@capagents/forgeqe 3.0.9 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/HOW_TO_USE.md +35 -22
  2. package/bin/bundle.js +3 -3
  3. package/bin/forgeqe.js +3 -3
  4. package/bin/license.js +1 -1
  5. package/dist/docs-site/CREDITS.md +11 -4
  6. package/dist/docs-site/LICENSE.dm-sans.txt +93 -0
  7. package/dist/docs-site/LICENSE.jetbrains-mono.txt +93 -0
  8. package/dist/docs-site/app-look.css +62 -0
  9. package/dist/docs-site/architecture-map/arch-fill.js +56 -0
  10. package/dist/docs-site/architecture-map/arch-theme.css +203 -0
  11. package/dist/docs-site/architecture-map/arch.css +0 -5
  12. package/dist/docs-site/architecture-map/index.html +57 -43
  13. package/dist/docs-site/docs/app-theme.css +166 -0
  14. package/dist/docs-site/docs/architecture/index.html +14 -11
  15. package/dist/docs-site/docs/containers/index.html +14 -11
  16. package/dist/docs-site/docs/cost-architecture/index.html +14 -11
  17. package/dist/docs-site/docs/custom-agents-first-run/index.html +14 -11
  18. package/dist/docs-site/docs/desktop/index.html +14 -11
  19. package/dist/docs-site/docs/desktop-ci/index.html +14 -11
  20. package/dist/docs-site/docs/docs.css +0 -7
  21. package/dist/docs-site/docs/evidence/index.html +14 -11
  22. package/dist/docs-site/docs/feature-test-prompts/index.html +14 -11
  23. package/dist/docs-site/docs/graphify/index.html +14 -11
  24. package/dist/docs-site/docs/guardrails/index.html +14 -11
  25. package/dist/docs-site/docs/index.html +96 -40
  26. package/dist/docs-site/docs/mobile/index.html +56 -18
  27. package/dist/docs-site/docs/model-routing/index.html +14 -11
  28. package/dist/docs-site/docs/product-graph/index.html +14 -11
  29. package/dist/docs-site/docs/product-knowledge/index.html +14 -11
  30. package/dist/docs-site/docs/product-views/index.html +14 -11
  31. package/dist/docs-site/docs/search.js +1 -1
  32. package/dist/docs-site/docs/web-app/index.html +14 -11
  33. package/dist/docs-site/img/wordmark.webp +0 -0
  34. package/dist/docs-site/site-header.css +0 -5
  35. package/dist/forgeqe.js +2225 -1867
  36. package/dist/template.html +14 -14
  37. package/dist/web/assets/{AgentWork-BhepbEeU.js → AgentWork-DwAI0_Of.js} +1 -1
  38. package/dist/web/assets/ApiTests-C0vFSHmM.js +10 -0
  39. package/dist/web/assets/Browse-5jfdtRc5.js +2 -0
  40. package/dist/web/assets/Chat-B3uhI94O.js +3 -0
  41. package/dist/web/assets/{CommandPalette-DMAmXPq1.js → CommandPalette-D2J4nf5y.js} +1 -1
  42. package/dist/web/assets/{Compare-DJNSrM2v.js → Compare-CN75w1p9.js} +1 -1
  43. package/dist/web/assets/{Cost-CEOZgbPs.js → Cost-QoxyjR95.js} +1 -1
  44. package/dist/web/assets/{Data-COFRpcJn.js → Data-BAvkcBVt.js} +4 -4
  45. package/dist/web/assets/Desktop-BXdOIalN.js +1 -0
  46. package/dist/web/assets/DesktopReview-Bl2SrPP0.js +1 -0
  47. package/dist/web/assets/{Evidence-DTrdEz3M.js → Evidence-BJ_I52CD.js} +1 -1
  48. package/dist/web/assets/{Explore-DDXgQj5Q.js → Explore-D9AuyTip.js} +2 -2
  49. package/dist/web/assets/Features-CusGMDR9.js +1 -0
  50. package/dist/web/assets/Flags-CycGFuUP.js +2 -0
  51. package/dist/web/assets/Flaky-BcSzJogN.js +1 -0
  52. package/dist/web/assets/Impact-CJHnyZ21.js +3 -0
  53. package/dist/web/assets/Jobs-4xcFzEFo.js +5 -0
  54. package/dist/web/assets/KindPage-BielEIej.js +6 -0
  55. package/dist/web/assets/Migration-NwanKpJg.js +2 -0
  56. package/dist/web/assets/PageAgent-CNw4NXva.js +1 -0
  57. package/dist/web/assets/Product-DS3LJZ4P.js +7 -0
  58. package/dist/web/assets/Production-D3zsyNIS.js +1 -0
  59. package/dist/web/assets/{Quality-DgNo4H0u.js → Quality-Ctj2YpC4.js} +1 -1
  60. package/dist/web/assets/{Readiness--GiTxFZo.js → Readiness-DGcRr_co.js} +1 -1
  61. package/dist/web/assets/Record-Cc-wGe_Y.js +1 -0
  62. package/dist/web/assets/Regression-DcsbrRa1.js +5 -0
  63. package/dist/web/assets/{Reports-C-NSlVAn.js → Reports-BkCn0-Sf.js} +2 -2
  64. package/dist/web/assets/Response-BP0UwQcW.js +9 -0
  65. package/dist/web/assets/Responsive-C8U7dumd.js +3 -0
  66. package/dist/web/assets/{RunDiff-CIdQD95y.js → RunDiff-BhABuhF_.js} +1 -1
  67. package/dist/web/assets/Runs-OwdWEYBv.js +2 -0
  68. package/dist/web/assets/Steps-BvzbQyoD.js +2 -0
  69. package/dist/web/assets/{TestCases-D-ZRb2N7.js → TestCases-CLq_6JA5.js} +1 -1
  70. package/dist/web/assets/{TestData-kXWCn7uZ.js → TestData-B0oKAhp6.js} +2 -2
  71. package/dist/web/assets/TestDebt-8NLQ5YV_.js +1 -0
  72. package/dist/web/assets/TestManagement-2LYQ7vsN.js +1 -0
  73. package/dist/web/assets/Tosca-DfvMpPTG.js +3 -0
  74. package/dist/web/assets/{WhatsNew-DpJWNec7.js → WhatsNew-BGFNGwqN.js} +1 -1
  75. package/dist/web/assets/families-DYlN5v0i.js +1 -0
  76. package/dist/web/assets/filters-faaSnoIq.js +1 -0
  77. package/dist/web/assets/{fold-BRxvbN9r.js → fold-CUjwWAK3.js} +1 -1
  78. package/dist/web/assets/frame-BLPdAXUq.js +13 -0
  79. package/dist/web/assets/head-CsTxBsO0.js +1 -0
  80. package/dist/web/assets/index-CxiCvGZq.js +78 -0
  81. package/dist/web/assets/index-dOIsrzhD.css +2 -0
  82. package/dist/web/assets/line-icons-CwZWt93L.js +1 -0
  83. package/dist/web/assets/logos-dGuc1jIM.js +1 -0
  84. package/dist/web/assets/{markdown-CWisJbSJ.js → markdown-BI3F-SJ1.js} +5 -5
  85. package/dist/web/assets/paletteCommands-QJiCuUEr.js +1 -0
  86. package/dist/web/assets/parts-CdF1f7yS.js +1 -0
  87. package/dist/web/assets/{productParts-BxdHuSBa.js → productParts-hNLD9fN0.js} +1 -1
  88. package/dist/web/assets/qualityParts-CT25lBWU.js +1 -0
  89. package/dist/web/assets/{recordTest-CcplpTS6.js → recordTest-P792aBUt.js} +1 -1
  90. package/dist/web/index.html +6 -6
  91. package/docs/ForgeQE-Client-Overview.pdf +0 -0
  92. package/docs/ForgeQE-Installation-Guide.pdf +0 -0
  93. package/docs/MOBILE.md +42 -7
  94. package/docs/user-guide.html +65 -12
  95. package/package.json +1 -1
  96. package/prompts/brain.md +1 -0
  97. package/prompts/responsive-review.md +38 -0
  98. package/prompts/responsive-split.md +40 -0
  99. package/prompts/responsive.md +42 -0
  100. package/py/forgeqe_data/connect.py +3 -1
  101. package/py/forgeqe_data/flows.py +1 -1
  102. package/py/forgeqe_data/service.py +1 -1
  103. package/py/forgeqe_data/streams.py +1 -1
  104. package/py/forgeqe_data/testdata.py +1 -1
  105. package/py/forgeqe_desktop/replay.py +43 -1
  106. package/py/forgeqe_desktop/service.py +2 -0
  107. package/py/forgeqe_desktop/workflow.py +77 -15
  108. package/py/forgeqe_engine/brand.py +1 -1
  109. package/py/forgeqe_engine/browser.py +2 -1
  110. package/py/forgeqe_engine/diagnostics.py +1 -1
  111. package/py/forgeqe_engine/memory.py +2 -1
  112. package/py/forgeqe_engine/neutral_log.py +1 -1
  113. package/py/forgeqe_engine/otp.py +127 -12
  114. package/py/forgeqe_engine/pwlaunch.mjs +1 -1
  115. package/py/forgeqe_engine/recordsession.py +13 -3
  116. package/py/forgeqe_engine/webrecord.py +20 -0
  117. package/py/forgeqe_mobile/appium_driver.py +225 -10
  118. package/py/forgeqe_mobile/locators.py +277 -0
  119. package/py/forgeqe_mobile/maestro.py +28 -1
  120. package/py/forgeqe_mobile/magiclink.py +79 -0
  121. package/py/forgeqe_mobile/record.py +284 -67
  122. package/py/forgeqe_mobile/service.py +9 -0
  123. package/py/forgeqe_mobile/webview.py +142 -0
  124. package/py/forgeqe_tosca/ntir.py +45 -6
  125. package/dist/docs-site/LICENSE.ubuntu.txt +0 -96
  126. package/dist/docs-site/img/icons/api.svg +0 -1
  127. package/dist/docs-site/img/icons/architecture.svg +0 -1
  128. package/dist/docs-site/img/icons/branch.svg +0 -1
  129. package/dist/docs-site/img/icons/browser-agent.svg +0 -1
  130. package/dist/docs-site/img/icons/case.svg +0 -1
  131. package/dist/docs-site/img/icons/container.svg +0 -1
  132. package/dist/docs-site/img/icons/context-engine.svg +0 -1
  133. package/dist/docs-site/img/icons/desktop.svg +0 -1
  134. package/dist/docs-site/img/icons/download.svg +0 -1
  135. package/dist/docs-site/img/icons/explorer.svg +0 -1
  136. package/dist/docs-site/img/icons/feature.svg +0 -1
  137. package/dist/docs-site/img/icons/healer.svg +0 -1
  138. package/dist/docs-site/img/icons/knowledge-base.svg +0 -1
  139. package/dist/docs-site/img/icons/mail.svg +0 -1
  140. package/dist/docs-site/img/icons/mobile.svg +0 -1
  141. package/dist/docs-site/img/icons/model.svg +0 -1
  142. package/dist/docs-site/img/icons/network.svg +0 -1
  143. package/dist/docs-site/img/icons/orchestrator.svg +0 -1
  144. package/dist/docs-site/img/icons/plug.svg +0 -1
  145. package/dist/docs-site/img/icons/pr-reviewer.svg +0 -1
  146. package/dist/docs-site/img/icons/replay.svg +0 -1
  147. package/dist/docs-site/img/icons/report.svg +0 -1
  148. package/dist/docs-site/img/icons/result.svg +0 -1
  149. package/dist/docs-site/img/icons/rule.svg +0 -1
  150. package/dist/docs-site/img/icons/scribe.svg +0 -1
  151. package/dist/docs-site/img/icons/shield.svg +0 -1
  152. package/dist/docs-site/img/icons/specs.svg +0 -1
  153. package/dist/docs-site/img/icons/speed.svg +0 -1
  154. package/dist/docs-site/img/icons/stories.svg +0 -1
  155. package/dist/docs-site/img/icons/terminal.svg +0 -1
  156. package/dist/docs-site/img/icons/test-finder.svg +0 -1
  157. package/dist/docs-site/img/icons/visual.svg +0 -1
  158. package/dist/docs-site/img/icons/web.svg +0 -1
  159. package/dist/docs-site/img/icons/wikis.svg +0 -1
  160. package/dist/web/assets/Agent-MlW7cfAm.js +0 -7
  161. package/dist/web/assets/ApiTests-mxUkUZvv.js +0 -10
  162. package/dist/web/assets/Browse-DENLuv4C.js +0 -2
  163. package/dist/web/assets/Chat-jxak1jci.js +0 -3
  164. package/dist/web/assets/Desktop-DGNdy7iS.js +0 -1
  165. package/dist/web/assets/DesktopReview-SdAwvi9y.js +0 -1
  166. package/dist/web/assets/Features-BM5iXhOR.js +0 -1
  167. package/dist/web/assets/Flags-CkKp4bbv.js +0 -2
  168. package/dist/web/assets/Flaky-BqUHVLao.js +0 -1
  169. package/dist/web/assets/Impact-CA6s3POt.js +0 -3
  170. package/dist/web/assets/Jobs-B59p1qvn.js +0 -5
  171. package/dist/web/assets/KindPage-DPADNnwH.js +0 -6
  172. package/dist/web/assets/Migration-DtynahwR.js +0 -2
  173. package/dist/web/assets/PageAgent-CB8HtdGd.js +0 -1
  174. package/dist/web/assets/Product-wWMz2Nnk.js +0 -7
  175. package/dist/web/assets/Production-Nst6__N7.js +0 -1
  176. package/dist/web/assets/Record-a4whC1jV.js +0 -1
  177. package/dist/web/assets/Regression-hesOlN4G.js +0 -5
  178. package/dist/web/assets/RelationGraph-C3Re0M1N.js +0 -1
  179. package/dist/web/assets/Response-CzX2rQEZ.js +0 -9
  180. package/dist/web/assets/Runs-DIDCOhbK.js +0 -2
  181. package/dist/web/assets/Steps-BOWDBzu4.js +0 -2
  182. package/dist/web/assets/TestDebt-BvP3w7ye.js +0 -1
  183. package/dist/web/assets/TestManagement-CphGo9DZ.js +0 -1
  184. package/dist/web/assets/Tosca-dhFuqYxV.js +0 -3
  185. package/dist/web/assets/agentTabs-BO5l3zw2.js +0 -1
  186. package/dist/web/assets/dataParts-DeUdfjjv.js +0 -3
  187. package/dist/web/assets/diff-D1_Qo2h1.js +0 -2
  188. package/dist/web/assets/families-DWilSDct.js +0 -1
  189. package/dist/web/assets/filters-CVzIOjPG.js +0 -1
  190. package/dist/web/assets/frame-VTMu7MoC.js +0 -13
  191. package/dist/web/assets/index-CKRa-K2y.css +0 -2
  192. package/dist/web/assets/index-nuLrB-Rb.js +0 -69
  193. package/dist/web/assets/line-icons-C_amZ5-o.js +0 -1
  194. package/dist/web/assets/logos-J6txZkKc.js +0 -1
  195. package/dist/web/assets/paletteCommands-BmYmp6YY.js +0 -1
  196. package/dist/web/assets/parts-CDBCk_Xz.js +0 -1
  197. package/dist/web/assets/qualityParts-CGKSK9Dq.js +0 -1
  198. package/dist/web/assets/rows-yPc39hV7.js +0 -1
