@capagents/forgeqe 2.10.3 → 2.10.4
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/dist/forgeqe.js +1385 -1384
- package/dist/web/assets/{Agent-DyyAZPKr.js → Agent-DaA5WhAY.js} +7 -7
- package/dist/web/assets/ApiTests-B7xsTGyo.js +10 -0
- package/dist/web/assets/Browse-ByYCyAwd.js +2 -0
- package/dist/web/assets/{Chat-BCV5OsEz.js → Chat-D1-cYNBr.js} +3 -3
- package/dist/web/assets/{CommandPalette-o9PuLas2.js → CommandPalette-DbxKJJJB.js} +1 -1
- package/dist/web/assets/{Compare-Bf1LhXmj.js → Compare-CYLFEtJl.js} +1 -1
- package/dist/web/assets/{Cost-r7D19VSG.js → Cost-Csz0jMHo.js} +1 -1
- package/dist/web/assets/{Data-CRttp4iM.js → Data-BWTme_Yw.js} +1 -1
- package/dist/web/assets/Desktop-rZ0vB6Ie.js +1 -0
- package/dist/web/assets/{DesktopReview-BjplTYfH.js → DesktopReview-_Xha22_d.js} +1 -1
- package/dist/web/assets/{Evidence-BAAKcK0h.js → Evidence-DmUyZy9F.js} +1 -1
- package/dist/web/assets/{Explore-D_RZhVAc.js → Explore-2wzgwz3J.js} +2 -2
- package/dist/web/assets/{Features-B6azjGtN.js → Features-DazEWqYu.js} +1 -1
- package/dist/web/assets/Flags-BTt0-pqd.js +2 -0
- package/dist/web/assets/{Flaky-Ci1bvglt.js → Flaky-CjkQp73T.js} +1 -1
- package/dist/web/assets/Impact-De87sv5J.js +3 -0
- package/dist/web/assets/Jobs-aiNGBVHL.js +5 -0
- package/dist/web/assets/{KindPage-Bl7q-2b8.js → KindPage-CrGoFeSa.js} +4 -4
- package/dist/web/assets/Migration-BAhQ1DZO.js +2 -0
- package/dist/web/assets/{Product-AMUC5arL.js → Product-DpK-PIxV.js} +2 -2
- package/dist/web/assets/{Production-CZ-EG3t2.js → Production-D6A89rZZ.js} +1 -1
- package/dist/web/assets/{Quality-k2U9v2Dn.js → Quality-Bc5wCsog.js} +1 -1
- package/dist/web/assets/{Readiness-D3_S6lDT.js → Readiness-CoVgZw2X.js} +1 -1
- package/dist/web/assets/{Record-Ba6XRn7c.js → Record-DcgBatJJ.js} +2 -2
- package/dist/web/assets/Regression-BJLYrqST.js +5 -0
- package/dist/web/assets/{Reports-BHKtb9Oi.js → Reports-DYfyfEDy.js} +2 -2
- package/dist/web/assets/{Response-CVNWGdun.js → Response-CNLi9Dqu.js} +2 -2
- package/dist/web/assets/{RunDiff-dbcFibiJ.js → RunDiff-BMTdRhii.js} +1 -1
- package/dist/web/assets/{Runs-ij-80l3A.js → Runs-lb78rvPV.js} +2 -2
- package/dist/web/assets/{TestCases-BW8laQ_8.js → TestCases-CfUwd67O.js} +1 -1
- package/dist/web/assets/TestData-DP7cvW48.js +2 -0
- package/dist/web/assets/{TestDebt-C-2y3RTV.js → TestDebt-CqARxL7k.js} +1 -1
- package/dist/web/assets/Tosca-CLAz9tWT.js +3 -0
- package/dist/web/assets/{WhatsNew-C1HUalPw.js → WhatsNew-1lhTRE5Z.js} +1 -1
- package/dist/web/assets/{dataParts-DWD2uUxL.js → dataParts-DI_OJhy5.js} +1 -1
- package/dist/web/assets/{fold-o_l3hXTU.js → fold-pOBiaSlF.js} +1 -1
- package/dist/web/assets/frame-CYYiRu5P.js +4 -0
- package/dist/web/assets/index-CNDoTeRV.css +2 -0
- package/dist/web/assets/index-D4a0w3Vl.js +67 -0
- package/dist/web/assets/{logos-CMkTgBD8.js → logos-DfCytw3-.js} +1 -1
- package/dist/web/assets/{palette-D-wSuihi.js → palette-Cj4CUs0K.js} +1 -1
- package/dist/web/assets/{qualityParts-DS83Q0nG.js → qualityParts-C9FItsTg.js} +1 -1
- package/dist/web/assets/{rows-DYYObxPx.js → rows-D6rPRkHl.js} +1 -1
- package/dist/web/assets/{thread-Cnjdo5ve.js → thread-DQdyL3Sv.js} +2 -2
- package/dist/web/assets/{usePageChat-DWmmQrbC.js → usePageChat-Dl2aUtHP.js} +1 -1
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/py/forgeqe_engine/recordsession.py +25 -0
- package/dist/web/assets/ApiTests-p_cbulD4.js +0 -10
- package/dist/web/assets/Browse-DOAlK-ox.js +0 -2
- package/dist/web/assets/Desktop-DcaKyfKA.js +0 -1
- package/dist/web/assets/Flags-BQR4dRaK.js +0 -2
- package/dist/web/assets/Impact-CPB7NjQF.js +0 -3
- package/dist/web/assets/Jobs-CR8SxpWA.js +0 -5
- package/dist/web/assets/Migration-BecNlszU.js +0 -2
- package/dist/web/assets/Regression-jpkQRkt_.js +0 -5
- package/dist/web/assets/TestData-0f1XzLdc.js +0 -2
- package/dist/web/assets/Tosca-DnfpS6Zf.js +0 -3
- package/dist/web/assets/frame-CdUL-UeQ.js +0 -4
- package/dist/web/assets/index-BmJOj6t1.js +0 -67
- package/dist/web/assets/index-DP3riJZe.css +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$n as e,Ar as t,D as n,Dt as r,Fn as i,Ir as a,L as o,M as s,Mt as c,Nn as l,Nr as u,O as d,T as f,U as p,Vn as m,Xt as h,Zn as g,_,_t as v,a as ee,at as y,f as b,j as x,kr as S,ln as C,lr as w,nr as te,ot as T,rn as E,rr as ne,y as D,yt as O}from"./line-icons-CQ-3V8ax.js";import{B as k,R as A,Rt as j,V as M,Zt as re,c as N,d as ie,f as P,h as F,i as ae,l as oe,n as se,o as ce,st as le,t as ue,u as de,z as fe}from"./filters-CflRmNDz.js";import{
|
|
2
|
-
`),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function We({e}){let[t,r]=(0,z.useState)(!1),i=e.action===`write`?`New`:`Edited`;return(0,B.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>r(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,B.jsx)(n,{size:16,"aria-hidden":`true`,className:k(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:i}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})}),(0,B.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,B.jsx)(ge,{open:t,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,B.jsx)(R,{text:Ue(e.diffs)}):null})]})}var Ge={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function W({label:e,children:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,B.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ke({c:e,files:t}){let n=e.edits.reduce((e,t)=>e+t.added,0),r=e.edits.reduce((e,t)=>e+t.removed,0),i=e.tests.filter(e=>!e.ok).length,a=e.reviews.at(-1),o=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,B.jsxs)(U,{title:`Code changes`,icon:(0,B.jsx)(F,{icon:p,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[M(e.edits.length,`file`),` · `,(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,n]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,r]})]}):o.length?(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:M(o.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,o=t.status===`error`||t.status===`failed`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(O,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:o?`text-fail`:`text-warn`}),(0,B.jsx)(`span`,{className:`text-[15px] font-semibold`,children:r?`Test written`:o?`Test not finished`:H(t.status).label}),(0,B.jsx)(N,{tone:r?`pass`:o?`fail`:`warn`,children:H(t.status).label}),e.tests.length>0&&(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[M(e.tests.length,`test run`),i?` (${i} failed)`:``,e.reviews.length?` · ${M(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-3`,children:[t.testFile&&(0,B.jsx)(W,{label:`Test`,children:(0,B.jsx)(L,{path:t.testFile})}),t.command&&(0,B.jsx)(W,{label:`Run it`,children:(0,B.jsx)(Ce,{text:t.command})}),(t.review||a)&&(0,B.jsx)(W,{label:`Review`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(N,{tone:(t.review??a).approved?`pass`:`warn`,children:(t.review??a).approved?`Approved`:`Changes asked`})}),(t.review?.summary||a?.summary)&&(0,B.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||a?.summary})]})}),t.notes&&(0,B.jsx)(W,{label:`Notes`,children:(0,B.jsx)(R,{text:t.notes,className:`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`})})]}),t.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(Le,{items:e.edits,first:8,render:e=>(0,B.jsx)(We,{e},e.path)})})]}),o.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>(0,B.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-3 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:Ge[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})})]},e.path))}),(0,B.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!o.length&&!e.results.length&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function qe({final:e,answer:t}){let n=e.from===`agent`?t?.files??[]:[],r=e.from!==`agent`,i=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),a="`".repeat(i+1);return(0,B.jsxs)(U,{title:`Final message`,icon:(0,B.jsx)(v,{size:18,"aria-hidden":`true`}),aside:(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,B.jsx)(He,{text:r?`${a}text\n${e.text}\n${a}`:ke(e.text),height:420}),n.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),n.map(e=>(0,B.jsx)(L,{path:e},e))]})]})}var Je={rule:{icon:b,label:`Rulebook`},decision:{icon:r,label:`Test decisions`},memory:{icon:_,label:`Page memory`},replay:{icon:l,label:`Replays`},model:{icon:g,label:`Model`},skill:{icon:c,label:`Skills`}};function Ye({list:e}){let t=Object.keys(Je).filter(t=>e.some(e=>e.kind===t));return(0,B.jsx)(U,{title:`Learnings`,icon:(0,B.jsx)(F,{icon:h,size:18}),aside:e.length?(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:t.map(t=>{let{icon:n,label:r}=Je[t];return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,B.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(F,{icon:n,size:14}),r]}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-1.5 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,B.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Xe({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,B.jsx)(Be,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,B.jsx)(Ve,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,B.jsx)(Ke,{c:e.coding,files:e.files},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,B.jsx)(B.Fragment,{children:t.map(e=>e.node)})}var Ze={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`},$e=e=>Qe[e]||e.charAt(0).toUpperCase()+e.slice(1),G=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},K=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),q=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,J=e=>e.usage.input+e.usage.output;function et(e){let[t,n]=(0,z.useState)(Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function tt({r:e}){return e.origin.kind===`web`?(0,B.jsxs)(`a`,{href:P(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(F,{icon:C,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,B.jsxs)(`a`,{href:P(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(F,{icon:D,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,B.jsx)(F,{icon:w,size:14}),`Terminal`]})}function Y({status:e}){let t=Ze[e].label;return e===`running`?(0,B.jsx)(E,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,B.jsx)(x,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,B.jsx)(o,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,B.jsx)(s,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!J(e)&&!e.files.length&&!e.outputs.length&&K(e,0)<2;function nt(e){return/^forgeqe(-|$)|^engine$/.test(e)?me(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,B.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var rt={rerun:i,write_test:te,investigate:m,fix_test:S},it={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function at({actions:e}){let[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await le.start(e.prompt,{});location.hash=P(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,B.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,B.jsxs)(A,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,B.jsx)(F,{icon:rt[e.kind],size:16,className:`flex-none`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:it[e.kind]}),e.note&&(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,B.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var ot=e=>`\`${e.replace(/`/g,``)}\``,st=[`summary`,`conversation`,`activity`,`details`],ct=e=>st.find(t=>t===e)??`summary`;function lt({name:n,tab:r}){let[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),u=ct(r),d=e=>location.hash=e===`summary`?P(`runs`,encodeURIComponent(n)):P(`runs`,encodeURIComponent(n),e),f=(0,z.useCallback)(()=>{j.detail(n).then(e=>{a(e),s(``)},e=>s(e.message))},[n]);(0,z.useEffect)(f,[f]);let p=i?.status===`running`;(0,z.useEffect)(()=>{if(!p)return;let e=setInterval(f,2e3);return()=>clearInterval(e)},[f,p]);let m=et(p),h=(0,z.useMemo)(()=>(i?.events??[]).map(Oe).filter(e=>!!e),[i?.events]),g=async()=>{l(!0),s(``);try{await j.cancel(n),f()}catch(e){s(e.message)}finally{l(!1)}},_=(0,B.jsxs)(`a`,{href:P(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,B.jsx)(ee,{size:16,"aria-hidden":`true`}),`All runs`]});if(!i)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_,o?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:o}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let v=Ze[i.status],y=!i.replies.length,b=!!i.final||i.executions.length>0||i.reports.length>0||!!(i.coding&&(i.coding.edits.length||i.coding.results.length))||i.learnings.length>0||i.outputs.length>0,x=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:i.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],S=new Set([...i.reports.map(e=>e.path),...i.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),C=i.outputs.filter(e=>!S.has(e.path)),w=i.context?.limit?Math.round(i.context.tokens/i.context.limit*100):null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[_,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:i.title}),(0,B.jsx)(N,{tone:v.tone,children:v.label})]}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Me,{kind:i.kind}),V[i.kind]]}),`· `,(0,B.jsx)(tt,{r:i}),`· `,G(i.startedAt),` · `,p?`running for `:`took `,q(K(i,m)),` · `,I(J(i)),` tokens`,i.profile?.model?` · ${i.profile.model}`:``]})]}),i.cancel&&(0,B.jsxs)(A,{variant:`danger`,disabled:c,"data-tip":i.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void g(),children:[i.cancel===`chat`?(0,B.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}):(0,B.jsx)(t,{"aria-hidden":`true`}),c?`Stopping…`:i.cancel===`chat`?`Stop`:`Cancel`]})]}),o&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),i.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,i.error]}),!p&&(0,B.jsx)(at,{actions:i.actions??[]}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:Ee,children:x.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":u===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>d(e.id),className:Te(u===e.id),children:[e.label,e.n!==void 0&&(0,B.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${u}`,"aria-labelledby":`run-tab-${u}`,className:`flex min-w-0 flex-col gap-6`,children:[u===`summary`&&(0,B.jsxs)(B.Fragment,{children:[i.final&&(0,B.jsx)(qe,{final:i.final,answer:i.answer}),(0,B.jsx)(Xe,{run:i}),C.length>0&&(0,B.jsx)(Q,{title:`What it produced (${C.length})`,children:C.map(e=>(0,B.jsx)(Z,{label:e.label,children:(0,B.jsx)(L,{path:e.path})},e.path))}),i.learnings.length>0&&(0,B.jsx)(Ye,{list:i.learnings}),!b&&(0,B.jsx)(oe,{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.`})]}),u===`conversation`&&(y?(0,B.jsx)(R,{text:ot(i.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:i.replies.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,B.jsx)(R,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,B.jsx)(R,{text:ke(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),u===`activity`&&(i.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,B.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):h.length?(0,B.jsx)(we,{timeline:!0,lines:h,start:i.startedAt,live:p,name:`forgeqe-run-${i.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),u===`details`&&(0,B.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-8 @3xl:grid-cols-2`,children:[(0,B.jsxs)(Q,{title:`Numbers`,children:[(0,B.jsx)(Z,{label:p?`Running for`:`Took`,children:q(K(i,m))}),(0,B.jsx)(Z,{label:`Tokens`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`span`,{children:[I(J(i)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,be(i.usage)]})]}),(i.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5 text-[13px]`,children:i.byAgent.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:nt(e.agent)}),(0,B.jsx)(`span`,{className:`text-muted tabular-nums`,children:I(e.input+e.output)})]},e.agent))})]})}),(0,B.jsxs)(Z,{label:`Context`,children:[i.context?I(i.context.tokens):`–`,w!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,I(i.context.limit),` (`,w,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[i.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,M(i.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(tt,{r:i})}),(0,B.jsx)(Z,{label:`Command`,children:$e(i.command)}),(0,B.jsx)(Z,{label:`Model`,children:i.profile?[i.profile.name,i.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:i.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:i.agents.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:nt(e.name)}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:M(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[i.archived?(0,B.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,B.jsx)(L,{path:`.forgeqe/logs/${i.name}`}),i.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),i.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:P(`jobs`,encodeURIComponent(i.origin.kind===`job`?i.origin.job:i.job.name)),children:i.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(R,{text:ot(i.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[i.job.schedule,!i.job.enabled&&` (disabled)`,i.job.nextAt&&i.job.enabled?` · next ${G(i.job.nextAt)}`:``]}),i.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[i.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,i.job.run.status.replace(`_`,` `),i.job.run.exitCode!==void 0&&i.job.run.exitCode!==null?`, exit ${i.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Files worked on (${i.files.length})`,children:i.files.length?[...i.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)).map(e=>(0,B.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action?e.action.charAt(0).toUpperCase()+e.action.slice(1):`Changed`,children:e.action===`delete`?(0,B.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,B.jsx)(L,{path:e.path})},e.path)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,B.jsx)(Q,{title:`Notifications`,children:i.notifications.length?i.notifications.map(e=>(0,B.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,B.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:i.origin.kind===`terminal`||i.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function ut({runs:e}){let t=et(e.some(e=>e.status===`running`)),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(`all`),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(0);(0,z.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,h=n.toLowerCase().split(/\s+/).filter(Boolean),g=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&h.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),_={all:g.length,running:g.filter(e=>e.status===`running`).length,failed:g.filter(e=>e.status===`failed`).length},v=i===`all`?g:g.filter(e=>e.status===i),ee=Math.max(1,Math.ceil(v.length/$)),y=Math.min(f,ee-1),b=v.slice(y*$,y*$+$),x=e.filter(e=>e.status!==`running`&&!X(e)),S=x.filter(e=>e.status===`failed`).length,w=x.length?x.reduce((e,n)=>e+K(n,t),0)/x.length:NaN,te=e.reduce((e,t)=>e+J(t),0),T=[...new Set(e.map(e=>e.kind))],E=[...new Set(e.map(e=>e.origin.kind))],D={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,B.jsx)(oe,{icon:ne,title:`No runs yet`,action:(0,B.jsxs)(`a`,{className:fe({size:`sm`}),href:P(),"data-tip":`Start a chat`,children:[(0,B.jsx)(C,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:k(`tabular-nums`,S?`text-fail`:`text-ink`),children:S}),` failed`,x.length?` (${Math.round(S/x.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:I(te)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:q(Math.round(w))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(ae,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,B.jsx)(ue,{items:[{id:`all`,label:`All`,n:_.all},{id:`running`,label:`Running`,n:_.running},{id:`failed`,label:`Failed`,n:_.failed,alert:!0}],value:i,onChange:a}),T.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Any kind`}),T.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]}),E.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Started anywhere`}),E.map(e=>(0,B.jsx)(`option`,{value:e,children:D[e]||e},e))]})]}),(0,B.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,B.jsx)(`span`,{className:`w-4`}),(0,B.jsx)(`span`,{children:`Run`}),(0,B.jsx)(`span`,{children:`Kind`}),(0,B.jsx)(`span`,{children:`Started by`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,B.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,B.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[b.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),b.map((e,n)=>{let r=xe(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(n===0||xe(b[n-1].startedAt)!==r)&&(0,B.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`a`,{href:P(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,B.jsx)(Y,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[V[e.kind],D[e.origin.kind],q(K(e,t)),`${I(J(e))} tokens`].join(` · `)})]}),(0,B.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,B.jsx)(Me,{kind:e.kind}),V[e.kind]]}),(0,B.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:D[e.origin.kind]||e.origin.kind}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:q(K(e,t))}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:I(J(e))}),(0,B.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":G(e.startedAt),children:Se(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(se,{page:y,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${M(m,`empty session`)}`:`${M(m,`empty session`)} hidden`})]})})]})]})}function dt({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{j.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,z.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,z.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ie(s):``;return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(_e,{}),(0,B.jsx)(`main`,{className:k(ve,`@container flex-auto gap-4`),children:l?(0,B.jsx)(lt,{name:l,tab:c},l):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(he,{pixel:ye.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(De,{label:`Runs and reports`,links:Ae,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(ut,{runs:t})]})})]})}export{dt as Runs,Y as StatusIcon,ct as runTab};
|
|
1
|
+
import{$n as e,Ar as t,D as n,Dt as r,Fn as i,Ir as a,L as o,M as s,Mt as c,Nn as l,Nr as u,O as d,T as f,U as p,Vn as m,Xt as h,Zn as g,_,_t as v,a as ee,at as y,f as b,j as x,kr as S,ln as C,lr as w,nr as te,ot as T,rn as E,rr as ne,y as D,yt as O}from"./line-icons-CQ-3V8ax.js";import{B as k,R as A,Rt as j,V as M,Zt as re,c as N,d as ie,f as P,h as F,i as ae,l as oe,n as se,o as ce,st as le,t as ue,u as de,z as fe}from"./filters-CflRmNDz.js";import{At as pe,Ot as me,V as I,bt as he,jt as ge,qt as _e,r as ve,t as ye,z as be}from"./frame-CYYiRu5P.js";import{n as L,r as R}from"./markdown-nTIj9lyp.js";import{i as xe,r as Se}from"./index-D4a0w3Vl.js";import{r as Ce,t as we}from"./Response-CNLi9Dqu.js";import{i as Te,r as Ee,t as De}from"./segmented-CAf_qz5Z.js";import{a as Oe,c as ke}from"./thread-DQdyL3Sv.js";import{r as Ae}from"./families-zlLgApNV.js";var z=a(u(),1),B=re(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},je={execution:O,report:y,coding:p,chat:C};function Me({kind:e}){let t=je[e];return(0,B.jsx)(F,{icon:t,size:14,className:`flex-none text-muted`})}var Ne={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},H=e=>Ne[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},Pe={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Fe=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function U({title:e,icon:t,children:n,aside:r}){return(0,B.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-line-soft pt-6 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function Ie({path:e,label:t=`Report`}){let[n,r]=(0,z.useState)(``);return(0,B.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(A,{"data-tip":`Open the report`,onClick:async()=>r(await de(e)),children:[(0,B.jsx)(T,{"aria-hidden":`true`}),t]}),n&&(0,B.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Le({items:e,first:t,render:n}){let[r,i]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[r?(0,B.jsx)(d,{size:14,"aria-hidden":`true`}):(0,B.jsx)(f,{size:14,"aria-hidden":`true`}),r?`Less`:`All (${e.length})`]})]})}function Re({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,B.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,B.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,B.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,B.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function ze({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:[Pe[e.scope]||e.scope,Fe(e.ms),e.tokens?`${I(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,B.jsx)(Ie,{path:e.report})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(N,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(N,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(N,{tone:`warn`,children:[e.counts.other,` other`]}),(0,B.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,B.jsx)(Re,{c:e.counts}),e.cases.length>0&&(0,B.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(Le,{items:[...e.cases].sort((e,t)=>Number(H(t.status).tone===`fail`)-Number(H(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,B.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(N,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,B.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,B.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Fe(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,B.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,B.jsx)(L,{path:e.folder})]})]})}function Be({list:e}){let t=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,B.jsx)(U,{title:`Execution summary`,icon:(0,B.jsx)(F,{icon:O,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[M(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,B.jsx)(ze,{e},`${e.folder||e.title}-${t}`)):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function Ve({list:e}){return(0,B.jsxs)(U,{title:`Report summary`,icon:(0,B.jsx)(F,{icon:y,size:18}),children:[e.length===0&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,B.jsx)(Ie,{path:e.path})]}),e.stats&&(0,B.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,B.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,B.jsx)(He,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function He({text:e,height:t=220}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!0),[o,s]=(0,z.useState)(t),c=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{c.current&&!n&&a(c.current.scrollHeight>t+8)},[e,t,n]),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{ref:c,style:o===void 0?void 0:{maxHeight:o},onTransitionEnd:e=>e.target===e.currentTarget&&n&&s(void 0),className:k(`transition-[max-height] duration-200 ease-out`,o!==void 0&&`relative overflow-hidden`),children:[(0,B.jsx)(R,{text:e,className:`text-sm`}),!n&&i&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=c.current?.scrollHeight??t;if(r(!n),me())return s(n?t:void 0);s(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>s(t)))},className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[n?(0,B.jsx)(d,{size:14,"aria-hidden":`true`}):(0,B.jsx)(f,{size:14,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Ue(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 We({e}){let[t,r]=(0,z.useState)(!1),i=e.action===`write`?`New`:`Edited`;return(0,B.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>r(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,B.jsx)(n,{size:16,"aria-hidden":`true`,className:k(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:i}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})}),(0,B.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,B.jsx)(ge,{open:t,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,B.jsx)(R,{text:Ue(e.diffs)}):null})]})}var Ge={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function W({label:e,children:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,B.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ke({c:e,files:t}){let n=e.edits.reduce((e,t)=>e+t.added,0),r=e.edits.reduce((e,t)=>e+t.removed,0),i=e.tests.filter(e=>!e.ok).length,a=e.reviews.at(-1),o=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,B.jsxs)(U,{title:`Code changes`,icon:(0,B.jsx)(F,{icon:p,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[M(e.edits.length,`file`),` · `,(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,n]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,r]})]}):o.length?(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:M(o.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,o=t.status===`error`||t.status===`failed`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(O,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:o?`text-fail`:`text-warn`}),(0,B.jsx)(`span`,{className:`text-[15px] font-semibold`,children:r?`Test written`:o?`Test not finished`:H(t.status).label}),(0,B.jsx)(N,{tone:r?`pass`:o?`fail`:`warn`,children:H(t.status).label}),e.tests.length>0&&(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[M(e.tests.length,`test run`),i?` (${i} failed)`:``,e.reviews.length?` · ${M(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-3`,children:[t.testFile&&(0,B.jsx)(W,{label:`Test`,children:(0,B.jsx)(L,{path:t.testFile})}),t.command&&(0,B.jsx)(W,{label:`Run it`,children:(0,B.jsx)(Ce,{text:t.command})}),(t.review||a)&&(0,B.jsx)(W,{label:`Review`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(N,{tone:(t.review??a).approved?`pass`:`warn`,children:(t.review??a).approved?`Approved`:`Changes asked`})}),(t.review?.summary||a?.summary)&&(0,B.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||a?.summary})]})}),t.notes&&(0,B.jsx)(W,{label:`Notes`,children:(0,B.jsx)(R,{text:t.notes,className:`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`})})]}),t.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(Le,{items:e.edits,first:8,render:e=>(0,B.jsx)(We,{e},e.path)})})]}),o.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>(0,B.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-3 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:Ge[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})})]},e.path))}),(0,B.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!o.length&&!e.results.length&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function qe({final:e,answer:t}){let n=e.from===`agent`?t?.files??[]:[],r=e.from!==`agent`,i=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),a="`".repeat(i+1);return(0,B.jsxs)(U,{title:`Final message`,icon:(0,B.jsx)(v,{size:18,"aria-hidden":`true`}),aside:(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,B.jsx)(He,{text:r?`${a}text\n${e.text}\n${a}`:ke(e.text),height:420}),n.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),n.map(e=>(0,B.jsx)(L,{path:e},e))]})]})}var Je={rule:{icon:b,label:`Rulebook`},decision:{icon:r,label:`Test decisions`},memory:{icon:_,label:`Page memory`},replay:{icon:l,label:`Replays`},model:{icon:g,label:`Model`},skill:{icon:c,label:`Skills`}};function Ye({list:e}){let t=Object.keys(Je).filter(t=>e.some(e=>e.kind===t));return(0,B.jsx)(U,{title:`Learnings`,icon:(0,B.jsx)(F,{icon:h,size:18}),aside:e.length?(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:t.map(t=>{let{icon:n,label:r}=Je[t];return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,B.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(F,{icon:n,size:14}),r]}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-1.5 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,B.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Xe({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,B.jsx)(Be,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,B.jsx)(Ve,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,B.jsx)(Ke,{c:e.coding,files:e.files},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,B.jsx)(B.Fragment,{children:t.map(e=>e.node)})}var Ze={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`},$e=e=>Qe[e]||e.charAt(0).toUpperCase()+e.slice(1),G=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},K=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),q=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,J=e=>e.usage.input+e.usage.output;function et(e){let[t,n]=(0,z.useState)(Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function tt({r:e}){return e.origin.kind===`web`?(0,B.jsxs)(`a`,{href:P(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(F,{icon:C,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,B.jsxs)(`a`,{href:P(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(F,{icon:D,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,B.jsx)(F,{icon:w,size:14}),`Terminal`]})}function Y({status:e}){let t=Ze[e].label;return e===`running`?(0,B.jsx)(E,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,B.jsx)(x,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,B.jsx)(o,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,B.jsx)(s,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!J(e)&&!e.files.length&&!e.outputs.length&&K(e,0)<2;function nt(e){return/^forgeqe(-|$)|^engine$/.test(e)?_e(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,B.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var rt={rerun:i,write_test:te,investigate:m,fix_test:S},it={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function at({actions:e}){let[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await le.start(e.prompt,{});location.hash=P(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,B.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,B.jsxs)(A,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,B.jsx)(F,{icon:rt[e.kind],size:16,className:`flex-none`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:it[e.kind]}),e.note&&(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,B.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var ot=e=>`\`${e.replace(/`/g,``)}\``,st=[`summary`,`conversation`,`activity`,`details`],ct=e=>st.find(t=>t===e)??`summary`;function lt({name:n,tab:r}){let[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),u=ct(r),d=e=>location.hash=e===`summary`?P(`runs`,encodeURIComponent(n)):P(`runs`,encodeURIComponent(n),e),f=(0,z.useCallback)(()=>{j.detail(n).then(e=>{a(e),s(``)},e=>s(e.message))},[n]);(0,z.useEffect)(f,[f]);let p=i?.status===`running`;(0,z.useEffect)(()=>{if(!p)return;let e=setInterval(f,2e3);return()=>clearInterval(e)},[f,p]);let m=et(p),h=(0,z.useMemo)(()=>(i?.events??[]).map(Oe).filter(e=>!!e),[i?.events]),g=async()=>{l(!0),s(``);try{await j.cancel(n),f()}catch(e){s(e.message)}finally{l(!1)}},_=(0,B.jsxs)(`a`,{href:P(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,B.jsx)(ee,{size:16,"aria-hidden":`true`}),`All runs`]});if(!i)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_,o?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:o}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let v=Ze[i.status],y=!i.replies.length,b=!!i.final||i.executions.length>0||i.reports.length>0||!!(i.coding&&(i.coding.edits.length||i.coding.results.length))||i.learnings.length>0||i.outputs.length>0,x=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:i.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],S=new Set([...i.reports.map(e=>e.path),...i.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),C=i.outputs.filter(e=>!S.has(e.path)),w=i.context?.limit?Math.round(i.context.tokens/i.context.limit*100):null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[_,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:i.title}),(0,B.jsx)(N,{tone:v.tone,children:v.label})]}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Me,{kind:i.kind}),V[i.kind]]}),`· `,(0,B.jsx)(tt,{r:i}),`· `,G(i.startedAt),` · `,p?`running for `:`took `,q(K(i,m)),` · `,I(J(i)),` tokens`,i.profile?.model?` · ${i.profile.model}`:``]})]}),i.cancel&&(0,B.jsxs)(A,{variant:`danger`,disabled:c,"data-tip":i.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void g(),children:[i.cancel===`chat`?(0,B.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}):(0,B.jsx)(t,{"aria-hidden":`true`}),c?`Stopping…`:i.cancel===`chat`?`Stop`:`Cancel`]})]}),o&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),i.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,i.error]}),!p&&(0,B.jsx)(at,{actions:i.actions??[]}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:Ee,children:x.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":u===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>d(e.id),className:Te(u===e.id),children:[e.label,e.n!==void 0&&(0,B.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${u}`,"aria-labelledby":`run-tab-${u}`,className:`flex min-w-0 flex-col gap-6`,children:[u===`summary`&&(0,B.jsxs)(B.Fragment,{children:[i.final&&(0,B.jsx)(qe,{final:i.final,answer:i.answer}),(0,B.jsx)(Xe,{run:i}),C.length>0&&(0,B.jsx)(Q,{title:`What it produced (${C.length})`,children:C.map(e=>(0,B.jsx)(Z,{label:e.label,children:(0,B.jsx)(L,{path:e.path})},e.path))}),i.learnings.length>0&&(0,B.jsx)(Ye,{list:i.learnings}),!b&&(0,B.jsx)(oe,{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.`})]}),u===`conversation`&&(y?(0,B.jsx)(R,{text:ot(i.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:i.replies.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,B.jsx)(R,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,B.jsx)(R,{text:ke(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),u===`activity`&&(i.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,B.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):h.length?(0,B.jsx)(we,{timeline:!0,lines:h,start:i.startedAt,live:p,name:`forgeqe-run-${i.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),u===`details`&&(0,B.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-8 @3xl:grid-cols-2`,children:[(0,B.jsxs)(Q,{title:`Numbers`,children:[(0,B.jsx)(Z,{label:p?`Running for`:`Took`,children:q(K(i,m))}),(0,B.jsx)(Z,{label:`Tokens`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`span`,{children:[I(J(i)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,be(i.usage)]})]}),(i.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5 text-[13px]`,children:i.byAgent.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:nt(e.agent)}),(0,B.jsx)(`span`,{className:`text-muted tabular-nums`,children:I(e.input+e.output)})]},e.agent))})]})}),(0,B.jsxs)(Z,{label:`Context`,children:[i.context?I(i.context.tokens):`–`,w!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,I(i.context.limit),` (`,w,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[i.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,M(i.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(tt,{r:i})}),(0,B.jsx)(Z,{label:`Command`,children:$e(i.command)}),(0,B.jsx)(Z,{label:`Model`,children:i.profile?[i.profile.name,i.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:i.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:i.agents.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:nt(e.name)}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:M(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[i.archived?(0,B.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,B.jsx)(L,{path:`.forgeqe/logs/${i.name}`}),i.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),i.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:P(`jobs`,encodeURIComponent(i.origin.kind===`job`?i.origin.job:i.job.name)),children:i.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(R,{text:ot(i.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[i.job.schedule,!i.job.enabled&&` (disabled)`,i.job.nextAt&&i.job.enabled?` · next ${G(i.job.nextAt)}`:``]}),i.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[i.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,i.job.run.status.replace(`_`,` `),i.job.run.exitCode!==void 0&&i.job.run.exitCode!==null?`, exit ${i.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Files worked on (${i.files.length})`,children:i.files.length?[...i.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)).map(e=>(0,B.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action?e.action.charAt(0).toUpperCase()+e.action.slice(1):`Changed`,children:e.action===`delete`?(0,B.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,B.jsx)(L,{path:e.path})},e.path)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,B.jsx)(Q,{title:`Notifications`,children:i.notifications.length?i.notifications.map(e=>(0,B.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,B.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:i.origin.kind===`terminal`||i.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function ut({runs:e}){let t=et(e.some(e=>e.status===`running`)),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(`all`),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(0);(0,z.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,h=n.toLowerCase().split(/\s+/).filter(Boolean),g=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&h.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),_={all:g.length,running:g.filter(e=>e.status===`running`).length,failed:g.filter(e=>e.status===`failed`).length},v=i===`all`?g:g.filter(e=>e.status===i),ee=Math.max(1,Math.ceil(v.length/$)),y=Math.min(f,ee-1),b=v.slice(y*$,y*$+$),x=e.filter(e=>e.status!==`running`&&!X(e)),S=x.filter(e=>e.status===`failed`).length,w=x.length?x.reduce((e,n)=>e+K(n,t),0)/x.length:NaN,te=e.reduce((e,t)=>e+J(t),0),T=[...new Set(e.map(e=>e.kind))],E=[...new Set(e.map(e=>e.origin.kind))],D={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,B.jsx)(oe,{icon:ne,title:`No runs yet`,action:(0,B.jsxs)(`a`,{className:fe({size:`sm`}),href:P(),"data-tip":`Start a chat`,children:[(0,B.jsx)(C,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:k(`tabular-nums`,S?`text-fail`:`text-ink`),children:S}),` failed`,x.length?` (${Math.round(S/x.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:I(te)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:q(Math.round(w))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(ae,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,B.jsx)(ue,{items:[{id:`all`,label:`All`,n:_.all},{id:`running`,label:`Running`,n:_.running},{id:`failed`,label:`Failed`,n:_.failed,alert:!0}],value:i,onChange:a}),T.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Any kind`}),T.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]}),E.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Started anywhere`}),E.map(e=>(0,B.jsx)(`option`,{value:e,children:D[e]||e},e))]})]}),(0,B.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,B.jsx)(`span`,{className:`w-4`}),(0,B.jsx)(`span`,{children:`Run`}),(0,B.jsx)(`span`,{children:`Kind`}),(0,B.jsx)(`span`,{children:`Started by`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,B.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,B.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[b.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),b.map((e,n)=>{let r=xe(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(n===0||xe(b[n-1].startedAt)!==r)&&(0,B.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`a`,{href:P(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,B.jsx)(Y,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[V[e.kind],D[e.origin.kind],q(K(e,t)),`${I(J(e))} tokens`].join(` · `)})]}),(0,B.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,B.jsx)(Me,{kind:e.kind}),V[e.kind]]}),(0,B.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:D[e.origin.kind]||e.origin.kind}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:q(K(e,t))}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:I(J(e))}),(0,B.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":G(e.startedAt),children:Se(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(se,{page:y,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${M(m,`empty session`)}`:`${M(m,`empty session`)} hidden`})]})})]})]})}function dt({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{j.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,z.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,z.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ie(s):``;return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(ve,{}),(0,B.jsx)(`main`,{className:k(ye,`@container flex-auto gap-4`),children:l?(0,B.jsx)(lt,{name:l,tab:c},l):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(pe,{pixel:he.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(De,{label:`Runs and reports`,links:Ae,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(ut,{runs:t})]})})]})}export{dt as Runs,Y as StatusIcon,ct as runTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$t as e,Ar as t,C as n,Ft as r,Ir as i,Nr as a,R as o,en as s,gr as c,it as l,o as u,rt as d}from"./line-icons-CQ-3V8ax.js";import{B as f,Gt as p,R as m,Zt as h,a as g,d as _,et as v,f as y,h as b,l as x,t as S}from"./filters-CflRmNDz.js";import{Ot as C,at as w,nt as T,r as E,rt as D,st as O,t as k,vt as A}from"./frame-CdUL-UeQ.js";import{o as j}from"./markdown-nTIj9lyp.js";import{r as M,s as N}from"./index-BmJOj6t1.js";var P=i(a(),1),F=h(),I=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],L=e=>I.some(t=>t.id===e),R=e=>e&&j(e)===`web`?e:void 0,z=(e,t)=>`${e} ${t}${e===1?``:`s`}`,B=e=>`${e.kind}:${e.id}`;function V(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${z((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function H(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function U(){let[e,t]=(0,P.useState)(I.map(e=>e.id)),[n,r]=(0,P.useState)(``);return(0,P.useEffect)(()=>{v.settings().then(e=>{let n=e.config.sources??{},r=I.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:I.filter(t=>e.includes(t.id)),error:n}}function W({id:e,icon:t,title:n,children:r}){return(0,F.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-3`,children:[(0,F.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,F.jsx)(b,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function G({view:i,onApplied:a,onError:u}){let[h,g]=(0,P.useState)([]),[_,v]=(0,P.useState)(null),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),C=i.story.id,E=i.proposals.filter(e=>h.includes(B(e))),k=async()=>{let e=E.map(e=>H(e,C));b(!0);try{let t=await p.preview(i.system,C,e);v({lines:t.lines,changes:e}),u(``)}catch(e){u(e.message)}finally{b(!1)}},A=async()=>{if(_){b(!0);try{let e=await p.apply(i.system,C,_.changes);S({applied:e.applied,failed:e.failed}),v(null),g([]),u(``),a()}catch(e){u(e.message)}finally{b(!1)}}},j=R(i.story.url);return(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,F.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[j?(0,F.jsxs)(`a`,{href:j,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[C,(0,F.jsx)(d,{size:14,"aria-hidden":`true`})]}):(0,F.jsx)(`span`,{children:C}),i.story.title&&(0,F.jsx)(`span`,{className:`font-normal text-ink-2`,children:i.story.title})]}),i.changed&&(0,F.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(i.changed.when).toLocaleString(),children:[`The story's `,i.changed.field,` changed `,M(i.changed.when),`.`]})]}),(0,F.jsx)(W,{id:`cases-h`,icon:e,title:`Linked cases`,children:(0,F.jsx)(T,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:w,children:`Case`}),(0,F.jsx)(`th`,{className:w,children:`Title`}),(0,F.jsx)(`th`,{className:f(w,`text-right`),children:`Steps`}),(0,F.jsx)(`th`,{className:w,children:`State`})]}),children:i.cases.map(e=>{let t=R(e.url);return(0,F.jsxs)(`tr`,{className:O,children:[(0,F.jsx)(`td`,{className:f(D,`whitespace-nowrap`),children:t?(0,F.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,F.jsx)(d,{size:12,"aria-hidden":`true`})]}):e.id}),(0,F.jsx)(`td`,{className:f(D,`[overflow-wrap:anywhere]`),children:e.title}),(0,F.jsx)(`td`,{className:f(D,`text-right tabular-nums`),children:e.steps}),(0,F.jsx)(`td`,{className:f(D,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(c,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,F.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,M(e.changed)]}):`–`})]},e.id)})})}),(0,F.jsx)(W,{id:`criteria-h`,icon:o,title:`Acceptance criteria`,children:(0,F.jsx)(T,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:w,children:`Criterion`}),(0,F.jsx)(`th`,{className:w,children:`Cases`})]}),children:i.criteria.map((e,t)=>(0,F.jsxs)(`tr`,{className:O,children:[(0,F.jsx)(`td`,{className:f(D,`[overflow-wrap:anywhere]`),children:e.text}),(0,F.jsx)(`td`,{className:f(D,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,F.jsxs)(W,{id:`proposals-h`,icon:s,title:`Proposed changes`,children:[(0,F.jsx)(T,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,F.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y||!E.length||!!_,"data-tip":`Review ${z(E.length,`change`)}`,onClick:()=>void k(),children:[(0,F.jsx)(l,{"aria-hidden":`true`}),`Review (`,E.length,`)`]}),head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:f(w,`w-10`),children:(0,F.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,F.jsx)(`th`,{className:w,children:`Change`}),(0,F.jsx)(`th`,{className:w,children:`Existing case`}),(0,F.jsx)(`th`,{className:w,children:`The agent wrote`})]}),children:i.proposals.map(e=>{let t=B(e);return(0,F.jsxs)(`tr`,{className:O,children:[(0,F.jsx)(`td`,{className:D,children:(0,F.jsx)(N,{"aria-label":`${V(e)}: ${e.id} ${e.title}`,checked:h.includes(t),disabled:y||!!_,onCheckedChange:e=>g(e?[...h,t]:h.filter(e=>e!==t))})}),(0,F.jsxs)(`td`,{className:f(D,`whitespace-nowrap font-medium`),children:[V(e),e.link&&e.kind!==`link`&&(0,F.jsx)(`span`,{className:`block text-[12px] font-normal text-muted`,children:`and link it`})]}),(0,F.jsxs)(`td`,{className:f(D,`[overflow-wrap:anywhere]`),children:[(0,F.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2`,children:e.id}),` `,e.title]}),(0,F.jsx)(`td`,{className:f(D,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),_&&(0,F.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,F.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,z(_.changes.length,`change`),` to `,I.find(e=>e.id===i.system)?.label,`?`]}),(0,F.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:_.lines.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y,onClick:()=>void A(),children:[(0,F.jsx)(n,{"aria-hidden":`true`}),`Apply`]}),(0,F.jsxs)(m,{size:`sm`,disabled:y,onClick:()=>v(null),children:[(0,F.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]})]}),x&&x.applied.length>0&&(0,F.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,x.applied.join(`, `)]}),x&&x.failed.length>0&&(0,F.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,x.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,F.jsx)(W,{id:`changes-h`,icon:r,title:`Recent changes`,children:i.changes.length?(0,F.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:i.changes.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),i.notes.map((e,t)=>(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function K({sub:t}){let{systems:n,error:r}=U(),i=t?t.indexOf(`/`):-1,a=i>0?t.slice(0,i):t,o=L(a)?a:void 0,s=o&&i>0?_(t.slice(i+1)):``,[c,l]=(0,P.useState)(o??`azure_devops`),[d,h]=(0,P.useState)(s),[v,b]=(0,P.useState)(null),[w,T]=(0,P.useState)(``),[D,O]=(0,P.useState)(!1);(0,P.useEffect)(()=>{o&&l(o),h(s)},[o,s]),(0,P.useEffect)(()=>{!o&&n.length&&!n.some(e=>e.id===c)&&l(n[0].id)},[n,c,o]);let j=(0,P.useCallback)(()=>{!o||!s?b(null):(O(!0),p.view(o,s).then(e=>{b(e),T(``),O(!1)},e=>{T(e.message),O(!1)}))},[o,s]);return(0,P.useEffect)(()=>b(null),[o,s]),(0,P.useEffect)(j,[j]),(0,F.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,F.jsx)(E,{}),(0,F.jsxs)(`main`,{className:f(k,`@container flex-auto gap-4`),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsx)(C,{pixel:A[`test-cases`],size:`lg`}),(0,F.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,F.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,F.jsx)(`a`,{href:y(`regression`),children:`Regression`}),`; their results on `,(0,F.jsx)(`a`,{href:y(`runs`),children:`Runs`}),`.`]}),(0,F.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=d.trim();if(!t)return;let n=y(`test-cases`,c,encodeURIComponent(t));location.hash===n?j():location.hash=n},className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-1.5`,children:(0,F.jsx)(S,{items:n,value:c,onChange:l})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,F.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,F.jsx)(g,{value:d,maxLength:120,spellCheck:!1,placeholder:c===`azure_devops`?`1234`:c===`qtest`?`5678`:c===`testrail`?`R12`:`SHOP-12`,onChange:e=>h(e.target.value)})]}),(0,F.jsxs)(m,{type:`submit`,variant:`primary`,disabled:!d.trim()||D,"data-tip":`Open the story's test cases`,children:[(0,F.jsx)(u,{"aria-hidden":`true`}),`Open`]})]})]}),[r,w].filter(Boolean).map(e=>(0,F.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),D&&(0,F.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),v&&(0,F.jsx)(G,{view:v,onApplied:j,onError:T},`${v.system}:${v.story.id}`),!s&&!v&&(0,F.jsx)(x,{icon:e,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})]})}export{K as TestCases};
|
|
1
|
+
import{$t as e,Ar as t,C as n,Ft as r,Ir as i,Nr as a,R as o,en as s,gr as c,it as l,o as u,rt as d}from"./line-icons-CQ-3V8ax.js";import{B as f,Gt as p,R as m,Zt as h,a as g,d as _,et as v,f as y,h as b,l as x,t as S}from"./filters-CflRmNDz.js";import{At as C,at as w,bt as T,nt as E,r as D,rt as O,st as k,t as A}from"./frame-CYYiRu5P.js";import{o as j}from"./markdown-nTIj9lyp.js";import{r as M,s as N}from"./index-D4a0w3Vl.js";var P=i(a(),1),F=h(),I=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],L=e=>I.some(t=>t.id===e),R=e=>e&&j(e)===`web`?e:void 0,z=(e,t)=>`${e} ${t}${e===1?``:`s`}`,B=e=>`${e.kind}:${e.id}`;function V(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${z((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function H(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function U(){let[e,t]=(0,P.useState)(I.map(e=>e.id)),[n,r]=(0,P.useState)(``);return(0,P.useEffect)(()=>{v.settings().then(e=>{let n=e.config.sources??{},r=I.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:I.filter(t=>e.includes(t.id)),error:n}}function W({id:e,icon:t,title:n,children:r}){return(0,F.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-3`,children:[(0,F.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,F.jsx)(b,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function G({view:i,onApplied:a,onError:u}){let[h,g]=(0,P.useState)([]),[_,v]=(0,P.useState)(null),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),C=i.story.id,T=i.proposals.filter(e=>h.includes(B(e))),D=async()=>{let e=T.map(e=>H(e,C));b(!0);try{let t=await p.preview(i.system,C,e);v({lines:t.lines,changes:e}),u(``)}catch(e){u(e.message)}finally{b(!1)}},A=async()=>{if(_){b(!0);try{let e=await p.apply(i.system,C,_.changes);S({applied:e.applied,failed:e.failed}),v(null),g([]),u(``),a()}catch(e){u(e.message)}finally{b(!1)}}},j=R(i.story.url);return(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,F.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[j?(0,F.jsxs)(`a`,{href:j,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[C,(0,F.jsx)(d,{size:14,"aria-hidden":`true`})]}):(0,F.jsx)(`span`,{children:C}),i.story.title&&(0,F.jsx)(`span`,{className:`font-normal text-ink-2`,children:i.story.title})]}),i.changed&&(0,F.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(i.changed.when).toLocaleString(),children:[`The story's `,i.changed.field,` changed `,M(i.changed.when),`.`]})]}),(0,F.jsx)(W,{id:`cases-h`,icon:e,title:`Linked cases`,children:(0,F.jsx)(E,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:w,children:`Case`}),(0,F.jsx)(`th`,{className:w,children:`Title`}),(0,F.jsx)(`th`,{className:f(w,`text-right`),children:`Steps`}),(0,F.jsx)(`th`,{className:w,children:`State`})]}),children:i.cases.map(e=>{let t=R(e.url);return(0,F.jsxs)(`tr`,{className:k,children:[(0,F.jsx)(`td`,{className:f(O,`whitespace-nowrap`),children:t?(0,F.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,F.jsx)(d,{size:12,"aria-hidden":`true`})]}):e.id}),(0,F.jsx)(`td`,{className:f(O,`[overflow-wrap:anywhere]`),children:e.title}),(0,F.jsx)(`td`,{className:f(O,`text-right tabular-nums`),children:e.steps}),(0,F.jsx)(`td`,{className:f(O,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(c,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,F.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,M(e.changed)]}):`–`})]},e.id)})})}),(0,F.jsx)(W,{id:`criteria-h`,icon:o,title:`Acceptance criteria`,children:(0,F.jsx)(E,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:w,children:`Criterion`}),(0,F.jsx)(`th`,{className:w,children:`Cases`})]}),children:i.criteria.map((e,t)=>(0,F.jsxs)(`tr`,{className:k,children:[(0,F.jsx)(`td`,{className:f(O,`[overflow-wrap:anywhere]`),children:e.text}),(0,F.jsx)(`td`,{className:f(O,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,F.jsxs)(W,{id:`proposals-h`,icon:s,title:`Proposed changes`,children:[(0,F.jsx)(E,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,F.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y||!T.length||!!_,"data-tip":`Review ${z(T.length,`change`)}`,onClick:()=>void D(),children:[(0,F.jsx)(l,{"aria-hidden":`true`}),`Review (`,T.length,`)`]}),head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:f(w,`w-10`),children:(0,F.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,F.jsx)(`th`,{className:w,children:`Change`}),(0,F.jsx)(`th`,{className:w,children:`Existing case`}),(0,F.jsx)(`th`,{className:w,children:`The agent wrote`})]}),children:i.proposals.map(e=>{let t=B(e);return(0,F.jsxs)(`tr`,{className:k,children:[(0,F.jsx)(`td`,{className:O,children:(0,F.jsx)(N,{"aria-label":`${V(e)}: ${e.id} ${e.title}`,checked:h.includes(t),disabled:y||!!_,onCheckedChange:e=>g(e?[...h,t]:h.filter(e=>e!==t))})}),(0,F.jsxs)(`td`,{className:f(O,`whitespace-nowrap font-medium`),children:[V(e),e.link&&e.kind!==`link`&&(0,F.jsx)(`span`,{className:`block text-[12px] font-normal text-muted`,children:`and link it`})]}),(0,F.jsxs)(`td`,{className:f(O,`[overflow-wrap:anywhere]`),children:[(0,F.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2`,children:e.id}),` `,e.title]}),(0,F.jsx)(`td`,{className:f(O,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),_&&(0,F.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,F.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,z(_.changes.length,`change`),` to `,I.find(e=>e.id===i.system)?.label,`?`]}),(0,F.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:_.lines.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y,onClick:()=>void A(),children:[(0,F.jsx)(n,{"aria-hidden":`true`}),`Apply`]}),(0,F.jsxs)(m,{size:`sm`,disabled:y,onClick:()=>v(null),children:[(0,F.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]})]}),x&&x.applied.length>0&&(0,F.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,x.applied.join(`, `)]}),x&&x.failed.length>0&&(0,F.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,x.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,F.jsx)(W,{id:`changes-h`,icon:r,title:`Recent changes`,children:i.changes.length?(0,F.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:i.changes.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),i.notes.map((e,t)=>(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function K({sub:t}){let{systems:n,error:r}=U(),i=t?t.indexOf(`/`):-1,a=i>0?t.slice(0,i):t,o=L(a)?a:void 0,s=o&&i>0?_(t.slice(i+1)):``,[c,l]=(0,P.useState)(o??`azure_devops`),[d,h]=(0,P.useState)(s),[v,b]=(0,P.useState)(null),[w,E]=(0,P.useState)(``),[O,k]=(0,P.useState)(!1);(0,P.useEffect)(()=>{o&&l(o),h(s)},[o,s]),(0,P.useEffect)(()=>{!o&&n.length&&!n.some(e=>e.id===c)&&l(n[0].id)},[n,c,o]);let j=(0,P.useCallback)(()=>{!o||!s?b(null):(k(!0),p.view(o,s).then(e=>{b(e),E(``),k(!1)},e=>{E(e.message),k(!1)}))},[o,s]);return(0,P.useEffect)(()=>b(null),[o,s]),(0,P.useEffect)(j,[j]),(0,F.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,F.jsx)(D,{}),(0,F.jsxs)(`main`,{className:f(A,`@container flex-auto gap-4`),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsx)(C,{pixel:T[`test-cases`],size:`lg`}),(0,F.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,F.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,F.jsx)(`a`,{href:y(`regression`),children:`Regression`}),`; their results on `,(0,F.jsx)(`a`,{href:y(`runs`),children:`Runs`}),`.`]}),(0,F.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=d.trim();if(!t)return;let n=y(`test-cases`,c,encodeURIComponent(t));location.hash===n?j():location.hash=n},className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-1.5`,children:(0,F.jsx)(S,{items:n,value:c,onChange:l})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,F.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,F.jsx)(g,{value:d,maxLength:120,spellCheck:!1,placeholder:c===`azure_devops`?`1234`:c===`qtest`?`5678`:c===`testrail`?`R12`:`SHOP-12`,onChange:e=>h(e.target.value)})]}),(0,F.jsxs)(m,{type:`submit`,variant:`primary`,disabled:!d.trim()||O,"data-tip":`Open the story's test cases`,children:[(0,F.jsx)(u,{"aria-hidden":`true`}),`Open`]})]})]}),[r,w].filter(Boolean).map(e=>(0,F.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),O&&(0,F.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),v&&(0,F.jsx)(G,{view:v,onApplied:j,onError:E},`${v.system}:${v.story.id}`),!s&&!v&&(0,F.jsx)(x,{icon:e,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})]})}export{K as TestCases};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ar as e,C as t,D as n,Fr as r,Ir as i,Mn as a,Nr as o,Q as s,Qn as c,T as l,a as u,it as d,ln as f,pr as p,tt as m,yt as h}from"./line-icons-CQ-3V8ax.js";import{B as g,R as _,V as v,Zt as y,a as b,c as x,dt as S,f as C,h as w,l as T,o as E,st as ee,t as D,z as O}from"./filters-CflRmNDz.js";import{At as k,at as A,bt as j,ct as te,it as M,nt as N,ot as P,r as F,rt as I,t as ne}from"./frame-CYYiRu5P.js";import{r as L}from"./index-D4a0w3Vl.js";import{n as re}from"./segmented-CAf_qz5Z.js";import{a as ie,c as R,f as z,i as B,n as V,o as H,r as U,s as W,t as G,u as K}from"./dataParts-DI_OJhy5.js";var q=r({Requests:()=>Q,TestData:()=>$}),J=i(o(),1),Y=y(),X=[`requests`,`kept`,`specs`,`batches`],Z={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},ae=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function oe({e,kept:t,busy:n,act:r}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,Y.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked the DB agent for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.name})]}):null]}),e.why&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,Y.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,Y.jsx)(R,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,Y.jsx)(K,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,Y.jsx)(V,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,Y.jsx)(V,{label:`INSERT script`,children:e.script_preview.join(`
|
|
2
|
+
`)})]}):null,t&&e.name&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(_,{size:`sm`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,Y.jsx)(a,{"aria-hidden":`true`}),`Refresh`]})})]})}function Q({view:e,log:t,busy:r,act:i}){let[a,o]=(0,J.useState)(`all`),[s,c]=(0,J.useState)(``),[u,d]=(0,J.useState)(``),[p,m]=(0,J.useState)(``),_=t??[],v=(0,J.useMemo)(()=>[...new Set(_.map(e=>e.requester))].sort(),[t]),y=(0,J.useMemo)(()=>[...new Set(_.map(e=>e.database).filter(Boolean))].sort(),[t]),b=_.filter(e=>!e.ok).length,S=_.filter(e=>(a===`all`||a===`ok`===e.ok)&&(!s||e.requester===s)&&(!u||e.database===u)),w=new Set(e.requests.map(e=>e.name));return t===null?(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):_.length?(0,Y.jsx)(N,{label:`Requests`,resetKey:`${a}|${s}|${u}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(D,{value:a,onChange:o,items:[{id:`all`,label:`All`,n:_.length},{id:`ok`,label:`Answered`,n:_.length-b},{id:`failed`,label:`Failed`,n:b,alert:!0}]}),v.length>1&&(0,Y.jsxs)(E,{size:`sm`,"aria-label":`Who asked`,value:s,onChange:e=>c(e.target.value),className:`w-[180px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Anyone`}),v.map(e=>(0,Y.jsx)(`option`,{children:e},e))]}),y.length>1&&(0,Y.jsxs)(E,{size:`sm`,"aria-label":`Database`,value:u,onChange:e=>d(e.target.value),className:`w-[160px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Any database`}),y.map(e=>(0,Y.jsx)(`option`,{children:e},e))]})]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{className:g(A,`w-9`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,Y.jsx)(`th`,{className:g(A,`w-[110px]`),children:`When`}),(0,Y.jsx)(`th`,{className:g(A,`w-[150px]`),children:`Who asked`}),(0,Y.jsx)(`th`,{className:A,children:`What for`}),(0,Y.jsx)(`th`,{className:g(A,`w-[110px]`),children:`Database`}),(0,Y.jsx)(`th`,{className:g(A,`w-[140px]`),children:`Answer`}),(0,Y.jsx)(`th`,{className:g(P,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:S.map(e=>{let t=p===e.id;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`tr`,{className:g(te,t&&`bg-surface-muted`),onClick:()=>m(t?``:e.id),children:[(0,Y.jsx)(`td`,{className:g(I,`pr-0`),children:(0,Y.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":t?`Close the request`:`Open the request`,onClick:n=>(n.stopPropagation(),m(t?``:e.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:t?(0,Y.jsx)(l,{size:16,"aria-hidden":`true`}):(0,Y.jsx)(n,{size:16,"aria-hidden":`true`})})}),(0,Y.jsx)(`td`,{className:g(I,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),children:L(e.at)}),(0,Y.jsx)(`td`,{className:g(I,`truncate`),"data-tip":e.requester,children:e.requester}),(0,Y.jsxs)(`td`,{className:g(I,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,Y.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,Y.jsx)(`td`,{className:g(I,`truncate`),"data-tip":e.database,children:e.database||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:g(I,`whitespace-nowrap`),children:(0,Y.jsx)(x,{tone:e.ok?`pass`:`fail`,children:e.ok?H[e.kind||``]||`Answered`:`Failed`})}),(0,Y.jsx)(`td`,{className:M,children:e.ok?ae(e):``})]}),t&&(0,Y.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,Y.jsx)(`td`,{colSpan:7,className:`max-w-0 px-4 py-2`,children:(0,Y.jsx)(oe,{e,kept:!!e.name&&w.has(e.name),busy:r,act:i})})})]},e.id)})}):(0,Y.jsx)(T,{icon:h,title:`No test data asked for yet`,action:(0,Y.jsxs)(`a`,{href:C(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(O({size:`sm`}),`no-underline`),children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function se({view:e,job:t,busy:n,act:r,onNote:i}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),o&&(0,Y.jsxs)(`section`,{"aria-label":`Fetched ${o.target}`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:o.target}),s&&!s.ok&&(0,Y.jsx)(R,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,Y.jsx)(G,{r:s,onNote:i})]}),e.requests.length===0?(0,Y.jsxs)(T,{className:`py-3`,children:[`No kept requests yet. Each request the DB agent answers is kept here; `,(0,Y.jsx)(`a`,{href:C(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,Y.jsx)(W,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,H[e.kind],e.rows?` · ${v(e.rows,`row`)}`:``,e.created?` · ${L(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,Y.jsx)(_,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,Y.jsx)(a,{"aria-hidden":`true`})})]},e.name)})]})}function ce({view:t,job:n,busy:r,act:i,onNote:a}){let[o,c]=(0,J.useState)(t.specs[0]??``),[l,u]=(0,J.useState)(``),[p,g]=(0,J.useState)(``),[v,y]=(0,J.useState)(`csv`),[x,S]=(0,J.useState)(!1),D={spec:o,...l?{db:l}:{},...p?{seed:p}:{}},O=n&&!n.running?n:null,k=O&&[`gen`,`files`,`insert`].includes(O.kind)&&O.target===o?O.result:void 0,A=t.databases.find(e=>e.name===l),j=async()=>{try{let{id:e}=await ee.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=C(`chats`,e)}catch(e){a(e.message)}};return(0,Y.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsxs)(`h2`,{id:`spec-h`,className:`m-0 flex flex-1 items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(w,{icon:h,size:18,className:`text-accent-fg`}),`Make test data from a spec`]}),(0,Y.jsxs)(_,{variant:`ghost`,onClick:()=>void j(),"data-tip":`Write a spec in a chat`,children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Chat`]})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),t.specs.length===0?(0,Y.jsx)(T,{className:`py-3`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-1.5 text-sm font-medium`,children:[`Spec`,(0,Y.jsx)(E,{value:o,onChange:e=>c(e.target.value),children:t.specs.map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Database`,(0,Y.jsxs)(E,{value:l,onChange:e=>u(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The spec's own`}),t.databases.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,Y.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-1.5 text-sm font-medium`,children:[`Seed`,(0,Y.jsx)(b,{value:p,inputMode:`numeric`,placeholder:`Random`,onChange:e=>g(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(_,{variant:x?void 0:`primary`,disabled:r||!o,onClick:()=>i(`gen`,D),children:[(0,Y.jsx)(d,{"aria-hidden":`true`}),`Preview`]}),(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsxs)(_,{disabled:r||!o,onClick:()=>i(`gen`,{...D,mode:`files`,format:v}),"data-tip":`Write files (${v})`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Export`]}),(0,Y.jsx)(E,{"aria-label":`File format`,value:v,onChange:e=>y(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(_,{disabled:r||!o||!A?.writable,"data-tip":A?.writable?`Insert into ${A.name}`:`Pick a writable database to insert into`,onClick:()=>S(!0),children:[(0,Y.jsx)(s,{"aria-hidden":`true`}),`Insert`]})]}),x&&A&&(0,Y.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-3 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,o,` into `,A.name,`?`]}),(0,Y.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(_,{variant:`primary`,onClick:()=>{S(!1),i(`gen`,{...D,mode:`insert`,confirmed:!0})},children:[(0,Y.jsx)(s,{"aria-hidden":`true`}),`Insert`]}),(0,Y.jsxs)(_,{onClick:()=>S(!1),"data-tip":`Don't insert`,children:[(0,Y.jsx)(e,{"aria-hidden":`true`}),`Cancel`]})]})]}),k&&!k.ok&&(0,Y.jsx)(R,{text:k.error||`It did not make the data.`}),k?.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[k.batch&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:k.batch}),`.`]}),k.files?.length?(0,Y.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,k.files.map(e=>(0,Y.jsx)(U,{file:e,onNote:a},e))]}):null,(0,Y.jsx)(B,{r:k})]})]})]})}function le({view:e,job:n,busy:r,act:i}){let a=e.databases.filter(e=>e.writable),[o,s]=(0,J.useState)(a[0]?.name??``),[l,u]=(0,J.useState)(``),f=n&&!n.running?n:null,m=f?.kind===`batches`?(Array.isArray(f.result)?f.result.flatMap(e=>e.batches||[]):f.result?.batches)??[]:null;return(0,Y.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`h2`,{id:`batch-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(w,{icon:c,size:18,className:`text-accent-fg`}),`Inserted batches`]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`}),a.length===0?(0,Y.jsx)(T,{className:`py-3`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(E,{"aria-label":`Database`,value:o,onChange:e=>s(e.target.value),className:`w-[220px]`,children:a.map(e=>(0,Y.jsx)(`option`,{children:e.name},e.name))}),(0,Y.jsxs)(_,{disabled:r||!o,onClick:()=>i(`batches`,{db:o}),"data-tip":`List batches`,children:[(0,Y.jsx)(d,{"aria-hidden":`true`}),`Show`]})]}),m&&m.length===0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,f?.target,`.`]}),m&&m.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:m.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[(0,Y.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:L(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),l===e.batch?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,f?.target,`?`]}),(0,Y.jsxs)(_,{variant:`danger`,size:`sm`,onClick:()=>{u(``),i(`clean`,{db:f?.target,batch:e.batch,confirmed:!0})},children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Remove`]}),(0,Y.jsxs)(_,{size:`sm`,onClick:()=>u(``),children:[(0,Y.jsx)(t,{"aria-hidden":`true`}),`Keep`]})]}):(0,Y.jsx)(_,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>u(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,Y.jsx)(p,{"aria-hidden":`true`})})]},e.batch))}),f?.kind===`clean`&&f.result?.ok&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(f.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})}function $({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=z(),[s,c]=(0,J.useState)(null),[l,d]=(0,J.useState)(``),p=X.includes(e)?e:`requests`,m=o&&!o.running?o.endedAt:``;(0,J.useEffect)(()=>{S.log().then(c,e=>d(e.message))},[m]);let h=(s||[]).filter(e=>!e.ok).length,_=new Set((s||[]).map(e=>e.requester)).size,y={requests:`Requests${s?` (${s.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(F,{}),(0,Y.jsxs)(`main`,{className:g(ne,`@container flex-auto gap-4`),children:[(0,Y.jsxs)(`a`,{href:C(`data`,`databases`),className:`inline-flex w-fit items-center gap-1.5 text-sm`,children:[(0,Y.jsx)(u,{size:16,"aria-hidden":`true`}),`All databases`]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(k,{pixel:j[`test-data`],size:`lg`}),(0,Y.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test data`}),(0,Y.jsxs)(`a`,{href:C(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(O(),`no-underline`),children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Ask`]})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what the DB agent sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),s&&s.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[v(s.length,`request`),` · `,v(_,`asker`),` · `,(0,Y.jsxs)(`span`,{className:h?`text-fail`:``,children:[h,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||l)&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n||l}),!t&&!n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(re,{label:`Test data`,current:p,onPick:e=>location.hash=C(`test-data`,e),tabs:X.map(e=>({id:e,label:y[e]}))}),o&&(o.running?Z[o.kind]!==void 0:Z[o.kind]===p)&&(0,Y.jsx)(ie,{job:o,onStop:a}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`,children:[p===`requests`&&(0,Y.jsx)(Q,{view:t,log:s,busy:r,act:i}),p===`kept`&&(0,Y.jsx)(se,{view:t,job:o,busy:r,act:i,onNote:d}),p===`specs`&&(0,Y.jsx)(ce,{view:t,job:o,busy:r,act:i,onNote:d}),p===`batches`&&(0,Y.jsx)(le,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{q as n,Q as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$t as e,Ir as t,J as n,L as ee,M as r,Mn as te,Nr as i,gr as a,j as o,nr as ne,o as s,vr as re}from"./line-icons-CQ-3V8ax.js";import{B as c,R as l,Zt as u,a as d,f,l as p,o as m,ot as h,st as g,t as _,z as v}from"./filters-CflRmNDz.js";import{Ot as ie,nt as y,r as ae,t as oe,vt as b}from"./frame-CdUL-UeQ.js";import{r as x}from"./index-BmJOj6t1.js";import{_ as S,o as C}from"./qualityParts-DS83Q0nG.js";var w=t(i(),1),T={view:()=>h(`GET`,`/api/testdebt`),refresh:()=>h(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>h(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},E=u(),D=[`untested`,`signal`,`duplicates`,`cases`],O={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},k={test:`Test`,recording:`Recording`,case:`Test case`},se={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},A={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},j=e=>`${Math.round(e*100)}%`,M=e=>D.includes(e)?e:`untested`;function N({part:e,what:t,action:n}){return(0,E.jsxs)(p,{icon:a,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,E.jsx)(s,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function P({text:e,tip:t}){return(0,E.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function F({sub:t}){let[i,a]=(0,w.useState)(null),[u,h]=(0,w.useState)(``),[D,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(``),R=M(t),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(`manual`),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(``);(0,w.useEffect)(()=>{T.view().then(e=>{a(e),h(``)},e=>h(e.message))},[]);let q=(0,w.useCallback)(async(e,t)=>{F(!0),L(``);try{a(await e()),h(``),t&&L(t)}catch(e){h(e.message)}finally{F(!1)}},[]),ce=async e=>{if(e){F(!0);try{let{id:t}=await g.start(e,{});location.hash=f(`chats`,t)}catch(e){h(e.message),F(!1)}}},J=(e,t)=>(0,E.jsx)(l,{size:`icon`,variant:`icon`,className:`size-8`,disabled:D||!e,onClick:()=>void ce(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,E.jsx)(ne,{"aria-hidden":`true`})}),Y=i?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=U||Y[0]?.id||``,Z=i?.cases.filter(e=>!e.automated).length??0,le=i?.areas.filter(e=>z===`all`||e.kind===z)??[],ue=i?.cases.filter(e=>V===`all`||(V===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-3 text-right tabular-nums`,$={untested:(i?.areas.length??0)+(i?.rules.length??0),signal:(i?.quiet.length??0)+(i?.gone.length??0),duplicates:i?.duplicates.length??0,cases:Z};return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(ae,{}),(0,E.jsxs)(`main`,{className:c(oe,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(ie,{pixel:b[`test-debt`],size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),i&&(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,E.jsxs)(`span`,{"data-tip":S(i.at),children:[`Worked out `,x(i.at)]}),(0,E.jsxs)(l,{size:`sm`,disabled:D,onClick:()=>void q(T.refresh,`Worked out again.`),children:[(0,E.jsx)(te,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,E.jsx)(`a`,{href:f(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,i?.repo&&i.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:i.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),u&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:u}),!i&&!u&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),I&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:I}),i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,E.jsx)(C,{label:`Untested code`,value:i.graph.state===`ok`?i.areas.length:`–`,tone:i.areas.length?`text-warn`:void 0,sub:i.graph.state===`ok`?`of ${i.graph.checked} areas`:`graph not built`}),(0,E.jsx)(C,{label:`Untested rules`,value:i.rules.length,tone:i.rules.length?`text-warn`:void 0,sub:`of ${i.graph.rulesChecked} rules`}),(0,E.jsx)(C,{label:`Never fail`,value:i.quiet.length,sub:`30 passes in a row`}),(0,E.jsx)(C,{label:`Code gone`,value:i.gone.length,tone:i.gone.length?`text-fail`:void 0,sub:`of ${i.files.count} files listed`}),(0,E.jsx)(C,{label:`Near-duplicates`,value:i.duplicates.length,sub:`from ${j(i.threshold)} alike`}),(0,E.jsx)(C,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${i.cases.length} test cases`})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:R,onChange:e=>location.hash=f(`test-debt`,e)})}),i.notes.map(e=>(0,E.jsx)(`p`,{className:`m-0 text-[12.5px] text-ink-2`,children:e},e)),R===`untested`&&(0,E.jsxs)(E.Fragment,{children:[i.graph.state===`ok`?(0,E.jsx)(y,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:z,empty:i.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`all`,label:`All`,n:i.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${O[e]}s`,n:i.areas.filter(t=>t.kind===e).length}))],value:z,onChange:B})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[34%] py-1.5 pr-3 pl-3 font-medium`,children:`Code`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Kind`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Used by`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:le.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:O[e.kind]}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:c(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,O[e.kind].toLowerCase())})]},e.id))}):(0,E.jsx)(N,{part:i.graph,what:`product graph`,action:{label:`Product`,to:f(`product`)}}),(0,E.jsx)(y,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:i.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Rule`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`From`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Closest test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.rules.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.nearest?(0,E.jsx)(P,{text:`${e.nearest.name} (${j(e.nearest.score)})`,tip:`${j(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`rule`)})]},e.id))})]}),R===`signal`&&(i.history.state===`ok`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[50%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Passes`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Since`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.quiet.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(o,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,E.jsx)(P,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,E.jsx)(`td`,{className:c(Q,`text-muted`),children:e.runs}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.since?S(e.since):void 0,children:e.since?x(e.since):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))}),(0,E.jsx)(y,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${i.files.count} files, listed by ${i.files.by===`git`?`git`:`walking the folder`}).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[40%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`File`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Last run`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.gone.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(ee,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,E.jsx)(P,{text:e.name})]})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2`,children:(0,E.jsx)(P,{text:e.file})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.last?S(e.last):void 0,children:e.last?x(e.last):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))})]}):(0,E.jsx)(N,{part:i.history,what:`test history`,action:{label:`Regression`,to:f(`regression`)}})),R===`duplicates`&&(0,E.jsx)(y,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${j(i.threshold)} of their words (${i.compared} pairs compared).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 text-right font-medium`,children:`Alike`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`First`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`Second`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Shared words`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.duplicates.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:c(Q,`pl-3`,e.score>=.85?`text-warn`:`text-muted`),children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,E.jsx)(n,{size:14,"aria-hidden":`true`}),j(e.score)]})}),[e.a,e.b].map((e,t)=>(0,E.jsxs)(`td`,{className:`max-w-0 py-2 pr-3`,children:[(0,E.jsx)(P,{text:e.name,tip:`${k[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,E.jsx)(`span`,{className:`block text-[12px] text-muted`,children:k[e.kind]})]},t)),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:(0,E.jsx)(P,{text:e.shared.join(`, `)})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),R===`cases`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,E.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:i.sources.map(e=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,E.jsx)(o,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,E.jsx)(r,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${x(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,E.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>T.readCases(X,G.trim()),`Test cases read.`)},children:[(0,E.jsx)(m,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>W(e.target.value),children:Y.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,E.jsx)(d,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?A[X]:``,value:G,maxLength:80,onChange:e=>K(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,E.jsxs)(l,{size:`sm`,type:`submit`,disabled:D||!G.trim(),"data-tip":`Read the test cases`,children:[(0,E.jsx)(re,{"aria-hidden":`true`}),`Import`]})]}),i.cases.length?(0,E.jsx)(y,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:V,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:i.cases.length-Z},{id:`all`,label:`All`,n:i.cases.length}],value:V,onChange:H})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Case`}),(0,E.jsx)(`th`,{className:`w-[36%] py-1.5 pr-3 font-medium`,children:`Title`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Source`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Automated`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pr-3 pl-3 font-mono text-[12.5px] whitespace-nowrap`,children:/^https?:\/\//i.test(e.url)?(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3`,children:(0,E.jsx)(P,{text:e.title||`–`})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap @xl:table-cell`,"data-tip":`From ${e.scope}`,children:se[e.source]}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,E.jsx)(o,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,E.jsx)(r,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.test?(0,E.jsx)(P,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,E.jsx)(p,{icon:e,title:`No test cases yet`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:f(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,E.jsx)(s,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{F as TestDebt};
|
|
1
|
+
import{$t as e,Ir as t,J as n,L as ee,M as r,Mn as te,Nr as i,gr as a,j as o,nr as ne,o as s,vr as re}from"./line-icons-CQ-3V8ax.js";import{B as c,R as l,Zt as u,a as d,f,l as p,o as m,ot as h,st as g,t as _,z as v}from"./filters-CflRmNDz.js";import{At as ie,bt as ae,nt as y,r as oe,t as b}from"./frame-CYYiRu5P.js";import{r as x}from"./index-D4a0w3Vl.js";import{_ as S,o as C}from"./qualityParts-C9FItsTg.js";var w=t(i(),1),T={view:()=>h(`GET`,`/api/testdebt`),refresh:()=>h(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>h(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},E=u(),D=[`untested`,`signal`,`duplicates`,`cases`],O={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},k={test:`Test`,recording:`Recording`,case:`Test case`},se={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},A={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},j=e=>`${Math.round(e*100)}%`,M=e=>D.includes(e)?e:`untested`;function N({part:e,what:t,action:n}){return(0,E.jsxs)(p,{icon:a,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,E.jsx)(s,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function P({text:e,tip:t}){return(0,E.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function F({sub:t}){let[i,a]=(0,w.useState)(null),[u,h]=(0,w.useState)(``),[D,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(``),R=M(t),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(`manual`),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(``);(0,w.useEffect)(()=>{T.view().then(e=>{a(e),h(``)},e=>h(e.message))},[]);let q=(0,w.useCallback)(async(e,t)=>{F(!0),L(``);try{a(await e()),h(``),t&&L(t)}catch(e){h(e.message)}finally{F(!1)}},[]),ce=async e=>{if(e){F(!0);try{let{id:t}=await g.start(e,{});location.hash=f(`chats`,t)}catch(e){h(e.message),F(!1)}}},J=(e,t)=>(0,E.jsx)(l,{size:`icon`,variant:`icon`,className:`size-8`,disabled:D||!e,onClick:()=>void ce(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,E.jsx)(ne,{"aria-hidden":`true`})}),Y=i?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=U||Y[0]?.id||``,Z=i?.cases.filter(e=>!e.automated).length??0,le=i?.areas.filter(e=>z===`all`||e.kind===z)??[],ue=i?.cases.filter(e=>V===`all`||(V===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-3 text-right tabular-nums`,$={untested:(i?.areas.length??0)+(i?.rules.length??0),signal:(i?.quiet.length??0)+(i?.gone.length??0),duplicates:i?.duplicates.length??0,cases:Z};return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(oe,{}),(0,E.jsxs)(`main`,{className:c(b,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(ie,{pixel:ae[`test-debt`],size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),i&&(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,E.jsxs)(`span`,{"data-tip":S(i.at),children:[`Worked out `,x(i.at)]}),(0,E.jsxs)(l,{size:`sm`,disabled:D,onClick:()=>void q(T.refresh,`Worked out again.`),children:[(0,E.jsx)(te,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,E.jsx)(`a`,{href:f(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,i?.repo&&i.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:i.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),u&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:u}),!i&&!u&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),I&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:I}),i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,E.jsx)(C,{label:`Untested code`,value:i.graph.state===`ok`?i.areas.length:`–`,tone:i.areas.length?`text-warn`:void 0,sub:i.graph.state===`ok`?`of ${i.graph.checked} areas`:`graph not built`}),(0,E.jsx)(C,{label:`Untested rules`,value:i.rules.length,tone:i.rules.length?`text-warn`:void 0,sub:`of ${i.graph.rulesChecked} rules`}),(0,E.jsx)(C,{label:`Never fail`,value:i.quiet.length,sub:`30 passes in a row`}),(0,E.jsx)(C,{label:`Code gone`,value:i.gone.length,tone:i.gone.length?`text-fail`:void 0,sub:`of ${i.files.count} files listed`}),(0,E.jsx)(C,{label:`Near-duplicates`,value:i.duplicates.length,sub:`from ${j(i.threshold)} alike`}),(0,E.jsx)(C,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${i.cases.length} test cases`})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:R,onChange:e=>location.hash=f(`test-debt`,e)})}),i.notes.map(e=>(0,E.jsx)(`p`,{className:`m-0 text-[12.5px] text-ink-2`,children:e},e)),R===`untested`&&(0,E.jsxs)(E.Fragment,{children:[i.graph.state===`ok`?(0,E.jsx)(y,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:z,empty:i.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`all`,label:`All`,n:i.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${O[e]}s`,n:i.areas.filter(t=>t.kind===e).length}))],value:z,onChange:B})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[34%] py-1.5 pr-3 pl-3 font-medium`,children:`Code`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Kind`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Used by`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:le.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:O[e.kind]}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:c(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,O[e.kind].toLowerCase())})]},e.id))}):(0,E.jsx)(N,{part:i.graph,what:`product graph`,action:{label:`Product`,to:f(`product`)}}),(0,E.jsx)(y,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:i.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Rule`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`From`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Closest test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.rules.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.nearest?(0,E.jsx)(P,{text:`${e.nearest.name} (${j(e.nearest.score)})`,tip:`${j(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`rule`)})]},e.id))})]}),R===`signal`&&(i.history.state===`ok`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[50%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Passes`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Since`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.quiet.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(o,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,E.jsx)(P,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,E.jsx)(`td`,{className:c(Q,`text-muted`),children:e.runs}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.since?S(e.since):void 0,children:e.since?x(e.since):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))}),(0,E.jsx)(y,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${i.files.count} files, listed by ${i.files.by===`git`?`git`:`walking the folder`}).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[40%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`File`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Last run`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.gone.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(ee,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,E.jsx)(P,{text:e.name})]})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2`,children:(0,E.jsx)(P,{text:e.file})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.last?S(e.last):void 0,children:e.last?x(e.last):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))})]}):(0,E.jsx)(N,{part:i.history,what:`test history`,action:{label:`Regression`,to:f(`regression`)}})),R===`duplicates`&&(0,E.jsx)(y,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${j(i.threshold)} of their words (${i.compared} pairs compared).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 text-right font-medium`,children:`Alike`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`First`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`Second`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Shared words`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.duplicates.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:c(Q,`pl-3`,e.score>=.85?`text-warn`:`text-muted`),children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,E.jsx)(n,{size:14,"aria-hidden":`true`}),j(e.score)]})}),[e.a,e.b].map((e,t)=>(0,E.jsxs)(`td`,{className:`max-w-0 py-2 pr-3`,children:[(0,E.jsx)(P,{text:e.name,tip:`${k[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,E.jsx)(`span`,{className:`block text-[12px] text-muted`,children:k[e.kind]})]},t)),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:(0,E.jsx)(P,{text:e.shared.join(`, `)})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),R===`cases`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,E.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:i.sources.map(e=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,E.jsx)(o,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,E.jsx)(r,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${x(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,E.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>T.readCases(X,G.trim()),`Test cases read.`)},children:[(0,E.jsx)(m,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>W(e.target.value),children:Y.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,E.jsx)(d,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?A[X]:``,value:G,maxLength:80,onChange:e=>K(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,E.jsxs)(l,{size:`sm`,type:`submit`,disabled:D||!G.trim(),"data-tip":`Read the test cases`,children:[(0,E.jsx)(re,{"aria-hidden":`true`}),`Import`]})]}),i.cases.length?(0,E.jsx)(y,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:V,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:i.cases.length-Z},{id:`all`,label:`All`,n:i.cases.length}],value:V,onChange:H})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Case`}),(0,E.jsx)(`th`,{className:`w-[36%] py-1.5 pr-3 font-medium`,children:`Title`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Source`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Automated`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pr-3 pl-3 font-mono text-[12.5px] whitespace-nowrap`,children:/^https?:\/\//i.test(e.url)?(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3`,children:(0,E.jsx)(P,{text:e.title||`–`})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap @xl:table-cell`,"data-tip":`From ${e.scope}`,children:se[e.source]}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,E.jsx)(o,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,E.jsx)(r,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.test?(0,E.jsx)(P,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,E.jsx)(p,{icon:e,title:`No test cases yet`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:f(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,E.jsx)(s,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{F as TestDebt};
|