@capagents/forgeqe 3.1.0 → 3.1.1

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 (107) hide show
  1. package/HOW_TO_USE.md +34 -21
  2. package/dist/docs-site/docs/index.html +25 -4
  3. package/dist/docs-site/docs/search.js +1 -1
  4. package/dist/forgeqe.js +2160 -1802
  5. package/dist/web/assets/{AgentWork-C3KdZh5M.js → AgentWork-DwAI0_Of.js} +1 -1
  6. package/dist/web/assets/ApiTests-C0vFSHmM.js +10 -0
  7. package/dist/web/assets/Browse-5jfdtRc5.js +2 -0
  8. package/dist/web/assets/Chat-B3uhI94O.js +3 -0
  9. package/dist/web/assets/{CommandPalette-D89NM2_E.js → CommandPalette-D2J4nf5y.js} +1 -1
  10. package/dist/web/assets/{Compare-YfFYHwfK.js → Compare-CN75w1p9.js} +1 -1
  11. package/dist/web/assets/Cost-QoxyjR95.js +1 -0
  12. package/dist/web/assets/{Data-jSFgAfej.js → Data-BAvkcBVt.js} +4 -4
  13. package/dist/web/assets/Desktop-BXdOIalN.js +1 -0
  14. package/dist/web/assets/DesktopReview-Bl2SrPP0.js +1 -0
  15. package/dist/web/assets/Evidence-BJ_I52CD.js +1 -0
  16. package/dist/web/assets/{Explore-BdFvqgF4.js → Explore-D9AuyTip.js} +2 -2
  17. package/dist/web/assets/Features-CusGMDR9.js +1 -0
  18. package/dist/web/assets/Flags-CycGFuUP.js +2 -0
  19. package/dist/web/assets/Flaky-BcSzJogN.js +1 -0
  20. package/dist/web/assets/Impact-CJHnyZ21.js +3 -0
  21. package/dist/web/assets/Jobs-4xcFzEFo.js +5 -0
  22. package/dist/web/assets/KindPage-BielEIej.js +6 -0
  23. package/dist/web/assets/Migration-NwanKpJg.js +2 -0
  24. package/dist/web/assets/PageAgent-CNw4NXva.js +1 -0
  25. package/dist/web/assets/Product-DS3LJZ4P.js +7 -0
  26. package/dist/web/assets/Production-D3zsyNIS.js +1 -0
  27. package/dist/web/assets/Quality-Ctj2YpC4.js +1 -0
  28. package/dist/web/assets/Readiness-DGcRr_co.js +1 -0
  29. package/dist/web/assets/Record-Cc-wGe_Y.js +1 -0
  30. package/dist/web/assets/Regression-DcsbrRa1.js +5 -0
  31. package/dist/web/assets/Reports-BkCn0-Sf.js +2 -0
  32. package/dist/web/assets/Response-BP0UwQcW.js +9 -0
  33. package/dist/web/assets/Responsive-C8U7dumd.js +3 -0
  34. package/dist/web/assets/RunDiff-BhABuhF_.js +1 -0
  35. package/dist/web/assets/Runs-OwdWEYBv.js +2 -0
  36. package/dist/web/assets/Steps-BvzbQyoD.js +2 -0
  37. package/dist/web/assets/TestCases-CLq_6JA5.js +1 -0
  38. package/dist/web/assets/{TestData-e3IX0xwG.js → TestData-B0oKAhp6.js} +2 -2
  39. package/dist/web/assets/TestDebt-8NLQ5YV_.js +1 -0
  40. package/dist/web/assets/TestManagement-2LYQ7vsN.js +1 -0
  41. package/dist/web/assets/Tosca-DfvMpPTG.js +3 -0
  42. package/dist/web/assets/{WhatsNew-CwnRbDnd.js → WhatsNew-BGFNGwqN.js} +1 -1
  43. package/dist/web/assets/families-DYlN5v0i.js +1 -0
  44. package/dist/web/assets/filters-faaSnoIq.js +1 -0
  45. package/dist/web/assets/{fold-tvLGnxD1.js → fold-CUjwWAK3.js} +1 -1
  46. package/dist/web/assets/frame-BLPdAXUq.js +13 -0
  47. package/dist/web/assets/head-CsTxBsO0.js +1 -0
  48. package/dist/web/assets/index-CxiCvGZq.js +78 -0
  49. package/dist/web/assets/index-dOIsrzhD.css +2 -0
  50. package/dist/web/assets/line-icons-CwZWt93L.js +1 -0
  51. package/dist/web/assets/logos-dGuc1jIM.js +1 -0
  52. package/dist/web/assets/{markdown-DC2HA0yZ.js → markdown-BI3F-SJ1.js} +5 -5
  53. package/dist/web/assets/{paletteCommands-Qxm5DZIs.js → paletteCommands-QJiCuUEr.js} +1 -1
  54. package/dist/web/assets/{parts-BR6dUwqn.js → parts-CdF1f7yS.js} +1 -1
  55. package/dist/web/assets/{productParts-BxdHuSBa.js → productParts-hNLD9fN0.js} +1 -1
  56. package/dist/web/assets/qualityParts-CT25lBWU.js +1 -0
  57. package/dist/web/assets/{recordTest-CcplpTS6.js → recordTest-P792aBUt.js} +1 -1
  58. package/dist/web/index.html +6 -12
  59. package/docs/user-guide.html +64 -11
  60. package/package.json +1 -1
  61. package/prompts/responsive-review.md +38 -0
  62. package/prompts/responsive-split.md +40 -0
  63. package/prompts/responsive.md +42 -0
  64. package/dist/web/assets/ApiTests-BLnl7JGO.js +0 -10
  65. package/dist/web/assets/Browse-C-Enjpmd.js +0 -2
  66. package/dist/web/assets/Chat-Bt6jZI68.js +0 -3
  67. package/dist/web/assets/Choices-D5eTFinz.js +0 -3
  68. package/dist/web/assets/Cost-ClaDz0YR.js +0 -1
  69. package/dist/web/assets/Desktop-BofKeLVf.js +0 -1
  70. package/dist/web/assets/DesktopReview--WjeZh3w.js +0 -1
  71. package/dist/web/assets/Evidence-CJNzSQpY.js +0 -1
  72. package/dist/web/assets/Features-CIBbw6PG.js +0 -1
  73. package/dist/web/assets/Flags-B62v4uWR.js +0 -2
  74. package/dist/web/assets/Flaky-Cut1kZw6.js +0 -1
  75. package/dist/web/assets/Impact-jOSl5Q0k.js +0 -3
  76. package/dist/web/assets/Jobs-DMJGgWtQ.js +0 -5
  77. package/dist/web/assets/KindPage-BbQWH5wa.js +0 -6
  78. package/dist/web/assets/Migration-BBgv7xXo.js +0 -2
  79. package/dist/web/assets/PageAgent-txbNoP6u.js +0 -1
  80. package/dist/web/assets/Product-BrXH81Ns.js +0 -7
  81. package/dist/web/assets/Production-CCVtFNGQ.js +0 -1
  82. package/dist/web/assets/Quality-Dxh-60A8.js +0 -1
  83. package/dist/web/assets/Readiness-DyJvSOLN.js +0 -1
  84. package/dist/web/assets/Record-Dnlkimjb.js +0 -1
  85. package/dist/web/assets/Regression-D2DDTwzs.js +0 -5
  86. package/dist/web/assets/Reports-ClcY7M0Q.js +0 -2
  87. package/dist/web/assets/Response-D9FYUvHg.js +0 -9
  88. package/dist/web/assets/RunDiff-CNImaEdz.js +0 -1
  89. package/dist/web/assets/Runs-CFvmdULI.js +0 -2
  90. package/dist/web/assets/Steps-BS66s0E1.js +0 -2
  91. package/dist/web/assets/TestCases-CrQEUtfD.js +0 -1
  92. package/dist/web/assets/TestDebt-tXPoexMF.js +0 -1
  93. package/dist/web/assets/TestManagement-wjGaoZzI.js +0 -1
  94. package/dist/web/assets/Tosca-C5YaMLS0.js +0 -3
  95. package/dist/web/assets/azuredevops-BcQ5AFOM.js +0 -1
  96. package/dist/web/assets/crew-CWfjZIxE.js +0 -1
  97. package/dist/web/assets/families-DWilSDct.js +0 -1
  98. package/dist/web/assets/filters-CVzIOjPG.js +0 -1
  99. package/dist/web/assets/frame-Deu1IqzV.js +0 -13
  100. package/dist/web/assets/index-BWMIKyPB.js +0 -76
  101. package/dist/web/assets/index-C2Yq55oT.css +0 -2
  102. package/dist/web/assets/line-icons-C_amZ5-o.js +0 -1
  103. package/dist/web/assets/logos-C1NBtBMc.js +0 -1
  104. package/dist/web/assets/logos-DFyhMw0i.js +0 -1
  105. package/dist/web/assets/qualityParts-lz6eYVxC.js +0 -1
  106. package/dist/web/assets/today-DuQFapJM.js +0 -1
  107. package/dist/web/assets/when-CHnpLdYw.js +0 -1
