@capagents/forgeqe 2.7.8 → 2.8.0

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 (55) hide show
  1. package/dist/forgeqe.js +1546 -1545
  2. package/dist/web/assets/{Agent-VNt6ZWZz.js → Agent-Cpr_JPsv.js} +1 -1
  3. package/dist/web/assets/{ApiTests-DCzhasKI.js → ApiTests-CjT-L7xj.js} +1 -1
  4. package/dist/web/assets/{Chat-Df_9hcrK.js → Chat-CKxJgDK-.js} +1 -1
  5. package/dist/web/assets/{CommandPalette-MCY8wvHA.js → CommandPalette-4IgFkCM3.js} +1 -1
  6. package/dist/web/assets/{Cost-BNfKL_03.js → Cost-BwRZfghx.js} +1 -1
  7. package/dist/web/assets/{Data-BhRzzs7P.js → Data-BMYEI2zm.js} +1 -1
  8. package/dist/web/assets/{Evidence-BFnrkuWM.js → Evidence-DV5cmf2A.js} +1 -1
  9. package/dist/web/assets/{Explore-DwWbiruJ.js → Explore-CRJLGwb_.js} +1 -1
  10. package/dist/web/assets/{Features-Bdag6Wmx.js → Features-DC6qkO4j.js} +1 -1
  11. package/dist/web/assets/{Flags-CX9bAVKi.js → Flags-BMvmpkqX.js} +1 -1
  12. package/dist/web/assets/{Flaky-DEN1VdiT.js → Flaky-gzUqp0xF.js} +1 -1
  13. package/dist/web/assets/{ForceGraph-mvdwnbOv.js → ForceGraph-uQcmLGJ6.js} +1 -1
  14. package/dist/web/assets/{Impact-muNB0nUs.js → Impact-CU6WpcdH.js} +1 -1
  15. package/dist/web/assets/{Jobs-CpTKT5DR.js → Jobs-PCuv59hx.js} +1 -1
  16. package/dist/web/assets/{KindPage-BU2JVAVF.js → KindPage-MvpdqxhO.js} +1 -1
  17. package/dist/web/assets/Migration-Bl1sMZbN.js +2 -0
  18. package/dist/web/assets/{Product-CSlODoYV.js → Product-DfDc1Y7W.js} +1 -1
  19. package/dist/web/assets/{Production-BirkX3Te.js → Production-Cmx-91bR.js} +1 -1
  20. package/dist/web/assets/{Quality-COxpzP7Z.js → Quality-BYLFLD-N.js} +1 -1
  21. package/dist/web/assets/{Readiness-BSgFm-Xp.js → Readiness-CLkwxBJ5.js} +1 -1
  22. package/dist/web/assets/{Record-CmQ5Zr3i.js → Record-D3Krlr-J.js} +1 -1
  23. package/dist/web/assets/{Regression-CyupwUMM.js → Regression-DGUcjl62.js} +1 -1
  24. package/dist/web/assets/{Reports-CejGNO45.js → Reports-DOvw7gQ7.js} +1 -1
  25. package/dist/web/assets/{Response-DG1lcsGu.js → Response-BrqXtc8W.js} +1 -1
  26. package/dist/web/assets/{RunDiff-CJ6k_1ZU.js → RunDiff-MMDCr2Pz.js} +1 -1
  27. package/dist/web/assets/{Runs-CJ9lRkNk.js → Runs-QO8eQ80z.js} +1 -1
  28. package/dist/web/assets/{TestCases-CCcZDwHs.js → TestCases-BpiSMks4.js} +1 -1
  29. package/dist/web/assets/{TestData-DS41AlXL.js → TestData-Anh6bcPT.js} +1 -1
  30. package/dist/web/assets/{TestDebt-CKjkoABS.js → TestDebt-B6KXcVJn.js} +1 -1
  31. package/dist/web/assets/Tosca-DLZ0Dtmp.js +2 -0
  32. package/dist/web/assets/{WhatsNew-jmU1_Vof.js → WhatsNew-TmFt7kPe.js} +1 -1
  33. package/dist/web/assets/{dataParts-CaJiuNL1.js → dataParts-YMCGX8gq.js} +1 -1
  34. package/dist/web/assets/{families-BGu6Jt7k.js → families-BxOkkDeO.js} +1 -1
  35. package/dist/web/assets/frame-COPwycC2.js +4 -0
  36. package/dist/web/assets/{index-BD3iUT-3.js → index-gt34hBeA.js} +4 -4
  37. package/dist/web/assets/{logos-c2wZeVQK.js → logos-BWQwdX_A.js} +1 -1
  38. package/dist/web/assets/{parts-CLy4FMjj.js → parts-CpA-Whdx.js} +1 -1
  39. package/dist/web/assets/{productParts-DyWke4HN.js → productParts--AVxWkUz.js} +1 -1
  40. package/dist/web/assets/{qualityParts-CFjfNmrS.js → qualityParts-DANtbDfW.js} +1 -1
  41. package/dist/web/assets/{segmented-E7E9vDxH.js → segmented-DDPlHkHh.js} +1 -1
  42. package/dist/web/assets/{thread-VaEnkSAe.js → thread-JBXELgnl.js} +1 -1
  43. package/dist/web/assets/{usePageChat-CBph4Mpc.js → usePageChat-HmuDg_GX.js} +1 -1
  44. package/dist/web/index.html +2 -2
  45. package/package.json +1 -1
  46. package/prompts/tosca.md +1 -1
  47. package/py/forgeqe_tosca/ntir.py +34 -2
  48. package/py/forgeqe_tosca/render.py +2 -1
  49. package/py/forgeqe_tosca/tsu.py +114 -2
  50. package/py/forgeqe_tosca/vendored.py +17 -5
  51. package/skills/tosca-knowledge/references/mapping-playwright.md +1 -0
  52. package/skills/tosca-knowledge/references/ntir.md +1 -1
  53. package/dist/web/assets/Migration-B54v2U19.js +0 -2
  54. package/dist/web/assets/Tosca-CXh15pdo.js +0 -2
  55. package/dist/web/assets/frame-CMf4LDd4.js +0 -4