@@ -1,9 +0,0 @@
1
- import{At as e,B as t,Dt as n,E as r,Et as i,Ir as a,Kn as o,Mr as s,Nr as c,Nt as l,Q as u,Rn as d,Un as f,Wn as p,Xn as m,Y as h,_t as g,bn as _,fr as v,ht as y,in as b,j as ee,mt as te,nt as ne,o as re,or as ie,pt as ae,qn as oe,rn as se,un as ce,w as x,xt as S,zr as le}from"./line-icons-C_amZ5-o.js";import{$t as ue,H as C,V as w,c as de,g as T,h as fe,v as pe,z as E}from"./filters-CVzIOjPG.js";import{Bn as D,Bt as O,Gt as k,Ht as A,On as j,Pn as M,Wt as N,_ as me,b as P,bn as he,h as ge,p as F,x as _e,y as ve}from"./frame-VTMu7MoC.js";import{a as ye,i as I,n as L,r as R}from"./markdown-CWisJbSJ.js";import{t as z}from"./diff-D1_Qo2h1.js";import{t as be}from"./fold-BRxvbN9r.js";var B=le(a(),1),V=ue();function H({review:e,className:t}){return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,V.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{className:w(`mt-px flex-none rounded-full px-2 py-px text-[13px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.file&&(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,V.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,V.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var xe={done:`border-pass/35`,active:`border-accent/35`,pending:`border-line-strong`,failed:`border-fail/35`,skipped:`border-line-strong`,note:`border-line-strong`};function U({status:e,orb:t,px:n=20,spin:r=!1}){let i={width:n,height:n};return e===`active`&&r?(0,V.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:i,children:(0,V.jsx)(b,{size:n-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,V.jsx)(fe,{state:t,px:n,label:`At work`}):e===`done`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:i,children:(0,V.jsx)(x,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:i,children:(0,V.jsx)(c,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:i,children:(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,V.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:w(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:i})}var Se=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Ce={read:g,search:p,list:i,edit:te,run:v,element:u,outline:se,references:e,impact:_,find:y,testfile:S,web:l,environment:oe,cases:t,browser:l,post:o,test:S,retry:d,review:m,task:n,work:s},we={done:`text-pass`,failed:`text-fail`,active:`text-accent-fg animate-pulse motion-reduce:animate-none`,pending:`text-muted`,skipped:`text-muted`,note:`text-muted`},W={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function Te({kind:e,status:t}){let n=w(`mt-px flex size-4 flex-none items-center justify-center`,we[t]);if(e===`skill`)return(0,V.jsxs)(`span`,{role:`img`,"aria-label":W[t],className:w(n,`relative`),children:[(0,V.jsx)(pe,{name:he.skills,px:15}),(t===`done`||t===`failed`)&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:w(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=Ce[e];return(0,V.jsx)(`span`,{role:`img`,"aria-label":W[t],className:n,children:(0,V.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function Ee({status:e}){return e===`active`?(0,V.jsx)(b,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,V.jsx)(`span`,{role:`img`,"aria-label":W[e],className:w(`mt-2 size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function G({text:e,label:t}){let[n,r]=(0,B.useState)(!1);return(0,V.jsx)(`button`,{type:`button`,"aria-label":n?`Copied`:t,"data-tip":n?`Copied`:t,onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}},className:`flex size-6 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted opacity-0 group-hover:opacity-100 hover:bg-surface-strong hover:text-ink focus-visible:opacity-100`,children:n?(0,V.jsx)(x,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(h,{size:13,"aria-hidden":`true`})})}function De({step:e,failed:t}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 py-1 font-mono text-[13px] leading-relaxed`,children:[e.command&&(0,V.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,V.jsx)(G,{text:e.command,label:`Copy the command`})]}),e.output&&(0,V.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,V.jsx)(`pre`,{className:w(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[13px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,V.jsx)(G,{text:e.output,label:`Copy the output`})]}),e.shell?.exit!==void 0&&e.shell.exit!==0&&(0,V.jsxs)(`span`,{className:`text-fail`,children:[`Exit code `,e.shell.exit]})]})}var Oe=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function K({text:e}){return(0,V.jsx)(`span`,{className:w(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-2 py-1 text-[13px] text-ink-2`,Oe(e)&&`font-mono text-[13px]`),children:e})}function ke(e){return{count:e.length,failed:e.filter(e=>e.ok===!1).length,latest:e[e.length-1]}}function q({line:e}){return(0,V.jsxs)(`li`,{className:w(`flex gap-2 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,V.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,V.jsx)(R,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]})}function Ae({step:e}){let[t,n]=(0,B.useState)(!1),i=e.lines.length>3&&!t,{count:a,failed:o,latest:s}=ke(e.lines);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.lines.length>3&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`flex w-fit cursor-pointer items-center gap-1 rounded-md border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink-2`,children:[(0,V.jsxs)(`span`,{children:[t?`Hide`:`Show`,` `,a,` lines`,o>0&&(0,V.jsxs)(`span`,{className:`text-fail`,children:[` · `,o,` failed`]})]}),(0,V.jsx)(r,{size:13,"aria-hidden":`true`,className:w(`transition-transform`,t&&`rotate-180`)})]}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:i?s&&(0,V.jsx)(q,{line:s}):e.lines.map((e,t)=>(0,V.jsx)(q,{line:e},t))})]})}function J({agent:e,named:t=!0,working:n=!1,state:r,orb:i}){let a=M(e),o=N(e);return(0,V.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-2`,"data-tip":a.name,children:[(0,V.jsx)(A,{agent:e,px:24,decorative:t,working:n,state:r,activity:n?k(i):void 0}),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`font-medium`,style:{color:o},children:a.name}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}var Y=e=>e===`active`?`thinking`:e===`failed`?`failed`:e===`done`?`done`:`idle`;function X({step:e,from:t,to:n,live:r}){let i=M(n),a=N(n),o=r?`thinking`:e.status===`fail`?`failed`:e.status===`ok`?`done`:`idle`,s=[...e.children??[]].reverse().find(e=>e.status===`running`)?.orb??(e.orb===`handing`?void 0:e.orb);return(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(A,{agent:t,px:24,activity:r?`handing`:void 0}),(0,V.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:w(`handoff-flow flex-none`,r&&`is-live`),style:{color:a},children:[(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{})]}),(0,V.jsx)(A,{agent:n,px:28,decorative:!0,state:o,activity:r?k(s):void 0,className:`handoff-in`}),(0,V.jsx)(`span`,{className:`font-medium`,style:{color:a},children:i.name}),!e.handoff&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`}),(0,V.jsx)(`span`,{className:w(`[overflow-wrap:anywhere]`,r?`text-ink`:`text-ink-2`),children:e.label})]}),e.arg&&(0,V.jsx)(K,{text:e.arg})]})}function je({step:e,working:t,from:n=j}){let i=e.agent||n,a=Me(e),o=Se(e,t),[s,c]=(0,B.useState)(null),l=s??((!!e.handoff||!!e.agent||!!e.shell||e.key.startsWith(`try:`))&&o===`active`),u=(0,V.jsxs)(V.Fragment,{children:[e.handoff||i!==n?(0,V.jsx)(U,{status:o,orb:e.orb,px:14,spin:!0}):!e.icon&&(0,V.jsx)(Ee,{status:o}),e.handoff||i!==n?(0,V.jsx)(X,{step:e,from:n,to:e.handoff?.agent??i,live:o===`active`}):(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[e.icon?(0,V.jsx)(Te,{kind:e.icon,status:o}):(0,V.jsx)(J,{agent:i,named:!1,working:o===`active`,state:Y(o),orb:e.orb}),(0,V.jsx)(`span`,{className:w(`[overflow-wrap:anywhere]`,o===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,V.jsx)(K,{text:e.arg}),e.change&&(0,V.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),a&&(0,V.jsx)(r,{size:14,"aria-hidden":`true`,className:w(`mt-1 ml-auto flex-none text-muted transition-transform`,l&&`rotate-180`)})]});return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[a?(0,V.jsx)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>c(!l),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-2 py-2 text-left text-[13px] hover:bg-surface-muted`,children:u}):(0,V.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-2 py-2 text-[13px]`,children:u}),a&&(0,V.jsx)(O,{open:l,children:(0,V.jsx)(Ne,{step:e,working:t,from:n,className:`mb-1 ml-4`})})]})}var Me=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function Ne({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-2 border-l border-dotted py-1 pl-4`,r),style:{borderColor:a?`${M(a).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,V.jsx)(De,{step:e,failed:e.status===`fail`}),e.review&&(0,V.jsx)(H,{review:e.review}),e.lines.length>0&&(0,V.jsx)(Ae,{step:e}),e.change&&(0,V.jsx)(z,{diff:e.change.diff}),i.length>0&&(0,V.jsx)(`ul`,{"aria-label":a?`What ${D(M(a).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,V.jsx)(je,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,V.jsxs)(`span`,{className:`text-muted`,children:[D(M(e.handoff.agent).name,!0),` answered`]}),(0,V.jsx)(R,{text:e.handoff.result.length>1200?`${e.handoff.result.slice(0,1199)}…`:e.handoff.result,className:`text-[13px] text-ink-2 [&_p]:my-0`})]})]})}function Pe({node:e,last:t,working:n,now:i,orbed:a}){let o=e.step?[]:e.steps,s=e.step,c=o.length>0||!!i||!!s&&Me(s),[l,u]=(0,B.useState)(null),d=l??(e.status===`active`||e.status===`failed`),f=s?.orb??[...o].reverse().find(e=>e.status===`running`)?.orb??i?.orb??`thinking`;return(0,V.jsxs)(`li`,{className:`flex gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,V.jsx)(`span`,{className:`mt-1`,children:(0,V.jsx)(U,{status:e.status,orb:f,spin:!a})}),!t&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:w(`mt-2 min-h-4 w-0 flex-1 border-l border-dotted`,xe[e.status])})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[c?(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>u(!d),className:`flex min-h-7 w-full cursor-pointer items-start gap-2 border-0 bg-transparent p-0 text-left`,children:[(0,V.jsx)(Fe,{node:e,orb:f}),(0,V.jsx)(r,{size:14,"aria-hidden":`true`,className:w(`mt-1 flex-none text-muted transition-transform`,d&&`rotate-180`)}),e.status===`active`&&(0,V.jsx)(`span`,{className:`mt-1 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[13px] font-medium text-accent-fg`,children:`In progress`})]}):(0,V.jsx)(`div`,{className:`min-h-7`,children:(0,V.jsx)(Fe,{node:e,orb:f})}),c&&(0,V.jsx)(O,{open:d,className:`mt-1`,children:s?(0,V.jsx)(Ne,{step:s,working:n,from:`forgeqe`,className:`mt-1`}):(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[o.map(e=>(0,V.jsx)(je,{step:e,working:n},e.key)),i&&(0,V.jsx)(`li`,{children:(0,V.jsx)(Z,{live:i,className:`px-2`})})]})})]})]})}function Fe({node:e,orb:t}){let n=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,r=e.step;return r?.handoff||r?.agent&&r.agent!==`forgeqe`?(0,V.jsx)(X,{step:r,from:j,to:r.handoff?.agent??r.agent,live:e.status===`active`}):(0,V.jsxs)(`span`,{className:w(`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm font-medium`,n,e.status===`skipped`&&`line-through`),children:[r&&(0,V.jsx)(J,{agent:r.agent||`forgeqe`,named:!!r.agent&&r.agent!==`forgeqe`,working:e.status===`active`,state:Y(e.status),orb:t}),e.status===`active`?(0,V.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,V.jsx)(`span`,{children:e.label})}):(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),r?.arg&&(0,V.jsx)(K,{text:r.arg})]})}var Ie={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink-2`,you:`text-accent-fg`,think:`text-muted italic`};function Le(e){let[t,n]=(0,B.useState)(()=>Date.now());(0,B.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?`${i}s ago`:`${Math.floor(i/60)} min ago`}function Z({live:e,orb:t=!1,className:n}){let r=Le(e.latest?.at);return(0,V.jsxs)(`div`,{className:w(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,V.jsx)(`span`,{className:`mt-1 flex size-4 flex-none items-center justify-center`,children:t?(0,V.jsx)(fe,{state:e.orb,px:20,label:`At work`}):(0,V.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,V.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,V.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`shimmer text-[13px] font-medium text-muted`,children:(0,V.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,V.jsxs)(`button`,{type:`button`,onClick:e.onLog,"data-tip":`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,V.jsx)(`span`,{className:w(`min-w-0 truncate font-mono text-[13px]`,Ie[e.latest.tone]),children:e.latest.plain}),(0,V.jsxs)(`span`,{className:`flex-none text-[13px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Re({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,V.jsx)(Z,{live:n,orb:!0});let i=ge(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=[...i].reverse().find(e=>e.status===`active`);return(0,V.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,V.jsx)(`li`,{className:`flex gap-4`,children:(0,V.jsx)(Z,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,V.jsx)(Pe,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var ze={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function Q({label:e,children:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,V.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function Be({text:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,V.jsx)(T,{icon:ie,size:14,className:`mt-1 flex-none text-muted`}),(0,V.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,V.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,"data-tip":t?`Copied`:`Copy the command`,onClick:async()=>{await ye(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,V.jsx)(x,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(h,{size:14,"aria-hidden":`true`})})]})}function Ve(e){if(e.runs===void 0)return e.attempts===void 0?``:C(e.attempts,`attempt`);let t=`${C(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${C(e.reviews,`review`)}`:t}function He({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function Ue({t:e}){let t=Ve(e);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(S,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,V.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,V.jsx)(de,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:ze[e.status]||e.status||`Not written`}),t&&(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,V.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-4`,children:[(e.testFile||e.testName)&&(0,V.jsx)(Q,{label:`Test`,children:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,V.jsx)(L,{path:e.testFile}),e.testName&&(0,V.jsx)(He,{name:e.testName})]})}),e.command&&(0,V.jsx)(Q,{label:`Run it`,children:(0,V.jsx)(Be,{text:e.command})}),e.review&&(0,V.jsx)(Q,{label:e.review.approved?`Review`:`Review asked`,children:(0,V.jsx)(H,{review:e.review})}),e.runDir&&(0,V.jsx)(Q,{label:`From the run`,children:(0,V.jsx)(L,{path:e.runDir})}),e.reused.length>0&&(0,V.jsx)(Q,{label:`Reused`,children:(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,V.jsx)(`li`,{className:`min-w-0`,children:(0,V.jsx)(L,{path:e})},e))})})]}),e.error&&(0,V.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function We({c:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the changes to ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>n(!t),className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,V.jsx)(r,{size:15,"aria-hidden":`true`,className:w(`transition-transform`,!t&&`-rotate-90`)})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,V.jsx)(L,{path:e.path})}),(0,V.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,V.jsx)(O,{open:t,children:(0,V.jsx)(z,{diff:e.diff,className:`mb-2 ml-10`})})]})}function Ge({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),r=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!r.length?null:(0,V.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 border-t border-line-soft pt-4`,children:[e.tests.map((e,t)=>(0,V.jsx)(Ue,{t:e},t)),t.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,V.jsx)(L,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-4`),children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,V.jsx)(ae,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,V.jsxs)(`span`,{className:`font-normal text-muted`,children:[C(e.changes.length+r.length,`file`),e.changes.length>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,V.jsx)(We,{c:e},e.path)),r.map(e=>(0,V.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-10`,children:(0,V.jsx)(L,{path:e})},e))]})]})]})}var Ke=/^\s*(?:[-*>]\s*)?(?:\*\*|__)?\s*(?:sources?|evidence|references?|refs?)\s*(?:\*\*|__)?\s*:/i;function qe(e){let t=[],n=[],r=!1;for(let i of e.split(`
2
- `))/^\s*(```|~~~)/.test(i)&&(r=!r),!r&&Ke.test(i)?n.push(i.trim()):t.push(i);return{body:t.join(`
3
- `).replace(/\n{3,}/g,`
4
-
5
- `).trimEnd(),sources:n.join(`
6
-
7
- `)}}var Je=1.5;function Ye(e,t){if(e>=t)return t;let n=t-e;return Math.min(t,e+Math.max(Je,n/45))}function Xe(e,t){return Math.min(Math.floor(t),e.length)}var Ze=()=>typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;function Qe(e,t){let n=(0,B.useRef)(t);t&&(n.current=!0);let r=n.current&&!Ze(),[i,a]=(0,B.useState)(()=>r?0:e.length),o=(0,B.useRef)(i),s=(0,B.useRef)(e);s.current!==e&&(o.current=Xe(e,o.current),s.current=e),r||(o.current=e.length),(0,B.useEffect)(()=>{if(!r||o.current>=e.length){a(o.current);return}let t=0,n=()=>{o.current=Ye(o.current,e.length),a(o.current),o.current<e.length&&(t=requestAnimationFrame(n))};return t=requestAnimationFrame(n),()=>cancelAnimationFrame(t)},[e,r]);let c=Math.min(Math.floor(r?i:e.length),e.length);return{shown:e.slice(0,c),typing:c<e.length}}var $e={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink`,you:`text-accent-fg`,think:`text-muted italic`};function et({line:e,start:t}){let[n,r]=(0,B.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,V.jsxs)(`li`,{className:`mt-4 flex items-baseline gap-4 border-b border-line-soft pb-1 first:mt-0`,children:[(0,V.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:P(t,e.at)}),(0,V.jsx)(R,{text:e.md,className:w(`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`,I)})]}):(0,V.jsxs)(`li`,{className:w(`flex items-baseline gap-4 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,V.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:P(t,e.at)}),e.kind===`out`?(0,V.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,V.jsx)(`button`,{type:`button`,disabled:!i,"aria-expanded":i?n:void 0,onClick:()=>r(!n),"data-tip":i&&!n?`Show all of it`:void 0,className:w(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,V.jsx)(R,{text:e.md,className:w(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[13px] [&_p]:my-0`,I,$e[e.tone],i&&!n&&`line-clamp-2`)})})]})}function $({lines:e,start:t,live:n,name:r,timeline:i=!1}){let a=(0,B.useRef)(null),o=(0,B.useRef)(!0),[s,c]=(0,B.useState)(!1),l=(0,B.useMemo)(()=>ve(e,t),[e,t]);(0,B.useEffect)(()=>{o.current&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[l]);let u=`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,V.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{className:`flex-1`,children:[i?``:`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,V.jsx)(`button`,{type:`button`,"aria-label":s?`Copied`:`Copy the activity log as Markdown`,"data-tip":s?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(l),c(!0),setTimeout(()=>c(!1),1500)}catch{}},className:u,children:s?(0,V.jsx)(x,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(h,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,"data-tip":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([l],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=r,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:u,children:(0,V.jsx)(T,{icon:ne,size:14})})]}),(0,V.jsx)(`div`,{ref:a,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:w(`overflow-y-auto py-2`,i?`max-h-[calc(var(--screen)-260px)] min-h-[320px]`:`max-h-[360px] border-b border-line-soft`),children:i?(0,V.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,n)=>(0,V.jsx)(et,{line:e,start:t},n))}):(0,V.jsx)(R,{text:l,className:w(`text-[13px] leading-[1.6] [&_code]:text-[13px] [&_h4]:mt-4 [&_h4]:mb-1 [&_h6]:mt-4 [&_h6]:mb-1 [&_h6]:text-ink [&_li]:my-1 [&_pre]:text-[13px] [&_ul]:my-1`,I)})})]})}function tt({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-4`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(ce,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,V.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,V.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,V.jsx)(E,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,V.jsxs)(E,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:[(0,V.jsx)(c,{"aria-hidden":`true`}),`Cancel`]})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function nt({wait:e,live:t,onProceed:n}){let r=t&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:w(`flex flex-col gap-4`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,V.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(ee,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),r?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(E,{size:`sm`,variant:`primary`,"data-tip":`Done, continue`,onClick:()=>n(!0),children:[(0,V.jsx)(re,{"aria-hidden":`true`}),`Continue`]}),(0,V.jsxs)(E,{size:`sm`,onClick:()=>n(!1),children:[(0,V.jsx)(c,{"aria-hidden":`true`}),`Cancel`]})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function rt(e,t){let[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(t);return(0,B.useEffect)(()=>{let n=t>i.current;if(i.current=t,!e||!n)return void(e||r(!1));r(!0);let a=setTimeout(()=>r(!1),900);return()=>clearTimeout(a)},[e,t]),n}function it({turn:e,live:t,onAnswer:n,onProceed:i}){let a=t&&!e.outcome,[o,s]=(0,B.useState)(null),c=o??a,l=F(e),u=a?l.text:me(e),d=e.parts.map(e=>_e(e.text)).filter(Boolean),p=Qe(e.outcome&&e.reply?e.reply:d.join(`
8
-
9
- `),a),m=(0,B.useMemo)(()=>qe(p.shown),[p.shown]),h=rt(a,d.reduce((e,t)=>e+t.length,0)),g=p.typing||h,[_,v]=(0,B.useState)(!1),y=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,V.jsxs)(`div`,{className:`flex gap-4`,children:[(0,V.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,V.jsx)(A,{agent:`forgeqe`,px:34,working:a,state:g?`speaking`:a?`thinking`:e.outcome===`done`?`done`:e.outcome===`failed`?`failed`:`idle`,activity:a&&!g?k(F(e).orb):void 0,className:`mt-1`})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 pt-2`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":c,disabled:!e.steps.length&&!e.plan.length,onClick:()=>s(!c),className:w(`flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,V.jsx)(`span`,{"aria-live":`polite`,children:u}),(e.steps.length>0||e.plan.length>0)&&(0,V.jsx)(r,{size:16,"aria-hidden":`true`,className:w(`transition-transform`,c&&`rotate-180`)})]}),e.log.length>0&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":_,onClick:()=>v(!_),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,V.jsx)(T,{icon:f,size:14}),`Activity log`,(0,V.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,V.jsx)(O,{open:(c||a)&&(e.steps.length>0||e.plan.length>0||a),children:(0,V.jsx)(Re,{turn:e,working:a,folded:!c,live:{...l,latest:y,events:e.log.length,onLog:()=>v(!0)}})}),(0,V.jsx)(O,{open:_,children:(0,V.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,V.jsx)(tt,{ask:e,live:a,onAnswer:t=>n(e.id,t)},e.id)),e.waits.map(e=>(0,V.jsx)(nt,{wait:e,live:a,onProceed:t=>i(e.id,t)},e.id)),m.body&&(0,V.jsx)(R,{text:m.body,className:w((p.typing||a)&&`typing-caret`)}),m.sources&&!p.typing&&!a&&(0,V.jsx)(be,{title:`Sources`,children:(0,V.jsx)(R,{text:m.sources,className:`text-muted`})}),(0,V.jsx)(Ge,{turn:e}),e.error&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{it as n,Be as r,$ as t};
@@ -1,2 +0,0 @@
1
- import{E as e,In as t,Ir as n,M as r,Mr as i,N as a,Nr as o,O as s,Pt as c,Qt as l,R as u,Rn as d,W as f,Wn as p,a as m,an as h,ar as g,b as _,ct as v,dn as y,er as b,fr as x,k as S,kt as C,nr as w,or as ee,p as T,st as E,v as D,xt as O,yt as k,zr as te}from"./line-icons-C_amZ5-o.js";import{$t as ne,B as re,H as A,V as j,c as M,f as ie,g as N,i as ae,l as oe,n as se,o as ce,p as P,st as le,t as ue,u as de,z as fe,zt as pe}from"./filters-CVzIOjPG.js";import{Bt as me,F,Kt as he,N as ge,Pn as _e,at as ve,bn as ye,bt as be,it as xe,o as Se,ot as Ce,rt as I,t as we,v as Te,x as Ee}from"./frame-VTMu7MoC.js";import{i as De,n as L,r as R}from"./markdown-CWisJbSJ.js";import{_ as Oe,i as ke,r as Ae}from"./index-nuLrB-Rb.js";import{r as je,t as Me}from"./Response-CzX2rQEZ.js";import{r as Ne}from"./families-DWilSDct.js";var z=te(n(),1),B=ne(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Pe={execution:O,report:E,coding:f,chat:y};function Fe({kind:e}){let t=Pe[e];return(0,B.jsx)(N,{icon:t,size:14,className:`flex-none text-muted`})}var Ie={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},H=e=>Ie[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},Le={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Re=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function U({title:e,icon:t,children:n,aside:r,className:i}){return(0,B.jsxs)(`section`,{className:j(`flex flex-col gap-4 border-t border-line-soft pt-6`,i),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function ze({path:e,label:t=`Report`}){let[n,r]=(0,z.useState)(``);return(0,B.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(fe,{"data-tip":`Open the report`,onClick:async()=>r(await de(e)),children:[(0,B.jsx)(v,{"aria-hidden":`true`}),t]}),n&&(0,B.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function W({items:t,first:n,render:r}){let[i,a]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(i?t:t.slice(0,n)).map(r),t.length>n&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(!i),className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[i?(0,B.jsx)(S,{size:14,"aria-hidden":`true`}):(0,B.jsx)(e,{size:14,"aria-hidden":`true`}),i?`Less`:`All (${t.length})`]})]})}function Be({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,B.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,B.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,B.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,B.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function Ve({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:[Le[e.scope]||e.scope,Re(e.ms),e.tokens?`${F(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,B.jsx)(ze,{path:e.report})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsxs)(`span`,{className:`text-[20px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(M,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(M,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(M,{tone:`warn`,children:[e.counts.other,` other`]}),(0,B.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,B.jsx)(Be,{c:e.counts}),e.cases.length>0&&(0,B.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(W,{items:[...e.cases].sort((e,t)=>Number(H(t.status).tone===`fail`)-Number(H(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,B.jsxs)(`li`,{className:`flex min-w-0 items-start gap-4 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(M,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-2 font-mono text-[13px] text-muted`,children:e.id}),e.title,e.device&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,B.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,B.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Re(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,B.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,B.jsx)(L,{path:e.folder})]})]})}function He({list:e,className:t}){let n=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,B.jsx)(U,{...t?{className:t}:{},title:`Execution summary`,icon:(0,B.jsx)(N,{icon:O,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[A(e.length,`run`),` · `,n.passed,` of `,n.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,B.jsx)(Ve,{e},`${e.folder||e.title}-${t}`)):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function Ue({list:e,className:t}){return(0,B.jsxs)(U,{...t?{className:t}:{},title:`Report summary`,icon:(0,B.jsx)(N,{icon:E,size:18}),children:[e.length===0&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,B.jsx)(ze,{path:e.path})]}),e.stats&&(0,B.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,B.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[13px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[20px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,B.jsx)(We,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function We({text:t,height:n=220}){let[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!0),[s,c]=(0,z.useState)(n),l=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{l.current&&!r&&o(l.current.scrollHeight>n+8)},[t,n,r]),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{ref:l,style:s===void 0?void 0:{maxHeight:s},onTransitionEnd:e=>e.target===e.currentTarget&&r&&c(void 0),className:j(`transition-[max-height] duration-200 ease-out`,s!==void 0&&`relative overflow-hidden`),children:[(0,B.jsx)(R,{text:t,className:j(`text-sm`,De)}),!r&&a&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(r||a)&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>{let e=l.current?.scrollHeight??n;if(i(!r),he())return c(r?n:void 0);c(e),r&&requestAnimationFrame(()=>requestAnimationFrame(()=>c(n)))},className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[r?(0,B.jsx)(S,{size:14,"aria-hidden":`true`}):(0,B.jsx)(e,{size:14,"aria-hidden":`true`}),r?`Less`:`More`]})]})}function Ge(e){let t=e.join(`
2
- `),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function Ke({e}){let[t,n]=(0,z.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,B.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-2 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>n(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,B.jsx)(s,{size:16,"aria-hidden":`true`,className:j(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:r}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})}),(0,B.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,B.jsx)(me,{open:t,className:`pb-4 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,B.jsx)(R,{text:Ge(e.diffs),className:De}):null})]})}var qe={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function G({label:e,children:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,B.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Je({c:e,files:t,className:n}){let r=e.edits.reduce((e,t)=>e+t.added,0),i=e.edits.reduce((e,t)=>e+t.removed,0),a=e.tests.filter(e=>!e.ok).length,o=e.reviews.at(-1),s=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,B.jsxs)(U,{...n?{className:n}:{},title:`Code changes`,icon:(0,B.jsx)(N,{icon:f,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[A(e.edits.length,`file`),` · `,(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,r]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,i]})]}):s.length?(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:A(s.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,i=t.status===`error`||t.status===`failed`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(O,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:i?`text-fail`:`text-warn`}),(0,B.jsx)(`span`,{className:`text-[16px] font-semibold`,children:r?`Test written`:i?`Test not finished`:H(t.status).label}),(0,B.jsx)(M,{tone:r?`pass`:i?`fail`:`warn`,children:H(t.status).label}),e.tests.length>0&&(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[A(e.tests.length,`test run`),a?` (${a} failed)`:``,e.reviews.length?` · ${A(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-4`,children:[t.testFile&&(0,B.jsx)(G,{label:`Test`,children:(0,B.jsx)(L,{path:t.testFile})}),t.command&&(0,B.jsx)(G,{label:`Run it`,children:(0,B.jsx)(je,{text:t.command})}),(t.review||o)&&(0,B.jsx)(G,{label:`Review`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(M,{tone:(t.review??o).approved?`pass`:`warn`,children:(t.review??o).approved?`Approved`:`Changes asked`})}),(t.review?.summary||o?.summary)&&(0,B.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||o?.summary})]})}),t.notes&&(0,B.jsx)(G,{label:`Notes`,children:(0,B.jsx)(R,{text:t.notes,className:j(`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`,`[&_p]:max-w-none [&_ul]:max-w-none [&_ol]:max-w-none [&_blockquote]:max-w-none [&_h1]:max-w-none [&_h2]:max-w-none [&_h3]:max-w-none [&_h4]:max-w-none [&_h5]:max-w-none [&_h6]:max-w-none`)})})]}),t.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(W,{items:e.edits,first:8,render:e=>(0,B.jsx)(Ke,{e},e.path)})})]}),s.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:s.map(e=>(0,B.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-4 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:qe[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})})]},e.path))}),(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!s.length&&!e.results.length&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function Ye({final:e,answer:t,className:n}){let r=e.from===`agent`?t?.files??[]:[],i=e.from!==`agent`,a=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),o="`".repeat(a+1);return(0,B.jsxs)(U,{...n?{className:n}:{},title:`Final message`,icon:(0,B.jsx)(k,{size:18,"aria-hidden":`true`}),aside:(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,B.jsx)(We,{text:i?`${o}text\n${e.text}\n${o}`:Ee(e.text),height:420}),r.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),r.map(e=>(0,B.jsx)(L,{path:e},e))]})]})}var Xe={rule:{icon:T,label:`Rulebook`},decision:{icon:C,label:`Test decisions`},memory:{icon:D,label:`Page memory`},replay:{icon:t,label:`Replays`},model:{icon:b,label:`Model`},skill:{icon:c,label:`Skills`}};function Ze({list:e,className:t}){let n=Object.keys(Xe).filter(t=>e.some(e=>e.kind===t));return(0,B.jsx)(U,{...t?{className:t}:{},title:`Learnings`,icon:(0,B.jsx)(N,{icon:l,size:18}),aside:e.length?(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-4`,children:n.map(t=>{let{icon:n,label:r}=Xe[t];return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,B.jsxs)(`h4`,{className:`m-0 flex items-center gap-2 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(N,{icon:n,size:14}),r]}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,B.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Qe({run:e,className:t}){let n=[],r=t?{className:t}:{};return(e.executions.length||e.kind===`execution`)&&n.push({kind:`execution`,node:(0,B.jsx)(He,{list:e.executions,...r},`e`)}),(e.reports.length||e.kind===`report`)&&n.push({kind:`report`,node:(0,B.jsx)(Ue,{list:e.reports,...r},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&n.push({kind:`coding`,node:(0,B.jsx)(Je,{c:e.coding,files:e.files,...r},`c`)}),n.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,B.jsx)(B.Fragment,{children:n.map(e=>e.node)})}var K={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},$e={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},et=e=>$e[e]||e.charAt(0).toUpperCase()+e.slice(1),tt=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},q=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),J=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,Y=e=>e.usage.input+e.usage.output;function nt(e){let[t,n]=(0,z.useState)(Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function rt({r:e}){return e.origin.kind===`web`?(0,B.jsxs)(`a`,{href:P(`chats`,e.origin.chat),className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(N,{icon:y,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,B.jsxs)(`a`,{href:P(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(N,{icon:_,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted`,children:[(0,B.jsx)(N,{icon:x,size:14}),`Terminal`]})}var it=e=>K[e].label;function at({status:e}){let t=K[e].label;return e===`running`?(0,B.jsx)(h,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,B.jsx)(r,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,B.jsx)(u,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,B.jsx)(a,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!Y(e)&&!e.files.length&&!e.outputs.length&&q(e,0)<2;function ot(e){return/^forgeqe(-|$)|^engine$/.test(e)?_e(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t,stacked:n=!1}){return n?(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]}):(0,B.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,B.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`h3`,{className:`m-0 mb-1 text-[13px] font-semibold`,children:e}),t]})}var st=8,ct=e=>e===`write`?`Written`:e===`edit`?`Edited`:e===`delete`?`Deleted`:e?e.charAt(0).toUpperCase()+e.slice(1):`Changed`;function lt({run:e,now:t,running:n,events:r}){let i=K[e.status],a=e.executions.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0}),o=e.coding?.results.at(-1),s=e.coding?.tests.length??0,c=e.coding?.tests.filter(e=>!e.ok).length??0,l=e.coding?.edits??[],u=l.reduce((e,t)=>e+t.added,0),d=l.reduce((e,t)=>e+t.removed,0),f=l.length||e.files.filter(e=>e.action&&e.action!==`read`).length;return(0,B.jsxs)(xe,{label:`How this run went`,children:[(0,B.jsx)(I,{compact:!0,label:`Outcome`,value:i.label,tone:i.tone===`fail`?`text-fail`:i.tone===`pass`?`text-pass`:void 0,...o?.attempts?{note:`attempt ${o.attempts}${o.maxAttempts?` of ${o.maxAttempts}`:``}`}:{}}),(0,B.jsx)(I,{label:n?`Running for`:`Took`,value:J(q(e,t)),...r?{note:A(r,`event`)}:{}}),a.total>0&&(0,B.jsx)(I,{label:`Cases`,value:`${a.passed}/${a.total}`,...a.failed?{tone:`text-fail`}:a.passed===a.total?{tone:`text-pass`}:{},note:`passed`}),s>0&&(0,B.jsx)(I,{label:`Test runs`,value:s,...c?{note:`${c} failed`}:{}}),f>0&&(0,B.jsx)(I,{label:`Files changed`,value:f,...u+d?{note:`+${u} −${d}`}:{}}),Y(e)>0&&(0,B.jsx)(I,{label:`Tokens`,value:F(Y(e)),note:`${F(e.usage.input)} in · ${F(e.usage.output)} out`})]})}var ut={rerun:d,write_test:g,investigate:p,fix_test:i},dt={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function ft({actions:e}){let[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await le.start(e.prompt,{});location.hash=P(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,B.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,B.jsxs)(fe,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,B.jsx)(N,{icon:ut[e.kind],size:16,className:`flex-none`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:dt[e.kind]}),e.note&&(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var pt=e=>`\`${e.replace(/`/g,``)}\``,mt=[`summary`,`conversation`,`activity`,`details`],ht=e=>mt.find(t=>t===e)??`summary`;function gt({name:e,tab:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),l=ht(t),u=t=>location.hash=t===`summary`?P(`runs`,encodeURIComponent(e)):P(`runs`,encodeURIComponent(e),t),d=(0,z.useCallback)(()=>{pe.detail(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);(0,z.useEffect)(d,[d]);let f=n?.status===`running`;(0,z.useEffect)(()=>{if(!f)return;let e=setInterval(d,2e3);return()=>clearInterval(e)},[d,f]);let p=nt(f),h=(0,z.useMemo)(()=>(n?.events??[]).map(Te).filter(e=>!!e),[n?.events]),g=async()=>{c(!0),a(``);try{await pe.cancel(e),d()}catch(e){a(e.message)}finally{c(!1)}},_=(0,B.jsxs)(`a`,{href:P(`runs`),className:`inline-flex items-center gap-2 text-sm`,children:[(0,B.jsx)(m,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_,i?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:i}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let v=K[n.status],y=!n.replies.length,b=!!n.final||n.executions.length>0||n.reports.length>0||!!(n.coding&&(n.coding.edits.length||n.coding.results.length))||n.learnings.length>0||n.outputs.length>0||n.files.length>0,x=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],S=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),C=n.outputs.filter(e=>!S.has(e.path)),ee=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null,T=C.length>0||n.files.length>0?`@3xl:col-span-3`:`@3xl:col-span-4`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[_,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[20px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,B.jsx)(M,{tone:v.tone,children:v.label})]}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(Fe,{kind:n.kind}),V[n.kind]]}),`· `,(0,B.jsx)(rt,{r:n}),`· `,tt(n.startedAt),` · `,f?`running for `:`took `,J(q(n,p)),` · `,F(Y(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,B.jsxs)(fe,{variant:`danger`,disabled:s,"data-tip":n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void g(),children:[n.cancel===`chat`?(0,B.jsx)(w,{fill:`currentColor`,"aria-hidden":`true`}):(0,B.jsx)(o,{"aria-hidden":`true`}),s?`Stopping…`:n.cancel===`chat`?`Stop`:`Cancel`]})]}),i&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),n.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!f&&(0,B.jsx)(ft,{actions:n.actions??[]}),(0,B.jsx)(Ce,{prefix:`run`,label:`This run`,className:`mb-0`,current:l,onPick:u,tabs:x}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${l}`,"aria-labelledby":`run-${l}`,className:`flex min-w-0 flex-col gap-6`,children:[l===`summary`&&(0,B.jsxs)(B.Fragment,{children:[b&&(0,B.jsx)(lt,{run:n,now:p,running:f,events:h.length}),(0,B.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:[n.final&&(0,B.jsx)(Ye,{final:n.final,answer:n.answer,className:T}),(0,B.jsx)(Qe,{run:n,className:T}),C.length>0&&(0,B.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,B.jsx)(Q,{title:`What it produced (${C.length})`,children:C.map(e=>(0,B.jsx)(Z,{label:e.label,stacked:!0,children:(0,B.jsx)(L,{path:e.path,children:e.path.split(`/`).pop()})},e.path))})}),n.files.length>0&&(0,B.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,B.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:(0,B.jsx)(W,{items:[...n.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)),first:st,render:e=>(0,B.jsx)(Z,{label:ct(e.action),stacked:!0,children:e.action===`delete`?(0,B.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path.split(`/`).pop()}):(0,B.jsx)(L,{path:e.path,children:e.path.split(`/`).pop()})},e.path)})})}),n.learnings.length>0&&(0,B.jsx)(Ze,{list:n.learnings,className:`@3xl:col-span-4`})]}),!b&&(0,B.jsx)(oe,{className:`py-4`,children:f?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),l===`conversation`&&(y?(0,B.jsx)(R,{text:pt(n.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.replies.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2 text-sm max-w-[85%]`,children:(0,B.jsx)(R,{text:e.ask,className:`[&_p]:my-1`})}),e.text&&(0,B.jsx)(R,{text:Ee(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),l===`activity`&&(n.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-4 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,B.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):h.length?(0,B.jsx)(Me,{timeline:!0,lines:h,start:n.startedAt,live:f,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),l===`details`&&(0,B.jsxs)(_t,{children:[(0,B.jsxs)(Q,{title:`Numbers`,children:[(0,B.jsx)(Z,{label:f?`Running for`:`Took`,children:J(q(n,p))}),(0,B.jsx)(Z,{label:`Tokens`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`span`,{children:[F(Y(n)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,ge(n.usage)]})]}),(n.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-1 text-[13px]`,children:n.byAgent.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:ot(e.agent)}),(0,B.jsx)(`span`,{className:`text-muted tabular-nums`,children:F(e.input+e.output)})]},e.agent))})]})}),(0,B.jsxs)(Z,{label:`Context`,children:[n.context?F(n.context.tokens):`–`,ee!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,F(n.context.limit),` (`,ee,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,A(n.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(rt,{r:n})}),(0,B.jsx)(Z,{label:`Command`,children:et(n.command)}),(0,B.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:n.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-1`,children:n.agents.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:ot(e.name)}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:A(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[n.archived?(0,B.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,B.jsx)(L,{path:`.forgeqe/logs/${n.name}`}),n.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:P(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(R,{text:pt(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${tt(n.job.nextAt)}`:``]}),n.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[n.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,n.job.run.status.replace(`_`,` `),n.job.run.exitCode!==void 0&&n.job.run.exitCode!==null?`, exit ${n.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Notifications`,children:n.notifications.length?n.notifications.map(e=>(0,B.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,B.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:n.origin.kind===`terminal`||n.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}function _t({children:e}){let t=z.Children.toArray(e).filter(Boolean),n=t.length%2==1;return(0,B.jsx)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:t.map((e,r)=>(0,B.jsx)(`section`,{className:j(`flex min-w-0 flex-col border-t border-line-soft pt-6`,n&&r===t.length-1?`@3xl:col-span-4`:`@3xl:col-span-2`),children:e},r))})}var $=25;function vt({runs:e}){let t=nt(e.some(e=>e.status===`running`)),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(`all`),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(0);(0,z.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,h=n.toLowerCase().split(/\s+/).filter(Boolean),g=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&h.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),_={all:g.length,running:g.filter(e=>e.status===`running`).length,failed:g.filter(e=>e.status===`failed`).length},v=i===`all`?g:g.filter(e=>e.status===i),b=Math.max(1,Math.ceil(v.length/$)),x=Math.min(f,b-1),S=v.slice(x*$,x*$+$),C=e.filter(e=>e.status!==`running`&&!X(e)),w=C.filter(e=>e.status===`failed`).length,T=C.length?C.reduce((e,n)=>e+q(n,t),0)/C.length:NaN,E=e.reduce((e,t)=>e+Y(t),0),D=[...new Set(e.map(e=>e.kind))],O=[...new Set(e.map(e=>e.origin.kind))],k={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,B.jsx)(oe,{icon:ee,title:`No runs yet`,action:(0,B.jsxs)(`a`,{className:re({size:`sm`}),href:P(),"data-tip":`Start a chat`,children:[(0,B.jsx)(y,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:j(`tabular-nums`,w?`text-fail`:`text-ink`),children:w}),` failed`,C.length?` (${Math.round(w/C.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:F(E)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:J(Math.round(T))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(ae,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,B.jsx)(ue,{items:[{id:`all`,label:`All`,n:_.all},{id:`running`,label:`Running`,n:_.running},{id:`failed`,label:`Failed`,n:_.failed,alert:!0}],value:i,onChange:a}),D.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,B.jsx)(`option`,{value:``,children:`Any kind`}),D.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]}),O.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,B.jsx)(`option`,{value:``,children:`Started anywhere`}),O.map(e=>(0,B.jsx)(`option`,{value:e,children:k[e]||e},e))]})]}),(0,B.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[13px] font-semibold text-muted @3xl:grid`,children:[(0,B.jsx)(`span`,{className:`w-4`}),(0,B.jsx)(`span`,{children:`Run`}),(0,B.jsx)(`span`,{children:`Kind`}),(0,B.jsx)(`span`,{children:`Started by`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,B.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,B.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-2`,children:[S.length===0&&(0,B.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:`Nothing matches.`}),S.map((e,n)=>{let r=ke(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(n===0||ke(S[n-1].startedAt)!==r)&&(0,B.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`a`,{href:P(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,B.jsx)(at,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[13px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[13px] text-muted @3xl:hidden`,children:[V[e.kind],k[e.origin.kind],J(q(e,t)),`${F(Y(e))} tokens`].join(` · `)})]}),(0,B.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-2 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,B.jsx)(Fe,{kind:e.kind}),V[e.kind]]}),(0,B.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:k[e.origin.kind]||e.origin.kind}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:J(q(e,t))}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:F(Y(e))}),(0,B.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":tt(e.startedAt),children:Ae(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(se,{page:x,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${A(m,`empty session`)}`:`${A(m,`empty session`)} hidden`})]})})]})]})}function yt({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{pe.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,z.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,z.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ie(s):``;return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(Se,{}),(0,B.jsx)(`main`,{className:j(we,`@container flex-auto gap-4`),children:l?(0,B.jsx)(gt,{name:l,tab:c},l):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Oe,{}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(be,{pixel:ye.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(ve,{label:`Runs and reports`,links:Ne,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(vt,{runs:t})]})})]})}export{yt as Runs,at as StatusIcon,X as empty,ht as runTab,it as statusLabel};
@@ -1,2 +0,0 @@
1
- import{Ir as e,Nr as t,at as n,in as r,w as i,zr as a}from"./line-icons-C_amZ5-o.js";import{$t as o,B as s,Jt as c,V as l,c as u,i as d,l as f,n as p,p as m}from"./filters-CVzIOjPG.js";import{o as h,t as g}from"./markdown-CWisJbSJ.js";import{u as _}from"./parts-CDBCk_Xz.js";var v=a(e(),1),y=o();function b({error:e}){return e?(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}var x=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,S={ok:{label:`Ready to start`,tone:`pass`},limits:{label:`Ready, with limits`,tone:`warn`},blocked:{label:`Not possible`,tone:`fail`}},C={converted:{label:`Converted`,tone:`pass`},partial:{label:`Needs review`,tone:`warn`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},running:{label:`Running`,tone:`running`}},w={converted:{label:`Converted`,tone:`pass`},written:{label:`Written`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`},blocked:{label:`Not possible`,tone:`warn`},skipped:{label:`Skipped`,tone:`neutral`}},T={setup:`Set-up`,page:`Page`,test:`Test`},E=e=>e.engine?e.engine===`mobile`?`Mobile workflow`:`Desktop workflow`:T[e.kind],D={matched:{label:`In the test`,dot:`bg-pass`},missing:{label:`Missing from the test`,dot:`bg-fail`},elided:{label:`Not needed: this branch never runs`,dot:`bg-line-strong`},marked:{label:`Left for a person to finish`,dot:`bg-warn`}},O=e=>e.route===`web`||e.route===`api`||(e.routes?.web??0)>0||(e.routes?.api??0)>0||(e.workflow?.steps??0)>0;function k(e){if(e.workflow&&e.workflow.steps>0)return`${e.workflow.engine===`mobile`?`Mobile`:`Desktop`} workflow${e.workflow.skipped?` + notes`:``}`;let t=e.route===`web`||(e.routes?.web??0)>0,n=e.route===`api`||(e.routes?.api??0)>0,r=(e.unsupported??0)>0||(e.routes?.unsupported??0)>0;return`${t&&n?`Web and API`:n?`API`:`Web`}${r?` + notes`:``}`}var A={web:`Web`,api:`API`,desktop:`Desktop`,mobile:`Mobile`,data:`Data`,mixed:`Mixed`,unsupported:`Not supported`},j={prepare:`Prepare`,setup:`Set up`,pages:`Pages`,tests:`Tests`,validate:`Validate`,review:`Review`},M=[`prepare`,`setup`,`pages`,`tests`,`validate`,`review`];function N(e,t){if(!t)return 0;if(t.status===`converted`||t.stages?.review.status===`done`)return 100;let n=t.stages?.validate.status===`done`?8:0,r=Math.min(t.units.length,e.units.length);return Math.min(99,Math.round(r/Math.max(1,e.units.length)*90+n))}function P(e){let t=e?.status||`pending`,n=e?.startedAt&&e?.endedAt?_(Date.parse(e.endedAt)-Date.parse(e.startedAt)):``;return t===`running`?e?.startedAt?`Running · ${_(Date.now()-Date.parse(e.startedAt))}`:`Running`:t===`done`?e?.note||(n?`Done · ${n}`:`Done`):t===`failed`?e?.note||`Did not finish`:t===`skipped`?e?.note||`Skipped`:`Waiting`}function F({states:e}){return(0,y.jsx)(`ol`,{"aria-label":`Stages`,className:`m-0 flex w-full min-w-0 list-none items-center gap-1 p-0 @xl:gap-2`,children:M.map((n,a)=>{let o=e?.[n],s=o?.status||`pending`,c=s===`done`||s===`skipped`,u=s===`running`||s===`failed`,d=P(o);return(0,y.jsxs)(`li`,{"data-tip":`${j[n]}: ${d}`,className:l(`relative flex items-center gap-1 @xl:gap-2`,a<M.length-1&&`flex-1`),"aria-current":s===`running`?`step`:void 0,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:l(`inline-flex size-5 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums @xl:size-6`,c?`bg-pass text-white`:s===`running`?`border-2 border-accent bg-accent-soft text-accent-fg`:s===`failed`?`bg-fail text-white`:`border border-line bg-bg text-muted`),children:c?(0,y.jsx)(i,{size:12,strokeWidth:3}):s===`failed`?(0,y.jsx)(t,{size:12,strokeWidth:3}):s===`running`?(0,y.jsx)(r,{size:12,strokeWidth:2.5,className:`animate-spin`}):a+1}),(0,y.jsxs)(`span`,{className:l(`flex-none text-[13px] whitespace-nowrap`,u?`inline`:`hidden @xl:inline`,s===`running`?`font-medium text-accent-fg`:s===`failed`?`font-medium text-fail`:s===`pending`?`text-muted`:`text-ink`),children:[j[n],u&&(0,y.jsx)(`span`,{className:`ml-2 hidden font-normal text-muted @3xl:inline`,children:d})]}),(0,y.jsxs)(`span`,{className:`sr-only`,children:[j[n],`: `,d]}),a<M.length-1&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,y.jsx)(`span`,{className:l(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,c?`w-full`:`w-0`)})})]},n)})})}function I(e){return e?`literal`in e?JSON.stringify(e.literal):`env`in e?`env ${String(e.env)}${e.secret?` (secret)`:``}`:`var`in e?`variable ${String(e.var)}`:`param`in e?`parameter ${String(e.param)}`:`data`in e?`test data ${String(e.data)}`:`expr`in e?`expression ${String(e.expr)}`:`concat`in e&&Array.isArray(e.concat)?e.concat.map(I).join(` + `):``:``}var L={exact:`is`,contains:`contains`,not:`is not`,gt:`is more than`,gte:`is at least`,lt:`is less than`,lte:`is at most`,exists:`is there`,absent:`is not there`},R=new Set([`gt`,`gte`,`lt`,`lte`]);function z(e){let t=e.expected;return t&&`literal`in t&&/^-?\d+(\.\d+)?$/.test(String(t.literal))&&(R.has(e.match||``)||e.op===`api_status`)?String(t.literal):I(t)}function B(e,t,n){return e===`api_status`||t===`status`?`the status`:e===`api_header`||t===`header`?`the header ${n}`:e===`api_body`||t===`body`?`the body`:`the JSON value ${n}`}function V(e){if(e.op===`api_request`){let t=e.method&&`literal`in e.method?String(e.method.literal):``,n=[e.endpoint,e.resource].filter(Boolean).map(e=>I(e)).join(` + `),r=(e,t,n)=>{let r=e?Object.keys(e).length:0;return r?`${r} ${r===1?t:n}`:``},i=[e.payload?.fields?.length?`${e.payload.fields.length} body ${e.payload.fields.length===1?`field`:`fields`}`:e.payload?.raw?`a body`:``,r(e.pathParams,`path parameter`,`path parameters`),r(e.query,`query parameter`,`query parameters`),r(e.headers,`header`,`headers`)].filter(Boolean);return`Call ${t?`${t} `:e.method?`(method ${I(e.method)}) `:``}${n||`with no address`}${i.length?`, with ${i.join(`, `)}`:``}`}if(e.kind===`assert`&&(e.op===`api_status`||e.op===`api_header`||e.op===`api_json`||e.op===`api_body`)){let t=B(e.op,void 0,e.target),n=e.match||`exact`;return`Check ${t} of the response ${L[n]||`is`}${n===`exists`||n===`absent`?``:` ${z(e)}`}`}return e.op===`api_store`?`Read ${B(void 0,e.property,e.target)} of the response into ${e.var}`:null}function H(e){let t=V(e);if(t!==null)return t;let n=e.target?e.target.slice(e.target.indexOf(`.`)+1).replace(/_/g,` `):``;if(e.kind===`action`){let t=e.op===`navigate`?`Open ${I(e.value)}`:e.op===`close`?`Close the browser`:e.op===`fill`?`Fill ${n} with ${I(e.value)}`:e.op===`press`?`Press ${e.key} on ${n}`:e.op===`select`?`Select in ${n}`:`${e.op[0].toUpperCase()}${e.op.slice(1)} ${n}`;return e.optional?`${t} (if it is there)`:t}return e.kind===`assert`?`Check ${n} ${e.op===`text`||e.op===`value`?`${e.match===`contains`?`contains`:`is`} ${I(e.expected)}`:`is ${e.op}`}${e.wait?`, waiting`:``}`:e.kind===`store`?`Read ${n} into ${e.var}`:e.kind===`set_var`?`Set ${e.var} to ${I(e.value)}`:e.kind===`wait`?`Wait ${e.ms} ms`:e.kind===`unsupported`?e.reason||`Cannot be converted`:e.name||e.kind}var U=(e,t)=>t?m(`tosca`,e,`compare`,encodeURIComponent(t)):m(`tosca`,e,`compare`),W=50,G={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function K({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,y.jsx)(`ul`,{className:l(`m-0 flex list-none flex-col p-0`,i>0&&`ml-4 border-l border-line-soft pl-4`),children:e.map((e,a)=>{if(e.kind===`group`)return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[G[e.role||`folder`]||`Folder`,`: `,(0,y.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,y.jsx)(K,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${a}`);if(e.kind===`if`||e.kind===`loop`){let o=e.condition;return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,y.jsx)(`code`,{className:`font-mono text-[13px] text-ink-2`,children:o?.tosca}),o?.constant!==void 0&&(0,y.jsxs)(`span`,{children:[` · always `,o.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsx)(`span`,{className:`ml-4 text-[13px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,y.jsx)(K,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${a}`)}let o=e.id?t.get(e.id):void 0,s=o?D[o]:void 0;return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:l(`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,n===e.id?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":s?.label||`Not converted yet`,"data-tip":s?.label||`Not converted yet`,className:l(`mt-2 size-2 flex-none rounded-full`,s?.dot||`bg-line`)}),(0,y.jsx)(`span`,{className:`w-9 flex-none font-mono text-[13px] text-muted`,children:e.id}),(0,y.jsxs)(`span`,{className:l(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[H(e),e.tosca?.step&&(0,y.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||a)})})}function q(e,t){for(let n of e){if(n.id===t)return n;for(let e of[`body`,`then`,`else`,`loop`]){let r=n[e]&&q(n[e],t);if(r)return r}}}function J({view:e,pick:t,engine:n}){let r=e.target,i=r?.text||``,a=i.split(`
2
- `),o=(0,v.useMemo)(()=>i?h(i,r?.lang||`plaintext`):null,[i,r?.lang]),s=(0,v.useMemo)(()=>{if(!t)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(a.flatMap((t,n)=>e.test(t)?[n]:[]))},[t,i]),c=(0,v.useRef)(null);(0,v.useEffect)(()=>{c.current?.scrollIntoView({block:`center`,behavior:`smooth`})},[t,s.size]);let u=Math.min(...s);return(0,y.jsxs)(`figure`,{className:`pane-swap m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-4`,children:[(0,y.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:n?E({kind:`test`,engine:n}):`Converted test`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink-2`,"data-tip":r?.path,children:r?.path||``}),i&&(0,y.jsx)(g,{text:i,label:`Copy ${r?.path||`the test`}`})]}),i?(0,y.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[13px] leading-[1.6]`,children:[(0,y.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft py-4 text-right text-muted select-none`,children:a.map((e,t)=>(0,y.jsx)(`span`,{ref:t===u?c:void 0,className:l(`block px-4`,s.has(t)&&`bg-accent-soft font-semibold text-accent-fg`),children:t+1},t))}),(0,y.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-4 py-4`,children:(0,y.jsx)(`code`,{className:`hljs`,children:o})})]}):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:r?`Not written yet.`:`This test case is left out of the plan.`}),t&&i&&(0,y.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:s.size?`${t} is done on line ${[...s].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`})]})}function Y({view:e,node:t}){if(!t?.target)return null;let[n,r]=t.target.split(`.`),i=e.pages.find(e=>e.id===n),a=i?.elements.find(e=>e.id===r);return a?(0,y.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-4 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,y.jsxs)(`span`,{className:`font-normal text-muted`,children:[`on `,i?.name,a.scope?.length?`, inside ${a.scope.join(` › `)}`:``,a.nth===void 0?``:`, number ${a.nth+1}`]})]}),a.locators.length?(0,y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`w-14 flex-none text-[13px] text-muted`,children:e.strategy}),(0,y.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.strategy===`role`?`${e.role} "${e.name}"`:e.attr?`[${e.attr}="${e.value}"]`:e.value}),e.fragile&&(0,y.jsx)(u,{tone:`warn`,children:`Fragile`})]},t))}):(0,y.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function X({id:e,plan:t,result:r,initial:i,full:a,onPick:o}){let u=t.cases.filter(e=>e.included),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(i||u[0]?.id||``),[b,S]=(0,v.useState)(null),[C,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``);(0,v.useEffect)(()=>{g&&(D(``),c.case(e,g).then(S,e=>D(e.message)))},[e,g,r?.units.length,r?.status]),(0,v.useEffect)(()=>{T(``),g&&o?.(g)},[g]);let O=new Map((b?.fidelity||[]).map(e=>[e.id,e.status])),k=u.filter(e=>!m||e.name.toLowerCase().includes(m.toLowerCase())),[j,M]=(0,v.useState)(0);(0,v.useEffect)(()=>M(0),[m]),(0,v.useEffect)(()=>{let e=k.findIndex(e=>e.id===g);e>=0&&Math.floor(e/W)!==j&&M(Math.floor(e/W))},[g]);let N=k.slice(j*W,j*W+W),P=e=>r?.units.find(t=>t.kind===`test`&&t.case===e);if(!u.length)return(0,y.jsx)(f,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});let F=(0,y.jsxs)(`div`,{className:l(`grid grid-cols-[minmax(0,1fr)] gap-4 @5xl:grid-cols-[220px_minmax(0,1fr)_minmax(0,1fr)]`,a?`@5xl:min-h-0 @5xl:flex-1`:`@5xl:h-[calc(var(--screen)-368px)] @5xl:min-h-[540px]`),children:[(0,y.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[320px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-4 @5xl:max-h-none`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-1 px-1`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:`Test cases`}),(0,y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[u.filter(e=>P(e.id)?.status===`converted`).length,` converted · `,u.some(e=>P(e.id)?.status===`written`)?`${u.filter(e=>P(e.id)?.status===`written`).length} written · `:``,u.filter(e=>[`failed`,`blocked`].includes(P(e.id)?.status||``)).length,` failed · `,x(u.length,`test case`)]})]}),(0,y.jsx)(d,{id:`find-a-case`,label:`Find a test case`,value:m,onChange:h,className:`max-w-none flex-none`}),(0,y.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-1 overflow-y-auto p-0`,children:[N.map(e=>{let t=P(e.id);return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":g===e.id,onClick:()=>_(e.id),className:l(`flex w-full cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,g===e.id?`bg-accent-soft text-ink`:`bg-transparent text-ink-2 hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":t?w[t.status].label:`Waiting`,className:l(`mt-2 size-2 flex-none rounded-full`,t?.status===`converted`?`bg-pass`:t?.status===`failed`?`bg-fail`:t?.status===`blocked`?`bg-warn`:`bg-line`)}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.name,(0,y.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[x(e.steps,`step`),` · `,x(e.asserts,`check`),t?.fidelity?` · ${t.fidelity.matched}/${t.fidelity.required} in the test`:``]})]})]})},e.id)}),!N.length&&(0,y.jsx)(`li`,{className:`px-2 py-4 text-[13px] text-muted`,children:`No test case matches.`})]}),k.length>W&&(0,y.jsx)(p,{page:j,size:W,total:k.length,onPage:M,label:`Test case pages`})]}),(0,y.jsxs)(`section`,{"aria-label":`Tosca steps`,className:`flex min-h-[360px] min-w-0 flex-col gap-4 overflow-hidden`,children:[E&&(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:E}),(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`header`,{className:`flex min-h-10 flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2`,children:[(0,y.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Tosca steps`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:b?.name}),b&&t.cases.find(e=>e.id===g)&&(0,y.jsx)(`span`,{className:`text-[13px] text-muted`,children:A[t.cases.find(e=>e.id===g).route]||``})]}),(0,y.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:b?(0,y.jsx)(K,{nodes:b.body,status:O,pick:C,onPick:e=>T(e.id||``)}):E?(0,y.jsx)(`p`,{className:`m-0 px-2 text-sm text-muted`,children:`Nothing to show.`}):(0,y.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:`Loading…`})},b?.case||``),b&&(b.env.length>0||b.warnings.length>0)&&(0,y.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-4 py-2 text-[13px] text-ink-2`,children:[b.env.length>0&&(0,y.jsxs)(`span`,{children:[`Environment variables: `,b.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),b.warnings.slice(0,3).map(e=>(0,y.jsx)(`span`,{className:`text-warn`,children:e},e))]})]}),b&&(0,y.jsx)(Y,{view:b,node:q(b.body,C)})]}),b?(0,y.jsx)(J,{view:b,pick:C,engine:t.units.find(e=>e.kind===`test`&&e.case===b.case)?.engine},b.case):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] items-center justify-center rounded-[12px] card border px-4 text-center text-sm text-muted`,children:E?`Nothing to show.`:`Loading…`})]});return a?F:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`flex justify-end`,children:(0,y.jsxs)(`a`,{href:U(e,g),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:s({variant:`ghost`,size:`sm`}),children:[(0,y.jsx)(n,{"aria-hidden":`true`}),`Open in a new tab`]})}),F]})}export{C as a,j as c,S as d,k as f,N as g,E as h,b as i,F as l,x as m,U as n,A as o,O as p,D as r,M as s,X as t,w as u};
@@ -1 +0,0 @@
1
- import{Fn as e,Ir as t,M as n,N as r,R as i,Y as a,ar as o,o as s,tn as ee,xr as c,yr as l,zr as u}from"./line-icons-C_amZ5-o.js";import{$t as d,B as f,V as p,a as te,l as m,o as ne,ot as h,p as g,st as _,t as v,z as y}from"./filters-CVzIOjPG.js";import{X as b,bn as x,bt as S,o as C,t as re}from"./frame-VTMu7MoC.js";import{_ as ie,r as w}from"./index-nuLrB-Rb.js";import{_ as T,o as E}from"./qualityParts-CGKSK9Dq.js";var D=u(t(),1),O={view:()=>h(`GET`,`/api/testdebt`),refresh:()=>h(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>h(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},k=d(),A=[`untested`,`signal`,`duplicates`,`cases`],j={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},M={test:`Test`,recording:`Recording`,case:`Test case`},N={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},P={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},F=e=>`${Math.round(e*100)}%`,I=e=>A.includes(e)?e:`untested`;function L({part:e,what:t,action:n}){return(0,k.jsxs)(m,{icon:l,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,k.jsxs)(`a`,{className:f({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,k.jsx)(s,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function R({text:e,tip:t}){return(0,k.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function z({sub:t}){let[l,u]=(0,D.useState)(null),[d,h]=(0,D.useState)(``),[A,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(``),H=I(t),[U,W]=(0,D.useState)(`all`),[G,ae]=(0,D.useState)(`manual`),[oe,se]=(0,D.useState)(``),[K,ce]=(0,D.useState)(``);(0,D.useEffect)(()=>{O.view().then(e=>{u(e),h(``)},e=>h(e.message))},[]);let q=(0,D.useCallback)(async(e,t)=>{z(!0),V(``);try{u(await e()),h(``),t&&V(t)}catch(e){h(e.message)}finally{z(!1)}},[]),le=async e=>{if(e){z(!0);try{let{id:t}=await _.start(e,{});location.hash=g(`chats`,t)}catch(e){h(e.message),z(!1)}}},J=(e,t)=>(0,k.jsx)(y,{size:`icon`,variant:`icon`,className:`size-8`,disabled:A||!e,onClick:()=>void le(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,k.jsx)(o,{"aria-hidden":`true`})}),Y=l?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=oe||Y[0]?.id||``,Z=l?.cases.filter(e=>!e.automated).length??0,ue=l?.areas.filter(e=>U===`all`||e.kind===U)??[],de=l?.cases.filter(e=>G===`all`||(G===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-4 text-right tabular-nums`,$={untested:(l?.areas.length??0)+(l?.rules.length??0),signal:(l?.quiet.length??0)+(l?.gone.length??0),duplicates:l?.duplicates.length??0,cases:Z};return(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(C,{}),(0,k.jsxs)(`main`,{className:p(re,`@container flex-auto gap-4`),children:[(0,k.jsx)(ie,{}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,k.jsx)(S,{pixel:x[`test-debt`],size:`lg`}),(0,k.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),l&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,k.jsxs)(`span`,{"data-tip":T(l.at),children:[`Worked out `,w(l.at)]}),(0,k.jsxs)(y,{size:`sm`,disabled:A,onClick:()=>void q(O.refresh,`Worked out again.`),children:[(0,k.jsx)(e,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,k.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,k.jsx)(`a`,{href:g(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,l?.repo&&l.repo!==`.`?(0,k.jsx)(`code`,{className:`font-mono text-[13px]`,children:l.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),d&&(0,k.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:d}),!l&&!d&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),B&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:B}),l&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,k.jsx)(E,{label:`Untested code`,value:l.graph.state===`ok`?l.areas.length:`–`,tone:l.areas.length?`text-warn`:void 0,sub:l.graph.state===`ok`?`of ${l.graph.checked} areas`:`graph not built`}),(0,k.jsx)(E,{label:`Untested rules`,value:l.rules.length,tone:l.rules.length?`text-warn`:void 0,sub:`of ${l.graph.rulesChecked} rules`}),(0,k.jsx)(E,{label:`Never fail`,value:l.quiet.length,sub:`30 passes in a row`}),(0,k.jsx)(E,{label:`Code gone`,value:l.gone.length,tone:l.gone.length?`text-fail`:void 0,sub:`of ${l.files.count} files listed`}),(0,k.jsx)(E,{label:`Near-duplicates`,value:l.duplicates.length,sub:`from ${F(l.threshold)} alike`}),(0,k.jsx)(E,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${l.cases.length} test cases`})]}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(v,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:H,onChange:e=>location.hash=g(`test-debt`,e)})}),l.notes.map(e=>(0,k.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:e},e)),H===`untested`&&(0,k.jsxs)(k.Fragment,{children:[l.graph.state===`ok`?(0,k.jsx)(b,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:U,empty:l.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(v,{items:[{id:`all`,label:`All`,n:l.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${j[e]}s`,n:l.areas.filter(t=>t.kind===e).length}))],value:U,onChange:W})}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Code`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Used by`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(r,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,k.jsx)(R,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:j[e.kind]}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,k.jsx)(R,{text:e.where})}),(0,k.jsx)(`td`,{className:p(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,j[e.kind].toLowerCase())})]},e.id))}):(0,k.jsx)(L,{part:l.graph,what:`product graph`,action:{label:`Product`,to:g(`product`)}}),(0,k.jsx)(b,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:l.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[46%]`),children:`Rule`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`From`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.rules.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(r,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,k.jsx)(R,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,k.jsx)(R,{text:e.where})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.nearest?(0,k.jsx)(R,{text:`${e.nearest.name} (${F(e.nearest.score)})`,tip:`${F(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`rule`)})]},e.id))})]}),H===`signal`&&(l.history.state===`ok`?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(b,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Passes`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Since`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.quiet.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(n,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,k.jsx)(R,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,k.jsx)(`td`,{className:p(Q,`text-muted`),children:e.runs}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?T(e.since):void 0,children:e.since?w(e.since):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))}),(0,k.jsx)(b,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${l.files.count} files, listed by ${l.files.by===`git`?`git`:`walking the folder`}).`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`File`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Last run`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.gone.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(i,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,k.jsx)(R,{text:e.name})]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0 font-mono text-[13px] text-ink-2`),children:(0,k.jsx)(R,{text:e.file})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?T(e.last):void 0,children:e.last?w(e.last):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))})]}):(0,k.jsx)(L,{part:l.history,what:`test history`,action:{label:`Regression`,to:g(`regression`)}})),H===`duplicates`&&(0,k.jsx)(b,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${F(l.threshold)} of their words (${l.compared} pairs compared).`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Alike`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`First`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`Second`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:l.duplicates.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(Q,`pl-4`,e.score>=.85?`text-warn`:`text-muted`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,k.jsx)(a,{size:14,"aria-hidden":`true`}),F(e.score)]})}),[e.a,e.b].map((e,t)=>(0,k.jsxs)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:[(0,k.jsx)(R,{text:e.name,tip:`${M[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,k.jsx)(`span`,{className:`block text-[13px] text-muted`,children:M[e.kind]})]},t)),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,k.jsx)(R,{text:e.shared.join(`, `)})}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),H===`cases`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:l.sources.map(e=>(0,k.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,k.jsx)(n,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,k.jsx)(r,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,k.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,k.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${w(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,k.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>O.readCases(X,K.trim()),`Test cases read.`)},children:[(0,k.jsx)(ne,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>se(e.target.value),children:Y.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,k.jsx)(te,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?P[X]:``,value:K,maxLength:80,onChange:e=>ce(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,k.jsxs)(y,{size:`sm`,type:`submit`,disabled:A||!K.trim(),"data-tip":`Read the test cases`,children:[(0,k.jsx)(c,{"aria-hidden":`true`}),`Import`]})]}),l.cases.length?(0,k.jsx)(b,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:G,empty:`Nothing matches.`,tools:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(v,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:l.cases.length-Z},{id:`all`,label:`All`,n:l.cases.length}],value:G,onChange:ae})}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Case`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[36%]`),children:`Title`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Source`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Automated`}),(0,k.jsx)(`th`,{className:p(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:de.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`font-mono text-[13px] whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,k.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`max-w-0`),children:(0,k.jsx)(R,{text:e.title||`–`})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:N[e.source]}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,k.jsx)(n,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,k.jsx)(r,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,k.jsx)(`td`,{className:p(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.test?(0,k.jsx)(R,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,k.jsx)(m,{icon:ee,title:`No test cases yet`,action:(0,k.jsxs)(`a`,{className:f({size:`sm`}),href:g(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,k.jsx)(s,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{z as TestDebt};
@@ -1 +0,0 @@
1
- import{An as e,Fn as t,Ir as n,Jt as r,Kn as i,M as a,N as o,Nr as s,P as c,R as l,Rn as u,U as d,Wn as f,a as p,at as m,b as h,dr as g,en as _,er as v,gr as y,it as b,jr as x,m as ee,nr as te,o as S,sr as C,tn as w,w as T,xr as E,yr as D,zr as ne}from"./line-icons-C_amZ5-o.js";import{$t as re,B as ie,V as O,a as k,c as A,f as ae,h as j,l as M,o as N,ot as P,p as F,st as I,t as oe,z as L}from"./filters-CVzIOjPG.js";import{$ as R,Q as z,Vt as B,X as V,Z as H,bn as se,bt as ce,et as U,it as le,n as ue,nt as de,o as fe,ot as pe,rt as W}from"./frame-VTMu7MoC.js";import{_ as me,r as G,s as K}from"./index-nuLrB-Rb.js";import{_ as he}from"./qualityParts-CGKSK9Dq.js";import{t as ge}from"./AgentWork-BhepbEeU.js";var q=ne(n(),1),J={view:()=>P(`GET`,`/api/testmgmt`),cases:()=>P(`GET`,`/api/testmgmt/cases`),case:e=>P(`GET`,`/api/testmgmt/case/${encodeURIComponent(e).replace(/%3A/gi,`:`)}`),sync:()=>P(`POST`,`/api/testmgmt/sync`),schedule:()=>P(`GET`,`/api/testmgmt/schedule`),setSchedule:e=>P(`POST`,`/api/testmgmt/schedule`,e),gaps:()=>P(`GET`,`/api/testmgmt/gaps`),tags:()=>P(`GET`,`/api/testmgmt/tags`),tag:(e,t=!1)=>P(`POST`,`/api/testmgmt/tags`,{...e,...t?{confirmed:!0}:{}}),suites:()=>P(`GET`,`/api/testmgmt/suites`),suite:e=>P(`GET`,`/api/testmgmt/suites/${encodeURIComponent(e)}`),buildSuite:(e,t)=>P(`POST`,`/api/testmgmt/suites/agent`,{request:e,...t?{open:t}:{}}),saveSuite:e=>P(`POST`,`/api/testmgmt/suites`,e),deleteSuite:e=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/delete`,{confirmed:!0}),runSuite:(e,t,n=!1)=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/run`,{...t,...n?{confirmed:!0}:{}}),run:(e,t,n=!1)=>P(`POST`,`/api/testmgmt/run`,{keys:e,...t?{env:t}:{},...n?{confirmed:!0}:{}}),job:()=>P(`GET`,`/api/testmgmt/job`),writeBack:(e,t,n,r)=>P(`POST`,`/api/testmgmt/writeback/${e}`,{keys:t,...r?{tags:r}:{},...n?{digest:n}:{}}),suiteTracker:(e,t,n)=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/tracker`,{...t?{target:t}:{},...n?{digest:n}:{}}),stop:()=>P(`POST`,`/api/testmgmt/stop`),tests:()=>P(`GET`,`/api/testmgmt/tests`),discoveryPlan:()=>P(`GET`,`/api/testmgmt/discover`),discover:e=>P(`POST`,`/api/testmgmt/discover`,{digest:e}),link:e=>P(`POST`,`/api/testmgmt/links`,{changes:e}),setMain:(e,t)=>P(`POST`,`/api/testmgmt/links/main`,{case:e,test:t}),proposeLinks:(e=[])=>P(`POST`,`/api/testmgmt/links/propose`,{keys:e}),ask:(e,t,n,r)=>P(`POST`,`/api/testmgmt/ask`,{intent:e,keys:t,...n?{words:n}:{},...r?.length?{stories:r}:{}}),readStories:e=>P(`POST`,`/api/testmgmt/stories`,{scope:e})},_e={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},ve={mapping:`ForgeQE's mapping`,manual:`Linked by a person`,attribute:`Its marker or attribute names the case`,tracker:`The case's system names it`,agent:`Linked by the mapping agent`,name:`The case's id is in its name or tags`},ye={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},Y={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},X=re();function be({title:e,about:t,onClose:n,children:r,footer:i}){return(0,X.jsxs)(`aside`,{"aria-label":e,className:`flex w-full flex-none flex-col border-t border-line-soft bg-surface-muted xl:sticky xl:top-0 xl:h-(--screen) xl:w-[320px] 2xl:w-[380px] xl:border-t-0 xl:border-l`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line-soft px-6 py-4`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:e}),(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:t})]}),n&&(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Close the ${e}`,"data-tip":`Close`,onClick:n,children:(0,X.jsx)(s,{"aria-hidden":`true`})})]}),(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-6`,children:r}),i&&(0,X.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft px-6 py-4`,children:i})]})}function xe({title:e,about:t,looking:n,context:r,suggestions:a,placeholder:o,onClose:s}){let[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``),[g,_]=(0,q.useState)(!1),v=async(e,t,n,r,i)=>{p(!0),h(``);try{let{request:a}=await J.ask(e,t,r,i),{id:o}=await I.start(a,{});l({id:o,said:n}),_(!1),d(``)}catch(e){h(e.message)}finally{p(!1)}};return(0,X.jsxs)(be,{title:e,about:t,onClose:s,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.map(e=>(0,X.jsxs)(L,{size:`sm`,disabled:f||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void v(e.intent,e.keys,e.label,void 0,e.stories),children:[(0,X.jsx)(e.icon,{"aria-hidden":`true`}),e.label]},e.label))}),(0,X.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),u.trim()&&v(`ask`,a[0]?.keys.slice(0,50)??[],u.trim(),u.trim())},children:[(0,X.jsxs)(`label`,{className:`sr-only`,htmlFor:`tm-agent-words`,children:[`Message the `,e]}),(0,X.jsx)(`textarea`,{id:`tm-agent-words`,rows:2,maxLength:1e3,value:u,placeholder:o,onChange:e=>d(e.target.value),className:`min-h-11 flex-1 resize-none rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,X.jsx)(L,{size:`icon`,variant:`primary`,type:`submit`,disabled:f||!u.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,X.jsx)(i,{"aria-hidden":`true`})})]})]}),children:[(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,X.jsx)(j,{state:f||c&&!g?`thinking`:`working`,px:96,label:f?`Starting`:c&&!g?`Working`:`Ready`}),(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:c?g?`Done. Ask again, or open the chat.`:`Working on it…`:n}),r.length>0&&(0,X.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:r.map(e=>(0,X.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-2 text-[13px] text-ink-2`,children:e},e))}),c&&(0,X.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:c.said})]}),m&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:m}),c?(0,X.jsx)(ge,{id:c.id,label:`The ${e} at work`,onEnd:()=>_(!0)},c.id):(0,X.jsxs)(`p`,{className:O(`m-0 text-center text-[13px] text-muted`),children:[`Pick what to do below, or say it in your own words. It works in a chat you can open: `,(0,X.jsx)(`a`,{href:F(`chats`),children:`Chats`}),`.`]})]})}var Se={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},Ce={automation:`Each case's tracker records its automated test: Azure DevOps' Associated Automation, or the automated label on a Jira or Xray test. Only cases whose test ForgeQE knows, from its mapping or a link, are marked.`,tags:`ForgeQE's own tags are added to each case's tags in Azure DevOps, or its labels in Jira. Tags the case already has stay; nothing is taken away.`,untag:`ForgeQE's own tags are taken off each case's tags in Azure DevOps, or its labels in Jira. Only a tag ForgeQE keeps for the case is taken off; the tracker's other tags stay.`},we=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,Te=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,Ee=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,De=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function Oe({plan:e,outcome:t}){let n=new Map((t?.failed??[]).map(e=>[e.key,e.error])),r=new Set((t?.done??[]).map(e=>e.key)),i=(e,t,i=!1)=>(0,X.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r.has(e.key)&&(0,X.jsx)(a,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,X.jsx)(l,{size:14,"aria-label":`Refused`,className:`flex-none text-fail`}),e.key!==`suite`&&(0,X.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.key.replace(/^[a-z_]+:/,``)}),(0,X.jsx)(`span`,{className:i?`text-muted`:`text-ink-2`,children:e.what})]}),n.has(e.key)&&(0,X.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:n.get(e.key)})]},`${e.key}-${t}`);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[e.changes.length?(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map((e,t)=>i(e,t))}):(0,X.jsx)(`p`,{className:`m-0 text-ink-2`,children:`Nothing to write: the trackers already say so.`}),e.skipped.length>0&&(0,X.jsxs)(`details`,{children:[(0,X.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Left out: `,e.skipped.length]}),(0,X.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col p-0`,children:e.skipped.map((e,t)=>i(e,t,!0))})]})]})}function ke(e,t,n){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{i(null),o(null),c(``),e&&e().then(e=>i(e??null),e=>c(e.message))},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(o(e),n(`Wrote ${e.done.length}${e.failed.length?`; the tracker refused ${e.failed.length}`:``}.`))}catch(e){c(e.message)}finally{u(!1)}}}}}function Ae({kind:e,keys:t,tags:n,onClose:r,onDone:i}){let[a,o]=(0,q.useState)(null);(0,q.useEffect)(()=>o(e?()=>()=>J.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,t,n]);let c=ke(a,r=>J.writeBack(e,t,r,n).then(e=>e.outcome),i);return(0,X.jsx)(B,{open:!!e,onClose:r,title:e?Se[e]:``,description:e?Ce[e]:``,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{onClick:r,children:[(0,X.jsx)(s,{"aria-hidden":`true`}),c.outcome?`Close`:`Cancel`]}),!c.outcome&&(0,X.jsxs)(L,{variant:`primary`,disabled:c.busy||!c.plan?.changes.length,onClick:()=>void c.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,X.jsx)(b,{"aria-hidden":`true`}):(0,X.jsx)(E,{"aria-hidden":`true`}),c.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${c.plan?.changes.length??``}`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!c.plan&&!c.error&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Working out what would change…`}),c.error&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c.error}),c.plan&&(0,X.jsx)(Oe,{plan:c.plan,outcome:c.outcome})]})})}function je({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[a,o]=(0,q.useState)(``),c=t.tracker?void 0:n.find(e=>Te(e)===(a||(n[0]?Te(n[0]):``))),[l,u]=(0,q.useState)(null);(0,q.useEffect)(()=>u(e&&(t.tracker||c)?()=>()=>J.suiteTracker(t.id,c).then(e=>e.plan):null),[e,t.id,t.tracker,c&&Te(c)]);let d=ke(l,e=>J.suiteTracker(t.id,c,e).then(e=>e.outcome),i),f=t.tracker;return(0,X.jsx)(B,{open:e,onClose:r,title:f?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:f?`It is ${De(f)}. Cases the suite gained are added there, and cases it lost are taken out.`:`The suite is made in the tracker with its cases, so the team sees it there. Later, Keep in step makes it match the suite again.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{onClick:r,children:[(0,X.jsx)(s,{"aria-hidden":`true`}),d.outcome?`Close`:`Cancel`]}),!d.outcome&&(0,X.jsxs)(L,{variant:`primary`,disabled:d.busy||!d.plan?.changes.length,onClick:()=>void d.go(),children:[(0,X.jsx)(T,{"aria-hidden":`true`}),d.busy?`Writing…`:f?`Keep in step`:`Make it there`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[!f&&(n.length?(0,X.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,X.jsx)(N,{value:c?Te(c):``,onChange:e=>o(e.target.value),children:n.map(e=>(0,X.jsx)(`option`,{value:Te(e),children:we(e)},Te(e)))})]}):(0,X.jsx)(`p`,{className:`m-0 text-ink-2`,children:`This suite's cases are in no connected Azure DevOps plan or Xray project. Connect one in Settings › Integrations.`})),(f||c)&&!d.plan&&!d.error&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Working out what would change…`}),d.error&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:d.error}),d.plan&&(0,X.jsx)(Oe,{plan:d.plan,outcome:d.outcome}),d.outcome&&!d.outcome.failed.length&&(0,X.jsx)(A,{tone:`pass`,children:`Done`})]})})}var Me={automated:a,not_automated:o,pending:c,known_defect:D,needs_attention:D},Ne={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function Z({text:e,tip:t,className:n}){return(0,X.jsx)(`span`,{"data-tip":t??e,className:O(`block truncate`,n),children:e})}function Pe({a:e}){let t=Me[e];return(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[13px] whitespace-nowrap`,children:[(0,X.jsx)(t,{size:15,"aria-hidden":`true`,className:O(`flex-none`,e===`automated`?`text-pass`:e===`known_defect`?`text-fail`:e===`not_automated`?`text-muted`:`text-warn`)}),_e[e]]})}function Fe({o:e}){return(0,X.jsx)(A,{tone:Ne[e],icon:e!==`not_run`,children:Y[e]})}function Ie({runs:e}){return e.length?(0,X.jsx)(`span`,{role:`img`,"aria-label":`Last runs: ${e.map(e=>e===`p`?`passed`:`failed`).join(`, `)}`,className:`inline-flex items-end gap-1`,children:e.map((e,t)=>(0,X.jsx)(`span`,{className:O(`inline-block h-4 w-2 rounded-[2px]`,e===`p`?`bg-pass`:`bg-fail`)},t))}):(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}function Q({tags:e,max:t=3}){return e.length?(0,X.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[e.slice(0,t).map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] bg-surface-strong px-2 text-[13px] text-ink-2`,children:[(0,X.jsx)(g,{size:11,"aria-hidden":`true`}),e]},e)),e.length>t&&(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,"data-tip":e.slice(t).join(`, `),children:[`+`,e.length-t]})]}):null}function Le({points:e,label:t,format:n=e=>String(e),height:r=160}){if(e.length<2)return(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`The trend starts after a second day of numbers: each visit of Test management keeps the day's.`});let i=r,a=Math.min(...e.map(e=>e.y)),o=Math.max(...e.map(e=>e.y)),s=Math.max(0,a-(o-a||1)*.2),c=o+(o-a||1)*.2,l=t=>8+t*584/(e.length-1),u=e=>i-20-(e-s)/(c-s||1)*(i-36),d=e.map((e,t)=>`${l(t).toFixed(1)},${u(e.y).toFixed(1)}`),f=e.at(-1);return(0,X.jsxs)(`figure`,{className:`m-0 flex flex-col gap-1`,children:[(0,X.jsxs)(`svg`,{viewBox:`0 0 600 ${i}`,role:`img`,"aria-label":`${t}: from ${n(e[0].y)} on ${e[0].x} to ${n(f.y)} on ${f.x}`,className:`h-auto w-full text-accent`,children:[[.25,.5,.75].map(e=>(0,X.jsx)(`line`,{x1:`0`,x2:600,y1:(i-20)*e+4,y2:(i-20)*e+4,className:`stroke-line-soft`,strokeWidth:`1`},e)),(0,X.jsx)(`path`,{d:`M${d.join(` L`)} L${l(e.length-1)},${i-20} L${l(0)},${i-20} Z`,fill:`currentColor`,fillOpacity:`0.1`}),(0,X.jsx)(`polyline`,{points:d.join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,X.jsx)(`circle`,{cx:l(e.length-1),cy:u(f.y),r:`4`,fill:`currentColor`,className:`stroke-bg`,strokeWidth:`2`})]}),(0,X.jsxs)(`figcaption`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{children:e[0].x}),(0,X.jsxs)(`span`,{className:`font-medium text-ink`,children:[n(f.y),` now`]}),(0,X.jsx)(`span`,{children:f.x})]})]})}function Re({items:e,series:t,label:n}){let r=Math.max(1,...e.flatMap(e=>e.values));return(0,X.jsxs)(`figure`,{className:`m-0 flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`flex flex-wrap gap-4 text-[13px] text-ink-2`,children:t.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:O(`inline-block size-[10px] rounded-[3px]`,e.className),"aria-hidden":`true`}),e.name]},e.name))}),(0,X.jsx)(`div`,{role:`img`,"aria-label":`${n}: ${e.map(e=>`${e.x} ${e.values.join(` and `)}`).join(`; `)}`,className:`flex h-[140px] items-end gap-2 border-b border-line`,children:e.map(e=>(0,X.jsx)(`span`,{className:`flex h-full flex-1 items-end justify-center gap-1`,"data-tip":`${e.x}: ${e.values.map((e,n)=>`${t[n]?.name.toLowerCase()} ${e}`).join(`, `)}`,children:e.values.map((e,n)=>(0,X.jsx)(`span`,{className:O(`w-full max-w-[14px] rounded-t-[4px]`,t[n]?.className),style:{height:`${Math.max(e?3:0,e/r*100)}%`}},n))},e.x))}),(0,X.jsxs)(`span`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{children:e[0]?.x}),(0,X.jsx)(`span`,{children:e.at(-1)?.x})]})]})}function ze({label:e,part:t,whole:n,className:r=`bg-accent`}){let i=n?Math.round(t/n*100):0;return(0,X.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr_auto] items-center gap-4 text-[13px]`,children:[(0,X.jsx)(Z,{text:e,className:`text-ink-2`}),(0,X.jsx)(`span`,{className:`h-2 overflow-hidden rounded-full bg-surface-strong`,role:`img`,"aria-label":`${e}: ${t} of ${n}`,children:(0,X.jsx)(`span`,{className:O(`block h-full rounded-full`,r),style:{width:`${i}%`}})}),(0,X.jsxs)(`span`,{className:`w-[86px] text-right tabular-nums text-ink-2`,children:[t,` of `,n]})]})}function Be({open:t,onClose:n,title:r,preview:i,onStarted:a}){let[o,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(!1);(0,q.useEffect)(()=>{t&&(f(null),m(``),J.suites().then(e=>{c({list:e.environments,...e.active?{active:e.active}:{}}),u(e.active&&e.environments.includes(e.active)?e.active:e.environments[0]??``)},e=>m(e.message)))},[t]),(0,q.useEffect)(()=>{t&&o!==null&&i(l||void 0,!1).then(e=>{f(e.preview??null),m(``)},e=>m(e.message))},[t,l,o]);let _=async()=>{g(!0);try{await i(l||void 0,!0),a(),n()}catch(e){m(e.message)}finally{g(!1)}};return(0,X.jsx)(B,{open:t,onClose:n,title:r,description:`ForgeQE runs these with forgeqe suite, on the environment you pick here. Results go to Runs and back to each case's system, as your settings say.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{onClick:n,children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(L,{variant:`primary`,disabled:h||!d,onClick:()=>void _(),"data-tip":`Start the run`,children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Run `,d?d.cases:``]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[o&&o.list.length>0&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,X.jsx)(N,{value:l,onChange:e=>u(e.target.value),children:o.list.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),d&&(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:[d.cases,` test case`,d.cases===1?``:`s`,` on `,d.env??`the active environment`,`.`]}),p&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:p})]})})}var Ve=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,He=e=>F(`test-management`,`cases`,encodeURIComponent(e));function Ue({cases:e,onChanged:t}){let[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(!1),[u,p]=(0,q.useState)(null),m=()=>J.tests().then(e=>{r(e),a(``)},e=>a(e.message));(0,q.useEffect)(()=>{m()},[]),(0,q.useEffect)(()=>{if(!n?.busy)return;let e=setInterval(()=>void m(),3e3);return()=>clearInterval(e)},[n?.busy]),Ge(n?.busy??null,()=>t(`Done: the tests and their links are up to date.`));let h=(0,q.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]);if(i)return(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:i});if(!n)return(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let g=n.tests.filter(e=>e.uid),y={all:g.length,unlinked:g.filter(e=>!e.cases.length).length,linked:g.filter(e=>e.cases.length).length,code:g.filter(e=>e.via===`code`).length},b=g.filter(e=>o===`all`||(o===`unlinked`?!e.cases.length:o===`linked`?e.cases.length>0:e.via===`code`)),x=async()=>{try{t(`The mapping agent is looking at ${(await J.proposeLinks()).cases} cases with no test.`),m()}catch(e){t(e.message)}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(L,{variant:`primary`,onClick:()=>l(!0),disabled:!!n.busy,children:[(0,X.jsx)(f,{"aria-hidden":`true`}),`Discover tests`]}),(0,X.jsxs)(L,{onClick:()=>void x(),disabled:!!n.busy||!g.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,X.jsx)(v,{"aria-hidden":`true`}),`Link with the agent`]}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[n.busy?n.busy.what===`discover`?`Discovering tests, started ${G(n.busy.started)}…`:`The mapping agent is at work, started ${G(n.busy.started)}…`:n.discovery?`Discovered ${G(n.discovery.at)}.`:`Not discovered yet: these are read from the code.`,n.proposed>0&&` ${n.proposed} link${n.proposed===1?``:`s`} proposed, waiting on the cases' pages.`]})]}),n.error&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:n.error}),n.discovery&&n.discovery.projects.length>0&&(0,X.jsx)(Ke,{projects:n.discovery.projects}),g.length?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,X.jsx)(oe,{items:[{id:`all`,label:`All`,n:y.all},{id:`unlinked`,label:`No test case`,n:y.unlinked},{id:`linked`,label:`Linked`,n:y.linked},{id:`code`,label:`Read from the code`,n:y.code,tip:`Their framework was not asked, or could not list them`}],value:o,onChange:s})}),(0,X.jsx)(V,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,resetKey:o,empty:`No test matches.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-[45%]`),children:`Test`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Framework`}),(0,X.jsx)(`th`,{className:R,children:`Test cases`}),(0,X.jsx)(`th`,{className:O(R,`hidden @3xl:table-cell`),children:`Tags`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Last runs`}),(0,X.jsx)(`th`,{className:R,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:b.map(t=>(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,X.jsxs)(`td`,{className:O(H,`max-w-0`),children:[(0,X.jsx)(Z,{text:t.name,tip:t.nativeId??t.name}),(0,X.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono text-accent-fg`,children:t.uid}),t.file&&(0,X.jsxs)(`span`,{className:`truncate font-mono`,children:[t.file,t.line?`:${t.line}`:``]}),t.flaky&&(0,X.jsx)(A,{tone:`warn`,children:`Flaky`})]})]}),(0,X.jsx)(`td`,{className:O(H,`hidden text-[13px] @2xl:table-cell`),children:(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsxs)(`span`,{children:[We[t.framework??`code`],t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``]}),(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:ye[t.via??`runs`]})]})}),(0,X.jsx)(`td`,{className:O(H,`text-[13px]`),children:t.cases.length?(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,children:[t.cases.slice(0,4).map(e=>(0,X.jsx)(`a`,{href:He(e),className:`font-mono`,"data-tip":h.get(e)?.title,children:h.get(e)?.id??e},e)),t.cases.length>4&&(0,X.jsxs)(`span`,{className:`text-muted`,children:[`+`,t.cases.length-4]})]}):(0,X.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,X.jsx)(`td`,{className:O(H,`hidden @3xl:table-cell`),children:(0,X.jsx)(Q,{tags:t.tags})}),(0,X.jsx)(`td`,{className:O(H,`hidden @2xl:table-cell`),children:(0,X.jsx)(Ie,{runs:t.runs})}),(0,X.jsx)(`td`,{className:O(H,`text-right`),children:(0,X.jsxs)(L,{size:`sm`,onClick:()=>p(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length,children:[(0,X.jsx)(_,{"aria-hidden":`true`}),`Link`]})})]},t.uid))})]}):(0,X.jsx)(M,{icon:d,title:`No automated test found yet`,children:`Discover tests asks each test project's framework (pytest, .NET, Playwright, Vitest, Jest, Mocha, Robot Framework) for its tests. Set the automation repository in Settings › Code first.`}),(0,X.jsx)(qe,{open:c,onClose:()=>l(!1),onStarted:()=>{l(!1),t(`Discovering tests: each project's framework lists its tests.`),m()}}),(0,X.jsx)(Je,{open:!!u,title:`Link to a test case`,description:u?`Pick the test case ${u.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`:void 0,items:e.filter(e=>!u?.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>p(null),onPick:async e=>{u?.uid&&(await J.link([{case:e,test:u.uid,action:`link`}]),p(null),t(`Linked ${u.uid} to ${h.get(e)?.id??e}.`),m())}})]})}var We={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function Ge(e,t){let[n,r]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function Ke({projects:e}){return(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2`,children:[e.ok?(0,X.jsx)(a,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,X.jsx)(D,{size:14,"aria-label":`Not listed`,className:`mt-1 flex-none text-warn`}),(0,X.jsxs)(`span`,{children:[e.label,` in `,e.dir?(0,X.jsx)(`span`,{className:`font-mono`,children:e.dir}):`the repository's root`,`: `,e.ok?`${e.tests} test${e.tests===1?``:`s`}`:`not listed by its framework, read from the code`,e.error&&(0,X.jsx)(`span`,{className:`block text-muted [overflow-wrap:anywhere]`,children:e.error})]})]},`${e.framework}-${e.dir}-${t}`))})}function qe({open:t,onClose:n,onStarted:r}){let[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);(0,q.useEffect)(()=>{t&&(a(null),s(``),J.discoveryPlan().then(a,e=>s(e.message)))},[t]);let u=async()=>{if(i){l(!0);try{await J.discover(i.digest),r()}catch(e){s(e.message)}finally{l(!1)}}};return(0,X.jsx)(B,{open:t,onClose:n,title:`Discover tests`,description:`Each test project's framework lists its tests, as a test explorer asks it. This runs the repository's code (pytest imports conftest.py, .NET builds the project) with no secret of ForgeQE's, so look at what will run first.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(L,{onClick:n,children:`Cancel`}),(0,X.jsxs)(L,{variant:`primary`,onClick:()=>void u(),disabled:!i||c,children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[o&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:o}),!i&&!o&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Finding the test projects…`}),i&&!i.steps.length&&(0,X.jsx)(`p`,{className:`m-0 text-ink-2`,children:`No test project was found whose framework can be asked. Gherkin features and the code are still read.`}),i&&i.steps.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:i.steps.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`span`,{children:[We[e.project.framework],` in `,e.project.dir?(0,X.jsx)(`span`,{className:`font-mono`,children:e.project.dir}):`the repository's root`]}),(0,X.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})]},t))})]})})}function Je({open:e,title:t,description:n,items:r,onClose:i,onPick:a}){let[o,s]=(0,q.useState)(``),[c,u]=(0,q.useState)(``);(0,q.useEffect)(()=>s(``),[e]);let d=async e=>{u(e),s(``);try{await a(e)}catch(e){s(e.message)}finally{u(``)}};return(0,X.jsx)(B,{open:e,onClose:i,title:t,description:n,wide:!0,footer:(0,X.jsx)(L,{onClick:i,children:`Close`}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o&&(0,X.jsxs)(`p`,{role:`alert`,className:`m-0 flex items-center gap-2 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[(0,X.jsx)(l,{size:14,"aria-hidden":`true`}),o]}),(0,X.jsx)(V,{label:t,placeholder:`Find by id or words`,resetKey:String(e),empty:`Nothing to pick.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:R,children:`Name`}),(0,X.jsx)(`th`,{className:R,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Pick`})})]}),children:r.map(e=>(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,X.jsxs)(`td`,{className:O(H,`max-w-0`),children:[(0,X.jsx)(Z,{text:e.label}),e.sub&&(0,X.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-muted`,children:e.sub})]}),(0,X.jsx)(`td`,{className:O(H,`w-24 text-right`),children:(0,X.jsxs)(L,{size:`sm`,onClick:()=>void d(e.id),disabled:!!c,children:[(0,X.jsx)(_,{"aria-hidden":`true`}),`Link`]})})]},e.id))})]})})}var Ye=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Xe({caseKey:t,onRun:n}){let[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``);(0,q.useEffect)(()=>{a(null),J.case(t).then(e=>{a(e),s(``)},e=>s(e.message))},[t]);let f=(0,X.jsxs)(`a`,{href:F(`test-management`,`cases`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,X.jsx)(p,{size:14,"aria-hidden":`true`}),`Test cases`]});if(o)return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f,(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:o})]});if(!i)return(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let h=i.case,g=Ye(h.url);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[f,(0,X.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono text-accent-fg`,children:h.id}),` · `,h.plans.join(`, `)||`Not in a synced plan`]}),(0,X.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:h.title}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[h.priority&&(0,X.jsxs)(A,{tone:h.priority===1?`fail`:h.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,h.priority]}),h.state&&(0,X.jsx)(A,{tone:`neutral`,children:h.state}),(0,X.jsx)(Pe,{a:h.automation}),h.origin===`forgeqe`&&(0,X.jsxs)(A,{tone:`running`,icon:!1,children:[(0,X.jsx)(v,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,h.createdAt?` ${G(h.createdAt)}`:``]})]})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[g&&(0,X.jsxs)(`a`,{className:ie(),href:g,target:`_blank`,rel:`noreferrer noopener`,children:[(0,X.jsx)(m,{"aria-hidden":`true`}),`Open in its system`]}),h.how!==`none`&&h.how!==`tracker`&&!!h.test?.file&&h.trackerAutomated!==!0&&(0,X.jsxs)(L,{onClick:()=>l(`automation`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Mark automated in its system`]}),h.ownTags.some(e=>!h.trackerTags.includes(e))&&(0,X.jsxs)(L,{onClick:()=>l(`tags`),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Write tags to its system`]}),h.ownTags.some(e=>h.trackerTags.includes(e))&&(0,X.jsxs)(L,{onClick:()=>l(`untag`),children:[(0,X.jsx)(b,{"aria-hidden":`true`}),`Take tags off in its system`]}),(0,X.jsxs)(L,{variant:`primary`,onClick:()=>n([h.key]),children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Run`]})]})]}),(0,X.jsx)(Ae,{kind:c,keys:[h.key],onClose:()=>l(null),onDone:e=>(d(e),void J.case(t).then(a,()=>{}))}),u&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:u}),(h.stale||h.drift)&&(0,X.jsxs)(`p`,{role:`status`,className:`m-0 flex items-start gap-2 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:[(0,X.jsx)(D,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,X.jsxs)(`span`,{children:[h.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,h.drift&&(h.trackerAutomated?`Its system marks it automated, but ForgeQE knows no test for it.`:`ForgeQE has a test for it, but its system does not mark it automated.`)]})]}),(0,X.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,X.jsx)(V,{label:`Steps`,search:!1,empty:`Its system holds no steps for it, or it is not in a synced plan.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-10`),children:`#`}),(0,X.jsx)(`th`,{className:R,children:`Action`}),(0,X.jsx)(`th`,{className:R,children:`Expected result`})]}),children:i.steps.map((e,t)=>(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,X.jsx)(`td`,{className:O(H,`text-[13px] text-muted tabular-nums`),children:t+1}),(0,X.jsx)(`td`,{className:O(H,`text-[13px] [overflow-wrap:anywhere]`),children:e.action}),(0,X.jsx)(`td`,{className:O(H,`text-[13px] text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,X.jsx)(Ze,{detail:i,onChanged:e=>(d(e),void J.case(t).then(a,()=>{}))})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,X.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6 text-[13px]`,children:[(0,X.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Details`}),(0,X.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,X.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Fe,{o:h.lastRun.outcome}),h.lastRun.at&&(0,X.jsxs)(`span`,{className:`text-muted`,children:[G(h.lastRun.at),h.lastRun.by===`tracker`?`, in its system`:``]})]}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`Suite`}),(0,X.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:h.suite??`–`}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,X.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:h.group??`–`}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,X.jsx)(`dd`,{className:`m-0`,children:h.stories.join(`, `)||`–`}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,X.jsx)(`dd`,{className:`m-0`,children:h.tags.length?(0,X.jsx)(Q,{tags:h.tags,max:10}):`–`}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,X.jsx)(`dd`,{className:`m-0`,children:h.steps})]})]}),(0,X.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,X.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-[16px] font-semibold`,children:[(0,X.jsx)(r,{size:16,"aria-hidden":`true`}),`In suites and packs`]}),i.suites.length||h.packs.length?(0,X.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[i.suites.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`a`,{href:F(`test-management`,`suites`,e.id),children:e.name})},e.id)),h.packs.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`a`,{href:F(`regression`,e),children:[`Pack `,e]})},e))]}):(0,X.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})]}),i.changes.length>0&&(0,X.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,X.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`What ForgeQE did`}),(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:i.changes.map((e,t)=>(0,X.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:G(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})]})]})]})]})}function Ze({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``);(0,q.useEffect)(()=>{(n.proposed.length||a)&&J.tests().then(e=>i(e.tests),()=>{})},[n.proposed.length,a]);let u=new Map((r??[]).filter(e=>e.uid).map(e=>[e.uid,e])),f=async(e,r,i)=>{l(``);try{await J.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){l(e.message)}},p=async e=>{l(``);try{t(`${e} is the main test now${(await J.setMain(n.key,e)).mapped?`, and ForgeQE's mapping records it`:``}. Mark automated writes it to the tracker.`)}catch(e){l(e.message)}},m=async()=>{l(``);try{await J.proposeLinks([n.key]),t(`The mapping agent is looking for this case's tests. Open the case again in a moment.`)}catch(e){l(e.message)}};return(0,X.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-[16px] font-semibold`,children:[(0,X.jsx)(d,{size:16,"aria-hidden":`true`}),`Automated tests`]}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>o(!0),children:[(0,X.jsx)(_,{"aria-hidden":`true`}),`Link a test`]}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>void m(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,X.jsx)(v,{"aria-hidden":`true`}),`Ask the agent`]})]}),c&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),n.tests.length?(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[13px]`,children:n.tests.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2 border-t border-line-soft py-2 first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 [overflow-wrap:anywhere]`,children:[e.name,e.main&&n.tests.length>1&&(0,X.jsx)(`span`,{"data-tip":`What its tracker records as its automated test, and what a run reuses first`,children:(0,X.jsx)(A,{tone:`pass`,icon:!1,children:`Main test`})})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[13px] text-muted`,children:[e.uid&&(0,X.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.uid}),e.file&&(0,X.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.file})]}),(0,X.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[ve[e.how],e.why&&e.why!==ve[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,X.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>void p(e.uid),"aria-label":`Make ${e.name} the main test`,"data-tip":`Its tracker records this one as the case's automated test`,children:[(0,X.jsx)(C,{"aria-hidden":`true`}),`Make main`]}),e.uid&&e.how!==`mapping`&&(0,X.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>void f(e.uid,`unlink`,`Unlinked ${e.uid}. It is not linked again by itself.`),"aria-label":`Unlink ${e.name}`,children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Unlink`]})]},e.uid??e.key))}):n.test?(0,X.jsxs)(`dl`,{className:`m-0 grid grid-cols-[120px_1fr] gap-x-4 gap-y-2 text-[13px]`,children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`Test`}),(0,X.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:n.test.name}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`File`}),(0,X.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:n.test.file??`–`}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`Known from`}),(0,X.jsx)(`dd`,{className:`m-0`,children:n.how===`none`?`–`:ve[n.how]})]}):(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No automated test is linked. Link one, ask the agent, or ask the agent on the right to automate it.`}),(n.tests.length>0||n.test)&&(0,X.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[`Last runs `,(0,X.jsx)(Ie,{runs:e.test?.runs??n.runs})]}),n.proposed.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Proposed by the mapping agent`}),n.proposed.map(e=>{let t=u.get(e.test);return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,X.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t?.name??e.test}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.test}),e.confidence?` · ${e.confidence} confidence`:``,e.why?` · ${e.why}`:``]})]}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>void f(e.test,`accept`,`Linked ${e.test}.`),children:[(0,X.jsx)(T,{"aria-hidden":`true`}),`Accept`]}),(0,X.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>void f(e.test,`refuse`,`Refused ${e.test}.`),children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Refuse`]})]},e.test)})]}),(0,X.jsx)(Je,{open:a,title:`Link a test`,description:`Pick a test that checks ${n.id}. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:(r??[]).filter(e=>e.uid&&!n.tests.some(t=>t.uid===e.uid)).map(e=>({id:e.uid,label:e.name,sub:`${e.uid}${e.file?` · ${e.file}`:``}`})),onClose:()=>o(!1),onPick:async e=>{await J.link([{case:n.key,test:e,action:`link`}]),o(!1),t(`Linked ${e}.`)}})]})}var Qe=[{id:`all`,label:`All`,icon:w,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:o,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:l,test:Ve,alert:!0},{id:`pending`,label:`Pending`,icon:c,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:v,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:D,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:D,test:e=>e.drift}],$=``,$e=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function et({cases:t,tests:n=0,selected:i,onSelect:a,onRun:o,onChanged:c}){let[l,u]=(0,q.useState)(`all`),[d,f]=(0,q.useState)($),[p,m]=(0,q.useState)($),[h,_]=(0,q.useState)($),[y,b]=(0,q.useState)($),[x,ee]=(0,q.useState)(!1),[te,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(null),T=(0,q.useMemo)(()=>$e(t.flatMap(e=>e.plans)),[t]),D=(0,q.useMemo)(()=>$e(t.map(e=>e.suite)),[t]),ne=(0,q.useMemo)(()=>$e(t.flatMap(e=>e.tags)),[t]),re=t.filter(e=>(!d||e.plans.includes(d))&&(!p||e.suite===p)&&(!h||String(e.priority??``)===h)&&(!y||e.tags.includes(y))),ie=Qe.find(e=>e.id===l),k=re.filter(ie.test),A=new Set(i),ae=(e,t)=>a(t?[...i,e]:i.filter(t=>t!==e)),j=k.length>0&&k.every(e=>A.has(e.key));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i.length>0&&(0,X.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-accent-soft px-4 py-2 text-[13px] text-accent-fg`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[i.length,` selected`]}),(0,X.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>a([]),children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Clear`]}),(0,X.jsx)(`span`,{className:`flex-1`}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>ee(!0),children:[(0,X.jsx)(g,{"aria-hidden":`true`}),`Tag`]}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>S(!0),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),`Make a suite`]}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>w(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Mark automated`]}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>w(`tags`),"data-tip":`Write ForgeQE's tags to their tracker`,children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Write tags`]}),(0,X.jsxs)(L,{size:`sm`,variant:`primary`,onClick:()=>o(i),children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Run `,i.length]})]}),(0,X.jsx)(V,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,resetKey:`${l}|${d}|${p}|${h}|${y}`,empty:t.length?`Nothing matches.`:n?`No test cases yet. The repository's ${n} automated test${n===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,X.jsx)(oe,{items:Qe.map(e=>({id:e.id,label:e.label,icon:e.icon,n:re.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:l,onChange:u})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[T.length>1&&(0,X.jsxs)(N,{size:`sm`,"aria-label":`Plan`,value:d,onChange:e=>f(e.target.value),className:`w-auto`,children:[(0,X.jsx)(`option`,{value:$,children:`Every plan`}),T.map(e=>(0,X.jsx)(`option`,{children:e},e))]}),D.length>0&&(0,X.jsxs)(N,{size:`sm`,"aria-label":`Suite`,value:p,onChange:e=>m(e.target.value),className:`w-auto`,children:[(0,X.jsx)(`option`,{value:$,children:`Every suite`}),D.map(e=>(0,X.jsx)(`option`,{children:e},e))]}),(0,X.jsxs)(N,{size:`sm`,"aria-label":`Priority`,value:h,onChange:e=>_(e.target.value),className:`w-auto`,children:[(0,X.jsx)(`option`,{value:$,children:`Any priority`}),[`1`,`2`,`3`,`4`].map(e=>(0,X.jsxs)(`option`,{value:e,children:[`Priority `,e]},e))]}),ne.length>0&&(0,X.jsxs)(N,{size:`sm`,"aria-label":`Tag`,value:y,onChange:e=>b(e.target.value),className:`w-auto`,children:[(0,X.jsx)(`option`,{value:$,children:`Any tag`}),ne.map(e=>(0,X.jsx)(`option`,{children:e},e))]})]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-10`),children:(0,X.jsx)(K,{"aria-label":`Select every case shown`,checked:j,onCheckedChange:e=>a(e?$e([...i,...k.map(e=>e.key)]):i.filter(e=>!k.some(t=>t.key===e)))})}),(0,X.jsx)(`th`,{className:R,children:`Test case`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Suite`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Priority`}),(0,X.jsx)(`th`,{className:R,children:`Automation`}),(0,X.jsx)(`th`,{className:O(R,`hidden @4xl:table-cell`),children:`Last runs`}),(0,X.jsx)(`th`,{className:R,children:`Last run`}),(0,X.jsx)(`th`,{className:R,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:k.map(t=>(0,X.jsxs)(`tr`,{className:O(`border-t border-line-soft align-top hover:bg-surface-muted`,A.has(t.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(K,{"aria-label":`Select ${t.id}`,checked:A.has(t.key),onCheckedChange:e=>ae(t.key,e)})}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsxs)(`a`,{href:He(t.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,X.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.title}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono text-accent-fg`,children:t.id}),t.origin===`forgeqe`&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"data-tip":`ForgeQE wrote this case`,children:[(0,X.jsx)(v,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),t.stories[0]&&(0,X.jsx)(`span`,{children:t.stories[0]}),(0,X.jsx)(Q,{tags:t.tags,max:2})]})]})}),(0,X.jsx)(`td`,{className:O(H,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,X.jsx)(Z,{text:t.suite??t.plans[0]??`–`})}),(0,X.jsx)(`td`,{className:O(H,`hidden text-[13px] @2xl:table-cell`),children:t.priority?`P${t.priority}`:`–`}),(0,X.jsxs)(`td`,{className:H,children:[(0,X.jsx)(Pe,{a:t.automation}),t.stale&&(0,X.jsx)(`span`,{className:`mt-1 block text-[13px] text-warn`,children:`Steps changed`})]}),(0,X.jsx)(`td`,{className:O(H,`hidden @4xl:table-cell`),children:(0,X.jsx)(Ie,{runs:t.runs})}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(`span`,{"data-tip":t.lastRun.at?`${G(t.lastRun.at)}${t.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:(0,X.jsx)(Fe,{o:t.lastRun.outcome})})}),(0,X.jsx)(`td`,{className:O(H,`text-right whitespace-nowrap`),children:(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${t.id}`,"data-tip":Ve(t)?`Run again`:`Run`,onClick:()=>o([t.key]),children:(0,X.jsx)(e,{"aria-hidden":`true`})})})]},t.key))}),(0,X.jsx)(Ae,{kind:C,keys:i,onClose:()=>w(null),onDone:e=>c(e)}),(0,X.jsx)(tt,{open:x,keys:i,onClose:()=>ee(!1),onDone:e=>c(e)}),(0,X.jsx)(nt,{open:te,keys:i,onClose:()=>S(!1),onDone:e=>c(e)})]})}function tt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,q.useState)(``),[o,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(!1),p=async()=>{f(!0),u(``);try{let e={[o?`remove`:`add`]:[i.trim()],cases:t};await J.tag(e);let s=await J.tag(e,!0);r(`${o?`Removed`:`Added`} the tag ${i.trim()} ${o?`from`:`on`} ${s.changed??0} case${s.changed===1?``:`s`}.`),a(``),n()}catch(e){u(e.message)}finally{f(!1)}};return(0,X.jsx)(B,{open:e,onClose:n,title:`Tag ${t.length} test case${t.length===1?``:`s`}`,description:`ForgeQE keeps its tags in .forgeqe/testmgmt/tags.json, shared with the team through the repository. The case's own tags in its system do not change.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{onClick:n,children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(L,{variant:`primary`,disabled:d||!i.trim(),onClick:()=>void p(),children:[(0,X.jsx)(g,{"aria-hidden":`true`}),o?`Remove`:`Add`,` tag`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Tag`,(0,X.jsx)(k,{value:i,maxLength:40,placeholder:`smoke, release-24.11`,onChange:e=>a(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(K,{checked:o,onCheckedChange:c}),`Remove it instead`]}),l&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:l})]})})}function nt({open:e,keys:t,onClose:n,onDone:i}){let[a,o]=(0,q.useState)(``),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(!1),f=async()=>{d(!0),l(``);try{let{suite:e}=await J.saveSuite({name:a.trim(),groups:[],exclude:[],picked:t});i(`Made the suite ${e.name}.`),o(``),n(),location.hash=F(`test-management`,`suites`,e.id)}catch(e){l(e.message)}finally{d(!1)}};return(0,X.jsx)(B,{open:e,onClose:n,title:`A suite of ${t.length} test case${t.length===1?``:`s`}`,description:`Kept in .forgeqe/testmgmt/suites.json. For a suite that keeps up as plans change, ask the Suite agent on Suites.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{onClick:n,children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(L,{variant:`primary`,disabled:u||!a.trim(),onClick:()=>void f(),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),`Make the suite`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Name`,(0,X.jsx)(k,{value:a,maxLength:80,placeholder:`Saved cards`,onChange:e=>o(e.target.value)})]}),c&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:c})]})})}var rt=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),it=(e,t)=>t?Math.round(e/t*100):0;function at(e,t,n){if(e.length<2)return;let r=e.at(-1),i=new Date(`${r.day}T00:00:00Z`).getTime()-6048e5,a=[...e].reverse().find(e=>new Date(`${e.day}T00:00:00Z`).getTime()<=i)??e[0],o=t(r)-t(a);return{text:`${o>0?`+`:``}${o}`,dir:o>0?`up`:o<0?`down`:`same`,...n===void 0||o===0?{}:{good:o>0===n},against:`since ${rt(a.day)}`}}function ot({view:t,onRunSuite:n}){let r=t.summary;if(!r.cases&&!t.plans.length&&r.tests)return(0,X.jsx)(M,{icon:d,title:`${r.tests} automated test${r.tests===1?``:`s`} found, no test case yet`,action:(0,X.jsxs)(`a`,{className:ie({size:`sm`}),href:F(`test-management`,`tests`),"data-tip":`Open the Automated tab`,children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`See the tests`]}),children:`These are the tests in the automation repository's code. Add a test plan in Settings › Integrations (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) to see the test cases they cover, which are automated and which are not.`});if(!r.cases&&!t.plans.length)return(0,X.jsx)(M,{icon:w,title:`No test plans connected yet`,action:(0,X.jsxs)(`a`,{className:ie({size:`sm`}),href:F(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,X.jsx)(S,{"aria-hidden":`true`}),`Settings`]}),children:`Add a test plan under Test plans in Test management, in your test case system's settings (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest). Its cases show here with their automation, runs and gaps. Cases ForgeQE wrote or automated show here already.`});let i=t.trend;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,X.jsxs)(le,{label:`Headline numbers`,children:[(0,X.jsx)(W,{label:`Test cases`,icon:w,value:r.cases,change:at(i,e=>e.cases,void 0),note:`${t.plans.length} plan${t.plans.length===1?``:`s`}`}),(0,X.jsx)(W,{label:`Automated`,icon:a,value:`${r.automated} · ${it(r.automated,r.cases)}%`,change:at(i,e=>e.automated,!0),note:`${r.newlyAutomated} newly this week`}),(0,X.jsx)(W,{label:`Not automated`,icon:o,value:r.notAutomated,change:at(i,e=>e.notAutomated,!1)}),(0,X.jsx)(W,{label:`Pending`,icon:c,value:r.pending,tone:r.pending?`text-warn`:void 0,change:at(i,e=>e.pending,!1),note:`in Design or not ready`}),(0,X.jsx)(W,{label:`Failing`,icon:l,value:r.failing,tone:r.failing?`text-fail`:void 0,change:at(i,e=>e.failing,!1),note:`their last run`}),(0,X.jsx)(W,{label:`Generated by ForgeQE`,icon:v,value:r.generated,change:at(i,e=>e.generated,!0)})]}),(0,X.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,X.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automation coverage`}),(0,X.jsx)(Le,{label:`Share of test cases automated`,points:i.map(e=>({x:rt(e.day),y:it(e.automated,e.cases)})),format:e=>`${e}%`})]}),(0,X.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Generated and automated, by week`}),(0,X.jsx)(Re,{label:`Test cases generated and automated each week`,series:[{name:`Generated`,className:`bg-accent-line`},{name:`Automated`,className:`bg-accent`}],items:t.weekly.map(e=>({x:rt(e.week),values:[e.generated,e.automated]}))})]}),(0,X.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Last run of every case`}),(0,X.jsxs)(`div`,{role:`img`,"aria-label":`Passed ${r.cases-r.failing-r.neverRun}, failing ${r.failing}, not run ${r.neverRun}`,className:`flex h-3 gap-1 overflow-hidden rounded-full`,children:[(0,X.jsx)(`span`,{className:`bg-pass`,style:{flex:r.cases-r.failing-r.neverRun}}),(0,X.jsx)(`span`,{className:`bg-fail`,style:{flex:r.failing}}),(0,X.jsx)(`span`,{className:`bg-line-strong`,style:{flex:r.neverRun}})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-4 text-[13px]`,children:[(0,X.jsx)(`a`,{href:F(`test-management`,`cases`),className:`no-underline`,children:(0,X.jsxs)(A,{tone:`pass`,children:[`Passed `,r.cases-r.failing-r.neverRun]})}),(0,X.jsx)(`a`,{href:F(`test-management`,`gaps`),className:`no-underline`,children:(0,X.jsxs)(A,{tone:`fail`,children:[`Failing `,r.failing]})}),(0,X.jsx)(`a`,{href:F(`test-management`,`gaps`),className:`no-underline`,children:(0,X.jsxs)(A,{tone:`neutral`,children:[`Not run `,r.neverRun]})})]})]}),(0,X.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,X.jsxs)(`span`,{className:`flex items-baseline justify-between gap-4`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automated, by suite`}),(0,X.jsx)(`a`,{href:F(`test-management`,`gaps`),className:`text-[13px]`,children:`Find gaps`})]}),t.coverage.length?t.coverage.slice(0,8).map(e=>(0,X.jsx)(ze,{label:e.suite,part:e.automated,whole:e.cases},e.suite)):(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No suites yet.`})]})]}),(0,X.jsx)(V,{label:`Suites`,placeholder:`Find a suite`,empty:`No suites yet: ask the Suite agent for one on Suites.`,search:t.suites.length>8,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:R,children:`Suite`}),(0,X.jsx)(`th`,{className:U,children:`Cases`}),(0,X.jsx)(`th`,{className:R,children:`Last run`}),(0,X.jsx)(`th`,{className:R,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.suites.map(t=>(0,X.jsxs)(`tr`,{className:de,onClick:()=>location.hash=F(`test-management`,`suites`,t.id),children:[(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(`a`,{href:F(`test-management`,`suites`,t.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:t.name})}),(0,X.jsx)(`td`,{className:z,children:t.cases}),(0,X.jsx)(`td`,{className:H,children:t.last?(0,X.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,X.jsxs)(A,{tone:t.last.failed?`fail`:`pass`,children:[t.last.passed,` passed`,t.last.failed?`, ${t.last.failed} failed`:``]}),(0,X.jsx)(`span`,{className:`text-muted`,children:G(t.last.at)})]}):(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,X.jsxs)(`td`,{className:`${H} text-right whitespace-nowrap`,onClick:e=>e.stopPropagation(),children:[!!t.last?.failed&&(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${t.name}`,"data-tip":`Rerun failed`,onClick:()=>n(t.id,`failed`),children:(0,X.jsx)(u,{"aria-hidden":`true`})}),(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${t.name}`,"data-tip":`Run`,onClick:()=>n(t.id),children:(0,X.jsx)(e,{"aria-hidden":`true`})})]})]},t.id))}),(0,X.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[(0,X.jsx)(d,{size:14,"aria-hidden":`true`}),r.tests,` automated tests known, `,r.testsWithoutCase,` with no test case behind them.`]})]})}var st=e=>e&&/^https:\/\//i.test(e)?e:void 0;function ct({id:e,title:t,url:n}){let r=st(n);return(0,X.jsxs)(`span`,{className:`flex min-w-[220px] flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),r?(0,X.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-[13px] text-accent-fg`,children:e}):(0,X.jsx)(`span`,{className:`font-mono text-[13px] text-accent-fg`,children:e})]})}var lt={azure_devops:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`iteration`,label:`Iteration path`,placeholder:`Shop\\Release 3`},{key:`area`,label:`Area path`,placeholder:`Shop\\Checkout`},{key:`parent`,label:`Epic or feature`,placeholder:`1234`,number:!0},{key:`ids`,label:`Work item ids`,placeholder:`101, 102`,list:`numbers`},{key:`project`,label:`Project`,placeholder:`When Settings names none`}],jira:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`fixVersion`,label:`Fix version`,placeholder:`2.4.0`},{key:`epic`,label:`Epic`,placeholder:`SHOP-12`},{key:`keys`,label:`Story keys`,placeholder:`SHOP-101, SHOP-102`,list:`keys`},{key:`project`,label:`Project key`,placeholder:`SHOP`}],qtest:[{key:`module`,label:`Requirements module`,placeholder:`Module id, e.g. 1203`,number:!0},{key:`ids`,label:`Requirement ids`,placeholder:`5101, 5102`,list:`numbers`}]};function ut(e,t){let n={system:e};for(let r of lt[e]){let i=(t[r.key]??``).trim();i&&(r.list===`numbers`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(Number):r.list===`keys`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(e=>e.toUpperCase()):r.number?n[r.key]=Number(i):n[r.key]=r.key===`project`&&e===`jira`?i.toUpperCase():i)}return n}var dt=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function ft({gaps:e,onRead:n}){let[r,i]=(0,q.useState)(e.live?.system??`azure_devops`),[a,o]=(0,q.useState)(dt(e.live)),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(``);(0,q.useEffect)(()=>{e.live&&(i(e.live.system),o(dt(e.live)))},[e.live]);let d=async()=>{c(!0),u(``);try{await J.readStories(ut(r,a)),n()}catch(e){u(e.message)}finally{c(!1)}};return(0,X.jsxs)(`form`,{className:`card flex flex-col gap-4 rounded-[14px] border p-4`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:`Stories in`}),(0,X.jsxs)(N,{size:`sm`,value:r,onChange:e=>(i(e.target.value),o({})),className:`w-auto`,children:[(0,X.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`}),(0,X.jsx)(`option`,{value:`jira`,children:`Jira (also Xray and Zephyr Scale)`}),(0,X.jsx)(`option`,{value:`qtest`,children:`qTest requirements`})]})]}),lt[r].map(e=>(0,X.jsxs)(`label`,{className:`flex min-w-[140px] flex-[1_1_140px] flex-col gap-1 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,X.jsx)(k,{size:`sm`,value:a[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>o({...a,[e.key]:t.target.value})})]},e.key)),(0,X.jsxs)(L,{size:`sm`,variant:`primary`,type:`submit`,disabled:s||!lt[r].some(e=>e.key!==`project`&&(a[e.key]??``).trim()),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),s?`Reading…`:`Read stories`]})]}),l&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:l})]})}function pt({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,X.jsx)(ft,{gaps:t,onRead:i});if(!t.report)return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,X.jsx)(M,{icon:ee,title:`No stories read yet`,children:`Say which stories to read: a sprint, an iteration, an area, an epic or the ids. ForgeQE reads each story with its test cases and acceptance criteria from the tracker, as Release readiness does, and reads them again with every sync.`})]});let o=(0,X.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.report.id===`live`?`Read from the tracker${t.report.at?` ${G(t.report.at)}`:``}: ${t.report.scope}`:`From the readiness report of ${t.report.scope||t.report.id}`,` (`,t.stories,` stor`,t.stories===1?`y`:`ies`,`).`,e===`stories`&&n.length>0&&` ${n.length} picked for the Gap agent's "Cases for stories".`]}),s=new Set(t.noCase.map(e=>e.id)),c=new Set(n.filter(e=>s.has(e)));return e===`stories`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,X.jsx)(V,{label:`Stories with no test case`,placeholder:`Find a story`,empty:`Every story of the release has a test case.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-10`),children:(0,X.jsx)(K,{"aria-label":`Pick every story shown`,checked:t.noCase.length>0&&t.noCase.every(e=>c.has(e.id)),onCheckedChange:e=>r(e?t.noCase.map(e=>e.id).slice(0,50):[])})}),(0,X.jsx)(`th`,{className:O(R,`w-[55%]`),children:`Story`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Type`}),(0,X.jsx)(`th`,{className:R,children:`State`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Area`})]}),children:t.noCase.map(e=>(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(K,{"aria-label":`Pick ${e.id}`,checked:c.has(e.id),onCheckedChange:t=>r(t?[...c,e.id].slice(0,50):[...c].filter(t=>t!==e.id))})}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(ct,{id:e.id,title:e.title,url:e.url})}),(0,X.jsx)(`td`,{className:O(H,`hidden text-[13px] @2xl:table-cell`),children:e.type||`–`}),(0,X.jsx)(`td`,{className:H,children:e.state?(0,X.jsx)(A,{tone:`neutral`,icon:!1,children:e.state}):(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,X.jsx)(`td`,{className:O(H,`hidden text-[13px] @2xl:table-cell [overflow-wrap:anywhere]`),children:e.area||`–`})]},e.id))})]}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,X.jsx)(V,{label:`Acceptance criteria no test case covers`,placeholder:`Find a criterion`,empty:`Every traced acceptance criterion has a test case.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-[55%]`),children:`Criterion`}),(0,X.jsx)(`th`,{className:R,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,X.jsx)(`td`,{className:O(H,`[overflow-wrap:anywhere]`),children:e.text}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(ct,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var mt=[{id:`stories`,label:`Stories with no case`,icon:ee},{id:`criteria`,label:`Criteria not covered`,icon:w}],ht=[{id:`not_automated`,label:`Not automated`,icon:o},{id:`pending`,label:`Pending`,icon:c},{id:`never_run`,label:`Never run`,icon:o},{id:`failing`,label:`Failing`,icon:l,alert:!0},{id:`stale`,label:`Steps changed`,icon:D},{id:`drift`,label:`Tracker disagrees`,icon:D},{id:`no_case`,label:`Tests with no case`,icon:d}];function gt({gaps:t,cases:n,tests:r,selected:i,onSelect:a,onRun:o,pickedStories:s=[],onPickStories:c=()=>{},onStoriesRead:l=()=>{}}){let[u,d]=(0,q.useState)(n.length||!r.length?`not_automated`:`no_case`),f=new Map(n.map(e=>[e.key,e])),p=new Map(t.ranked.map(e=>[e.key,e.why])),m=u===`no_case`||u===`stories`||u===`criteria`?[]:u===`not_automated`?t.ranked.map(e=>e.key):t.lists[u],h=t.stories??{stories:0,noCase:[],criteria:[]},g={stories:h.noCase.length,criteria:h.criteria.length},_=m.map(e=>f.get(e)).filter(e=>!!e),v=new Set(i),y=(e,t)=>a(t?[...i,e]:i.filter(t=>t!==e));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,X.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,X.jsx)(oe,{items:[...ht.map(e=>({id:e.id,label:e.label,icon:e.icon,n:t.counts[e.id],...e.alert?{alert:!0}:{}})),...mt.map(e=>({id:e.id,label:e.label,icon:e.icon,n:g[e.id],tip:h.report?h.report.id===`live`?`Read from the tracker: ${h.report.scope}`:`From the readiness report of ${h.report.scope||h.report.id}`:`Read the release's stories from the tracker first`}))],value:u,onChange:e=>d(e)})}),u===`not_automated`&&_.length>0&&(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-[13px] text-ink-2`,children:[`Highest value first: priority, failing when run, in a pack, tagged smoke.`,(0,X.jsx)(L,{size:`sm`,onClick:()=>a(_.slice(0,20).map(e=>e.key)),children:`Pick the top 20`})]})]}),(0,X.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Not automated, by suite`}),t.bySuite.length?t.bySuite.slice(0,8).map(e=>(0,X.jsx)(ze,{label:e.suite,part:e.notAutomated+e.pending,whole:e.cases,className:`bg-warn`},e.suite)):(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Nothing left to automate.`})]})]}),u===`stories`||u===`criteria`?(0,X.jsx)(pt,{kind:u,gaps:h,picked:s,onPick:c,onRead:l}):u===`no_case`?(0,X.jsx)(V,{label:`Tests with no test case`,placeholder:`Find a test`,empty:`Every test ForgeQE knows has a test case behind it.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-[55%]`),children:`Test`}),(0,X.jsx)(`th`,{className:R,children:`Tags`}),(0,X.jsx)(`th`,{className:R,children:`Last runs`})]}),children:t.testsWithoutCase.map(e=>{let t=r.find(t=>t.key===e);return t?(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,X.jsxs)(`td`,{className:O(H,`max-w-0`),children:[(0,X.jsx)(Z,{text:t.name,tip:t.file?`${t.name} · ${t.file}`:t.name}),t.flaky&&(0,X.jsx)(A,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(Q,{tags:t.tags})}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(Ie,{runs:t.runs})})]},e):null})}):(0,X.jsx)(V,{label:ht.find(e=>e.id===u).label,placeholder:`Find a case`,resetKey:u,empty:`No gap of this kind.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-10`),children:(0,X.jsx)(K,{"aria-label":`Select every case shown`,checked:_.length>0&&_.every(e=>v.has(e.key)),onCheckedChange:e=>a(e?[...new Set([...i,..._.map(e=>e.key)])]:i.filter(e=>!_.some(t=>t.key===e)))})}),(0,X.jsx)(`th`,{className:R,children:`Test case`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Priority`}),(0,X.jsx)(`th`,{className:R,children:u===`not_automated`?`Why it matters`:`Automation`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Last run`}),(0,X.jsx)(`th`,{className:R,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:_.map(t=>(0,X.jsxs)(`tr`,{className:O(`border-t border-line-soft align-top hover:bg-surface-muted`,v.has(t.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(K,{"aria-label":`Select ${t.id}`,checked:v.has(t.key),onCheckedChange:e=>y(t.key,e)})}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsxs)(`a`,{href:He(t.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,X.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.title}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono text-accent-fg`,children:t.id}),t.suite&&(0,X.jsx)(`span`,{children:t.suite}),(0,X.jsx)(Q,{tags:t.tags,max:2})]})]})}),(0,X.jsx)(`td`,{className:O(H,`hidden text-[13px] @2xl:table-cell`),children:t.priority?`P${t.priority}`:`–`}),(0,X.jsx)(`td`,{className:H,children:u===`not_automated`?(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(p.get(t.key)??[]).map(e=>(0,X.jsx)(A,{tone:`running`,icon:!1,children:e},e)),!(p.get(t.key)??[]).length&&(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})]}):(0,X.jsx)(Pe,{a:t.automation})}),(0,X.jsx)(`td`,{className:O(H,`hidden @2xl:table-cell`),children:(0,X.jsx)(Fe,{o:t.lastRun.outcome})}),(0,X.jsx)(`td`,{className:O(H,`text-right`),children:(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${t.id}`,"data-tip":`Run`,onClick:()=>o([t.key]),children:(0,X.jsx)(e,{"aria-hidden":`true`})})})]},t.key))})]})}var _t=e=>e.from===`report`?`From the run's own report`:`From each case's latest result since the run started (its report is not written yet)`,vt={system:`system`,plan:`plan`,suite:`suite`,priority:`priority`,state:`state`,automation:`automation`,tag:`tag`,last_run:`last run`,origin:`origin`,stale:`steps changed`,in_pack:`in pack`};function yt({suites:t,onRun:n}){return t.length?(0,X.jsx)(V,{label:`Suites`,placeholder:`Find a suite`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-[40%]`),children:`Suite`}),(0,X.jsx)(`th`,{className:U,children:`Cases`}),(0,X.jsx)(`th`,{className:O(U,`hidden @xl:table-cell`),children:`Automated`}),(0,X.jsx)(`th`,{className:R,children:`Last run`}),(0,X.jsx)(`th`,{className:R,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.map(t=>(0,X.jsxs)(`tr`,{className:de,onClick:()=>location.hash=F(`test-management`,`suites`,t.id),children:[(0,X.jsxs)(`td`,{className:O(H,`max-w-0`),children:[(0,X.jsxs)(`a`,{href:F(`test-management`,`suites`,t.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[t.built===`agent`?(0,X.jsx)(v,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,X.jsx)(r,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,X.jsx)(Z,{text:t.name})]}),t.description&&(0,X.jsx)(Z,{text:t.description,className:`mt-1 text-[13px] text-muted`})]}),(0,X.jsx)(`td`,{className:z,children:t.cases}),(0,X.jsxs)(`td`,{className:O(z,`hidden @xl:table-cell`),children:[t.cases?Math.round(t.automated/t.cases*100):0,`%`]}),(0,X.jsx)(`td`,{className:H,children:t.last?(0,X.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-[13px]`,"data-tip":_t(t.last),children:[(0,X.jsxs)(A,{tone:t.last.failed?`fail`:`pass`,children:[t.last.passed,` passed`,t.last.failed?`, ${t.last.failed} failed`:``]}),(0,X.jsx)(`span`,{className:`text-muted`,children:G(t.last.at)})]}):(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,X.jsxs)(`td`,{className:O(H,`text-right whitespace-nowrap`),onClick:e=>e.stopPropagation(),children:[!!t.last?.failed&&(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${t.name}`,"data-tip":`Rerun failed`,onClick:()=>n(t.id,`failed`),children:(0,X.jsx)(u,{"aria-hidden":`true`})}),(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${t.name}`,"data-tip":`Run`,onClick:()=>n(t.id),children:(0,X.jsx)(e,{"aria-hidden":`true`})})]})]},t.id))}):(0,X.jsx)(M,{icon:r,title:`No suites yet`,children:`Tell the Suite agent on the right what the suite is for, such as “regression for the payments suite, P1 and anything failing lately”. It picks the cases from your plans, tags and runs.`})}function bt({id:t,onRun:n,onDeleted:r}){let[i,a]=(0,q.useState)(null),[o,c]=(0,q.useState)(``),[l,d]=(0,q.useState)(!1),[f,m]=(0,q.useState)(!1);(0,q.useEffect)(()=>{a(null),J.suite(t).then(e=>{a(e),c(``)},e=>c(e.message))},[t]);let h=(0,X.jsxs)(`a`,{href:F(`test-management`,`suites`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,X.jsx)(p,{size:14,"aria-hidden":`true`}),`All suites`]});if(o)return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail`,children:o})]});if(!i)return(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let g=i.suite,_=i.members.filter(e=>e.case.lastRun.outcome===`failed`||e.case.lastRun.outcome===`blocked`).length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,X.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:g.name}),g.description&&(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:g.description}),g.tracker&&(0,X.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Kept as`,` `,Ee(g.tracker)?(0,X.jsx)(`a`,{href:Ee(g.tracker),target:`_blank`,rel:`noreferrer noopener`,children:De(g.tracker)}):De(g.tracker)]})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(g.tracker||i.targets.length>0)&&(0,X.jsxs)(L,{onClick:()=>m(!0),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),g.tracker?`Keep in step`:`Keep in tracker`]}),(0,X.jsxs)(L,{variant:`danger`,onClick:()=>d(!0),children:[(0,X.jsx)(y,{"aria-hidden":`true`}),`Delete`]}),_>0&&(0,X.jsxs)(L,{onClick:()=>n(g.id,`failed`),children:[(0,X.jsx)(u,{"aria-hidden":`true`}),`Rerun `,_,` failed`]}),(0,X.jsxs)(L,{variant:`primary`,onClick:()=>n(g.id),children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Run suite`]})]})]}),(0,X.jsxs)(le,{label:`The suite`,children:[(0,X.jsx)(W,{compact:!0,label:`Cases`,value:g.cases,note:`${g.automated} automated`}),(0,X.jsx)(W,{compact:!0,label:`Last run`,value:g.last?`${g.last.passed} passed`:`Not run`,tone:g.last?.failed?`text-fail`:void 0,note:g.last?`${g.last.failed} failed · ${G(g.last.at)}${g.last.from===`report`?``:` · so far`}`:void 0}),(0,X.jsx)(W,{compact:!0,label:`Runs on`,value:g.env??`Active`,note:g.runs.length?`${g.runs.length} run${g.runs.length===1?``:`s`}`:`never run`}),(0,X.jsx)(W,{compact:!0,label:`Built`,value:g.built===`agent`?`Suite agent`:g.built===`rules`?`Rules`:`Picked`,note:`updated ${G(g.updatedAt)}`})]}),g.groupsCount.length>0&&(0,X.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,X.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Why these cases`}),(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:g.groupsCount.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`text-muted`,children:g.groups[t]?.rules.map(e=>`${vt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(` and `)}),(0,X.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label))})]}),(0,X.jsx)(V,{label:`Cases`,placeholder:`Find a case`,empty:`No case meets the suite's rules now.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-[45%]`),children:`Test case`}),(0,X.jsx)(`th`,{className:O(R,`hidden @xl:table-cell`),children:`Why it is in`}),(0,X.jsx)(`th`,{className:R,children:`Automation`}),(0,X.jsx)(`th`,{className:R,children:`Last run`})]}),children:i.members.map(e=>(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,X.jsx)(`td`,{className:O(H,`max-w-0`),children:(0,X.jsxs)(`a`,{href:He(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,X.jsx)(Z,{text:e.case.title,className:`font-medium`}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.case.id}),(0,X.jsx)(Q,{tags:e.case.tags})]})]})}),(0,X.jsx)(`td`,{className:O(H,`hidden text-[13px] text-ink-2 @xl:table-cell`),children:e.group}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(Pe,{a:e.case.automation})}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(Fe,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,X.jsx)(je,{open:f,suite:g,targets:i.targets,onClose:()=>m(!1),onDone:()=>void J.suite(t).then(a,()=>{})}),(0,X.jsx)(B,{open:l,onClose:()=>d(!1),title:`Delete ${g.name}?`,description:`The suite goes from .forgeqe/testmgmt/suites.json. Its cases and their runs stay.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{onClick:()=>d(!1),children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(L,{variant:`destructive`,onClick:()=>void J.deleteSuite(g.id).then(()=>{d(!1),r()},e=>c(e.message)),children:[(0,X.jsx)(y,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,X.jsx)(`p`,{className:`m-0 pt-4 text-[13px] text-ink-2`,children:`Runs already made are kept in Runs.`})})]})}function xt({open:e,onSaved:t}){let[n,r]=(0,q.useState)([]),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(``),d=[...n].reverse().find(e=>`built`in e)?.built,f=n.filter(e=>`you`in e).map(e=>e.you).join(`. `),p=async t=>{let n=t.trim();if(n){c(!0),u(``),r(e=>[...e,{you:n}]),o(``);try{let t=await J.buildSuite(f?`${f}. ${n}`:n,e?.id);r(e=>[...e,{built:t}])}catch(e){u(e.message)}finally{c(!1)}}},m=async n=>{if(d){c(!0);try{let{suite:i}=await J.saveSuite({...n&&e?{id:e.id}:{},name:n&&e?e.name:d.name,description:d.summary,groups:d.groups,exclude:d.exclude,built:`agent`});r([]),t(i)}catch(e){u(e.message)}finally{c(!1)}}};return(0,X.jsxs)(be,{title:`Suite agent`,about:`Builds and changes suites from your plans, tags and runs.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(e?[`Leave out cases that are not automated`,`Add everything failing lately`,`Only priority 1 and 2`]:[`Smoke suite`,`P1 cases that failed lately`,`Everything not automated in one suite`]).map(e=>(0,X.jsx)(L,{size:`sm`,disabled:s,onClick:()=>void p(e),children:e},e))}),(0,X.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),p(a)},children:[(0,X.jsx)(`label`,{className:`sr-only`,htmlFor:`tm-suite-words`,children:`Tell the Suite agent what the suite is for`}),(0,X.jsx)(`textarea`,{id:`tm-suite-words`,rows:2,maxLength:1e3,value:a,placeholder:e?`Change ${e.name}, or ask about it`:`Describe the suite you need, e.g. regression for Payments under 30 minutes`,onChange:e=>o(e.target.value),className:`min-h-11 flex-1 resize-none rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,X.jsx)(L,{size:`icon`,variant:`primary`,type:`submit`,disabled:s||!a.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,X.jsx)(i,{"aria-hidden":`true`})})]})]}),children:[(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,X.jsx)(j,{state:s?`thinking`:`working`,px:96,label:s?`Building the suite`:`Ready`}),(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:s?`Building the suite…`:e?`Looking at ${e.name}.`:`Ready. Say what the suite is for.`})]}),n.map((e,t)=>`you`in e?(0,X.jsx)(`p`,{className:`m-0 text-center text-[16px] leading-relaxed text-ink-2`,children:e.you},t):(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`p`,{className:`m-0 text-center text-[20px] leading-snug`,children:[e.built.name,`: `,e.built.cases,` case`,e.built.cases===1?``:`s`,`, `,e.built.automated,` automated.`]}),e.built.summary&&(0,X.jsx)(`p`,{className:`m-0 text-center text-[13px] text-ink-2`,children:e.built.summary}),e.built.note&&(0,X.jsx)(`p`,{className:`m-0 text-center text-[13px] text-muted`,children:e.built.note}),(0,X.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[e.built.perGroup.map(e=>(0,X.jsxs)(`span`,{className:`flex items-baseline gap-2`,"data-tip":e.why,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label)),e.built.exclude.length>0&&(0,X.jsxs)(`span`,{className:`text-muted`,children:[`Leaves out: `,e.built.exclude.map(e=>`${vt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===n.length-1&&(0,X.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.built.question.text}),e.built.question.options.map(e=>(0,X.jsx)(L,{size:`sm`,disabled:s,onClick:()=>void p(e),className:`justify-start`,children:e},e))]}),e.built.sample.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.built.sample.slice(0,5).map(e=>(0,X.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:e.case.id}),(0,X.jsx)(Z,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),l&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:l}),d&&(0,X.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,X.jsxs)(L,{disabled:s,onClick:()=>void m(!0),children:[(0,X.jsx)(T,{"aria-hidden":`true`}),`Update `,e.name]}),(0,X.jsxs)(L,{variant:`primary`,disabled:s,onClick:()=>void m(!1),children:[(0,X.jsx)(T,{"aria-hidden":`true`}),`Save `,e?`as a new suite`:`suite`]})]})]})}var St=[{id:`off`,label:`Off`,icon:o},{id:`hourly`,label:`Every hour`,icon:t},{id:`daily`,label:`Daily`,icon:h}];function Ct(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function wt({disabled:e}){let[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(null);return(0,q.useEffect)(()=>{J.schedule().then(e=>i(e.schedule),()=>{})},[]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{size:`sm`,disabled:e,onClick:()=>n(!0),"data-tip":r?.nextAt?`Next sync ${he(r.nextAt)}`:`Set when the plans are synced`,children:[(0,X.jsx)(h,{"aria-hidden":`true`}),Ct(r)]}),(0,X.jsx)(Tt,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}function Tt({open:e,onClose:t,now:n,onSaved:r}){let[i,a]=(0,q.useState)(`off`),[o,c]=(0,q.useState)(`06:00`),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(!1);(0,q.useEffect)(()=>{e&&(u(``),g(!!n&&n.every!==`off`&&n.every!==`custom`&&!!n.discover),J.discoveryPlan().then(m,()=>m(null)),a(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&c(n.at))},[e,n]);let _=async()=>{f(!0);try{let e=h&&p&&i!==`off`?{discover:p.digest}:{};r((await J.setSchedule(i===`daily`?{every:i,at:o,...e}:i===`hourly`?{every:i,...e}:{every:i})).schedule),t()}catch(e){u(e.message)}finally{f(!1)}};return(0,X.jsx)(B,{open:e,onClose:t,title:`Sync on a schedule`,description:`ForgeQE reads every case of the connected test plans again, as Sync does, and the stories Gaps read, in the jobs service (forgeqe testmgmt sync). It can also discover the tests first. It runs while this computer is on.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(L,{onClick:t,children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(L,{variant:`primary`,disabled:d||i===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(o),onClick:()=>void _(),children:[(0,X.jsx)(T,{"aria-hidden":`true`}),`Save`]})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,X.jsx)(`div`,{role:`group`,"aria-label":`When to sync`,className:`flex flex-wrap gap-2`,children:(0,X.jsx)(oe,{items:St.map(e=>({id:e.id,label:e.label,icon:e.icon})),value:i,onChange:a})}),i===`daily`&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Time (this computer's clock)`,(0,X.jsx)(k,{type:`time`,step:60,value:o,onChange:e=>c(e.target.value)})]}),i!==`off`&&p&&p.steps.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(K,{checked:h,onCheckedChange:e=>g(e===!0),"aria-label":`Also discover the tests`}),(0,X.jsx)(`span`,{children:`Also discover the tests first. This runs the repository's code with these commands, with no secret of ForgeQE's. If the test projects change, the schedule stops discovering until you confirm again.`})]}),h&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:p.steps.map((e,t)=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})},t))})]}),n?.every===`custom`&&(0,X.jsxs)(`p`,{className:`m-0 text-warn`,children:[`The sync job was changed outside this page (`,n.text,`). Saving here replaces it.`]}),n?.enabled===!1&&(0,X.jsx)(`p`,{className:`m-0 text-warn`,children:`The sync job is disabled in the jobs service.`}),n?.last&&(0,X.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Last scheduled sync `,he(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),l&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:l})]})})}var Et={forgeqe:{label:`ForgeQE`,icon:v},script:{label:`Tests`,icon:d}},Dt=e=>Et[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:x},Ot=e=>e!==`forgeqe`&&e!==`script`,kt=[];function At({tags:e,cases:t=[],onChanged:n}){let[r,i]=(0,q.useState)(`all`),[a,o]=(0,q.useState)(null),s=e=>e.system===`azure_devops`||e.system===`jira`,c=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&s(t)).map(e=>e.key),l=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&s(t)).map(e=>e.key),u=e.tags.filter(e=>r===`all`||(r===`out`?e.outOfStep>0:r===`tracker`?e.from.some(Ot):e.from.includes(r))),f=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,X.jsxs)(le,{label:`Tags`,children:[(0,X.jsx)(W,{compact:!0,label:`Tags in use`,icon:g,value:e.tags.length}),(0,X.jsx)(W,{compact:!0,label:`Test cases with a tag`,value:f(e.casesTagged,e.cases),note:`${e.casesTagged} of ${e.cases}`}),(0,X.jsx)(W,{compact:!0,label:`Tests with a tag`,value:f(e.testsTagged,e.tests),note:`${e.testsTagged} of ${e.tests}`}),(0,X.jsx)(W,{compact:!0,label:`Out of step`,icon:D,value:e.tags.filter(e=>e.outOfStep).length,tone:e.tags.some(e=>e.outOfStep)?`text-warn`:void 0,note:`a case's tag its test lacks`})]}),(0,X.jsx)(V,{label:`Tags`,placeholder:`Find a tag`,resetKey:r,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,X.jsx)(oe,{items:[{id:`all`,label:`All`,n:e.tags.length},{id:`tracker`,label:`From their systems`,icon:x,n:e.tags.filter(e=>e.from.some(Ot)).length},{id:`script`,label:`From tests`,icon:d,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,icon:v,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,icon:D,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:r,onChange:i})}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:O(R,`w-[28%]`),children:`Tag`}),(0,X.jsx)(`th`,{className:R,children:`Comes from`}),(0,X.jsx)(`th`,{className:U,children:`Test cases`}),(0,X.jsx)(`th`,{className:U,children:`Tests`}),(0,X.jsx)(`th`,{className:O(R,`hidden @xl:table-cell`),children:`Out of step`}),(0,X.jsx)(`th`,{className:O(R,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,X.jsx)(`th`,{className:R,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:u.map(e=>(0,X.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,X.jsx)(`td`,{className:H,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-[6px] bg-surface-strong px-2 text-[13px] font-medium`,children:[(0,X.jsx)(g,{size:12,"aria-hidden":`true`}),e.name]})}),(0,X.jsx)(`td`,{className:H,children:(0,X.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=Dt(e);return(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] border border-line px-2 text-[13px] text-ink-2`,children:[(0,X.jsx)(t.icon,{size:12,"aria-hidden":`true`}),t.label]},e)})})}),(0,X.jsx)(`td`,{className:z,children:e.cases}),(0,X.jsx)(`td`,{className:z,children:e.tests}),(0,X.jsx)(`td`,{className:O(H,`hidden @xl:table-cell`),children:e.outOfStep?(0,X.jsx)(A,{tone:`warn`,children:e.outOfStep}):(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,X.jsx)(`td`,{className:O(H,`hidden text-[13px] text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,X.jsxs)(`td`,{className:O(H,`text-right`),children:[c(e.name).length>0&&(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${c(e.name).length} cases`,"data-tip":`Write to the trackers of ${c(e.name).length} cases`,onClick:()=>o({kind:`tags`,keys:c(e.name)}),children:(0,X.jsx)(E,{"aria-hidden":`true`})}),l(e.name).length>0&&(0,X.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Take the tag ${e.name} off in the trackers of ${l(e.name).length} cases`,"data-tip":`Take off in the trackers of ${l(e.name).length} cases`,onClick:()=>o({kind:`untag`,keys:l(e.name),tags:[e.name]}),children:(0,X.jsx)(b,{"aria-hidden":`true`})})]})]},e.name))}),(0,X.jsx)(Ae,{kind:a?.kind??null,keys:a?.keys??kt,tags:a?.tags,onClose:()=>o(null),onDone:e=>n?.(e)})]})}var jt=[`dashboard`,`cases`,`tests`,`gaps`,`suites`,`tags`];function Mt({sub:n}){let r=(n??``).split(`/`).filter(Boolean),i=jt.includes(r[0])?r[0]:`dashboard`,a=i===`cases`&&r[1]?ae(r[1]):void 0,o=i===`suites`&&r[1]?ae(r[1]):void 0,[s,c]=(0,q.useState)(null),[u,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),[h,_]=(0,q.useState)([]),[y,b]=(0,q.useState)(null),[x,ee]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(``),[ne,re]=(0,q.useState)(!1),[ie,k]=(0,q.useState)([]),[j,M]=(0,q.useState)(null),[N,P]=(0,q.useState)(!0),I=(0,q.useCallback)(async()=>{try{let[e,t]=await Promise.all([J.view(),J.cases()]);c(e),f(t),ee(e.suites),C(e.job),T(``)}catch(e){T(e.message)}},[]);(0,q.useEffect)(()=>{I()},[I]),(0,q.useEffect)(()=>{i===`gaps`&&J.gaps().then(m,e=>T(e.message)),i===`tags`&&J.tags().then(b,e=>T(e.message)),i===`suites`&&J.suites().then(e=>ee(e.suites),e=>T(e.message))},[i,s]),(0,q.useEffect)(()=>{if(!S?.running)return;let e=setInterval(()=>{J.job().then(e=>{C(e.job),e.job?.running||I()},()=>{})},2e3);return()=>clearInterval(e)},[S?.running,I]);let oe=async()=>{re(!0),D(``);try{let e=await J.sync(),t=e.plans.filter(e=>e.error);D(t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`),await I()}catch(e){T(e.message)}finally{re(!1)}},R=e=>M({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>J.run(e,t,n)}),z=(e,t)=>{let n=x?.find(t=>t.id===e)??s?.suites.find(t=>t.id===e);M({title:`${t?`Rerun the failed cases of`:`Run`} ${n?.name??`the suite`}`,go:(n,r)=>J.runSuite(e,{...n?{env:n}:{},...t?{only:t}:{}},r)})},B=()=>{D(`The run started: it shows here while it runs, and in Runs.`),J.job().then(e=>C(e.job),()=>{})},V=e=>{D(e),k([]),I()},H=new Map((u?.cases??[]).map(e=>[e.key,e])),U=ie.filter(e=>H.has(e)),le=e=>e.map(e=>H.get(e).id),de=U.filter(e=>[`failed`,`blocked`].includes(H.get(e).lastRun.outcome)),W=U.filter(e=>H.get(e).automation!==`automated`),K=[{intent:`automate`,label:W.length?`Automate ${W.length}`:`Automate`,icon:d,keys:W.slice(0,50),...W.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:de.length?`Why ${de.length} fail`:`Why they fail`,icon:l,keys:de.slice(0,50),...de.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:g,keys:U.slice(0,50),...U.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:d,keys:U.filter(e=>H.get(e).tests.length>0&&H.get(e).tags.length>0).slice(0,50),...U.filter(e=>H.get(e).tests.length>0&&H.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],ge=(p?.ranked??[]).slice(0,20).map(e=>e.key),_e=[{intent:`automate`,label:U.length?`Automate ${U.length}`:`Automate the top ${ge.length}`,icon:d,keys:(U.length?U:ge).slice(0,50),...U.length||ge.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:l,keys:(p?.lists.failing??[]).slice(0,50),...p?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:h.length?`Cases for ${h.length} stor${h.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:v,keys:[],stories:(h.length?h:(p?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),...h.length||p?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],ve=o?x?.find(e=>e.id===o):void 0,ye=(0,X.jsxs)(`main`,{className:O(ue,`@container flex-auto gap-4`),children:[(0,X.jsx)(me,{}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,X.jsx)(ce,{pixel:se[`test-management`],size:`lg`}),(0,X.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test management`}),s&&(0,X.jsx)(pe,{label:`Test management`,className:`mb-0`,current:i,onPick:e=>location.hash=F(`test-management`,e),tabs:[{id:`dashboard`,label:`Dashboard`},{id:`cases`,label:`Test cases`,n:s.summary.cases},{id:`tests`,label:`Automated`,n:s.summary.tests},{id:`gaps`,label:`Gaps`,n:s.summary.notAutomated+s.summary.pending+s.summary.failing},{id:`suites`,label:`Suites`,n:s.suites.length},{id:`tags`,label:`Tags`}]}),s&&(0,X.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[s.plans.length>0&&(0,X.jsxs)(`span`,{"data-tip":s.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${he(e.at)}`:``}`).join(` · `),children:[s.plans.length,` plan`,s.plans.length===1?``:`s`,s.plans[0]?.at?`, synced ${G(s.plans.map(e=>e.at??``).sort()[0])}`:`, not synced yet`]}),s.plans.length>0&&(0,X.jsxs)(L,{size:`sm`,disabled:ne,onClick:()=>void oe(),"data-tip":`Read every case of the connected plans again`,children:[(0,X.jsx)(t,{"aria-hidden":`true`}),ne?`Syncing…`:`Sync`]}),(s.plans.length>0||s.summary.tests>0)&&(0,X.jsx)(wt,{disabled:ne}),(i===`cases`||i===`gaps`||i===`suites`)&&!N&&(0,X.jsxs)(L,{size:`sm`,onClick:()=>P(!0),children:[(0,X.jsx)(v,{"aria-hidden":`true`}),i===`suites`?`Suite agent`:`Agent`]})]})]}),w&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:w}),!s&&!w&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),E&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:E}),s&&s.refused.length>0&&(0,X.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`Not read, as their system does not write a plan that way: `,s.refused.join(` · `),`. Fix them in Settings › Integrations.`]}),S&&(0,X.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] border border-line px-4 py-2 text-[13px]`,children:[(0,X.jsx)(A,{tone:S.running?`running`:S.exitCode===0?`pass`:`fail`,children:S.running?`Running`:S.exitCode===0?`Finished`:`Stopped`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":S.command,children:S.lines.at(-1)??S.command}),S.running?(0,X.jsxs)(L,{size:`sm`,variant:`danger`,onClick:()=>void J.stop().then(e=>C(e.job)),children:[(0,X.jsx)(te,{"aria-hidden":`true`}),`Stop`]}):(0,X.jsx)(`a`,{href:F(`runs`),className:`text-[13px]`,children:`Runs`})]}),s&&(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)(`div`,{id:`panel-${i}`,role:`tabpanel`,"aria-labelledby":`tab-${i}`,className:`flex flex-col gap-4`,children:[i===`dashboard`&&(0,X.jsx)(ot,{view:s,onRunSuite:z}),i===`cases`&&(a?(0,X.jsx)(Xe,{caseKey:a,onRun:R}):u&&(0,X.jsx)(et,{cases:u.cases,tests:u.tests.length,selected:U,onSelect:k,onRun:R,onChanged:V})),i===`tests`&&u&&(0,X.jsx)(Ue,{cases:u.cases,onChanged:V}),i===`gaps`&&(p&&u?(0,X.jsx)(gt,{gaps:p,cases:u.cases,tests:u.tests,selected:U,onSelect:k,onRun:R,pickedStories:h,onPickStories:_,onStoriesRead:()=>(_([]),void I())}):(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`})),i===`suites`&&(o?(0,X.jsx)(bt,{id:o,onRun:z,onDeleted:()=>(location.hash=F(`test-management`,`suites`),void I())},o):x&&(0,X.jsx)(yt,{suites:x,onRun:z})),i===`tags`&&(y?(0,X.jsx)(At,{tags:y,cases:u?.cases,onChanged:V}):(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}))]})}),(0,X.jsx)(Be,{open:!!j,onClose:()=>M(null),title:j?.title??`Run`,preview:(e,t)=>j.go(e,t),onStarted:B})]}),Y=a?H.get(a):void 0;return(0,X.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,X.jsx)(fe,{}),(0,X.jsxs)(`div`,{className:`flex flex-auto flex-col xl:flex-row`,children:[(0,X.jsx)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:ye}),s&&N&&i===`cases`&&(0,X.jsx)(xe,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:Y?`Looking at ${Y.id}.`:U.length?`Looking at the ${U.length} cases you picked.`:`Looking at ${s.summary.cases} test cases. Pick some in the list.`,context:Y?[Y.id,...Y.plans.slice(0,1)]:U.length?le(U).slice(0,4):[],suggestions:Y?[{intent:Y.automation===`automated`?`run`:`automate`,label:Y.automation===`automated`?`Run it and explain`:`Automate it`,icon:Y.automation===`automated`?e:d,keys:[Y.key]},{intent:`investigate`,label:`Why it fails`,icon:l,keys:[Y.key],...[`failed`,`blocked`].includes(Y.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:g,keys:[Y.key]}]:K,placeholder:`Ask about these cases, or say what to do`,onClose:()=>P(!1)},a??`list`),s&&N&&i===`gaps`&&(0,X.jsx)(xe,{title:`Gap agent`,about:`Finds what to close first and closes it with you.`,looking:`Looking at ${s.summary.notAutomated} cases not automated, ${s.summary.pending} pending and ${s.summary.failing} failing.`,context:U.length?le(U).slice(0,4):[],suggestions:_e,placeholder:`What should we close first?`,onClose:()=>P(!1)}),s&&N&&i===`suites`&&(0,X.jsx)(xt,{open:ve,onSaved:e=>{D(`Saved the suite ${e.name}.`),I(),location.hash=F(`test-management`,`suites`,e.id)}})]})]})}export{Mt as TestManagement};