@capagents/forgeqe 2.7.1 → 2.7.3

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 (124) hide show
  1. package/HOW_TO_USE.md +82 -18
  2. package/THIRD_PARTY_NOTICES.md +62 -22
  3. package/bin/forgeqe.js +1 -1
  4. package/dist/docs-site/docs/architecture/index.html +1 -1
  5. package/dist/docs-site/docs/containers/index.html +1 -1
  6. package/dist/docs-site/docs/index.html +71 -2
  7. package/dist/docs-site/docs/search.js +1 -1
  8. package/dist/forgeqe.js +1775 -1520
  9. package/dist/web/THIRD_PARTY_NOTICES.md +578 -51
  10. package/dist/web/assets/Agent-DU51Em-3.js +4 -0
  11. package/dist/web/assets/ApiTests-D6YhbfPF.js +10 -0
  12. package/dist/web/assets/Chat-CQsQvyDs.js +3 -0
  13. package/dist/web/assets/Data-Djj0u25X.js +3 -0
  14. package/dist/web/assets/Evidence-R2GZ5yW9.js +1 -0
  15. package/dist/web/assets/Features-C1qvr-oy.js +1 -0
  16. package/dist/web/assets/Jobs-BOr2nkQa.js +5 -0
  17. package/dist/web/assets/KindPage-CB2gMzhI.js +6 -0
  18. package/dist/web/assets/Migration-71lvv1zU.js +2 -0
  19. package/dist/web/assets/Product-BAQtMlzO.js +7 -0
  20. package/dist/web/assets/Product-DLioOiRN.css +1 -0
  21. package/dist/web/assets/Quality-DeUvoOND.js +1 -0
  22. package/dist/web/assets/Record-CPjgxHRX.js +2 -0
  23. package/dist/web/assets/Regression-D8V0CNAw.js +5 -0
  24. package/dist/web/assets/Reports-Bhv6gqFl.js +2 -0
  25. package/dist/web/assets/Response-CXyWQxrt.js +4 -0
  26. package/dist/web/assets/Runs-Ba8X4nId.js +2 -0
  27. package/dist/web/assets/Shell-BoXDubsc.js +3 -0
  28. package/dist/web/assets/TestCases-DEciDMh1.js +1 -0
  29. package/dist/web/assets/TestData-DY6MVYdx.js +2 -0
  30. package/dist/web/assets/Tosca-BzNnPm0_.js +2 -0
  31. package/dist/web/assets/WhatsNew-7O1MlqCy.js +1 -0
  32. package/dist/web/assets/dataParts-0a9Sjn2u.js +3 -0
  33. package/dist/web/assets/index-C9TchKsF.css +2 -0
  34. package/dist/web/assets/index-DcmN4YB2.js +43 -0
  35. package/dist/web/assets/logos-BnPN8M-S.js +1 -0
  36. package/dist/web/assets/parts-mP2z3tbH.js +1 -0
  37. package/dist/web/assets/productParts-B2wO-b1i.js +1 -0
  38. package/dist/web/assets/qualityParts-ByR8_rNE.js +1 -0
  39. package/dist/web/assets/segmented-BZcnZadS.js +1 -0
  40. package/dist/web/assets/{thread-CHhZJi-Y.js → thread-DLf1W085.js} +2 -2
  41. package/dist/web/assets/usePageChat-lpZh_ziF.js +1 -0
  42. package/dist/web/index.html +3 -3
  43. package/docs/ARCHITECTURE.md +1 -1
  44. package/docs/CONTAINERS.md +1 -1
  45. package/docs/EVIDENCE.md +9 -4
  46. package/docs/GRAPHIFY.md +178 -0
  47. package/docs/PRODUCT_KNOWLEDGE.md +25 -4
  48. package/docs/PRODUCT_VIEWS.md +5 -2
  49. package/docs/prompts/graphify-evidence.md +167 -0
  50. package/docs/user-guide.html +71 -2
  51. package/evals/evidence/domain/base/orders-api/src/report.ts +4 -0
  52. package/evals/evidence/domain/base/orders-api/src/routes/admin.ts +2 -1
  53. package/evals/evidence/domain/cases/bad-function-removed/after/src/workflow.ts +6 -0
  54. package/evals/evidence/domain/cases/bad-function-removed/case.json +14 -0
  55. package/evals/evidence/domain/cases/bad-signature-changed/after/src/workflow.ts +6 -0
  56. package/evals/evidence/domain/cases/bad-signature-changed/case.json +14 -0
  57. package/evals/evidence/domain/cases/bad-state-set-directly/after/src/routes/admin.ts +2 -1
  58. package/evals/evidence/domain/cases/bad-untested-change/after/src/routes/admin.ts +2 -1
  59. package/evals/evidence/domain/cases/bad-untested-helper/after/src/report.ts +4 -0
  60. package/evals/evidence/domain/cases/bad-untested-helper/case.json +14 -0
  61. package/evals/evidence/domain/cases/good-optional-parameter/after/src/workflow.ts +6 -0
  62. package/evals/evidence/domain/cases/good-optional-parameter/case.json +12 -0
  63. package/evals/evidence/domain/cases/good-tested-helper/after/src/clients/payments.ts +8 -0
  64. package/evals/evidence/domain/cases/good-tested-helper/case.json +12 -0
  65. package/forgeqe.example.yaml +14 -1
  66. package/package.json +17 -14
  67. package/prompts/README.md +1 -0
  68. package/prompts/product-investigate.md +1 -1
  69. package/prompts/tosca.md +64 -0
  70. package/py/forgeqe_desktop/models.py +14 -5
  71. package/py/forgeqe_engine/__init__.py +1 -1
  72. package/py/forgeqe_knowledge/graphify_bridge.py +156 -0
  73. package/py/forgeqe_tosca/__init__.py +85 -0
  74. package/py/forgeqe_tosca/__main__.py +50 -0
  75. package/py/forgeqe_tosca/ntir.py +484 -0
  76. package/py/forgeqe_tosca/render.py +128 -0
  77. package/py/forgeqe_tosca/tsu.py +187 -0
  78. package/py/forgeqe_tosca/vendor/toscatsu/LICENSE +26 -0
  79. package/py/forgeqe_tosca/vendor/toscatsu/UPSTREAM +7 -0
  80. package/py/forgeqe_tosca/vendor/toscatsu/gen_tsu.py +735 -0
  81. package/py/forgeqe_tosca/vendor/toscatsu/parse_tsu.py +1979 -0
  82. package/py/forgeqe_tosca/vendor/toscatsu/spec_to_manifest.py +878 -0
  83. package/py/forgeqe_tosca/vendored.py +50 -0
  84. package/skills/tosca-knowledge/SKILL.md +56 -0
  85. package/skills/tosca-knowledge/references/actions-and-values.md +63 -0
  86. package/skills/tosca-knowledge/references/locators.md +29 -0
  87. package/skills/tosca-knowledge/references/mapping-cypress.md +21 -0
  88. package/skills/tosca-knowledge/references/mapping-playwright.md +31 -0
  89. package/skills/tosca-knowledge/references/mapping-selenium-webdriverio.md +26 -0
  90. package/skills/tosca-knowledge/references/ntir.md +46 -0
  91. package/dist/web/assets/Agent-Ol1sf0Me.js +0 -4
  92. package/dist/web/assets/ApiTests-BfN5VysH.js +0 -10
  93. package/dist/web/assets/Chat-Bk2ECB9h.js +0 -3
  94. package/dist/web/assets/Data-DSZ9xkqr.js +0 -3
  95. package/dist/web/assets/Evidence-BVjGRwcr.js +0 -1
  96. package/dist/web/assets/Features-DQEzR0Mz.js +0 -1
  97. package/dist/web/assets/Jobs-chEiiqmE.js +0 -5
  98. package/dist/web/assets/KindPage-D-Jah0cx.js +0 -6
  99. package/dist/web/assets/Migration-DMIBgW27.js +0 -2
  100. package/dist/web/assets/Product-B3buEWja.js +0 -1
  101. package/dist/web/assets/Quality-DuELzB5I.js +0 -1
  102. package/dist/web/assets/Record-DLTuuxTP.js +0 -2
  103. package/dist/web/assets/Regression-Bjz4Xfbo.js +0 -5
  104. package/dist/web/assets/Reports-p8Qp2KwM.js +0 -2
  105. package/dist/web/assets/Response-DGJAmOI0.js +0 -4
  106. package/dist/web/assets/Runs-CnPPwEq7.js +0 -2
  107. package/dist/web/assets/Shell-Molb7AUz.js +0 -3
  108. package/dist/web/assets/TestCases-CUZ-kHja.js +0 -1
  109. package/dist/web/assets/TestData-B3P1fBRO.js +0 -2
  110. package/dist/web/assets/WhatsNew-CdiZ0Eob.js +0 -1
  111. package/dist/web/assets/arrow-down-D5oPK0MM.js +0 -1
  112. package/dist/web/assets/arrow-right-2yt0QgFJ.js +0 -1
  113. package/dist/web/assets/circle-DIklM9wF.js +0 -1
  114. package/dist/web/assets/circle-dashed-BZvX5dyl.js +0 -1
  115. package/dist/web/assets/circle-dot-Cd20PWQi.js +0 -1
  116. package/dist/web/assets/dataParts-D0dUqael.js +0 -3
  117. package/dist/web/assets/index-BC72t3H1.js +0 -43
  118. package/dist/web/assets/index-BiJ_Nvm1.css +0 -2
  119. package/dist/web/assets/keyboard-Dab5j5YB.js +0 -1
  120. package/dist/web/assets/pencil-DeEsXRZX.js +0 -1
  121. package/dist/web/assets/productParts-Ciuentrl.js +0 -1
  122. package/dist/web/assets/qualityParts-CZCG8hDs.js +0 -1
  123. package/dist/web/assets/segmented-BMOboT4H.js +0 -1
  124. package/dist/web/assets/usePageChat-eO0J5JlP.js +0 -1