@@ -1,4 +1,4 @@
1
- import{$n as e,At as t,Ci as n,Cr as r,Ft as i,Gt as a,It as o,Jn as s,Mi as c,Oi as l,Or as u,Pi as d,Rn as f,Sn as p,Tr as m,Ui as h,Xn as g,Xr as ee,Xt as _,Zr as v,_a as y,_t as te,da as ne,dr as b,en as x,fa as re,fr as ie,ga as S,ho as ae,ji as oe,jr as C,ki as se,kn as ce,ma as w,mr as le,ni as ue,po as de,qi as fe,tn as pe,ui as me,ur as he,vo as ge,vr as T,wn as E,yt as _e,zt as D}from"./frame-CMf4LDd4.js";import{c as O,l as ve,s as k}from"./index-BD3iUT-3.js";import{c as ye,i as A,o as j,r as M,s as N,t as P}from"./thread-VaEnkSAe.js";var F=ge(ae(),1),I=de();function L({diff:e,className:t}){let n=0,r=0,i=e.split(`
1
+ import{$n as e,At as t,Ci as n,Cr as r,Ft as i,Gt as a,It as o,Jn as s,Mi as c,Oi as l,Or as u,Pi as d,Rn as f,Sn as p,Tr as m,Ui as h,Xn as g,Xr as ee,Xt as _,Zr as v,_a as y,_t as te,da as ne,dr as b,en as x,fa as re,fr as ie,ga as S,ho as ae,ji as oe,jr as C,ki as se,kn as ce,ma as w,mr as le,ni as ue,po as de,qi as fe,tn as pe,ui as me,ur as he,vo as ge,vr as T,wn as E,yt as _e,zt as D}from"./frame-COPwycC2.js";import{c as O,l as ve,s as k}from"./index-gt34hBeA.js";import{c as ye,i as A,o as j,r as M,s as N,t as P}from"./thread-JBXELgnl.js";var F=ge(ae(),1),I=de();function L({diff:e,className:t}){let n=0,r=0,i=e.split(`
2
2
  `).flatMap((e,t)=>{if(/^(diff |index |--- |\+\+\+ )/.test(e))return[];let i=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);return i?(n=Number(i[1]),r=Number(i[2]),[{key:t,kind:`hunk`,text:e,a:``,b:``}]):e.startsWith(`+`)?[{key:t,kind:`add`,text:e.slice(1),a:``,b:String(r++)}]:e.startsWith(`-`)?[{key:t,kind:`del`,text:e.slice(1),a:String(n++),b:``}]:e.startsWith(`\\`)?[{key:t,kind:`hunk`,text:e,a:``,b:``}]:[{key:t,kind:`same`,text:e.startsWith(` `)?e.slice(1):e,a:String(n++),b:String(r++)}]});return(0,I.jsx)(`div`,{className:S(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[12px] leading-[1.6]`,t),children:(0,I.jsx)(`table`,{className:`w-full border-collapse`,children:(0,I.jsx)(`tbody`,{children:i.map(e=>(0,I.jsxs)(`tr`,{className:e.kind===`add`?`bg-pass-soft`:e.kind===`del`?`bg-fail-soft`:e.kind===`hunk`?`bg-surface-muted`:void 0,children:[(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,I.jsx)(`td`,{"aria-hidden":`true`,className:S(`w-4 align-top select-none`,e.kind===`add`?`text-pass`:e.kind===`del`?`text-fail`:`text-muted`),children:e.kind===`add`?`+`:e.kind===`del`?`−`:``}),(0,I.jsxs)(`td`,{className:S(`pr-3 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,I.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}function R({review:e,className:t}){return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,I.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,I.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{className:S(`mt-px flex-none rounded-full px-2 py-px text-[11.5px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[e.file&&(0,I.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,I.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,I.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var be={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 z({status:e,orb:t,px:n=20,spin:r=!1}){let a={width:n,height:n};return e===`active`&&r?(0,I.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:a,children:(0,I.jsx)(v,{size:n-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,I.jsx)(i,{state:t,px:n,label:`At work`}):e===`done`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:a,children:(0,I.jsx)(p,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:a,children:(0,I.jsx)(re,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:a,children:(0,I.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,I.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:S(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:a})}var xe=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Se={read:le,search:se,list:r,edit:b,run:fe,element:g,outline:ee,references:u,impact:me,find:ie,testfile:T,web:C,environment:c,cases:f,browser:C,post:oe,test:T,retry:n,review:d,task:m,work:ne},Ce={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`},B={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function we({kind:e,status:t}){let n=S(`mt-px flex size-4 flex-none items-center justify-center`,Ce[t]);if(e===`skill`)return(0,I.jsxs)(`span`,{role:`img`,"aria-label":B[t],className:S(n,`relative`),children:[(0,I.jsx)(pe,{name:_e.skills,px:15}),(t===`done`||t===`failed`)&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:S(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=Se[e];return(0,I.jsx)(`span`,{role:`img`,"aria-label":B[t],className:n,children:(0,I.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function Te({status:e}){return e===`active`?(0,I.jsx)(v,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,I.jsx)(`span`,{role:`img`,"aria-label":B[e],className:S(`mt-[7px] size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function V({text:e,label:t}){let[n,r]=(0,F.useState)(!1);return(0,I.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,I.jsx)(p,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(s,{size:13,"aria-hidden":`true`})})}function Ee({step:e,failed:t}){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 py-0.5 font-mono text-[12px] leading-relaxed`,children:[e.command&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,I.jsx)(V,{text:e.command,label:`Copy the command`})]}),e.output&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,I.jsx)(`pre`,{className:S(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[12px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,I.jsx)(V,{text:e.output,label:`Copy the output`})]})]})}var De=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function H({text:e}){return(0,I.jsx)(`span`,{className:S(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-1.5 py-0.5 text-[12.5px] text-ink-2`,De(e)&&`font-mono text-[12px]`),children:e})}function Oe({step:e}){return(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:e.lines.map((e,t)=>(0,I.jsxs)(`li`,{className:S(`flex gap-1.5 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,I.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,I.jsx)(O,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]},t))})}function U({agent:e,named:t=!0,working:n=!1}){let r=a(e);return(0,I.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-1.5`,"data-tip":r.name,children:[(0,I.jsx)(o,{agent:e,px:18,decorative:t,working:n}),t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`font-medium`,style:{color:r.hue},children:r.name}),(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}function W({step:e,from:t,live:n}){let r=e.handoff.agent,i=a(r);return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,I.jsx)(o,{agent:t,px:18}),(0,I.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:S(`handoff-flow flex-none`,n&&`is-live`),style:{color:i.hue},children:[(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{})]}),(0,I.jsx)(o,{agent:r,px:20,decorative:!0,working:n,className:`handoff-in`}),(0,I.jsx)(`span`,{className:`font-medium`,style:{color:i.hue},children:i.name}),e.arg&&(0,I.jsx)(H,{text:e.arg})]})}function G({step:e,working:n,from:r=D}){let i=e.agent||r,a=K(e),o=xe(e,n),[s,c]=(0,F.useState)(null),l=s??((!!e.handoff||!!e.agent||e.key.startsWith(`try:`))&&o===`active`),u=(0,I.jsxs)(I.Fragment,{children:[e.handoff?(0,I.jsx)(z,{status:o,orb:e.orb,px:14,spin:!0}):!(e.icon&&i===r)&&(0,I.jsx)(Te,{status:o}),e.handoff?(0,I.jsx)(W,{step:e,from:r,live:o===`active`}):(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[i!==r||!e.icon?(0,I.jsx)(U,{agent:i,named:i!==r,working:o===`active`}):(0,I.jsx)(we,{kind:e.icon,status:o}),(0,I.jsx)(`span`,{className:S(`[overflow-wrap:anywhere]`,o===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,I.jsx)(H,{text:e.arg}),e.change&&(0,I.jsxs)(`span`,{className:`font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),a&&(0,I.jsx)(E,{size:14,"aria-hidden":`true`,className:S(`mt-0.5 ml-auto flex-none text-muted transition-transform`,l&&`rotate-180`)})]});return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[a?(0,I.jsx)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>c(!l),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-1.5 py-1.5 text-left text-[13.5px] hover:bg-surface-muted`,children:u}):(0,I.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:u}),a&&(0,I.jsx)(t,{open:l,children:(0,I.jsx)(q,{step:e,working:n,from:r,className:`mb-1 ml-[13px]`})})]})}var K=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function q({step:e,working:t,from:n,className:r}){let i=e.children||[],o=e.handoff?.agent||e.agent;return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-1.5 border-l border-dotted py-1 pl-3`,r),style:{borderColor:o?`${a(o).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,I.jsx)(Ee,{step:e,failed:e.status===`fail`}),e.review&&(0,I.jsx)(R,{review:e.review}),e.lines.length>0&&(0,I.jsx)(Oe,{step:e}),e.change&&(0,I.jsx)(L,{diff:e.change.diff}),i.length>0&&(0,I.jsx)(`ul`,{"aria-label":o?`What ${_(a(o).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,I.jsx)(G,{step:e,working:t,from:o||n},e.key))}),e.handoff?.result&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`text-muted`,children:[_(a(e.handoff.agent).name,!0),` answered`]}),(0,I.jsx)(O,{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 ke({node:e,last:n,working:r,now:i,orbed:a}){let o=e.step?[]:e.steps,s=e.step,c=o.length>0||!!i||!!s&&K(s),[l,u]=(0,F.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,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,I.jsx)(`span`,{className:`mt-[3px]`,children:(0,I.jsx)(z,{status:e.status,orb:f,spin:!a})}),!n&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:S(`mt-1.5 min-h-4 w-0 flex-1 border-l border-dotted`,be[e.status])})]}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[c?(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>u(!d),className:`flex min-h-7 w-full cursor-pointer items-start gap-1.5 border-0 bg-transparent p-0 text-left`,children:[(0,I.jsx)(J,{node:e}),(0,I.jsx)(E,{size:14,"aria-hidden":`true`,className:S(`mt-1 flex-none text-muted transition-transform`,d&&`rotate-180`)}),e.status===`active`&&(0,I.jsx)(`span`,{className:`mt-0.5 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[11.5px] font-medium text-accent-fg`,children:`In progress`})]}):(0,I.jsx)(`div`,{className:`min-h-7`,children:(0,I.jsx)(J,{node:e})}),c&&(0,I.jsx)(t,{open:d,className:`mt-0.5`,children:s?(0,I.jsx)(q,{step:s,working:r,from:`forgeqe`,className:`mt-1`}):(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[o.map(e=>(0,I.jsx)(G,{step:e,working:r},e.key)),i&&(0,I.jsx)(`li`,{children:(0,I.jsx)(Y,{live:i,className:`px-1.5`})})]})})]})]})}function J({node:e}){let t=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,n=e.step;return n?.handoff?(0,I.jsx)(W,{step:n,from:D,live:e.status===`active`}):(0,I.jsxs)(`span`,{className:S(`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-sm font-medium`,t,e.status===`skipped`&&`line-through`),children:[n&&(0,I.jsx)(U,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`}),e.status===`active`?(0,I.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,I.jsx)(`span`,{children:e.label})}):(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,I.jsx)(H,{text:n.arg})]})}var Ae={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 je(e){let[t,n]=(0,F.useState)(()=>Date.now());(0,F.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 Y({live:e,orb:t=!1,className:n}){let r=je(e.latest?.at);return(0,I.jsxs)(`div`,{className:S(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,I.jsx)(`span`,{className:`mt-0.5 flex size-4 flex-none items-center justify-center`,children:t?(0,I.jsx)(i,{state:e.orb,px:20,label:`At work`}):(0,I.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,I.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,I.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{className:`shimmer text-[13.5px] font-medium text-muted`,children:(0,I.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,I.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,I.jsx)(`span`,{className:S(`min-w-0 truncate font-mono text-[12px]`,Ae[e.latest.tone]),children:e.latest.plain}),(0,I.jsxs)(`span`,{className:`flex-none text-[11.5px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Me({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,I.jsx)(Y,{live:n,orb:!0});let i=M(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,I.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,I.jsx)(`li`,{className:`flex gap-3`,children:(0,I.jsx)(Y,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,I.jsx)(ke,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var Ne={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function X({label:e,children:t}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,I.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function Z({text:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,I.jsx)(x,{icon:h,size:14,className:`mt-0.5 flex-none text-muted`}),(0,I.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12.5px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,I.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,onClick:async()=>{await ve(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,I.jsx)(p,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(s,{size:14,"aria-hidden":`true`})})]})}function Pe(e){if(e.runs===void 0)return e.attempts===void 0?``:y(e.attempts,`attempt`);let t=`${y(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${y(e.reviews,`review`)}`:t}function Fe({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,I.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,I.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function Ie({t:e}){let t=Pe(e);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,I.jsx)(T,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,I.jsx)(`span`,{className:`text-[15px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,I.jsx)(te,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:Ne[e.status]||e.status||`Not written`}),t&&(0,I.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,I.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-3`,children:[(e.testFile||e.testName)&&(0,I.jsx)(X,{label:`Test`,children:(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,I.jsx)(k,{path:e.testFile}),e.testName&&(0,I.jsx)(Fe,{name:e.testName})]})}),e.command&&(0,I.jsx)(X,{label:`Run it`,children:(0,I.jsx)(Z,{text:e.command})}),e.review&&(0,I.jsx)(X,{label:e.review.approved?`Review`:`Review asked`,children:(0,I.jsx)(R,{review:e.review})}),e.runDir&&(0,I.jsx)(X,{label:`From the run`,children:(0,I.jsx)(k,{path:e.runDir})}),e.reused.length>0&&(0,I.jsx)(X,{label:`Reused`,children:(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,I.jsx)(`li`,{className:`min-w-0`,children:(0,I.jsx)(k,{path:e})},e))})})]}),e.error&&(0,I.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function Le({c:e}){let[n,r]=(0,F.useState)(!1);return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":`${n?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>r(!n),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,I.jsx)(E,{size:15,"aria-hidden":`true`,className:S(`transition-transform`,!n&&`-rotate-90`)})}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,I.jsx)(k,{path:e.path})}),(0,I.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,I.jsx)(t,{open:n,children:(0,I.jsx)(L,{diff:e.diff,className:`mb-2 ml-9`})})]})}function Re({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,I.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,I.jsx)(Ie,{t:e},t)),t.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,I.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,I.jsx)(k,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-3`),children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,I.jsx)(he,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,I.jsxs)(`span`,{className:`font-normal text-muted`,children:[y(e.changes.length+r.length,`file`),e.changes.length>0&&(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,I.jsx)(Le,{c:e},e.path)),r.map(e=>(0,I.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,I.jsx)(k,{path:e})},e))]})]})]})}var Q={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 ze({line:e,start:t}){let[n,r]=(0,F.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,I.jsxs)(`li`,{className:`mt-3 flex items-baseline gap-3 border-b border-line-soft pb-1 first:mt-0`,children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:N(t,e.at)}),(0,I.jsx)(O,{text:e.md,className:`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`})]}):(0,I.jsxs)(`li`,{className:S(`flex items-baseline gap-3 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:N(t,e.at)}),e.kind===`out`?(0,I.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,I.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:S(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,I.jsx)(O,{text:e.md,className:S(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[12px] [&_p]:my-0`,Q[e.tone],i&&!n&&`line-clamp-2`)})})]})}function $({lines:t,start:n,live:r,name:i,timeline:a=!1}){let o=(0,F.useRef)(null),c=(0,F.useRef)(!0),[l,u]=(0,F.useState)(!1),d=(0,F.useMemo)(()=>j(t,n),[t,n]);(0,F.useEffect)(()=>{c.current&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[d]);let f=`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[12px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,I.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[12px] text-muted`,children:[(0,I.jsxs)(`span`,{className:`flex-1`,children:[a?``:`Markdown · `,t.length,` event`,t.length===1?``:`s`,r&&` · live`]}),(0,I.jsxs)(`button`,{type:`button`,"aria-label":l?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(d),u(!0),setTimeout(()=>u(!1),1500)}catch{}},className:f,children:[l?(0,I.jsx)(p,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(s,{size:14,"aria-hidden":`true`}),l?`Copied`:`Copy`]}),(0,I.jsxs)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([d],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=i,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:f,children:[(0,I.jsx)(x,{icon:e,size:14}),`.md`]})]}),(0,I.jsx)(`div`,{ref:o,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;c.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:S(`overflow-y-auto py-2`,a?`max-h-[calc(var(--screen)-260px)] min-h-[320px]`:`max-h-[360px] border-b border-line-soft`),children:a?(0,I.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:t.map((e,t)=>(0,I.jsx)(ze,{line:e,start:n},t))}):(0,I.jsx)(O,{text:d,className:`text-[13px] leading-[1.6] [&_code]:text-[12px] [&_h4]:mt-3 [&_h4]:mb-1 [&_li]:my-0.5 [&_pre]:text-[12px] [&_ul]:my-1`})})]})}function Be({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-3`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(ue,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,I.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,I.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,I.jsx)(w,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,I.jsx)(w,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:`Cancel`})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function Ve({wait:e,live:t,onProceed:n}){let r=t&&e.answer===void 0;return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-3`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(ce,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),r?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(w,{size:`sm`,variant:`primary`,onClick:()=>n(!0),children:`Done, continue`}),(0,I.jsx)(w,{size:`sm`,onClick:()=>n(!1),children:`Cancel`})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function He({turn:e,live:n,onAnswer:r,onProceed:i}){let a=n&&!e.outcome,[s,c]=(0,F.useState)(null),u=s??a,d=P(e),f=a?d.text:A(e),p=e.parts.map(e=>ye(e.text)).filter(Boolean),[m,h]=(0,F.useState)(!1),g=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,I.jsxs)(`div`,{className:`flex gap-3`,children:[(0,I.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,I.jsx)(o,{agent:`forgeqe`,px:34,working:a,className:`mt-0.5`})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 pt-1.5`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":u,disabled:!e.steps.length&&!e.plan.length,onClick:()=>c(!u),className:S(`flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,I.jsx)(`span`,{"aria-live":`polite`,children:f}),(e.steps.length>0||e.plan.length>0)&&(0,I.jsx)(E,{size:16,"aria-hidden":`true`,className:S(`transition-transform`,u&&`rotate-180`)})]}),e.log.length>0&&(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":m,onClick:()=>h(!m),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,I.jsx)(x,{icon:l,size:14}),`Activity log`,(0,I.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,I.jsx)(t,{open:(u||a)&&(e.steps.length>0||e.plan.length>0||a),children:(0,I.jsx)(Me,{turn:e,working:a,folded:!u,live:{...d,latest:g,events:e.log.length,onLog:()=>h(!0)}})}),(0,I.jsx)(t,{open:m,children:(0,I.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,I.jsx)(Be,{ask:e,live:a,onAnswer:t=>r(e.id,t)},e.id)),e.waits.map(e=>(0,I.jsx)(Ve,{wait:e,live:a,onProceed:t=>i(e.id,t)},e.id)),e.outcome&&e.reply?(0,I.jsx)(O,{text:e.reply}):p.length>0&&(0,I.jsx)(O,{text:p.join(`
3
3
 
4
4
  `)}),(0,I.jsx)(Re,{turn:e}),e.error&&(0,I.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,I.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{L as i,He as n,Z as r,$ as t};
@@ -1 +1 @@
1
- import{$i as e,An as t,At as n,In as r,Nt as i,ct as a,ga as o,ha as s,ho as c,ka as l,kt as u,ma as d,po as f,pt as p,r as m,ri as h,ro as g,t as _,vo as v,vt as y,wn as b,yt as x}from"./frame-CMf4LDd4.js";import{r as S}from"./index-BD3iUT-3.js";import{t as C}from"./segmented-E7E9vDxH.js";import{r as w}from"./families-BGu6Jt7k.js";import{_ as T,o as E}from"./qualityParts-CFjfNmrS.js";var D=v(c(),1),O=f(),k={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.`}},A=e=>`${(e/1e3).toFixed(1)}s`,j=e=>`${e.goal.slice(0,80)} · ${e.status} · ${S(e.at)}`;function M(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 N({run:e,step:t}){let[n,r]=(0,D.useState)(``),[i,a]=(0,D.useState)(!1);return(0,D.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&g.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,O.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`No screenshot`}):n?(0,O.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,O.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,O.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`Not in this run`})}function P({step:e,other:n}){if(!e)return(0,O.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`Not in this run`});let i=e.ok?t:r,a=new Set((n?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),s=n?e.calls.filter(e=>!a.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,O.jsx)(i,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:o(`mt-0.5 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,O.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,O.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${A(e.ms)}`:``]}),e.error&&(0,O.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:e.error}),s.slice(0,3).map(e=>(0,O.jsxs)(`span`,{className:o(`truncate font-mono text-[12px]`,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,O.jsx)(`span`,{className:`truncate text-[12px] text-warn`,"data-tip":e,children:e},e))]})}function F({row:e,i:t,a:r,b:i,focus:a,open:s,onToggle:c}){let l=e.a?.n,u=e.b?.n;return(0,O.jsxs)(`li`,{id:a?`look-here`:void 0,className:o(`border-t border-line-soft`,!e.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-3 px-3 py-2 text-[13px]`,children:[(0,O.jsx)(`span`,{className:`pt-0.5 text-muted tabular-nums`,"data-tip":l!==void 0&&u!==void 0&&l!==u?`Step ${l} of the first run, ${u} of the second`:void 0,children:l!==void 0&&u!==void 0&&l!==u?`${l}·${u}`:l??u??t+1}),(0,O.jsx)(P,{step:e.a,other:e.b}),(0,O.jsx)(P,{step:e.b,other:e.a}),(0,O.jsx)(d,{size:`sm`,variant:`icon`,"aria-label":s?`Hide screenshots`:`Show screenshots`,"aria-expanded":s,onClick:c,"data-tip":`Screenshots`,children:(0,O.jsx)(b,{"aria-hidden":`true`,className:o(`transition-transform`,s&&`rotate-180`)})})]}),!e.same&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-3 pb-2 pl-[3.75rem] text-[12.5px] text-ink-2`,children:[a&&e.kind&&(0,O.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,k[e.kind].label]}),e.differences.map(e=>(0,O.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,O.jsx)(n,{open:s,children:(0,O.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-3 px-3 pb-3 @2xl:grid-cols-2`,children:[(0,O.jsx)(N,{run:r,step:e.a}),(0,O.jsx)(N,{run:i,step:e.b})]})})]})}function I({runs:e,a:t,b:n}){let[r,a]=(0,D.useState)(t??``),[o,s]=(0,D.useState)(n??``);(0,D.useEffect)(()=>{a(t??``),s(n??``)},[t,n]);let{same:c,other:l}=M(e,r);return(0,O.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&o&&r!==o&&(location.hash=i(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(o)}`))},children:[(0,O.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,O.jsxs)(p,{size:`sm`,value:r,onChange:e=>a(e.target.value),children:[(0,O.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,O.jsx)(`option`,{value:e.id,children:j(e)},e.id))]})]}),(0,O.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,O.jsxs)(p,{size:`sm`,value:o,onChange:e=>s(e.target.value),disabled:!r,children:[(0,O.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),c.length>0&&(0,O.jsx)(`optgroup`,{label:`Same test`,children:c.map(e=>(0,O.jsx)(`option`,{value:e.id,children:j(e)},e.id))}),(0,O.jsx)(`optgroup`,{label:c.length?`Other runs`:`Runs`,children:l.map(e=>(0,O.jsx)(`option`,{value:e.id,children:j(e)},e.id))})]})]}),(0,O.jsx)(d,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!o||r===o,children:`Compare`})]})}function L({sub:t}){let[n,r]=(0,D.useState)(null),[c,f]=(0,D.useState)(null),[p,v]=(0,D.useState)(``),[b,S]=(0,D.useState)(`all`),[j,M]=(0,D.useState)(new Set),[N,P]=(0,D.useState)(``),[L,R]=(0,D.useMemo)(()=>{let e=(t?decodeURIComponent(t):``).split(`~`);return e.length===2&&e[0]&&e[1]?[e[0],e[1]]:[void 0,void 0]},[t]);(0,D.useEffect)(()=>{g.runs().then(e=>r(e.runs),e=>v(e.message))},[]),(0,D.useEffect)(()=>{let e=!1;if(f(null),P(``),L&&R)return g.diff(L,R).then(t=>{e||(f(t),v(``),M(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&v(t.message)),()=>{e=!0}},[L,R]);let z=async()=>{if(c)try{let{id:e}=await l.start(`Compare the browser runs ${c.a.id} and ${c.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=i(`chats`,e)}catch(e){P(e.message)}},B=c?.rows??[],V=B.map((e,t)=>({r:e,i:t})).filter(({r:e})=>b===`all`||!e.same),H=e=>e===void 0?void 0:B[e]?.b?.n??B[e]?.a?.n,U=H(c?.first),W=H(c?.focus);return(0,O.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,O.jsx)(m,{}),(0,O.jsxs)(`main`,{className:o(_,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(u,{pixel:x[`run-diff`],size:`lg`}),(0,O.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,O.jsx)(C,{label:`Runs and reports`,links:w,current:`run-diff`})]}),(0,O.jsx)(`p`,{className:`m-0 max-w-[80ch] 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.`}),p&&(0,O.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),!n&&!p&&(0,O.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),n&&n.length<2&&(0,O.jsx)(y,{icon:e,title:`Two runs are needed`,action:(0,O.jsx)(`a`,{className:s({size:`sm`}),href:i(`record`),children:`Record a flow`}),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.`}),n&&n.length>=2&&(0,O.jsx)(I,{runs:n,a:L,b:R}),L&&R&&!c&&!p&&(0,O.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),c&&(0,O.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-3`,children:[(0,O.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,O.jsx)(E,{label:`Verdict`,value:c.first===void 0?`Same`:`Differ`,tone:c.first===void 0?`text-pass`:`text-warn`,sub:c.first===void 0?`every step alike`:`from step ${U??`?`}`}),(0,O.jsx)(E,{label:`Steps differing`,value:c.counts.differing,tone:c.counts.differing?`text-warn`:void 0,sub:`of ${B.length} lined up`}),(0,O.jsx)(E,{label:`Steps`,value:`${c.a.steps} · ${c.b.steps}`,sub:`first · second`}),(0,O.jsx)(E,{label:`Time`,value:`${A(c.a.ms)} · ${A(c.b.ms)}`,sub:`first · second`}),(0,O.jsx)(E,{label:`Calls answered otherwise`,value:c.counts.calls,tone:c.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,O.jsx)(E,{label:`New browser errors`,value:c.counts.errors,tone:c.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[c.a,c.b].map((e,t)=>(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,O.jsx)(`span`,{className:`text-[12px] text-muted`,children:t?`Second run`:`First run`}),(0,O.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,O.jsxs)(`span`,{className:`truncate text-[12.5px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,T(e.at),` · `,e.host??e.id]})]},e.id))}),!c.sameGoal&&(0,O.jsx)(`p`,{className:`m-0 text-[12.5px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),c.kind&&(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 rounded-[12px] bg-warn-soft px-3 py-2.5 text-[13px]`,children:[(0,O.jsx)(e,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-warn`}),(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5`,children:[(0,O.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,W??`?`,` of the second run: `,k[c.kind].label]}),(0,O.jsx)(`span`,{className:`text-ink-2`,children:k[c.kind].hint}),c.first!==c.focus&&c.first!==void 0&&B[c.first]?.kind&&(0,O.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,U,`: `,k[B[c.first].kind].label.toLowerCase(),`.`]})]}),(0,O.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,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,O.jsx)(a,{items:[{id:`all`,label:`All steps`,n:B.length},{id:`diff`,label:`Only differences`,n:c.counts.differing,alert:!0}],value:b,onChange:S})}),(0,O.jsxs)(d,{size:`sm`,variant:`ghost`,onClick:()=>void z(),className:`ml-auto`,children:[(0,O.jsx)(h,{"aria-hidden":`true`}),`Ask in a chat`]})]}),N&&(0,O.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:N}),(0,O.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-3 bg-surface-muted px-3 py-1.5 text-[11.5px] text-muted`,children:[(0,O.jsx)(`span`,{children:`Step`}),(0,O.jsx)(`span`,{children:`First run`}),(0,O.jsx)(`span`,{children:`Second run`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),V.length?(0,O.jsx)(`ol`,{className:`m-0 list-none p-0`,children:V.map(({r:e,i:t})=>(0,O.jsx)(F,{row:e,i:t,a:c.a.id,b:c.b.id,focus:t===c.focus,open:j.has(t),onToggle:()=>{let e=new Set(j);e.has(t)?e.delete(t):e.add(t),M(e)}},t))}):(0,O.jsx)(`p`,{className:`m-0 border-t border-line-soft px-3 py-3 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{k as KIND_TEXT,L as RunDiff,M as choicesFor};
1
+ import{$i as e,An as t,At as n,In as r,Nt as i,ct as a,ga as o,ha as s,ho as c,ka as l,kt as u,ma as d,po as f,pt as p,r as m,ri as h,ro as g,t as _,vo as v,vt as y,wn as b,yt as x}from"./frame-COPwycC2.js";import{r as S}from"./index-gt34hBeA.js";import{t as C}from"./segmented-DDPlHkHh.js";import{r as w}from"./families-BxOkkDeO.js";import{_ as T,o as E}from"./qualityParts-DANtbDfW.js";var D=v(c(),1),O=f(),k={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.`}},A=e=>`${(e/1e3).toFixed(1)}s`,j=e=>`${e.goal.slice(0,80)} · ${e.status} · ${S(e.at)}`;function M(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 N({run:e,step:t}){let[n,r]=(0,D.useState)(``),[i,a]=(0,D.useState)(!1);return(0,D.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&g.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,O.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`No screenshot`}):n?(0,O.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,O.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,O.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`Not in this run`})}function P({step:e,other:n}){if(!e)return(0,O.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`Not in this run`});let i=e.ok?t:r,a=new Set((n?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),s=n?e.calls.filter(e=>!a.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,O.jsx)(i,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:o(`mt-0.5 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,O.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,O.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${A(e.ms)}`:``]}),e.error&&(0,O.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:e.error}),s.slice(0,3).map(e=>(0,O.jsxs)(`span`,{className:o(`truncate font-mono text-[12px]`,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,O.jsx)(`span`,{className:`truncate text-[12px] text-warn`,"data-tip":e,children:e},e))]})}function F({row:e,i:t,a:r,b:i,focus:a,open:s,onToggle:c}){let l=e.a?.n,u=e.b?.n;return(0,O.jsxs)(`li`,{id:a?`look-here`:void 0,className:o(`border-t border-line-soft`,!e.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-3 px-3 py-2 text-[13px]`,children:[(0,O.jsx)(`span`,{className:`pt-0.5 text-muted tabular-nums`,"data-tip":l!==void 0&&u!==void 0&&l!==u?`Step ${l} of the first run, ${u} of the second`:void 0,children:l!==void 0&&u!==void 0&&l!==u?`${l}·${u}`:l??u??t+1}),(0,O.jsx)(P,{step:e.a,other:e.b}),(0,O.jsx)(P,{step:e.b,other:e.a}),(0,O.jsx)(d,{size:`sm`,variant:`icon`,"aria-label":s?`Hide screenshots`:`Show screenshots`,"aria-expanded":s,onClick:c,"data-tip":`Screenshots`,children:(0,O.jsx)(b,{"aria-hidden":`true`,className:o(`transition-transform`,s&&`rotate-180`)})})]}),!e.same&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-3 pb-2 pl-[3.75rem] text-[12.5px] text-ink-2`,children:[a&&e.kind&&(0,O.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,k[e.kind].label]}),e.differences.map(e=>(0,O.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,O.jsx)(n,{open:s,children:(0,O.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-3 px-3 pb-3 @2xl:grid-cols-2`,children:[(0,O.jsx)(N,{run:r,step:e.a}),(0,O.jsx)(N,{run:i,step:e.b})]})})]})}function I({runs:e,a:t,b:n}){let[r,a]=(0,D.useState)(t??``),[o,s]=(0,D.useState)(n??``);(0,D.useEffect)(()=>{a(t??``),s(n??``)},[t,n]);let{same:c,other:l}=M(e,r);return(0,O.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&o&&r!==o&&(location.hash=i(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(o)}`))},children:[(0,O.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,O.jsxs)(p,{size:`sm`,value:r,onChange:e=>a(e.target.value),children:[(0,O.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,O.jsx)(`option`,{value:e.id,children:j(e)},e.id))]})]}),(0,O.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,O.jsxs)(p,{size:`sm`,value:o,onChange:e=>s(e.target.value),disabled:!r,children:[(0,O.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),c.length>0&&(0,O.jsx)(`optgroup`,{label:`Same test`,children:c.map(e=>(0,O.jsx)(`option`,{value:e.id,children:j(e)},e.id))}),(0,O.jsx)(`optgroup`,{label:c.length?`Other runs`:`Runs`,children:l.map(e=>(0,O.jsx)(`option`,{value:e.id,children:j(e)},e.id))})]})]}),(0,O.jsx)(d,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!o||r===o,children:`Compare`})]})}function L({sub:t}){let[n,r]=(0,D.useState)(null),[c,f]=(0,D.useState)(null),[p,v]=(0,D.useState)(``),[b,S]=(0,D.useState)(`all`),[j,M]=(0,D.useState)(new Set),[N,P]=(0,D.useState)(``),[L,R]=(0,D.useMemo)(()=>{let e=(t?decodeURIComponent(t):``).split(`~`);return e.length===2&&e[0]&&e[1]?[e[0],e[1]]:[void 0,void 0]},[t]);(0,D.useEffect)(()=>{g.runs().then(e=>r(e.runs),e=>v(e.message))},[]),(0,D.useEffect)(()=>{let e=!1;if(f(null),P(``),L&&R)return g.diff(L,R).then(t=>{e||(f(t),v(``),M(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&v(t.message)),()=>{e=!0}},[L,R]);let z=async()=>{if(c)try{let{id:e}=await l.start(`Compare the browser runs ${c.a.id} and ${c.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=i(`chats`,e)}catch(e){P(e.message)}},B=c?.rows??[],V=B.map((e,t)=>({r:e,i:t})).filter(({r:e})=>b===`all`||!e.same),H=e=>e===void 0?void 0:B[e]?.b?.n??B[e]?.a?.n,U=H(c?.first),W=H(c?.focus);return(0,O.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,O.jsx)(m,{}),(0,O.jsxs)(`main`,{className:o(_,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(u,{pixel:x[`run-diff`],size:`lg`}),(0,O.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,O.jsx)(C,{label:`Runs and reports`,links:w,current:`run-diff`})]}),(0,O.jsx)(`p`,{className:`m-0 max-w-[80ch] 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.`}),p&&(0,O.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),!n&&!p&&(0,O.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),n&&n.length<2&&(0,O.jsx)(y,{icon:e,title:`Two runs are needed`,action:(0,O.jsx)(`a`,{className:s({size:`sm`}),href:i(`record`),children:`Record a flow`}),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.`}),n&&n.length>=2&&(0,O.jsx)(I,{runs:n,a:L,b:R}),L&&R&&!c&&!p&&(0,O.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),c&&(0,O.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-3`,children:[(0,O.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,O.jsx)(E,{label:`Verdict`,value:c.first===void 0?`Same`:`Differ`,tone:c.first===void 0?`text-pass`:`text-warn`,sub:c.first===void 0?`every step alike`:`from step ${U??`?`}`}),(0,O.jsx)(E,{label:`Steps differing`,value:c.counts.differing,tone:c.counts.differing?`text-warn`:void 0,sub:`of ${B.length} lined up`}),(0,O.jsx)(E,{label:`Steps`,value:`${c.a.steps} · ${c.b.steps}`,sub:`first · second`}),(0,O.jsx)(E,{label:`Time`,value:`${A(c.a.ms)} · ${A(c.b.ms)}`,sub:`first · second`}),(0,O.jsx)(E,{label:`Calls answered otherwise`,value:c.counts.calls,tone:c.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,O.jsx)(E,{label:`New browser errors`,value:c.counts.errors,tone:c.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[c.a,c.b].map((e,t)=>(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,O.jsx)(`span`,{className:`text-[12px] text-muted`,children:t?`Second run`:`First run`}),(0,O.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,O.jsxs)(`span`,{className:`truncate text-[12.5px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,T(e.at),` · `,e.host??e.id]})]},e.id))}),!c.sameGoal&&(0,O.jsx)(`p`,{className:`m-0 text-[12.5px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),c.kind&&(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 rounded-[12px] bg-warn-soft px-3 py-2.5 text-[13px]`,children:[(0,O.jsx)(e,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-warn`}),(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5`,children:[(0,O.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,W??`?`,` of the second run: `,k[c.kind].label]}),(0,O.jsx)(`span`,{className:`text-ink-2`,children:k[c.kind].hint}),c.first!==c.focus&&c.first!==void 0&&B[c.first]?.kind&&(0,O.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,U,`: `,k[B[c.first].kind].label.toLowerCase(),`.`]})]}),(0,O.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,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,O.jsx)(a,{items:[{id:`all`,label:`All steps`,n:B.length},{id:`diff`,label:`Only differences`,n:c.counts.differing,alert:!0}],value:b,onChange:S})}),(0,O.jsxs)(d,{size:`sm`,variant:`ghost`,onClick:()=>void z(),className:`ml-auto`,children:[(0,O.jsx)(h,{"aria-hidden":`true`}),`Ask in a chat`]})]}),N&&(0,O.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:N}),(0,O.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-3 bg-surface-muted px-3 py-1.5 text-[11.5px] text-muted`,children:[(0,O.jsx)(`span`,{children:`Step`}),(0,O.jsx)(`span`,{children:`First run`}),(0,O.jsx)(`span`,{children:`Second run`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),V.length?(0,O.jsx)(`ol`,{className:`m-0 list-none p-0`,children:V.map(({r:e,i:t})=>(0,O.jsx)(F,{row:e,i:t,a:c.a.id,b:c.b.id,focus:t===c.focus,open:j.has(t),onToggle:()=>{let e=new Set(j);e.has(t)?e.delete(t):e.add(t),M(e)}},t))}):(0,O.jsx)(`p`,{className:`m-0 border-t border-line-soft px-3 py-3 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{k as KIND_TEXT,L as RunDiff,M as choicesFor};
@@ -1,2 +1,2 @@
1
- import{An as e,At as t,B as n,Ci as r,Dr as i,Dt as a,En as o,Gt as s,Hn as c,In as l,Kr as u,Li as d,Mr as f,Nt as p,Qr as m,Ui as h,_a as g,_n as _,_t as v,an as ee,ct as y,da as b,dt as x,en as S,fn as C,ga as w,gr as T,ha as E,ho as D,io as O,ir as k,jn as A,jt as j,ka as te,ki as M,kt as N,lt as ne,ma as P,nr as re,oa as ie,po as ae,pt as oe,qi as se,r as ce,ri as le,t as ue,vo as de,vr as F,vt as fe,xi as pe,yn as me,yt as he,zi as ge}from"./frame-CMf4LDd4.js";import{c as I,i as L,r as _e,s as R}from"./index-BD3iUT-3.js";import{r as ve,t as ye}from"./Response-DG1lcsGu.js";import{i as be,r as xe,t as Se}from"./segmented-E7E9vDxH.js";import{a as Ce,c as we}from"./thread-VaEnkSAe.js";import{r as Te}from"./families-BGu6Jt7k.js";var z=de(D(),1),B=ae(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Ee={execution:F,report:k,coding:c,chat:le};function De({kind:e}){let t=Ee[e];return(0,B.jsx)(S,{icon:t,size:14,className:`flex-none text-muted`})}var Oe={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=>Oe[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},ke={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Ae=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}){return(0,B.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-line-soft pt-6 first:border-t-0 first:pt-0`,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 je({path:e,label:t=`Open 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)(P,{onClick:async()=>r(await j(e)),children:[(0,B.jsx)(re,{"aria-hidden":`true`}),t]}),n&&(0,B.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Me({items:e,first:t,render:n}){let[r,i]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,B.jsx)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:r?`Show fewer`:`Show all ${e.length}`})]})}function Ne({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 Pe({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-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:[ke[e.scope]||e.scope,Ae(e.ms),e.tokens?`${n(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,B.jsx)(je,{path:e.report})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(v,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(v,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(v,{tone:`warn`,children:[e.counts.other,` other`]}),(0,B.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,B.jsx)(Ne,{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)(Me,{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-3 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(v,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] 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:Ae(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,B.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,B.jsx)(R,{path:e.folder})]})]})}function Fe({list:e}){let t=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,{title:`Execution summary`,icon:(0,B.jsx)(S,{icon:F,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[g(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,B.jsx)(Pe,{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 Ie({list:e}){return(0,B.jsxs)(U,{title:`Report summary`,icon:(0,B.jsx)(S,{icon:k,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-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,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)(je,{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-3 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,B.jsx)(Le,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function Le({text:e,height:t=220}){let[n,r]=(0,z.useState)(!1),[i,o]=(0,z.useState)(!0),[s,c]=(0,z.useState)(t),l=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{l.current&&!n&&o(l.current.scrollHeight>t+8)},[e,t,n]),(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&&n&&c(void 0),className:w(`transition-[max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)]`,s!==void 0&&`relative overflow-hidden`),children:[(0,B.jsx)(I,{text:e,className:`text-sm`}),!n&&i&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,B.jsx)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=l.current?.scrollHeight??t;if(r(!n),a())return c(n?t:void 0);c(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>c(t)))},className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:n?`Show less`:`Show all of it`})]})}function Re(e){let t=e.join(`
1
+ import{An as e,At as t,B as n,Ci as r,Dr as i,Dt as a,En as o,Gt as s,Hn as c,In as l,Kr as u,Li as d,Mr as f,Nt as p,Qr as m,Ui as h,_a as g,_n as _,_t as v,an as ee,ct as y,da as b,dt as x,en as S,fn as C,ga as w,gr as T,ha as E,ho as D,io as O,ir as k,jn as A,jt as j,ka as te,ki as M,kt as N,lt as ne,ma as P,nr as re,oa as ie,po as ae,pt as oe,qi as se,r as ce,ri as le,t as ue,vo as de,vr as F,vt as fe,xi as pe,yn as me,yt as he,zi as ge}from"./frame-COPwycC2.js";import{c as I,i as L,r as _e,s as R}from"./index-gt34hBeA.js";import{r as ve,t as ye}from"./Response-BrqXtc8W.js";import{i as be,r as xe,t as Se}from"./segmented-DDPlHkHh.js";import{a as Ce,c as we}from"./thread-JBXELgnl.js";import{r as Te}from"./families-BxOkkDeO.js";var z=de(D(),1),B=ae(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Ee={execution:F,report:k,coding:c,chat:le};function De({kind:e}){let t=Ee[e];return(0,B.jsx)(S,{icon:t,size:14,className:`flex-none text-muted`})}var Oe={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=>Oe[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},ke={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Ae=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}){return(0,B.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-line-soft pt-6 first:border-t-0 first:pt-0`,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 je({path:e,label:t=`Open 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)(P,{onClick:async()=>r(await j(e)),children:[(0,B.jsx)(re,{"aria-hidden":`true`}),t]}),n&&(0,B.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Me({items:e,first:t,render:n}){let[r,i]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,B.jsx)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:r?`Show fewer`:`Show all ${e.length}`})]})}function Ne({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 Pe({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-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:[ke[e.scope]||e.scope,Ae(e.ms),e.tokens?`${n(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,B.jsx)(je,{path:e.report})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(v,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(v,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(v,{tone:`warn`,children:[e.counts.other,` other`]}),(0,B.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,B.jsx)(Ne,{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)(Me,{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-3 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(v,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] 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:Ae(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,B.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,B.jsx)(R,{path:e.folder})]})]})}function Fe({list:e}){let t=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,{title:`Execution summary`,icon:(0,B.jsx)(S,{icon:F,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[g(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,B.jsx)(Pe,{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 Ie({list:e}){return(0,B.jsxs)(U,{title:`Report summary`,icon:(0,B.jsx)(S,{icon:k,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-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,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)(je,{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-3 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,B.jsx)(Le,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function Le({text:e,height:t=220}){let[n,r]=(0,z.useState)(!1),[i,o]=(0,z.useState)(!0),[s,c]=(0,z.useState)(t),l=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{l.current&&!n&&o(l.current.scrollHeight>t+8)},[e,t,n]),(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&&n&&c(void 0),className:w(`transition-[max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)]`,s!==void 0&&`relative overflow-hidden`),children:[(0,B.jsx)(I,{text:e,className:`text-sm`}),!n&&i&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,B.jsx)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=l.current?.scrollHeight??t;if(r(!n),a())return c(n?t:void 0);c(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>c(t)))},className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:n?`Show less`:`Show all of it`})]})}function Re(e){let t=e.join(`
2
2
  `),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function ze({e}){let[n,r]=(0,z.useState)(!1),i=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-1.5 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":`${n?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>r(!n),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)(o,{size:16,"aria-hidden":`true`,className:w(`transition-transform duration-200`,n&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:i}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(R,{path:e.path})}),(0,B.jsxs)(`span`,{className:`flex-none font-mono text-[12px] 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)(t,{open:n,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,B.jsx)(I,{text:Re(e.diffs)}):null})]})}var Be={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function W({label:e,children:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,B.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ve({c:e,files:t}){let n=e.edits.reduce((e,t)=>e+t.added,0),r=e.edits.reduce((e,t)=>e+t.removed,0),i=e.tests.filter(e=>!e.ok).length,a=e.reviews.at(-1),o=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,B.jsxs)(U,{title:`Code changes`,icon:(0,B.jsx)(S,{icon:c,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[g(e.edits.length,`file`),` · `,(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,n]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,r]})]}):o.length?(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:g(o.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,o=t.status===`error`||t.status===`failed`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 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)(F,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:o?`text-fail`:`text-warn`}),(0,B.jsx)(`span`,{className:`text-[15px] font-semibold`,children:r?`Test written`:o?`Test not finished`:H(t.status).label}),(0,B.jsx)(v,{tone:r?`pass`:o?`fail`:`warn`,children:H(t.status).label}),e.tests.length>0&&(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[g(e.tests.length,`test run`),i?` (${i} failed)`:``,e.reviews.length?` · ${g(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-3`,children:[t.testFile&&(0,B.jsx)(W,{label:`Test`,children:(0,B.jsx)(R,{path:t.testFile})}),t.command&&(0,B.jsx)(W,{label:`Run it`,children:(0,B.jsx)(ve,{text:t.command})}),(t.review||a)&&(0,B.jsx)(W,{label:`Review`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(v,{tone:(t.review??a).approved?`pass`:`warn`,children:(t.review??a).approved?`Approved`:`Changes asked`})}),(t.review?.summary||a?.summary)&&(0,B.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||a?.summary})]})}),t.notes&&(0,B.jsx)(W,{label:`Notes`,children:(0,B.jsx)(I,{text:t.notes,className:`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`})})]}),t.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 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)(Me,{items:e.edits,first:8,render:e=>(0,B.jsx)(ze,{e},e.path)})})]}),o.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:o.map(e=>(0,B.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-3 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:Be[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)(R,{path:e.path})})]},e.path))}),(0,B.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!o.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 He({final:e,answer:t}){let n=e.from===`agent`?t?.files??[]:[],r=e.from!==`agent`,i=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),a="`".repeat(i+1);return(0,B.jsxs)(U,{title:`Final message`,icon:(0,B.jsx)(T,{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)(Le,{text:r?`${a}text\n${e.text}\n${a}`:we(e.text),height:420}),n.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:`}),n.map(e=>(0,B.jsx)(R,{path:e},e))]})]})}var Ue={rule:{icon:C,label:`Rulebook`},decision:{icon:i,label:`Test decisions`},memory:{icon:_,label:`Page memory`},replay:{icon:pe,label:`Replays`},model:{icon:d,label:`Model`},skill:{icon:f,label:`Skills`}};function We({list:e}){let t=Object.keys(Ue).filter(t=>e.some(e=>e.kind===t));return(0,B.jsx)(U,{title:`Learnings`,icon:(0,B.jsx)(S,{icon:u,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-3`,children:t.map(t=>{let{icon:n,label:r}=Ue[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-1.5 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(S,{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-0.5 border-t border-line-soft py-1.5 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 Ge({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,B.jsx)(Fe,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,B.jsx)(Ie,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,B.jsx)(Ve,{c:e.coding,files:e.files},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,B.jsx)(B.Fragment,{children:t.map(e=>e.node)})}var Ke={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},qe={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`},Je=e=>qe[e]||e.charAt(0).toUpperCase()+e.slice(1),G=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},K=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),q=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`:`–`,J=e=>e.usage.input+e.usage.output;function Y(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 Ye({r:e}){return e.origin.kind===`web`?(0,B.jsxs)(`a`,{href:p(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(S,{icon:le,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-1.5`,children:[(0,B.jsx)(S,{icon:me,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,B.jsx)(S,{icon:se,size:14}),`Terminal`]})}function Xe({status:t}){let n=Ke[t].label;return t===`running`?(0,B.jsx)(m,{size:16,"aria-label":n,className:`flex-none animate-spin text-accent-fg`}):t===`done`?(0,B.jsx)(e,{size:16,"aria-label":n,className:`flex-none text-pass`}):t===`failed`?(0,B.jsx)(l,{size:16,"aria-label":n,className:`flex-none text-fail`}):(0,B.jsx)(A,{size:16,"aria-label":n,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!J(e)&&!e.files.length&&!e.outputs.length&&K(e,0)<2;function Ze(e){return/^forgeqe(-|$)|^engine$/.test(e)?s(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 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-[14px] font-semibold`,children:e}),t]})}var Qe={rerun:r,write_test:ie,investigate:M,fix_test:b};function $e({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 te.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)(P,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note||void 0,className:`max-w-full min-w-0`,children:[(0,B.jsx)(S,{icon:Qe[e.kind],size:16,className:`flex-none`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening a chat…`:e.label}),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-[12px] 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 et=e=>`\`${e.replace(/`/g,``)}\``,tt=[`summary`,`conversation`,`activity`,`details`],nt=e=>tt.find(t=>t===e)??`summary`;function rt({name:e,tab:t}){let[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),l=nt(t),u=t=>location.hash=t===`summary`?p(`runs`,encodeURIComponent(e)):p(`runs`,encodeURIComponent(e),t),d=(0,z.useCallback)(()=>{O.detail(e).then(e=>{i(e),o(``)},e=>o(e.message))},[e]);(0,z.useEffect)(d,[d]);let f=r?.status===`running`;(0,z.useEffect)(()=>{if(!f)return;let e=setInterval(d,2e3);return()=>clearInterval(e)},[d,f]);let m=Y(f),h=(0,z.useMemo)(()=>(r?.events??[]).map(Ce).filter(e=>!!e),[r?.events]),_=async()=>{c(!0),o(``);try{await O.cancel(e),d()}catch(e){o(e.message)}finally{c(!1)}},y=(0,B.jsxs)(`a`,{href:p(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,B.jsx)(ee,{size:16,"aria-hidden":`true`}),`All runs`]});if(!r)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[y,a?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:a}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let b=Ke[r.status],x=!r.replies.length,S=!!r.final||r.executions.length>0||r.reports.length>0||!!(r.coding&&(r.coding.edits.length||r.coding.results.length))||r.learnings.length>0||r.outputs.length>0,C=[{id:`summary`,label:`Summary`},{id:`conversation`,label:x?`Command`:`Conversation`,n:r.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],w=new Set([...r.reports.map(e=>e.path),...r.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),T=r.outputs.filter(e=>!w.has(e.path)),E=r.context?.limit?Math.round(r.context.tokens/r.context.limit*100):null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[y,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:r.title}),(0,B.jsx)(v,{tone:b.tone,children:b.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-1.5`,children:[(0,B.jsx)(De,{kind:r.kind}),V[r.kind]]}),`· `,(0,B.jsx)(Ye,{r}),`· `,G(r.startedAt),` · `,f?`running for `:`took `,q(K(r,m)),` · `,n(J(r)),` tokens`,r.profile?.model?` · ${r.profile.model}`:``]})]}),r.cancel&&(0,B.jsxs)(P,{variant:`danger`,disabled:s,onClick:()=>void _(),children:[(0,B.jsx)(ge,{fill:`currentColor`,"aria-hidden":`true`}),s?`Stopping…`:r.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`]})]}),a&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),r.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,r.error]}),!f&&(0,B.jsx)($e,{actions:r.actions??[]}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:xe,children:C.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":l===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>u(e.id),className:be(l===e.id),children:[e.label,e.n!==void 0&&(0,B.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${l}`,"aria-labelledby":`run-tab-${l}`,className:`flex min-w-0 flex-col gap-6`,children:[l===`summary`&&(0,B.jsxs)(B.Fragment,{children:[r.final&&(0,B.jsx)(He,{final:r.final,answer:r.answer}),(0,B.jsx)(Ge,{run:r}),T.length>0&&(0,B.jsx)(Q,{title:`What it produced (${T.length})`,children:T.map(e=>(0,B.jsx)(Z,{label:e.label,children:(0,B.jsx)(R,{path:e.path})},e.path))}),r.learnings.length>0&&(0,B.jsx)(We,{list:r.learnings}),!S&&(0,B.jsx)(fe,{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`&&(x?(0,B.jsx)(I,{text:et(r.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:r.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.5 text-sm max-w-[85%]`,children:(0,B.jsx)(I,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,B.jsx)(I,{text:we(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),l===`activity`&&(r.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 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)(ye,{timeline:!0,lines:h,start:r.startedAt,live:f,name:`forgeqe-run-${r.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),l===`details`&&(0,B.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-8 @3xl:grid-cols-2`,children:[(0,B.jsxs)(Q,{title:`Numbers`,children:[(0,B.jsx)(Z,{label:f?`Running for`:`Took`,children:q(K(r,m))}),(0,B.jsx)(Z,{label:`Tokens`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`span`,{children:[n(J(r)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,n(r.usage.input),` read · `,n(r.usage.output),` written`,r.usage.cached?` · ${n(r.usage.cached)} cached`:``]})]}),(r.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5 text-[13px]`,children:r.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:Ze(e.agent)}),(0,B.jsx)(`span`,{className:`text-muted tabular-nums`,children:n(e.input+e.output)})]},e.agent))})]})}),(0,B.jsxs)(Z,{label:`Context`,children:[r.context?n(r.context.tokens):`–`,E!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,n(r.context.limit),` (`,E,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[r.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,g(r.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(Ye,{r})}),(0,B.jsx)(Z,{label:`Command`,children:Je(r.command)}),(0,B.jsx)(Z,{label:`Model`,children:r.profile?[r.profile.name,r.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:r.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:r.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:Ze(e.name)}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:g(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[r.archived?(0,B.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,B.jsx)(R,{path:`.forgeqe/logs/${r.name}`}),r.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),r.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:p(`jobs`,encodeURIComponent(r.origin.kind===`job`?r.origin.job:r.job.name)),children:r.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(I,{text:et(r.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[r.job.schedule,!r.job.enabled&&` (disabled)`,r.job.nextAt&&r.job.enabled?` · next ${G(r.job.nextAt)}`:``]}),r.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[r.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,r.job.run.status.replace(`_`,` `),r.job.run.exitCode!==void 0&&r.job.run.exitCode!==null?`, exit ${r.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Files worked on (${r.files.length})`,children:r.files.length?[...r.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)).map(e=>(0,B.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action?e.action.charAt(0).toUpperCase()+e.action.slice(1):`Changed`,children:e.action===`delete`?(0,B.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,B.jsx)(R,{path:e.path})},e.path)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,B.jsx)(Q,{title:`Notifications`,children:r.notifications.length?r.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:r.origin.kind===`terminal`||r.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function it({runs:e}){let t=Y(e.some(e=>e.status===`running`)),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(`all`),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),[m,_]=(0,z.useState)(0);(0,z.useEffect)(()=>_(0),[r,a,s,l,d]);let v=e.filter(X).length,ee=r.toLowerCase().split(/\s+/).filter(Boolean),b=e.filter(e=>(d||!X(e))&&(!s||e.kind===s)&&(!l||e.origin.kind===l)&&ee.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),S={all:b.length,running:b.filter(e=>e.status===`running`).length,failed:b.filter(e=>e.status===`failed`).length},C=a===`all`?b:b.filter(e=>e.status===a),T=Math.max(1,Math.ceil(C.length/$)),D=Math.min(m,T-1),O=C.slice(D*$,D*$+$),k=e.filter(e=>e.status!==`running`&&!X(e)),A=k.filter(e=>e.status===`failed`).length,j=k.length?k.reduce((e,n)=>e+K(n,t),0)/k.length:NaN,te=e.reduce((e,t)=>e+J(t),0),M=[...new Set(e.map(e=>e.kind))],N=[...new Set(e.map(e=>e.origin.kind))],P={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,B.jsx)(fe,{icon:h,title:`No runs yet`,action:(0,B.jsx)(`a`,{className:E({size:`sm`}),href:p(),children:`Start a 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-3`,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-v}),` 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:w(`tabular-nums`,A?`text-fail`:`text-ink`),children:A}),` failed`,k.length?` (${Math.round(A/k.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:n(te)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:q(Math.round(j))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(x,{id:`run-search`,label:`Find a run`,value:r,onChange:i,placeholder:`Find a run by what was asked`}),(0,B.jsx)(y,{items:[{id:`all`,label:`All`,n:S.all},{id:`running`,label:`Running`,n:S.running},{id:`failed`,label:`Failed`,n:S.failed,alert:!0}],value:a,onChange:o}),M.length>1&&(0,B.jsxs)(oe,{size:`sm`,"aria-label":`What it did`,value:s,onChange:e=>c(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Any kind`}),M.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]}),N.length>1&&(0,B.jsxs)(oe,{size:`sm`,"aria-label":`Started by`,value:l,onChange:e=>u(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Started anywhere`}),N.map(e=>(0,B.jsx)(`option`,{value:e,children:P[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-[12px] 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-1.5`,children:[O.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),O.map((e,r)=>{let i=L(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(r===0||L(O[r-1].startedAt)!==i)&&(0,B.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:i}),(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-3 rounded-[10px] px-3 py-1.5 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)(Xe,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[V[e.kind],P[e.origin.kind],q(K(e,t)),`${n(J(e))} tokens`].join(` · `)})]}),(0,B.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,B.jsx)(De,{kind:e.kind}),V[e.kind]]}),(0,B.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:P[e.origin.kind]||e.origin.kind}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:q(K(e,t))}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:n(J(e))}),(0,B.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":G(e.startedAt),children:_e(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(ne,{page:D,size:$,total:C.length,onPage:_,label:`Pages of runs`,children:v>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(!d),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:d?`Hide the ${g(v,`empty session`)}`:`${g(v,`empty session`)} hidden`})]})})]})]})}function at({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{O.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?decodeURIComponent(s):``;return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(ce,{}),(0,B.jsx)(`main`,{className:w(ue,`@container flex-auto gap-4`),children:l?(0,B.jsx)(rt,{name:l,tab:c},l):(0,B.jsxs)(B.Fragment,{children:[(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-3`,children:[(0,B.jsx)(N,{pixel:he.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(Se,{label:`Runs and reports`,links:Te,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 max-w-[70ch] 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-3 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)(it,{runs:t})]})})]})}export{at as Runs,Xe as StatusIcon,nt as runTab};
@@ -1 +1 @@
1
- import{$i as e,Fr as t,Jr as n,Ln as r,Nt as i,Yr as a,ct as o,en as s,ft as c,ga as l,ho as u,it as d,kt as f,lo as p,ma as m,nr as h,nt as g,ot as _,po as v,r as y,t as b,tt as x,vo as S,vt as C,wa as w,yt as T}from"./frame-CMf4LDd4.js";import{d as E,r as D}from"./index-BD3iUT-3.js";var O=S(u(),1),k=v(),A=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],j=e=>A.some(t=>t.id===e),M=e=>e&&E(e)===`web`?e:void 0,N=(e,t)=>`${e} ${t}${e===1?``:`s`}`,P=e=>`${e.kind}:${e.id}`;function F(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${N((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function I(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 L(){let[e,t]=(0,O.useState)(A.map(e=>e.id)),[n,r]=(0,O.useState)(``);return(0,O.useEffect)(()=>{w.settings().then(e=>{let n=e.config.sources??{},r=A.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:A.filter(t=>e.includes(t.id)),error:n}}function R({id:e,icon:t,title:n,children:r}){return(0,k.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-3`,children:[(0,k.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,k.jsx)(s,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function z({view:i,onApplied:o,onError:s}){let[c,u]=(0,O.useState)([]),[f,v]=(0,O.useState)(null),[y,b]=(0,O.useState)(!1),[S,C]=(0,O.useState)(null),w=i.story.id,T=i.proposals.filter(e=>c.includes(P(e))),E=async()=>{let e=T.map(e=>I(e,w));b(!0);try{let t=await p.preview(i.system,w,e);v({lines:t.lines,changes:e}),s(``)}catch(e){s(e.message)}finally{b(!1)}},j=async()=>{if(f){b(!0);try{let e=await p.apply(i.system,w,f.changes);C({applied:e.applied,failed:e.failed}),v(null),u([]),s(``),o()}catch(e){s(e.message)}finally{b(!1)}}},L=M(i.story.url);return(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,k.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[L?(0,k.jsxs)(`a`,{href:L,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[w,(0,k.jsx)(h,{size:14,"aria-hidden":`true`})]}):(0,k.jsx)(`span`,{children:w}),i.story.title&&(0,k.jsx)(`span`,{className:`font-normal text-ink-2`,children:i.story.title})]}),i.changed&&(0,k.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(i.changed.when).toLocaleString(),children:[`The story's `,i.changed.field,` changed `,D(i.changed.when),`.`]})]}),(0,k.jsx)(R,{id:`cases-h`,icon:n,title:`Linked cases`,children:(0,k.jsx)(x,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:d,children:`Case`}),(0,k.jsx)(`th`,{className:d,children:`Title`}),(0,k.jsx)(`th`,{className:l(d,`text-right`),children:`Steps`}),(0,k.jsx)(`th`,{className:d,children:`State`})]}),children:i.cases.map(t=>{let n=M(t.url);return(0,k.jsxs)(`tr`,{className:_,children:[(0,k.jsx)(`td`,{className:l(g,`whitespace-nowrap`),children:n?(0,k.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[t.id,(0,k.jsx)(h,{size:12,"aria-hidden":`true`})]}):t.id}),(0,k.jsx)(`td`,{className:l(g,`[overflow-wrap:anywhere]`),children:t.title}),(0,k.jsx)(`td`,{className:l(g,`text-right tabular-nums`),children:t.steps}),(0,k.jsx)(`td`,{className:l(g,t.stale?`text-warn`:`text-muted`),children:t.stale?(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,k.jsx)(e,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):t.changed?(0,k.jsxs)(`span`,{"data-tip":new Date(t.changed).toLocaleString(),children:[`changed `,D(t.changed)]}):`–`})]},t.id)})})}),(0,k.jsx)(R,{id:`criteria-h`,icon:r,title:`Acceptance criteria`,children:(0,k.jsx)(x,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:d,children:`Criterion`}),(0,k.jsx)(`th`,{className:d,children:`Cases`})]}),children:i.criteria.map((e,t)=>(0,k.jsxs)(`tr`,{className:_,children:[(0,k.jsx)(`td`,{className:l(g,`[overflow-wrap:anywhere]`),children:e.text}),(0,k.jsx)(`td`,{className:l(g,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,k.jsxs)(R,{id:`proposals-h`,icon:a,title:`Proposed changes`,children:[(0,k.jsx)(x,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,k.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y||!T.length||!!f,onClick:()=>void E(),children:[`Review `,N(T.length,`change`)]}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:l(d,`w-10`),children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,k.jsx)(`th`,{className:d,children:`Change`}),(0,k.jsx)(`th`,{className:d,children:`Existing case`}),(0,k.jsx)(`th`,{className:d,children:`The agent wrote`})]}),children:i.proposals.map(e=>{let t=P(e);return(0,k.jsxs)(`tr`,{className:_,children:[(0,k.jsx)(`td`,{className:g,children:(0,k.jsx)(`input`,{type:`checkbox`,"aria-label":`${F(e)}: ${e.id} ${e.title}`,checked:c.includes(t),disabled:y||!!f,onChange:e=>u(e.target.checked?[...c,t]:c.filter(e=>e!==t))})}),(0,k.jsxs)(`td`,{className:l(g,`whitespace-nowrap font-medium`),children:[F(e),e.link&&e.kind!==`link`&&(0,k.jsx)(`span`,{className:`block text-[12px] font-normal text-muted`,children:`and link it`})]}),(0,k.jsxs)(`td`,{className:l(g,`[overflow-wrap:anywhere]`),children:[(0,k.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2`,children:e.id}),` `,e.title]}),(0,k.jsx)(`td`,{className:l(g,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),f&&(0,k.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-3 text-[13px]`,children:[(0,k.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,N(f.changes.length,`change`),` to `,A.find(e=>e.id===i.system)?.label,`?`]}),(0,k.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:f.lines.map((e,t)=>(0,k.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,k.jsx)(m,{size:`sm`,variant:`primary`,disabled:y,onClick:()=>void j(),children:`Apply`}),(0,k.jsx)(m,{size:`sm`,disabled:y,onClick:()=>v(null),children:`Cancel`})]})]}),S&&S.applied.length>0&&(0,k.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,S.applied.join(`, `)]}),S&&S.failed.length>0&&(0,k.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,S.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,k.jsx)(R,{id:`changes-h`,icon:t,title:`Recent changes`,children:i.changes.length?(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:i.changes.map((e,t)=>(0,k.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,k.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),i.notes.map((e,t)=>(0,k.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function B({sub:e}){let{systems:t,error:r}=L(),a=e?e.indexOf(`/`):-1,s=a>0?e.slice(0,a):e,u=j(s)?s:void 0,d=u&&a>0?decodeURIComponent(e.slice(a+1)):``,[h,g]=(0,O.useState)(u??`azure_devops`),[_,v]=(0,O.useState)(d),[x,S]=(0,O.useState)(null),[w,E]=(0,O.useState)(``),[D,A]=(0,O.useState)(!1);(0,O.useEffect)(()=>{u&&g(u),v(d)},[u,d]),(0,O.useEffect)(()=>{!u&&t.length&&!t.some(e=>e.id===h)&&g(t[0].id)},[t,h,u]);let M=(0,O.useCallback)(()=>{!u||!d?S(null):(A(!0),p.view(u,d).then(e=>{S(e),E(``),A(!1)},e=>{E(e.message),A(!1)}))},[u,d]);return(0,O.useEffect)(()=>S(null),[u,d]),(0,O.useEffect)(M,[M]),(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(y,{}),(0,k.jsxs)(`main`,{className:l(b,`@container flex-auto gap-4`),children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,k.jsx)(f,{pixel:T[`test-cases`],size:`lg`}),(0,k.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,k.jsxs)(`p`,{className:`m-0 max-w-[80ch] 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,k.jsx)(`a`,{href:i(`regression`),children:`Regression`}),`; their results on `,(0,k.jsx)(`a`,{href:i(`runs`),children:`Runs`}),`.`]}),(0,k.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=_.trim();if(!t)return;let n=i(`test-cases`,h,encodeURIComponent(t));location.hash===n?M():location.hash=n},className:`flex flex-col gap-3`,children:[(0,k.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-1.5`,children:(0,k.jsx)(o,{items:t,value:h,onChange:g})}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,k.jsx)(c,{value:_,maxLength:120,spellCheck:!1,placeholder:h===`azure_devops`?`1234`:h===`qtest`?`5678`:h===`testrail`?`R12`:`SHOP-12`,onChange:e=>v(e.target.value)})]}),(0,k.jsx)(m,{type:`submit`,variant:`primary`,disabled:!_.trim()||D,children:`Open`})]})]}),[r,w].filter(Boolean).map(e=>(0,k.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),D&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),x&&(0,k.jsx)(z,{view:x,onApplied:M,onError:E},`${x.system}:${x.story.id}`),!d&&!x&&(0,k.jsx)(C,{icon:n,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{B as TestCases};
1
+ import{$i as e,Fr as t,Jr as n,Ln as r,Nt as i,Yr as a,ct as o,en as s,ft as c,ga as l,ho as u,it as d,kt as f,lo as p,ma as m,nr as h,nt as g,ot as _,po as v,r as y,t as b,tt as x,vo as S,vt as C,wa as w,yt as T}from"./frame-COPwycC2.js";import{d as E,r as D}from"./index-gt34hBeA.js";var O=S(u(),1),k=v(),A=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],j=e=>A.some(t=>t.id===e),M=e=>e&&E(e)===`web`?e:void 0,N=(e,t)=>`${e} ${t}${e===1?``:`s`}`,P=e=>`${e.kind}:${e.id}`;function F(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${N((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function I(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 L(){let[e,t]=(0,O.useState)(A.map(e=>e.id)),[n,r]=(0,O.useState)(``);return(0,O.useEffect)(()=>{w.settings().then(e=>{let n=e.config.sources??{},r=A.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:A.filter(t=>e.includes(t.id)),error:n}}function R({id:e,icon:t,title:n,children:r}){return(0,k.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-3`,children:[(0,k.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,k.jsx)(s,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function z({view:i,onApplied:o,onError:s}){let[c,u]=(0,O.useState)([]),[f,v]=(0,O.useState)(null),[y,b]=(0,O.useState)(!1),[S,C]=(0,O.useState)(null),w=i.story.id,T=i.proposals.filter(e=>c.includes(P(e))),E=async()=>{let e=T.map(e=>I(e,w));b(!0);try{let t=await p.preview(i.system,w,e);v({lines:t.lines,changes:e}),s(``)}catch(e){s(e.message)}finally{b(!1)}},j=async()=>{if(f){b(!0);try{let e=await p.apply(i.system,w,f.changes);C({applied:e.applied,failed:e.failed}),v(null),u([]),s(``),o()}catch(e){s(e.message)}finally{b(!1)}}},L=M(i.story.url);return(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,k.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[L?(0,k.jsxs)(`a`,{href:L,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[w,(0,k.jsx)(h,{size:14,"aria-hidden":`true`})]}):(0,k.jsx)(`span`,{children:w}),i.story.title&&(0,k.jsx)(`span`,{className:`font-normal text-ink-2`,children:i.story.title})]}),i.changed&&(0,k.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(i.changed.when).toLocaleString(),children:[`The story's `,i.changed.field,` changed `,D(i.changed.when),`.`]})]}),(0,k.jsx)(R,{id:`cases-h`,icon:n,title:`Linked cases`,children:(0,k.jsx)(x,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:d,children:`Case`}),(0,k.jsx)(`th`,{className:d,children:`Title`}),(0,k.jsx)(`th`,{className:l(d,`text-right`),children:`Steps`}),(0,k.jsx)(`th`,{className:d,children:`State`})]}),children:i.cases.map(t=>{let n=M(t.url);return(0,k.jsxs)(`tr`,{className:_,children:[(0,k.jsx)(`td`,{className:l(g,`whitespace-nowrap`),children:n?(0,k.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[t.id,(0,k.jsx)(h,{size:12,"aria-hidden":`true`})]}):t.id}),(0,k.jsx)(`td`,{className:l(g,`[overflow-wrap:anywhere]`),children:t.title}),(0,k.jsx)(`td`,{className:l(g,`text-right tabular-nums`),children:t.steps}),(0,k.jsx)(`td`,{className:l(g,t.stale?`text-warn`:`text-muted`),children:t.stale?(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,k.jsx)(e,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):t.changed?(0,k.jsxs)(`span`,{"data-tip":new Date(t.changed).toLocaleString(),children:[`changed `,D(t.changed)]}):`–`})]},t.id)})})}),(0,k.jsx)(R,{id:`criteria-h`,icon:r,title:`Acceptance criteria`,children:(0,k.jsx)(x,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:d,children:`Criterion`}),(0,k.jsx)(`th`,{className:d,children:`Cases`})]}),children:i.criteria.map((e,t)=>(0,k.jsxs)(`tr`,{className:_,children:[(0,k.jsx)(`td`,{className:l(g,`[overflow-wrap:anywhere]`),children:e.text}),(0,k.jsx)(`td`,{className:l(g,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,k.jsxs)(R,{id:`proposals-h`,icon:a,title:`Proposed changes`,children:[(0,k.jsx)(x,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,k.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y||!T.length||!!f,onClick:()=>void E(),children:[`Review `,N(T.length,`change`)]}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:l(d,`w-10`),children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,k.jsx)(`th`,{className:d,children:`Change`}),(0,k.jsx)(`th`,{className:d,children:`Existing case`}),(0,k.jsx)(`th`,{className:d,children:`The agent wrote`})]}),children:i.proposals.map(e=>{let t=P(e);return(0,k.jsxs)(`tr`,{className:_,children:[(0,k.jsx)(`td`,{className:g,children:(0,k.jsx)(`input`,{type:`checkbox`,"aria-label":`${F(e)}: ${e.id} ${e.title}`,checked:c.includes(t),disabled:y||!!f,onChange:e=>u(e.target.checked?[...c,t]:c.filter(e=>e!==t))})}),(0,k.jsxs)(`td`,{className:l(g,`whitespace-nowrap font-medium`),children:[F(e),e.link&&e.kind!==`link`&&(0,k.jsx)(`span`,{className:`block text-[12px] font-normal text-muted`,children:`and link it`})]}),(0,k.jsxs)(`td`,{className:l(g,`[overflow-wrap:anywhere]`),children:[(0,k.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2`,children:e.id}),` `,e.title]}),(0,k.jsx)(`td`,{className:l(g,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),f&&(0,k.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-3 text-[13px]`,children:[(0,k.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,N(f.changes.length,`change`),` to `,A.find(e=>e.id===i.system)?.label,`?`]}),(0,k.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:f.lines.map((e,t)=>(0,k.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,k.jsx)(m,{size:`sm`,variant:`primary`,disabled:y,onClick:()=>void j(),children:`Apply`}),(0,k.jsx)(m,{size:`sm`,disabled:y,onClick:()=>v(null),children:`Cancel`})]})]}),S&&S.applied.length>0&&(0,k.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,S.applied.join(`, `)]}),S&&S.failed.length>0&&(0,k.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,S.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,k.jsx)(R,{id:`changes-h`,icon:t,title:`Recent changes`,children:i.changes.length?(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:i.changes.map((e,t)=>(0,k.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,k.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),i.notes.map((e,t)=>(0,k.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function B({sub:e}){let{systems:t,error:r}=L(),a=e?e.indexOf(`/`):-1,s=a>0?e.slice(0,a):e,u=j(s)?s:void 0,d=u&&a>0?decodeURIComponent(e.slice(a+1)):``,[h,g]=(0,O.useState)(u??`azure_devops`),[_,v]=(0,O.useState)(d),[x,S]=(0,O.useState)(null),[w,E]=(0,O.useState)(``),[D,A]=(0,O.useState)(!1);(0,O.useEffect)(()=>{u&&g(u),v(d)},[u,d]),(0,O.useEffect)(()=>{!u&&t.length&&!t.some(e=>e.id===h)&&g(t[0].id)},[t,h,u]);let M=(0,O.useCallback)(()=>{!u||!d?S(null):(A(!0),p.view(u,d).then(e=>{S(e),E(``),A(!1)},e=>{E(e.message),A(!1)}))},[u,d]);return(0,O.useEffect)(()=>S(null),[u,d]),(0,O.useEffect)(M,[M]),(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(y,{}),(0,k.jsxs)(`main`,{className:l(b,`@container flex-auto gap-4`),children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,k.jsx)(f,{pixel:T[`test-cases`],size:`lg`}),(0,k.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,k.jsxs)(`p`,{className:`m-0 max-w-[80ch] 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,k.jsx)(`a`,{href:i(`regression`),children:`Regression`}),`; their results on `,(0,k.jsx)(`a`,{href:i(`runs`),children:`Runs`}),`.`]}),(0,k.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=_.trim();if(!t)return;let n=i(`test-cases`,h,encodeURIComponent(t));location.hash===n?M():location.hash=n},className:`flex flex-col gap-3`,children:[(0,k.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-1.5`,children:(0,k.jsx)(o,{items:t,value:h,onChange:g})}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,k.jsx)(c,{value:_,maxLength:120,spellCheck:!1,placeholder:h===`azure_devops`?`1234`:h===`qtest`?`5678`:h===`testrail`?`R12`:`SHOP-12`,onChange:e=>v(e.target.value)})]}),(0,k.jsx)(m,{type:`submit`,variant:`primary`,disabled:!_.trim()||D,children:`Open`})]})]}),[r,w].filter(Boolean).map(e=>(0,k.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),D&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),x&&(0,k.jsx)(z,{view:x,onApplied:M,onError:E},`${x.system}:${x.story.id}`),!d&&!x&&(0,k.jsx)(C,{icon:n,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{B as TestCases};
@@ -1,2 +1,2 @@
1
- import{En as e,Na as t,Nt as n,Ri as r,Xi as i,_a as a,_o as o,_t as s,an as c,at as l,ct as u,en as d,ft as f,ga as p,ha as m,ho as h,it as g,ka as _,kt as v,ma as y,nt as b,po as x,pt as S,r as C,ri as w,rt as T,st as E,t as D,tt as O,vo as k,vr as A,vt as j,wi as M,wn as N,yt as P}from"./frame-CMf4LDd4.js";import{r as F}from"./index-BD3iUT-3.js";import{n as I}from"./segmented-E7E9vDxH.js";import{a as L,c as R,f as z,i as B,n as V,o as H,r as U,s as W,t as G,u as K}from"./dataParts-CaJiuNL1.js";var q=o({Requests:()=>$,TestData:()=>ie}),J=k(h(),1),Y=x(),X=[`requests`,`kept`,`specs`,`batches`],Z={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},Q=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function ee({e,kept:t,busy:n,act:r}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,Y.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked the DB agent for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.name})]}):null]}),e.why&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,Y.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,Y.jsx)(R,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,Y.jsx)(K,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,Y.jsx)(V,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,Y.jsx)(V,{label:`INSERT script`,children:e.script_preview.join(`
1
+ import{En as e,Na as t,Nt as n,Ri as r,Xi as i,_a as a,_o as o,_t as s,an as c,at as l,ct as u,en as d,ft as f,ga as p,ha as m,ho as h,it as g,ka as _,kt as v,ma as y,nt as b,po as x,pt as S,r as C,ri as w,rt as T,st as E,t as D,tt as O,vo as k,vr as A,vt as j,wi as M,wn as N,yt as P}from"./frame-COPwycC2.js";import{r as F}from"./index-gt34hBeA.js";import{n as I}from"./segmented-DDPlHkHh.js";import{a as L,c as R,f as z,i as B,n as V,o as H,r as U,s as W,t as G,u as K}from"./dataParts-YMCGX8gq.js";var q=o({Requests:()=>$,TestData:()=>ie}),J=k(h(),1),Y=x(),X=[`requests`,`kept`,`specs`,`batches`],Z={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},Q=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function ee({e,kept:t,busy:n,act:r}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,Y.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked the DB agent for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.name})]}):null]}),e.why&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,Y.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,Y.jsx)(R,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,Y.jsx)(K,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,Y.jsx)(V,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,Y.jsx)(V,{label:`INSERT script`,children:e.script_preview.join(`
2
2
  `)})]}):null,t&&e.name&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(y,{size:`sm`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),`Fetch again`]})})]})}function $({view:t,log:r,busy:i,act:a}){let[o,c]=(0,J.useState)(`all`),[d,f]=(0,J.useState)(``),[h,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(``),x=r??[],C=(0,J.useMemo)(()=>[...new Set(x.map(e=>e.requester))].sort(),[r]),w=(0,J.useMemo)(()=>[...new Set(x.map(e=>e.database).filter(Boolean))].sort(),[r]),D=x.filter(e=>!e.ok).length,k=x.filter(e=>(o===`all`||o===`ok`===e.ok)&&(!d||e.requester===d)&&(!h||e.database===h)),M=new Set(t.requests.map(e=>e.name));return r===null?(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):x.length?(0,Y.jsx)(O,{label:`Requests`,resetKey:`${o}|${d}|${h}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(u,{value:o,onChange:c,items:[{id:`all`,label:`All`,n:x.length},{id:`ok`,label:`Answered`,n:x.length-D},{id:`failed`,label:`Failed`,n:D,alert:!0}]}),C.length>1&&(0,Y.jsxs)(S,{size:`sm`,"aria-label":`Who asked`,value:d,onChange:e=>f(e.target.value),className:`w-[180px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Anyone`}),C.map(e=>(0,Y.jsx)(`option`,{children:e},e))]}),w.length>1&&(0,Y.jsxs)(S,{size:`sm`,"aria-label":`Database`,value:h,onChange:e=>_(e.target.value),className:`w-[160px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Any database`}),w.map(e=>(0,Y.jsx)(`option`,{children:e},e))]})]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{className:p(g,`w-9`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,Y.jsx)(`th`,{className:p(g,`w-[110px]`),children:`When`}),(0,Y.jsx)(`th`,{className:p(g,`w-[150px]`),children:`Who asked`}),(0,Y.jsx)(`th`,{className:g,children:`What for`}),(0,Y.jsx)(`th`,{className:p(g,`w-[110px]`),children:`Database`}),(0,Y.jsx)(`th`,{className:p(g,`w-[140px]`),children:`Answer`}),(0,Y.jsx)(`th`,{className:p(l,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:k.map(t=>{let n=v===t.id;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`tr`,{className:p(E,n&&`bg-surface-muted`),onClick:()=>y(n?``:t.id),children:[(0,Y.jsx)(`td`,{className:p(b,`pr-0`),children:(0,Y.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":n?`Close the request`:`Open the request`,onClick:e=>(e.stopPropagation(),y(n?``:t.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:n?(0,Y.jsx)(N,{size:16,"aria-hidden":`true`}):(0,Y.jsx)(e,{size:16,"aria-hidden":`true`})})}),(0,Y.jsx)(`td`,{className:p(b,`whitespace-nowrap text-muted`),"data-tip":new Date(t.at).toLocaleString(),children:F(t.at)}),(0,Y.jsx)(`td`,{className:p(b,`truncate`),"data-tip":t.requester,children:t.requester}),(0,Y.jsxs)(`td`,{className:p(b,`truncate`),"data-tip":t.need,children:[t.need,t.source===`fetch`?(0,Y.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,Y.jsx)(`td`,{className:p(b,`truncate`),"data-tip":t.database,children:t.database||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:p(b,`whitespace-nowrap`),children:(0,Y.jsx)(s,{tone:t.ok?`pass`:`fail`,children:t.ok?H[t.kind||``]||`Answered`:`Failed`})}),(0,Y.jsx)(`td`,{className:T,children:t.ok?Q(t):``})]}),n&&(0,Y.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,Y.jsx)(`td`,{colSpan:7,className:`max-w-0 px-4 py-2`,children:(0,Y.jsx)(ee,{e:t,kept:!!t.name&&M.has(t.name),busy:i,act:a})})})]},t.id)})}):(0,Y.jsx)(j,{icon:A,title:`No test data asked for yet`,action:(0,Y.jsxs)(`a`,{href:n(`data`,`ask`,`test-data`),className:p(m({size:`sm`}),`no-underline`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),`Ask for test data`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function te({view:e,job:t,busy:r,act:i,onNote:o}){let s=t&&!t.running&&t.kind===`fetch`?t:null,c=s?.result;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),s&&(0,Y.jsxs)(`section`,{"aria-label":`Fetched ${s.target}`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:s.target}),c&&!c.ok&&(0,Y.jsx)(R,{text:c.error||`It could not fetch the data.`}),c?.ok&&(0,Y.jsx)(G,{r:c,onNote:o})]}),e.requests.length===0?(0,Y.jsxs)(j,{className:`py-3`,children:[`No kept requests yet. Each request the DB agent answers is kept here; `,(0,Y.jsx)(`a`,{href:n(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,Y.jsx)(W,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,H[e.kind],e.rows?` · ${a(e.rows,`row`)}`:``,e.created?` · ${F(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,Y.jsxs)(y,{size:`sm`,disabled:r,onClick:()=>i(`fetch`,{name:e.name}),children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),`Fetch again`]})]},e.name)})]})}function ne({view:e,job:t,busy:i,act:a,onNote:o}){let[s,c]=(0,J.useState)(e.specs[0]??``),[l,u]=(0,J.useState)(``),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(`csv`),[v,b]=(0,J.useState)(!1),x={spec:s,...l?{db:l}:{},...p?{seed:p}:{}},C=t&&!t.running?t:null,T=C&&[`gen`,`files`,`insert`].includes(C.kind)&&C.target===s?C.result:void 0,E=e.databases.find(e=>e.name===l),D=async()=>{try{let{id:e}=await _.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=n(`chats`,e)}catch(e){o(e.message)}};return(0,Y.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsxs)(`h2`,{id:`spec-h`,className:`m-0 flex flex-1 items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(d,{icon:A,size:18,className:`text-accent-fg`}),`Make test data from a spec`]}),(0,Y.jsxs)(y,{variant:`ghost`,onClick:()=>void D(),children:[(0,Y.jsx)(w,{"aria-hidden":`true`}),`Write a spec in a chat`]})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),e.specs.length===0?(0,Y.jsx)(j,{className:`py-3`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-1.5 text-sm font-medium`,children:[`Spec`,(0,Y.jsx)(S,{value:s,onChange:e=>c(e.target.value),children:e.specs.map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Database`,(0,Y.jsxs)(S,{value:l,onChange:e=>u(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The spec's own`}),e.databases.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,Y.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-1.5 text-sm font-medium`,children:[`Seed`,(0,Y.jsx)(f,{value:p,inputMode:`numeric`,placeholder:`Random`,onChange:e=>m(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(y,{variant:v?void 0:`primary`,disabled:i||!s,onClick:()=>a(`gen`,x),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),`Preview`]}),(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(y,{disabled:i||!s,onClick:()=>a(`gen`,{...x,mode:`files`,format:h}),children:`Write files`}),(0,Y.jsx)(S,{"aria-label":`File format`,value:h,onChange:e=>g(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(y,{disabled:i||!s||!E?.writable,"data-tip":E?.writable?void 0:`Pick a writable database to insert into`,onClick:()=>b(!0),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Insert into `,E?.writable?E.name:`a database`]})]}),v&&E&&(0,Y.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-3 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,s,` into `,E.name,`?`]}),(0,Y.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(y,{variant:`primary`,onClick:()=>{b(!1),a(`gen`,{...x,mode:`insert`,confirmed:!0})},children:`Insert`}),(0,Y.jsx)(y,{onClick:()=>b(!1),children:`Don't insert`})]})]}),T&&!T.ok&&(0,Y.jsx)(R,{text:T.error||`It did not make the data.`}),T?.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[T.batch&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:T.batch}),`.`]}),T.files?.length?(0,Y.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,T.files.map(e=>(0,Y.jsx)(U,{file:e,onNote:o},e))]}):null,(0,Y.jsx)(B,{r:T})]})]})]})}function re({view:e,job:t,busy:n,act:a}){let o=e.databases.filter(e=>e.writable),[s,c]=(0,J.useState)(o[0]?.name??``),[l,u]=(0,J.useState)(``),f=t&&!t.running?t:null,p=f?.kind===`batches`?(Array.isArray(f.result)?f.result.flatMap(e=>e.batches||[]):f.result?.batches)??[]:null;return(0,Y.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`h2`,{id:`batch-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(d,{icon:r,size:18,className:`text-accent-fg`}),`Inserted batches`]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`}),o.length===0?(0,Y.jsx)(j,{className:`py-3`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(S,{"aria-label":`Database`,value:s,onChange:e=>c(e.target.value),className:`w-[220px]`,children:o.map(e=>(0,Y.jsx)(`option`,{children:e.name},e.name))}),(0,Y.jsx)(y,{disabled:n||!s,onClick:()=>a(`batches`,{db:s}),children:`List batches`})]}),p&&p.length===0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,f?.target,`.`]}),p&&p.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[(0,Y.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:F(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),l===e.batch?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,f?.target,`?`]}),(0,Y.jsx)(y,{variant:`danger`,size:`sm`,onClick:()=>{u(``),a(`clean`,{db:f?.target,batch:e.batch,confirmed:!0})},children:`Remove`}),(0,Y.jsx)(y,{size:`sm`,onClick:()=>u(``),children:`Keep`})]}):(0,Y.jsxs)(y,{size:`sm`,disabled:n,onClick:()=>u(e.batch),children:[(0,Y.jsx)(i,{"aria-hidden":`true`}),`Remove`]})]},e.batch))}),f?.kind===`clean`&&f.result?.ok&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(f.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})}function ie({sub:e}){let{view:r,error:i,busy:o,act:s,stop:l,job:u}=z(),[d,f]=(0,J.useState)(null),[h,g]=(0,J.useState)(``),_=X.includes(e)?e:`requests`,y=u&&!u.running?u.endedAt:``;(0,J.useEffect)(()=>{t.log().then(f,e=>g(e.message))},[y]);let b=(d||[]).filter(e=>!e.ok).length,x=new Set((d||[]).map(e=>e.requester)).size,S={requests:`Requests${d?` (${d.length})`:``}`,kept:`Kept${r?` (${r.requests.length})`:``}`,specs:`Specs${r?` (${r.specs.length})`:``}`,batches:`Batches`};return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(C,{}),(0,Y.jsxs)(`main`,{className:p(D,`@container flex-auto gap-4`),children:[(0,Y.jsxs)(`a`,{href:n(`data`,`databases`),className:`inline-flex w-fit items-center gap-1.5 text-sm`,children:[(0,Y.jsx)(c,{size:16,"aria-hidden":`true`}),`All databases`]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(v,{pixel:P[`test-data`],size:`lg`}),(0,Y.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test data`}),(0,Y.jsxs)(`a`,{href:n(`data`,`ask`,`test-data`),className:p(m(),`no-underline`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),`Ask for test data`]})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what the DB agent sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),d&&d.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[a(d.length,`request`),` · `,a(x,`asker`),` · `,(0,Y.jsxs)(`span`,{className:b?`text-fail`:``,children:[b,` failed`]}),r?` · ${r.requests.length} kept`:``]}),(i||h)&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i||h}),!r&&!i&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{label:`Test data`,current:_,onPick:e=>location.hash=n(`test-data`,e),tabs:X.map(e=>({id:e,label:S[e]}))}),u&&(u.running?Z[u.kind]!==void 0:Z[u.kind]===_)&&(0,Y.jsx)(L,{job:u,onStop:l}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`panel-${_}`,"aria-labelledby":`tab-${_}`,children:[_===`requests`&&(0,Y.jsx)($,{view:r,log:d,busy:o,act:s}),_===`kept`&&(0,Y.jsx)(te,{view:r,job:u,busy:o,act:s,onNote:g}),_===`specs`&&(0,Y.jsx)(ne,{view:r,job:u,busy:o,act:s,onNote:g}),_===`batches`&&(0,Y.jsx)(re,{view:r,job:u,busy:o,act:s})]})]})]})]})}export{q as n,$ as t};
@@ -1 +1 @@
1
- import{$i as e,An as t,In as n,Jn as r,Jr as i,Nt as a,Oa as o,bi as s,ct as c,ft as ee,ga as l,ha as u,ho as d,jn as f,ka as te,kt as ne,ma as p,po as m,pt as h,r as g,ri as re,t as ie,tt as _,vo as v,vt as y,yt as b}from"./frame-CMf4LDd4.js";import{r as x}from"./index-BD3iUT-3.js";import{_ as S,o as C}from"./qualityParts-CFjfNmrS.js";var w=v(d(),1),T={view:()=>o(`GET`,`/api/testdebt`),refresh:()=>o(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>o(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},E=m(),D=[`untested`,`signal`,`duplicates`,`cases`],O={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},k={test:`Test`,recording:`Recording`,case:`Test case`},A={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},j={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},M=e=>`${Math.round(e*100)}%`,ae=e=>D.includes(e)?e:`untested`;function N({part:t,what:n,action:r}){return(0,E.jsxs)(y,{icon:e,title:t.state===`empty`?`No ${n} yet`:`${n[0].toUpperCase()}${n.slice(1)}: not connected`,action:(0,E.jsx)(`a`,{className:u({size:`sm`}),href:r.to,children:r.label}),children:[`To see this list, set `,t.set,`.`]})}function P({text:e,tip:t}){return(0,E.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function F({sub:e}){let[o,d]=(0,w.useState)(null),[m,v]=(0,w.useState)(``),[D,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(``),R=ae(e),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(`manual`),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(``);(0,w.useEffect)(()=>{T.view().then(e=>{d(e),v(``)},e=>v(e.message))},[]);let q=(0,w.useCallback)(async(e,t)=>{F(!0),L(``);try{d(await e()),v(``),t&&L(t)}catch(e){v(e.message)}finally{F(!1)}},[]),oe=async e=>{if(e){F(!0);try{let{id:t}=await te.start(e,{});location.hash=a(`chats`,t)}catch(e){v(e.message),F(!1)}}},J=(e,t)=>(0,E.jsxs)(p,{size:`sm`,variant:`ghost`,disabled:D||!e,onClick:()=>void oe(e),"data-tip":e?`Ask in a chat to draft a test for this ${t}`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:[(0,E.jsx)(re,{"aria-hidden":`true`}),`Draft the test`]}),Y=o?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=U||Y[0]?.id||``,Z=o?.cases.filter(e=>!e.automated).length??0,se=o?.areas.filter(e=>z===`all`||e.kind===z)??[],ce=o?.cases.filter(e=>V===`all`||(V===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-3 text-right tabular-nums`,$={untested:(o?.areas.length??0)+(o?.rules.length??0),signal:(o?.quiet.length??0)+(o?.gone.length??0),duplicates:o?.duplicates.length??0,cases:Z};return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(g,{}),(0,E.jsxs)(`main`,{className:l(ie,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(ne,{pixel:b[`test-debt`],size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),o&&(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,E.jsxs)(`span`,{"data-tip":S(o.at),children:[`Worked out `,x(o.at)]}),(0,E.jsxs)(p,{size:`sm`,disabled:D,onClick:()=>void q(T.refresh,`Worked out again.`),children:[(0,E.jsx)(s,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-[80ch] 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,E.jsx)(`a`,{href:a(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,o?.repo&&o.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:o.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.`]}),m&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:m}),!o&&!m&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),I&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:I}),o&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,E.jsx)(C,{label:`Untested code`,value:o.graph.state===`ok`?o.areas.length:`–`,tone:o.areas.length?`text-warn`:void 0,sub:o.graph.state===`ok`?`of ${o.graph.checked} areas`:`graph not built`}),(0,E.jsx)(C,{label:`Untested rules`,value:o.rules.length,tone:o.rules.length?`text-warn`:void 0,sub:`of ${o.graph.rulesChecked} rules`}),(0,E.jsx)(C,{label:`Never fail`,value:o.quiet.length,sub:`30 passes in a row`}),(0,E.jsx)(C,{label:`Code gone`,value:o.gone.length,tone:o.gone.length?`text-fail`:void 0,sub:`of ${o.files.count} files listed`}),(0,E.jsx)(C,{label:`Near-duplicates`,value:o.duplicates.length,sub:`from ${M(o.threshold)} alike`}),(0,E.jsx)(C,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${o.cases.length} test cases`})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(c,{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:R,onChange:e=>location.hash=a(`test-debt`,e)})}),o.notes.map(e=>(0,E.jsx)(`p`,{className:`m-0 text-[12.5px] text-ink-2`,children:e},e)),R===`untested`&&(0,E.jsxs)(E.Fragment,{children:[o.graph.state===`ok`?(0,E.jsx)(_,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:z,empty:o.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(c,{items:[{id:`all`,label:`All`,n:o.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${O[e]}s`,n:o.areas.filter(t=>t.kind===e).length}))],value:z,onChange:B})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[34%] py-1.5 pr-3 pl-3 font-medium`,children:`Code`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Kind`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Used by`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:se.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(f,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:O[e.kind]}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:l(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,O[e.kind].toLowerCase())})]},e.id))}):(0,E.jsx)(N,{part:o.graph,what:`product graph`,action:{label:`Open Product`,to:a(`product`)}}),(0,E.jsx)(_,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:o.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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Rule`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`From`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Closest test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.rules.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(f,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] 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,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.nearest?(0,E.jsx)(P,{text:`${e.nearest.name} (${M(e.nearest.score)})`,tip:`${M(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`rule`)})]},e.id))})]}),R===`signal`&&(o.history.state===`ok`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[50%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Passes`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Since`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.quiet.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(t,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,E.jsx)(P,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,E.jsx)(`td`,{className:l(Q,`text-muted`),children:e.runs}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.since?S(e.since):void 0,children:e.since?x(e.since):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))}),(0,E.jsx)(_,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${o.files.count} files, listed by ${o.files.by===`git`?`git`:`walking the folder`}).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[40%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`File`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Last run`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.gone.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(n,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,E.jsx)(P,{text:e.name})]})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2`,children:(0,E.jsx)(P,{text:e.file})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.last?S(e.last):void 0,children:e.last?x(e.last):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))})]}):(0,E.jsx)(N,{part:o.history,what:`test history`,action:{label:`Open Regression`,to:a(`regression`)}})),R===`duplicates`&&(0,E.jsx)(_,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${M(o.threshold)} of their words (${o.compared} pairs compared).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 text-right font-medium`,children:`Alike`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`First`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`Second`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Shared words`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.duplicates.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:l(Q,`pl-3`,e.score>=.85?`text-warn`:`text-muted`),children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,E.jsx)(r,{size:14,"aria-hidden":`true`}),M(e.score)]})}),[e.a,e.b].map((e,t)=>(0,E.jsxs)(`td`,{className:`max-w-0 py-2 pr-3`,children:[(0,E.jsx)(P,{text:e.name,tip:`${k[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,E.jsx)(`span`,{className:`block text-[12px] text-muted`,children:k[e.kind]})]},t)),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:(0,E.jsx)(P,{text:e.shared.join(`, `)})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),R===`cases`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,E.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:o.sources.map(e=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,E.jsx)(t,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,E.jsx)(f,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${x(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,E.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>T.readCases(X,G.trim()),`Test cases read.`)},children:[(0,E.jsx)(h,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>W(e.target.value),children:Y.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,E.jsx)(ee,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?j[X]:``,value:G,maxLength:80,onChange:e=>K(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,E.jsxs)(p,{size:`sm`,type:`submit`,disabled:D||!G.trim(),children:[(0,E.jsx)(i,{"aria-hidden":`true`}),`Read cases`]})]}),o.cases.length?(0,E.jsx)(_,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:V,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(c,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:o.cases.length-Z},{id:`all`,label:`All`,n:o.cases.length}],value:V,onChange:H})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Case`}),(0,E.jsx)(`th`,{className:`w-[36%] py-1.5 pr-3 font-medium`,children:`Title`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Source`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Automated`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ce.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pr-3 pl-3 font-mono text-[12.5px] whitespace-nowrap`,children:/^https?:\/\//i.test(e.url)?(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3`,children:(0,E.jsx)(P,{text:e.title||`–`})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap @xl:table-cell`,"data-tip":`From ${e.scope}`,children:A[e.source]}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,"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,E.jsx)(t,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,E.jsx)(f,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.test?(0,E.jsx)(P,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,E.jsx)(y,{icon:i,title:`No test cases yet`,action:(0,E.jsx)(`a`,{className:u({size:`sm`}),href:a(`settings`,`integrations`),children:`Open 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{F as TestDebt};
1
+ import{$i as e,An as t,In as n,Jn as r,Jr as i,Nt as a,Oa as o,bi as s,ct as c,ft as ee,ga as l,ha as u,ho as d,jn as f,ka as te,kt as ne,ma as p,po as m,pt as h,r as g,ri as re,t as ie,tt as _,vo as v,vt as y,yt as b}from"./frame-COPwycC2.js";import{r as x}from"./index-gt34hBeA.js";import{_ as S,o as C}from"./qualityParts-DANtbDfW.js";var w=v(d(),1),T={view:()=>o(`GET`,`/api/testdebt`),refresh:()=>o(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>o(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},E=m(),D=[`untested`,`signal`,`duplicates`,`cases`],O={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},k={test:`Test`,recording:`Recording`,case:`Test case`},A={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},j={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},M=e=>`${Math.round(e*100)}%`,ae=e=>D.includes(e)?e:`untested`;function N({part:t,what:n,action:r}){return(0,E.jsxs)(y,{icon:e,title:t.state===`empty`?`No ${n} yet`:`${n[0].toUpperCase()}${n.slice(1)}: not connected`,action:(0,E.jsx)(`a`,{className:u({size:`sm`}),href:r.to,children:r.label}),children:[`To see this list, set `,t.set,`.`]})}function P({text:e,tip:t}){return(0,E.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function F({sub:e}){let[o,d]=(0,w.useState)(null),[m,v]=(0,w.useState)(``),[D,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(``),R=ae(e),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(`manual`),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(``);(0,w.useEffect)(()=>{T.view().then(e=>{d(e),v(``)},e=>v(e.message))},[]);let q=(0,w.useCallback)(async(e,t)=>{F(!0),L(``);try{d(await e()),v(``),t&&L(t)}catch(e){v(e.message)}finally{F(!1)}},[]),oe=async e=>{if(e){F(!0);try{let{id:t}=await te.start(e,{});location.hash=a(`chats`,t)}catch(e){v(e.message),F(!1)}}},J=(e,t)=>(0,E.jsxs)(p,{size:`sm`,variant:`ghost`,disabled:D||!e,onClick:()=>void oe(e),"data-tip":e?`Ask in a chat to draft a test for this ${t}`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:[(0,E.jsx)(re,{"aria-hidden":`true`}),`Draft the test`]}),Y=o?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=U||Y[0]?.id||``,Z=o?.cases.filter(e=>!e.automated).length??0,se=o?.areas.filter(e=>z===`all`||e.kind===z)??[],ce=o?.cases.filter(e=>V===`all`||(V===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-3 text-right tabular-nums`,$={untested:(o?.areas.length??0)+(o?.rules.length??0),signal:(o?.quiet.length??0)+(o?.gone.length??0),duplicates:o?.duplicates.length??0,cases:Z};return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(g,{}),(0,E.jsxs)(`main`,{className:l(ie,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(ne,{pixel:b[`test-debt`],size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),o&&(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,E.jsxs)(`span`,{"data-tip":S(o.at),children:[`Worked out `,x(o.at)]}),(0,E.jsxs)(p,{size:`sm`,disabled:D,onClick:()=>void q(T.refresh,`Worked out again.`),children:[(0,E.jsx)(s,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-[80ch] 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,E.jsx)(`a`,{href:a(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,o?.repo&&o.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:o.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.`]}),m&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:m}),!o&&!m&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),I&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:I}),o&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,E.jsx)(C,{label:`Untested code`,value:o.graph.state===`ok`?o.areas.length:`–`,tone:o.areas.length?`text-warn`:void 0,sub:o.graph.state===`ok`?`of ${o.graph.checked} areas`:`graph not built`}),(0,E.jsx)(C,{label:`Untested rules`,value:o.rules.length,tone:o.rules.length?`text-warn`:void 0,sub:`of ${o.graph.rulesChecked} rules`}),(0,E.jsx)(C,{label:`Never fail`,value:o.quiet.length,sub:`30 passes in a row`}),(0,E.jsx)(C,{label:`Code gone`,value:o.gone.length,tone:o.gone.length?`text-fail`:void 0,sub:`of ${o.files.count} files listed`}),(0,E.jsx)(C,{label:`Near-duplicates`,value:o.duplicates.length,sub:`from ${M(o.threshold)} alike`}),(0,E.jsx)(C,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${o.cases.length} test cases`})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(c,{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:R,onChange:e=>location.hash=a(`test-debt`,e)})}),o.notes.map(e=>(0,E.jsx)(`p`,{className:`m-0 text-[12.5px] text-ink-2`,children:e},e)),R===`untested`&&(0,E.jsxs)(E.Fragment,{children:[o.graph.state===`ok`?(0,E.jsx)(_,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:z,empty:o.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(c,{items:[{id:`all`,label:`All`,n:o.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${O[e]}s`,n:o.areas.filter(t=>t.kind===e).length}))],value:z,onChange:B})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[34%] py-1.5 pr-3 pl-3 font-medium`,children:`Code`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Kind`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Used by`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:se.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(f,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:O[e.kind]}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:l(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,O[e.kind].toLowerCase())})]},e.id))}):(0,E.jsx)(N,{part:o.graph,what:`product graph`,action:{label:`Open Product`,to:a(`product`)}}),(0,E.jsx)(_,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:o.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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Rule`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`From`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Closest test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.rules.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(f,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] 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,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.nearest?(0,E.jsx)(P,{text:`${e.nearest.name} (${M(e.nearest.score)})`,tip:`${M(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`rule`)})]},e.id))})]}),R===`signal`&&(o.history.state===`ok`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[50%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Passes`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Since`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.quiet.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(t,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,E.jsx)(P,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,E.jsx)(`td`,{className:l(Q,`text-muted`),children:e.runs}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.since?S(e.since):void 0,children:e.since?x(e.since):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))}),(0,E.jsx)(_,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${o.files.count} files, listed by ${o.files.by===`git`?`git`:`walking the folder`}).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[40%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`File`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Last run`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.gone.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(n,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,E.jsx)(P,{text:e.name})]})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2`,children:(0,E.jsx)(P,{text:e.file})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.last?S(e.last):void 0,children:e.last?x(e.last):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))})]}):(0,E.jsx)(N,{part:o.history,what:`test history`,action:{label:`Open Regression`,to:a(`regression`)}})),R===`duplicates`&&(0,E.jsx)(_,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${M(o.threshold)} of their words (${o.compared} pairs compared).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 text-right font-medium`,children:`Alike`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`First`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`Second`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Shared words`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.duplicates.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:l(Q,`pl-3`,e.score>=.85?`text-warn`:`text-muted`),children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,E.jsx)(r,{size:14,"aria-hidden":`true`}),M(e.score)]})}),[e.a,e.b].map((e,t)=>(0,E.jsxs)(`td`,{className:`max-w-0 py-2 pr-3`,children:[(0,E.jsx)(P,{text:e.name,tip:`${k[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,E.jsx)(`span`,{className:`block text-[12px] text-muted`,children:k[e.kind]})]},t)),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:(0,E.jsx)(P,{text:e.shared.join(`, `)})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),R===`cases`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,E.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:o.sources.map(e=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,E.jsx)(t,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,E.jsx)(f,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${x(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,E.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>T.readCases(X,G.trim()),`Test cases read.`)},children:[(0,E.jsx)(h,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>W(e.target.value),children:Y.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,E.jsx)(ee,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?j[X]:``,value:G,maxLength:80,onChange:e=>K(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,E.jsxs)(p,{size:`sm`,type:`submit`,disabled:D||!G.trim(),children:[(0,E.jsx)(i,{"aria-hidden":`true`}),`Read cases`]})]}),o.cases.length?(0,E.jsx)(_,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:V,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(c,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:o.cases.length-Z},{id:`all`,label:`All`,n:o.cases.length}],value:V,onChange:H})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Case`}),(0,E.jsx)(`th`,{className:`w-[36%] py-1.5 pr-3 font-medium`,children:`Title`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Source`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Automated`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ce.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pr-3 pl-3 font-mono text-[12.5px] whitespace-nowrap`,children:/^https?:\/\//i.test(e.url)?(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3`,children:(0,E.jsx)(P,{text:e.title||`–`})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap @xl:table-cell`,"data-tip":`From ${e.scope}`,children:A[e.source]}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,"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,E.jsx)(t,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,E.jsx)(f,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.test?(0,E.jsx)(P,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,E.jsx)(y,{icon:i,title:`No test cases yet`,action:(0,E.jsx)(`a`,{className:u({size:`sm`}),href:a(`settings`,`integrations`),children:`Open 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{F as TestDebt};