@capagents/forgeqe 3.0.7 → 3.0.9

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 (129) hide show
  1. package/HOW_TO_USE.md +46 -50
  2. package/THIRD_PARTY_NOTICES.md +1018 -0
  3. package/dist/docs-site/docs/index.html +44 -39
  4. package/dist/docs-site/docs/search.js +1 -1
  5. package/dist/forgeqe.js +2110 -2023
  6. package/dist/web/assets/Agent-MlW7cfAm.js +7 -0
  7. package/dist/web/assets/AgentWork-BhepbEeU.js +2 -0
  8. package/dist/web/assets/ApiTests-mxUkUZvv.js +10 -0
  9. package/dist/web/assets/Browse-DENLuv4C.js +2 -0
  10. package/dist/web/assets/Chat-jxak1jci.js +3 -0
  11. package/dist/web/assets/CommandPalette-DMAmXPq1.js +1 -0
  12. package/dist/web/assets/Compare-DJNSrM2v.js +1 -0
  13. package/dist/web/assets/Cost-CEOZgbPs.js +1 -0
  14. package/dist/web/assets/Data-COFRpcJn.js +6 -0
  15. package/dist/web/assets/Desktop-DGNdy7iS.js +1 -0
  16. package/dist/web/assets/DesktopReview-SdAwvi9y.js +1 -0
  17. package/dist/web/assets/Evidence-DTrdEz3M.js +1 -0
  18. package/dist/web/assets/Explore-DDXgQj5Q.js +2 -0
  19. package/dist/web/assets/Features-BM5iXhOR.js +1 -0
  20. package/dist/web/assets/Flags-CkKp4bbv.js +2 -0
  21. package/dist/web/assets/Flaky-BqUHVLao.js +1 -0
  22. package/dist/web/assets/Impact-CA6s3POt.js +3 -0
  23. package/dist/web/assets/Jobs-B59p1qvn.js +5 -0
  24. package/dist/web/assets/KindPage-DPADNnwH.js +6 -0
  25. package/dist/web/assets/Migration-DtynahwR.js +2 -0
  26. package/dist/web/assets/PageAgent-CB8HtdGd.js +1 -0
  27. package/dist/web/assets/Product-wWMz2Nnk.js +7 -0
  28. package/dist/web/assets/Production-Nst6__N7.js +1 -0
  29. package/dist/web/assets/Quality-DgNo4H0u.js +1 -0
  30. package/dist/web/assets/Readiness--GiTxFZo.js +1 -0
  31. package/dist/web/assets/Record-a4whC1jV.js +1 -0
  32. package/dist/web/assets/Regression-hesOlN4G.js +5 -0
  33. package/dist/web/assets/{RelationGraph-Stj9gLlk.js → RelationGraph-C3Re0M1N.js} +1 -1
  34. package/dist/web/assets/Reports-C-NSlVAn.js +2 -0
  35. package/dist/web/assets/Response-CzX2rQEZ.js +9 -0
  36. package/dist/web/assets/RunDiff-CIdQD95y.js +1 -0
  37. package/dist/web/assets/Runs-DIDCOhbK.js +2 -0
  38. package/dist/web/assets/{Steps-DDNOjqR0.js → Steps-BOWDBzu4.js} +2 -2
  39. package/dist/web/assets/TestCases-D-ZRb2N7.js +1 -0
  40. package/dist/web/assets/TestData-kXWCn7uZ.js +2 -0
  41. package/dist/web/assets/TestDebt-BvP3w7ye.js +1 -0
  42. package/dist/web/assets/TestManagement-CphGo9DZ.js +1 -0
  43. package/dist/web/assets/Tosca-dhFuqYxV.js +3 -0
  44. package/dist/web/assets/WhatsNew-DpJWNec7.js +1 -0
  45. package/dist/web/assets/agentTabs-BO5l3zw2.js +1 -0
  46. package/dist/web/assets/dataParts-DeUdfjjv.js +3 -0
  47. package/dist/web/assets/diff-D1_Qo2h1.js +2 -0
  48. package/dist/web/assets/{families-C_rjd0Xf.js → families-DWilSDct.js} +1 -1
  49. package/dist/web/assets/filters-CVzIOjPG.js +1 -0
  50. package/dist/web/assets/{fold-BWrh257K.js → fold-BRxvbN9r.js} +1 -1
  51. package/dist/web/assets/frame-VTMu7MoC.js +13 -0
  52. package/dist/web/assets/index-CKRa-K2y.css +2 -0
  53. package/dist/web/assets/index-nuLrB-Rb.js +69 -0
  54. package/dist/web/assets/line-icons-C_amZ5-o.js +1 -0
  55. package/dist/web/assets/{logos-BGwyuzYI.js → logos-J6txZkKc.js} +1 -1
  56. package/dist/web/assets/{markdown-A9SeSXqj.js → markdown-CWisJbSJ.js} +7 -7
  57. package/dist/web/assets/paletteCommands-BmYmp6YY.js +1 -0
  58. package/dist/web/assets/parts-CDBCk_Xz.js +1 -0
  59. package/dist/web/assets/{productParts-Cuv1euHM.js → productParts-BxdHuSBa.js} +1 -1
  60. package/dist/web/assets/qualityParts-CGKSK9Dq.js +1 -0
  61. package/dist/web/assets/{recordTest-Bynmxkso.js → recordTest-CcplpTS6.js} +1 -1
  62. package/dist/web/assets/{rows-Vz0y1oXB.js → rows-yPc39hV7.js} +1 -1
  63. package/dist/web/index.html +6 -6
  64. package/docs/BASAL.md +61 -0
  65. package/docs/TEST_MANAGEMENT_PLAN.md +186 -15
  66. package/docs/user-guide.html +44 -39
  67. package/forgeqe.example.yaml +13 -0
  68. package/package.json +3 -1
  69. package/prompts/README.md +5 -2
  70. package/prompts/basal-cast.md +44 -0
  71. package/prompts/basal-rehearse.md +45 -0
  72. package/prompts/basal-strategist.md +49 -0
  73. package/prompts/basal-understand.md +46 -0
  74. package/prompts/brain.md +7 -10
  75. package/prompts/test-linker.md +43 -0
  76. package/py/forgeqe_testmgmt/__init__.py +1 -0
  77. package/py/forgeqe_testmgmt/pytest_collect.py +56 -0
  78. package/dist/web/assets/Agent-BPjox9-J.js +0 -8
  79. package/dist/web/assets/AgentWork-BrMSCnH9.js +0 -2
  80. package/dist/web/assets/ApiTests-BWkctGq_.js +0 -10
  81. package/dist/web/assets/Browse-BHkFgQm7.js +0 -2
  82. package/dist/web/assets/Chat-DN075IE2.js +0 -3
  83. package/dist/web/assets/CommandPalette-C4U1esum.js +0 -1
  84. package/dist/web/assets/Compare-BeuKSpJg.js +0 -1
  85. package/dist/web/assets/Cost-C0q4kFo_.js +0 -1
  86. package/dist/web/assets/Data-C0xGI6gj.js +0 -6
  87. package/dist/web/assets/Desktop-BPo9EQzU.js +0 -1
  88. package/dist/web/assets/DesktopReview-CbPOcaTp.js +0 -1
  89. package/dist/web/assets/Evidence-xBD_g-6G.js +0 -1
  90. package/dist/web/assets/Explore-AgY2mPFA.js +0 -2
  91. package/dist/web/assets/Features-CNQLzHNE.js +0 -1
  92. package/dist/web/assets/Flags-BYiygdEm.js +0 -2
  93. package/dist/web/assets/Flaky-zDUSG0D0.js +0 -1
  94. package/dist/web/assets/Impact-B7flvv3m.js +0 -3
  95. package/dist/web/assets/Jobs-KO_M1Z5x.js +0 -5
  96. package/dist/web/assets/KindPage-D6QT3D1p.js +0 -6
  97. package/dist/web/assets/Migration-CH3HvJkR.js +0 -2
  98. package/dist/web/assets/Product-B14vAOSF.js +0 -7
  99. package/dist/web/assets/Production-NgWNih7Q.js +0 -1
  100. package/dist/web/assets/Quality-C0InnJO5.js +0 -1
  101. package/dist/web/assets/Readiness-CKfe15YB.js +0 -1
  102. package/dist/web/assets/Record-Bo1qtSQJ.js +0 -1
  103. package/dist/web/assets/Regression-DKCF89mp.js +0 -5
  104. package/dist/web/assets/Reports-5y4wtUOg.js +0 -2
  105. package/dist/web/assets/Response-BZZNyAAR.js +0 -10
  106. package/dist/web/assets/RunDiff-DHvLXuxX.js +0 -1
  107. package/dist/web/assets/Runs-C9vsfEz2.js +0 -2
  108. package/dist/web/assets/TestCases-CwvwkJJK.js +0 -1
  109. package/dist/web/assets/TestData-fdvpO4sj.js +0 -2
  110. package/dist/web/assets/TestDebt-C0qy5pIJ.js +0 -1
  111. package/dist/web/assets/TestManagement-CAyj7lhx.js +0 -1
  112. package/dist/web/assets/Tosca-DsHjjrsa.js +0 -3
  113. package/dist/web/assets/WhatsNew-D30mYpbI.js +0 -1
  114. package/dist/web/assets/agentLink-yb-OobW-.js +0 -1
  115. package/dist/web/assets/dataParts-BXHRvarN.js +0 -3
  116. package/dist/web/assets/filters-DoEToSM9.js +0 -1
  117. package/dist/web/assets/frame-5jc7OkUQ.js +0 -7
  118. package/dist/web/assets/index-DAN0sMvE.js +0 -69
  119. package/dist/web/assets/index-T6cArIaU.css +0 -2
  120. package/dist/web/assets/line-icons-Cb4JZG1G.js +0 -1
  121. package/dist/web/assets/paletteCommands-BlTG5RlB.js +0 -1
  122. package/dist/web/assets/parts-B0-ARNQW.js +0 -1
  123. package/dist/web/assets/qualityParts-BFHdnu9w.js +0 -1
  124. package/dist/web/assets/segmented-ZM3wOT2F.js +0 -1
  125. package/dist/web/assets/thread-gzrCd4Os.js +0 -5
  126. package/dist/web/assets/usePageChat-CNhpFZ3D.js +0 -1
  127. package/docs/BUSINESS_ASSURANCE.md +0 -105
  128. package/prompts/business-interview.md +0 -43
  129. package/prompts/business-strategist.md +0 -44
