@capagents/forgeqe 2.6.1 → 2.6.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.
- package/HOW_TO_USE.md +311 -15
- package/README.md +5 -25
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/bin/activate-web.d.ts +16 -0
- package/bin/activate-web.js +117 -0
- package/bin/bundle.d.ts +27 -0
- package/bin/bundle.js +173 -0
- package/bin/forgeqe.js +109 -2
- package/bin/license.d.ts +25 -0
- package/bin/license.js +178 -0
- package/dist/docs-site/docs/architecture/index.html +2 -1
- package/dist/docs-site/docs/index.html +291 -11
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +35 -6
- package/dist/forgeqe.js +1513 -1291
- package/dist/template.html +64 -64
- package/dist/web/assets/Agent-yd1DyMzR.js +4 -0
- package/dist/web/assets/ApiTests-BwOGta9J.js +10 -0
- package/dist/web/assets/Chat-P8GH_6gl.js +3 -0
- package/dist/web/assets/Data-D2iCqk3t.js +3 -0
- package/dist/web/assets/Features-Bu38clxs.js +1 -0
- package/dist/web/assets/Jobs-DymuaGeN.js +5 -0
- package/dist/web/assets/KindPage-zl6TBkEl.js +6 -0
- package/dist/web/assets/Migration-Cg_FUqS_.js +2 -0
- package/dist/web/assets/Quality-D3bSHP_B.js +1 -0
- package/dist/web/assets/Record-DkCLJos6.js +2 -0
- package/dist/web/assets/Regression-B2qMKjAE.js +5 -0
- package/dist/web/assets/Reports-D_G9yfDa.js +2 -0
- package/dist/web/assets/Response-BnPAefP-.js +4 -0
- package/dist/web/assets/Runs-DsDj9-LT.js +2 -0
- package/dist/web/assets/Shell-DlZHZN0d.js +3 -0
- package/dist/web/assets/TestData-qI1R5Q9v.js +2 -0
- package/dist/web/assets/WhatsNew-CoCHqSDm.js +1 -0
- package/dist/web/assets/accessibility-CH8EpEAV.svg +1 -0
- package/dist/web/assets/{arrow-down-BqARSDDZ.js → arrow-down-BWCXlJU0.js} +1 -1
- package/dist/web/assets/arrow-right-CdxkQBV7.js +1 -0
- package/dist/web/assets/{bot-BtKTIZEs.js → bot-D8486kSA.js} +1 -1
- package/dist/web/assets/capgemini-mark-D6aZFnD3.png +0 -0
- package/dist/web/assets/chevron-up-CQz_ZmIK.js +1 -0
- package/dist/web/assets/circle-BqXBUsQS.js +1 -0
- package/dist/web/assets/{circle-dashed-DwIAhHPq.js → circle-dashed-DlOiCbWD.js} +1 -1
- package/dist/web/assets/dataParts-bwNleJYd.js +3 -0
- package/dist/web/assets/forgeqe-logo-D3CwM2Jl.png +0 -0
- package/dist/web/assets/forgeqe-logo-white-CoE-hF2l.png +0 -0
- package/dist/web/assets/forgeqe-mark-ZLd4S3hw.png +0 -0
- package/dist/web/assets/index-Bh4NBbEU.js +37 -0
- package/dist/web/assets/index-DkgUrjyL.css +2 -0
- package/dist/web/assets/keyboard-wpCM6HMa.js +1 -0
- package/dist/web/assets/qualityParts-iy-mouSI.js +1 -0
- package/dist/web/assets/{thread-iCgQPYwX.js → thread-BfW2V-2U.js} +1 -1
- package/dist/web/assets/upload-CwExsxOd.js +1 -0
- package/dist/web/assets/usePageChat-CzWbP_sa.js +1 -0
- package/dist/web/index.html +3 -3
- package/docs/ARCHITECTURE.md +2 -1
- package/docs/CUSTOM_AGENTS_FIRST_RUN.md +107 -0
- package/docs/WEB_APP.md +36 -6
- package/docs/security-data-flow.html +3 -3
- package/docs/user-guide.html +291 -11
- package/docs/walkthrough/hotfix-narration.md +443 -297
- package/forgeqe.example.yaml +13 -2
- package/package.json +6 -3
- package/prompts/README.md +1 -0
- package/prompts/agent-builder.md +69 -0
- package/prompts/api-tests.md +1 -1
- package/prompts/brain.md +22 -2
- package/prompts/browser-persona.md +14 -0
- package/prompts/db-agent.md +73 -0
- package/prompts/heal.md +1 -1
- package/prompts/migrate.md +54 -0
- package/prompts/test-agent.md +1 -0
- package/py/forgeqe_engine/cli.py +9 -1
- package/py/forgeqe_engine/copilot_gateway.py +162 -9
- package/py/forgeqe_engine/persona.py +435 -0
- package/py/forgeqe_engine/proceed.py +67 -0
- package/py/forgeqe_engine/service.py +93 -11
- package/skills/test-data/SKILL.md +4 -0
- package/dist/web/assets/Agent-jYaYLJO8.js +0 -1
- package/dist/web/assets/ApiTests-BYQ0VYx3.js +0 -10
- package/dist/web/assets/Chat-DOcK3ngF.js +0 -3
- package/dist/web/assets/Data-KFQ0-EbI.js +0 -4
- package/dist/web/assets/Features-9rw1s5Vs.js +0 -1
- package/dist/web/assets/Jobs-MRHq6isA.js +0 -5
- package/dist/web/assets/Quality-CGrki-iI.js +0 -1
- package/dist/web/assets/Record-Bamcsz1Y.js +0 -2
- package/dist/web/assets/Regression-D0yEt-3X.js +0 -5
- package/dist/web/assets/Reports-BwvQNDFa.js +0 -2
- package/dist/web/assets/Response-XIaBzLD_.js +0 -4
- package/dist/web/assets/Runs-DtgNqxHd.js +0 -2
- package/dist/web/assets/Shell-E3JKoPtx.js +0 -3
- package/dist/web/assets/accessibility-BSaq_4Me.svg +0 -1
- package/dist/web/assets/capgemini-BO8ajcbd.svg +0 -21
- package/dist/web/assets/capgemini-white-ByjwPW8N.svg +0 -21
- package/dist/web/assets/circle-C_9D6W14.js +0 -1
- package/dist/web/assets/index-CVa5dAjG.js +0 -26
- package/dist/web/assets/index-DF-gVa3Q.css +0 -2
- package/dist/web/assets/markdown-OsvJ-mly.js +0 -10
- package/dist/web/assets/trending-up-fRykocOw.js +0 -1
- package/dist/web/assets/usePageChat-B5pKShGC.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$t as e,A as t,Cn as n,Cr as r,Dt as i,En as a,Hn as o,It as s,Kr as c,Lr as l,Nt as u,Ot as d,Rt as f,Tt as p,Ur as m,Vt as h,Zn as g,ar as _,at as v,cn as y,er as b,et as x,fn as S,gr as C,gt as w,it as T,jn as E,jt as D,kt as O,lr as k,mn as A,mt as j,n as M,nr as ee,qt as te,rt as N,sr as ne,tr as re,tt as ie,vt as ae,yt as P,zn as oe}from"./Shell-E3JKoPtx.js";import{t as se}from"./circle-dashed-DwIAhHPq.js";import{t as ce}from"./Response-XIaBzLD_.js";import{n as F,t as I}from"./markdown-OsvJ-mly.js";import{n as L,t as le,v as ue,w as de,x as fe}from"./index-CVa5dAjG.js";import{n as R,t as pe}from"./when-CHnpLdYw.js";import{a as me,s as z}from"./thread-iCgQPYwX.js";var B={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`}]]};B.node;var he=C(B),V=c(m(),1),H=i(),U={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},ge={execution:E,report:oe,coding:g,chat:y};function _e({kind:e}){let t=ge[e];return(0,H.jsx)(p,{icon:t,size:14,className:`flex-none text-muted`})}var ve={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`}},W=e=>ve[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},ye={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},be=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function G({title:e,icon:t,children:n,aside:r}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-[14px] border border-line-soft p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,H.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function xe({path:e,label:t=`Open report`}){let[n,r]=(0,V.useState)(``);return(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(P,{onClick:async()=>r(await N(e)),children:[(0,H.jsx)(o,{size:16,"aria-hidden":`true`}),t]}),n&&(0,H.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Se({items:e,first:t,render:n}){let[r,i]=(0,V.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,H.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 Ce({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,H.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,H.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,H.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,H.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function we({e}){let n=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,H.jsx)(`span`,{className:`text-[13px] text-muted`,children:[ye[e.scope]||e.scope,be(e.ms),e.tokens?`${t(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,H.jsx)(xe,{path:e.report})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[n,`%`]}),(0,H.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,H.jsxs)(L,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,H.jsxs)(L,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,H.jsxs)(L,{tone:`warn`,children:[e.counts.other,` other`]}),(0,H.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,H.jsx)(Ce,{c:e.counts}),e.cases.length>0&&(0,H.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,H.jsx)(Se,{items:[...e.cases].sort((e,t)=>Number(W(t.status).tone===`fail`)-Number(W(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,H.jsx)(L,{tone:W(e.status).tone,children:W(e.status).label})}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,H.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,H.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,H.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,H.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:be(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,H.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,H.jsx)(I,{path:e.folder})]})]})}function Te({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,H.jsx)(G,{title:`Execution summary`,icon:(0,H.jsx)(p,{icon:E,size:18}),aside:e.length>1?(0,H.jsxs)(`span`,{className:`text-sm text-muted`,children:[O(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,H.jsx)(we,{e},`${e.folder||e.title}-${t}`)):(0,H.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 Ee({list:e}){return(0,H.jsxs)(G,{title:`Report summary`,icon:(0,H.jsx)(p,{icon:oe,size:18}),children:[e.length===0&&(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,H.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,H.jsx)(xe,{path:e.path})]}),e.stats&&(0,H.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,H.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,H.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,H.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,H.jsx)(De,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function De({text:e,height:t=220}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!0),[o,s]=(0,V.useState)(t),c=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{c.current&&!n&&a(c.current.scrollHeight>t+8)},[e,t,n]),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`div`,{ref:c,style:o===void 0?void 0:{maxHeight:o},onTransitionEnd:e=>e.target===e.currentTarget&&n&&s(void 0),className:d(`transition-[max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)]`,o!==void 0&&`relative overflow-hidden`),children:[(0,H.jsx)(F,{text:e,className:`text-sm`}),!n&&i&&(0,H.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,H.jsx)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=c.current?.scrollHeight??t;if(r(!n),w())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 Oe(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,V.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,H.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,H.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,H.jsx)(re,{size:16,"aria-hidden":`true`,className:d(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,H.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:r}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,H.jsx)(I,{path:e.path})}),(0,H.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,H.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,H.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,H.jsx)(j,{open:t,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,H.jsx)(F,{text:Oe(e.diffs)}):null})]})}function Ae({c:e}){let t=e.edits.reduce((e,t)=>e+t.added,0),n=e.edits.reduce((e,t)=>e+t.removed,0),r=e.tests.at(-1),i=e.reviews.at(-1);return(0,H.jsxs)(G,{title:`Code changes`,icon:(0,H.jsx)(p,{icon:g,size:18}),aside:(0,H.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[e.edits.length,` file`,e.edits.length===1?``:`s`,` · `,(0,H.jsxs)(`span`,{className:`text-pass`,children:[`+`,t]}),` `,(0,H.jsxs)(`span`,{className:`text-fail`,children:[`−`,n]})]}),children:[e.results.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(L,{tone:e.status===`passed`||e.status===`done`?`pass`:e.status===`error`||e.status===`failed`?`fail`:`warn`,children:W(e.status).label}),e.testFile&&(0,H.jsx)(I,{path:e.testFile}),e.maxAttempts>0&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[`attempt `,e.attempts,` of `,e.maxAttempts]}),e.review&&(0,H.jsx)(L,{tone:e.review.approved?`pass`:`warn`,children:e.review.approved?`Review approved`:`Review not approved`})]}),e.error&&(0,H.jsx)(`p`,{className:`m-0 text-fail`,children:e.error}),e.notes&&(0,H.jsx)(F,{text:e.notes,className:`text-sm [&_p]:my-1`}),e.command&&(0,H.jsx)(F,{text:`Run it with \`${e.command.replace(/`/g,``)}\``,className:`text-sm [&_p]:my-0`})]},t)),(r||i)&&(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[r&&(0,H.jsxs)(L,{tone:r.ok?`pass`:`fail`,children:[`Last test run `,r.ok?`passed`:`failed`,e.tests.length>1?` (${e.tests.length} runs)`:``]}),i&&(0,H.jsxs)(L,{tone:i.approved?`pass`:`warn`,children:[`Review `,i.approved?`approved`:`asked for ${i.issues} fix${i.issues===1?``:`es`}`]})]}),e.edits.length?(0,H.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,H.jsx)(Se,{items:e.edits,first:8,render:e=>(0,H.jsx)(ke,{e},e.path)})}):(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,H.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 je({final:e,answer:t}){let n=e.from===`agent`?t?.facts??[]:[],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,H.jsxs)(G,{title:`Final message`,icon:(0,H.jsx)(he,{size:18,"aria-hidden":`true`}),aside:(0,H.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:[n.length>0&&(0,H.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-2`,children:n.map((e,t)=>(0,H.jsxs)(`div`,{className:`min-w-0 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,H.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,H.jsx)(`dd`,{className:`m-0 text-sm [overflow-wrap:anywhere]`,children:(0,H.jsx)(F,{text:e.value,className:`[&_p]:my-0`})})]},`${e.label}-${t}`))}),(0,H.jsx)(De,{text:i?`${o}text\n${e.text}\n${o}`:z(e.text),height:360}),r.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),r.map(e=>(0,H.jsx)(I,{path:e},e))]})]})}var Me={rule:{icon:k,label:`Rulebook`},decision:{icon:a,label:`Test decisions`},memory:{icon:ne,label:`Page memory`},replay:{icon:e,label:`Replays`},model:{icon:h,label:`Model`},skill:{icon:n,label:`Skills`}};function Ne({list:e}){let t=Object.keys(Me).filter(t=>e.some(e=>e.kind===t));return(0,H.jsx)(G,{title:`Learnings`,icon:(0,H.jsx)(p,{icon:A,size:18}),aside:e.length?(0,H.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,H.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,H.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}=Me[t];return(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,H.jsx)(p,{icon:n,size:14}),r]}),(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,H.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,H.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,H.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Pe({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,H.jsx)(Te,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,H.jsx)(Ee,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,H.jsx)(Ae,{c:e.coding},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,H.jsx)(H.Fragment,{children:t.map(e=>e.node)})}var Fe={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},Ie={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`},Le=e=>Ie[e]||e.charAt(0).toUpperCase()+e.slice(1),K=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 Re(e){let[t,n]=(0,V.useState)(Date.now());return(0,V.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function ze({r:e}){return e.origin.kind===`web`?(0,H.jsxs)(`a`,{href:v(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(p,{icon:y,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,H.jsxs)(`a`,{href:v(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(p,{icon:_,size:14}),`Job`]}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,H.jsx)(p,{icon:s,size:14}),`Terminal`]})}function Be({status:e}){let t=Fe[e].label;return e===`running`?(0,H.jsx)(S,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,H.jsx)(fe,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,H.jsx)(b,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,H.jsx)(se,{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 Z({label:e,children:t}){return(0,H.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,H.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,H.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,H.jsxs)(`section`,{className:`flex min-w-0 flex-col rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var Ve={rerun:ue,write_test:u,investigate:te,fix_test:D};function He({actions:e}){let[t,n]=(0,V.useState)(``),[i,a]=(0,V.useState)(``);if(!e.length)return null;let o=async e=>{n(e.prompt),a(``);try{let{id:t}=await r.start(e.prompt,{});location.hash=v(`chats`,t)}catch(e){a(e.message),n(``)}};return(0,H.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>{let r=Ve[e.kind];return(0,H.jsxs)(`button`,{type:`button`,disabled:!!t,onClick:()=>void o(e),className:d(`flex min-h-[52px] max-w-full cursor-pointer items-center gap-3 rounded-[14px] border px-3 py-2 text-left disabled:cursor-default disabled:opacity-60`,n===0?`border-accent bg-accent-soft hover:bg-accent-soft/70`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,H.jsx)(p,{icon:r,size:18,className:`flex-none text-accent-fg`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-ink`,children:t===e.prompt?`Opening a chat…`:e.label}),(0,H.jsx)(`span`,{className:`max-w-[320px] truncate text-[12px] text-muted`,children:e.note})]})]},n)})}),(0,H.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),i&&(0,H.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:i})]})}var Ue=e=>`\`${e.replace(/`/g,``)}\``;function We({name:e}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(!1),[c,u]=(0,V.useState)(`summary`),p=(0,V.useCallback)(()=>{l.detail(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);(0,V.useEffect)(p,[p]);let m=n?.status===`running`;(0,V.useEffect)(()=>{if(!m)return;let e=setInterval(p,2e3);return()=>clearInterval(e)},[p,m]);let h=Re(m),g=(0,V.useMemo)(()=>(n?.events??[]).map(me).filter(e=>!!e),[n?.events]),_=async()=>{s(!0),a(``);try{await l.cancel(e),p()}catch(e){a(e.message)}finally{s(!1)}},y=(0,H.jsxs)(`a`,{href:v(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,H.jsx)(de,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[y,i?(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:i}):(0,H.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let b=Fe[n.status],x=!n.replies.length,S=!!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,C=[{id:`summary`,label:`Summary`},{id:`conversation`,label:x?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:g.length||void 0},{id:`details`,label:`Details`}],w=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),T=n.outputs.filter(e=>!w.has(e.path)),E=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[y,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,H.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,H.jsx)(L,{tone:b.tone,children:b.label})]}),(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(_e,{kind:n.kind}),U[n.kind]]}),`· `,(0,H.jsx)(ze,{r:n}),`· `,K(n.startedAt),` · `,m?`running for `:`took `,J(q(n,h)),` · `,t(Y(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,H.jsxs)(P,{disabled:o,onClick:()=>void _(),className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,H.jsx)(f,{size:14,fill:`currentColor`,"aria-hidden":`true`}),o?`Stopping…`:n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`]})]}),i&&(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),n.error&&(0,H.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,H.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!m&&(0,H.jsx)(He,{actions:n.actions??[]}),(0,H.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:`flex gap-1 overflow-x-auto border-b border-line-soft`,children:C.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":c===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>u(e.id),className:d(`-mb-px inline-flex min-h-10 cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-3 text-sm font-medium whitespace-nowrap`,c===e.id?`border-accent text-ink`:`border-transparent text-muted hover:text-ink`),children:[e.label,e.n!==void 0&&(0,H.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,H.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${c}`,"aria-labelledby":`run-tab-${c}`,className:`flex min-w-0 flex-col gap-4`,children:[c===`summary`&&(0,H.jsxs)(H.Fragment,{children:[n.final&&(0,H.jsx)(je,{final:n.final,answer:n.answer}),(0,H.jsx)(Pe,{run:n}),T.length>0&&(0,H.jsx)(Q,{title:`What it produced (${T.length})`,children:T.map(e=>(0,H.jsx)(Z,{label:e.label,children:(0,H.jsx)(I,{path:e.path})},e.path))}),n.learnings.length>0&&(0,H.jsx)(Ne,{list:n.learnings}),!S&&(0,H.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:m?`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.`})]}),c===`conversation`&&(x?(0,H.jsx)(F,{text:Ue(n.prompt),className:`text-sm [&_p]:my-0`}):(0,H.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.replies.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,H.jsx)(F,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,H.jsx)(F,{text:z(e.text),className:`text-sm`}),e.error&&(0,H.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))})),c===`activity`&&(n.archived?(0,H.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,H.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):g.length?(0,H.jsx)(ce,{lines:g,start:n.startedAt,live:m,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),c===`details`&&(0,H.jsxs)(`div`,{className:`grid items-start gap-3 @3xl:grid-cols-2`,children:[(0,H.jsxs)(Q,{title:`Numbers`,children:[(0,H.jsx)(Z,{label:m?`Running for`:`Took`,children:J(q(n,h))}),(0,H.jsxs)(Z,{label:`Tokens`,children:[t(Y(n)),` `,(0,H.jsxs)(`span`,{className:`text-muted`,children:[`(`,t(n.usage.input),` in · `,t(n.usage.output),` out`,n.usage.cached?` · ${t(n.usage.cached)} cached`:``,`)`]})]}),(0,H.jsxs)(Z,{label:`Context`,children:[n.context?t(n.context.tokens):`–`,E!==null&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` of `,t(n.context.limit),` (`,E,`%)`]})]}),(0,H.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,H.jsxs)(`span`,{className:`text-muted`,children:[`in `,O(n.turns,`turn`)]})]})]}),(0,H.jsxs)(Q,{title:`Session`,children:[(0,H.jsx)(Z,{label:`Started by`,children:(0,H.jsx)(ze,{r:n})}),(0,H.jsx)(Z,{label:`Command`,children:Le(n.command)}),(0,H.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,H.jsx)(Z,{label:`Agents`,children:n.agents.length?n.agents.map(e=>`${e.name} (${O(e.calls,`call`)})`).join(`, `):(0,H.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,H.jsxs)(Z,{label:`Log`,children:[n.archived?(0,H.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,H.jsx)(I,{path:`.forgeqe/logs/${n.name}`}),n.truncated&&(0,H.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,H.jsxs)(Q,{title:`Job`,children:[(0,H.jsx)(Z,{label:`Job`,children:(0,H.jsx)(`a`,{href:v(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,H.jsx)(Z,{label:`Runs`,children:(0,H.jsx)(F,{text:Ue(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,H.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${K(n.job.nextAt)}`:``]}),n.job.run&&(0,H.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,H.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:n.files.length?n.files.map(e=>(0,H.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action||`Changed`,children:e.action===`delete`?(0,H.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,H.jsx)(I,{path:e.path})},e.path)):(0,H.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,H.jsx)(Q,{title:`Notifications`,children:n.notifications.length?n.notifications.map(e=>(0,H.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,H.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,H.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).`})})]})]})]})}var $=25;function Ge({runs:e}){let n=Re(e.some(e=>e.status===`running`)),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(`all`),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(``),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(0);(0,V.useEffect)(()=>h(0),[r,a,s,l,f]);let g=e.filter(X).length,_=r.toLowerCase().split(/\s+/).filter(Boolean),y=e.filter(e=>(f||!X(e))&&(!s||e.kind===s)&&(!l||e.origin.kind===l)&&_.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),b={all:y.length,running:y.filter(e=>e.status===`running`).length,failed:y.filter(e=>e.status===`failed`).length},S=a===`all`?y:y.filter(e=>e.status===a),C=Math.max(1,Math.ceil(S.length/$)),w=Math.min(m,C-1),T=S.slice(w*$,w*$+$),E=e.filter(e=>e.status!==`running`&&!X(e)),D=E.filter(e=>e.status===`failed`).length,k=E.length?E.reduce((e,t)=>e+q(t,n),0)/E.length:NaN,A=e.reduce((e,t)=>e+Y(t),0),j=[...new Set(e.map(e=>e.kind))],M=[...new Set(e.map(e=>e.origin.kind))],N={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,H.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm leading-relaxed text-ink-2`,children:`No runs yet. A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-g}),` runs`]}),e.some(e=>e.status===`running`)&&(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:d(`tabular-nums`,D?`text-fail`:`text-ink`),children:D}),` failed`,E.length?` (${Math.round(D/E.length*100)}%)`:``]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-ink tabular-nums`,children:t(A)}),` tokens`]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-ink tabular-nums`,children:J(Math.round(k))}),` on average`]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`relative min-w-0 w-full max-w-[320px] flex-[0_1_320px]`,children:[(0,H.jsx)(te,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,H.jsx)(`label`,{htmlFor:`run-search`,className:`sr-only`,children:`Find a run`}),(0,H.jsx)(x,{id:`run-search`,type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:`Find a run by what was asked`,className:`h-9 pl-9`})]}),[[`all`,`All`],[`running`,`Running`],[`failed`,`Failed`]].map(([e,t])=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":a===e,onClick:()=>o(e),className:d(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,a===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,H.jsx)(`span`,{className:d(`tabular-nums`,e===`failed`&&b.failed?`text-fail`:``),children:b[e]})]},e)),j.length>1&&(0,H.jsxs)(ie,{"aria-label":`What it did`,value:s,onChange:e=>c(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,H.jsx)(`option`,{value:``,children:`Any kind`}),j.map(e=>(0,H.jsx)(`option`,{value:e,children:U[e]},e))]}),M.length>1&&(0,H.jsxs)(ie,{"aria-label":`Started by`,value:l,onChange:e=>u(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,H.jsx)(`option`,{value:``,children:`Started anywhere`}),M.map(e=>(0,H.jsx)(`option`,{value:e,children:N[e]||e},e))]})]}),(0,H.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,H.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,H.jsx)(`span`,{className:`w-4`}),(0,H.jsx)(`span`,{children:`Run`}),(0,H.jsx)(`span`,{children:`Kind`}),(0,H.jsx)(`span`,{children:`Started by`}),(0,H.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,H.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,H.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,H.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[T.length===0&&(0,H.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),T.map((e,r)=>{let i=R(e.startedAt);return(0,H.jsxs)(`li`,{className:`contents`,children:[(r===0||R(T[r-1].startedAt)!==i)&&(0,H.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,H.jsxs)(`a`,{href:v(`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,H.jsx)(Be,{status:e.status}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.title,children:e.title}),e.error?(0,H.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,H.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[U[e.kind],N[e.origin.kind],J(q(e,n)),`${t(Y(e))} tokens`].join(` · `)})]}),(0,H.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,H.jsx)(_e,{kind:e.kind}),U[e.kind]]}),(0,H.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:N[e.origin.kind]||e.origin.kind}),(0,H.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:J(q(e,n))}),(0,H.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:t(Y(e))}),(0,H.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,title:K(e.startedAt),children:pe(e.startedAt)})]})]},e.name)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,H.jsxs)(`span`,{className:`flex-1`,children:[S.length?`${w*$+1}–${Math.min(S.length,w*$+$)} of ${S.length}`:`0 runs`,g>0&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(`button`,{type:`button`,onClick:()=>p(!f),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:f?`Hide the ${O(g,`empty session`)}`:`${O(g,`empty session`)} hidden`})]})]}),C>1&&(0,H.jsxs)(`nav`,{"aria-label":`Pages of runs`,className:`flex items-center gap-1`,children:[(0,H.jsx)(P,{size:`sm`,variant:`ghost`,disabled:w===0,onClick:()=>h(w-1),"aria-label":`Newer runs`,children:(0,H.jsx)(ee,{size:16,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,w+1,` of `,C]}),(0,H.jsx)(P,{size:`sm`,variant:`ghost`,disabled:w>=C-1,onClick:()=>h(w+1),"aria-label":`Older runs`,children:(0,H.jsx)(re,{size:16,"aria-hidden":`true`})})]})]})]})]})}function Ke({sub:e}){let[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(``),a=(0,V.useCallback)(()=>{l.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,V.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,V.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let s=e?decodeURIComponent(e):``;return(0,H.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,H.jsx)(M,{}),(0,H.jsx)(`main`,{className:d(le,`@container flex-auto gap-4`),children:s?(0,H.jsx)(We,{name:s},s):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(ae,{pixel:T.runs,size:`lg`}),(0,H.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,H.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,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,H.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,H.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,H.jsx)(Ge,{runs:t})]})})]})}export{Ke as Runs,Be as StatusIcon};
|