@@ -1,4 +0,0 @@
1
- import{Ai as e,Bt as t,Dn as n,Dr as r,Er as i,Et as a,Fn as o,Ft as s,Gt as c,Hr as l,Jt as u,Kt as d,Ni as f,Oi as p,Pn as m,Qn as h,St as g,Tt as _,Ut as v,Xt as ee,Yt as y,an as te,ar as ne,fn as re,fr as ie,gn as ae,hn as oe,kt as b,lt as se,mn as ce,pn as le,qn as x,qt as S,rr as ue,sn as de,st as fe,tr as C,xr as pe}from"./Shell-Molb7AUz.js";import{G as me,H as w,L as he,a as ge,i as T,r as E}from"./index-BC72t3H1.js";import{c as _e,i as ve,o as ye,r as be,s as D,t as xe}from"./thread-CHhZJi-Y.js";var O={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};O.node;var Se=l(O),k={name:`file-pen`,size:24,node:[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]],aliases:[`file-edit`]};k.node;var A=l(k),j={name:`file-search`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};j.node;var Ce=l(j),M={name:`forward`,size:24,node:[[`path`,{d:`m15 17 5-5-5-5`,key:`nf172w`}],[`path`,{d:`M4 18v-2a4 4 0 0 1 4-4h12`,key:`jmiej9`}]]};M.node;var we=l(M),N={name:`git-fork`,size:24,node:[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]};N.node;var Te=l(N),P={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};P.node;var Ee=l(P),F=f(e(),1),I=p();function L({diff:e,className:t}){let n=0,r=0,i=e.split(`
2
- `).flatMap((e,t)=>{if(/^(diff |index |--- |\+\+\+ )/.test(e))return[];let i=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);return i?(n=Number(i[1]),r=Number(i[2]),[{key:t,kind:`hunk`,text:e,a:``,b:``}]):e.startsWith(`+`)?[{key:t,kind:`add`,text:e.slice(1),a:``,b:String(r++)}]:e.startsWith(`-`)?[{key:t,kind:`del`,text:e.slice(1),a:String(n++),b:``}]:e.startsWith(`\\`)?[{key:t,kind:`hunk`,text:e,a:``,b:``}]:[{key:t,kind:`same`,text:e.startsWith(` `)?e.slice(1):e,a:String(n++),b:String(r++)}]});return(0,I.jsx)(`div`,{className:S(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[12px] leading-[1.6]`,t),children:(0,I.jsx)(`table`,{className:`w-full border-collapse`,children:(0,I.jsx)(`tbody`,{children:i.map(e=>(0,I.jsxs)(`tr`,{className:e.kind===`add`?`bg-pass-soft`:e.kind===`del`?`bg-fail-soft`:e.kind===`hunk`?`bg-surface-muted`:void 0,children:[(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,I.jsx)(`td`,{"aria-hidden":`true`,className:S(`w-4 align-top select-none`,e.kind===`add`?`text-pass`:e.kind===`del`?`text-fail`:`text-muted`),children:e.kind===`add`?`+`:e.kind===`del`?`−`:``}),(0,I.jsxs)(`td`,{className:S(`pr-3 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,I.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}function R({review:e,className:t}){return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,I.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,I.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{className:S(`mt-px flex-none rounded-full px-2 py-px text-[11.5px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[e.file&&(0,I.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,I.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,I.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var De={done:`border-pass/35`,active:`border-accent/35`,pending:`border-line-strong`,failed:`border-fail/35`,skipped:`border-line-strong`,note:`border-line-strong`};function z({status:e,orb:t,px:n=20,spin:i=!1}){let a={width:n,height:n};return e===`active`&&i?(0,I.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:a,children:(0,I.jsx)(m,{size:n-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,I.jsx)(_,{state:t,px:n,label:`At work`}):e===`done`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:a,children:(0,I.jsx)(r,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:a,children:(0,I.jsx)(y,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:a,children:(0,I.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,I.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:S(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:a})}var Oe=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,ke={read:ue,search:oe,list:h,edit:A,run:te,element:Se,outline:o,references:Te,impact:n,find:Ce,testfile:C,web:x,environment:le,cases:pe,browser:x,post:ce,test:C,retry:he,review:re,task:we,work:ee},Ae={done:`text-pass`,failed:`text-fail`,active:`text-accent-fg animate-pulse motion-reduce:animate-none`,pending:`text-muted`,skipped:`text-muted`,note:`text-muted`},B={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function V({kind:e,status:t}){let n=S(`mt-px flex size-4 flex-none items-center justify-center`,Ae[t]);if(e===`skill`)return(0,I.jsxs)(`span`,{role:`img`,"aria-label":B[t],className:S(n,`relative`),children:[(0,I.jsx)(d,{name:se.skills,px:15}),(t===`done`||t===`failed`)&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:S(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=ke[e];return(0,I.jsx)(`span`,{role:`img`,"aria-label":B[t],className:n,children:(0,I.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function je({status:e}){return e===`active`?(0,I.jsx)(m,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,I.jsx)(`span`,{role:`img`,"aria-label":B[e],className:S(`mt-[7px] size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function H({text:e,label:t}){let[n,i]=(0,F.useState)(!1);return(0,I.jsx)(`button`,{type:`button`,"aria-label":n?`Copied`:t,"data-tip":n?`Copied`:t,onClick:async()=>{try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch{}},className:`flex size-6 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted opacity-0 group-hover:opacity-100 hover:bg-surface-strong hover:text-ink focus-visible:opacity-100`,children:n?(0,I.jsx)(r,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(w,{size:13,"aria-hidden":`true`})})}function Me({step:e,failed:t}){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 py-0.5 font-mono text-[12px] leading-relaxed`,children:[e.command&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,I.jsx)(H,{text:e.command,label:`Copy the command`})]}),e.output&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,I.jsx)(`pre`,{className:S(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[12px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,I.jsx)(H,{text:e.output,label:`Copy the output`})]})]})}var Ne=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function U({text:e}){return(0,I.jsx)(`span`,{className:S(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-1.5 py-0.5 text-[12.5px] text-ink-2`,Ne(e)&&`font-mono text-[12px]`),children:e})}function Pe({step:e}){return(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:e.lines.map((e,t)=>(0,I.jsxs)(`li`,{className:S(`flex gap-1.5 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,I.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,I.jsx)(T,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]},t))})}function W({agent:e,named:t=!0,working:n=!1}){let r=s(e);return(0,I.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-1.5`,"data-tip":r.name,children:[(0,I.jsx)(a,{agent:e,px:18,decorative:t,working:n}),t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`font-medium`,style:{color:r.hue},children:r.name}),(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}function G({step:e,from:t,live:n}){let r=e.handoff.agent,i=s(r);return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,I.jsx)(a,{agent:t,px:18}),(0,I.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:S(`handoff-flow flex-none`,n&&`is-live`),style:{color:i.hue},children:[(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{})]}),(0,I.jsx)(a,{agent:r,px:20,decorative:!0,working:n,className:`handoff-in`}),(0,I.jsx)(`span`,{className:`font-medium`,style:{color:i.hue},children:i.name}),e.arg&&(0,I.jsx)(U,{text:e.arg})]})}function K({step:e,working:t,from:n=b}){let r=e.agent||n,a=q(e),o=Oe(e,t),[s,c]=(0,F.useState)(null),l=s??((!!e.handoff||!!e.agent||e.key.startsWith(`try:`))&&o===`active`),u=(0,I.jsxs)(I.Fragment,{children:[e.handoff?(0,I.jsx)(z,{status:o,orb:e.orb,px:14,spin:!0}):!(e.icon&&r===n)&&(0,I.jsx)(je,{status:o}),e.handoff?(0,I.jsx)(G,{step:e,from:n,live:o===`active`}):(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[r!==n||!e.icon?(0,I.jsx)(W,{agent:r,named:r!==n,working:o===`active`}):(0,I.jsx)(V,{kind:e.icon,status:o}),(0,I.jsx)(`span`,{className:S(`[overflow-wrap:anywhere]`,o===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,I.jsx)(U,{text:e.arg}),e.change&&(0,I.jsxs)(`span`,{className:`font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),a&&(0,I.jsx)(i,{size:14,"aria-hidden":`true`,className:S(`mt-0.5 ml-auto flex-none text-muted transition-transform`,l&&`rotate-180`)})]});return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[a?(0,I.jsx)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>c(!l),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-1.5 py-1.5 text-left text-[13.5px] hover:bg-surface-muted`,children:u}):(0,I.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:u}),a&&(0,I.jsx)(g,{open:l,children:(0,I.jsx)(J,{step:e,working:t,from:n,className:`mb-1 ml-[13px]`})})]})}var q=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function J({step:e,working:n,from:r,className:i}){let a=e.children||[],o=e.handoff?.agent||e.agent;return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-1.5 border-l border-dotted py-1 pl-3`,i),style:{borderColor:o?`${s(o).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,I.jsx)(Me,{step:e,failed:e.status===`fail`}),e.review&&(0,I.jsx)(R,{review:e.review}),e.lines.length>0&&(0,I.jsx)(Pe,{step:e}),e.change&&(0,I.jsx)(L,{diff:e.change.diff}),a.length>0&&(0,I.jsx)(`ul`,{"aria-label":o?`What ${t(s(o).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:a.map(e=>(0,I.jsx)(K,{step:e,working:n,from:o||r},e.key))}),e.handoff?.result&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`text-muted`,children:[t(s(e.handoff.agent).name,!0),` answered`]}),(0,I.jsx)(T,{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 Fe({node:e,last:t,working:n,now:r,orbed:a}){let o=e.step?[]:e.steps,s=e.step,c=o.length>0||!!r||!!s&&q(s),[l,u]=(0,F.useState)(null),d=l??(e.status===`active`||e.status===`failed`),f=s?.orb??[...o].reverse().find(e=>e.status===`running`)?.orb??r?.orb??`thinking`;return(0,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,I.jsx)(`span`,{className:`mt-[3px]`,children:(0,I.jsx)(z,{status:e.status,orb:f,spin:!a})}),!t&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:S(`mt-1.5 min-h-4 w-0 flex-1 border-l border-dotted`,De[e.status])})]}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[c?(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>u(!d),className:`flex min-h-7 w-full cursor-pointer items-start gap-1.5 border-0 bg-transparent p-0 text-left`,children:[(0,I.jsx)(Y,{node:e}),(0,I.jsx)(i,{size:14,"aria-hidden":`true`,className:S(`mt-1 flex-none text-muted transition-transform`,d&&`rotate-180`)}),e.status===`active`&&(0,I.jsx)(`span`,{className:`mt-0.5 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[11.5px] font-medium text-accent-fg`,children:`In progress`})]}):(0,I.jsx)(`div`,{className:`min-h-7`,children:(0,I.jsx)(Y,{node:e})}),c&&(0,I.jsx)(g,{open:d,className:`mt-0.5`,children:s?(0,I.jsx)(J,{step:s,working:n,from:`forgeqe`,className:`mt-1`}):(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[o.map(e=>(0,I.jsx)(K,{step:e,working:n},e.key)),r&&(0,I.jsx)(`li`,{children:(0,I.jsx)(X,{live:r,className:`px-1.5`})})]})})]})]})}function Y({node:e}){let t=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,n=e.step;return n?.handoff?(0,I.jsx)(G,{step:n,from:b,live:e.status===`active`}):(0,I.jsxs)(`span`,{className:S(`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-sm font-medium`,t,e.status===`skipped`&&`line-through`),children:[n&&(0,I.jsx)(W,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`}),e.status===`active`?(0,I.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,I.jsx)(`span`,{children:e.label})}):(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,I.jsx)(U,{text:n.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,F.useState)(()=>Date.now());(0,F.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?`${i}s ago`:`${Math.floor(i/60)} min ago`}function X({live:e,orb:t=!1,className:n}){let r=Le(e.latest?.at);return(0,I.jsxs)(`div`,{className:S(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,I.jsx)(`span`,{className:`mt-0.5 flex size-4 flex-none items-center justify-center`,children:t?(0,I.jsx)(_,{state:e.orb,px:20,label:`At work`}):(0,I.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,I.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,I.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{className:`shimmer text-[13.5px] font-medium text-muted`,children:(0,I.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,I.jsxs)(`button`,{type:`button`,onClick:e.onLog,"data-tip":`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,I.jsx)(`span`,{className:S(`min-w-0 truncate font-mono text-[12px]`,Ie[e.latest.tone]),children:e.latest.plain}),(0,I.jsxs)(`span`,{className:`flex-none text-[11.5px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Re({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,I.jsx)(X,{live:n,orb:!0});let i=be(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=[...i].reverse().find(e=>e.status===`active`);return(0,I.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,I.jsx)(`li`,{className:`flex gap-3`,children:(0,I.jsx)(X,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,I.jsx)(Fe,{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 Z({label:e,children:t}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,I.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function Q({text:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,I.jsx)(c,{icon:de,size:14,className:`mt-0.5 flex-none text-muted`}),(0,I.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12.5px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,I.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,onClick:async()=>{await ge(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,I.jsx)(r,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(w,{size:14,"aria-hidden":`true`})})]})}function Be(e){if(e.runs===void 0)return e.attempts===void 0?``:u(e.attempts,`attempt`);let t=`${u(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${u(e.reviews,`review`)}`:t}function Ve({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,I.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,I.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function He({t:e}){let t=Be(e);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,I.jsx)(C,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,I.jsx)(`span`,{className:`text-[15px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,I.jsx)(fe,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:ze[e.status]||e.status||`Not written`}),t&&(0,I.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,I.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-3`,children:[(e.testFile||e.testName)&&(0,I.jsx)(Z,{label:`Test`,children:(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,I.jsx)(E,{path:e.testFile}),e.testName&&(0,I.jsx)(Ve,{name:e.testName})]})}),e.command&&(0,I.jsx)(Z,{label:`Run it`,children:(0,I.jsx)(Q,{text:e.command})}),e.review&&(0,I.jsx)(Z,{label:e.review.approved?`Review`:`Review asked`,children:(0,I.jsx)(R,{review:e.review})}),e.runDir&&(0,I.jsx)(Z,{label:`From the run`,children:(0,I.jsx)(E,{path:e.runDir})}),e.reused.length>0&&(0,I.jsx)(Z,{label:`Reused`,children:(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,I.jsx)(`li`,{className:`min-w-0`,children:(0,I.jsx)(E,{path:e})},e))})})]}),e.error&&(0,I.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function Ue({c:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${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,I.jsx)(i,{size:15,"aria-hidden":`true`,className:S(`transition-transform`,!t&&`-rotate-90`)})}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,I.jsx)(E,{path:e.path})}),(0,I.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,I.jsx)(g,{open:t,children:(0,I.jsx)(L,{diff:e.diff,className:`mb-2 ml-9`})})]})}function We({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),r=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!r.length?null:(0,I.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 border-t border-line-soft pt-4`,children:[e.tests.map((e,t)=>(0,I.jsx)(He,{t:e},t)),t.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,I.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,I.jsx)(E,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-3`),children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,I.jsx)(ne,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,I.jsxs)(`span`,{className:`font-normal text-muted`,children:[u(e.changes.length+r.length,`file`),e.changes.length>0&&(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,I.jsx)(Ue,{c:e},e.path)),r.map(e=>(0,I.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,I.jsx)(E,{path:e})},e))]})]})]})}var Ge={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 Ke({line:e,start:t}){let[n,r]=(0,F.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,I.jsxs)(`li`,{className:`mt-3 flex items-baseline gap-3 border-b border-line-soft pb-1 first:mt-0`,children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:D(t,e.at)}),(0,I.jsx)(T,{text:e.md,className:`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`})]}):(0,I.jsxs)(`li`,{className:S(`flex items-baseline gap-3 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:D(t,e.at)}),e.kind===`out`?(0,I.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,I.jsx)(`button`,{type:`button`,disabled:!i,"aria-expanded":i?n:void 0,onClick:()=>r(!n),"data-tip":i&&!n?`Show all of it`:void 0,className:S(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,I.jsx)(T,{text:e.md,className:S(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[12px] [&_p]:my-0`,Ge[e.tone],i&&!n&&`line-clamp-2`)})})]})}function $({lines:e,start:t,live:n,name:i,timeline:a=!1}){let o=(0,F.useRef)(null),s=(0,F.useRef)(!0),[l,u]=(0,F.useState)(!1),d=(0,F.useMemo)(()=>ye(e,t),[e,t]);(0,F.useEffect)(()=>{s.current&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[d]);let f=`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[12px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,I.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[12px] text-muted`,children:[(0,I.jsxs)(`span`,{className:`flex-1`,children:[a?``:`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,I.jsxs)(`button`,{type:`button`,"aria-label":l?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(d),u(!0),setTimeout(()=>u(!1),1500)}catch{}},className:f,children:[l?(0,I.jsx)(r,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(w,{size:14,"aria-hidden":`true`}),l?`Copied`:`Copy`]}),(0,I.jsxs)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([d],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=i,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:f,children:[(0,I.jsx)(c,{icon:ie,size:14}),`.md`]})]}),(0,I.jsx)(`div`,{ref:o,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;s.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:S(`overflow-y-auto py-2`,a?`max-h-[calc(100vh-260px)] min-h-[320px]`:`max-h-[360px] border-b border-line-soft`),children:a?(0,I.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,n)=>(0,I.jsx)(Ke,{line:e,start:t},n))}):(0,I.jsx)(T,{text:d,className:`text-[13px] leading-[1.6] [&_code]:text-[12px] [&_h4]:mt-3 [&_h4]:mb-1 [&_li]:my-0.5 [&_pre]:text-[12px] [&_ul]:my-1`})})]})}function qe({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-3`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(Ee,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,I.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,I.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,I.jsx)(v,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,I.jsx)(v,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:`Cancel`})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function Je({wait:e,live:t,onProceed:n}){let r=t&&e.answer===void 0;return(0,I.jsxs)(`div`,{className:S(`flex flex-col gap-3`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(me,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),r?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(v,{size:`sm`,variant:`primary`,onClick:()=>n(!0),children:`Done, continue`}),(0,I.jsx)(v,{size:`sm`,onClick:()=>n(!1),children:`Cancel`})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function Ye({turn:e,live:t,onAnswer:n,onProceed:r}){let o=t&&!e.outcome,[s,l]=(0,F.useState)(null),u=s??o,d=xe(e),f=o?d.text:ve(e),p=e.parts.map(e=>_e(e.text)).filter(Boolean),[m,h]=(0,F.useState)(!1),_=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,I.jsxs)(`div`,{className:`flex gap-3`,children:[(0,I.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,I.jsx)(a,{agent:`forgeqe`,px:34,working:o,className:`mt-0.5`})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 pt-1.5`,children:[(e.steps.length>0||o||e.log.length>0)&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":u,disabled:!e.steps.length&&!e.plan.length,onClick:()=>l(!u),className:S(`flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,o&&`shimmer`),children:[(0,I.jsx)(`span`,{"aria-live":`polite`,children:f}),(e.steps.length>0||e.plan.length>0)&&(0,I.jsx)(i,{size:16,"aria-hidden":`true`,className:S(`transition-transform`,u&&`rotate-180`)})]}),e.log.length>0&&(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":m,onClick:()=>h(!m),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,I.jsx)(c,{icon:ae,size:14}),`Activity log`,(0,I.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,I.jsx)(g,{open:(u||o)&&(e.steps.length>0||e.plan.length>0||o),children:(0,I.jsx)(Re,{turn:e,working:o,folded:!u,live:{...d,latest:_,events:e.log.length,onLog:()=>h(!0)}})}),(0,I.jsx)(g,{open:m,children:(0,I.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:o,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,I.jsx)(qe,{ask:e,live:o,onAnswer:t=>n(e.id,t)},e.id)),e.waits.map(e=>(0,I.jsx)(Je,{wait:e,live:o,onProceed:t=>r(e.id,t)},e.id)),e.outcome&&e.reply?(0,I.jsx)(T,{text:e.reply}):p.length>0&&(0,I.jsx)(T,{text:p.join(`
3
-
4
- `)}),(0,I.jsx)(We,{turn:e}),e.error&&(0,I.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,I.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{L as i,Ye as n,Q as r,$ as t};
@@ -1,2 +0,0 @@
1
- import{$ as e,$t as t,A as n,Ai as r,An as i,Cr as a,Ct as o,Fr as s,Ft as c,Gt as l,Hr as u,Jt as d,Kn as f,Ln as p,Ni as m,Oi as h,Pn as g,Q as _,Qr as v,St as y,Ut as b,Xt as x,Yn as S,an as C,ct as w,dt as T,hn as E,jr as D,kr as O,ln as k,lr as A,lt as ee,n as j,qt as M,rt as te,sn as ne,st as N,tr as P,tt as re,wr as ie,xi as F,xn as ae,xt as oe,yr as se,yt as ce}from"./Shell-Molb7AUz.js";import{t as le}from"./circle-dashed-BZvX5dyl.js";import{r as ue,t as de}from"./Response-DGJAmOI0.js";import{F as fe,L as pe,V as me,W as he,i as I,q as ge,r as L,t as _e}from"./index-BC72t3H1.js";import{n as ve,t as ye}from"./when-CHnpLdYw.js";import{n as be,r as xe}from"./segmented-BMOboT4H.js";import{a as Se,c as Ce}from"./thread-CHhZJi-Y.js";var we={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};we.node;var Te=u(we),R=m(r(),1),z=h(),B={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Ee={execution:P,report:A,coding:se,chat:i};function De({kind:e}){let t=Ee[e];return(0,z.jsx)(l,{icon:t,size:14,className:`flex-none text-muted`})}var Oe={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},V=e=>Oe[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},ke={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Ae=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function H({title:e,icon:t,children:n,aside:r}){return(0,z.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-line-soft pt-6 first:border-t-0 first:pt-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,z.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function je({path:e,label:t=`Open report`}){let[n,r]=(0,R.useState)(``);return(0,z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(b,{onClick:async()=>r(await o(e)),children:[(0,z.jsx)(me,{"aria-hidden":`true`}),t]}),n&&(0,z.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Me({items:e,first:t,render:n}){let[r,i]=(0,R.useState)(!1);return(0,z.jsxs)(z.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,z.jsx)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:r?`Show fewer`:`Show all ${e.length}`})]})}function Ne({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,z.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,z.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,z.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,z.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function Pe({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:[ke[e.scope]||e.scope,Ae(e.ms),e.tokens?`${n(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,z.jsx)(je,{path:e.report})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,z.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,z.jsxs)(N,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,z.jsxs)(N,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,z.jsxs)(N,{tone:`warn`,children:[e.counts.other,` other`]}),(0,z.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,z.jsx)(Ne,{c:e.counts}),e.cases.length>0&&(0,z.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,z.jsx)(Me,{items:[...e.cases].sort((e,t)=>Number(V(t.status).tone===`fail`)-Number(V(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,z.jsx)(N,{tone:V(e.status).tone,children:V(e.status).label})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,z.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,z.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,z.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,z.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Ae(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,z.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,z.jsx)(L,{path:e.folder})]})]})}function Fe({list:e}){let t=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,z.jsx)(H,{title:`Execution summary`,icon:(0,z.jsx)(l,{icon:P,size:18}),aside:e.length>1?(0,z.jsxs)(`span`,{className:`text-sm text-muted`,children:[d(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,z.jsx)(Pe,{e},`${e.folder||e.title}-${t}`)):(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function Ie({list:e}){return(0,z.jsxs)(H,{title:`Report summary`,icon:(0,z.jsx)(l,{icon:A,size:18}),children:[e.length===0&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,z.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,z.jsx)(je,{path:e.path})]}),e.stats&&(0,z.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,z.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,z.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,z.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,z.jsx)(Le,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function Le({text:e,height:t=220}){let[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(!0),[o,s]=(0,R.useState)(t),c=(0,R.useRef)(null);return(0,R.useLayoutEffect)(()=>{c.current&&!n&&a(c.current.scrollHeight>t+8)},[e,t,n]),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{ref:c,style:o===void 0?void 0:{maxHeight:o},onTransitionEnd:e=>e.target===e.currentTarget&&n&&s(void 0),className:M(`transition-[max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)]`,o!==void 0&&`relative overflow-hidden`),children:[(0,z.jsx)(I,{text:e,className:`text-sm`}),!n&&i&&(0,z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,z.jsx)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=c.current?.scrollHeight??t;if(r(!n),ce())return s(n?t:void 0);s(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>s(t)))},className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:n?`Show less`:`Show all of it`})]})}function Re(e){let t=e.join(`
2
- `),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function ze({e}){let[t,n]=(0,R.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,z.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${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,z.jsx)(ie,{size:16,"aria-hidden":`true`,className:M(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,z.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:r}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,z.jsx)(L,{path:e.path})}),(0,z.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,z.jsx)(y,{open:t,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,z.jsx)(I,{text:Re(e.diffs)}):null})]})}var Be={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function U({label:e,children:t}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,z.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ve({c:e,files:t}){let n=e.edits.reduce((e,t)=>e+t.added,0),r=e.edits.reduce((e,t)=>e+t.removed,0),i=e.tests.filter(e=>!e.ok).length,a=e.reviews.at(-1),o=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,z.jsxs)(H,{title:`Code changes`,icon:(0,z.jsx)(l,{icon:se,size:18}),aside:e.edits.length?(0,z.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[d(e.edits.length,`file`),` · `,(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,n]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,r]})]}):o.length?(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:d(o.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,o=t.status===`error`||t.status===`failed`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,z.jsx)(P,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:o?`text-fail`:`text-warn`}),(0,z.jsx)(`span`,{className:`text-[15px] font-semibold`,children:r?`Test written`:o?`Test not finished`:V(t.status).label}),(0,z.jsx)(N,{tone:r?`pass`:o?`fail`:`warn`,children:V(t.status).label}),e.tests.length>0&&(0,z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[d(e.tests.length,`test run`),i?` (${i} failed)`:``,e.reviews.length?` · ${d(e.reviews.length,`review`)}`:``]})]}),(0,z.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-3`,children:[t.testFile&&(0,z.jsx)(U,{label:`Test`,children:(0,z.jsx)(L,{path:t.testFile})}),t.command&&(0,z.jsx)(U,{label:`Run it`,children:(0,z.jsx)(ue,{text:t.command})}),(t.review||a)&&(0,z.jsx)(U,{label:`Review`,children:(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(N,{tone:(t.review??a).approved?`pass`:`warn`,children:(t.review??a).approved?`Approved`:`Changes asked`})}),(t.review?.summary||a?.summary)&&(0,z.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||a?.summary})]})}),t.notes&&(0,z.jsx)(U,{label:`Notes`,children:(0,z.jsx)(I,{text:t.notes,className:`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`})})]}),t.error&&(0,z.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,z.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,z.jsx)(Me,{items:e.edits,first:8,render:e=>(0,z.jsx)(ze,{e},e.path)})})]}),o.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,z.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>(0,z.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-3 border-t border-line-soft text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:Be[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,z.jsx)(L,{path:e.path})})]},e.path))}),(0,z.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!o.length&&!e.results.length&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function He({final:e,answer:t}){let n=e.from===`agent`?t?.files??[]:[],r=e.from!==`agent`,i=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),a="`".repeat(i+1);return(0,z.jsxs)(H,{title:`Final message`,icon:(0,z.jsx)(Te,{size:18,"aria-hidden":`true`}),aside:(0,z.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,z.jsx)(Le,{text:r?`${a}text\n${e.text}\n${a}`:Ce(e.text),height:420}),n.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),n.map(e=>(0,z.jsx)(L,{path:e},e))]})]})}var Ue={rule:{icon:s,label:`Rulebook`},decision:{icon:S,label:`Test decisions`},memory:{icon:D,label:`Page memory`},replay:{icon:ae,label:`Replays`},model:{icon:k,label:`Model`},skill:{icon:f,label:`Skills`}};function We({list:e}){let t=Object.keys(Ue).filter(t=>e.some(e=>e.kind===t));return(0,z.jsx)(H,{title:`Learnings`,icon:(0,z.jsx)(l,{icon:p,size:18}),aside:e.length?(0,z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,z.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,z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:t.map(t=>{let{icon:n,label:r}=Ue[t];return(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,z.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,z.jsx)(l,{icon:n,size:14}),r]}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-1.5 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,z.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Ge({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,z.jsx)(Fe,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,z.jsx)(Ie,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,z.jsx)(Ve,{c:e.coding,files:e.files},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,z.jsx)(z.Fragment,{children:t.map(e=>e.node)})}var Ke={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},qe={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},Je=e=>qe[e]||e.charAt(0).toUpperCase()+e.slice(1),W=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`})},G=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),K=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`:`–`,q=e=>e.usage.input+e.usage.output;function Ye(e){let[t,n]=(0,R.useState)(Date.now());return(0,R.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function J({r:e}){return e.origin.kind===`web`?(0,z.jsxs)(`a`,{href:T(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(l,{icon:i,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,z.jsxs)(`a`,{href:T(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(l,{icon:O,size:14}),`Job`]}):(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,z.jsx)(l,{icon:C,size:14}),`Terminal`]})}function Xe({status:e}){let t=Ke[e].label;return e===`running`?(0,z.jsx)(g,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,z.jsx)(he,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,z.jsx)(a,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,z.jsx)(le,{size:16,"aria-label":t,className:`flex-none text-muted`})}var Y=e=>e.status!==`running`&&!e.tools&&!e.turns&&!q(e)&&!e.files.length&&!e.outputs.length&&G(e,0)<2;function Ze(e){return/^forgeqe(-|$)|^engine$/.test(e)?c(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function X({label:e,children:t}){return(0,z.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Z({title:e,children:t}){return(0,z.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var Qe={rerun:pe,write_test:t,investigate:E,fix_test:x};function $e({actions:e}){let[t,n]=(0,R.useState)(``),[r,i]=(0,R.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await v.start(e.prompt,{});location.hash=T(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,z.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,z.jsxs)(b,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note||void 0,className:`max-w-full min-w-0`,children:[(0,z.jsx)(l,{icon:Qe[e.kind],size:16,className:`flex-none`}),(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening a chat…`:e.label}),e.note&&(0,z.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,z.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var et=e=>`\`${e.replace(/`/g,``)}\``,tt=[`summary`,`conversation`,`activity`,`details`],Q=e=>tt.find(t=>t===e)??`summary`;function nt({name:e,tab:t}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(!1),l=Q(t),u=t=>location.hash=t===`summary`?T(`runs`,encodeURIComponent(e)):T(`runs`,encodeURIComponent(e),t),f=(0,R.useCallback)(()=>{F.detail(e).then(e=>{i(e),o(``)},e=>o(e.message))},[e]);(0,R.useEffect)(f,[f]);let p=r?.status===`running`;(0,R.useEffect)(()=>{if(!p)return;let e=setInterval(f,2e3);return()=>clearInterval(e)},[f,p]);let m=Ye(p),h=(0,R.useMemo)(()=>(r?.events??[]).map(Se).filter(e=>!!e),[r?.events]),g=async()=>{c(!0),o(``);try{await F.cancel(e),f()}catch(e){o(e.message)}finally{c(!1)}},_=(0,z.jsxs)(`a`,{href:T(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,z.jsx)(ge,{size:16,"aria-hidden":`true`}),`All runs`]});if(!r)return(0,z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_,a?(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:a}):(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let v=Ke[r.status],y=!r.replies.length,x=!!r.final||r.executions.length>0||r.reports.length>0||!!(r.coding&&(r.coding.edits.length||r.coding.results.length))||r.learnings.length>0||r.outputs.length>0,S=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:r.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],C=new Set([...r.reports.map(e=>e.path),...r.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),E=r.outputs.filter(e=>!C.has(e.path)),D=r.context?.limit?Math.round(r.context.tokens/r.context.limit*100):null;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[_,(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,z.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:r.title}),(0,z.jsx)(N,{tone:v.tone,children:v.label})]}),(0,z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(De,{kind:r.kind}),B[r.kind]]}),`· `,(0,z.jsx)(J,{r}),`· `,W(r.startedAt),` · `,p?`running for `:`took `,K(G(r,m)),` · `,n(q(r)),` tokens`,r.profile?.model?` · ${r.profile.model}`:``]})]}),r.cancel&&(0,z.jsxs)(b,{variant:`danger`,disabled:s,onClick:()=>void g(),children:[(0,z.jsx)(fe,{fill:`currentColor`,"aria-hidden":`true`}),s?`Stopping…`:r.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`]})]}),a&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),r.error&&(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,z.jsx)(`strong`,{children:`What went wrong:`}),` `,r.error]}),!p&&(0,z.jsx)($e,{actions:r.actions??[]}),(0,z.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:be,children:S.map(e=>(0,z.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":l===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>u(e.id),className:xe(l===e.id),children:[e.label,e.n!==void 0&&(0,z.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,z.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${l}`,"aria-labelledby":`run-tab-${l}`,className:`flex min-w-0 flex-col gap-6`,children:[l===`summary`&&(0,z.jsxs)(z.Fragment,{children:[r.final&&(0,z.jsx)(He,{final:r.final,answer:r.answer}),(0,z.jsx)(Ge,{run:r}),E.length>0&&(0,z.jsx)(Z,{title:`What it produced (${E.length})`,children:E.map(e=>(0,z.jsx)(X,{label:e.label,children:(0,z.jsx)(L,{path:e.path})},e.path))}),r.learnings.length>0&&(0,z.jsx)(We,{list:r.learnings}),!x&&(0,z.jsx)(w,{className:`py-4`,children:p?`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,z.jsx)(I,{text:et(r.prompt),className:`text-sm [&_p]:my-0`}):(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:r.replies.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,z.jsx)(I,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,z.jsx)(I,{text:Ce(e.text),className:`text-sm`}),e.error&&(0,z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),l===`activity`&&(r.archived?(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,z.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):h.length?(0,z.jsx)(de,{timeline:!0,lines:h,start:r.startedAt,live:p,name:`forgeqe-run-${r.name.replace(/\.log$/,``)}.md`}):(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),l===`details`&&(0,z.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-8 @3xl:grid-cols-2`,children:[(0,z.jsxs)(Z,{title:`Numbers`,children:[(0,z.jsx)(X,{label:p?`Running for`:`Took`,children:K(G(r,m))}),(0,z.jsx)(X,{label:`Tokens`,children:(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{children:[n(q(r)),` `,(0,z.jsxs)(`span`,{className:`text-muted`,children:[`· `,n(r.usage.input),` read · `,n(r.usage.output),` written`,r.usage.cached?` · ${n(r.usage.cached)} cached`:``]})]}),(r.byAgent?.length??0)>1&&(0,z.jsx)(`span`,{className:`flex flex-col gap-0.5 text-[13px]`,children:r.byAgent.map(e=>(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:Ze(e.agent)}),(0,z.jsx)(`span`,{className:`text-muted tabular-nums`,children:n(e.input+e.output)})]},e.agent))})]})}),(0,z.jsxs)(X,{label:`Context`,children:[r.context?n(r.context.tokens):`–`,D!==null&&(0,z.jsxs)(`span`,{className:`text-muted`,children:[` of `,n(r.context.limit),` (`,D,`%)`]})]}),(0,z.jsxs)(X,{label:`Tool calls`,children:[r.tools,` `,(0,z.jsxs)(`span`,{className:`text-muted`,children:[`in `,d(r.turns,`turn`)]})]})]}),(0,z.jsxs)(Z,{title:`Session`,children:[(0,z.jsx)(X,{label:`Started by`,children:(0,z.jsx)(J,{r})}),(0,z.jsx)(X,{label:`Command`,children:Je(r.command)}),(0,z.jsx)(X,{label:`Model`,children:r.profile?[r.profile.name,r.profile.model].filter(Boolean).join(` · `):`–`}),(0,z.jsx)(X,{label:`Agents`,children:r.agents.length?(0,z.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:r.agents.map(e=>(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Ze(e.name)}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:d(e.calls,`call`)})]},e.name))}):(0,z.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,z.jsxs)(X,{label:`Log`,children:[r.archived?(0,z.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,z.jsx)(L,{path:`.forgeqe/logs/${r.name}`}),r.truncated&&(0,z.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),r.job&&(0,z.jsxs)(Z,{title:`Job`,children:[(0,z.jsx)(X,{label:`Job`,children:(0,z.jsx)(`a`,{href:T(`jobs`,encodeURIComponent(r.origin.kind===`job`?r.origin.job:r.job.name)),children:r.job.name})}),(0,z.jsx)(X,{label:`Runs`,children:(0,z.jsx)(I,{text:et(r.job.command),className:`text-sm [&_p]:my-0`})}),(0,z.jsxs)(X,{label:`Schedule`,children:[r.job.schedule,!r.job.enabled&&` (disabled)`,r.job.nextAt&&r.job.enabled?` · next ${W(r.job.nextAt)}`:``]}),r.job.run&&(0,z.jsxs)(X,{label:`This run`,children:[r.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,r.job.run.status.replace(`_`,` `),r.job.run.exitCode!==void 0&&r.job.run.exitCode!==null?`, exit ${r.job.run.exitCode}`:``]})]}),(0,z.jsx)(Z,{title:`Files worked on (${r.files.length})`,children:r.files.length?[...r.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)).map(e=>(0,z.jsx)(X,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action?e.action.charAt(0).toUpperCase()+e.action.slice(1):`Changed`,children:e.action===`delete`?(0,z.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,z.jsx)(L,{path:e.path})},e.path)):(0,z.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,z.jsx)(Z,{title:`Notifications`,children:r.notifications.length?r.notifications.map(e=>(0,z.jsx)(X,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,z.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,z.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:r.origin.kind===`terminal`||r.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function rt({runs:t}){let r=Ye(t.some(e=>e.status===`running`)),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(`all`),[c,l]=(0,R.useState)(``),[u,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(0);(0,R.useEffect)(()=>g(0),[i,o,c,u,p]);let v=t.filter(Y).length,y=i.toLowerCase().split(/\s+/).filter(Boolean),b=t.filter(e=>(p||!Y(e))&&(!c||e.kind===c)&&(!u||e.origin.kind===u)&&y.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),x={all:b.length,running:b.filter(e=>e.status===`running`).length,failed:b.filter(e=>e.status===`failed`).length},S=o===`all`?b:b.filter(e=>e.status===o),C=Math.max(1,Math.ceil(S.length/$)),E=Math.min(h,C-1),D=S.slice(E*$,E*$+$),O=t.filter(e=>e.status!==`running`&&!Y(e)),k=O.filter(e=>e.status===`failed`).length,A=O.length?O.reduce((e,t)=>e+G(t,r),0)/O.length:NaN,ee=t.reduce((e,t)=>e+q(t),0),j=[...new Set(t.map(e=>e.kind))],N=[...new Set(t.map(e=>e.origin.kind))],P={web:`Web chat`,job:`Job`,terminal:`Terminal`};return t.length===0?(0,z.jsx)(w,{icon:ne,title:`No runs yet`,children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.length-v}),` runs`]}),t.some(e=>e.status===`running`)&&(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:t.filter(e=>e.status===`running`).length}),` running now`]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:M(`tabular-nums`,k?`text-fail`:`text-ink`),children:k}),` failed`,O.length?` (${Math.round(k/O.length*100)}%)`:``]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:n(ee)}),` tokens`]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:K(Math.round(A))}),` on average`]})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(re,{id:`run-search`,label:`Find a run`,value:i,onChange:a,placeholder:`Find a run by what was asked`}),(0,z.jsx)(_,{items:[{id:`all`,label:`All`,n:x.all},{id:`running`,label:`Running`,n:x.running},{id:`failed`,label:`Failed`,n:x.failed,alert:!0}],value:o,onChange:s}),j.length>1&&(0,z.jsxs)(te,{size:`sm`,"aria-label":`What it did`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,z.jsx)(`option`,{value:``,children:`Any kind`}),j.map(e=>(0,z.jsx)(`option`,{value:e,children:B[e]},e))]}),N.length>1&&(0,z.jsxs)(te,{size:`sm`,"aria-label":`Started by`,value:u,onChange:e=>f(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,z.jsx)(`option`,{value:``,children:`Started anywhere`}),N.map(e=>(0,z.jsx)(`option`,{value:e,children:P[e]||e},e))]})]}),(0,z.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,z.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,z.jsx)(`span`,{className:`w-4`}),(0,z.jsx)(`span`,{children:`Run`}),(0,z.jsx)(`span`,{children:`Kind`}),(0,z.jsx)(`span`,{children:`Started by`}),(0,z.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,z.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,z.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,z.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[D.length===0&&(0,z.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),D.map((e,t)=>{let i=ve(e.startedAt);return(0,z.jsxs)(`li`,{className:`contents`,children:[(t===0||ve(D[t-1].startedAt)!==i)&&(0,z.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,z.jsxs)(`a`,{href:T(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,z.jsx)(Xe,{status:e.status}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,z.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,z.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[B[e.kind],P[e.origin.kind],K(G(e,r)),`${n(q(e))} tokens`].join(` · `)})]}),(0,z.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,z.jsx)(De,{kind:e.kind}),B[e.kind]]}),(0,z.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:P[e.origin.kind]||e.origin.kind}),(0,z.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:K(G(e,r))}),(0,z.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:n(q(e))}),(0,z.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":W(e.startedAt),children:ye(e.startedAt)})]})]},e.name)})]}),(0,z.jsx)(e,{page:E,size:$,total:S.length,onPage:g,label:`Pages of runs`,children:v>0&&(0,z.jsxs)(z.Fragment,{children:[` · `,(0,z.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:p?`Hide the ${d(v,`empty session`)}`:`${d(v,`empty session`)} hidden`})]})})]})]})}function it({sub:e}){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),a=(0,R.useCallback)(()=>{F.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,R.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,R.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?decodeURIComponent(s):``;return(0,z.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,z.jsx)(j,{}),(0,z.jsx)(`main`,{className:M(_e,`@container flex-auto gap-4`),children:l?(0,z.jsx)(nt,{name:l,tab:c},l):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(oe,{pixel:ee.runs,size:`lg`}),(0,z.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,z.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,z.jsx)(rt,{runs:t})]})})]})}export{it as Runs,Xe as StatusIcon,Q as runTab};