@@ -1 +0,0 @@
1
- import{Dn as e,Er as t,Fr as n,M as r,Mn as i,Mr as a,Rr as o,Tt as s,a as c,at as l,hr as u,jr as d,kn as f,mn as p,un as m,w as h}from"./line-icons-Cb4JZG1G.js";import{H as g,V as _,a as v,c as y,ct as b,en as x,i as S,l as ee,o as C,p as te,pt as w,t as T,z as E}from"./filters-DoEToSM9.js";import{Q as D}from"./frame-5jc7OkUQ.js";import{n as O}from"./markdown-A9SeSXqj.js";import{k as ne,r as k}from"./index-DAN0sMvE.js";import{i as A,r as re}from"./segmented-ZM3wOT2F.js";import{a as j}from"./dataParts-BXHRvarN.js";var M=o(n(),1),N=x();function P(e){return(e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||``).replace(/\.(exe|app)$/i,``).toLowerCase().replace(/[^a-z0-9_.-]+/g,`-`).replace(/^[^a-z]+/,``).replace(/-+$/,``).slice(0,40)||`app`}function F({value:e,onChange:t,onPicked:n,onError:r,className:i}){let[a,o]=(0,M.useState)(!1),c=async()=>{o(!0),r(``);try{let e=await w.browse();`path`in e?(t(e.path),n?.(e.path,e.name)):`unavailable`in e&&r(e.unavailable)}catch(e){r(e.message)}finally{o(!1)}};return(0,N.jsxs)(`div`,{className:_(`flex min-w-0 gap-2`,i),children:[(0,N.jsx)(v,{"aria-label":`App's path`,value:e,spellCheck:!1,placeholder:`C:\\Program Files\\Contoso\\Billing.exe`,onChange:e=>t(e.target.value),className:`min-w-0 flex-1 font-mono text-[13px]`}),(0,N.jsxs)(E,{type:`button`,disabled:a,onClick:()=>void c(),"data-tip":`Choose the app's .exe on this computer`,children:[(0,N.jsx)(s,{"aria-hidden":`true`}),a?`Choosing…`:`Browse…`]})]})}var ie={click:[`target`,`timeout`,`note`],double_click:[`target`,`timeout`,`note`],type:[`target`,`text`,`timeout`,`note`],select:[`target`,`value`,`timeout`,`note`],keys:[`keys`,`note`],expect:[`target`,`text`,`timeout`,`note`],wait:[`seconds`,`note`],wait_for:[`target`,`text`,`timeout`,`note`],launch:[`timeout`,`note`],close:[`note`],expect_image:[`timeout`,`note`]};function I({p:e}){return(0,N.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,N.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-[13px] text-ink-2`,children:e.summary.map((e,t)=>(0,N.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,N.jsx)(`pre`,{className:`m-0 max-h-[200px] overflow-auto rounded-[10px] bg-surface-muted p-2 font-mono text-[13px] leading-relaxed whitespace-pre-wrap`,children:e.diff.map((e,t)=>(0,N.jsx)(`span`,{className:_(`block`,e.startsWith(`+`)?`text-pass`:e.startsWith(`-`)?`text-fail`:`text-muted`),children:e},t))})]})}function L({label:e,children:t}){return(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-[13px] font-medium`,children:[e,t]})}function ae({workflow:t,step:n,mode:r,onDone:i,onCancel:o}){let s=ie[n.op]??[`note`],c=n.fields??{},[l,d]=(0,M.useState)({automation_id:c.target?.automation_id??``,name:c.target?.name??``,control_type:c.target?.control_type??``}),[f,p]=(0,M.useState)(c.text??``),[m,g]=(0,M.useState)(c.value??``),[_,y]=(0,M.useState)(c.keys??``),[b,x]=(0,M.useState)(c.seconds===void 0?``:String(c.seconds)),[S,ee]=(0,M.useState)(c.timeout===void 0?``:String(c.timeout)),[C,te]=(0,M.useState)(c.note??``),[T,D]=(0,M.useState)(null),[O,ne]=(0,M.useState)(``),[k,A]=(0,M.useState)(!1),re=()=>{let e={};return s.includes(`target`)&&(l.automation_id!==(c.target?.automation_id??``)||l.name!==(c.target?.name??``)||l.control_type!==(c.target?.control_type??``))&&(e.target=l),s.includes(`text`)&&f!==(c.text??``)&&(e.text=f),s.includes(`value`)&&m!==(c.value??``)&&(e.value=m),s.includes(`keys`)&&_!==(c.keys??``)&&(e.keys=_),s.includes(`seconds`)&&b!==(c.seconds===void 0?``:String(c.seconds))&&(e.seconds=Number(b)),s.includes(`timeout`)&&S!==(c.timeout===void 0?``:String(c.timeout))&&S.trim()&&(e.timeout=Number(S)),s.includes(`note`)&&C!==(c.note??``)&&(e.note=C),e},j=async e=>{A(!0),ne(``);try{let a=await w.editStep({workflow:t,step:n.n,action:r,...r===`edit`?{fields:re()}:{},...e?{version:e}:{}});a.written?i():D(a)}catch(e){ne(e.message)}finally{A(!1)}};(0,M.useEffect)(()=>{r===`remove`&&j()},[]);let P=()=>D(null);return(0,N.jsxs)(`div`,{className:`mb-2 ml-10 flex flex-col gap-4 rounded-[12px] bg-surface-muted p-4`,children:[r===`edit`&&!T&&(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,180px),1fr))] gap-2`,children:[s.includes(`target`)&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(L,{label:`Control's name`,children:(0,N.jsx)(v,{size:`sm`,value:l.name,maxLength:300,onChange:e=>(d({...l,name:e.target.value}),P()),className:`bg-bg`})}),(0,N.jsx)(L,{label:`Automation id`,children:(0,N.jsx)(v,{size:`sm`,value:l.automation_id,maxLength:300,spellCheck:!1,onChange:e=>(d({...l,automation_id:e.target.value}),P()),className:`bg-bg font-mono text-[13px]`})}),(0,N.jsx)(L,{label:`Control type`,children:(0,N.jsx)(v,{size:`sm`,value:l.control_type,maxLength:60,spellCheck:!1,placeholder:`Button`,onChange:e=>(d({...l,control_type:e.target.value}),P()),className:`bg-bg`})})]}),s.includes(`text`)&&(0,N.jsx)(L,{label:n.op===`type`?`Text to type`:`Text it shows`,children:(0,N.jsx)(v,{size:`sm`,value:f,maxLength:500,onChange:e=>p(e.target.value),className:`bg-bg`})}),s.includes(`value`)&&(0,N.jsx)(L,{label:`Item to choose`,children:(0,N.jsx)(v,{size:`sm`,value:m,maxLength:500,onChange:e=>g(e.target.value),className:`bg-bg`})}),s.includes(`keys`)&&(0,N.jsx)(L,{label:`Keys`,children:(0,N.jsx)(v,{size:`sm`,value:_,maxLength:100,spellCheck:!1,placeholder:`ctrl+s`,onChange:e=>y(e.target.value),className:`bg-bg font-mono text-[13px]`})}),s.includes(`seconds`)&&(0,N.jsx)(L,{label:`Wait (seconds)`,children:(0,N.jsx)(v,{size:`sm`,type:`number`,min:0,max:600,value:b,onChange:e=>x(e.target.value),className:`bg-bg`})}),s.includes(`timeout`)&&(0,N.jsx)(L,{label:`Timeout (seconds)`,children:(0,N.jsx)(v,{size:`sm`,type:`number`,min:0,max:600,value:S,placeholder:`default`,onChange:e=>ee(e.target.value),className:`bg-bg`})}),s.includes(`note`)&&(0,N.jsx)(L,{label:`Note`,children:(0,N.jsx)(v,{size:`sm`,value:C,maxLength:200,onChange:e=>te(e.target.value),className:`bg-bg`})})]}),r===`remove`&&!T&&!O&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Working out the change…`}),T&&(0,N.jsx)(I,{p:T}),O&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:O}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[T?(0,N.jsxs)(E,{size:`sm`,variant:r===`remove`?`destructive`:`primary`,disabled:k,onClick:()=>void j(T.version),children:[r===`remove`?(0,N.jsx)(u,{"aria-hidden":`true`}):(0,N.jsx)(h,{"aria-hidden":`true`}),k?`Saving…`:r===`remove`?`Delete step ${n.n}`:`Save the change`]}):r===`edit`&&(0,N.jsx)(E,{size:`sm`,variant:`primary`,disabled:k||!Object.keys(re()).length,onClick:()=>void j(),children:k?`Checking…`:`Preview the change`}),T&&r===`edit`&&(0,N.jsxs)(E,{size:`sm`,onClick:()=>D(null),children:[(0,N.jsx)(e,{"aria-hidden":`true`}),`Change it more`]}),(0,N.jsxs)(E,{size:`sm`,variant:`ghost`,onClick:o,children:[(0,N.jsx)(a,{"aria-hidden":`true`}),`Cancel`]})]})]})}var R=[{id:`typed`,label:`As typed`,note:`The workflow types exactly this.`},{id:`data`,label:`Test data`,note:`A named value the replay fills in: its own value, a row of a data file, or one you give when it runs.`},{id:`secret`,label:`Secret`,note:`Read from an environment variable when it replays; what was typed leaves the workflow.`}],z={replay:[`Replaying the workflow`,`Replayed the workflow`,`working`],validate:[`Checking the workflow`,`Checked the workflow`,`searching`]};async function oe(e){let t=await w.editStep(e);await w.editStep({...e,version:t.version})}var B=[{id:`check_text`,label:`Check a control shows a text`,control:!0,text:`need`},{id:`check_present`,label:`Check a control is there`,control:!0},{id:`wait_for`,label:`Wait for a control`,control:!0,text:`may`},{id:`wait_gone`,label:`Wait until a control is gone`,control:!0},{id:`wait`,label:`Wait some seconds`,control:!1},{id:`keys`,label:`Press keys`,control:!1}];function se({step:e,onAdd:t}){let[n,r]=(0,M.useState)(`check_text`),a=e.fields?.target,[o,s]=(0,M.useState)({name:a?.name??``,automation_id:a?.automation_id??``,control_type:a?.control_type??``}),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(`2`),[f,p]=(0,M.useState)(``),m=B.find(e=>e.id===n),h=m.control?!!(o.name.trim()||o.automation_id.trim())&&(m.text!==`need`||!!c.trim()):n===`wait`?Number(u)>0:!!f.trim();return(0,N.jsxs)(`form`,{className:`flex flex-col gap-2 p-4`,onSubmit:e=>{e.preventDefault(),h&&t({kind:n,...m.control?{target:o}:{},...m.text&&c.trim()?{text:c}:{},...n===`wait`?{seconds:Number(u)}:{},...n===`keys`?{keys:f}:{}})},children:[(0,N.jsxs)(`p`,{className:`m-0 text-[13px] font-semibold`,children:[`After step `,e.n]}),(0,N.jsx)(C,{size:`sm`,"aria-label":`What to add`,value:n,onChange:e=>r(e.target.value),children:B.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.label},e.id))}),m.control&&(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,N.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Control's name`,(0,N.jsx)(v,{size:`sm`,value:o.name,maxLength:300,onChange:e=>s({...o,name:e.target.value})})]}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Automation id`,(0,N.jsx)(v,{size:`sm`,value:o.automation_id,maxLength:300,spellCheck:!1,onChange:e=>s({...o,automation_id:e.target.value}),className:`font-mono text-[13px]`})]})]}),m.text&&(0,N.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[m.text===`need`?`The text it shows`:`Showing the text (optional)`,(0,N.jsx)(v,{size:`sm`,value:c,maxLength:500,placeholder:`Invoice saved`,onChange:e=>l(e.target.value)})]}),n===`wait`&&(0,N.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Seconds`,(0,N.jsx)(v,{size:`sm`,type:`number`,min:1,max:600,value:u,onChange:e=>d(e.target.value)})]}),n===`keys`&&(0,N.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Keys`,(0,N.jsx)(v,{size:`sm`,value:f,maxLength:100,spellCheck:!1,placeholder:`ctrl+s`,onChange:e=>p(e.target.value),className:`font-mono text-[13px]`})]}),(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`The control is filled from this step's; change it for another. A wait for a control is better than a fixed wait.`}),(0,N.jsxs)(E,{type:`submit`,size:`sm`,variant:`primary`,disabled:!h,className:`self-start`,children:[(0,N.jsx)(i,{"aria-hidden":`true`}),`Add`]})]})}var V=e=>e.name||e.automation_id||`the control`;function ce({pictures:e,step:t,busy:n,onPick:r}){let[i,a]=(0,M.useState)(0),o=e[Math.min(i,e.length-1)],[s,c]=(0,M.useState)(``),[l,u]=(0,M.useState)(``),[d,f]=(0,M.useState)(null);(0,M.useEffect)(()=>{let e=!1;return c(``),u(``),f(null),w.shot(o.run,o.n).then(t=>!e&&c(t),t=>!e&&u(t.message)),w.controls(o.run,o.n).then(t=>!e&&f(t),()=>{}),()=>{e=!0}},[o.run,o.n]);let p=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`,[m,h]=(0,M.useState)(!1),g=d&&d.w>0?[...d.controls].sort((e,t)=>t.w*t.h-e.w*e.h):[];return(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.length>1&&(0,N.jsx)(`div`,{role:`radiogroup`,"aria-label":`Pictures of step ${t}`,className:`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,children:e.map((e,t)=>(0,N.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===i,onClick:()=>a(t),className:A(t===i),children:e.label},e.label))}),(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[o.note,g.length>0?` Click a control to check that it shows its text, or that it is there.`:``]})]}),l&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:l}),!s&&!l&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading the picture…`}),s&&(0,N.jsxs)(`div`,{className:_(`relative w-full overflow-hidden rounded-[10px] border border-line-soft`,m?`max-w-[360px]`:`max-w-[720px]`),style:g.length?{aspectRatio:`${d.w} / ${d.h}`}:void 0,children:[(0,N.jsx)(`img`,{src:s,alt:`The app after step ${t}, ${o.label.toLowerCase()}`,onLoad:e=>h(e.currentTarget.naturalHeight>e.currentTarget.naturalWidth),className:g.length?`absolute inset-0 size-full object-fill`:`block w-full`}),g.map((e,t)=>{let i=e.text?`Check ${V(e)} shows "${e.text}"`:`Check ${V(e)} is there`;return(0,N.jsx)(`button`,{type:`button`,disabled:n,"aria-label":i,"data-tip":i,onClick:()=>r({target:{...e.automation_id?{automation_id:e.automation_id}:{},...e.name?{name:e.name}:{},...e.control_type?{control_type:e.control_type}:{}},...e.text?{text:e.text}:{}}),className:`absolute cursor-pointer rounded-[3px] border-0 bg-transparent p-0 outline-none hover:bg-accent/15 hover:ring-2 hover:ring-accent focus-visible:bg-accent/15 focus-visible:ring-2 focus-visible:ring-accent`,style:{left:p(e.x,d.w),top:p(e.y,d.h),width:p(e.w,d.w),height:p(e.h,d.h)}},`${t}-${e.automation_id||e.name}`)})]})]})}function le({v:e,secrets:t,onSave:n,busy:r,mobile:i=!1}){let[a,o]=(0,M.useState)(e.as),[s,c]=(0,M.useState)(e.name??``),[l,u]=(0,M.useState)(e.value??``);(0,M.useEffect)(()=>{o(e.as),c(e.name??``),u(e.value??``)},[e]);let d=R.filter(t=>e.op===`type`||t.id!==`secret`),f=a!==e.as||s!==(e.name??``)||l!==(e.value??``),p=a===`typed`?!0:a===`data`?/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(s):/^[A-Z_][A-Z0-9_]{0,63}$/.test(s);return(0,N.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2 border-t border-line-soft px-4 py-2 first:border-t-0`,children:[(0,N.jsx)(`span`,{className:`w-6 flex-none pt-2 text-right font-mono text-[13px] text-muted tabular-nums`,children:e.n}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col pt-2`,children:[(0,N.jsx)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,N.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:R.find(e=>e.id===a)?.note})]}),(0,N.jsxs)(`span`,{className:`flex flex-[1_1_360px] flex-wrap items-center gap-2`,children:[(0,N.jsx)(C,{"aria-label":`Where the value of step ${e.n} comes from`,value:a,disabled:r,onChange:e=>o(e.target.value),className:`w-[150px] flex-none`,children:d.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.label},e.id))}),a!==`typed`&&(0,N.jsx)(v,{"aria-label":a===`secret`?`The secret's environment variable`:`The test data's name`,value:s,maxLength:64,spellCheck:!1,list:a===`secret`?`desktop-secrets`:void 0,placeholder:a===`secret`?`BILLING_PASSWORD`:`customer`,onChange:e=>c(a===`secret`?e.target.value.toUpperCase():e.target.value),className:`w-[170px] flex-none font-mono text-[13px]`}),a!==`secret`&&(0,N.jsx)(v,{"aria-label":a===`data`?`Its value`:`The value`,value:l,maxLength:500,onChange:e=>u(e.target.value),className:`min-w-[140px] flex-1`}),a===`secret`&&!t.includes(s)&&s&&(0,N.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Not in `,i?`mobile.secrets`:`desktop.secrets`,` yet`]}),(0,N.jsxs)(E,{size:`sm`,variant:`primary`,disabled:r||!f||!p,onClick:()=>n(a,a===`typed`?void 0:s,a===`secret`?void 0:l),children:[(0,N.jsx)(h,{"aria-hidden":`true`}),`Save`]})]}),(0,N.jsx)(`datalist`,{id:`desktop-secrets`,children:t.map(e=>(0,N.jsx)(`option`,{value:e},e))})]})}function ue({view:e,job:t,rows:n,onRun:r,busy:i,heal:a}){let[o,s]=(0,M.useState)(()=>Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(a),[p,m]=(0,M.useState)(!1),h=e.lastRun,_=c.startsWith(`file:`)?{file:c.slice(5)}:c.startsWith(`request:`)?{request:c.slice(8)}:void 0,b=t&&t.kind===`replay`&&t.target===e.workflow.path;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Replay plays the steps in the app with no model, as a scheduled run or CI will, and takes over the mouse and keyboard while it runs: use a test machine and a test account.`}),(0,N.jsxs)(`form`,{className:`flex flex-col gap-4 rounded-[12px] card border p-4`,onSubmit:e=>{e.preventDefault(),r({variables:o,..._?{rows:_}:{},heal:u,updateBaselines:p})},children:[e.variables.length>0&&(0,N.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,180px),1fr))] gap-4`,children:e.variables.map(e=>(0,N.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[e.name,(0,N.jsx)(v,{value:o[e.name]??``,onChange:t=>s({...o,[e.name]:t.target.value})})]},e.name))}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,N.jsxs)(`label`,{className:`flex min-w-[220px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Test data`,(0,N.jsxs)(C,{value:c,onChange:e=>l(e.target.value),children:[(0,N.jsx)(`option`,{value:``,children:`Once, with the values above`}),n.files.map(e=>(0,N.jsxs)(`option`,{value:`file:${e}`,children:[`Each row of `,e]},e)),n.requests.map(e=>(0,N.jsxs)(`option`,{value:`request:${e}`,children:[`Each row of request `,e]},e))]})]}),(0,N.jsxs)(`label`,{className:`flex min-h-10 items-center gap-2 text-sm text-ink-2`,children:[(0,N.jsx)(D,{checked:u,onChange:d,label:`Heal a step whose control moved`}),`Heal a moved control`]}),(0,N.jsxs)(`label`,{className:`flex min-h-10 items-center gap-2 text-sm text-ink-2`,children:[(0,N.jsx)(D,{checked:p,onChange:m,label:`Take new image baselines`}),`New image baselines`]}),(0,N.jsx)(`span`,{className:`flex-1`}),(0,N.jsxs)(E,{type:`submit`,variant:`primary`,disabled:i,children:[(0,N.jsx)(f,{"aria-hidden":`true`}),`Replay`]})]})]}),b&&(0,N.jsx)(j,{job:t,onStop:()=>void w.stop(),words:z}),h?(0,N.jsxs)(`section`,{"aria-labelledby":`desktop-last-run`,className:`flex flex-col gap-2`,children:[(0,N.jsx)(`h3`,{id:`desktop-last-run`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Last replay`}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-[12px] card border px-4 py-2 text-sm`,children:[(0,N.jsx)(y,{tone:h.ok?`pass`:`fail`,children:h.many?`${h.many.passed} of ${h.many.total} passed`:h.ok?`Passed`:`Failed`}),(0,N.jsxs)(`span`,{className:`text-muted`,children:[k(h.at),` · `,g(e.replays,`replay`),` in all`]}),h.failed&&(0,N.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Step `,h.failed.index,`: `,h.failed.error]}),(0,N.jsx)(`span`,{className:`flex-1`}),h.report&&(0,N.jsx)(O,{path:h.report,children:`Report`})]})]}):(0,N.jsx)(ee,{className:`py-4`,children:`Not replayed yet.`})]})}function de({workflow:n,onClose:o,backLabel:s=`Back`,notices:v}){let[x,C]=(0,M.useState)(null),[D,O]=(0,M.useState)(``),[k,j]=(0,M.useState)(!1),[P,F]=(0,M.useState)(`steps`),[ie,I]=(0,M.useState)(``),[L,R]=(0,M.useState)(`all`),[z,B]=(0,M.useState)(null),[V,de]=(0,M.useState)(null),[H,U]=(0,M.useState)(null),[fe,W]=(0,M.useState)(``),[G,pe]=(0,M.useState)(null),[me,he]=(0,M.useState)({files:[],requests:[]}),[ge,_e]=(0,M.useState)(!0),K=(0,M.useCallback)(()=>{w.review(n).then(e=>{C(e),O(``)},e=>O(e.message))},[n]);(0,M.useEffect)(K,[K]);let q=(0,M.useCallback)(()=>{w.view().then(e=>{pe(e.job),he(e.rows),_e(e.heal)},()=>{})},[]);(0,M.useEffect)(q,[q]);let J=!!G?.running;(0,M.useEffect)(()=>{if(!J)return;let e=setInterval(q,1e3);return()=>clearInterval(e)},[J,q]);let ve=G&&!G.running?G.endedAt:``;(0,M.useEffect)(()=>{ve&&K()},[ve,K]);let Y=async(e,t)=>{j(!0),O(``),W(``);try{await e(),K(),t&&W(t)}catch(e){O(e.message)}finally{j(!1)}},ye=e=>void b.start(e,{}).then(({id:e})=>location.hash=te(`chats`,e),e=>O(e.message));if(!x)return D?(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:D}):(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Opening the workflow…`});let X=x.workflow.kind===`mobile`,Z=x.lastRun,be=new Map((Z?.results??[]).map(e=>[e.n,e])),xe=!!Z&&Date.parse(x.workflow.modified)>Date.parse(Z.at),Se=x.steps.filter(e=>e.op.startsWith(`expect`)).length,Q=Z&&!Z.ok?Z.failed?.index??0:0,$=Q?x.steps[Q-1]:void 0,Ce=(Z?.results??[]).filter(e=>!e.ok).length,we=ie.toLowerCase().split(/\s+/).filter(Boolean),Te=x.steps.filter(e=>we.every(t=>`${e.n} ${e.text} ${e.fields?.note||``}`.toLowerCase().includes(t))&&(L===`all`||(L===`checks`?e.op.startsWith(`expect`):be.get(e.n)?.ok===!1))),Ee=e=>{F(`steps`),R(`all`),I(``),requestAnimationFrame(()=>document.getElementById(`dstep-${e}`)?.scrollIntoView({block:`center`,behavior:`smooth`}))},De=e=>void Y(async()=>{await w.replay({workflow:x.workflow.path,...e}),q()},X?`Replaying on the device: a device cloud can take a minute or two to start it.`:`Replaying: the app opens on this computer.`),Oe=[{id:`steps`,label:`Steps`,n:x.steps.length},{id:`data`,label:`Test data`,n:x.values.length},{id:`run`,label:`Last run`}];return(0,N.jsxs)(`section`,{"aria-labelledby":`dreview-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,N.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-1 flex flex-col gap-4 border-b border-line bg-bg px-1 py-4`,children:[o&&(0,N.jsx)(`div`,{children:(0,N.jsxs)(E,{size:`sm`,variant:`ghost`,onClick:o,className:`-ml-2 text-ink-2`,children:[(0,N.jsx)(c,{"aria-hidden":`true`}),s]})}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,N.jsx)(`h2`,{id:`dreview-title`,className:`m-0 min-w-0 truncate text-lg font-semibold`,"data-tip":x.workflow.name,children:x.workflow.name}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,N.jsxs)(`span`,{children:[x.workflow.app||`no app`,` · `,g(x.steps.length,`step`),` · `,g(Se,`check`)]}),J&&G?.target===x.workflow.path?(0,N.jsx)(y,{tone:`running`,children:`Replaying…`}):Z?(0,N.jsx)(y,{tone:Z.ok?`pass`:`fail`,children:Z.ok?`Last replay passed`:Q?`Last replay failed at step ${Q}`:`Last replay did not get through`}):(0,N.jsx)(y,{tone:`neutral`,icon:!1,children:`Not replayed yet`}),xe&&(0,N.jsx)(`span`,{children:`· you changed it since`})]})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(E,{onClick:()=>ye(`${X?`Look at the mobile workflow`:`DeskPilot: look at the desktop workflow`} ${x.workflow.path} and tell me what to fix or add (a wait, a timeout, a dialog to dismiss, checks of the outcome); change it with desktop_edit_workflow only after showing me the change.`),"data-tip":X?`Ask the agent to improve it`:`Ask DeskPilot to improve it`,children:[(0,N.jsx)(t,{"aria-hidden":`true`}),`Improve`]}),(0,N.jsxs)(E,{variant:`primary`,disabled:J,onClick:()=>F(`run`),"data-tip":J?`A replay is going`:`Replay it with no model`,children:[(0,N.jsx)(f,{"aria-hidden":`true`}),`Replay`]})]})]})]}),v,D&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:D}),fe&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-pass-soft px-4 py-2 text-[13px] text-pass`,children:fe}),Z&&!Z.ok&&(0,N.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 rounded-[12px] border border-fail/30 bg-fail-soft px-4 py-4 text-sm`,children:[(0,N.jsxs)(`p`,{className:`m-0 font-semibold text-fail`,children:[Q?`Step ${Q} failed`:`The replay did not get through`,xe&&(0,N.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),$&&(0,N.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:$.text}),(0,N.jsx)(`p`,{className:`m-0 line-clamp-3 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:Z.failed?.error||Z.error||`It failed.`}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$&&(0,N.jsxs)(E,{size:`sm`,onClick:()=>Ee(Q),children:[(0,N.jsx)(l,{"aria-hidden":`true`}),`Show`]}),$&&Q>1&&(0,N.jsxs)(E,{size:`sm`,onClick:()=>(Ee(Q),U({n:Q,mode:`edit`})),"data-tip":`Change the failed step: its control, text or timeout`,children:[(0,N.jsx)(e,{"aria-hidden":`true`}),`Change`]}),(0,N.jsxs)(E,{size:`sm`,variant:`ghost`,onClick:()=>ye(`${X?`The`:`DeskPilot: the`} last replay of ${x.workflow.path} failed${Q?` at step ${Q}`:``}. Read its report (${Z.dir}), tell me why, and offer a fix.`),children:[(0,N.jsx)(m,{"aria-hidden":`true`}),`Ask why`]})]})]}),Z&&Z.ok&&Z.heals>0&&!Z.healsAccepted&&(0,N.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-4 rounded-[12px] bg-accent-soft px-4 py-2 text-sm`,children:[(0,N.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`The last replay found `,g(Z.heals,`moved control`),` and healed `,Z.heals===1?`it`:`them`,`: write the new locators into the workflow?`]}),(0,N.jsxs)(E,{size:`sm`,disabled:k,onClick:()=>void Y(()=>w.acceptHeals(Z.dir),`The healed locators are in the workflow.`),children:[(0,N.jsx)(d,{"aria-hidden":`true`}),`Accept`]})]}),(0,N.jsx)(`div`,{role:`tablist`,"aria-label":`This workflow`,className:re,children:Oe.map(e=>(0,N.jsxs)(`button`,{type:`button`,role:`tab`,id:`dreview-tab-${e.id}`,"aria-selected":P===e.id,"aria-controls":`dreview-panel-${e.id}`,onClick:()=>F(e.id),className:A(P===e.id),children:[e.label,e.n!==void 0&&(0,N.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:e.n}),e.id===`run`&&Z&&(0,N.jsx)(`span`,{"aria-label":Z.ok?`passed`:`failed`,className:_(`size-2 rounded-full`,Z.ok?`bg-pass`:`bg-fail`)})]},e.id))}),(0,N.jsxs)(`div`,{role:`tabpanel`,id:`dreview-panel-${P}`,"aria-labelledby":`dreview-tab-${P}`,className:`flex min-w-0 flex-col gap-4`,children:[P===`steps`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(S,{id:`dreview-step-search`,label:`Find a step`,value:ie,onChange:I}),(0,N.jsx)(T,{items:[{id:`all`,label:`All`,n:x.steps.length},{id:`checks`,label:`Checks`,n:Se},...Ce?[{id:`failed`,label:`Failed`,n:Ce,alert:!0}]:[]],value:L,onChange:R})]}),Se===0&&(0,N.jsx)(`p`,{className:`m-0 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:`No checks of the outcome: a replay passes when its steps run. Add one with + after the step whose result matters.`}),Te.length===0?(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] card border px-4 py-4 text-sm text-muted`,children:`No step matches.`}):(0,N.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 [&>li:first-child]:rounded-t-[12px] [&>li:last-child]:rounded-b-[12px]`,children:Te.map((t,n)=>{let o=be.get(t.n),s=t.op.startsWith(`expect`),c=x.recorded?.shots[t.n],d=[...c&&x.recorded?[{label:`When recorded`,run:x.recorded.run,n:c,note:`The app after step ${t.n} as you recorded it.`}]:[],...o?.shot&&Z?[{label:`Last replay`,run:Z.dir,n:t.n,note:`The app after step ${t.n} on the last replay${xe?`, before your last change`:``}.`}]:[]];return(0,N.jsxs)(`li`,{id:`dstep-${t.n}`,className:_(`flex scroll-mt-48 flex-col`,n>0&&`border-t border-line-soft`,o&&!o.ok&&`bg-fail-soft`),children:[(0,N.jsxs)(`div`,{className:`group flex min-h-11 items-start gap-4 px-4 py-2`,children:[(0,N.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right font-mono text-[13px] text-muted tabular-nums`,children:t.n}),(0,N.jsx)(`span`,{className:`flex w-4 flex-none justify-center pt-1`,children:o?o.ok?(0,N.jsx)(h,{size:14,strokeWidth:2.5,"aria-label":`Passed on the last replay`,className:`text-pass`}):(0,N.jsx)(a,{size:14,strokeWidth:2.5,"aria-label":`Failed on the last replay`,className:`text-fail`}):Z?(0,N.jsx)(p,{size:14,"aria-label":`Not replayed`,className:`text-muted`}):s?(0,N.jsx)(r,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1 size-1.5 rounded-full bg-line-strong`})}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[s&&(0,N.jsx)(y,{tone:`pass`,icon:!1,className:`min-h-5 px-2 text-[13px]`,children:`Check`}),t.op.startsWith(`wait`)&&(0,N.jsx)(y,{tone:`neutral`,icon:!1,className:`min-h-5 px-2 text-[13px]`,children:`Wait`}),(0,N.jsx)(`span`,{className:`min-w-0 text-[13px] text-ink [overflow-wrap:anywhere]`,children:t.text}),o?.healed&&(0,N.jsx)(y,{tone:`warn`,icon:!1,className:`min-h-5 px-2 text-[13px]`,children:`Healed`})]}),t.fields?.note&&(0,N.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Note: `,t.fields.note]}),o&&!o.ok&&o.error&&(0,N.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-fail [overflow-wrap:anywhere]`,"data-tip":o.error,children:o.error})]}),(0,N.jsxs)(`span`,{className:`relative flex flex-none items-center gap-1`,children:[(0,N.jsx)(E,{size:`icon`,variant:`icon`,disabled:k,"aria-haspopup":`dialog`,"aria-expanded":z===t.n,"aria-label":`Add a check or wait after step ${t.n}`,"data-tip":`Add a check or wait after step ${t.n}`,onClick:()=>B(z===t.n?null:t.n),className:`size-8`,children:(0,N.jsx)(i,{"aria-hidden":`true`})}),(0,N.jsx)(ne,{open:z===t.n,onClose:()=>B(null),label:`Add after step ${t.n}`,role:`dialog`,side:`auto`,className:`right-0 w-[min(360px,calc(100vw-48px))]`,children:(0,N.jsx)(se,{step:t,onAdd:e=>{B(null),Y(()=>oe({workflow:x.workflow.path,step:t.n,action:`insert`,...e}),`Added after step ${t.n}.`)}})}),d.length>0&&(0,N.jsx)(E,{size:`icon`,variant:`icon`,"aria-label":`See the app after step ${t.n}`,"aria-expanded":V===t.n,"data-tip":`See the app after step ${t.n}`,onClick:()=>de(V===t.n?null:t.n),className:`size-8`,children:(0,N.jsx)(l,{"aria-hidden":`true`})}),(0,N.jsx)(E,{size:`icon`,variant:`icon`,"aria-label":`Change step ${t.n}`,"data-tip":`Change step ${t.n}`,onClick:()=>U({n:t.n,mode:`edit`}),className:`size-8`,children:(0,N.jsx)(e,{"aria-hidden":`true`})}),t.n>1&&(0,N.jsx)(E,{size:`icon`,variant:`icon`,"aria-label":`Drop step ${t.n}`,"data-tip":`Drop step ${t.n}`,onClick:()=>U({n:t.n,mode:`remove`}),className:`size-8 hover:text-fail`,children:(0,N.jsx)(u,{"aria-hidden":`true`})})]})]}),H&&H.n===t.n&&(0,N.jsx)(`div`,{className:`pr-4`,children:(0,N.jsx)(ae,{workflow:x.workflow.path,step:t,mode:H.mode,onCancel:()=>U(null),onDone:()=>{W(H.mode===`remove`?`Step ${t.n} dropped.`:`Step ${t.n} changed.`),U(null),K()}},`${t.n}-${H.mode}`)}),V===t.n&&d.length>0&&(0,N.jsx)(ce,{pictures:d,step:t.n,busy:k,onPick:e=>void Y(()=>oe({workflow:x.workflow.path,step:t.n,action:`insert`,kind:e.text?`check_text`:`check_present`,target:e.target,...e.text?{text:e.text}:{}}),e.text?`Added after step ${t.n}: a check that ${e.target.name||e.target.automation_id} shows "${e.text}".`:`Added after step ${t.n}: a check that ${e.target.name||e.target.automation_id} is there.`)})]},`${t.n}-${t.text}`)})})]}),P===`data`&&(x.values.length===0?(0,N.jsx)(ee,{className:`py-4`,children:`Nothing is typed or chosen in this workflow, so it has no test data.`}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Where each value typed or chosen comes from when it replays. Test data can come from a data file's rows on the Last run tab.`}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:x.values.map(e=>(0,N.jsx)(le,{v:e,secrets:x.secrets,mobile:X,busy:k,onSave:(t,n,r)=>void Y(()=>oe({workflow:x.workflow.path,step:e.n,action:`data`,as:t,...n===void 0?{}:{name:n},...r===void 0?{}:{value:r}}),t===`secret`?`Step ${e.n} types the secret ${n}; what was typed left the workflow.`:`Step ${e.n} saved.`)},e.n))})]})),P===`run`&&(0,N.jsx)(ue,{view:x,job:G,rows:X?{...me,requests:[]}:me,heal:ge,busy:k||J,onRun:De})]})]})}export{F as n,P as r,de as t};
@@ -1 +0,0 @@
1
- import{$n as e,Bn as t,D as n,Dt as r,E as i,Fr as a,L as o,M as s,Mn as c,Mr as l,O as u,Qt as d,R as f,Rr as p,Ut as m,Yn as h,_ as g,a as _,bt as v,ct as y,dn as ee,en as b,gt as x,jr as S,k as C,nt as w,un as T,vr as E,w as D,x as te,z as ne,zn as re}from"./line-icons-Cb4JZG1G.js";import{H as O,V as k,a as ie,c as A,en as ae,f as j,g as oe,gt as M,i as se,l as N,o as P,p as F,s as I,z as L}from"./filters-DoEToSM9.js";import{B as ce,H as le,U as ue,V as de,W as fe,at as pe,in as me,r as he,t as ge,z as R}from"./frame-5jc7OkUQ.js";import{s as _e}from"./markdown-A9SeSXqj.js";import{i as ve,r as z,s as ye}from"./index-DAN0sMvE.js";import{t as be}from"./segmented-ZM3wOT2F.js";import{t as xe}from"./families-C_rjd0Xf.js";import{i as B,r as V}from"./productParts-Cuv1euHM.js";var H=p(a(),1),U=ae(),Se={"forgeqe-session":`ForgeQE session`,otlp:`OpenTelemetry trace`,jsonl:`the agent's own log`,langfuse:`Langfuse`,langsmith:`LangSmith`},Ce={tool:S,model:e,say:T,plan:b,handoff:re,ask:T,policy:h,error:E},we={text:`What it said`,file_change:`A file it changed`,report:`A report`,test_result:`A test result`,message:`A message it sent`},Te={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`},W=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`),G=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`})},K=25,q={PASS:{tone:`pass`,label:`Pass`},WARN:{tone:`warn`,label:`Warning`},FAIL:{tone:`fail`,label:`Fail`},UNKNOWN:{tone:`neutral`,label:`Not known`}},J={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`},Ee={build:{title:`Does the change work?`,icon:v},behaviour:{title:`Did it work the agreed way?`,icon:ne},decisions:{title:`Did it decide on the right grounds, with data it may use?`,icon:t},content:{title:`Was its answer right: on topic, grounded, complete?`,icon:y},domain:{title:`Was its change right for the product?`,icon:g}},Y=200;function X({id:e,children:t}){let n=xe.some(t=>t.id===e);return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,U.jsx)(pe,{pixel:me[e],size:`lg`}),(0,U.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:t})]}),n&&(0,U.jsx)(be,{label:`Governance`,links:xe,current:e})]})}function Z(){return(0,U.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function De(){return(0,U.jsxs)(N,{icon:v,title:`No agent run recorded yet`,children:[`Receive an agent's OpenTelemetry traces while it runs with `,(0,U.jsx)(`code`,{children:`forgeqe evidence receive`}),`; record a file with `,(0,U.jsx)(`code`,{children:`forgeqe evidence record`}),`: an OpenTelemetry export, a Langfuse or LangSmith export, an agent's own JSON log with `,(0,U.jsx)(`code`,{children:`--mapping mapping.yaml`}),`, or ForgeQE's own last session with `,(0,U.jsx)(`code`,{children:`--latest`}),`.`]})}function Oe({refused:e}){return e.length?(0,U.jsxs)(`section`,{"aria-label":`Files that are not run records`,className:`flex flex-col gap-1 rounded-[12px] bg-warn-soft px-4 py-2 text-sm text-ink-2`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[O(e.length,`file`),` in the runs folder `,e.length===1?`is`:`are`,` not a run record and `,e.length===1?`is`:`are`,` not shown:`]}),e.slice(0,10).map(e=>(0,U.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}):null}function ke(){let[t,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(``);return(0,H.useEffect)(()=>{M.overview().then(n,e=>i(e.message))},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence`,children:`Evidence`}),(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`What AI agents did, how, what they decided and why, and what data they used, from the records of their runs. What an agent says about its own work is kept as a claim, to be checked against what it did; what a record cannot say is listed, never guessed.`}),r&&(0,U.jsx)(V,{text:r}),!t&&!r&&(0,U.jsx)(Z,{}),t&&(0,U.jsx)(Oe,{refused:t.refused}),t&&!t.runs&&(0,U.jsx)(De,{}),t&&t.runs>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.runs}),` `,t.runs===1?`run`:`runs`,` recorded`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.agents.length}),` `,t.agents.length===1?`agent`:`agents`]})]}),(0,U.jsx)(`h2`,{className:`sr-only`,children:`What is recorded`}),(0,U.jsx)(B,{id:`agents`,title:`Agents`,icon:e,n:t.agents.length,children:(0,U.jsx)(`ul`,{"aria-label":`Agents`,className:`m-0 list-none rounded-[14px] card border p-2`,children:t.agents.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:F(`evidence`,encodeURIComponent(e.name)),className:`flex min-h-12 flex-wrap items-center gap-x-4 gap-y-1 rounded-[10px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:W(e.name)}),(0,U.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[e.versions.length?`versions ${e.versions.slice(0,4).join(`, `)}${e.versions.length>4?`, …`:``} · `:``,`from `,e.sources.map(e=>Se[e]||e).join(`, `)]})]}),(0,U.jsx)(`span`,{className:`text-[13px] text-ink-2 tabular-nums`,children:O(e.runs,`run`)}),(0,U.jsx)(`span`,{className:`text-[13px] text-ink-2 tabular-nums`,children:O(e.decisions,`decision`)}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:[O(e.gaps,`thing`,`things`),` not known`]}),(0,U.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:e.contract?`${e.contract.approved?`Contract approved`:`Contract not approved`}: ${[`FAIL`,`WARN`,`UNKNOWN`,`PASS`].filter(t=>e.verdicts[t]).map(t=>O(e.verdicts[t],{FAIL:`failed run`,WARN:`warning`,UNKNOWN:`not known`,PASS:`passed run`}[t],{FAIL:`failed runs`,WARN:`warnings`,UNKNOWN:`not known`,PASS:`passed runs`}[t])).join(`, `)}`:`No contract`}),(0,U.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,"data-tip":G(e.last),children:e.last?z(e.last):``})]})},e.name))})})]})]})}var Ae={PASS:`Passed`,WARN:`Warned`,FAIL:`Failed`,UNKNOWN:`Not known`,NONE:`Not judged`};function je({t:e,label:t,on:n,onToggle:r,fail:i}){return e.n?(0,U.jsx)(`button`,{type:`button`,"aria-pressed":n,"aria-label":`${e.n}: ${t}. Show the runs`,onClick:r,className:k(`inline-flex min-h-7 min-w-7 cursor-pointer items-center justify-end rounded-[8px] border-0 px-2 tabular-nums hover:underline`,n?`bg-accent-soft text-accent-fg`:`bg-transparent text-accent-fg`,i&&!n&&`text-fail`),children:e.n}):(0,U.jsx)(`span`,{className:`inline-flex min-h-7 items-center justify-end px-2 text-muted tabular-nums`,children:`0`})}function Me({pick:e,d:t,onClose:n}){let[r,a]=(0,H.useState)(!1),o=r?e.runs:e.runs.slice(0,25);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsxs)(`span`,{className:`text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:[O(e.runs.length,`run`),` behind `,W(e.label)]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:n,children:[(0,U.jsx)(l,{"aria-hidden":`true`}),`Close`]})]}),(0,U.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,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e)),className:`grid min-h-10 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[8px] px-2 py-1 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[n&&n.status!==`NONE`?(0,U.jsx)(A,{tone:q[n.status].tone,children:q[n.status].label}):(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not judged`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px]`,children:W(n?.request||e)}),(0,U.jsxs)(`span`,{className:`truncate font-mono text-[13px] text-muted`,children:[e,n?.version?` · ${W(n.version)}`:``]})]}),(0,U.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":G(n?.started),children:n?.started?z(n.started):``})]})},e)})}),e.runs.length>o.length&&(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>a(!0),children:[(0,U.jsx)(i,{"aria-hidden":`true`}),`All (`,e.runs.length,`)`]})]})}function Ne({agent:e}){let[n,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(null);(0,H.useEffect)(()=>{M.dashboard(e).then(i,e=>o(e.message))},[e]);let d=e=>e?W(e):`no version`,f=n?n.versions.find(e=>e.version===s)||n.versions[0]:void 0,p=e=>l&&n&&l.key.startsWith(`${e}|`)?(0,U.jsx)(Me,{pick:l,d:n,onClose:()=>u(null)},l.key):null,m=(e,t,n,r)=>{let i=`${e}|${n}`;return(0,U.jsx)(je,{t,label:n,on:l?.key===i,onToggle:()=>u(l?.key===i?null:{key:i,label:n,runs:t.runs}),fail:r})};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`a`,{href:F(`evidence`),className:`inline-flex min-h-8 w-fit items-center gap-2 text-[13px] text-accent-fg no-underline hover:underline`,children:[(0,U.jsx)(oe,{icon:_,size:14}),` Evidence`]}),(0,U.jsx)(X,{id:`evidence`,children:W(e)}),(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`How this agent's runs were judged, version by version and week by week. Every number opens the runs it counts; not known and not judged are never counted as passed. Worked out now from the runs and their verdicts, with people's overrules applied.`}),a&&(0,U.jsx)(V,{text:a}),!n&&!a&&(0,U.jsx)(Z,{}),n?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),n&&f&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:n.runs.n}),` `,n.runs.n===1?`run`:`runs`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:n.versions.length}),` `,n.versions.length===1?`version`:`versions`]}),(0,U.jsx)(`a`,{href:F(`evidence-runs`,`agent`,encodeURIComponent(e)),children:`All its runs`}),(0,U.jsx)(`a`,{href:F(`evidence-learn`,encodeURIComponent(e)),children:`What to change`})]}),(0,U.jsx)(`h2`,{className:`sr-only`,children:`Its numbers`}),(0,U.jsxs)(B,{id:`versions`,title:`Versions`,icon:r,n:n.versions.length,children:[(0,U.jsx)(R,{label:`Versions of ${e}`,search:!1,minWidth:640,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Version`}),[`Runs`,`Passed`,`Warned`,`Failed`,`Not known`,`Not judged`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:e},e)),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Last run`})]}),children:n.versions.map(e=>(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left font-medium`),children:d(e.version)}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:m(`versions`,e.runs,`${d(e.version)}: runs`)}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:m(`versions`,e.outcome[t],`${d(e.version)}: ${Ae[t].toLowerCase()}`,t===`FAIL`)},t)),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`text-muted`),"data-tip":G(e.last),children:e.last?z(e.last):``})]},e.version))}),p(`versions`)]}),n.versions.length>1&&n.benchmark.length>0&&(0,U.jsxs)(B,{id:`benchmark`,title:`Versions side by side`,icon:t,children:[(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-[13px] text-muted`,children:`Each check: the share of a version's runs that passed it, of the runs it judged. The number after it opens the runs that did not pass.`}),(0,U.jsx)(R,{label:`Versions side by side`,search:!1,minWidth:480,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Check`}),n.versions.map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:d(e.version)},e.version))]}),children:n.benchmark.map(e=>(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left font-medium`),children:J[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,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:t.rate===null?(0,U.jsx)(`span`,{className:`text-muted`,children:`not judged`}):(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:k(t.rate<1&&`text-ink`),children:[Math.round(t.rate*100),`% of `,t.judged.n]}),n.n>0&&(0,U.jsx)(`span`,{className:`text-muted`,children:`·`}),n.n>0&&m(`benchmark`,n,`${J[e.check]} on ${d(t.version)}: not passed`,!0)]})},t.version)})]},`${e.lens}-${e.check}`))}),p(`benchmark`)]}),(0,U.jsxs)(B,{id:`checks`,title:`Checks`,icon:b,n:f.checks.length,children:[n.versions.length>1&&(0,U.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-[13px] text-ink-2`,children:[`Version`,(0,U.jsx)(P,{value:f.version,onChange:e=>{c(e.target.value),u(null)},children:n.versions.map(e=>(0,U.jsx)(`option`,{value:e.version,children:e.version||`no version`},e.version))})]}),f.checks.length?(0,U.jsx)(R,{label:`Checks of ${d(f.version)}`,search:!1,minWidth:600,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Check`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Lens`}),[`Passed`,`Warned`,`Failed`,`Not known`,`Overruled`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:e},e))]}),children:f.checks.map(e=>(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left font-medium`),children:J[e.check]}),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`text-muted`),children:Ue[e.lens]}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`].map(t=>(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:m(`checks`,e.outcome[t],`${J[e.check]}: ${Ae[t].toLowerCase()}`,t===`FAIL`)},t)),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:m(`checks`,e.overruled,`${J[e.check]}: overruled`)})]},`${e.lens}-${e.check}`))}):(0,U.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No contract judged these runs: `,(0,U.jsx)(`a`,{href:F(`evidence-contracts`),children:`Contracts`}),` says what one agrees.`]}),p(`checks`)]}),f.rules.length>0&&(0,U.jsxs)(B,{id:`recurring`,title:`What keeps going wrong`,icon:E,n:f.rules.length,children:[(0,U.jsx)(`ul`,{"aria-label":`What keeps going wrong`,className:`m-0 list-none rounded-[14px] card border p-2`,children:f.rules.slice(0,20).map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(A,{tone:q[e.status].tone,children:q[e.status].label}),(0,U.jsxs)(`span`,{className:`text-[13px] font-medium`,children:[J[e.check],`: `,W(e.rule)]}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-muted`,children:[`in `,m(`recurring`,e.runs,`${J[e.check]}: ${e.rule}`),` `,e.runs.n===1?`run`:`runs`]})]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`For example: `,W(e.example)]})]},`${e.check}-${e.rule}`))}),p(`recurring`)]}),(0,U.jsxs)(B,{id:`weeks`,title:`Week by week`,icon:te,n:n.weeks.length,children:[(0,U.jsx)(R,{label:`Week by week`,search:!1,minWidth:520,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Week`}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:Ae[e]},e))]}),children:[...n.weeks].reverse().map(e=>(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`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,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:m(`weeks`,e.outcome[t],`${e.week}: ${Ae[t].toLowerCase()}`,t===`FAIL`)},t))]},e.week))}),p(`weeks`)]})]})]})}function Pe({agent:e}){let[t,r]=(0,H.useState)(null),[i,a]=(0,H.useState)([]),[o,c]=(0,H.useState)(``),[l,d]=(0,H.useState)(``),[p,m]=(0,H.useState)(e),[h,g]=(0,H.useState)(`all`),[_,v]=(0,H.useState)(0);(0,H.useEffect)(()=>{M.runs().then(e=>{r(e.runs),a(e.refused)},e=>c(e.message))},[]),(0,H.useEffect)(()=>m(e),[e]);let y=(0,H.useMemo)(()=>[...new Set((t||[]).map(e=>e.agent))].sort(),[t]),ee=l.toLowerCase().split(/\s+/).filter(Boolean),b=(t||[]).filter(e=>(!p||e.agent===p)&&ee.every(t=>`${e.agent} ${e.request||``} ${e.id} ${e.source.name}`.toLowerCase().includes(t))),x=h===`failed`?b.filter(e=>e.failed):b,S={all:b.length,failed:b.filter(e=>e.failed).length},C=Math.max(1,Math.ceil(x.length/K)),w=Math.min(_,C-1),T=x.slice(w*K,w*K+K);(0,H.useEffect)(()=>v(0),[l,p,h]);let E=t||[],D=E.filter(e=>e.failed).length;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-runs`,children:`Agent runs`}),(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`Every agent run recorded here, newest first. Open one for its timeline: each step, the data it took in, what it decided and the reason it gave, and what the record cannot say.`}),o&&(0,U.jsx)(V,{text:o}),!t&&!o&&(0,U.jsx)(Z,{}),(0,U.jsx)(Oe,{refused:i}),t&&!t.length&&(0,U.jsx)(De,{}),t&&t.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:E.length}),` `,E.length===1?`run`:`runs`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:k(`tabular-nums`,D?`text-fail`:`text-ink`),children:D}),` with a failed step (`,Math.round(D/E.length*100),`%)`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:E.reduce((e,t)=>e+t.decisions,0)}),` `,E.reduce((e,t)=>e+t.decisions,0)===1?`decision`:`decisions`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:new Set(E.map(e=>e.agent)).size}),` `,new Set(E.map(e=>e.agent)).size===1?`agent`:`agents`]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(se,{id:`evidence-search`,label:`Find a run`,value:l,onChange:d,placeholder:`Find a run by what was asked`}),[[`all`,`All`],[`failed`,`Failed`]].map(([e,t])=>(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":h===e,onClick:()=>g(e),className:k(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-4 text-[13px] font-medium`,h===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,U.jsx)(`span`,{className:k(`tabular-nums`,e===`failed`&&S.failed?`text-fail`:``),children:S[e]})]},e)),y.length>1&&(0,U.jsxs)(P,{size:`sm`,"aria-label":`Agent`,value:p,onChange:e=>m(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,U.jsx)(`option`,{value:``,children:`Every agent`}),y.map(e=>(0,U.jsx)(`option`,{value:e,children:W(e)},e))]})]}),(0,U.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,U.jsxs)(`ul`,{"aria-label":`Agent runs`,className:`m-0 list-none p-2`,children:[!T.length&&(0,U.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:`Nothing matches.`}),T.map((e,t)=>(0,U.jsxs)(`li`,{className:`contents`,children:[(t===0||ve(T[t-1].started)!==ve(e.started))&&(0,U.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:ve(e.started)}),(0,U.jsxs)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.id)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[e.failed?(0,U.jsx)(f,{size:16,"aria-label":`${e.failed} failed ${e.failed===1?`step`:`steps`}`,className:`flex-none text-fail`}):(0,U.jsx)(s,{size:16,"aria-label":`No failed step`,className:`flex-none text-muted`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] font-medium`,"data-tip":e.request||e.agent,children:W(e.request||`${e.agent}: request not recorded`)}),(0,U.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[W(`${e.agent}${e.version?` ${e.version}`:``}`),O(e.steps,`step`),O(e.decisions,`decision`),`${O(e.gaps,`thing`,`things`)} not known`,Se[e.source.kind],e.content?`content kept`:`inputs as fingerprints`,e.verdict?`verdict: ${q[e.verdict].label.toLowerCase()}`:`no contract`].join(` · `)})]}),(0,U.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":G(e.started),children:e.started?z(e.started):``})]})]},e.id))]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:[(0,U.jsx)(`span`,{className:`flex-1`,children:x.length?`${w*K+1}–${Math.min(x.length,w*K+K)} of ${x.length}`:`0 runs`}),C>1&&(0,U.jsxs)(`nav`,{"aria-label":`Pages of agent runs`,className:`flex items-center gap-1`,children:[(0,U.jsx)(L,{size:`sm`,variant:`ghost`,disabled:w===0,onClick:()=>v(w-1),"aria-label":`Newer runs`,"data-tip":`Newer runs`,children:(0,U.jsx)(n,{"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,w+1,` of `,C]}),(0,U.jsx)(L,{size:`sm`,variant:`ghost`,disabled:w>=C-1,onClick:()=>v(w+1),"aria-label":`Older runs`,"data-tip":`Older runs`,children:(0,U.jsx)(u,{"aria-hidden":`true`})})]})]})]})]})]})}function Q({t:e,label:t}){let[n,r]=(0,H.useState)(!1);if(e.text===void 0)return(0,U.jsxs)(`span`,{className:`font-mono text-[13px] text-muted`,children:[t,`: fingerprint only, `,e.chars.toLocaleString(),` characters, sha256 `,e.sha256.slice(0,12),`…`]});let a=e.text.length>600;return(0,U.jsxs)(`span`,{className:`flex flex-col items-start gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[13px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:W(a&&!n?`${e.text.slice(0,600)}…`:e.text)}),a&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"data-tip":n?void 0:`Show all ${e.text.length.toLocaleString()} characters`,className:`inline-flex cursor-pointer items-center gap-1 border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:[n?(0,U.jsx)(C,{size:12,"aria-hidden":`true`}):(0,U.jsx)(i,{size:12,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Fe({d:e}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-accent-line pl-4`,children:[(0,U.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[`Decided`,e.by?` · by ${W(e.by)}`:``]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:[W(e.what),`: `,(0,U.jsx)(`b`,{className:`font-semibold`,children:W(e.chose)})]}),e.options&&e.options.length>0&&(0,U.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Options: `,W(e.options.join(`, `))]}),e.reason?(0,U.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The reason given (a claim, not checked yet):`}),(0,U.jsx)(Q,{t:e.reason,label:`reason`})]}):(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:`No reason given.`})]})}function Ie({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,U.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,U.jsx)(`span`,{className:`pt-1 text-right text-[13px] text-muted tabular-nums`,children:e.seq}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,U.jsx)(oe,{icon:Ce[e.kind]||S,size:14,className:`flex-none`}),(0,U.jsx)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:W(e.name)}),(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.kind}),e.agent&&(0,U.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`· by `,W(e.agent)]}),e.ok===!1&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-fail`,children:[(0,U.jsx)(f,{size:13,"aria-hidden":`true`}),`failed`]}),e.ms!==void 0&&(0,U.jsxs)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:[`· `,e.ms.toLocaleString(),` ms`]})]}),a.length>0&&(0,U.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:W(a.map(([e,t])=>`${e}: ${String(t)}`).join(` · `))}),e.detail&&(0,U.jsx)(Q,{t:e.detail,label:`details`}),e.instructions&&(0,U.jsxs)(`details`,{className:`border-l-2 border-line pl-4`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-[13px] 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,U.jsx)(`div`,{className:`mt-1`,children:(0,U.jsx)(Q,{t:e.instructions,label:`instructions`})})]}),n.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,U.jsxs)(`span`,{className:`text-[13px] font-medium text-muted [overflow-wrap:anywhere]`,children:[`Took in `,Te[e.kind]||e.kind,` from `,W(e.source)]}),(0,U.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,U.jsx)(Fe,{d:e},e.seq)),i.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,U.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`Said (a claim about its own work, not checked yet)`}),(0,U.jsx)(Q,{t:e.text,label:`statement`})]},e.seq))]})]})}function Le({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`),l=e=>n.reduce((t,n)=>t+(typeof n.facts?.[e]==`number`?n.facts[e]:0),0),u=l(`tokens_in`),d=l(`tokens_out`),f=[...new Set(n.map(e=>e.name))],p=({children:e})=>(0,U.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:e}),m=({seq:e})=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:[`step `,e]});return(0,U.jsx)(B,{id:`evidence-io`,title:`Prompt and output`,icon:ee,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(n.length>0||u+d>0)&&(0,U.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[n.length,` model `,n.length===1?`call`:`calls`,f.length?` (${W(f.join(`, `))})`:``,u+d>0?` · ${u.toLocaleString()} tokens in, ${d.toLocaleString()} out`:``]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(p,{children:[`Instructions (system prompt)`,r?(0,U.jsxs)(U.Fragment,{children:[` · from `,(0,U.jsx)(m,{seq:r.seq})]}):null,i>1?` · ${i} different ones in this run`:``]}),(0,U.jsx)(`div`,{className:`rounded-[12px] bg-surface-muted px-4 py-2`,children:r?.instructions?(0,U.jsx)(Q,{t:r.instructions,label:`instructions`}):(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in the record: its source did not hold the instructions the model was given.`})})]}),(0,U.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(p,{children:[`Request`,e.request?.by?` · from ${W(e.request.by)}`:``,e.request?.from?` · read from the ${W(e.request.from)}`:``]}),(0,U.jsx)(`div`,{className:`rounded-[12px] bg-surface-muted px-4 py-2`,children:e.request?.text?(0,U.jsx)(Q,{t:e.request.text,label:`request`}):(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in the record: its source did not say what the agent was asked.`})})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(p,{children:[`Final answer`,o?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(m,{seq:o.step})]}):null]}),(0,U.jsx)(`div`,{className:`rounded-[12px] bg-surface-muted px-4 py-2`,children:o?.data?(0,U.jsx)(Q,{t:o.data,label:`answer`}):(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in the record: its source did not say what the agent answered.`})})]})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(p,{children:[`What it produced (`,c.length,`)`]}),(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:c.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-ink-2`,children:[we[e.kind]||e.kind,e.target?(0,U.jsx)(`span`,{className:`font-mono text-[13px] [overflow-wrap:anywhere]`,children:W(e.target)}):null,`· `,(0,U.jsx)(m,{seq:e.step})]},e.id))})]}),s.length>0&&(0,U.jsxs)(`details`,{className:`group flex flex-col gap-2`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-[13px] font-medium text-muted`,children:[`What it said on the way (`,s.length,`)`]}),(0,U.jsx)(`ol`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:s.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,U.jsx)(m,{seq:e.step}),e.data?(0,U.jsx)(Q,{t:e.data,label:`said`}):null]},e.id))})]})]})})}function Re({id:e}){let[n,r]=(0,H.useState)(null),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(Y);(0,H.useEffect)(()=>{M.run(e).then(r,e=>o(e.message))},[e]);let l=(0,U.jsxs)(`a`,{href:F(`evidence-runs`),className:`inline-flex items-center gap-2 self-start text-sm`,children:[(0,U.jsx)(_,{size:16,"aria-hidden":`true`}),`All agent runs`]});if(!n)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[l,a?(0,U.jsx)(V,{text:a}):(0,U.jsx)(Z,{})]});let u=n.decisions.filter(e=>!e.step),d=n.steps.filter(e=>e.ok===!1).length,f=e=>{e>s&&c(Math.ceil(e/Y)*Y),requestAnimationFrame(()=>{let t=document.getElementById(`evidence-step-${e}`);t?.scrollIntoView({block:`start`}),t?.focus({preventScroll:!0})})},p=[...n.gaps,...n.truncated?[n.truncated]:[]];return(0,U.jsxs)(`section`,{"aria-labelledby":`evidence-run-h`,className:`flex flex-col gap-6`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[l,(0,U.jsx)(`h2`,{id:`evidence-run-h`,className:`m-0 text-[20px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:W(n.request?.text?.text?n.request.text.text.slice(0,200):`${n.agent.name}: request not recorded`)}),(0,U.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:[W(`${n.agent.name}${n.agent.version?` ${n.agent.version}`:``}${n.agent.model?` · ${n.agent.model}`:``}${n.agent.provider?` (${n.agent.provider})`:``}`),` · from `,Se[n.source.kind],`, `,W(n.source.name),n.started?` · ${G(n.started)}`:``,n.ended&&n.ended!==n.started?` to ${G(n.ended)}`:``]}),(0,U.jsx)(`p`,{className:`m-0 font-mono text-[13px] text-muted`,children:n.id})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:n.steps.length}),` `,n.steps.length===1?`step`:`steps`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:k(`tabular-nums`,d?`text-fail`:`text-ink`),children:d}),` failed`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:n.inputs.length}),` `,n.inputs.length===1?`input`:`inputs`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:n.decisions.length}),` `,n.decisions.length===1?`decision`:`decisions`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:n.statements.length}),` `,n.statements.length===1?`claim`:`claims`]}),(0,U.jsx)(`span`,{children:n.content?`Content kept, with secrets cut out`:`Inputs kept as fingerprints only`})]}),(0,U.jsx)(Le,{r:n,goTo:f}),(0,U.jsx)(ze,{id:n.id,goTo:f}),(0,U.jsx)(B,{id:`evidence-gaps`,title:`What the record cannot say`,icon:m,n:p.length,children:p.length?(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,U.jsx)(`li`,{className:`border-b border-line-soft py-2 text-[13px] text-ink-2 last:border-b-0 [overflow-wrap:anywhere]`,children:W(e)},e))}):(0,U.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing: the source said everything the record holds.`})}),(0,U.jsxs)(B,{id:`evidence-timeline`,title:`Timeline`,icon:re,n:n.steps.length,children:[(0,U.jsx)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col p-0`,children:n.steps.slice(0,s).map(e=>(0,U.jsx)(Ie,{s:e,r:n},e.seq))}),n.steps.length>s&&(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>c(s+Y),"data-tip":`Show ${Math.min(Y,n.steps.length-s)} more of ${n.steps.length-s}`,children:[(0,U.jsx)(i,{"aria-hidden":`true`}),`More (`,Math.min(Y,n.steps.length-s),`)`]})]}),u.length>0&&(0,U.jsx)(B,{id:`evidence-loose`,title:`Decisions not tied to a step`,icon:t,n:u.length,children:(0,U.jsx)(`div`,{className:`flex flex-col gap-4`,children:u.map(e=>(0,U.jsx)(Fe,{d:e},e.seq))})}),(0,U.jsx)(B,{id:`evidence-inputs`,title:`Data it took in`,icon:x,n:n.inputs.length,children:n.inputs.length?(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:n.inputs.map(e=>(0,U.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,U.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[13px] [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:Te[e.kind]||e.kind}),` `,(0,U.jsx)(`span`,{className:`text-muted`,children:`from`}),` `,W(e.source)]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:[`step `,e.step]}),(0,U.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:e.data.text===void 0?`${e.data.chars.toLocaleString()} chars · ${e.data.sha256.slice(0,12)}`:`kept`})]},e.id))}):(0,U.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`The record holds no input.`})})]})}function ze({id:e,goTo:t}){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(0),c=()=>s(e=>e+1);if((0,H.useEffect)(()=>{M.verdict(e).then(r,e=>a(e.message))},[e,o]),i)return(0,U.jsx)(V,{text:i});if(!n)return(0,U.jsx)(Z,{});let l=n.why||!n.verdicts.length?(0,U.jsx)(B,{id:`evidence-behaviour`,title:Ee.behaviour.title,icon:ne,children:(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:[`Not judged: `,W(n.why||`no contract judges this agent.`),` A contract says what was agreed for an agent; `,(0,U.jsx)(`a`,{href:F(`evidence-contracts`),children:`Contracts`}),` lists them.`]})}):null;return(0,U.jsxs)(U.Fragment,{children:[n.work&&(0,U.jsxs)(`p`,{className:k(`m-0 rounded-[12px] px-4 py-2 text-sm`,n.work.personTakesOver?`bg-warn-soft text-ink`:`bg-surface-muted text-ink-2`),children:[n.work.attempt?`Fix attempt ${n.work.attempt} of 2 at `:`The first run of work tried again in `,n.work.attempt?(0,U.jsx)(`a`,{href:F(`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.`:`.`]}),l,n.verdicts.map(e=>(0,U.jsx)(B,{id:`evidence-${e.lens}`,title:Ee[e.lens].title,icon:Ee[e.lens].icon,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(A,{tone:q[e.status].tone,children:q[e.status].label}),(0,U.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.contract?(0,U.jsxs)(U.Fragment,{children:[`By contract `,W(e.contract.name),`, version `,W(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,U.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:W(e)},e)),(0,U.jsx)(`ul`,{"aria-label":`Checks`,className:`m-0 flex list-none flex-col rounded-[14px] card border p-2`,children:e.checks.map(n=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`min-w-[152px] text-[13px] font-medium`,children:J[n.check]}),(0,U.jsx)(A,{tone:q[n.status].tone,children:q[n.status].label}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[W(n.checked),n.gating?` · can fail a run`:n.advisory&&e.contract?.approved?` · ${n.advisory}`:``]})]}),n.findings.map(n=>(0,U.jsx)(Ve,{f:n,run:e.run,goTo:t,onOverruled:c},n.id))]},n.check))}),e.lens===`content`&&n.rubric&&(0,U.jsx)(Be,{run:e.run,rubric:n.rubric,onGraded:c})]})},e.lens))]})}function Be({run:e,rubric:t,onGraded:n}){let[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=a.trim().length>=10&&a.trim().length<=500,p=async()=>{if(r){c(!0),d(``);try{await M.grade(e,r.id,r.grade,a.trim()),i(null),o(``),n()}catch(e){d(e.message)}finally{c(!1)}}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`h4`,{className:`m-0 text-sm font-semibold`,children:`Grade the answer`}),(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-[13px] 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,U.jsx)(`p`,{className:`m-0 max-w-measure whitespace-pre-wrap rounded-[12px] bg-surface-muted px-4 py-2 text-[13px] text-ink [overflow-wrap:anywhere]`,children:W(t.answer)}),(0,U.jsx)(`ul`,{"aria-label":`Rubric criteria`,className:`m-0 flex list-none flex-col rounded-[14px] card border p-2`,children:t.criteria.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsxs)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`font-mono text-muted`,children:e.id}),` `,W(e.text)]}),e.grade&&(0,U.jsx)(A,{tone:e.grade.grade===`meets`?`pass`:`warn`,children:e.grade.grade===`meets`?`Meets`:`Misses`}),(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.grade?`Grade again:`:`Grade:`}),[`meets`,`misses`].map(t=>(0,U.jsx)(`button`,{type:`button`,"aria-label":`${e.id} ${t===`meets`?`meets`:`misses`}`,onClick:()=>i({id:e.id,grade:t}),className:`inline-flex min-h-7 cursor-pointer items-center rounded-[8px] border-0 bg-transparent px-2 text-[13px] text-accent-fg hover:underline`,children:t===`meets`?`Meets`:`Misses`},t))]}),e.grade&&(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Graded by `,W(e.grade.by),` `,G(e.grade.at),`: `,W(e.grade.reason)]}),r?.id===e.id&&(0,U.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,U.jsxs)(`label`,{htmlFor:`grade-${e.id}`,className:`text-[13px] font-medium text-ink-2`,children:[`Why does the answer `,r.grade===`meets`?`meet`:`miss`,` it?`]}),(0,U.jsx)(I,{id:`grade-${e.id}`,value:a,onChange:e=>o(e.target.value),rows:2,maxLength:500,placeholder:`For example: it says the customer must send a photo by Friday.`}),u&&(0,U.jsx)(V,{text:u}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(L,{size:`sm`,disabled:!f||s,onClick:p,"data-tip":r.grade===`meets`?`Keep the grade: meets`:`Keep the grade: misses`,children:[(0,U.jsx)(D,{"aria-hidden":`true`}),s?`Keeping…`:`Keep`]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>i(null),children:[(0,U.jsx)(l,{"aria-hidden":`true`}),`Cancel`]})]})]})]},e.id))})]})}function Ve({f:e,run:t,goTo:n,onOverruled:r}){let[i,a]=(0,H.useState)(!1),[s,c]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(``),m=s.trim().length>=10&&s.trim().length<=500,h=async()=>{d(!0),p(``);try{await M.overrule(t,e.id,s.trim()),a(!1),r()}catch(e){p(e.message)}finally{d(!1)}};return(0,U.jsxs)(`div`,{className:k(`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,U.jsx)(`span`,{className:k(`text-[13px] [overflow-wrap:anywhere]`,e.overruled?`text-ink-2`:`text-ink`),children:W(e.what)}),e.fix&&!e.overruled&&(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Fix: `,W(e.fix)]}),e.overruled&&(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Overruled by `,W(e.overruled.by),` `,G(e.overruled.at),` (`,e.overruled.via===`web`?`on this page`:`at a terminal`,`): `,W(e.overruled.reason)]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,U.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:W(e.source)}),e.location&&(0,U.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:W(`${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,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`inline-flex min-h-7 cursor-pointer items-center rounded-[8px] border-0 bg-surface-strong px-2 text-[13px] text-accent-fg tabular-nums hover:underline`,children:[`step `,e]},e)),!e.overruled&&e.status!==`UNKNOWN`&&!i&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[8px] border-0 bg-transparent px-2 text-[13px] text-accent-fg hover:underline`,children:[(0,U.jsx)(o,{size:12,"aria-hidden":`true`}),`Overrule`]})]}),i&&(0,U.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,U.jsx)(`label`,{htmlFor:`overrule-${e.id}`,className:`text-[13px] 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,U.jsx)(I,{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.`}),f&&(0,U.jsx)(V,{text:f}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(L,{size:`sm`,disabled:!m||u,onClick:h,children:[(0,U.jsx)(o,{"aria-hidden":`true`}),u?`Overruling…`:`Overrule`]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>a(!1),children:[(0,U.jsx)(l,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function He(){let[e,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(``);return(0,H.useEffect)(()=>{M.review().then(n,e=>i(e.message))},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-review`,children:`Review queue`}),(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`Runs whose findings are still open, the failed first, then work whose two fix attempts are used, where a person takes over. Open a run to read its findings, and overrule one with a reason where it is wrong or right to accept. Then the answers the rubric's judge could not settle, for a person to grade, and every finding people overruled, and why.`}),r&&(0,U.jsx)(V,{text:r}),!e&&!r&&(0,U.jsx)(Z,{}),e?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),e&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`What waits, what to grade, and what was overruled`}),(0,U.jsx)(B,{id:`waiting`,title:`Waiting for a person`,icon:ne,n:e.waiting.length,children:e.waiting.length?(0,U.jsx)(`ul`,{"aria-label":`Waiting for a person`,className:`m-0 list-none rounded-[14px] card border p-2`,children:e.waiting.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.run)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,U.jsx)(A,{tone:q[e.status].tone,children:q[e.status].label}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:W(e.request||`${e.agent}: request not recorded`)}),(0,U.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[W(e.agent),O(e.open,`open finding`),e.failed?`${e.failed} failing`:``,e.attempt?`fix attempt ${e.attempt} of 2`:``,e.personTakesOver?`a person takes over`:``].filter(Boolean).join(` · `)})]}),(0,U.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":G(e.started),children:e.started?z(e.started):``})]})},e.run))}):(0,U.jsx)(N,{className:`py-4`,children:`Nothing waits: no run has an open finding.`})}),e.grade.length>0&&(0,U.jsxs)(B,{id:`grade`,title:`Answers to grade`,icon:b,n:e.grade.length,children:[(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-[13px] text-muted`,children:`The rubric's judge could not settle these answers: it is not yet calibrated against people's grades, or it disagreed with itself. Grading them settles each one and calibrates the judge.`}),(0,U.jsx)(`ul`,{"aria-label":`Answers to grade`,className:`m-0 list-none rounded-[14px] card border p-2`,children:e.grade.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.run)),className:`grid min-h-12 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:W(e.request||`${e.agent}: request not recorded`)}),(0,U.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[W(e.agent),`${e.ungraded} of ${e.criteria} ${e.criteria===1?`criterion`:`criteria`} not graded`].join(` · `)})]}),(0,U.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":G(e.started),children:e.started?z(e.started):``})]})},e.run))})]}),(0,U.jsx)(B,{id:`overruled`,title:`Overruled by people`,icon:t,n:e.overruled.length,children:e.overruled.length?(0,U.jsx)(`ul`,{"aria-label":`Overruled findings`,className:`m-0 list-none rounded-[14px] card border p-2`,children:e.overruled.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`text-[13px] [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.run)),children:W(e.agent||e.run)}),` · `,W(`${e.check}/${e.rule}`),e.what?`: ${W(e.what)}`:``]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[W(e.by),` `,G(e.at),` (`,e.via===`web`?`on the page`:`at a terminal`,`): `,W(e.reason)]})]},`${e.run}-${e.finding}-${e.at}`))}):(0,U.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No finding has been overruled.`})})]})]})}var Ue={build:`Build and test`,behaviour:`Behaviour`,decisions:`Decisions and data`,content:`Content`,domain:`Domain`};function We({s:e}){let[t,n]=(0,H.useState)(e.versions[0]||``),[r,i]=(0,H.useState)(e.versions[1]||``),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(``);(0,H.useEffect)(()=>{e.agent&&t&&(c(``),M.release(e.agent,t,r===t?``:r).then(o,e=>c(e.message)))},[e.agent,t,r]);let l=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`},u=a?[...new Set([...Object.keys(a.candidate.lensPass),...Object.keys(a.live?.lensPass||{})])]:[];return(0,U.jsxs)(`li`,{className:`flex flex-col gap-4 rounded-[14px] card border px-4 py-4`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`text-[16px] font-medium [overflow-wrap:anywhere]`,children:W(e.agent||e.name)}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[W(`${e.name}.yaml`),` · `,O(e.scenarios.length,`scenario`)]})]}),e.problem&&(0,U.jsx)(V,{text:e.problem}),e.agent&&!e.versions.length&&(0,U.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No run of `,W(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,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,U.jsx)(`label`,{htmlFor:`cand-${e.name}`,children:`Candidate`}),(0,U.jsx)(P,{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,U.jsx)(`option`,{value:e,children:W(e)},e))}),(0,U.jsx)(`label`,{htmlFor:`live-${e.name}`,children:`against live`}),(0,U.jsxs)(P,{size:`sm`,id:`live-${e.name}`,value:r,onChange:e=>i(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,U.jsx)(`option`,{value:``,children:`No live version`}),e.versions.filter(e=>e!==t).map(e=>(0,U.jsx)(`option`,{value:e,children:W(e)},e))]})]}),s&&(0,U.jsx)(V,{text:s}),a&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(A,{tone:a.status===`ready`?`pass`:`fail`,children:a.status===`ready`?`Ready`:`Held`}),(0,U.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:a.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.`})]}),a.reasons.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-[13px] text-ink-2`,children:a.reasons.map(e=>(0,U.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:W(e)},e))}),(0,U.jsxs)(R,{label:`Scenarios of ${e.agent}`,search:!1,minWidth:520,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Scenario`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`}),a.live&&(0,U.jsxs)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:[W(a.live.version),` (live)`]}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:W(a.candidate.version)})]}),children:[e.scenarios.map(e=>(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left font-medium`),"data-tip":e.request,children:W(e.id)}),(0,U.jsx)(`td`,{className:`px-4 py-2`,children:e.kind}),a.live&&(0,U.jsx)(`td`,{className:k(`px-4 py-2`,a.live.cells[e.id]&&!a.live.cells[e.id].pass&&`text-fail`),children:l(a.live.cells[e.id])}),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,(a.candidate.cells[e.id]===null||a.candidate.cells[e.id]&&!a.candidate.cells[e.id].pass)&&`text-fail`),children:l(a.candidate.cells[e.id])})]},e.id)),u.map(e=>(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsxs)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left text-muted`),children:[Ue[e],`: scenarios passed`]}),(0,U.jsx)(`td`,{className:`px-4 py-2`}),a.live&&(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`tabular-nums`),children:a.live.lensPass[e]??0}),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`tabular-nums`,a.live&&(a.candidate.lensPass[e]??0)<(a.live.lensPass[e]??0)&&`text-fail`),children:a.candidate.lensPass[e]??0})]},e)),(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left text-muted`),children:`The owners' expectations met`}),(0,U.jsx)(`td`,{className:`px-4 py-2`}),a.live&&(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`tabular-nums`),children:a.live.golden}),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`tabular-nums`,a.live&&a.candidate.golden<a.live.golden&&`text-fail`),children:a.candidate.golden})]})]}),(0,U.jsx)(Ye,{g:a}),(0,U.jsx)(Ge,{g:a}),(0,U.jsx)(Xe,{g:a,ids:e.scenarios.map(e=>e.id)})]}),e.history.length>0&&(0,U.jsxs)(`details`,{className:`text-[13px]`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Gates kept (`,e.history.length,`)`]}),(0,U.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.history.map(e=>(0,U.jsxs)(`li`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[G(e.at),` · `,W(e.by),` · `,W(e.candidate),e.live?` against ${W(e.live)}`:``,`: `,e.status===`ready`?`ready`:`held`,e.reasons.length?` (${W(e.reasons[0])}${e.reasons.length>1?`, and ${e.reasons.length-1} more`:``})`:``]},e.at))})]})]})}function Ge({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,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h4`,{className:`m-0 text-sm font-semibold`,children:[`Answers waiting for your grade (`,t.length,`)`]}),(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-[13px] text-muted`,children:`These scenarios are graded by a person: until an answer is graded, it is not known, and the scenario does not pass.`}),(0,U.jsx)(`ul`,{"aria-label":`Answers waiting for a grade`,className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:t.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.run)),className:`text-accent-fg hover:underline`,children:[W(e.sid),`: `,e.run]})},e.run))})]}):null}function Ke({f:e}){return(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(A,{tone:e.applied||e.proven?`pass`:`fail`,children:e.applied?`Applied`:e.proven?`Proven`:`Not proven`}),(0,U.jsx)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:W(e.instruction)}),(0,U.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:e.id})]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Adds it to `,W(e.file),`, for `,W(e.cause),` of `,(0,U.jsx)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),` (scenario `,W(e.scenario),`, `,W(e.version),`).`]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`The cause: `,e.proof.replace(`-`,` `),` (`,W(e.why),`)`,e.replays.length?(0,U.jsxs)(U.Fragment,{children:[`; replays `,ut(e.replays)]}):null,`.`]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`The suite, run from the patched copy against `,W(e.version),`: `,e.gate.status===`ready`?`no worse`:`held: ${W(e.gate.reasons.join(` `))}`]}),e.applied&&(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Applied by `,W(e.applied.by),` `,G(e.applied.at),`: `,W(e.applied.reason)]}),(0,U.jsxs)(`details`,{className:`text-[13px]`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`The patch`}),(0,U.jsx)(`pre`,{className:`m-0 mt-1 overflow-x-auto rounded-[12px] bg-surface-muted px-4 py-2 font-mono text-[13px] text-ink`,children:W(e.patch)})]})]})}function qe({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=>W(e)).join(`, `);return(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-4 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:e.id}),(0,U.jsxs)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:[W(n.id),` for `,W(e.agent)]}),(0,U.jsx)(A,{tone:`neutral`,children:n.kind}),n.held_out&&(0,U.jsx)(A,{tone:`neutral`,children:`Held out`}),e.decided&&(0,U.jsx)(A,{tone:e.decided.decision===`accepted`?`pass`:`warn`,children:e.decided.decision===`accepted`?`Accepted`:`Rejected`})]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Drafted by `,e.by===`code`?`code`:`a model`,` from `,i,` `,e.source.url&&_e(e.source.url)===`web`?(0,U.jsx)(`a`,{href:e.source.url,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent-fg hover:underline`,children:W(e.source.ref)}):W(e.source.ref),e.source.criterion?` ${W(e.source.criterion)}`:``,e.source.quote?(0,U.jsxs)(U.Fragment,{children:[`: “`,W(e.source.quote),`”`]}):e.source.why?(0,U.jsxs)(U.Fragment,{children:[`: `,W(e.source.why)]}):null]}),(0,U.jsx)(`p`,{className:`m-0 max-w-measure whitespace-pre-wrap rounded-[12px] bg-surface-muted px-4 py-2 text-[13px] text-ink [overflow-wrap:anywhere]`,children:W(n.request)}),(0,U.jsxs)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-[13px] text-ink-2`,children:[r.chose&&(0,U.jsxs)(`li`,{children:[`Expects it to choose `,a(r.chose)]}),r.not_chose&&(0,U.jsxs)(`li`,{children:[`Expects it never to choose `,a(r.not_chose)]}),r.says&&(0,U.jsxs)(`li`,{children:[`Expects it to say: `,a(r.says)]}),r.not_says&&(0,U.jsxs)(`li`,{children:[`Expects it never to say: `,a(r.not_says)]}),r.graded&&(0,U.jsx)(`li`,{children:`A person grades each answer`}),(0,U.jsx)(`li`,{children:r.clean?`Every lens must find nothing`:`The lenses are counted lens by lens`})]}),e.decided?(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.decided.decision===`accepted`?`Accepted`:`Rejected`,` by `,W(e.decided.by),` `,G(e.decided.at),e.decided.scenario?` as ${W(e.decided.scenario)}`:``,`: `,W(e.decided.reason)]}):(0,U.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(lt,{agent:e.id,uid:`${e.id}-accept`,label:`Add`,icon:c,tip:`Add to the suite`,action:(t,n)=>M.decideDraft(e.id,`accepted`,t,n),onDone:t}),(0,U.jsx)(lt,{agent:e.id,uid:`${e.id}-reject`,label:`Reject`,icon:o,action:(t,n)=>M.decideDraft(e.id,`rejected`,t,n),onDone:t})]})]})}function Je({onDecided:e}){let[t,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(``),a=()=>M.drafts().then(n,e=>i(e.message));(0,H.useEffect)(()=>{a()},[]);let o=t?.drafts.filter(e=>!e.decided).length??0;return(0,U.jsxs)(B,{id:`drafts`,title:`Drafted scenarios`,icon:b,n:o,children:[(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-[13px] text-muted`,children:[`Drafted from work items' acceptance criteria and defects (`,(0,U.jsx)(`code`,{children:`forgeqe evidence draft <agent> --from ado:N`}),`) or the product graph's business rules (`,(0,U.jsx)(`code`,{children:`--from-product`}),`), each resting on a quote of its source, or from a run that failed (`,(0,U.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,U.jsx)(V,{text:r}),t?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),t&&!t.drafts.length&&(0,U.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No draft yet.`}),t&&t.drafts.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Drafted scenarios`,className:`m-0 flex list-none flex-col rounded-[14px] card border p-2`,children:t.drafts.map(t=>(0,U.jsx)(qe,{d:t,onDecided:()=>{a(),e()}},t.id))})]})}function Ye({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=>[Ue[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)}% (${Ue[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,U.jsxs)(`details`,{className:`text-[13px]`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`Scores: runs passed, lens by lens`}),(0,U.jsx)(`p`,{className:`m-0 mt-1 max-w-measure text-[13px] 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,U.jsx)(R,{label:`Scores`,search:!1,minWidth:420,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:le,children:`Score`}),t.map(t=>(0,U.jsxs)(`th`,{scope:`col`,className:ue,children:[W(t.version),e.live&&t===e.live?` (live)`:``]},t.version))]}),children:r.map(([e,n])=>(0,U.jsxs)(`tr`,{className:fe,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(ce,`text-left font-medium`),children:e}),t.map(e=>(0,U.jsx)(`td`,{className:de,children:n(e)},e.version))]},e))})]})}function Xe({g:e,ids:t}){let n=e=>e?e.runs.find(e=>e.path?.unmet.length)??e.runs.find(e=>e.path):void 0,r=t.flatMap(t=>{let r=n(e.candidate.cells[t]),i=e.live?n(e.live.cells[t]):void 0;return r?.path||i?.path?[{id:t,cand:r,live:i}]:[]});if(!r.length)return null;let i={same:``,missing:`expected, not done`,extra:`done, not expected`},a=(e,t)=>t?.path?(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e,`: `,(0,U.jsx)(`a`,{href:F(`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,U.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-[13px]`,children:(t.path.alignment.length?t.path.alignment:t.path.actual.map(e=>({kind:`same`,step:e}))).map((e,t)=>(0,U.jsxs)(`li`,{className:k(`[overflow-wrap:anywhere]`,e.kind===`missing`&&`text-fail`,e.kind===`extra`&&`text-warn`),children:[e.kind===`missing`?`− `:e.kind===`extra`?`+ `:` `,W(e.step),e.kind!==`same`&&(0,U.jsxs)(`span`,{className:`font-sans text-[13px] text-muted`,children:[` (`,i[e.kind],`)`]})]},`${t}-${e.step}`))}),t.path.unmet.map(e=>(0,U.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:W(e)},e))]}):(0,U.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e,`: not run`]});return(0,U.jsxs)(`details`,{className:`text-[13px]`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Paths: expected against actual (`,r.length,`)`]}),(0,U.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-4 p-0`,children:r.map(t=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-2`,children:[(0,U.jsx)(`span`,{className:`text-[13px] font-medium`,children:W(t.id)}),(0,U.jsxs)(`div`,{className:`grid gap-4 @[640px]:grid-cols-2`,children:[e.live&&a(`${e.live.version} (live)`,t.live),a(e.candidate.version,t.cand)]})]},t.id))})]})}function Ze(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(``),i=()=>M.releases().then(t,e=>r(e.message));return(0,H.useEffect)(()=>{i()},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-releases`,children:`Releases`}),(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,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,U.jsx)(`code`,{children:`forgeqe evidence release`}),` keeps each gate.`]}),n&&(0,U.jsx)(V,{text:n}),!e&&!n&&(0,U.jsx)(Z,{}),e&&!e.suites.length&&(0,U.jsx)(N,{className:`py-4`,children:`No scenario suite yet: write one in .forgeqe/evidence/scenarios/<agent>.yaml (docs/EVIDENCE.md has its form), or add drafted scenarios below.`}),e&&e.suites.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`Each agent's scenario suite and release gate`}),(0,U.jsx)(B,{id:`suites`,title:`Scenario suites`,icon:b,n:e.suites.length,children:(0,U.jsx)(`ul`,{"aria-label":`Scenario suites`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.suites.map(e=>(0,U.jsx)(We,{s:e},e.name))})})]}),e&&(0,U.jsx)(Je,{onDecided:i})]})}var Qe={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 $e(){let[e,t]=(0,H.useState)(null),[n,i]=(0,H.useState)(``);(0,H.useEffect)(()=>{M.contracts().then(t,e=>i(e.message))},[]);let a=e=>e===null?`–`:`${Math.round(e*100)}%`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-contracts`,children:`Contracts`}),(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:[`What each agent's owner agreed for it: the steps it must take, what it may and may never do, its limits, what a person decides, and what its statements need behind them. Each run is checked against its agent's approved contract. A contract nobody approved, or a check not yet measured well enough on labelled runs, only warns. Start one with `,(0,U.jsx)(`code`,{children:`forgeqe evidence contract new "<agent>"`}),`; a person approves it at a terminal with `,(0,U.jsx)(`code`,{children:`forgeqe evidence contract approve <name>`}),`.`]}),n&&(0,U.jsx)(V,{text:n}),!e&&!n&&(0,U.jsx)(Z,{}),e&&!e.contracts.length&&(0,U.jsx)(N,{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,U.jsx)(`h2`,{className:`sr-only`,children:`The contracts and how each check is measured`}),e&&e.contracts.length>0&&(0,U.jsx)(B,{id:`contracts`,title:`Contracts`,icon:x,n:e.contracts.length,children:(0,U.jsx)(`ul`,{"aria-label":`Contracts`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.contracts.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`text-[16px] font-medium [overflow-wrap:anywhere]`,children:W(e.agent||e.name)}),(0,U.jsx)(A,{tone:Qe[e.state].tone,children:Qe[e.state].label}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[W(`${e.name}.yaml`),e.version?` · version ${W(e.version)}`:``,e.approved?` · approved ${G(e.approved.at)} by ${W(e.approved.by)}`:``]})]}),e.problem&&(0,U.jsx)(V,{text:e.problem}),e.says.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.says.map(e=>(0,U.jsx)(`li`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:W(e)},e))}),(0,U.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.gates.length?`Can fail a run: ${e.gates.map(e=>J[e]).join(`, `)}.`:`No check can fail a run under it yet: what they find is a warning.`})]},e.name))})}),e&&(0,U.jsxs)(B,{id:`measured`,title:`How well each check is measured`,icon:r,children:[(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-[13px] leading-relaxed text-ink-2`,children:[`On `,O(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,U.jsx)(V,{text:`Not measured: ${e}`},e)),(0,U.jsx)(`div`,{className:`@container`,children:(0,U.jsx)(R,{label:`How well each check is measured`,search:!1,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Check`}),[`Labelled`,`Found right`,`Found wrong`,`Missed`,`Precision`,`Recall`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:k(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`whitespace-normal`,et.has(e)&&`hidden @lg:table-cell`),children:e},e))]}),children:Object.keys(J).filter(t=>e.measured.checks[t]).map(t=>{let n=e.measured.checks[t];return(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left font-medium`),children:J[t]}),(0,U.jsx)(`td`,{className:k(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,n.labelled<e.measured.min&&`text-muted`),children:n.labelled}),(0,U.jsx)(`td`,{className:k(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`),children:n.tp}),(0,U.jsx)(`td`,{className:k(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fp>0&&`text-fail`),children:n.fp}),(0,U.jsx)(`td`,{className:k(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fn>0&&`text-fail`),children:n.fn}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:a(n.precision)}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:a(n.recall)})]},t)})})})]})]})}var et=new Set([`Found right`,`Found wrong`,`Missed`]),tt={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`}},nt={instruction:`Its instructions`,tool:`A tool`,data:`Its data`};function rt({p:e,onDecided:t}){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(``),[c,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),p=i.trim().length>=10&&i.trim().length<=500,m=async()=>{if(n){u(!0),f(``);try{await M.decide(e.agent,e.id,n,i.trim()),r(null),t()}catch(e){f(e.message)}finally{u(!1)}}};return(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(A,{tone:e.state===`approved`?`pass`:e.state===`declined`?`neutral`:`warn`,children:e.state===`approved`?`Approved`:e.state===`declined`?`Declined`:`Open`}),(0,U.jsx)(`span`,{className:`text-[13px] font-medium text-ink-2`,children:e.kind===`fix`?`Fix, proven by replay`:`Guidance for its instructions`}),(0,U.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:e.id})]}),(0,U.jsx)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:W(e.text)}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Because `,W(e.because),`. `,O(e.runs.length,`run`),e.replays?`, ${O(e.replays.length,`replay`)}`:``,`:`,` `,[...e.runs,...e.replays??[]].slice(0,8).map((e,t)=>(0,U.jsxs)(`span`,{children:[t?`, `:``,(0,U.jsx)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e))]}),e.decision&&(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.state===`approved`?`Approved`:`Declined`,` by `,W(e.decision.by),` `,G(e.decision.at),` (`,e.decision.via===`web`?`on this page`:`at a terminal`,`): `,W(e.decision.reason)]}),e.state===`open`&&!n&&(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(L,{size:`sm`,onClick:()=>r(`approved`),children:[(0,U.jsx)(s,{"aria-hidden":`true`}),`Approve`]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>r(`declined`),children:[(0,U.jsx)(o,{"aria-hidden":`true`}),`Decline`]})]}),n&&(0,U.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,U.jsx)(`label`,{htmlFor:`decide-${e.id}`,className:`text-[13px] 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,U.jsx)(I,{id:`decide-${e.id}`,value:i,onChange:e=>a(e.target.value),rows:2,maxLength:500,placeholder:`For example: the replays show the claim data is the cause.`}),d&&(0,U.jsx)(V,{text:d}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(L,{size:`sm`,disabled:!p||c,onClick:m,children:[n===`approved`?(0,U.jsx)(s,{"aria-hidden":`true`}):(0,U.jsx)(o,{"aria-hidden":`true`}),c?`Keeping…`:n===`approved`?`Approve`:`Decline`]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:[(0,U.jsx)(l,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function it({agent:e,run:t,c:n,candidates:r,onLinked:i}){let a=r,[o,s]=(0,H.useState)(!1),[c,u]=(0,H.useState)([]),[f,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(``);return(0,U.jsxs)(`div`,{className:k(`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,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(A,{tone:tt[n.status].tone,children:tt[n.status].label}),(0,U.jsxs)(`span`,{className:`text-[13px] font-medium`,children:[n.id,` · `,nt[n.kind],`: `,W(n.where)]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`of `,J[n.finding.check],`: `,W(n.finding.rule)]})]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:[`Change: `,W(n.change)]}),(0,U.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[W(n.why),`.`]}),n.replays.map(e=>(0,U.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Replay `,(0,U.jsx)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),`: `,e.gone&&!e.broke.length&&e.changeSeen!==!1?`the finding is gone`:W(e.why.join(`; `))]},e.run)),!o&&a.length>0&&n.status!==`proven`&&(0,U.jsx)(`span`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),"data-tip":`Link replays`,className:`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[8px] border-0 bg-transparent px-0 text-[13px] text-accent-fg hover:underline`,children:[(0,U.jsx)(d,{size:12,"aria-hidden":`true`}),`Link`]})}),o&&(0,U.jsxs)(`fieldset`,{className:`m-0 flex max-w-[640px] flex-col gap-2 rounded-[12px] border-0 bg-surface-muted p-4`,children:[(0,U.jsxs)(`legend`,{className:`sr-only`,children:[`Replays of `,n.id]}),(0,U.jsx)(`span`,{className:`text-[13px] 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.`}),a.map(e=>(0,U.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2 text-[13px]`,children:[(0,U.jsx)(ye,{checked:c.includes(e),onCheckedChange:t=>u(n=>t?[...n,e]:n.filter(t=>t!==e))}),(0,U.jsx)(`span`,{className:`font-mono`,children:e})]},e)),m&&(0,U.jsx)(V,{text:m}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(L,{size:`sm`,disabled:!c.length||f,onClick:async()=>{p(!0),h(``);try{await M.replay(e,t,n.id,c),s(!1),u([]),i()}catch(e){h(e.message)}finally{p(!1)}},"data-tip":`Link the picked replays`,children:[(0,U.jsx)(d,{"aria-hidden":`true`}),f?`Linking…`:c.length?`Link (${c.length})`:`Link`]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>s(!1),children:[(0,U.jsx)(l,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function at({sub:t}){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(t?j(t):``),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(0);(0,H.useEffect)(()=>{M.overview().then(e=>{let t=e.agents.map(e=>e.name);r(t),a(e=>e||t[0]||``)},e=>l(e.message))},[]),(0,H.useEffect)(()=>{i&&(s(null),M.learn(i).then(s,e=>l(e.message)))},[i,u]);let f=()=>d(e=>e+1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-learn`,children:`Learn`}),(0,U.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`What to change in an agent, from what its runs got wrong. Each open finding has its possible causes (its instructions, a tool, the data it took in); a cause is proven when the same request, run again three times with that one change, no longer gives the finding and breaks nothing else. Proven causes and rules broken again and again are proposed; a person approves or declines each, and the team puts what is approved into the agent. Evidence changes nothing itself.`}),c&&(0,U.jsx)(V,{text:c}),n&&!n.length&&(0,U.jsx)(De,{}),n&&n.length>1&&(0,U.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-[13px] text-ink-2`,children:[`Agent`,(0,U.jsx)(P,{value:i,onChange:e=>a(e.target.value),children:n.map(e=>(0,U.jsx)(`option`,{value:e,children:W(e)},e))})]}),i&&!o&&!c&&(0,U.jsx)(Z,{}),o?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`h2`,{className:`sr-only`,children:[`Proposals and causes of `,W(o.agent)]}),(0,U.jsxs)(B,{id:`proposals`,title:`Proposals`,icon:e,n:o.proposals.length,children:[o.proposals.length?(0,U.jsx)(`ul`,{"aria-label":`Proposals`,className:`m-0 list-none rounded-[14px] card border p-2`,children:o.proposals.map(e=>(0,U.jsx)(rt,{p:e,onDecided:f},e.id))}):(0,U.jsx)(N,{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.`}),o.proposals.some(e=>e.state===`approved`)&&(0,U.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[(0,U.jsxs)(`code`,{children:[`forgeqe evidence guidance `,W(o.agent)]}),` writes what was approved as Markdown, to put into the agent.`]})]}),(0,U.jsxs)(B,{id:`fixes`,title:`Fixes proven by the harness`,icon:S,n:o.fixes.length,children:[(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-[13px] text-muted`,children:[`A cause in the agent's instructions, added to a copy of them and run by ForgeQE's harness: proven on 3 clean replays and a suite that is no worse. The project is not changed: a person applies a proven fix at a terminal (`,(0,U.jsx)(`code`,{children:`forgeqe evidence fix apply <fix>`}),`), or puts its patch on a branch for a pull request.`]}),o.fixes.length?(0,U.jsx)(`ul`,{"aria-label":`Fixes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:o.fixes.map(e=>(0,U.jsx)(Ke,{f:e},`${e.id}-${e.at}`))}):(0,U.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No fix proven yet: `,(0,U.jsx)(`code`,{children:`forgeqe evidence fix <run> H1`}),` proves one of a cause below.`]})]}),(0,U.jsx)(B,{id:`causes`,title:`Causes of its findings`,icon:re,n:o.runs.length,children:o.runs.length?(0,U.jsx)(`ul`,{"aria-label":`Runs and their causes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:o.runs.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e.run)),className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:W(e.request||e.run)}),(0,U.jsxs)(`span`,{className:`font-mono text-[13px] text-muted`,children:[e.run,e.version?` · ${W(e.version)}`:``]})]}),e.causes.map(t=>(0,U.jsx)(it,{agent:o.agent,run:e.run,c:t,candidates:e.candidates,onLinked:f},t.key)),!e.candidates.length&&(0,U.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`No run of the same request is recorded after it yet: `,(0,U.jsxs)(`code`,{children:[`forgeqe evidence replay-kit `,e.run,` H1`]}),` says what to change for a replay.`]})]},e.run))}):(0,U.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No run of this agent has an open finding.`})})]})]})}var $={observe:`Observe`,assist:`Assist`,act:`Act`,autonomous:`Autonomous`},ot={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 lt({agent:e,label:t,icon:n,tip:r,action:i,children:a,onDone:o,uid:s}){let[c,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),[p,m]=(0,H.useState)(``),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(``),y=d.trim().length>=10&&d.trim().length<=500&&p===e,ee=async()=>{g(!0),v(``);try{await i(p,d.trim()),u(!1),f(``),m(``),o()}catch(e){v(e.message)}finally{g(!1)}};if(!c)return(0,U.jsx)(`span`,{children:(0,U.jsxs)(L,{size:`sm`,onClick:()=>u(!0),"data-tip":r,children:[(0,U.jsx)(n,{"aria-hidden":`true`}),t]})});let b=`${t}${s?`-${s}`:``}`.toLowerCase().replace(/[^a-z0-9]+/g,`-`);return(0,U.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,children:[a,(0,U.jsx)(`label`,{htmlFor:`${b}-reason`,className:`text-[13px] font-medium text-ink-2`,children:`Why? It is kept with your name and in the audit.`}),(0,U.jsx)(I,{id:`${b}-reason`,value:d,onChange:e=>f(e.target.value),rows:2,maxLength:500}),(0,U.jsxs)(`label`,{htmlFor:`${b}-confirm`,className:`text-[13px] font-medium text-ink-2`,children:[`Type `,W(e),` to confirm`]}),(0,U.jsx)(ie,{id:`${b}-confirm`,value:p,onChange:e=>m(e.target.value),autoComplete:`off`}),_&&(0,U.jsx)(V,{text:_}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(L,{size:`sm`,disabled:!y||h,onClick:ee,"data-tip":r,children:[(0,U.jsx)(n,{"aria-hidden":`true`}),h?`Keeping…`:t]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>u(!1),children:[(0,U.jsx)(l,{"aria-hidden":`true`}),`Cancel`]})]})]})}function ut(e){return(0,U.jsxs)(U.Fragment,{children:[e.slice(0,8).map((e,t)=>(0,U.jsxs)(`span`,{children:[t?`, `:``,(0,U.jsx)(`a`,{href:F(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e)),e.length>8?`, and ${e.length-8} more`:``]})}function dt({sub:e}){let t=e?j(e):``,[n,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(``),[c,l]=(0,H.useState)(0),[u,d]=(0,H.useState)(`observe`),p=()=>l(e=>e+1);(0,H.useEffect)(()=>{o(``),M.monitor(t||void 0).then(i,e=>o(e.message))},[t,c]);let m=async()=>{try{let e=await M.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){o(e.message)}},_=n?.agent;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-monitor`,children:`Monitor`}),(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:[`Every agent evaluated, and for each: what changed since its baseline (a model, a tool, the documents it reads, a check doing worse, its contract or judge), how much autonomy its evidence supports and what a person granted it, and every decision people made about it, to export. The nightly job is `,(0,U.jsx)(`code`,{children:`forgeqe evidence drift --all`}),`.`]}),a&&(0,U.jsx)(V,{text:a}),!n&&!a&&(0,U.jsx)(Z,{}),n?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),n&&!n.inventory.length&&(0,U.jsx)(De,{}),n&&n.inventory.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`Agents and their governance`}),(0,U.jsxs)(B,{id:`inventory`,title:`Inventory`,icon:g,n:n.inventory.length,children:[(0,U.jsx)(R,{label:`Agents evaluated`,search:!1,minWidth:760,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Agent`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Versions`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Models`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Tools`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Contract`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Trust`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Alerts`})]}),children:n.inventory.map(e=>(0,U.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,U.jsx)(`th`,{scope:`row`,className:k(`px-4 py-2`,`text-left font-medium`),children:(0,U.jsx)(`a`,{href:F(`evidence-monitor`,encodeURIComponent(e.agent)),"aria-current":e.agent===t?`page`:void 0,children:W(e.agent)})}),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`text-muted`),children:e.versions.slice(0,3).map(W).join(`, `)||`none named`}),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`text-muted [overflow-wrap:anywhere]`),children:e.models.slice(0,3).map(W).join(`, `)||`none named`}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.tools.length}),(0,U.jsx)(`td`,{className:k(`px-4 py-2`,`text-muted`),children:e.contract?e.contract.approved?`Approved`:`Not approved`:`None`}),(0,U.jsx)(`td`,{className:`px-4 py-2`,children:e.granted?`${$[e.granted]} (supports ${$[e.supported].toLowerCase()})`:`Not granted (supports ${$[e.supported].toLowerCase()})`}),(0,U.jsx)(`td`,{className:k(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.alerts>0&&`text-fail`),children:e.baseline||e.alerts?e.alerts:(0,U.jsx)(`span`,{className:`text-muted`,children:`no baseline`})})]},e.agent))}),!t&&(0,U.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Open an agent to see its drift, its trust and its audit.`})]}),_&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(B,{id:`drift`,title:`Drift of ${_.name}`,icon:r,n:_.drift.alerts.length,children:[_.drift.baseline?(0,U.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Since its baseline (`,_.drift.baseline.version?W(_.drift.baseline.version):`no version`,`, `,O(_.drift.baseline.runs,`run`),`, set by `,W(_.drift.baseline.by),` `,G(_.drift.baseline.at),`): `,O(_.drift.since.length,`run`),`.`]}):(0,U.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No baseline is set: what changed cannot be said. Set one when a version is released.`}),_.drift.alerts.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Drift alerts`,className:`m-0 list-none rounded-[14px] card border p-2`,children:_.drift.alerts.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(A,{tone:`warn`,children:st[e.kind]}),(0,U.jsx)(`span`,{className:`text-[13px] [overflow-wrap:anywhere]`,children:W(e.what)})]}),e.runs.length>0&&(0,U.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`In `,ut(e.runs)]})]},`${e.kind}-${e.subject}`))}),_.drift.baseline&&!_.drift.alerts.length&&(0,U.jsx)(N,{className:`py-4`,children:`Nothing changed since the baseline.`}),(0,U.jsx)(lt,{agent:_.name,label:`Set baseline`,icon:D,tip:_.drift.baseline?`Set a new baseline`:`Set the baseline`,action:(e,t)=>M.baseline(_.name,e,t),onDone:p,children:(0,U.jsx)(`span`,{className:`text-[13px] 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,U.jsxs)(B,{id:`trust`,title:`Trust in ${_.name}`,icon:h,children:[(0,U.jsxs)(`p`,{className:`m-0 text-[13px]`,children:[`Its evidence supports `,(0,U.jsx)(`b`,{children:$[_.trust.supported]}),`: `,ot[_.trust.supported],`.`,` `,_.trust.granted?(0,U.jsxs)(U.Fragment,{children:[`Granted: `,(0,U.jsx)(`b`,{children:$[_.trust.granted.level]}),`, by `,W(_.trust.granted.by),` `,G(_.trust.granted.at),`: `,W(_.trust.granted.reason)]}):`No level is granted.`]}),(0,U.jsx)(`ul`,{"aria-label":`What each level needs`,className:`m-0 list-none rounded-[14px] card border p-2`,children:_.trust.criteria.filter(e=>e.level!==`observe`).map(e=>(0,U.jsxs)(`li`,{className:`flex items-start gap-2 border-b border-line-soft px-4 py-2 text-[13px] last:border-b-0`,children:[(0,U.jsx)(oe,{icon:e.met?s:f,size:15,className:e.met?`mt-1 text-pass`:`mt-1 text-muted`}),(0,U.jsx)(`span`,{className:`w-[96px] shrink-0 font-medium`,children:$[e.level]}),(0,U.jsxs)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`sr-only`,children:e.met?`Met: `:`Not met: `}),W(e.what)]})]},`${e.level}-${e.what}`))}),(0,U.jsx)(lt,{agent:_.name,label:`Grant`,icon:s,tip:`Grant a trust level`,action:(e,t)=>M.trust(_.name,u,e,t),onDone:p,children:(0,U.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-[13px] font-medium text-ink-2`,children:[`Level`,(0,U.jsx)(P,{value:u,onChange:e=>d(e.target.value),children:ct.slice(0,ct.indexOf(_.trust.supported)+1).map(e=>(0,U.jsxs)(`option`,{value:e,children:[$[e],`: `,ot[e]]},e))})]})})]}),(0,U.jsxs)(B,{id:`audit`,title:`Audit`,icon:x,children:[(0,U.jsxs)(`p`,{className:`m-0 max-w-measure text-[13px] text-muted`,children:[`Every decision people made about `,W(_.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,U.jsx)(`span`,{children:(0,U.jsxs)(L,{size:`sm`,onClick:m,"data-tip":`Download the audit`,children:[(0,U.jsx)(w,{"aria-hidden":`true`}),`Download`]})})]})]})]})]})}function ft({page:e,sub:t}){let n=(t||``).split(`/`),r=n[0]===`agent`&&n[1]?j(n[1]):``,i=e===`evidence-runs`&&n[0]&&n[0]!==`agent`?j(n[0]):``;return(0,U.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,U.jsx)(he,{}),(0,U.jsx)(`main`,{className:k(ge,`@container flex-auto gap-4`),children:e===`evidence`?t?(0,U.jsx)(Ne,{agent:j(t)},t):(0,U.jsx)(ke,{}):e===`evidence-contracts`?(0,U.jsx)($e,{}):e===`evidence-review`?(0,U.jsx)(He,{}):e===`evidence-releases`?(0,U.jsx)(Ze,{}):e===`evidence-learn`?(0,U.jsx)(at,{sub:t}):e===`evidence-monitor`?(0,U.jsx)(dt,{sub:t},t||``):i?(0,U.jsx)(Re,{id:i},i):(0,U.jsx)(Pe,{agent:r})})]})}export{ft as Evidence};
@@ -1,2 +0,0 @@
1
- import{E as e,Fr as t,M as n,Mr as r,R as i,Rr as a,kn as o,q as s,tr as c,un as l,vr as u}from"./line-icons-Cb4JZG1G.js";import{V as d,a as f,c as p,ct as m,en as h,f as g,l as _,o as v,p as y,r as b,st as x,z as S}from"./filters-DoEToSM9.js";import{at as C,in as w,r as T,t as E,z as D}from"./frame-5jc7OkUQ.js";import{r as O}from"./index-DAN0sMvE.js";import{_ as k,o as A}from"./qualityParts-BFHdnu9w.js";var j=a(t(),1),M={view:()=>x(`GET`,`/api/explore`),start:e=>x(`POST`,`/api/explore/start`,{...e,confirmed:!0}),stop:()=>x(`POST`,`/api/explore/stop`,{}),answer:(e,t)=>x(`POST`,`/api/explore/answer`,{id:e,choice:t}),session:e=>x(`GET`,`/api/explore/sessions/${encodeURIComponent(e)}`)},N=h(),P=[2,3,4,6,8,12],F=[10,15,30,45,60,90,120],I={passed:{label:`As expected`,icon:n,tone:`text-pass`},defect:{label:`Defect, confirmed`,icon:i,tone:`text-fail`},not_reproduced:{label:`Not reproduced`,icon:u,tone:`text-warn`},could_not_explore:{label:`Could not explore`,icon:u,tone:`text-muted`},stopped:{label:`Stopped`,icon:c,tone:`text-muted`}},L=e=>{let t=Math.max(0,Math.round(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function R({job:e,onStop:t,onAnswer:n}){let r=(0,j.useRef)(null),[,i]=(0,j.useState)(0);(0,j.useEffect)(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e.lines.length]),(0,j.useEffect)(()=>{if(!e.running)return;let t=setInterval(()=>i(e=>e+1),1e3);return()=>clearInterval(t)},[e.running]);let a=(e.endedAt?Date.parse(e.endedAt):Date.now())-Date.parse(e.startedAt),o=e.deadline?Date.parse(e.deadline)-Date.now():void 0,s=e.exitCode===0?`No defect confirmed`:e.exitCode===1?`Defects confirmed`:`Did not finish`;return(0,N.jsxs)(`section`,{"aria-label":`Session`,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,N.jsx)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:e.goal||`Exploratory session`}),(0,N.jsx)(p,{orb:`working`,tone:e.running?`running`:e.exitCode===0?`pass`:`fail`,children:e.running?e.question?`Waiting for you`:`Exploring`:s}),(0,N.jsxs)(`span`,{className:`text-[13px] text-muted tabular-nums`,"data-tip":e.minutes?`Time limit ${e.minutes} minutes`:void 0,children:[L(a),e.running&&o!==void 0?` · ${L(o)} left`:``]}),e.running&&(0,N.jsxs)(S,{variant:`danger`,onClick:t,children:[(0,N.jsx)(c,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),e.running&&e.question&&(0,N.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 rounded-[10px] bg-surface-muted border-0 p-4`,children:[(0,N.jsx)(`legend`,{className:`float-left mb-1 text-sm font-medium`,children:e.question.title}),e.question.detail&&(0,N.jsx)(`p`,{className:`clear-left m-0 text-sm text-ink-2`,children:e.question.detail}),(0,N.jsx)(`div`,{className:`clear-left flex flex-wrap gap-2`,children:e.question.options.map((t,r)=>(0,N.jsx)(S,{size:`sm`,variant:r===0&&t.id!==`cancel`?`primary`:`outline`,onClick:()=>n(e.question.id,t.id),children:t.label},t.id))})]}),(0,N.jsxs)(`details`,{open:e.running,children:[(0,N.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,e.lines.length,` lines): the charters, each run, and what it found`]}),(0,N.jsx)(`pre`,{ref:r,className:`mt-2 max-h-[340px] overflow-auto rounded-[10px] bg-surface-muted p-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:e.lines.join(`
2
- `)||`Planning the charters…`})]})]})}function z({view:e,onStarted:t}){let[n,i]=(0,j.useState)(``),[a,c]=(0,j.useState)(e.production?``:e.apps[0]?.name??``),[l,u]=(0,j.useState)(``),[d,p]=(0,j.useState)(``),[m,h]=(0,j.useState)(4),[g,_]=(0,j.useState)(30),[y,x]=(0,j.useState)([]),[C,w]=(0,j.useState)(!1),[T,E]=(0,j.useState)(!1),[D,O]=(0,j.useState)(``),k=e.production?[]:e.apps,A=a||/^https?:\/\/\S+$/i.test(l.trim()),I=n.trim().length>=8&&A,L=async()=>{E(!0);try{t(await M.start({goal:n.trim(),...d.trim()?{story:d.trim()}:{},...a?{app:a}:{url:l.trim()},charters:m,minutes:g,...y.length?{roles:y}:{}})),w(!1),O(``)}catch(e){O(e.message)}finally{E(!1)}};return(0,N.jsxs)(`form`,{"aria-labelledby":`explore-new`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,onSubmit:e=>{e.preventDefault(),I&&w(!0)},children:[(0,N.jsx)(`h2`,{id:`explore-new`,className:`m-0 text-[16px] font-semibold`,children:`New session`}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Goal`,(0,N.jsx)(f,{value:n,onChange:e=>i(e.target.value),maxLength:300,placeholder:`Try to break checkout with odd addresses and postcodes`,"aria-describedby":`explore-goal-help`}),(0,N.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,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1 text-[13px] font-medium`,children:[`Start at`,(0,N.jsxs)(v,{size:`sm`,value:a,onChange:e=>c(e.target.value),children:[k.map(t=>(0,N.jsxs)(`option`,{value:t.name,children:[t.name,` (`,e.environment,`)`]},t.name)),(0,N.jsx)(`option`,{value:``,children:`Another address…`})]})]}),!a&&(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Address`,(0,N.jsx)(f,{size:`sm`,value:l,onChange:e=>u(e.target.value),placeholder:`https://qa.shop.example.com/checkout`})]}),(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_160px] flex-col gap-1 text-[13px] font-medium`,children:[`Story (optional)`,(0,N.jsx)(f,{size:`sm`,value:d,onChange:e=>p(e.target.value),maxLength:40,placeholder:`ado:1234 or SHOP-12`})]}),(0,N.jsxs)(`label`,{className:`flex flex-[0_1_140px] flex-col gap-1 text-[13px] font-medium`,children:[`Charters, at most`,(0,N.jsx)(v,{size:`sm`,value:String(m),onChange:e=>h(Number(e.target.value)),children:P.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))})]}),(0,N.jsxs)(`label`,{className:`flex flex-[0_1_140px] flex-col gap-1 text-[13px] font-medium`,children:[`Time limit`,(0,N.jsx)(v,{size:`sm`,value:String(g),onChange:e=>_(Number(e.target.value)),children:F.map(e=>(0,N.jsxs)(`option`,{value:e,children:[e,` minutes`]},e))})]})]}),e.roles.length>1&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,N.jsx)(`span`,{className:`font-medium`,children:`Roles`}),(0,N.jsx)(b,{items:e.roles.map(e=>({id:e,label:e})),value:y,onChange:x}),(0,N.jsx)(`span`,{className:`text-muted`,children:`Saved logins to explore as. None picked: each of them.`})]}),e.production&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`The active environment, `,e.environment,`, is named like production: give the address of a test environment.`]}),D&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:D}),C?(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[10px] bg-surface-muted px-4 py-2 text-[13px]`,children:[(0,N.jsxs)(`span`,{className:`flex-[1_1_280px]`,children:[`Start a session of up to `,m,` charters, for at most `,g,` minutes? Each charter is a browser run (two when it finds a possible defect); you choose which charters run once they are planned.`]}),(0,N.jsxs)(S,{size:`sm`,variant:`primary`,disabled:T,onClick:()=>void L(),children:[(0,N.jsx)(o,{"aria-hidden":`true`}),`Start`]}),(0,N.jsxs)(S,{size:`sm`,variant:`ghost`,disabled:T,onClick:()=>w(!1),children:[(0,N.jsx)(r,{"aria-hidden":`true`}),`Cancel`]})]}):(0,N.jsx)(`div`,{children:(0,N.jsxs)(S,{size:`sm`,variant:`primary`,type:`submit`,disabled:!I,"data-tip":`Plan charters, then explore`,children:[(0,N.jsx)(s,{"aria-hidden":`true`}),`Explore`]})})]})}function B({id:t}){let[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(``),[o,s]=(0,j.useState)(``);(0,j.useEffect)(()=>{let e=!1;return M.session(t).then(t=>!e&&r(t),t=>!e&&a(t.message)),()=>{e=!0}},[t]);let c=(0,N.jsxs)(`a`,{href:y(`explore`),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,N.jsx)(e,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All sessions`]});if(i||!n)return(0,N.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c,i?(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail`,children:i}):(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`})]});let u=async()=>{try{let{id:e}=await m.start(`Go through the exploratory session ${n.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=y(`chats`,e)}catch(e){s(e.message)}};return(0,N.jsxs)(`section`,{"aria-labelledby":`explore-s-h`,className:`flex min-w-0 flex-col gap-4`,children:[c,(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,N.jsx)(`h2`,{id:`explore-s-h`,"data-tip":n.title,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:n.title}),(0,N.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[k(n.at),` · `,n.story.id&&n.story.id!==`story`?`${n.story.id} · `:``,(0,N.jsx)(`span`,{className:`font-mono`,children:n.id})]})]}),(0,N.jsxs)(S,{size:`sm`,variant:`ghost`,onClick:()=>void u(),"data-tip":`Ask about this session in a chat`,children:[(0,N.jsx)(l,{"aria-hidden":`true`}),`Chat`]})]}),o&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:o}),(0,N.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-5 @xl:divide-x @xl:divide-line-soft`,children:[(0,N.jsx)(A,{label:`Charters`,value:n.charters,sub:`planned and run`}),(0,N.jsx)(A,{label:`Defects`,value:n.defects,tone:n.defects?`text-fail`:`text-pass`,sub:`confirmed by a second run`}),(0,N.jsx)(A,{label:`As expected`,value:n.passed,sub:`ran clean`}),(0,N.jsx)(A,{label:`Not reproduced`,value:n.notReproduced,tone:n.notReproduced?`text-warn`:void 0,sub:`observations`}),(0,N.jsx)(A,{label:`Stopped`,value:n.stopped+n.notExplored,sub:`time limit or could not explore`})]}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:n.results.map(e=>{let t=I[e.status];return(0,N.jsxs)(`li`,{className:`flex items-start gap-2 border-t border-line-soft py-2 text-[13px]`,children:[(0,N.jsx)(t.icon,{size:15,"aria-label":t.label,className:d(`mt-1 flex-none`,t.tone)}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`font-medium`,children:[e.id?`${e.id} · `:``,e.title,` `,(0,N.jsxs)(`span`,{className:d(`font-normal`,t.tone),children:[`· `,t.label]}),e.role?(0,N.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · as `,e.role]}):null,e.changesData?(0,N.jsx)(`span`,{className:`font-normal text-muted`,children:` · changes data`}):null]}),e.mission&&(0,N.jsx)(`span`,{className:`text-ink-2`,children:e.mission}),(e.reason||e.summary)&&(0,N.jsx)(`span`,{className:d(`[overflow-wrap:anywhere]`,e.status===`defect`?`text-fail`:`text-ink-2`),children:e.reason||e.summary}),e.observations.map((e,t)=>(0,N.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Noticed: `,e]},t)),e.runDir&&(0,N.jsxs)(`span`,{className:`truncate font-mono text-[13px] 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)})}),n.proposed.length>0&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,N.jsx)(`h3`,{className:`m-0 text-[13px] font-semibold`,children:`Proposed test cases`}),(0,N.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-ink-2`,children:n.proposed.map((e,t)=>(0,N.jsxs)(`li`,{children:[e.title,e.kind===`defect`?(0,N.jsx)(`span`,{className:`text-muted`,children:` · checks the defect is fixed`}):null]},t))})]})]})}function V({sub:e}){let[t,r]=(0,j.useState)(null),[a,o]=(0,j.useState)(``),c=(0,j.useCallback)(()=>{M.view().then(e=>(r(e),o(``)),e=>o(e.message))},[]);(0,j.useEffect)(c,[c]);let l=!!t?.job?.running;(0,j.useEffect)(()=>{if(!l)return;let e=setInterval(c,2e3);return()=>clearInterval(e)},[l,c]);let f=async e=>{try{r(await e())}catch(e){o(e.message)}},p=e?g(e):``,m=e=>location.hash=y(`explore`,encodeURIComponent(e)),h=`py-2 pr-4 text-right tabular-nums`;return(0,N.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,N.jsx)(T,{}),(0,N.jsxs)(`main`,{className:d(E,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,N.jsx)(C,{pixel:w.explore,size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Exploratory testing`})]}),!p&&(0,N.jsx)(`p`,{className:`m-0 max-w-measure text-[13px] leading-relaxed text-ink-2`,children:`Exploring beyond the scripted test cases, with a goal: ForgeQE plans charters from it (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.`}),a&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:a}),!t&&!a&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&p&&(0,N.jsx)(B,{id:p}),t&&!p&&(0,N.jsxs)(N.Fragment,{children:[t.job&&(0,N.jsx)(R,{job:t.job,onStop:()=>void f(M.stop),onAnswer:(e,t)=>void f(()=>M.answer(e,t))}),!l&&(0,N.jsx)(z,{view:t,onStarted:r}),(0,N.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Sessions`}),t.sessions.length?(0,N.jsx)(D,{label:`Sessions`,placeholder:`Find a session`,empty:`Nothing matches.`,head:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`th`,{className:`w-[50%] py-2 pr-4 pl-4 font-medium`,children:`Session`}),(0,N.jsx)(`th`,{className:`py-2 pr-4 text-right font-medium`,children:`Defects`}),(0,N.jsx)(`th`,{className:`hidden py-2 pr-4 text-right font-medium @xl:table-cell`,children:`Charters`}),(0,N.jsx)(`th`,{className:`hidden py-2 pr-4 text-right font-medium @2xl:table-cell`,children:`As expected`}),(0,N.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @xl:table-cell`,children:`When`})]}),children:t.sessions.map(e=>{let t=e.defects?i:e.notReproduced?u:n;return(0,N.jsxs)(`tr`,{onClick:()=>m(e.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,N.jsx)(`td`,{className:`max-w-0 py-2 pr-4 pl-4`,children:(0,N.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(t,{size:15,"aria-label":e.defects?`Defects confirmed`:e.notReproduced?`Observations`:`Nothing confirmed`,className:d(`flex-none`,e.defects?`text-fail`:e.notReproduced?`text-warn`:`text-pass`)}),(0,N.jsx)(`a`,{href:y(`explore`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.title,className:`truncate text-ink no-underline hover:underline`,children:e.title})]})}),(0,N.jsx)(`td`,{className:d(h,e.defects?`text-fail`:`text-muted`),children:e.defects}),(0,N.jsx)(`td`,{className:d(h,`hidden text-muted @xl:table-cell`),children:e.charters}),(0,N.jsx)(`td`,{className:d(h,`hidden text-muted @2xl:table-cell`),children:e.passed}),(0,N.jsx)(`td`,{className:`hidden py-2 pr-4 whitespace-nowrap text-[13px] text-muted @xl:table-cell`,"data-tip":k(e.at),children:O(e.at)})]},e.id)})}):(0,N.jsx)(_,{icon:s,title:`No sessions yet`,children:`Give a goal above and start one: what it finds, the defects it confirmed and the test cases it proposes show here.`})]})]})]})}export{V as Explore};
@@ -1 +0,0 @@
1
- import{E as e,F as t,Fr as n,Mr as r,N as i,Rr as a,k as o,l as s,qn as c,un as l}from"./line-icons-Cb4JZG1G.js";import{H as u,V as d,c as f,ct as p,en as m,i as h,o as g,p as _,vt as v,z as y}from"./filters-DoEToSM9.js";import{K as b,Tt as x,at as S,in as C,q as w,r as T,t as E}from"./frame-5jc7OkUQ.js";import{r as D}from"./markdown-A9SeSXqj.js";var O=a(n(),1),k=m(),A={ready:{label:`Ready`,tone:`pass`,icon:s,color:`text-pass`},partial:{label:`Partly set up`,tone:`warn`,icon:t,color:`text-warn`},needs_setup:{label:`Needs setup`,tone:`neutral`,icon:i,color:`text-muted`}},j={models:`Models`,integrations:`Integrations`,monitor:`Monitor`,notifications:`Notifications`,agents:`Agents`,environments:`Environments`,containers:`Containers`,databases:`Databases`},M=4;async function N(e,t){try{let{id:t}=await p.start(e,{});location.hash=_(`chats`,t)}catch(e){t(e.message)}}function P({f:e,onScope:t,busy:n}){let[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(``),[s,f]=(0,O.useState)(``);(0,O.useEffect)(()=>{v.detail(e.id).then(i,e=>o(e.message))},[e.id]);let p=e.gaps.filter(e=>!e.optional),m=e.gaps.filter(e=>e.optional);return(0,k.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[(0,k.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:e.summary}),[[p,`Needs`],[m,`Would do more with`]].map(([e,t])=>e.length?(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:t}),(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.map((e,n)=>(0,k.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-[10px] bg-bg px-4 py-2 text-sm`,children:[(0,k.jsx)(`span`,{className:d(t===`Needs`?`text-ink`:`text-ink-2`),children:e.missing}),(0,k.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.fix}),e.settings&&(0,k.jsxs)(`a`,{href:_(`settings`,e.settings),className:`inline-flex items-center gap-1 self-start text-[13px] font-medium`,children:[(0,k.jsx)(c,{size:13,"aria-hidden":`true`}),`Set it up in Settings, `,j[e.settings]||e.settings]})]},n))})]},t):null),e.inputs.length>0&&(0,k.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`From your request: `,e.inputs.join(`; `),`.`]}),a&&(0,k.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:a}),r&&(0,k.jsxs)(k.Fragment,{children:[r.examples.length>0&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:`Ask for it like this`}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.examples.slice(0,4).map(t=>(0,k.jsxs)(y,{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 N(t,f),className:`h-auto min-h-8 max-w-full py-2 text-left whitespace-normal`,children:[(0,k.jsx)(l,{"aria-hidden":`true`}),t]},t))}),s&&(0,k.jsx)(`span`,{className:`text-[13px] text-fail`,children:s})]}),r.limits.length>0&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:`What it does not do`}),(0,k.jsx)(`ul`,{className:`m-0 list-disc pl-6 text-sm text-ink-2`,children:r.limits.map(e=>(0,k.jsx)(`li`,{children:e},e))})]}),r.docs.length>0&&(0,k.jsxs)(`details`,{children:[(0,k.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[`How it works (`,u(r.docs.length,`section`),`)`]}),(0,k.jsx)(`div`,{className:`mt-2 flex flex-col gap-4`,children:r.docs.map(e=>(0,k.jsxs)(`section`,{className:`rounded-[12px] bg-bg px-4 py-4`,children:[(0,k.jsx)(`h4`,{className:`m-0 mb-1 text-sm font-semibold`,children:e.heading}),(0,k.jsx)(D,{text:e.text,className:`text-sm`})]},e.heading))})]}),(0,k.jsxs)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Tools: `,r.tools.join(`, `)]})]}),(0,k.jsxs)(`label`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft pt-4 text-sm`,children:[(0,k.jsxs)(`span`,{className:`flex-[1_1_240px]`,children:[`The agent gets its tools`,(0,k.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`agent.capabilities in forgeqe.yaml`})]}),(0,k.jsxs)(g,{value:e.scope,disabled:n,onChange:e=>t(e.target.value),className:`w-[240px]`,children:[(0,k.jsx)(`option`,{value:`auto`,children:`When a request is about it`}),(0,k.jsx)(`option`,{value:`always`,children:`Always`}),(0,k.jsx)(`option`,{value:`off`,children:`Never, in this project`})]})]})]})}function F({embedded:t=!1}={}){let[n,i]=(0,O.useState)(null),[a,s]=(0,O.useState)(``),[c,l]=(0,O.useState)(``),[u,p]=(0,O.useState)(`all`),[m,g]=(0,O.useState)(``),[_,D]=(0,O.useState)(!1),[j,N]=(0,O.useState)([]),F=(0,O.useCallback)(()=>v.view().then(i,e=>s(e.message)),[]);(0,O.useEffect)(()=>void F(),[F]);let I=(0,O.useMemo)(()=>{let e=m.toLowerCase().split(/\s+/).filter(Boolean);return(n?.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)},[n,u,m]),L=async(e,t)=>{D(!0);try{i(await v.scope(e,t)),s(``)}catch(e){s(e.message)}finally{D(!1)}},R=n?.counts,z=n?.areas.flatMap(e=>e.features).find(e=>e.id===c),B=(0,k.jsxs)(k.Fragment,{children:[a&&(0,k.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),!n&&!a&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&R&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(w,{label:`Features`,children:[(0,k.jsx)(b,{icon:A.ready.icon,label:`Ready`,value:String(R.ready)}),(0,k.jsx)(b,{icon:A.partial.icon,label:`Partly set up`,value:String(R.partial)}),(0,k.jsx)(b,{icon:A.needs_setup.icon,label:`Need setup`,value:String(R.needs_setup)})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,k.jsx)(`div`,{role:`radiogroup`,"aria-label":`Show`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`all`,`All`],[`needs`,`Needs setup`],[`ready`,`Ready`]].map(([e,t])=>(0,k.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":u===e,onClick:()=>p(e),className:d(`min-h-8 cursor-pointer rounded-[7px] border-0 px-4 text-sm font-medium`,u===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),(0,k.jsx)(h,{id:`find-a-feature`,label:`Find a feature`,value:m,onChange:g})]}),I.length===0&&(0,k.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing matches.`}),(0,k.jsx)(`div`,{className:`@container`,children:(0,k.jsx)(`div`,{className:`grid auto-rows-fr grid-cols-1 items-stretch gap-4 @2xl:grid-cols-2 @5xl:grid-cols-3`,children:I.map((t,n)=>{let r=u!==`all`||m.trim()!==``||j.includes(t.area),i=r?t.features:t.features.slice(0,M),a=t.features.length-M,s=`area-list-${n}`;return(0,k.jsxs)(`section`,{"aria-labelledby":`area-${n}`,className:`@container/col flex min-w-0 flex-col rounded-[16px] card border p-2 @min-[260px]/col:p-4`,children:[(0,k.jsxs)(`h2`,{id:`area-${n}`,className:`m-0 px-2 pt-2 pb-4 text-[16px] font-semibold`,children:[t.area,(0,k.jsx)(`span`,{className:`ml-2 text-[13px] font-normal text-muted tabular-nums`,children:t.features.length})]}),(0,k.jsx)(`ul`,{id:s,className:`m-0 flex list-none flex-col gap-1 p-0`,children:i.map(e=>{let t=A[e.state];return(0,k.jsx)(`li`,{children:(0,k.jsxs)(`button`,{type:`button`,onClick:()=>l(e.id),className:`flex w-full cursor-pointer items-center gap-2 rounded-[10px] border-0 bg-transparent px-2 py-2 text-left text-sm text-ink hover:bg-surface-strong`,children:[(0,k.jsx)(t.icon,{size:16,"aria-hidden":`true`,className:d(`flex-none`,t.color)}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.title}),(0,k.jsxs)(`span`,{className:`sr-only`,children:[`, `,t.label]}),e.scope!==`auto`&&(0,k.jsx)(`span`,{className:`flex-none text-[13px] text-muted`,children:e.scope===`always`?`Always given`:`Off here`}),(0,k.jsx)(`span`,{className:`flex-none text-[13px] font-medium text-accent`,children:`More`})]})},e.id)})}),a>0&&u===`all`&&!m.trim()&&(0,k.jsxs)(y,{variant:`ghost`,size:`sm`,"aria-expanded":r,"aria-controls":s,onClick:()=>N(r?j.filter(e=>e!==t.area):[...j,t.area]),"data-tip":r?`Fewer features`:`More features (${a})`,className:`mt-auto w-full justify-center gap-2 text-muted`,children:[r?(0,k.jsx)(o,{"aria-hidden":`true`}):(0,k.jsx)(e,{"aria-hidden":`true`}),r?`Less`:`More (${a})`]})]},t.area)})})}),(0,k.jsx)(x,{open:!!z,wide:!0,onClose:()=>l(``),title:z?.title||``,description:z&&(0,k.jsx)(f,{tone:A[z.state].tone,icon:z.state!==`needs_setup`,children:A[z.state].label}),footer:(0,k.jsxs)(y,{onClick:()=>l(``),children:[(0,k.jsx)(r,{"aria-hidden":`true`}),`Close`]}),children:z&&(0,k.jsx)(P,{f:z,busy:_,onScope:e=>void L(z.id,e)})}),n.outOfScope.length>0&&(0,k.jsxs)(`details`,{className:`rounded-[14px] card border px-4 py-4`,children:[(0,k.jsx)(`summary`,{className:`cursor-pointer`,children:(0,k.jsxs)(`h2`,{className:`m-0 inline text-base font-semibold`,children:[`Not what ForgeQE does (`,n.outOfScope.length,`)`]})}),(0,k.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-1 p-0 text-sm`,children:n.outOfScope.map(e=>(0,k.jsxs)(`li`,{children:[e.what,e.instead?(0,k.jsxs)(`span`,{className:`text-muted`,children:[`; instead: `,e.instead]}):null]},e.what))})]})]})]});return t?(0,k.jsx)(`div`,{className:`flex flex-col gap-6`,children:B}):(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(T,{}),(0,k.jsxs)(`main`,{className:d(E,`flex-auto gap-6`),children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,k.jsx)(S,{pixel:C.features,size:`lg`}),(0,k.jsx)(`h1`,{className:`m-0 flex-1 text-[25px] font-semibold tracking-[-0.01em]`,children:`What's ready`})]}),(0,k.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`What ForgeQE can do here. Pick one to see what it needs.`}),B]})]})}export{F as Features};
@@ -1,2 +0,0 @@
1
- import{Fr as e,L as t,M as n,Mr as r,N as i,Pn as a,R as o,Rr as s,in as c,kn as l,o as ee,tr as u,vr as d}from"./line-icons-Cb4JZG1G.js";import{B as te,V as f,en as p,l as ne,o as m,p as h,r as re,st as g,t as ie,z as _}from"./filters-DoEToSM9.js";import{at as ae,in as oe,r as se,t as ce,z as v}from"./frame-5jc7OkUQ.js";import{r as y,s as le}from"./index-DAN0sMvE.js";import{_ as b,m as x,o as S}from"./qualityParts-BFHdnu9w.js";var C=s(e(),1),w={view:()=>g(`GET`,`/api/flags`),catalog:(e,t=!1)=>g(`GET`,`/api/flags/catalog?env=${encodeURIComponent(e)}${t?`&refresh=1`:``}`),preview:e=>g(`POST`,`/api/flags/preview`,e),run:e=>g(`POST`,`/api/flags/run`,{...e,confirmed:!0}),job:()=>g(`GET`,`/api/flags/job`),stop:()=>g(`POST`,`/api/flags/stop`,{})},T=p(),E={cookie:`cookie`,header:`header`,query:`query`,localStorage:`localStorage`},D={"env.yaml":`env.yaml`,launchdarkly:`LaunchDarkly`,unleash:`Unleash`},O={queued:{icon:i,label:`Queued`,tone:`text-muted`},running:{icon:c,label:`Running`,tone:`text-accent`},passed:{icon:n,label:`Passed`,tone:`text-pass`},failed:{icon:o,label:`Tests failed`,tone:`text-fail`},error:{icon:d,label:`Did not finish`,tone:`text-warn`},stopped:{icon:t,label:`Stopped`,tone:`text-muted`}};function k({status:e}){let t=O[e];return(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-2 whitespace-nowrap`,children:[(0,T.jsx)(t.icon,{size:15,"aria-label":t.label,className:f(`flex-none`,t.tone,e===`running`&&`animate-spin`)}),(0,T.jsx)(`span`,{className:`text-[13px]`,children:t.label})]})}var A=e=>Object.entries(e).map(([e,t])=>`${e}=${t}`).join(` · `);function ue({job:e,onStop:t,busy:n}){let r=e.runs.filter(e=>e.status===`passed`||e.status===`failed`||e.status===`error`||e.status===`stopped`).length,i=e.runs.filter(e=>e.status===`passed`).length,a=e.runs.filter(e=>e.status===`failed`||e.status===`error`).length;return(0,T.jsxs)(`section`,{"aria-label":`Pack ${e.pack} across ${e.runs.length} combinations`,className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,T.jsxs)(`h2`,{className:`m-0 flex-1 text-[16px] font-semibold`,children:[e.running?`Running`:`Ran`,` `,e.pack,` on `,e.environment]}),(0,T.jsxs)(`span`,{className:`text-[13px] text-muted`,"data-tip":b(e.startedAt),children:[`started `,y(e.startedAt)]}),e.running&&(0,T.jsxs)(_,{size:`sm`,variant:`danger`,disabled:n,onClick:t,children:[(0,T.jsx)(u,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-4 @xl:divide-x @xl:divide-line-soft`,children:[(0,T.jsx)(S,{label:`Combinations`,value:e.runs.length,sub:e.mode===`pairwise`?`pairwise`:`every combination`}),(0,T.jsx)(S,{label:`Finished`,value:`${r} of ${e.runs.length}`,sub:`${e.parallel} at once`}),(0,T.jsx)(S,{label:`Passed`,value:i,tone:i?`text-pass`:void 0,sub:`every test passed`}),(0,T.jsx)(S,{label:`Failed`,value:a,tone:a?`text-fail`:`text-pass`,sub:`a test failed, or the run did not finish`})]}),(0,T.jsx)(v,{label:`Runs`,placeholder:`Find a run by its values`,resetKey:e.startedAt,empty:`No runs.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[64px] py-2 pl-4 font-medium`,children:`Run`}),(0,T.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:`Flag values`}),(0,T.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:`Result`}),(0,T.jsx)(`th`,{className:`hidden py-2 pr-4 text-right font-medium @xl:table-cell`,children:`Time`})]}),children:e.runs.map(e=>{let t=e.startedAt?Math.round(((e.endedAt?Date.parse(e.endedAt):Date.now())-Date.parse(e.startedAt))/1e3):void 0;return(0,T.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,T.jsx)(`td`,{className:`py-2 pl-4 font-mono text-[13px]`,children:e.id}),(0,T.jsxs)(`td`,{className:`max-w-0 py-2 pr-4`,children:[(0,T.jsx)(`span`,{className:`block truncate font-mono text-[13px]`,"data-tip":A(e.values),children:A(e.values)}),e.lines.length>0&&(0,T.jsxs)(`details`,{className:`mt-1`,children:[(0,T.jsxs)(`summary`,{className:`cursor-pointer text-[13px] text-muted`,children:[`Output (`,x(e.lines.length,`line`),`)`]}),(0,T.jsx)(`pre`,{className:`mt-1 max-h-[240px] overflow-auto rounded-[10px] bg-surface-muted p-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:e.lines.join(`
2
- `)})]})]}),(0,T.jsx)(`td`,{className:`py-2 pr-4`,children:(0,T.jsx)(k,{status:e.status})}),(0,T.jsx)(`td`,{className:`hidden py-2 pr-4 text-right text-muted tabular-nums @xl:table-cell`,children:t===void 0?`–`:t>=60?`${(t/60).toFixed(1)}m`:`${t}s`})]},e.id)})}),(0,T.jsx)(`code`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.runs[0]?.command})]})}function j(){let[e,t]=(0,C.useState)(null),[i,s]=(0,C.useState)(``),[c,u]=(0,C.useState)(``),[p,g]=(0,C.useState)(null),[b,O]=(0,C.useState)(``),[k,A]=(0,C.useState)(!1),[j,de]=(0,C.useState)(``),[M,fe]=(0,C.useState)(`local`),[N,pe]=(0,C.useState)(`pairwise`),[P,F]=(0,C.useState)({}),[I,L]=(0,C.useState)(null),[R,z]=(0,C.useState)(``),[me,B]=(0,C.useState)(!1),[V,H]=(0,C.useState)(!1),[U,W]=(0,C.useState)(``),[G,K]=(0,C.useState)(null),q=(0,C.useCallback)(()=>{w.view().then(e=>{t(e),K(e.job),s(``),u(t=>t||e.environments.find(e=>e.flags&&!e.production)?.name||e.environments.find(e=>e.flags)?.name||``),de(t=>t||e.packs[0]?.name||``)},e=>s(e.message))},[]);(0,C.useEffect)(q,[q]);let J=(0,C.useCallback)((e,t=!1)=>{e&&(A(!0),w.catalog(e,t).then(e=>{g(e),O(``),A(!1)},e=>{g(null),O(e.message),A(!1)}))},[]);(0,C.useEffect)(()=>{F({}),L(null),B(!1),J(c)},[c,J]),(0,C.useEffect)(()=>{if(!G?.running)return;let e=setInterval(()=>{w.job().then(K,()=>{})},1500);return()=>clearInterval(e)},[G?.running]);let Y=(0,C.useMemo)(()=>Object.entries(P).filter(([,e])=>e.length).map(([e,t])=>({flag:e,values:t})),[P]),X=e?.environments.find(e=>e.name===c);(0,C.useEffect)(()=>{if(B(!1),!c||!Y.length||X?.production){L(null),z(``);return}let e=!0,t=setTimeout(()=>{w.preview({environment:c,picks:Y,mode:N,on:M,...j?{pack:j}:{}}).then(t=>{e&&(L(t),z(``))},t=>{e&&(L(null),z(t.message))})},250);return()=>{e=!1,clearTimeout(t)}},[c,Y,N,M,j,X?.production]);let he=e?.maxValues??10,ge=(e,t,n)=>{let r={...P};n?r[e]=t.slice(0,he):delete r[e],F(r)},_e=async()=>{if(I&&j){H(!0);try{let e=await w.run({environment:c,picks:Y,mode:N,pack:j,on:M});K(e),B(!1),W(`${x(e.runs.length,`run`)} of ${j} started, ${e.parallel} at once.`)}catch(e){W(e.message)}finally{H(!1)}}},ve=async()=>{H(!0);try{K(await w.stop())}catch(e){W(e.message)}finally{H(!1)}},Z=p?.flags??[],ye=e?.cap??32,Q=e?.environments.filter(e=>e.flags)??[],be=p?.sources.filter(e=>e.ok).length??0,$=Y.map(e=>e.flag);return(0,T.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,T.jsx)(se,{}),(0,T.jsxs)(`main`,{className:f(ce,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,T.jsx)(ae,{pixel:oe.flags,size:`lg`}),(0,T.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Feature-flag matrix`})]}),(0,T.jsxs)(`p`,{className:`m-0 max-w-measure text-[13px] leading-relaxed text-ink-2`,children:[`Pick feature flags of a test environment and the values to try, and run a `,(0,T.jsx)(`a`,{href:h(`regression`),children:`regression pack`}),` once per combination, side by side. Flags come from the environment's `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`flags:`}),` in env.yaml and from LaunchDarkly and Unleash, read only: nothing is changed there. Each run gets its values as `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`FORGEQE_FLAG_<KEY>`}),` and `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`FORGEQE_FLAGS`}),`, for the tests to apply as a cookie, header, query parameter or localStorage key. Environments named like production never run.`]}),i&&(0,T.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:i}),!e&&!i&&(0,T.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),e&&!Q.length&&(0,T.jsxs)(ne,{icon:d,title:`No environment lists flags yet`,action:(0,T.jsxs)(`a`,{className:te({size:`sm`}),href:h(`settings`,`environments`),"data-tip":`Open Environments in Settings`,children:[(0,T.jsx)(ee,{"aria-hidden":`true`}),`Environments`]}),children:[`Add `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`flags:`}),` to an environment of env.yaml: a `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`list:`}),` of flags and their values, and LaunchDarkly (`,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`project`}),`, `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`environment`}),`, `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`token_env`}),`) or Unleash (`,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`url`}),`, `,(0,T.jsx)(`code`,{className:`font-mono text-[13px]`,children:`token_env`}),`). The tokens stay in Settings › Secrets.`]}),e&&Q.length>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,T.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Environment`,(0,T.jsx)(m,{size:`sm`,value:c,onChange:e=>u(e.target.value),children:Q.map(e=>(0,T.jsxs)(`option`,{value:e.name,children:[e.name,e.production?` (production: read only)`:``]},e.name))})]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Regression pack`,(0,T.jsxs)(m,{size:`sm`,value:j,onChange:e=>de(e.target.value),disabled:!e.packs.length,children:[!e.packs.length&&(0,T.jsx)(`option`,{value:``,children:`No packs yet`}),e.packs.map(e=>(0,T.jsxs)(`option`,{value:e.name,children:[e.name,` (`,x(e.tests,`test`),`)`]},e.name))]})]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium`,children:[`Browsers`,(0,T.jsxs)(m,{size:`sm`,value:M,onChange:e=>fe(e.target.value===`testmu`?`testmu`:`local`),children:[(0,T.jsx)(`option`,{value:`local`,children:`This machine`}),(0,T.jsx)(`option`,{value:`testmu`,children:`TestMu AI`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,T.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Combine`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,T.jsx)(ie,{items:[{id:`pairwise`,label:`Pairwise`},{id:`all`,label:`Every combination`}],value:N,onChange:pe})})]}),(0,T.jsxs)(_,{size:`sm`,variant:`ghost`,disabled:k||!c,onClick:()=>J(c,!0),"data-tip":`Read the flags from LaunchDarkly and Unleash again`,children:[(0,T.jsx)(a,{"aria-hidden":`true`}),`Refresh`]})]}),X?.production&&(0,T.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:[X.name,` is named like production: its flags are shown, but no combination runs there.`]}),!e.packs.length&&(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`No regression pack yet: build one on `,(0,T.jsx)(`a`,{href:h(`regression`),children:`Regression`}),` to run the combinations.`]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-5 @xl:divide-x @xl:divide-line-soft`,children:[(0,T.jsx)(S,{label:`Flags`,value:Z.length,sub:p?`from ${x(p.sources.length,`source`)}`:k?`reading…`:`–`}),(0,T.jsx)(S,{label:`Sources read`,value:p?`${be} of ${p.sources.length}`:`–`,tone:p&&be<p.sources.length?`text-warn`:void 0,sub:p?`read ${y(p.fetchedAt)}`:void 0}),(0,T.jsx)(S,{label:`Picked`,value:Y.length,sub:Y.length?x(Y.reduce((e,t)=>e+t.values.length,0),`value`):`pick flags below`}),(0,T.jsx)(S,{label:`Combinations`,value:I?I.count:`–`,tone:I?.over?`text-fail`:void 0,sub:I?`at most ${ye}${I.mode===`pairwise`?`; ${I.allCount} for every one`:``}`:`at most ${ye}`}),(0,T.jsx)(S,{label:`At once`,value:I&&!I.over?I.parallel:`–`,sub:`as devices run (suite.parallel)`})]}),b&&(0,T.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:b}),p&&p.sources.length>0&&(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:p.sources.map(e=>(0,T.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.ok?(0,T.jsx)(n,{size:15,"aria-label":`Read`,className:`text-pass`}):(0,T.jsx)(o,{size:15,"aria-label":`Not read`,className:`text-fail`}),(0,T.jsx)(`span`,{className:`font-medium`,children:D[e.source]}),(0,T.jsx)(`span`,{className:`font-mono text-[13px] text-muted`,children:e.where}),(0,T.jsx)(`span`,{className:`text-ink-2`,children:e.ok?`${x(e.flags,`flag`)}${e.skipped?`, ${e.skipped} left out (not a plain shape)`:``}`:e.error})]},e.source))}),p&&p.problems.length>0&&(0,T.jsxs)(`details`,{className:`text-[13px]`,children:[(0,T.jsxs)(`summary`,{className:`cursor-pointer text-warn`,children:[x(p.problems.length,`problem`),` in env.yaml's flags`]}),(0,T.jsx)(`ul`,{className:`m-0 mt-1 flex flex-col gap-1 pl-6 text-ink-2`,children:p.problems.map((e,t)=>(0,T.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))})]}),p&&(0,T.jsx)(v,{label:`Flags`,placeholder:`Find a flag`,resetKey:p.environment,empty:k?`Reading…`:`No flags listed for this environment.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-8 py-2 pl-4 font-medium`,children:(0,T.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,T.jsx)(`th`,{className:`w-[26%] py-2 pr-4 font-medium`,children:`Flag`}),(0,T.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @xl:table-cell`,children:`Source`}),(0,T.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @2xl:table-cell`,children:`Now`}),(0,T.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:`Values to try`}),(0,T.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @3xl:table-cell`,children:`Delivered as`})]}),children:Z.map(t=>{let n=P[t.key];return(0,T.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,T.jsx)(`td`,{className:`py-2 pl-4`,children:(0,T.jsx)(le,{"aria-label":`Pick ${t.key}`,checked:!!n,disabled:!n&&Y.length>=(e.maxFlags??12),onCheckedChange:e=>ge(t.key,t.values,e)})}),(0,T.jsx)(`td`,{className:`max-w-0 py-2 pr-4`,children:(0,T.jsx)(`span`,{className:`block truncate font-mono text-[13px]`,"data-tip":t.title?`${t.key} · ${t.title}`:t.key,children:t.key})}),(0,T.jsx)(`td`,{className:`hidden py-2 pr-4 text-[13px] whitespace-nowrap @xl:table-cell`,children:D[t.source]}),(0,T.jsx)(`td`,{className:`hidden py-2 pr-4 font-mono text-[13px] text-muted @2xl:table-cell`,children:t.current??`–`}),(0,T.jsx)(`td`,{className:`py-2 pr-4`,children:n?(0,T.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,T.jsx)(re,{items:t.values.map(e=>({id:e,label:e})),value:n,onChange:e=>F({...P,[t.key]:e.slice(0,he)})})}):(0,T.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-muted`,"data-tip":t.values.join(`, `),children:t.values.join(`, `)})}),(0,T.jsxs)(`td`,{className:`hidden py-2 pr-4 text-[13px] whitespace-nowrap @3xl:table-cell`,children:[E[t.via],` `,(0,T.jsx)(`span`,{className:`font-mono text-muted`,children:t.deliverAs})]})]},t.key)})}),R&&(0,T.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:R}),I?.over&&(0,T.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail`,children:[I.count,` combinations: at most `,I.cap,` run. Pick fewer flags or values`,I.mode===`all`?`, or combine pairwise`:``,`.`]}),I&&!I.over&&I.runs.length>0&&(0,T.jsxs)(`section`,{"aria-label":`What each run would get`,className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`h2`,{className:`m-0 flex-1 text-[16px] font-semibold`,children:`What each run would get`}),me?(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[10px] bg-surface-muted px-4 py-2 text-[13px]`,children:[(0,T.jsxs)(`span`,{children:[`Run `,j,` `,x(I.runs.length,`time`),` on `,I.environment,`, `,I.parallel,` at once?`]}),(0,T.jsxs)(_,{size:`sm`,variant:`primary`,disabled:V,onClick:()=>void _e(),children:[(0,T.jsx)(l,{"aria-hidden":`true`}),`Run`]}),(0,T.jsxs)(_,{size:`sm`,variant:`ghost`,disabled:V,onClick:()=>B(!1),children:[(0,T.jsx)(r,{"aria-hidden":`true`}),`Cancel`]})]}):(0,T.jsxs)(_,{size:`sm`,disabled:!j||!!G?.running||V,onClick:()=>B(!0),"data-tip":G?.running?`A matrix is running: wait for it, or stop it`:j?`Run ${x(I.runs.length,`combination`)}`:`Pick a regression pack`,children:[(0,T.jsx)(l,{"aria-hidden":`true`}),`Run (`,I.runs.length,`)`]})]}),(0,T.jsx)(v,{label:`Combinations`,placeholder:`Find a combination`,resetKey:`${I.mode}-${I.count}-${$.join(`,`)}`,empty:`No combinations.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[64px] py-2 pl-4 font-medium`,children:`Run`}),$.map(e=>(0,T.jsx)(`th`,{className:`max-w-[160px] truncate py-2 pr-4 font-medium`,"data-tip":e,children:e},e))]}),children:I.runs.map(e=>(0,T.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,T.jsx)(`td`,{className:`py-2 pl-4 font-mono text-[13px]`,children:e.id}),$.map(t=>{let n=e.deliver.find(e=>e.flag===t);return(0,T.jsx)(`td`,{className:`py-2 pr-4 font-mono text-[13px]`,"data-tip":n?`${E[n.via]} ${n.name}=${n.value} · FORGEQE_FLAG_ variable`:void 0,children:e.values[t]},t)})]},e.id))}),I.pack&&(0,T.jsx)(`code`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:I.commands[I.runs[0].id]})]}),U&&(0,T.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:U})]}),G&&(0,T.jsx)(ue,{job:G,busy:V,onStop:()=>void ve()})]})]})}export{j as Flags};
@@ -1 +0,0 @@
1
- import{Fr as e,Ln as t,M as n,Mr as r,R as i,Rr as a,Yn as o,jr as ee,o as s,vr as c}from"./line-icons-Cb4JZG1G.js";import{B as l,Mt as u,V as d,a as f,en as p,l as m,p as h,t as g,xt as _,z as v}from"./filters-DoEToSM9.js";import{at as te,in as ne,r as re,t as y,z as b}from"./frame-5jc7OkUQ.js";import{s as x}from"./index-DAN0sMvE.js";import{t as S}from"./segmented-ZM3wOT2F.js";import{o as C}from"./qualityParts-BFHdnu9w.js";import{r as w}from"./families-C_rjd0Xf.js";var T=a(e(),1),E=p(),D={timing:`Timing`,locator:`Locator`,overlay:`Overlay`,data:`Data`,network:`Network`,environment:`Environment`,unknown:`No pattern`};function O(e,t,n){return e.filter(e=>(t===`all`||t===`flaky`&&(e.flaky||e.quarantined)||t===`quarantined`&&e.quarantined||t===`release`&&e.releasable)&&(n===`all`||e.cause===n))}var k=e=>e>=60?`${(e/60).toFixed(1)}m`:`${e.toFixed(+(e<10))}s`;function A({trail:e}){return(0,E.jsx)(`span`,{className:`font-mono text-[13px] tracking-[0.08em]`,"aria-label":`Last results, oldest first: ${e}`,children:[...e].map((e,t)=>(0,E.jsx)(`span`,{className:e===`✓`?`text-pass`:e===`✗`?`text-fail`:e===`↻`?`text-warn`:`text-muted`,children:e},t))})}function j(){let[e,a]=(0,T.useState)(null),[p,j]=(0,T.useState)(``),[M,ie]=(0,T.useState)(`flaky`),[N,ae]=(0,T.useState)(`all`),[P,F]=(0,T.useState)(new Set),[I,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(``),[B,V]=(0,T.useState)(!1),[H,U]=(0,T.useState)(``),W=(0,T.useCallback)(()=>{_.view().then(e=>{a(e),j(``)},e=>j(e.message))},[]);(0,T.useEffect)(W,[W]);let G=e?.tests??[],K=O(G,M,N),q=G.filter(e=>e.flaky&&!e.quarantined).length,oe=G.filter(e=>e.quarantined).length,J=G.filter(e=>e.releasable).length,Y=Object.keys(D).filter(t=>e?.causes[t]),X=Y.sort((t,n)=>(e.causes[n]??0)-(e.causes[t]??0))[0],Z=G.filter(e=>P.has(e.name)),se=Z.some(e=>!e.quarantined),ce=Z.some(e=>e.quarantined),le=(e,t)=>{let n=new Set(P);t?n.add(e):n.delete(e),F(n)},ue=async()=>{if(!I)return;let e=I===`release`,t=Z.filter(t=>e?t.quarantined:!t.quarantined).map(e=>e.name);V(!0);try{a(await _.quarantine(t,e,R.trim()||void 0)),U(`${t.length} test${t.length===1?``:`s`} ${e?`released from`:`put in`} quarantine.`),F(new Set),L(null),z(``)}catch(e){U(e.message)}finally{V(!1)}},Q=async e=>{let t=e.healIn[0];if(t){V(!0);try{await u.heal(t,[e.name]),location.hash=h(`regression`,encodeURIComponent(t))}catch(e){U(e.message),V(!1)}}},$=`py-2 pr-4 text-right tabular-nums`;return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(re,{}),(0,E.jsxs)(`main`,{className:d(y,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,E.jsx)(te,{pixel:ne.flaky,size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Flaky tests`})]}),(0,E.jsx)(S,{label:`Runs and reports`,links:w,current:`flaky`})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-measure text-[13px] leading-relaxed text-ink-2`,children:[`Each automated test of `,e?.repo&&e.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[13px]`,children:e.repo}):`the test repository`,` scored from its last 20 results: flips between passing and failing, passes on a retry, and how much its run time varies. A test counts as flaky from a score of `,e?.flakyAfter??2,` (flaky.flaky_after). Quarantine changes no test code: the test still runs, but its failure does not fail the run. Heal sends a test the last `,(0,E.jsx)(`a`,{href:h(`regression`),children:`Regression`}),` run sent to healing.`]}),p&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),!e&&!p&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),e&&!G.length&&(0,E.jsx)(m,{icon:c,title:`No test history yet`,action:(0,E.jsxs)(`a`,{className:l({size:`sm`}),href:h(`regression`),"data-tip":`Open Regression`,children:[(0,E.jsx)(s,{"aria-hidden":`true`}),`Regression`]}),children:`ForgeQE keeps each automated test's results in .forgeqe/test-history.json whenever it runs the repository's tests: run a regression pack, or ask in a chat to run the tests, and their history shows here.`}),e&&G.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-5 @xl:divide-x @xl:divide-line-soft`,children:[(0,E.jsx)(C,{label:`Tests tracked`,value:G.length,sub:`with a history`}),(0,E.jsx)(C,{label:`Flaky`,value:q,tone:q?`text-warn`:`text-pass`,sub:`not in quarantine`}),(0,E.jsx)(C,{label:`In quarantine`,value:oe,sub:`still run, not counted`}),(0,E.jsx)(C,{label:`Ready to release`,value:J,tone:J?`text-pass`:void 0,sub:`5 clean runs in a row`}),(0,E.jsx)(C,{label:`Most common cause`,value:X?D[X]:`–`,sub:X?`${e.causes[X]} test${e.causes[X]===1?``:`s`}`:`nothing flaky`})]}),Y.length>0&&(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Likely cause`}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,E.jsx)(g,{items:[{id:`all`,label:`All causes`},...Y.map(t=>({id:t,label:D[t],n:e.causes[t]}))],value:N,onChange:ae})}),N!==`all`&&(0,E.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:e.causeText[N]})]}),P.size>0&&(0,E.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[10px] bg-surface-muted px-4 py-2 text-[13px]`,children:I?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{children:[I===`release`?`Release`:`Quarantine`,` `,Z.filter(e=>I===`release`?e.quarantined:!e.quarantined).length,` test(s)?`]}),I===`quarantine`&&(0,E.jsx)(f,{size:`sm`,"aria-label":`Reason`,placeholder:`Reason (optional)`,value:R,maxLength:200,onChange:e=>z(e.target.value),className:`w-full max-w-[320px] flex-[0_1_320px]`}),(0,E.jsxs)(v,{size:`sm`,disabled:B,onClick:()=>void ue(),children:[I===`release`?(0,E.jsx)(t,{"aria-hidden":`true`}):(0,E.jsx)(o,{"aria-hidden":`true`}),I===`release`?`Release`:`Quarantine`]}),(0,E.jsxs)(v,{size:`sm`,variant:`ghost`,disabled:B,onClick:()=>L(null),children:[(0,E.jsx)(r,{"aria-hidden":`true`}),`Cancel`]})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{children:[P.size,` picked`]}),se&&(0,E.jsxs)(v,{size:`sm`,onClick:()=>L(`quarantine`),children:[(0,E.jsx)(o,{"aria-hidden":`true`}),`Quarantine`]}),ce&&(0,E.jsxs)(v,{size:`sm`,onClick:()=>L(`release`),"data-tip":`Release from quarantine`,children:[(0,E.jsx)(t,{"aria-hidden":`true`}),`Release`]}),(0,E.jsxs)(v,{size:`sm`,variant:`ghost`,onClick:()=>F(new Set),"data-tip":`Clear the selection`,children:[(0,E.jsx)(r,{"aria-hidden":`true`}),`Clear`]})]})}),H&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:H}),(0,E.jsx)(b,{label:`Tests`,placeholder:`Find a test by name`,resetKey:`${M}-${N}`,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,E.jsx)(g,{items:[{id:`flaky`,label:`Flaky`,n:O(G,`flaky`,N).length,alert:!0},{id:`quarantined`,label:`In quarantine`,n:O(G,`quarantined`,N).length},{id:`release`,label:`Ready to release`,n:O(G,`release`,N).length},{id:`all`,label:`All`,n:O(G,`all`,N).length}],value:M,onChange:ie})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-8 py-2 pl-4 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,E.jsx)(`th`,{className:`w-[38%] py-2 pr-4 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @xl:table-cell`,children:`Last results`}),(0,E.jsx)(`th`,{className:`py-2 pr-4 text-right font-medium`,children:`Passed`}),(0,E.jsx)(`th`,{className:`hidden py-2 pr-4 text-right font-medium @2xl:table-cell`,children:`Flips`}),(0,E.jsx)(`th`,{className:`hidden py-2 pr-4 text-right font-medium @2xl:table-cell`,children:`Retry passes`}),(0,E.jsx)(`th`,{className:`hidden py-2 pr-4 text-right font-medium @3xl:table-cell`,children:`Run time`}),(0,E.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:`Cause`}),(0,E.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:K.map(t=>{let r=t.quarantined?o:t.flaky?c:t.passRate===1?n:i,a=t.quarantined?t.releasable?`In quarantine, ready to release`:`In quarantine`:t.flaky?`Flaky`:t.passRate===1?`Steady`:`Failing`;return(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pl-4`,children:(0,E.jsx)(x,{"aria-label":`Pick ${t.name}`,checked:P.has(t.name),onCheckedChange:e=>le(t.name,e)})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-4`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":a,className:d(`flex-none`,t.quarantined?`text-muted`:t.flaky?`text-warn`:t.passRate===1?`text-pass`:`text-fail`)}),(0,E.jsx)(`span`,{"data-tip":t.quarantined?`${t.name} · quarantined: ${t.quarantined.reason}`:t.name,className:`truncate`,children:t.name})]})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-4 @xl:table-cell`,children:(0,E.jsx)(A,{trail:t.trail})}),(0,E.jsxs)(`td`,{className:d($,t.passRate<.8?`text-fail`:`text-muted`),children:[Math.round(t.passRate*100),`%`]}),(0,E.jsx)(`td`,{className:d($,`hidden @2xl:table-cell`,t.flips?`text-warn`:`text-muted`),children:t.flips}),(0,E.jsx)(`td`,{className:d($,`hidden @2xl:table-cell`,t.retryPasses?`text-warn`:`text-muted`),children:t.retryPasses}),(0,E.jsx)(`td`,{className:d($,`hidden @3xl:table-cell`,t.timing&&t.timing.spread>1?`text-warn`:`text-muted`),"data-tip":t.timing?`fastest ${k(t.timing.min)}, slowest ${k(t.timing.max)}`:void 0,children:t.timing?`${k(t.timing.median)} ±${Math.round(t.timing.spread*50)}%`:`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-4 whitespace-nowrap text-[13px]`,"data-tip":t.example?`${e.causeText[t.cause]} · e.g. ${t.example}`:e.causeText[t.cause],children:t.flaky||t.quarantined||t.passRate<1?D[t.cause]:`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-4 text-right whitespace-nowrap`,children:t.healIn.length>0&&(0,E.jsx)(v,{variant:`icon`,size:`icon-sm`,disabled:B,onClick:()=>void Q(t),"aria-label":`Heal ${t.name} with forgeqe pack heal in pack ${t.healIn[0]}`,"data-tip":`Heal ${t.name} with forgeqe pack heal in pack ${t.healIn[0]}`,children:(0,E.jsx)(ee,{"aria-hidden":`true`})})})]},t.name)})})]})]})]})}export{D as CAUSE_LABEL,j as Flaky,O as shown};