@@ -1,2 +0,0 @@
1
- import{E as e,Fn as t,Ft as n,Ir as r,M as i,N as a,R as o,_t as s,ct as c,dn as l,zr as u}from"./line-icons-C_amZ5-o.js";import{$t as d,B as f,H as p,Lt as m,V as h,h as g,i as _,l as v,o as y,p as b,u as x,z as S}from"./filters-CVzIOjPG.js";import{F as C,M as w,at as T,bn as E,bt as D,it as O,o as k,rt as A,t as j}from"./frame-Deu1IqzV.js";import{n as M}from"./markdown-DC2HA0yZ.js";import{n as N,t as P}from"./when-CHnpLdYw.js";import{U as F}from"./index-BWMIKyPB.js";import{r as I}from"./families-DWilSDct.js";var L=u(r(),1),R=d(),z={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`Mobile run`,page:`Report page`},B=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`})},V=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`};function H(e){return e.scope===`page`?{tone:`neutral`,label:`Report`}:e.counts.total?e.counts.failed?{tone:`fail`,label:`${e.counts.failed} failed`}:e.stopped||e.counts.other?{tone:`warn`,label:e.stopped?`Stopped`:`${e.counts.other} not run`}:{tone:`pass`,label:`Passed`}:{tone:`neutral`,label:`No results`}}var U=50;function W({r:e}){let t=H(e),n=e.scope===`page`?s:t.tone===`pass`?i:t.tone===`fail`?o:a;return(0,R.jsx)(n,{size:16,"aria-label":t.label,className:h(`flex-none`,t.tone===`pass`?`text-pass`:t.tone===`fail`?`text-fail`:t.tone===`warn`?`text-warn`:`text-muted`)})}var G=e=>{let t=new Date(`${e}T12:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString([],{day:`numeric`,month:`short`})},K=e=>{let t=e.reduce((e,t)=>e+t.cases,0);return t?Math.round(e.reduce((e,t)=>e+t.passed,0)/t*100):null};function q({title:e,note:t,children:n,className:r}){return(0,R.jsxs)(`section`,{className:h(`flex min-w-0 flex-col rounded-[14px] card border px-4 py-4`,r),children:[(0,R.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:e}),t&&(0,R.jsx)(`p`,{className:`m-0 mt-1 text-[13px] text-muted`,children:t}),(0,R.jsx)(`div`,{className:`mt-4 flex min-w-0 flex-col`,children:n})]})}function J({part:e,whole:t,tone:n,label:r}){return(0,R.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-16 flex-none overflow-hidden rounded-full bg-surface-strong`,children:(0,R.jsx)(`span`,{className:h(`block h-full rounded-full transition-[width] duration-200 ease-out`,n===`pass`?`bg-pass`:n===`fail`?`bg-fail`:`bg-accent`),style:{width:`${t?Math.max(4,e/t*100):0}%`}})}),(0,R.jsx)(`span`,{className:`text-[13px] whitespace-nowrap text-ink-2 tabular-nums`,children:r})]})}function Y({days:e}){let[t,n]=(0,L.useState)(null),r=e.slice(-30);if(!r.length)return(0,R.jsx)(`p`,{className:`m-0 py-6 text-sm text-muted`,children:`No runs with results yet.`});let i=Math.max(1,...r.map(e=>e.cases)),a=i<=4?1:Math.ceil(i/4/5)*5||1,o=Math.ceil(i/a)*a,s=[o,Math.round(o/2),0],c=Math.ceil(r.length/8),l=t===null?null:r[t];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{"aria-hidden":`true`,className:`flex gap-4 text-[13px] text-ink-2`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-fail`}),` Failed`]})]}),(0,R.jsxs)(`div`,{className:`relative grid grid-cols-[32px_minmax(0,1fr)] gap-x-2`,children:[(0,R.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-[180px] flex-col justify-between text-right text-[13px] text-muted tabular-nums`,children:s.map(e=>(0,R.jsx)(`span`,{className:`-translate-y-1/2 first:translate-y-0 last:translate-y-0`,children:e},e))}),(0,R.jsxs)(`div`,{className:`relative h-[180px]`,onMouseLeave:()=>n(null),children:[s.map((e,t)=>(0,R.jsx)(`span`,{"aria-hidden":`true`,className:h(`absolute inset-x-0 border-t`,t===s.length-1?`border-line`:`border-line-soft`),style:{top:`${(1-e/o)*100}%`}},e)),(0,R.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-1`,children:r.map((e,r)=>{let i=e.cases-e.passed;return(0,R.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 cursor-default flex-col justify-end`,onMouseEnter:()=>n(r),children:(0,R.jsxs)(`div`,{className:h(`flex w-full flex-col justify-end gap-1 transition-opacity`,t!==null&&t!==r&&`opacity-50`),style:{height:`${e.cases/o*100}%`},children:[i>0&&(0,R.jsx)(`span`,{className:`min-h-[2px] w-full rounded-t-[4px] bg-fail`,style:{flexGrow:i}}),e.passed>0&&(0,R.jsx)(`span`,{className:h(`min-h-[2px] w-full bg-pass`,!i&&`rounded-t-[4px]`),style:{flexGrow:e.passed}})]})},e.day)})}),l&&(0,R.jsxs)(`div`,{role:`status`,className:`pointer-events-none absolute z-[2] w-max max-w-[220px] -translate-x-1/2 -translate-y-[calc(100%+8px)] rounded-[10px] border border-line-soft bg-surface-muted px-4 py-2 text-[13px] shadow-composer`,style:{left:`${Math.min(88,Math.max(12,(t+.5)/r.length*100))}%`,top:`${(1-l.cases/o)*100}%`},children:[(0,R.jsx)(`b`,{className:`block text-ink`,children:G(l.day)}),(0,R.jsxs)(`span`,{className:`block text-ink-2 tabular-nums`,children:[l.passed,` passed, `,l.cases-l.passed,` failed · `,K([l]),`%`]}),(0,R.jsx)(`span`,{className:`block text-muted`,children:p(l.runs,`run`)})]})]}),(0,R.jsx)(`span`,{}),(0,R.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-1 text-[13px] text-muted`,children:r.map((e,t)=>(0,R.jsx)(`span`,{className:`min-w-0 flex-1 text-center whitespace-nowrap`,children:t%c===0&&(0,R.jsx)(`span`,{className:h(t/c%2==1&&`hidden @2xl:inline`),children:G(e.day)})},e.day))})]}),(0,R.jsxs)(`table`,{className:`sr-only`,children:[(0,R.jsx)(`caption`,{children:`Cases by day`}),(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Day`}),(0,R.jsx)(`th`,{children:`Runs`}),(0,R.jsx)(`th`,{children:`Passed`}),(0,R.jsx)(`th`,{children:`Failed`})]})}),(0,R.jsx)(`tbody`,{children:r.map(e=>(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`td`,{children:e.day}),(0,R.jsx)(`td`,{children:e.runs}),(0,R.jsx)(`td`,{children:e.passed}),(0,R.jsx)(`td`,{children:e.cases-e.passed})]},e.day))})]})]})}function X({project:e,build:r,onBuilt:i}){let[a,s]=(0,L.useState)(r),[u,d]=(0,L.useState)(``),_=!!a?.running;(0,L.useEffect)(()=>{if(!_)return;let e=setInterval(async()=>{try{let e=await m.buildStatus();s(e),e&&!e.running&&i()}catch{}},1200);return()=>clearInterval(e)},[_,i]);let y=e.cases?Math.round(e.passed/e.cases*100):null,T=K(e.days.slice(-7)),E=K(e.days.slice(-14,-7)),D=T!==null&&E!==null?T-E:null,k=[{label:`Runs`,value:String(e.runs),sub:e.runs?`${G(String(e.from).slice(0,10))} – ${G(String(e.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(e.cases),sub:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`text-pass`,children:[e.passed,` passed`]}),` · `,(0,R.jsxs)(`span`,{className:h(e.failed&&`text-fail`),children:[e.failed,` failed`]})]})},{label:`Tokens`,value:C(e.tokens),sub:e.cost?w(e.cost.amount,e.cost.currency):void 0}];return(0,R.jsxs)(`section`,{"aria-labelledby":`project-h`,className:`flex min-w-0 flex-col gap-4`,children:[(0,R.jsx)(`h2`,{id:`project-h`,className:`sr-only`,children:`Project report`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] text-[13px] text-muted`,children:e.page?`The HTML report was built ${B(e.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),e.page&&(0,R.jsxs)(S,{size:`sm`,"data-tip":`Open the HTML report`,onClick:async()=>d(await x(e.page.file)),children:[(0,R.jsx)(c,{"aria-hidden":`true`}),`Report`]}),(0,R.jsx)(S,{size:`sm`,variant:`outline`,disabled:_,"data-tip":e.page?`Build the HTML report again`:`Build the HTML report`,onClick:async()=>{d(``);try{s(await m.build())}catch(e){d(e.message)}},children:_?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(g,{state:`working`,px:14}),`Building…`]}):e.page?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(t,{"aria-hidden":`true`}),`Rebuild`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(n,{"aria-hidden":`true`}),`Build`]})})]}),u&&(0,R.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:u}),a&&(a.running||a.ok===!1)&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!a.running&&(0,R.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:`forgeqe bi build stopped with a problem; its output is below.`}),(0,R.jsx)(`pre`,{"aria-label":`forgeqe bi build output`,"aria-live":`polite`,className:`m-0 max-h-[200px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:a.lines.length?a.lines.join(`
2
- `):`Starting…`})]}),e.runs?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(O,{label:`Project numbers`,children:[(0,R.jsx)(A,{label:`Pass rate`,big:!0,value:y===null?`–`:`${y}%`,tone:y!==null&&y<80?`text-fail`:void 0,change:D===null?void 0:{text:D===0?`Same`:`${D>0?`+`:`−`}${Math.abs(D)} ${Math.abs(D)===1?`point`:`points`}`,dir:D>0?`up`:D<0?`down`:`same`,good:D>0,against:D===0?`as the week before`:`on the week before`}}),k.map(e=>(0,R.jsx)(A,{label:e.label,value:e.value,note:e.sub},e.label))]}),(0,R.jsx)(q,{title:`Cases by day`,note:`The last ${p(Math.min(30,e.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,R.jsx)(Y,{days:e.days})}),(0,R.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,R.jsx)(q,{title:`Fails most`,note:`Cases that failed in the most runs.`,children:e.failing.length===0?(0,R.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No case has failed.`}):(0,R.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.failing.slice(0,8).map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(o,{size:14,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,"data-tip":e.title,children:[e.id&&(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,R.jsx)(`span`,{className:`flex-none text-[13px] text-muted`,children:P(e.lastFailed)})]}),(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-4 pl-6`,children:[(0,R.jsx)(J,{part:e.failed,whole:e.runs,tone:`fail`,label:`failed ${e.failed} of ${e.runs}`}),e.summary&&(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[13px] text-muted`,children:e.summary.replace(/[*_`#>[\]]/g,``)})]})]},e.id||e.title))})}),(0,R.jsx)(q,{title:`Defects`,note:`Failures grouped by their cause.`,children:e.defects.length===0?(0,R.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None found.`}):(0,R.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.defects.slice(0,8).map(e=>(0,R.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,"data-tip":e.title,children:e.title}),(0,R.jsxs)(`span`,{className:`text-[13px] whitespace-nowrap text-muted tabular-nums`,children:[p(e.cases,`case`),` · `,p(e.runs,`run`),e.lastSeen?` · ${P(e.lastSeen)}`:``]})]},e.title))})}),(0,R.jsx)(q,{title:`Flaky`,note:`Cases that both passed and failed.`,children:e.flaky.length===0?(0,R.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None.`}):(0,R.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.flaky.slice(0,8).map(e=>(0,R.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 truncate text-[13px]`,"data-tip":e.title,children:[e.id&&(0,R.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,R.jsx)(J,{part:e.failed,whole:e.runs,tone:`fail`,label:`${e.failed}/${e.runs} failed`})]},e.id||e.title))})}),(0,R.jsx)(q,{title:`By kind`,note:`Each kind of run and how often its cases passed.`,children:e.kinds.length===0?(0,R.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No runs with results yet.`}):(0,R.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.kinds.map(e=>(0,R.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:z[e.scope]||e.scope}),(0,R.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:p(e.runs,`run`)}),(0,R.jsx)(J,{part:e.passed,whole:e.cases,tone:`pass`,label:e.cases?`${Math.round(e.passed/e.cases*100)}% passed`:`no cases`})]},e.scope))})})]})]}):(0,R.jsx)(v,{icon:c,title:`No runs yet`,action:(0,R.jsxs)(`a`,{className:f({size:`sm`}),href:b(),"data-tip":`Start a chat`,children:[(0,R.jsx)(l,{"aria-hidden":`true`}),`Chat`]}),children:`Runs, suites and monitor rounds are taken together here once there are some: pass rate by day, the cases that fail most, flaky cases and defects.`})]})}function Z({sub:t}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(`all`),[p,g]=(0,L.useState)(U),[v,b]=(0,L.useState)(``),C=(0,L.useCallback)(()=>{m.list().then(r,e=>a(e.message))},[]);(0,L.useEffect)(C,[C]);let w=t===`project`?`project`:`execution`,O=n?.rows??null,A=l.toLowerCase().split(/\s+/).filter(Boolean),G=(0,L.useMemo)(()=>(O||[]).filter(e=>(!o||e.scope===o)&&A.every(t=>`${e.title} ${e.id} ${z[e.scope]}`.toLowerCase().includes(t))),[O,o,l]),K=G.filter(e=>H(e).tone===`fail`).length,q=d===`failed`?G.filter(e=>H(e).tone===`fail`):G;(0,L.useEffect)(()=>g(U),[o,l,d]);let J=[...new Set((O||[]).map(e=>e.scope))];return(0,R.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,R.jsx)(k,{}),(0,R.jsxs)(`main`,{className:h(j,`@container flex-auto gap-4`),children:[(0,R.jsx)(F,{}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-2`,children:[(0,R.jsx)(D,{pixel:E.reports,size:`lg`}),(0,R.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Reports`}),(0,R.jsx)(T,{label:`Runs and reports`,links:I,current:w===`project`?`reports-project`:`reports`})]}),i&&(0,R.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:i}),!n&&!i&&(0,R.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&w===`project`&&(0,R.jsx)(X,{project:n.project,build:n.build,onBuilt:C}),n&&w===`execution`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every report ForgeQE generated, newest first. Open one to see it in full in a new tab.`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(_,{id:`report-search`,label:`Find a report`,value:l,onChange:u}),[[`all`,`All`,G.length],[`failed`,`Failed`,K]].map(([e,t,n])=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":d===e,onClick:()=>f(e),className:h(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-4 text-[13px] font-medium`,d===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,R.jsx)(`span`,{className:h(`tabular-nums`,e===`failed`&&n?`text-fail`:``),children:n})]},e)),J.length>1&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`label`,{htmlFor:`report-kind`,className:`sr-only`,children:`Kind`}),(0,R.jsxs)(y,{size:`sm`,id:`report-kind`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,R.jsx)(`option`,{value:``,children:`Every kind`}),J.map(e=>(0,R.jsx)(`option`,{value:e,children:z[e]},e))]})]})]}),v&&(0,R.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:v}),(0,R.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,R.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_110px_150px_100px_128px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[13px] font-semibold text-muted @3xl:grid`,children:[(0,R.jsx)(`span`,{children:`Report`}),(0,R.jsx)(`span`,{children:`Kind`}),(0,R.jsx)(`span`,{children:`Result`}),(0,R.jsx)(`span`,{className:`text-right`,children:`When`}),(0,R.jsx)(`span`,{})]}),(0,R.jsxs)(`ul`,{"aria-label":`Execution reports`,className:`m-0 list-none p-2`,children:[q.length===0&&(0,R.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:n.rows.length?`Nothing matches.`:`No reports yet. Runs, suites and monitor rounds show here once they have run.`}),q.slice(0,p).map((e,t,n)=>{let r=N(e.startedAt),i=H(e);return(0,R.jsxs)(`li`,{className:`contents`,children:[(t===0||N(n[t-1].startedAt)!==r)&&(0,R.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:r}),(0,R.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 hover:bg-surface-muted @3xl:grid-cols-[auto_minmax(0,1fr)_110px_150px_100px_128px] @3xl:gap-x-4`,children:[(0,R.jsx)(W,{r:e}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,R.jsx)(`span`,{className:`truncate text-[13px] font-medium`,"data-tip":e.title,children:e.title}),(0,R.jsx)(`span`,{className:`truncate text-[13px] text-muted @3xl:hidden`,children:[z[e.scope],e.scope===`page`||!e.counts.total?``:`${e.counts.passed}/${e.counts.total} passed`,P(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,R.jsx)(`span`,{className:`hidden truncate text-[13px] text-muted @3xl:block`,children:z[e.scope]}),(0,R.jsxs)(`span`,{className:`hidden truncate text-[13px] text-muted tabular-nums @3xl:block`,children:[(0,R.jsx)(`span`,{className:h(i.tone===`fail`&&`text-fail`),children:e.scope===`page`?`Report`:e.counts.total?`${e.counts.passed}/${e.counts.total} passed`:i.label}),V(e.ms)?` · ${V(e.ms)}`:``]}),(0,R.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,"data-tip":B(e.startedAt),children:P(e.startedAt)}),(0,R.jsx)(`span`,{className:`flex min-w-0 justify-end`,children:e.report?(0,R.jsx)(S,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.title} in a new tab`,"data-tip":`Open the report of ${e.title} in a new tab`,onClick:async()=>b(await x(e.report)),children:(0,R.jsx)(c,{"aria-hidden":`true`})}):(0,R.jsx)(M,{path:e.folder,onNote:b,children:`Folder`})})]})]},e.key)})]}),(q.length>p||n.total>n.rows.length)&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:[(0,R.jsxs)(`span`,{children:[`Showing `,Math.min(p,q.length),` of `,q.length,n.total>n.rows.length?` (the newest ${n.rows.length} of ${n.total})`:``]}),q.length>p&&(0,R.jsxs)(S,{size:`sm`,onClick:()=>g(p+U),children:[(0,R.jsx)(e,{"aria-hidden":`true`}),`More (`,Math.min(U,q.length-p),`)`]})]})]})]})]})]})}export{Z as Reports};
@@ -1,9 +0,0 @@
1
- import{At as e,B as t,Dt as n,E as r,Et as i,Ir as a,Kn as o,Mr as s,Nr as c,Nt as l,Q as u,Rn as d,Un as f,Wn as p,Xn as m,Y as h,_t as g,bn as _,fr as v,ht as y,in as b,j as ee,mt as te,nt as ne,o as re,or as ie,pt as ae,qn as oe,rn as se,un as ce,w as x,xt as S,zr as le}from"./line-icons-C_amZ5-o.js";import{$t as ue,H as C,V as w,c as de,g as T,h as fe,v as pe,z as E}from"./filters-CVzIOjPG.js";import{Bt as D,Fn as O,Gt as k,Ht as A,On as j,Vn as M,Wt as N,_ as me,b as P,bn as he,h as ge,p as F,x as _e,y as ve}from"./frame-Deu1IqzV.js";import{a as ye,i as I,n as L,r as R}from"./markdown-DC2HA0yZ.js";import{A as z}from"./index-BWMIKyPB.js";import{t as be}from"./fold-tvLGnxD1.js";var B=le(a(),1),V=ue();function H({review:e,className:t}){return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,V.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{className:w(`mt-px flex-none rounded-full px-2 py-px text-[13px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.file&&(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,V.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,V.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var xe={done:`border-pass/35`,active:`border-accent/35`,pending:`border-line-strong`,failed:`border-fail/35`,skipped:`border-line-strong`,note:`border-line-strong`};function U({status:e,orb:t,px:n=20,spin:r=!1}){let i={width:n,height:n};return e===`active`&&r?(0,V.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:i,children:(0,V.jsx)(b,{size:n-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,V.jsx)(fe,{state:t,px:n,label:`At work`}):e===`done`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:i,children:(0,V.jsx)(x,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:i,children:(0,V.jsx)(c,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:i,children:(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,V.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:w(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:i})}var Se=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Ce={read:g,search:p,list:i,edit:te,run:v,element:u,outline:se,references:e,impact:_,find:y,testfile:S,web:l,environment:oe,cases:t,browser:l,post:o,test:S,retry:d,review:m,task:n,work:s},we={done:`text-pass`,failed:`text-fail`,active:`text-accent-fg animate-pulse motion-reduce:animate-none`,pending:`text-muted`,skipped:`text-muted`,note:`text-muted`},W={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function Te({kind:e,status:t}){let n=w(`mt-px flex size-4 flex-none items-center justify-center`,we[t]);if(e===`skill`)return(0,V.jsxs)(`span`,{role:`img`,"aria-label":W[t],className:w(n,`relative`),children:[(0,V.jsx)(pe,{name:he.skills,px:15}),(t===`done`||t===`failed`)&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:w(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=Ce[e];return(0,V.jsx)(`span`,{role:`img`,"aria-label":W[t],className:n,children:(0,V.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function Ee({status:e}){return e===`active`?(0,V.jsx)(b,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,V.jsx)(`span`,{role:`img`,"aria-label":W[e],className:w(`mt-2 size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function G({text:e,label:t}){let[n,r]=(0,B.useState)(!1);return(0,V.jsx)(`button`,{type:`button`,"aria-label":n?`Copied`:t,"data-tip":n?`Copied`:t,onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}},className:`flex size-6 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted opacity-0 group-hover:opacity-100 hover:bg-surface-strong hover:text-ink focus-visible:opacity-100`,children:n?(0,V.jsx)(x,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(h,{size:13,"aria-hidden":`true`})})}function De({step:e,failed:t}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 py-1 font-mono text-[13px] leading-relaxed`,children:[e.command&&(0,V.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,V.jsx)(G,{text:e.command,label:`Copy the command`})]}),e.output&&(0,V.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,V.jsx)(`pre`,{className:w(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[13px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,V.jsx)(G,{text:e.output,label:`Copy the output`})]}),e.shell?.exit!==void 0&&e.shell.exit!==0&&(0,V.jsxs)(`span`,{className:`text-fail`,children:[`Exit code `,e.shell.exit]})]})}var Oe=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function K({text:e}){return(0,V.jsx)(`span`,{className:w(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-2 py-1 text-[13px] text-ink-2`,Oe(e)&&`font-mono text-[13px]`),children:e})}function ke(e){return{count:e.length,failed:e.filter(e=>e.ok===!1).length,latest:e[e.length-1]}}function q({line:e}){return(0,V.jsxs)(`li`,{className:w(`flex gap-2 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,V.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,V.jsx)(R,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]})}function Ae({step:e}){let[t,n]=(0,B.useState)(!1),i=e.lines.length>3&&!t,{count:a,failed:o,latest:s}=ke(e.lines);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.lines.length>3&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`flex w-fit cursor-pointer items-center gap-1 rounded-md border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink-2`,children:[(0,V.jsxs)(`span`,{children:[t?`Hide`:`Show`,` `,a,` lines`,o>0&&(0,V.jsxs)(`span`,{className:`text-fail`,children:[` · `,o,` failed`]})]}),(0,V.jsx)(r,{size:13,"aria-hidden":`true`,className:w(`transition-transform`,t&&`rotate-180`)})]}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:i?s&&(0,V.jsx)(q,{line:s}):e.lines.map((e,t)=>(0,V.jsx)(q,{line:e},t))})]})}function J({agent:e,named:t=!0,working:n=!1,state:r,orb:i}){let a=O(e),o=N(e);return(0,V.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-2`,"data-tip":a.name,children:[(0,V.jsx)(A,{agent:e,px:24,decorative:t,working:n,state:r,activity:n?k(i):void 0}),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`font-medium`,style:{color:o},children:a.name}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}var Y=e=>e===`active`?`thinking`:e===`failed`?`failed`:e===`done`?`done`:`idle`;function X({step:e,from:t,to:n,live:r}){let i=O(n),a=N(n),o=r?`thinking`:e.status===`fail`?`failed`:e.status===`ok`?`done`:`idle`,s=[...e.children??[]].reverse().find(e=>e.status===`running`)?.orb??(e.orb===`handing`?void 0:e.orb);return(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(A,{agent:t,px:24,activity:r?`handing`:void 0}),(0,V.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:w(`handoff-flow flex-none`,r&&`is-live`),style:{color:a},children:[(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{})]}),(0,V.jsx)(A,{agent:n,px:28,decorative:!0,state:o,activity:r?k(s):void 0,className:`handoff-in`}),(0,V.jsx)(`span`,{className:`font-medium`,style:{color:a},children:i.name}),!e.handoff&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`}),(0,V.jsx)(`span`,{className:w(`[overflow-wrap:anywhere]`,r?`text-ink`:`text-ink-2`),children:e.label})]}),e.arg&&(0,V.jsx)(K,{text:e.arg})]})}function je({step:e,working:t,from:n=j}){let i=e.agent||n,a=Me(e),o=Se(e,t),[s,c]=(0,B.useState)(null),l=s??((!!e.handoff||!!e.agent||!!e.shell||e.key.startsWith(`try:`))&&o===`active`),u=(0,V.jsxs)(V.Fragment,{children:[e.handoff||i!==n?(0,V.jsx)(U,{status:o,orb:e.orb,px:14,spin:!0}):!e.icon&&(0,V.jsx)(Ee,{status:o}),e.handoff||i!==n?(0,V.jsx)(X,{step:e,from:n,to:e.handoff?.agent??i,live:o===`active`}):(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[e.icon?(0,V.jsx)(Te,{kind:e.icon,status:o}):(0,V.jsx)(J,{agent:i,named:!1,working:o===`active`,state:Y(o),orb:e.orb}),(0,V.jsx)(`span`,{className:w(`[overflow-wrap:anywhere]`,o===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,V.jsx)(K,{text:e.arg}),e.change&&(0,V.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),a&&(0,V.jsx)(r,{size:14,"aria-hidden":`true`,className:w(`mt-1 ml-auto flex-none text-muted transition-transform`,l&&`rotate-180`)})]});return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[a?(0,V.jsx)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>c(!l),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-2 py-2 text-left text-[13px] hover:bg-surface-muted`,children:u}):(0,V.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-2 py-2 text-[13px]`,children:u}),a&&(0,V.jsx)(D,{open:l,children:(0,V.jsx)(Ne,{step:e,working:t,from:n,className:`mb-1 ml-4`})})]})}var Me=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function Ne({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-2 border-l border-dotted py-1 pl-4`,r),style:{borderColor:a?`${O(a).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,V.jsx)(De,{step:e,failed:e.status===`fail`}),e.review&&(0,V.jsx)(H,{review:e.review}),e.lines.length>0&&(0,V.jsx)(Ae,{step:e}),e.change&&(0,V.jsx)(z,{diff:e.change.diff}),i.length>0&&(0,V.jsx)(`ul`,{"aria-label":a?`What ${M(O(a).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,V.jsx)(je,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,V.jsxs)(`span`,{className:`text-muted`,children:[M(O(e.handoff.agent).name,!0),` answered`]}),(0,V.jsx)(R,{text:e.handoff.result.length>1200?`${e.handoff.result.slice(0,1199)}…`:e.handoff.result,className:`text-[13px] text-ink-2 [&_p]:my-0`})]})]})}function Pe({node:e,last:t,working:n,now:i,orbed:a}){let o=e.step?[]:e.steps,s=e.step,c=o.length>0||!!i||!!s&&Me(s),[l,u]=(0,B.useState)(null),d=l??(e.status===`active`||e.status===`failed`),f=s?.orb??[...o].reverse().find(e=>e.status===`running`)?.orb??i?.orb??`thinking`;return(0,V.jsxs)(`li`,{className:`flex gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,V.jsx)(`span`,{className:`mt-1`,children:(0,V.jsx)(U,{status:e.status,orb:f,spin:!a})}),!t&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:w(`mt-2 min-h-4 w-0 flex-1 border-l border-dotted`,xe[e.status])})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[c?(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>u(!d),className:`flex min-h-7 w-full cursor-pointer items-start gap-2 border-0 bg-transparent p-0 text-left`,children:[(0,V.jsx)(Fe,{node:e,orb:f}),(0,V.jsx)(r,{size:14,"aria-hidden":`true`,className:w(`mt-1 flex-none text-muted transition-transform`,d&&`rotate-180`)}),e.status===`active`&&(0,V.jsx)(`span`,{className:`mt-1 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[13px] font-medium text-accent-fg`,children:`In progress`})]}):(0,V.jsx)(`div`,{className:`min-h-7`,children:(0,V.jsx)(Fe,{node:e,orb:f})}),c&&(0,V.jsx)(D,{open:d,className:`mt-1`,children:s?(0,V.jsx)(Ne,{step:s,working:n,from:`forgeqe`,className:`mt-1`}):(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[o.map(e=>(0,V.jsx)(je,{step:e,working:n},e.key)),i&&(0,V.jsx)(`li`,{children:(0,V.jsx)(Z,{live:i,className:`px-2`})})]})})]})]})}function Fe({node:e,orb:t}){let n=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,r=e.step;return r?.handoff||r?.agent&&r.agent!==`forgeqe`?(0,V.jsx)(X,{step:r,from:j,to:r.handoff?.agent??r.agent,live:e.status===`active`}):(0,V.jsxs)(`span`,{className:w(`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm font-medium`,n,e.status===`skipped`&&`line-through`),children:[r&&(0,V.jsx)(J,{agent:r.agent||`forgeqe`,named:!!r.agent&&r.agent!==`forgeqe`,working:e.status===`active`,state:Y(e.status),orb:t}),e.status===`active`?(0,V.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,V.jsx)(`span`,{children:e.label})}):(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),r?.arg&&(0,V.jsx)(K,{text:r.arg})]})}var Ie={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink-2`,you:`text-accent-fg`,think:`text-muted italic`};function Le(e){let[t,n]=(0,B.useState)(()=>Date.now());(0,B.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?`${i}s ago`:`${Math.floor(i/60)} min ago`}function Z({live:e,orb:t=!1,className:n}){let r=Le(e.latest?.at);return(0,V.jsxs)(`div`,{className:w(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,V.jsx)(`span`,{className:`mt-1 flex size-4 flex-none items-center justify-center`,children:t?(0,V.jsx)(fe,{state:e.orb,px:20,label:`At work`}):(0,V.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,V.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,V.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`shimmer text-[13px] font-medium text-muted`,children:(0,V.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,V.jsxs)(`button`,{type:`button`,onClick:e.onLog,"data-tip":`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,V.jsx)(`span`,{className:w(`min-w-0 truncate font-mono text-[13px]`,Ie[e.latest.tone]),children:e.latest.plain}),(0,V.jsxs)(`span`,{className:`flex-none text-[13px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Re({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,V.jsx)(Z,{live:n,orb:!0});let i=ge(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=[...i].reverse().find(e=>e.status===`active`);return(0,V.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,V.jsx)(`li`,{className:`flex gap-4`,children:(0,V.jsx)(Z,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,V.jsx)(Pe,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var ze={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function Q({label:e,children:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,V.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function Be({text:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,V.jsx)(T,{icon:ie,size:14,className:`mt-1 flex-none text-muted`}),(0,V.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,V.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,"data-tip":t?`Copied`:`Copy the command`,onClick:async()=>{await ye(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,V.jsx)(x,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(h,{size:14,"aria-hidden":`true`})})]})}function Ve(e){if(e.runs===void 0)return e.attempts===void 0?``:C(e.attempts,`attempt`);let t=`${C(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${C(e.reviews,`review`)}`:t}function He({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function Ue({t:e}){let t=Ve(e);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(S,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,V.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,V.jsx)(de,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:ze[e.status]||e.status||`Not written`}),t&&(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,V.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-4`,children:[(e.testFile||e.testName)&&(0,V.jsx)(Q,{label:`Test`,children:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,V.jsx)(L,{path:e.testFile}),e.testName&&(0,V.jsx)(He,{name:e.testName})]})}),e.command&&(0,V.jsx)(Q,{label:`Run it`,children:(0,V.jsx)(Be,{text:e.command})}),e.review&&(0,V.jsx)(Q,{label:e.review.approved?`Review`:`Review asked`,children:(0,V.jsx)(H,{review:e.review})}),e.runDir&&(0,V.jsx)(Q,{label:`From the run`,children:(0,V.jsx)(L,{path:e.runDir})}),e.reused.length>0&&(0,V.jsx)(Q,{label:`Reused`,children:(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,V.jsx)(`li`,{className:`min-w-0`,children:(0,V.jsx)(L,{path:e})},e))})})]}),e.error&&(0,V.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function We({c:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the changes to ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>n(!t),className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,V.jsx)(r,{size:15,"aria-hidden":`true`,className:w(`transition-transform`,!t&&`-rotate-90`)})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,V.jsx)(L,{path:e.path})}),(0,V.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,V.jsx)(D,{open:t,children:(0,V.jsx)(z,{diff:e.diff,className:`mb-2 ml-10`})})]})}function Ge({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),r=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!r.length?null:(0,V.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 border-t border-line-soft pt-4`,children:[e.tests.map((e,t)=>(0,V.jsx)(Ue,{t:e},t)),t.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,V.jsx)(L,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-4`),children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,V.jsx)(ae,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,V.jsxs)(`span`,{className:`font-normal text-muted`,children:[C(e.changes.length+r.length,`file`),e.changes.length>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,V.jsx)(We,{c:e},e.path)),r.map(e=>(0,V.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-10`,children:(0,V.jsx)(L,{path:e})},e))]})]})]})}var Ke=/^\s*(?:[-*>]\s*)?(?:\*\*|__)?\s*(?:sources?|evidence|references?|refs?)\s*(?:\*\*|__)?\s*:/i;function qe(e){let t=[],n=[],r=!1;for(let i of e.split(`
2
- `))/^\s*(```|~~~)/.test(i)&&(r=!r),!r&&Ke.test(i)?n.push(i.trim()):t.push(i);return{body:t.join(`
3
- `).replace(/\n{3,}/g,`
4
-
5
- `).trimEnd(),sources:n.join(`
6
-
7
- `)}}var Je=1.5;function Ye(e,t){if(e>=t)return t;let n=t-e;return Math.min(t,e+Math.max(Je,n/45))}function Xe(e,t){return Math.min(Math.floor(t),e.length)}var Ze=()=>typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;function Qe(e,t){let n=(0,B.useRef)(t);t&&(n.current=!0);let r=n.current&&!Ze(),[i,a]=(0,B.useState)(()=>r?0:e.length),o=(0,B.useRef)(i),s=(0,B.useRef)(e);s.current!==e&&(o.current=Xe(e,o.current),s.current=e),r||(o.current=e.length),(0,B.useEffect)(()=>{if(!r||o.current>=e.length){a(o.current);return}let t=0,n=()=>{o.current=Ye(o.current,e.length),a(o.current),o.current<e.length&&(t=requestAnimationFrame(n))};return t=requestAnimationFrame(n),()=>cancelAnimationFrame(t)},[e,r]);let c=Math.min(Math.floor(r?i:e.length),e.length);return{shown:e.slice(0,c),typing:c<e.length}}var $e={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink`,you:`text-accent-fg`,think:`text-muted italic`};function et({line:e,start:t}){let[n,r]=(0,B.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,V.jsxs)(`li`,{className:`mt-4 flex items-baseline gap-4 border-b border-line-soft pb-1 first:mt-0`,children:[(0,V.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:P(t,e.at)}),(0,V.jsx)(R,{text:e.md,className:w(`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`,I)})]}):(0,V.jsxs)(`li`,{className:w(`flex items-baseline gap-4 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,V.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:P(t,e.at)}),e.kind===`out`?(0,V.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,V.jsx)(`button`,{type:`button`,disabled:!i,"aria-expanded":i?n:void 0,onClick:()=>r(!n),"data-tip":i&&!n?`Show all of it`:void 0,className:w(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,V.jsx)(R,{text:e.md,className:w(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[13px] [&_p]:my-0`,I,$e[e.tone],i&&!n&&`line-clamp-2`)})})]})}function $({lines:e,start:t,live:n,name:r,timeline:i=!1}){let a=(0,B.useRef)(null),o=(0,B.useRef)(!0),[s,c]=(0,B.useState)(!1),l=(0,B.useMemo)(()=>ve(e,t),[e,t]);(0,B.useEffect)(()=>{o.current&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[l]);let u=`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,V.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{className:`flex-1`,children:[i?``:`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,V.jsx)(`button`,{type:`button`,"aria-label":s?`Copied`:`Copy the activity log as Markdown`,"data-tip":s?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(l),c(!0),setTimeout(()=>c(!1),1500)}catch{}},className:u,children:s?(0,V.jsx)(x,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(h,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,"data-tip":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([l],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=r,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:u,children:(0,V.jsx)(T,{icon:ne,size:14})})]}),(0,V.jsx)(`div`,{ref:a,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:w(`overflow-y-auto py-2`,i?`max-h-[calc(var(--screen)-260px)] min-h-[320px]`:`max-h-[360px] border-b border-line-soft`),children:i?(0,V.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,n)=>(0,V.jsx)(et,{line:e,start:t},n))}):(0,V.jsx)(R,{text:l,className:w(`text-[13px] leading-[1.6] [&_code]:text-[13px] [&_h4]:mt-4 [&_h4]:mb-1 [&_h6]:mt-4 [&_h6]:mb-1 [&_h6]:text-ink [&_li]:my-1 [&_pre]:text-[13px] [&_ul]:my-1`,I)})})]})}function tt({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-4`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(ce,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,V.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,V.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,V.jsx)(E,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,V.jsxs)(E,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:[(0,V.jsx)(c,{"aria-hidden":`true`}),`Cancel`]})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function nt({wait:e,live:t,onProceed:n}){let r=t&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-4`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,V.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(ee,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),r?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(E,{size:`sm`,variant:`primary`,"data-tip":`Done, continue`,onClick:()=>n(!0),children:[(0,V.jsx)(re,{"aria-hidden":`true`}),`Continue`]}),(0,V.jsxs)(E,{size:`sm`,onClick:()=>n(!1),children:[(0,V.jsx)(c,{"aria-hidden":`true`}),`Cancel`]})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function rt(e,t){let[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(t);return(0,B.useEffect)(()=>{let n=t>i.current;if(i.current=t,!e||!n)return void(e||r(!1));r(!0);let a=setTimeout(()=>r(!1),900);return()=>clearTimeout(a)},[e,t]),n}function it({turn:e,live:t,onAnswer:n,onProceed:i}){let a=t&&!e.outcome,[o,s]=(0,B.useState)(null),c=o??a,l=F(e),u=a?l.text:me(e),d=e.parts.map(e=>_e(e.text)).filter(Boolean),p=Qe(e.outcome&&e.reply?e.reply:d.join(`
8
-
9
- `),a),m=(0,B.useMemo)(()=>qe(p.shown),[p.shown]),h=rt(a,d.reduce((e,t)=>e+t.length,0)),g=p.typing||h,[_,v]=(0,B.useState)(!1),y=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,V.jsxs)(`div`,{className:`flex gap-4`,children:[(0,V.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,V.jsx)(A,{agent:`forgeqe`,px:34,working:a,state:g?`speaking`:a?`thinking`:e.outcome===`done`?`done`:e.outcome===`failed`?`failed`:`idle`,activity:a&&!g?k(F(e).orb):void 0,className:`mt-1`})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 pt-2`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":c,disabled:!e.steps.length&&!e.plan.length,onClick:()=>s(!c),className:w(`flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,V.jsx)(`span`,{"aria-live":`polite`,children:u}),(e.steps.length>0||e.plan.length>0)&&(0,V.jsx)(r,{size:16,"aria-hidden":`true`,className:w(`transition-transform`,c&&`rotate-180`)})]}),e.log.length>0&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":_,onClick:()=>v(!_),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,V.jsx)(T,{icon:f,size:14}),`Activity log`,(0,V.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,V.jsx)(D,{open:(c||a)&&(e.steps.length>0||e.plan.length>0||a),children:(0,V.jsx)(Re,{turn:e,working:a,folded:!c,live:{...l,latest:y,events:e.log.length,onLog:()=>v(!0)}})}),(0,V.jsx)(D,{open:_,children:(0,V.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,V.jsx)(tt,{ask:e,live:a,onAnswer:t=>n(e.id,t)},e.id)),e.waits.map(e=>(0,V.jsx)(nt,{wait:e,live:a,onProceed:t=>i(e.id,t)},e.id)),m.body&&(0,V.jsx)(R,{text:m.body,className:w((p.typing||a)&&`typing-caret`)}),m.sources&&!p.typing&&!a&&(0,V.jsx)(be,{title:`Sources`,children:(0,V.jsx)(R,{text:m.sources,className:`text-muted`})}),(0,V.jsx)(Ge,{turn:e}),e.error&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{it as n,Be as r,$ as t};
@@ -1 +0,0 @@
1
- import{E as e,Ir as t,M as n,P as r,R as i,dn as a,pt as o,yr as s,zr as c}from"./line-icons-C_amZ5-o.js";import{$t as l,B as u,Rt as d,V as f,f as p,l as m,o as h,p as g,st as _,t as v,z as y}from"./filters-CVzIOjPG.js";import{Bt as b,at as x,bn as S,bt as C,o as w,t as T}from"./frame-Deu1IqzV.js";import{t as E}from"./when-CHnpLdYw.js";import{U as D}from"./index-BWMIKyPB.js";import{r as O}from"./families-DWilSDct.js";import{_ as k,o as A}from"./qualityParts-lz6eYVxC.js";var j=c(t(),1),M=l(),N={server:{label:`The server answered differently`,hint:`A call returned another status: likely a product or backend change, not the test. File it as a defect if the first run was right.`},locator:{label:`An element was not found`,hint:`The page likely changed under the test. If the change was intended, heal the test; if not, it is a product bug.`},navigation:{label:`It reached another page`,hint:`A redirect, a sign-in, a feature flag or the environment's settings may differ between the runs.`},path:{label:`It took another path`,hint:`The run did something else here: the flow changed, or the agent found another way through it.`},data:{label:`Same step, another outcome`,hint:`The step was the same but ended otherwise: the test data, the account or what the page held likely differs.`},timing:{label:`Only the timing differs`,hint:`A slow environment, or a wait that races the page: a likely cause of flaky failures.`},errors:{label:`New browser errors`,hint:`The page raised errors in the second run that it did not in the first.`},missing:{label:`A step only one run did`,hint:`One run has a step the other does not: a dialog, a retry or a changed flow.`}},P=e=>`${(e/1e3).toFixed(1)}s`,F=e=>`${e.goal.slice(0,80)} · ${e.status} · ${E(e.at)}`;function I(e,t){let n=e.find(e=>e.id===t),r=e.filter(e=>e.id!==t);if(!n)return{same:[],other:r};let i=n.goal.trim().toLowerCase();return{same:r.filter(e=>e.goal.trim().toLowerCase()===i),other:r.filter(e=>e.goal.trim().toLowerCase()!==i)}}function L({run:e,step:t}){let[n,r]=(0,j.useState)(``),[i,a]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&d.shot(e,t.n,t.shot).then(e=>!n&&r(e),()=>!n&&a(!0)),()=>{n=!0}},[e,t?.n,t?.shot]),t?!t.shot||i?(0,M.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`No screenshot`}):n?(0,M.jsx)(`img`,{src:n,alt:`Step ${t.n} of ${e}`,className:`max-h-[420px] w-full rounded-[12px] border border-line-soft object-contain object-top`}):(0,M.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,M.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`Not in this run`})}function R({step:e,other:t}){if(!e)return(0,M.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in this run`});let r=e.ok?n:i,a=new Set((t?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),o=t?e.calls.filter(e=>!a.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,M.jsx)(r,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:f(`mt-1 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,M.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,M.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${P(e.ms)}`:``]}),e.error&&(0,M.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error}),o.slice(0,3).map(e=>(0,M.jsxs)(`span`,{className:f(`truncate font-mono text-[13px]`,e.status>=400||e.failed?`text-fail`:`text-muted`),"data-tip":`${e.method} ${e.path}`,children:[e.method,` `,e.path,` `,e.failed?`no answer`:e.status]},`${e.method} ${e.path}`)),e.problems.slice(0,2).map(e=>(0,M.jsx)(`span`,{className:`truncate text-[13px] text-warn`,"data-tip":e,children:e},e))]})}function z({row:t,i:n,a:r,b:i,focus:a,open:o,onToggle:s}){let c=t.a?.n,l=t.b?.n;return(0,M.jsxs)(`li`,{id:a?`look-here`:void 0,className:f(`border-t border-line-soft`,!t.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,M.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-4 px-4 py-2 text-[13px]`,children:[(0,M.jsx)(`span`,{className:`pt-1 text-muted tabular-nums`,"data-tip":c!==void 0&&l!==void 0&&c!==l?`Step ${c} of the first run, ${l} of the second`:void 0,children:c!==void 0&&l!==void 0&&c!==l?`${c}·${l}`:c??l??n+1}),(0,M.jsx)(R,{step:t.a,other:t.b}),(0,M.jsx)(R,{step:t.b,other:t.a}),(0,M.jsx)(y,{variant:`icon`,size:`icon-sm`,"aria-label":o?`Hide screenshots`:`Show screenshots`,"aria-expanded":o,onClick:s,"data-tip":o?`Hide screenshots`:`Show screenshots`,children:(0,M.jsx)(e,{"aria-hidden":`true`,className:f(`transition-transform`,o&&`rotate-180`)})})]}),!t.same&&(0,M.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2 pl-[3.75rem] text-[13px] text-ink-2`,children:[a&&t.kind&&(0,M.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,N[t.kind].label]}),t.differences.map(e=>(0,M.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,M.jsx)(b,{open:o,children:(0,M.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-4 px-4 pb-4 @2xl:grid-cols-2`,children:[(0,M.jsx)(L,{run:r,step:t.a}),(0,M.jsx)(L,{run:i,step:t.b})]})})]})}function B({runs:e,a:t,b:n}){let[r,i]=(0,j.useState)(t??``),[a,s]=(0,j.useState)(n??``);(0,j.useEffect)(()=>{i(t??``),s(n??``)},[t,n]);let{same:c,other:l}=I(e,r);return(0,M.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&a&&r!==a&&(location.hash=g(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(a)}`))},children:[(0,M.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`First run (as expected)`,(0,M.jsxs)(h,{size:`sm`,value:r,onChange:e=>i(e.target.value),children:[(0,M.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,M.jsx)(`option`,{value:e.id,children:F(e)},e.id))]})]}),(0,M.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,M.jsxs)(h,{size:`sm`,value:a,onChange:e=>s(e.target.value),disabled:!r,children:[(0,M.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),c.length>0&&(0,M.jsx)(`optgroup`,{label:`Same test`,children:c.map(e=>(0,M.jsx)(`option`,{value:e.id,children:F(e)},e.id))}),(0,M.jsx)(`optgroup`,{label:c.length?`Other runs`:`Runs`,children:l.map(e=>(0,M.jsx)(`option`,{value:e.id,children:F(e)},e.id))})]})]}),(0,M.jsxs)(y,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!a||r===a,children:[(0,M.jsx)(o,{"aria-hidden":`true`}),`Compare`]})]})}function V({sub:e}){let[t,n]=(0,j.useState)(null),[i,o]=(0,j.useState)(null),[c,l]=(0,j.useState)(``),[h,b]=(0,j.useState)(`all`),[E,F]=(0,j.useState)(new Set),[I,L]=(0,j.useState)(``),[R,V]=(0,j.useMemo)(()=>{let t=(e?p(e):``).split(`~`);return t.length===2&&t[0]&&t[1]?[t[0],t[1]]:[void 0,void 0]},[e]);(0,j.useEffect)(()=>{d.runs().then(e=>n(e.runs),e=>l(e.message))},[]),(0,j.useEffect)(()=>{let e=!1;if(o(null),L(``),R&&V)return d.diff(R,V).then(t=>{e||(o(t),l(``),F(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&l(t.message)),()=>{e=!0}},[R,V]);let H=async()=>{if(i)try{let{id:e}=await _.start(`Compare the browser runs ${i.a.id} and ${i.b.id} in the reports folder, step by step (their steps.json, network.json and screenshots). Say where they first differ and whether that is a product bug, a test that needs healing, test data or the environment, and what to do next.`,{});location.hash=g(`chats`,e)}catch(e){L(e.message)}},U=i?.rows??[],W=U.map((e,t)=>({r:e,i:t})).filter(({r:e})=>h===`all`||!e.same),G=e=>e===void 0?void 0:U[e]?.b?.n??U[e]?.a?.n,K=G(i?.first),q=G(i?.focus);return(0,M.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,M.jsx)(w,{}),(0,M.jsxs)(`main`,{className:f(T,`@container flex-auto gap-4`),children:[(0,M.jsx)(D,{}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,M.jsx)(C,{pixel:S[`run-diff`],size:`lg`}),(0,M.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,M.jsx)(x,{label:`Runs and reports`,links:O,current:`run-diff`})]}),(0,M.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:`Two browser runs side by side, step by step: a run that passed and one that failed, the same test on two environments or devices, or a test before and after it was healed. Steps are lined up by page and action, and the first one that differs is marked with what it likely means.`}),c&&(0,M.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),!t&&!c&&(0,M.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&t.length<2&&(0,M.jsx)(m,{icon:s,title:`Two runs are needed`,action:(0,M.jsxs)(`a`,{className:u({size:`sm`}),href:g(`record`),"data-tip":`Record a flow`,children:[(0,M.jsx)(r,{"aria-hidden":`true`}),`Record`]}),children:`Every browser run keeps its steps in the reports folder. Run a flow from a chat or the Record page twice, or a test case on two environments, and compare them here.`}),t&&t.length>=2&&(0,M.jsx)(B,{runs:t,a:R,b:V}),R&&V&&!i&&!c&&(0,M.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),i&&(0,M.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-3 @4xl:grid-cols-6 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,M.jsx)(A,{label:`Verdict`,value:i.first===void 0?`Same`:`Differ`,tone:i.first===void 0?`text-pass`:`text-warn`,sub:i.first===void 0?`every step alike`:`from step ${K??`?`}`}),(0,M.jsx)(A,{label:`Steps differing`,value:i.counts.differing,tone:i.counts.differing?`text-warn`:void 0,sub:`of ${U.length} lined up`}),(0,M.jsx)(A,{label:`Steps`,value:`${i.a.steps} · ${i.b.steps}`,sub:`first · second`}),(0,M.jsx)(A,{label:`Time`,value:`${P(i.a.ms)} · ${P(i.b.ms)}`,sub:`first · second`}),(0,M.jsx)(A,{label:`Calls answered otherwise`,value:i.counts.calls,tone:i.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,M.jsx)(A,{label:`New browser errors`,value:i.counts.errors,tone:i.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[i.a,i.b].map((e,t)=>(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,M.jsx)(`span`,{className:`text-[13px] text-muted`,children:t?`Second run`:`First run`}),(0,M.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,M.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,k(e.at),` · `,e.host??e.id]})]},e.id))}),!i.sameGoal&&(0,M.jsx)(`p`,{className:`m-0 text-[13px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),i.kind&&(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px]`,children:[(0,M.jsx)(s,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-warn`}),(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,q??`?`,` of the second run: `,N[i.kind].label]}),(0,M.jsx)(`span`,{className:`text-ink-2`,children:N[i.kind].hint}),i.first!==i.focus&&i.first!==void 0&&U[i.first]?.kind&&(0,M.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,K,`: `,N[U[i.first].kind].label.toLowerCase(),`.`]})]}),(0,M.jsx)(`a`,{href:`#look-here`,onClick:e=>(e.preventDefault(),document.getElementById(`look-here`)?.scrollIntoView({behavior:`smooth`,block:`center`})),className:`self-center text-[13px]`,children:`Go to it`})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,M.jsx)(v,{items:[{id:`all`,label:`All steps`,n:U.length},{id:`diff`,label:`Only differences`,n:i.counts.differing,alert:!0}],value:h,onChange:b})}),(0,M.jsxs)(y,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void H(),className:`ml-auto`,children:[(0,M.jsx)(a,{"aria-hidden":`true`}),`Chat`]})]}),I&&(0,M.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:I}),(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,M.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-4 bg-surface-muted px-4 py-2 text-[13px] text-muted`,children:[(0,M.jsx)(`span`,{children:`Step`}),(0,M.jsx)(`span`,{children:`First run`}),(0,M.jsx)(`span`,{children:`Second run`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),W.length?(0,M.jsx)(`ol`,{className:`m-0 list-none p-0`,children:W.map(({r:e,i:t})=>(0,M.jsx)(z,{row:e,i:t,a:i.a.id,b:i.b.id,focus:t===i.focus,open:E.has(t),onToggle:()=>{let e=new Set(E);e.has(t)?e.delete(t):e.add(t),F(e)}},t))}):(0,M.jsx)(`p`,{className:`m-0 border-t border-line-soft px-4 py-4 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{N as KIND_TEXT,V as RunDiff,I as choicesFor};
@@ -1,2 +0,0 @@
1
- import{E as e,In as t,Ir as n,M as r,Mr as i,N as a,Nr as o,O as s,Pt as c,Qt as l,R as u,Rn as d,W as f,Wn as p,a as m,an as h,ar as g,b as _,ct as v,dn as y,er as b,fr as x,k as S,kt as C,nr as w,or as ee,p as T,st as E,v as D,xt as O,yt as k,zr as te}from"./line-icons-C_amZ5-o.js";import{$t as ne,B as re,H as A,V as j,c as M,f as ie,g as N,i as ae,l as oe,n as se,o as ce,p as P,st as le,t as ue,u as de,z as fe,zt as pe}from"./filters-CVzIOjPG.js";import{Bt as me,F,Fn as he,Kt as ge,N as _e,at as ve,bn as ye,bt as be,it as xe,o as Se,ot as Ce,rt as I,t as we,v as Te,x as Ee}from"./frame-Deu1IqzV.js";import{i as De,n as L,r as R}from"./markdown-DC2HA0yZ.js";import{n as Oe,t as ke}from"./when-CHnpLdYw.js";import{U as Ae}from"./index-BWMIKyPB.js";import{r as je,t as Me}from"./Response-D9FYUvHg.js";import{r as Ne}from"./families-DWilSDct.js";var z=te(n(),1),B=ne(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Pe={execution:O,report:E,coding:f,chat:y};function Fe({kind:e}){let t=Pe[e];return(0,B.jsx)(N,{icon:t,size:14,className:`flex-none text-muted`})}var Ie={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},H=e=>Ie[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},Le={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Re=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function U({title:e,icon:t,children:n,aside:r,className:i}){return(0,B.jsxs)(`section`,{className:j(`flex flex-col gap-4 border-t border-line-soft pt-6`,i),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function ze({path:e,label:t=`Report`}){let[n,r]=(0,z.useState)(``);return(0,B.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(fe,{"data-tip":`Open the report`,onClick:async()=>r(await de(e)),children:[(0,B.jsx)(v,{"aria-hidden":`true`}),t]}),n&&(0,B.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function W({items:t,first:n,render:r}){let[i,a]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(i?t:t.slice(0,n)).map(r),t.length>n&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(!i),className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[i?(0,B.jsx)(S,{size:14,"aria-hidden":`true`}):(0,B.jsx)(e,{size:14,"aria-hidden":`true`}),i?`Less`:`All (${t.length})`]})]})}function Be({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,B.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,B.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,B.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,B.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function Ve({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:[Le[e.scope]||e.scope,Re(e.ms),e.tokens?`${F(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,B.jsx)(ze,{path:e.report})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsxs)(`span`,{className:`text-[20px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(M,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(M,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(M,{tone:`warn`,children:[e.counts.other,` other`]}),(0,B.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,B.jsx)(Be,{c:e.counts}),e.cases.length>0&&(0,B.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(W,{items:[...e.cases].sort((e,t)=>Number(H(t.status).tone===`fail`)-Number(H(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,B.jsxs)(`li`,{className:`flex min-w-0 items-start gap-4 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(M,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-2 font-mono text-[13px] text-muted`,children:e.id}),e.title,e.device&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,B.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,B.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Re(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,B.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,B.jsx)(L,{path:e.folder})]})]})}function He({list:e,className:t}){let n=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,B.jsx)(U,{...t?{className:t}:{},title:`Execution summary`,icon:(0,B.jsx)(N,{icon:O,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[A(e.length,`run`),` · `,n.passed,` of `,n.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,B.jsx)(Ve,{e},`${e.folder||e.title}-${t}`)):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function Ue({list:e,className:t}){return(0,B.jsxs)(U,{...t?{className:t}:{},title:`Report summary`,icon:(0,B.jsx)(N,{icon:E,size:18}),children:[e.length===0&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,B.jsx)(ze,{path:e.path})]}),e.stats&&(0,B.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,B.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[13px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[20px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,B.jsx)(We,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function We({text:t,height:n=220}){let[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!0),[s,c]=(0,z.useState)(n),l=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{l.current&&!r&&o(l.current.scrollHeight>n+8)},[t,n,r]),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{ref:l,style:s===void 0?void 0:{maxHeight:s},onTransitionEnd:e=>e.target===e.currentTarget&&r&&c(void 0),className:j(`transition-[max-height] duration-200 ease-out`,s!==void 0&&`relative overflow-hidden`),children:[(0,B.jsx)(R,{text:t,className:j(`text-sm`,De)}),!r&&a&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(r||a)&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>{let e=l.current?.scrollHeight??n;if(i(!r),ge())return c(r?n:void 0);c(e),r&&requestAnimationFrame(()=>requestAnimationFrame(()=>c(n)))},className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[r?(0,B.jsx)(S,{size:14,"aria-hidden":`true`}):(0,B.jsx)(e,{size:14,"aria-hidden":`true`}),r?`Less`:`More`]})]})}function Ge(e){let t=e.join(`
2
- `),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function Ke({e}){let[t,n]=(0,z.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,B.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-2 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>n(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,B.jsx)(s,{size:16,"aria-hidden":`true`,className:j(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:r}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})}),(0,B.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,B.jsx)(me,{open:t,className:`pb-4 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,B.jsx)(R,{text:Ge(e.diffs),className:De}):null})]})}var qe={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function G({label:e,children:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,B.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Je({c:e,files:t,className:n}){let r=e.edits.reduce((e,t)=>e+t.added,0),i=e.edits.reduce((e,t)=>e+t.removed,0),a=e.tests.filter(e=>!e.ok).length,o=e.reviews.at(-1),s=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,B.jsxs)(U,{...n?{className:n}:{},title:`Code changes`,icon:(0,B.jsx)(N,{icon:f,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[A(e.edits.length,`file`),` · `,(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,r]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,i]})]}):s.length?(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:A(s.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,i=t.status===`error`||t.status===`failed`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(O,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:i?`text-fail`:`text-warn`}),(0,B.jsx)(`span`,{className:`text-[16px] font-semibold`,children:r?`Test written`:i?`Test not finished`:H(t.status).label}),(0,B.jsx)(M,{tone:r?`pass`:i?`fail`:`warn`,children:H(t.status).label}),e.tests.length>0&&(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[A(e.tests.length,`test run`),a?` (${a} failed)`:``,e.reviews.length?` · ${A(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-4`,children:[t.testFile&&(0,B.jsx)(G,{label:`Test`,children:(0,B.jsx)(L,{path:t.testFile})}),t.command&&(0,B.jsx)(G,{label:`Run it`,children:(0,B.jsx)(je,{text:t.command})}),(t.review||o)&&(0,B.jsx)(G,{label:`Review`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(M,{tone:(t.review??o).approved?`pass`:`warn`,children:(t.review??o).approved?`Approved`:`Changes asked`})}),(t.review?.summary||o?.summary)&&(0,B.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||o?.summary})]})}),t.notes&&(0,B.jsx)(G,{label:`Notes`,children:(0,B.jsx)(R,{text:t.notes,className:j(`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`,`[&_p]:max-w-none [&_ul]:max-w-none [&_ol]:max-w-none [&_blockquote]:max-w-none [&_h1]:max-w-none [&_h2]:max-w-none [&_h3]:max-w-none [&_h4]:max-w-none [&_h5]:max-w-none [&_h6]:max-w-none`)})})]}),t.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(W,{items:e.edits,first:8,render:e=>(0,B.jsx)(Ke,{e},e.path)})})]}),s.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:s.map(e=>(0,B.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-4 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:qe[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})})]},e.path))}),(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!s.length&&!e.results.length&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function Ye({final:e,answer:t,className:n}){let r=e.from===`agent`?t?.files??[]:[],i=e.from!==`agent`,a=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),o="`".repeat(a+1);return(0,B.jsxs)(U,{...n?{className:n}:{},title:`Final message`,icon:(0,B.jsx)(k,{size:18,"aria-hidden":`true`}),aside:(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,B.jsx)(We,{text:i?`${o}text\n${e.text}\n${o}`:Ee(e.text),height:420}),r.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),r.map(e=>(0,B.jsx)(L,{path:e},e))]})]})}var Xe={rule:{icon:T,label:`Rulebook`},decision:{icon:C,label:`Test decisions`},memory:{icon:D,label:`Page memory`},replay:{icon:t,label:`Replays`},model:{icon:b,label:`Model`},skill:{icon:c,label:`Skills`}};function Ze({list:e,className:t}){let n=Object.keys(Xe).filter(t=>e.some(e=>e.kind===t));return(0,B.jsx)(U,{...t?{className:t}:{},title:`Learnings`,icon:(0,B.jsx)(N,{icon:l,size:18}),aside:e.length?(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-4`,children:n.map(t=>{let{icon:n,label:r}=Xe[t];return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,B.jsxs)(`h4`,{className:`m-0 flex items-center gap-2 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(N,{icon:n,size:14}),r]}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,B.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Qe({run:e,className:t}){let n=[],r=t?{className:t}:{};return(e.executions.length||e.kind===`execution`)&&n.push({kind:`execution`,node:(0,B.jsx)(He,{list:e.executions,...r},`e`)}),(e.reports.length||e.kind===`report`)&&n.push({kind:`report`,node:(0,B.jsx)(Ue,{list:e.reports,...r},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&n.push({kind:`coding`,node:(0,B.jsx)(Je,{c:e.coding,files:e.files,...r},`c`)}),n.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,B.jsx)(B.Fragment,{children:n.map(e=>e.node)})}var K={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},$e={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},et=e=>$e[e]||e.charAt(0).toUpperCase()+e.slice(1),tt=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`})},q=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),J=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,Y=e=>e.usage.input+e.usage.output;function nt(e){let[t,n]=(0,z.useState)(Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function rt({r:e}){return e.origin.kind===`web`?(0,B.jsxs)(`a`,{href:P(`chats`,e.origin.chat),className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(N,{icon:y,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,B.jsxs)(`a`,{href:P(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(N,{icon:_,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted`,children:[(0,B.jsx)(N,{icon:x,size:14}),`Terminal`]})}var it=e=>K[e].label;function at({status:e}){let t=K[e].label;return e===`running`?(0,B.jsx)(h,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,B.jsx)(r,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,B.jsx)(u,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,B.jsx)(a,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!Y(e)&&!e.files.length&&!e.outputs.length&&q(e,0)<2;function ot(e){return/^forgeqe(-|$)|^engine$/.test(e)?he(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t,stacked:n=!1}){return n?(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]}):(0,B.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,B.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`h3`,{className:`m-0 mb-1 text-[13px] font-semibold`,children:e}),t]})}var st=8,ct=e=>e===`write`?`Written`:e===`edit`?`Edited`:e===`delete`?`Deleted`:e?e.charAt(0).toUpperCase()+e.slice(1):`Changed`;function lt({run:e,now:t,running:n,events:r}){let i=K[e.status],a=e.executions.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0}),o=e.coding?.results.at(-1),s=e.coding?.tests.length??0,c=e.coding?.tests.filter(e=>!e.ok).length??0,l=e.coding?.edits??[],u=l.reduce((e,t)=>e+t.added,0),d=l.reduce((e,t)=>e+t.removed,0),f=l.length||e.files.filter(e=>e.action&&e.action!==`read`).length;return(0,B.jsxs)(xe,{label:`How this run went`,children:[(0,B.jsx)(I,{compact:!0,label:`Outcome`,value:i.label,tone:i.tone===`fail`?`text-fail`:i.tone===`pass`?`text-pass`:void 0,...o?.attempts?{note:`attempt ${o.attempts}${o.maxAttempts?` of ${o.maxAttempts}`:``}`}:{}}),(0,B.jsx)(I,{label:n?`Running for`:`Took`,value:J(q(e,t)),...r?{note:A(r,`event`)}:{}}),a.total>0&&(0,B.jsx)(I,{label:`Cases`,value:`${a.passed}/${a.total}`,...a.failed?{tone:`text-fail`}:a.passed===a.total?{tone:`text-pass`}:{},note:`passed`}),s>0&&(0,B.jsx)(I,{label:`Test runs`,value:s,...c?{note:`${c} failed`}:{}}),f>0&&(0,B.jsx)(I,{label:`Files changed`,value:f,...u+d?{note:`+${u} −${d}`}:{}}),Y(e)>0&&(0,B.jsx)(I,{label:`Tokens`,value:F(Y(e)),note:`${F(e.usage.input)} in · ${F(e.usage.output)} out`})]})}var ut={rerun:d,write_test:g,investigate:p,fix_test:i},dt={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function ft({actions:e}){let[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await le.start(e.prompt,{});location.hash=P(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,B.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,B.jsxs)(fe,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,B.jsx)(N,{icon:ut[e.kind],size:16,className:`flex-none`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:dt[e.kind]}),e.note&&(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var pt=e=>`\`${e.replace(/`/g,``)}\``,mt=[`summary`,`conversation`,`activity`,`details`],ht=e=>mt.find(t=>t===e)??`summary`;function gt({name:e,tab:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),l=ht(t),u=t=>location.hash=t===`summary`?P(`runs`,encodeURIComponent(e)):P(`runs`,encodeURIComponent(e),t),d=(0,z.useCallback)(()=>{pe.detail(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);(0,z.useEffect)(d,[d]);let f=n?.status===`running`;(0,z.useEffect)(()=>{if(!f)return;let e=setInterval(d,2e3);return()=>clearInterval(e)},[d,f]);let p=nt(f),h=(0,z.useMemo)(()=>(n?.events??[]).map(Te).filter(e=>!!e),[n?.events]),g=async()=>{c(!0),a(``);try{await pe.cancel(e),d()}catch(e){a(e.message)}finally{c(!1)}},_=(0,B.jsxs)(`a`,{href:P(`runs`),className:`inline-flex items-center gap-2 text-sm`,children:[(0,B.jsx)(m,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_,i?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:i}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let v=K[n.status],y=!n.replies.length,b=!!n.final||n.executions.length>0||n.reports.length>0||!!(n.coding&&(n.coding.edits.length||n.coding.results.length))||n.learnings.length>0||n.outputs.length>0||n.files.length>0,x=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],S=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),C=n.outputs.filter(e=>!S.has(e.path)),ee=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null,T=C.length>0||n.files.length>0?`@3xl:col-span-3`:`@3xl:col-span-4`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[_,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[20px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,B.jsx)(M,{tone:v.tone,children:v.label})]}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(Fe,{kind:n.kind}),V[n.kind]]}),`· `,(0,B.jsx)(rt,{r:n}),`· `,tt(n.startedAt),` · `,f?`running for `:`took `,J(q(n,p)),` · `,F(Y(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,B.jsxs)(fe,{variant:`danger`,disabled:s,"data-tip":n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void g(),children:[n.cancel===`chat`?(0,B.jsx)(w,{fill:`currentColor`,"aria-hidden":`true`}):(0,B.jsx)(o,{"aria-hidden":`true`}),s?`Stopping…`:n.cancel===`chat`?`Stop`:`Cancel`]})]}),i&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),n.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!f&&(0,B.jsx)(ft,{actions:n.actions??[]}),(0,B.jsx)(Ce,{prefix:`run`,label:`This run`,className:`mb-0`,current:l,onPick:u,tabs:x}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${l}`,"aria-labelledby":`run-${l}`,className:`flex min-w-0 flex-col gap-6`,children:[l===`summary`&&(0,B.jsxs)(B.Fragment,{children:[b&&(0,B.jsx)(lt,{run:n,now:p,running:f,events:h.length}),(0,B.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:[n.final&&(0,B.jsx)(Ye,{final:n.final,answer:n.answer,className:T}),(0,B.jsx)(Qe,{run:n,className:T}),C.length>0&&(0,B.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,B.jsx)(Q,{title:`What it produced (${C.length})`,children:C.map(e=>(0,B.jsx)(Z,{label:e.label,stacked:!0,children:(0,B.jsx)(L,{path:e.path,children:e.path.split(`/`).pop()})},e.path))})}),n.files.length>0&&(0,B.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,B.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:(0,B.jsx)(W,{items:[...n.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)),first:st,render:e=>(0,B.jsx)(Z,{label:ct(e.action),stacked:!0,children:e.action===`delete`?(0,B.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path.split(`/`).pop()}):(0,B.jsx)(L,{path:e.path,children:e.path.split(`/`).pop()})},e.path)})})}),n.learnings.length>0&&(0,B.jsx)(Ze,{list:n.learnings,className:`@3xl:col-span-4`})]}),!b&&(0,B.jsx)(oe,{className:`py-4`,children:f?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),l===`conversation`&&(y?(0,B.jsx)(R,{text:pt(n.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.replies.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2 text-sm max-w-[85%]`,children:(0,B.jsx)(R,{text:e.ask,className:`[&_p]:my-1`})}),e.text&&(0,B.jsx)(R,{text:Ee(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),l===`activity`&&(n.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-4 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,B.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):h.length?(0,B.jsx)(Me,{timeline:!0,lines:h,start:n.startedAt,live:f,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),l===`details`&&(0,B.jsxs)(_t,{children:[(0,B.jsxs)(Q,{title:`Numbers`,children:[(0,B.jsx)(Z,{label:f?`Running for`:`Took`,children:J(q(n,p))}),(0,B.jsx)(Z,{label:`Tokens`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`span`,{children:[F(Y(n)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,_e(n.usage)]})]}),(n.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-1 text-[13px]`,children:n.byAgent.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:ot(e.agent)}),(0,B.jsx)(`span`,{className:`text-muted tabular-nums`,children:F(e.input+e.output)})]},e.agent))})]})}),(0,B.jsxs)(Z,{label:`Context`,children:[n.context?F(n.context.tokens):`–`,ee!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,F(n.context.limit),` (`,ee,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,A(n.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(rt,{r:n})}),(0,B.jsx)(Z,{label:`Command`,children:et(n.command)}),(0,B.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:n.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-1`,children:n.agents.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:ot(e.name)}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:A(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[n.archived?(0,B.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,B.jsx)(L,{path:`.forgeqe/logs/${n.name}`}),n.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:P(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(R,{text:pt(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${tt(n.job.nextAt)}`:``]}),n.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[n.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,n.job.run.status.replace(`_`,` `),n.job.run.exitCode!==void 0&&n.job.run.exitCode!==null?`, exit ${n.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Notifications`,children:n.notifications.length?n.notifications.map(e=>(0,B.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,B.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:n.origin.kind===`terminal`||n.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}function _t({children:e}){let t=z.Children.toArray(e).filter(Boolean),n=t.length%2==1;return(0,B.jsx)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:t.map((e,r)=>(0,B.jsx)(`section`,{className:j(`flex min-w-0 flex-col border-t border-line-soft pt-6`,n&&r===t.length-1?`@3xl:col-span-4`:`@3xl:col-span-2`),children:e},r))})}var $=25;function vt({runs:e}){let t=nt(e.some(e=>e.status===`running`)),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(`all`),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(0);(0,z.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,h=n.toLowerCase().split(/\s+/).filter(Boolean),g=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&h.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),_={all:g.length,running:g.filter(e=>e.status===`running`).length,failed:g.filter(e=>e.status===`failed`).length},v=i===`all`?g:g.filter(e=>e.status===i),b=Math.max(1,Math.ceil(v.length/$)),x=Math.min(f,b-1),S=v.slice(x*$,x*$+$),C=e.filter(e=>e.status!==`running`&&!X(e)),w=C.filter(e=>e.status===`failed`).length,T=C.length?C.reduce((e,n)=>e+q(n,t),0)/C.length:NaN,E=e.reduce((e,t)=>e+Y(t),0),D=[...new Set(e.map(e=>e.kind))],O=[...new Set(e.map(e=>e.origin.kind))],k={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,B.jsx)(oe,{icon:ee,title:`No runs yet`,action:(0,B.jsxs)(`a`,{className:re({size:`sm`}),href:P(),"data-tip":`Start a chat`,children:[(0,B.jsx)(y,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:j(`tabular-nums`,w?`text-fail`:`text-ink`),children:w}),` failed`,C.length?` (${Math.round(w/C.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:F(E)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:J(Math.round(T))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(ae,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,B.jsx)(ue,{items:[{id:`all`,label:`All`,n:_.all},{id:`running`,label:`Running`,n:_.running},{id:`failed`,label:`Failed`,n:_.failed,alert:!0}],value:i,onChange:a}),D.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,B.jsx)(`option`,{value:``,children:`Any kind`}),D.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]}),O.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,B.jsx)(`option`,{value:``,children:`Started anywhere`}),O.map(e=>(0,B.jsx)(`option`,{value:e,children:k[e]||e},e))]})]}),(0,B.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[13px] font-semibold text-muted @3xl:grid`,children:[(0,B.jsx)(`span`,{className:`w-4`}),(0,B.jsx)(`span`,{children:`Run`}),(0,B.jsx)(`span`,{children:`Kind`}),(0,B.jsx)(`span`,{children:`Started by`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,B.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,B.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-2`,children:[S.length===0&&(0,B.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:`Nothing matches.`}),S.map((e,n)=>{let r=Oe(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(n===0||Oe(S[n-1].startedAt)!==r)&&(0,B.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`a`,{href:P(`runs`,encodeURIComponent(e.name)),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 @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,B.jsx)(at,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[13px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[13px] text-muted @3xl:hidden`,children:[V[e.kind],k[e.origin.kind],J(q(e,t)),`${F(Y(e))} tokens`].join(` · `)})]}),(0,B.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-2 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,B.jsx)(Fe,{kind:e.kind}),V[e.kind]]}),(0,B.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:k[e.origin.kind]||e.origin.kind}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:J(q(e,t))}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:F(Y(e))}),(0,B.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":tt(e.startedAt),children:ke(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(se,{page:x,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${A(m,`empty session`)}`:`${A(m,`empty session`)} hidden`})]})})]})]})}function yt({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{pe.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,z.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,z.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ie(s):``;return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(Se,{}),(0,B.jsx)(`main`,{className:j(we,`@container flex-auto gap-4`),children:l?(0,B.jsx)(gt,{name:l,tab:c},l):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ae,{}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(be,{pixel:ye.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(ve,{label:`Runs and reports`,links:Ne,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(vt,{runs:t})]})})]})}export{yt as Runs,at as StatusIcon,X as empty,ht as runTab,it as statusLabel};
@@ -1,2 +0,0 @@
1
- import{Ir as e,Nr as t,at as n,in as r,w as i,zr as a}from"./line-icons-C_amZ5-o.js";import{$t as o,B as s,Jt as c,V as l,c as u,i as d,l as f,n as p,p as m}from"./filters-CVzIOjPG.js";import{o as h,t as g}from"./markdown-DC2HA0yZ.js";import{u as _}from"./parts-BR6dUwqn.js";var v=a(e(),1),y=o();function b({error:e}){return e?(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}var x=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,S={ok:{label:`Ready to start`,tone:`pass`},limits:{label:`Ready, with limits`,tone:`warn`},blocked:{label:`Not possible`,tone:`fail`}},C={converted:{label:`Converted`,tone:`pass`},partial:{label:`Needs review`,tone:`warn`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},running:{label:`Running`,tone:`running`}},w={converted:{label:`Converted`,tone:`pass`},written:{label:`Written`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`},blocked:{label:`Not possible`,tone:`warn`},skipped:{label:`Skipped`,tone:`neutral`}},T={setup:`Set-up`,page:`Page`,test:`Test`},E=e=>e.engine?e.engine===`mobile`?`Mobile workflow`:`Desktop workflow`:T[e.kind],D={matched:{label:`In the test`,dot:`bg-pass`},missing:{label:`Missing from the test`,dot:`bg-fail`},elided:{label:`Not needed: this branch never runs`,dot:`bg-line-strong`},marked:{label:`Left for a person to finish`,dot:`bg-warn`}},O=e=>e.route===`web`||e.route===`api`||(e.routes?.web??0)>0||(e.routes?.api??0)>0||(e.workflow?.steps??0)>0;function k(e){if(e.workflow&&e.workflow.steps>0)return`${e.workflow.engine===`mobile`?`Mobile`:`Desktop`} workflow${e.workflow.skipped?` + notes`:``}`;let t=e.route===`web`||(e.routes?.web??0)>0,n=e.route===`api`||(e.routes?.api??0)>0,r=(e.unsupported??0)>0||(e.routes?.unsupported??0)>0;return`${t&&n?`Web and API`:n?`API`:`Web`}${r?` + notes`:``}`}var A={web:`Web`,api:`API`,desktop:`Desktop`,mobile:`Mobile`,data:`Data`,mixed:`Mixed`,unsupported:`Not supported`},j={prepare:`Prepare`,setup:`Set up`,pages:`Pages`,tests:`Tests`,validate:`Validate`,review:`Review`},M=[`prepare`,`setup`,`pages`,`tests`,`validate`,`review`];function N(e,t){if(!t)return 0;if(t.status===`converted`||t.stages?.review.status===`done`)return 100;let n=t.stages?.validate.status===`done`?8:0,r=Math.min(t.units.length,e.units.length);return Math.min(99,Math.round(r/Math.max(1,e.units.length)*90+n))}function P(e){let t=e?.status||`pending`,n=e?.startedAt&&e?.endedAt?_(Date.parse(e.endedAt)-Date.parse(e.startedAt)):``;return t===`running`?e?.startedAt?`Running · ${_(Date.now()-Date.parse(e.startedAt))}`:`Running`:t===`done`?e?.note||(n?`Done · ${n}`:`Done`):t===`failed`?e?.note||`Did not finish`:t===`skipped`?e?.note||`Skipped`:`Waiting`}function F({states:e}){return(0,y.jsx)(`ol`,{"aria-label":`Stages`,className:`m-0 flex w-full min-w-0 list-none items-center gap-1 p-0 @xl:gap-2`,children:M.map((n,a)=>{let o=e?.[n],s=o?.status||`pending`,c=s===`done`||s===`skipped`,u=s===`running`||s===`failed`,d=P(o);return(0,y.jsxs)(`li`,{"data-tip":`${j[n]}: ${d}`,className:l(`relative flex items-center gap-1 @xl:gap-2`,a<M.length-1&&`flex-1`),"aria-current":s===`running`?`step`:void 0,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:l(`inline-flex size-5 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums @xl:size-6`,c?`bg-pass text-white`:s===`running`?`border-2 border-accent bg-accent-soft text-accent-fg`:s===`failed`?`bg-fail text-white`:`border border-line bg-bg text-muted`),children:c?(0,y.jsx)(i,{size:12,strokeWidth:3}):s===`failed`?(0,y.jsx)(t,{size:12,strokeWidth:3}):s===`running`?(0,y.jsx)(r,{size:12,strokeWidth:2.5,className:`animate-spin`}):a+1}),(0,y.jsxs)(`span`,{className:l(`flex-none text-[13px] whitespace-nowrap`,u?`inline`:`hidden @xl:inline`,s===`running`?`font-medium text-accent-fg`:s===`failed`?`font-medium text-fail`:s===`pending`?`text-muted`:`text-ink`),children:[j[n],u&&(0,y.jsx)(`span`,{className:`ml-2 hidden font-normal text-muted @3xl:inline`,children:d})]}),(0,y.jsxs)(`span`,{className:`sr-only`,children:[j[n],`: `,d]}),a<M.length-1&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,y.jsx)(`span`,{className:l(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,c?`w-full`:`w-0`)})})]},n)})})}function I(e){return e?`literal`in e?JSON.stringify(e.literal):`env`in e?`env ${String(e.env)}${e.secret?` (secret)`:``}`:`var`in e?`variable ${String(e.var)}`:`param`in e?`parameter ${String(e.param)}`:`data`in e?`test data ${String(e.data)}`:`expr`in e?`expression ${String(e.expr)}`:`concat`in e&&Array.isArray(e.concat)?e.concat.map(I).join(` + `):``:``}var L={exact:`is`,contains:`contains`,not:`is not`,gt:`is more than`,gte:`is at least`,lt:`is less than`,lte:`is at most`,exists:`is there`,absent:`is not there`},R=new Set([`gt`,`gte`,`lt`,`lte`]);function z(e){let t=e.expected;return t&&`literal`in t&&/^-?\d+(\.\d+)?$/.test(String(t.literal))&&(R.has(e.match||``)||e.op===`api_status`)?String(t.literal):I(t)}function B(e,t,n){return e===`api_status`||t===`status`?`the status`:e===`api_header`||t===`header`?`the header ${n}`:e===`api_body`||t===`body`?`the body`:`the JSON value ${n}`}function V(e){if(e.op===`api_request`){let t=e.method&&`literal`in e.method?String(e.method.literal):``,n=[e.endpoint,e.resource].filter(Boolean).map(e=>I(e)).join(` + `),r=(e,t,n)=>{let r=e?Object.keys(e).length:0;return r?`${r} ${r===1?t:n}`:``},i=[e.payload?.fields?.length?`${e.payload.fields.length} body ${e.payload.fields.length===1?`field`:`fields`}`:e.payload?.raw?`a body`:``,r(e.pathParams,`path parameter`,`path parameters`),r(e.query,`query parameter`,`query parameters`),r(e.headers,`header`,`headers`)].filter(Boolean);return`Call ${t?`${t} `:e.method?`(method ${I(e.method)}) `:``}${n||`with no address`}${i.length?`, with ${i.join(`, `)}`:``}`}if(e.kind===`assert`&&(e.op===`api_status`||e.op===`api_header`||e.op===`api_json`||e.op===`api_body`)){let t=B(e.op,void 0,e.target),n=e.match||`exact`;return`Check ${t} of the response ${L[n]||`is`}${n===`exists`||n===`absent`?``:` ${z(e)}`}`}return e.op===`api_store`?`Read ${B(void 0,e.property,e.target)} of the response into ${e.var}`:null}function H(e){let t=V(e);if(t!==null)return t;let n=e.target?e.target.slice(e.target.indexOf(`.`)+1).replace(/_/g,` `):``;if(e.kind===`action`){let t=e.op===`navigate`?`Open ${I(e.value)}`:e.op===`close`?`Close the browser`:e.op===`fill`?`Fill ${n} with ${I(e.value)}`:e.op===`press`?`Press ${e.key} on ${n}`:e.op===`select`?`Select in ${n}`:`${e.op[0].toUpperCase()}${e.op.slice(1)} ${n}`;return e.optional?`${t} (if it is there)`:t}return e.kind===`assert`?`Check ${n} ${e.op===`text`||e.op===`value`?`${e.match===`contains`?`contains`:`is`} ${I(e.expected)}`:`is ${e.op}`}${e.wait?`, waiting`:``}`:e.kind===`store`?`Read ${n} into ${e.var}`:e.kind===`set_var`?`Set ${e.var} to ${I(e.value)}`:e.kind===`wait`?`Wait ${e.ms} ms`:e.kind===`unsupported`?e.reason||`Cannot be converted`:e.name||e.kind}var U=(e,t)=>t?m(`tosca`,e,`compare`,encodeURIComponent(t)):m(`tosca`,e,`compare`),W=50,G={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function K({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,y.jsx)(`ul`,{className:l(`m-0 flex list-none flex-col p-0`,i>0&&`ml-4 border-l border-line-soft pl-4`),children:e.map((e,a)=>{if(e.kind===`group`)return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[G[e.role||`folder`]||`Folder`,`: `,(0,y.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,y.jsx)(K,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${a}`);if(e.kind===`if`||e.kind===`loop`){let o=e.condition;return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,y.jsx)(`code`,{className:`font-mono text-[13px] text-ink-2`,children:o?.tosca}),o?.constant!==void 0&&(0,y.jsxs)(`span`,{children:[` · always `,o.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsx)(`span`,{className:`ml-4 text-[13px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,y.jsx)(K,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${a}`)}let o=e.id?t.get(e.id):void 0,s=o?D[o]:void 0;return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:l(`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,n===e.id?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":s?.label||`Not converted yet`,"data-tip":s?.label||`Not converted yet`,className:l(`mt-2 size-2 flex-none rounded-full`,s?.dot||`bg-line`)}),(0,y.jsx)(`span`,{className:`w-9 flex-none font-mono text-[13px] text-muted`,children:e.id}),(0,y.jsxs)(`span`,{className:l(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[H(e),e.tosca?.step&&(0,y.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||a)})})}function q(e,t){for(let n of e){if(n.id===t)return n;for(let e of[`body`,`then`,`else`,`loop`]){let r=n[e]&&q(n[e],t);if(r)return r}}}function J({view:e,pick:t,engine:n}){let r=e.target,i=r?.text||``,a=i.split(`
2
- `),o=(0,v.useMemo)(()=>i?h(i,r?.lang||`plaintext`):null,[i,r?.lang]),s=(0,v.useMemo)(()=>{if(!t)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(a.flatMap((t,n)=>e.test(t)?[n]:[]))},[t,i]),c=(0,v.useRef)(null);(0,v.useEffect)(()=>{c.current?.scrollIntoView({block:`center`,behavior:`smooth`})},[t,s.size]);let u=Math.min(...s);return(0,y.jsxs)(`figure`,{className:`pane-swap m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-4`,children:[(0,y.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:n?E({kind:`test`,engine:n}):`Converted test`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink-2`,"data-tip":r?.path,children:r?.path||``}),i&&(0,y.jsx)(g,{text:i,label:`Copy ${r?.path||`the test`}`})]}),i?(0,y.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[13px] leading-[1.6]`,children:[(0,y.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft py-4 text-right text-muted select-none`,children:a.map((e,t)=>(0,y.jsx)(`span`,{ref:t===u?c:void 0,className:l(`block px-4`,s.has(t)&&`bg-accent-soft font-semibold text-accent-fg`),children:t+1},t))}),(0,y.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-4 py-4`,children:(0,y.jsx)(`code`,{className:`hljs`,children:o})})]}):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:r?`Not written yet.`:`This test case is left out of the plan.`}),t&&i&&(0,y.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:s.size?`${t} is done on line ${[...s].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`})]})}function Y({view:e,node:t}){if(!t?.target)return null;let[n,r]=t.target.split(`.`),i=e.pages.find(e=>e.id===n),a=i?.elements.find(e=>e.id===r);return a?(0,y.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-4 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,y.jsxs)(`span`,{className:`font-normal text-muted`,children:[`on `,i?.name,a.scope?.length?`, inside ${a.scope.join(` › `)}`:``,a.nth===void 0?``:`, number ${a.nth+1}`]})]}),a.locators.length?(0,y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`w-14 flex-none text-[13px] text-muted`,children:e.strategy}),(0,y.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.strategy===`role`?`${e.role} "${e.name}"`:e.attr?`[${e.attr}="${e.value}"]`:e.value}),e.fragile&&(0,y.jsx)(u,{tone:`warn`,children:`Fragile`})]},t))}):(0,y.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function X({id:e,plan:t,result:r,initial:i,full:a,onPick:o}){let u=t.cases.filter(e=>e.included),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(i||u[0]?.id||``),[b,S]=(0,v.useState)(null),[C,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``);(0,v.useEffect)(()=>{g&&(D(``),c.case(e,g).then(S,e=>D(e.message)))},[e,g,r?.units.length,r?.status]),(0,v.useEffect)(()=>{T(``),g&&o?.(g)},[g]);let O=new Map((b?.fidelity||[]).map(e=>[e.id,e.status])),k=u.filter(e=>!m||e.name.toLowerCase().includes(m.toLowerCase())),[j,M]=(0,v.useState)(0);(0,v.useEffect)(()=>M(0),[m]),(0,v.useEffect)(()=>{let e=k.findIndex(e=>e.id===g);e>=0&&Math.floor(e/W)!==j&&M(Math.floor(e/W))},[g]);let N=k.slice(j*W,j*W+W),P=e=>r?.units.find(t=>t.kind===`test`&&t.case===e);if(!u.length)return(0,y.jsx)(f,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});let F=(0,y.jsxs)(`div`,{className:l(`grid grid-cols-[minmax(0,1fr)] gap-4 @5xl:grid-cols-[220px_minmax(0,1fr)_minmax(0,1fr)]`,a?`@5xl:min-h-0 @5xl:flex-1`:`@5xl:h-[calc(var(--screen)-368px)] @5xl:min-h-[540px]`),children:[(0,y.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[320px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-4 @5xl:max-h-none`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-1 px-1`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:`Test cases`}),(0,y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[u.filter(e=>P(e.id)?.status===`converted`).length,` converted · `,u.some(e=>P(e.id)?.status===`written`)?`${u.filter(e=>P(e.id)?.status===`written`).length} written · `:``,u.filter(e=>[`failed`,`blocked`].includes(P(e.id)?.status||``)).length,` failed · `,x(u.length,`test case`)]})]}),(0,y.jsx)(d,{id:`find-a-case`,label:`Find a test case`,value:m,onChange:h,className:`max-w-none flex-none`}),(0,y.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-1 overflow-y-auto p-0`,children:[N.map(e=>{let t=P(e.id);return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":g===e.id,onClick:()=>_(e.id),className:l(`flex w-full cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,g===e.id?`bg-accent-soft text-ink`:`bg-transparent text-ink-2 hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":t?w[t.status].label:`Waiting`,className:l(`mt-2 size-2 flex-none rounded-full`,t?.status===`converted`?`bg-pass`:t?.status===`failed`?`bg-fail`:t?.status===`blocked`?`bg-warn`:`bg-line`)}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.name,(0,y.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[x(e.steps,`step`),` · `,x(e.asserts,`check`),t?.fidelity?` · ${t.fidelity.matched}/${t.fidelity.required} in the test`:``]})]})]})},e.id)}),!N.length&&(0,y.jsx)(`li`,{className:`px-2 py-4 text-[13px] text-muted`,children:`No test case matches.`})]}),k.length>W&&(0,y.jsx)(p,{page:j,size:W,total:k.length,onPage:M,label:`Test case pages`})]}),(0,y.jsxs)(`section`,{"aria-label":`Tosca steps`,className:`flex min-h-[360px] min-w-0 flex-col gap-4 overflow-hidden`,children:[E&&(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:E}),(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`header`,{className:`flex min-h-10 flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2`,children:[(0,y.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Tosca steps`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:b?.name}),b&&t.cases.find(e=>e.id===g)&&(0,y.jsx)(`span`,{className:`text-[13px] text-muted`,children:A[t.cases.find(e=>e.id===g).route]||``})]}),(0,y.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:b?(0,y.jsx)(K,{nodes:b.body,status:O,pick:C,onPick:e=>T(e.id||``)}):E?(0,y.jsx)(`p`,{className:`m-0 px-2 text-sm text-muted`,children:`Nothing to show.`}):(0,y.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:`Loading…`})},b?.case||``),b&&(b.env.length>0||b.warnings.length>0)&&(0,y.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-4 py-2 text-[13px] text-ink-2`,children:[b.env.length>0&&(0,y.jsxs)(`span`,{children:[`Environment variables: `,b.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),b.warnings.slice(0,3).map(e=>(0,y.jsx)(`span`,{className:`text-warn`,children:e},e))]})]}),b&&(0,y.jsx)(Y,{view:b,node:q(b.body,C)})]}),b?(0,y.jsx)(J,{view:b,pick:C,engine:t.units.find(e=>e.kind===`test`&&e.case===b.case)?.engine},b.case):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] items-center justify-center rounded-[12px] card border px-4 text-center text-sm text-muted`,children:E?`Nothing to show.`:`Loading…`})]});return a?F:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`flex justify-end`,children:(0,y.jsxs)(`a`,{href:U(e,g),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:s({variant:`ghost`,size:`sm`}),children:[(0,y.jsx)(n,{"aria-hidden":`true`}),`Open in a new tab`]})}),F]})}export{C as a,j as c,S as d,k as f,N as g,E as h,b as i,F as l,x as m,U as n,A as o,O as p,D as r,M as s,X as t,w as u};
@@ -1 +0,0 @@
1
- import{Ir as e,Lt as t,Nr as n,at as r,nn as i,o as a,ot as o,tn as s,w as c,yr as l,z as u,zr as d}from"./line-icons-C_amZ5-o.js";import{$t as f,Kt as p,V as m,a as h,et as g,f as _,g as v,l as y,p as b,t as x,z as S}from"./filters-CVzIOjPG.js";import{$ as C,X as w,Z as T,bn as E,bt as D,o as O,t as k,tt as A}from"./frame-Deu1IqzV.js";import{s as j}from"./markdown-DC2HA0yZ.js";import{t as M}from"./when-CHnpLdYw.js";import{U as N,j as P}from"./index-BWMIKyPB.js";var F=d(e(),1),I=f(),L=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],R=e=>L.some(t=>t.id===e),z=e=>e&&j(e)===`web`?e:void 0,B=(e,t)=>`${e} ${t}${e===1?``:`s`}`,V=e=>`${e.kind}:${e.id}`;function H(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${B((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function U(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function W(){let[e,t]=(0,F.useState)(L.map(e=>e.id)),[n,r]=(0,F.useState)(``);return(0,F.useEffect)(()=>{g.settings().then(e=>{let n=e.config.sources??{},r=L.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:L.filter(t=>e.includes(t.id)),error:n}}function G({id:e,icon:t,title:n,children:r}){return(0,I.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-4`,children:[(0,I.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,I.jsx)(v,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function K({view:e,onApplied:a,onError:d}){let[f,h]=(0,F.useState)([]),[g,_]=(0,F.useState)(null),[v,y]=(0,F.useState)(!1),[b,x]=(0,F.useState)(null),E=e.story.id,D=e.proposals.filter(e=>f.includes(V(e))),O=async()=>{let t=D.map(e=>U(e,E));y(!0);try{let n=await p.preview(e.system,E,t);_({lines:n.lines,changes:t}),d(``)}catch(e){d(e.message)}finally{y(!1)}},k=async()=>{if(g){y(!0);try{let t=await p.apply(e.system,E,g.changes);x({applied:t.applied,failed:t.failed}),_(null),h([]),d(``),a()}catch(e){d(e.message)}finally{y(!1)}}},j=z(e.story.url);return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[j?(0,I.jsxs)(`a`,{href:j,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[E,(0,I.jsx)(r,{size:14,"aria-hidden":`true`})]}):(0,I.jsx)(`span`,{children:E}),e.story.title&&(0,I.jsx)(`span`,{className:`font-normal text-ink-2`,children:e.story.title})]}),e.changed&&(0,I.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(e.changed.when).toLocaleString(),children:[`The story's `,e.changed.field,` changed `,M(e.changed.when),`.`]})]}),(0,I.jsx)(G,{id:`cases-h`,icon:s,title:`Linked cases`,children:(0,I.jsx)(w,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:C,children:`Case`}),(0,I.jsx)(`th`,{className:C,children:`Title`}),(0,I.jsx)(`th`,{className:m(C,`text-right`),children:`Steps`}),(0,I.jsx)(`th`,{className:C,children:`State`})]}),children:e.cases.map(e=>{let t=z(e.url);return(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:m(T,`whitespace-nowrap`),children:t?(0,I.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,I.jsx)(r,{size:12,"aria-hidden":`true`})]}):e.id}),(0,I.jsx)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:e.title}),(0,I.jsx)(`td`,{className:m(T,`text-right tabular-nums`),children:e.steps}),(0,I.jsx)(`td`,{className:m(T,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(l,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,I.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,M(e.changed)]}):`–`})]},e.id)})})}),(0,I.jsx)(G,{id:`criteria-h`,icon:u,title:`Acceptance criteria`,children:(0,I.jsx)(w,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:C,children:`Criterion`}),(0,I.jsx)(`th`,{className:C,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:e.text}),(0,I.jsx)(`td`,{className:m(T,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,I.jsxs)(G,{id:`proposals-h`,icon:i,title:`Proposed changes`,children:[(0,I.jsx)(w,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,I.jsxs)(S,{size:`sm`,variant:`primary`,disabled:v||!D.length||!!g,"data-tip":`Review ${B(D.length,`change`)}`,onClick:()=>void O(),children:[(0,I.jsx)(o,{"aria-hidden":`true`}),`Review (`,D.length,`)`]}),head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:m(C,`w-10`),children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,I.jsx)(`th`,{className:C,children:`Change`}),(0,I.jsx)(`th`,{className:C,children:`Existing case`}),(0,I.jsx)(`th`,{className:C,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=V(e);return(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:T,children:(0,I.jsx)(P,{"aria-label":`${H(e)}: ${e.id} ${e.title}`,checked:f.includes(t),disabled:v||!!g,onCheckedChange:e=>h(e?[...f,t]:f.filter(e=>e!==t))})}),(0,I.jsxs)(`td`,{className:m(T,`whitespace-nowrap font-medium`),children:[H(e),e.link&&e.kind!==`link`&&(0,I.jsx)(`span`,{className:`block text-[13px] font-normal text-muted`,children:`and link it`})]}),(0,I.jsxs)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:[(0,I.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,I.jsx)(`td`,{className:m(T,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),g&&(0,I.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-4 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,B(g.changes.length,`change`),` to `,L.find(t=>t.id===e.system)?.label,`?`]}),(0,I.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:g.lines.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsxs)(S,{size:`sm`,variant:`primary`,disabled:v,onClick:()=>void k(),children:[(0,I.jsx)(c,{"aria-hidden":`true`}),`Apply`]}),(0,I.jsxs)(S,{size:`sm`,disabled:v,onClick:()=>_(null),children:[(0,I.jsx)(n,{"aria-hidden":`true`}),`Cancel`]})]})]}),b&&b.applied.length>0&&(0,I.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,b.applied.join(`, `)]}),b&&b.failed.length>0&&(0,I.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,b.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,I.jsx)(G,{id:`changes-h`,icon:t,title:`Recent changes`,children:e.changes.length?(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:e.changes.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),e.notes.map((e,t)=>(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function q({sub:e}){let{systems:t,error:n}=W(),r=e?e.indexOf(`/`):-1,i=r>0?e.slice(0,r):e,o=R(i)?i:void 0,c=o&&r>0?_(e.slice(r+1)):``,[l,u]=(0,F.useState)(o??`azure_devops`),[d,f]=(0,F.useState)(c),[g,v]=(0,F.useState)(null),[C,w]=(0,F.useState)(``),[T,A]=(0,F.useState)(!1);(0,F.useEffect)(()=>{o&&u(o),f(c)},[o,c]),(0,F.useEffect)(()=>{!o&&t.length&&!t.some(e=>e.id===l)&&u(t[0].id)},[t,l,o]);let j=(0,F.useCallback)(()=>{!o||!c?v(null):(A(!0),p.view(o,c).then(e=>{v(e),w(``),A(!1)},e=>{w(e.message),A(!1)}))},[o,c]);return(0,F.useEffect)(()=>v(null),[o,c]),(0,F.useEffect)(j,[j]),(0,I.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,I.jsx)(O,{}),(0,I.jsxs)(`main`,{className:m(k,`@container flex-auto gap-4`),children:[(0,I.jsx)(N,{}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,I.jsx)(D,{pixel:E[`test-cases`],size:`lg`}),(0,I.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,I.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,I.jsx)(`a`,{href:b(`regression`),children:`Regression`}),`; their results on `,(0,I.jsx)(`a`,{href:b(`runs`),children:`Runs`}),`.`]}),(0,I.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=d.trim();if(!t)return;let n=b(`test-cases`,l,encodeURIComponent(t));location.hash===n?j():location.hash=n},className:`flex flex-col gap-4`,children:[(0,I.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-2`,children:(0,I.jsx)(x,{items:t,value:l,onChange:u})}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,I.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,I.jsx)(h,{value:d,maxLength:120,spellCheck:!1,placeholder:l===`azure_devops`?`1234`:l===`qtest`?`5678`:l===`testrail`?`R12`:`SHOP-12`,onChange:e=>f(e.target.value)})]}),(0,I.jsxs)(S,{type:`submit`,variant:`primary`,disabled:!d.trim()||T,"data-tip":`Open the story's test cases`,children:[(0,I.jsx)(a,{"aria-hidden":`true`}),`Open`]})]})]}),[n,C].filter(Boolean).map(e=>(0,I.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),T&&(0,I.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),g&&(0,I.jsx)(K,{view:g,onApplied:j,onError:w},`${g.system}:${g.story.id}`),!c&&!g&&(0,I.jsx)(y,{icon:s,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})]})}export{q as TestCases};
@@ -1 +0,0 @@
1
- import{Fn as e,Ir as t,M as n,N as r,R as i,Y as a,ar as o,o as s,tn as ee,xr as c,yr as l,zr as u}from"./line-icons-C_amZ5-o.js";import{$t as d,B as f,V as p,a as te,l as m,o as ne,ot as h,p as g,st as _,t as v,z as y}from"./filters-CVzIOjPG.js";import{X as b,bn as x,bt as S,o as C,t as re}from"./frame-Deu1IqzV.js";import{t as w}from"./when-CHnpLdYw.js";import{U as ie}from"./index-BWMIKyPB.js";import{_ as T,o as E}from"./qualityParts-lz6eYVxC.js";var D=u(t(),1),O={view:()=>h(`GET`,`/api/testdebt`),refresh:()=>h(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>h(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},k=d(),A=[`untested`,`signal`,`duplicates`,`cases`],j={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},M={test:`Test`,recording:`Recording`,case:`Test case`},N={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},P={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},F=e=>`${Math.round(e*100)}%`,I=e=>A.includes(e)?e:`untested`;function L({part:e,what:t,action:n}){return(0,k.jsxs)(m,{icon:l,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,k.jsxs)(`a`,{className:f({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,k.jsx)(s,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function R({text:e,tip:t}){return(0,k.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function z({sub:t}){let[l,u]=(0,D.useState)(null),[d,h]=(0,D.useState)(``),[A,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(``),H=I(t),[U,W]=(0,D.useState)(`all`),[G,ae]=(0,D.useState)(`manual`),[oe,se]=(0,D.useState)(``),[K,ce]=(0,D.useState)(``);(0,D.useEffect)(()=>{O.view().then(e=>{u(e),h(``)},e=>h(e.message))},[]);let q=(0,D.useCallback)(async(e,t)=>{z(!0),V(``);try{u(await e()),h(``),t&&V(t)}catch(e){h(e.message)}finally{z(!1)}},[]),le=async e=>{if(e){z(!0);try{let{id:t}=await _.start(e,{});location.hash=g(`chats`,t)}catch(e){h(e.message),z(!1)}}},J=(e,t)=>(0,k.jsx)(y,{size:`icon`,variant:`icon`,className:`size-8`,disabled:A||!e,onClick:()=>void le(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,k.jsx)(o,{"aria-hidden":`true`})}),Y=l?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=oe||Y[0]?.id||``,Z=l?.cases.filter(e=>!e.automated).length??0,ue=l?.areas.filter(e=>U===`all`||e.kind===U)??[],de=l?.cases.filter(e=>G===`all`||(G===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-4 text-right tabular-nums`,$={untested:(l?.areas.length??0)+(l?.rules.length??0),signal:(l?.quiet.length??0)+(l?.gone.length??0),duplicates:l?.duplicates.length??0,cases:Z};return(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(C,{}),(0,k.jsxs)(`main`,{className:p(re,`@container flex-auto gap-4`),children:[(0,k.jsx)(ie,{}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,k.jsx)(S,{pixel:x[`test-debt`],size:`lg`}),(0,k.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),l&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,k.jsxs)(`span`,{"data-tip":T(l.at),children:[`Worked out `,w(l.at)]}),(0,k.jsxs)(y,{size:`sm`,disabled:A,onClick:()=>void q(O.refresh,`Worked out again.`),children:[(0,k.jsx)(e,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,k.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,k.jsx)(`a`,{href:g(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,l?.repo&&l.repo!==`.`?(0,k.jsx)(`code`,{className:`font-mono text-[13px]`,children:l.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),d&&(0,k.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}),!l&&!d&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),B&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:B}),l&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,k.jsx)(E,{label:`Untested code`,value:l.graph.state===`ok`?l.areas.length:`–`,tone:l.areas.length?`text-warn`:void 0,sub:l.graph.state===`ok`?`of ${l.graph.checked} areas`:`graph not built`}),(0,k.jsx)(E,{label:`Untested rules`,value:l.rules.length,tone:l.rules.length?`text-warn`:void 0,sub:`of ${l.graph.rulesChecked} rules`}),(0,k.jsx)(E,{label:`Never fail`,value:l.quiet.length,sub:`30 passes in a row`}),(0,k.jsx)(E,{label:`Code gone`,value:l.gone.length,tone:l.gone.length?`text-fail`:void 0,sub:`of ${l.files.count} files listed`}),(0,k.jsx)(E,{label:`Near-duplicates`,value:l.duplicates.length,sub:`from ${F(l.threshold)} alike`}),(0,k.jsx)(E,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${l.cases.length} test cases`})]}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(v,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:H,onChange:e=>location.hash=g(`test-debt`,e)})}),l.notes.map(e=>(0,k.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:e},e)),H===`untested`&&(0,k.jsxs)(k.Fragment,{children:[l.graph.state===`ok`?(0,k.jsx)(b,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:U,empty:l.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(v,{items:[{id:`all`,label:`All`,n:l.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${j[e]}s`,n:l.areas.filter(t=>t.kind===e).length}))],value:U,onChange:W})}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Code`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Used by`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(r,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,k.jsx)(R,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:j[e.kind]}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,k.jsx)(R,{text:e.where})}),(0,k.jsx)(`td`,{className:p(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,j[e.kind].toLowerCase())})]},e.id))}):(0,k.jsx)(L,{part:l.graph,what:`product graph`,action:{label:`Product`,to:g(`product`)}}),(0,k.jsx)(b,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:l.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[46%]`),children:`Rule`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`From`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.rules.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(r,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,k.jsx)(R,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,k.jsx)(R,{text:e.where})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.nearest?(0,k.jsx)(R,{text:`${e.nearest.name} (${F(e.nearest.score)})`,tip:`${F(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`rule`)})]},e.id))})]}),H===`signal`&&(l.history.state===`ok`?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(b,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Passes`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Since`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.quiet.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(n,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,k.jsx)(R,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,k.jsx)(`td`,{className:p(Q,`text-muted`),children:e.runs}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?T(e.since):void 0,children:e.since?w(e.since):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))}),(0,k.jsx)(b,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${l.files.count} files, listed by ${l.files.by===`git`?`git`:`walking the folder`}).`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`File`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Last run`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.gone.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(i,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,k.jsx)(R,{text:e.name})]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0 font-mono text-[13px] text-ink-2`),children:(0,k.jsx)(R,{text:e.file})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?T(e.last):void 0,children:e.last?w(e.last):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))})]}):(0,k.jsx)(L,{part:l.history,what:`test history`,action:{label:`Regression`,to:g(`regression`)}})),H===`duplicates`&&(0,k.jsx)(b,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${F(l.threshold)} of their words (${l.compared} pairs compared).`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Alike`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`First`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`Second`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.duplicates.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(Q,`pl-4`,e.score>=.85?`text-warn`:`text-muted`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,k.jsx)(a,{size:14,"aria-hidden":`true`}),F(e.score)]})}),[e.a,e.b].map((e,t)=>(0,k.jsxs)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:[(0,k.jsx)(R,{text:e.name,tip:`${M[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,k.jsx)(`span`,{className:`block text-[13px] text-muted`,children:M[e.kind]})]},t)),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,k.jsx)(R,{text:e.shared.join(`, `)})}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),H===`cases`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:l.sources.map(e=>(0,k.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,k.jsx)(n,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,k.jsx)(r,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,k.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,k.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${w(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,k.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>O.readCases(X,K.trim()),`Test cases read.`)},children:[(0,k.jsx)(ne,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>se(e.target.value),children:Y.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,k.jsx)(te,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?P[X]:``,value:K,maxLength:80,onChange:e=>ce(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,k.jsxs)(y,{size:`sm`,type:`submit`,disabled:A||!K.trim(),"data-tip":`Read the test cases`,children:[(0,k.jsx)(c,{"aria-hidden":`true`}),`Import`]})]}),l.cases.length?(0,k.jsx)(b,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:G,empty:`Nothing matches.`,tools:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(v,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:l.cases.length-Z},{id:`all`,label:`All`,n:l.cases.length}],value:G,onChange:ae})}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Case`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[36%]`),children:`Title`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Source`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Automated`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:de.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`font-mono text-[13px] whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,k.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsx)(R,{text:e.title||`–`})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:N[e.source]}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,k.jsx)(n,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,k.jsx)(r,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.test?(0,k.jsx)(R,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,k.jsx)(m,{icon:ee,title:`No test cases yet`,action:(0,k.jsxs)(`a`,{className:f({size:`sm`}),href:g(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,k.jsx)(s,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{z as TestDebt};