trxa-tool 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/MANUAL.md +376 -368
  2. package/README.md +75 -51
  3. package/SETUP.md +401 -0
  4. package/STUDIO.md +417 -309
  5. package/dist/fixture-schema.d.ts +45 -5
  6. package/dist/fixture-schema.js +97 -13
  7. package/dist/fixture-store.d.ts +37 -0
  8. package/dist/fixture-store.js +75 -0
  9. package/dist/index.js +76 -40
  10. package/dist/mapping.js +4 -1
  11. package/dist/mcp-bridge.d.ts +52 -0
  12. package/dist/mcp-bridge.js +290 -0
  13. package/dist/planrun-schema.d.ts +14 -6
  14. package/dist/planrun-schema.js +31 -7
  15. package/dist/planrun.d.ts +1 -1
  16. package/dist/planrun.js +2 -2
  17. package/dist/report-schema.d.ts +10 -1
  18. package/dist/report-schema.js +31 -5
  19. package/dist/report.d.ts +4 -1
  20. package/dist/report.js +9 -2
  21. package/dist/suite-runner.js +8 -2
  22. package/media/studio/fixtures-test-cases.png +0 -0
  23. package/media/studio/plans-editor.png +0 -0
  24. package/media/studio/recordings-create-test-case.png +0 -0
  25. package/media/studio/run-dialog.png +0 -0
  26. package/media/studio/settings-agent-runs.png +0 -0
  27. package/media/studio/settings-working-folder.png +0 -0
  28. package/media/studio/studio-recordings.png +0 -0
  29. package/media/studio/suites-canvas.png +0 -0
  30. package/media/studio/suites-inspector.png +0 -0
  31. package/media/studio/testcases-expectations.png +0 -0
  32. package/media/studio/testcases-outputs.png +0 -0
  33. package/media/studio/testrun-details.png +0 -0
  34. package/media/studio/testruns-list.png +0 -0
  35. package/package.json +6 -2
  36. package/studio/client-dist/assets/CreatePanel-C5bb5OIs.js +6 -0
  37. package/studio/client-dist/assets/FactTile-G1pURLys.js +1 -0
  38. package/studio/client-dist/assets/FieldLabel-DPmIEQ08.js +1 -0
  39. package/studio/client-dist/assets/FixtureNamePicker-137AAgwZ.js +1 -0
  40. package/studio/client-dist/assets/Fixtures-D0t-soph.js +1 -0
  41. package/studio/client-dist/assets/GeneralSection-CWkTeSX2.js +1 -0
  42. package/studio/client-dist/assets/ListPaneHeader-DXKqX36N.js +1 -0
  43. package/studio/client-dist/assets/Plans-C70evkGc.js +1 -0
  44. package/studio/client-dist/assets/Recordings-BT0dyVLs.js +1 -0
  45. package/studio/client-dist/assets/Settings-k-J3u5lH.js +1 -0
  46. package/studio/client-dist/assets/Suites-DLioOiRN.css +1 -0
  47. package/studio/client-dist/assets/Suites-DQhhMxjT.js +7 -0
  48. package/studio/client-dist/assets/TestCases-BdiopVGI.js +1 -0
  49. package/studio/client-dist/assets/TestRuns-CylAe-3t.js +9 -0
  50. package/studio/client-dist/assets/api-DJZ703_F.js +24 -0
  51. package/studio/client-dist/assets/bucket-18-viuwGcaj.js +1 -0
  52. package/studio/client-dist/assets/fixtureName-CTZT_jKu.js +1 -0
  53. package/studio/client-dist/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  54. package/studio/client-dist/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  55. package/studio/client-dist/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  56. package/studio/client-dist/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  57. package/studio/client-dist/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  58. package/studio/client-dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  59. package/studio/client-dist/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  60. package/studio/client-dist/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  61. package/studio/client-dist/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  62. package/studio/client-dist/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  63. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-300-normal-LoaTnByX.woff +0 -0
  64. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-300-normal-RhT0Ayi3.woff2 +0 -0
  65. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-400-italic-Bf1n82Tb.woff +0 -0
  66. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-400-italic-D9J6q4_O.woff2 +0 -0
  67. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-400-normal-BTotfTJu.woff +0 -0
  68. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-400-normal-DZqxrq2p.woff2 +0 -0
  69. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-600-normal-71GNu3SW.woff2 +0 -0
  70. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-600-normal-BGq0mW3O.woff +0 -0
  71. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-300-normal-Bbd5v1xK.woff +0 -0
  72. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-300-normal-DqmgDkIN.woff2 +0 -0
  73. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-400-italic-BELOEI8R.woff2 +0 -0
  74. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-400-italic-CfSXsIbO.woff +0 -0
  75. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-400-normal-Dsrv2Tcn.woff +0 -0
  76. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-400-normal-g30qAdWV.woff2 +0 -0
  77. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-600-normal-Bz0x94Yp.woff +0 -0
  78. package/studio/client-dist/assets/ibm-plex-sans-cyrillic-ext-600-normal-DUMzJB7m.woff2 +0 -0
  79. package/studio/client-dist/assets/ibm-plex-sans-greek-300-normal-J-CBqZoJ.woff2 +0 -0
  80. package/studio/client-dist/assets/ibm-plex-sans-greek-300-normal-STc8XiDr.woff +0 -0
  81. package/studio/client-dist/assets/ibm-plex-sans-greek-400-italic-BEZwmy7D.woff2 +0 -0
  82. package/studio/client-dist/assets/ibm-plex-sans-greek-400-italic-CTYLy0lX.woff +0 -0
  83. package/studio/client-dist/assets/ibm-plex-sans-greek-400-normal-D9ESIMu3.woff +0 -0
  84. package/studio/client-dist/assets/ibm-plex-sans-greek-400-normal-_efipK4i.woff2 +0 -0
  85. package/studio/client-dist/assets/ibm-plex-sans-greek-600-normal-D-CqTdkO.woff +0 -0
  86. package/studio/client-dist/assets/ibm-plex-sans-greek-600-normal-DzTrcv_p.woff2 +0 -0
  87. package/studio/client-dist/assets/ibm-plex-sans-latin-300-normal-C9Of02-5.woff +0 -0
  88. package/studio/client-dist/assets/ibm-plex-sans-latin-300-normal-b4i7YzLG.woff2 +0 -0
  89. package/studio/client-dist/assets/ibm-plex-sans-latin-400-italic-CZTNEAuW.woff2 +0 -0
  90. package/studio/client-dist/assets/ibm-plex-sans-latin-400-italic-CsGl1sm0.woff +0 -0
  91. package/studio/client-dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
  92. package/studio/client-dist/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
  93. package/studio/client-dist/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
  94. package/studio/client-dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
  95. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-300-normal-B8Zgwjh3.woff +0 -0
  96. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-300-normal-BLFuR0P1.woff2 +0 -0
  97. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-400-italic-Du9zzoL2.woff2 +0 -0
  98. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-400-italic-V_9i1P_m.woff +0 -0
  99. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-400-normal-C5H60-Va.woff2 +0 -0
  100. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-400-normal-RBey6euL.woff +0 -0
  101. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-600-normal-DIrixKbi.woff +0 -0
  102. package/studio/client-dist/assets/ibm-plex-sans-latin-ext-600-normal-DOrvGEcy.woff2 +0 -0
  103. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-300-normal-CkYRZD2a.woff +0 -0
  104. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-300-normal-SDfX6ktj.woff2 +0 -0
  105. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-400-italic-78jqtfZH.woff +0 -0
  106. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-400-italic-BbRnwouv.woff2 +0 -0
  107. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-400-normal-DG4YqDda.woff2 +0 -0
  108. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-400-normal-fK1oJ5dG.woff +0 -0
  109. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-600-normal-DgdngZtN.woff +0 -0
  110. package/studio/client-dist/assets/ibm-plex-sans-vietnamese-600-normal-DpPYBSTl.woff2 +0 -0
  111. package/studio/client-dist/assets/index-cxBc2iRv.js +10 -0
  112. package/studio/client-dist/assets/index-wjWuVHXN.css +1 -0
  113. package/studio/client-dist/assets/status-DUGxC7G7.js +1 -0
  114. package/studio/client-dist/assets/testCaseTree-Cl1-bc5O.js +1 -0
  115. package/studio/client-dist/axtr-icon.svg +2 -5
  116. package/studio/client-dist/favicon.svg +2 -5
  117. package/studio/client-dist/index.html +5 -4
  118. package/studio/server/dist/index.js +1530 -292
  119. package/studio/client-dist/assets/index-CgWhGkEn.js +0 -24
  120. package/studio/client-dist/assets/index-CwAUMVCL.css +0 -1
@@ -0,0 +1,9 @@
1
+ import{$ as e,$t as t,B as n,C as r,Cn as i,Ct as a,D as o,Dt as s,F as c,G as l,H as u,Ht as d,I as f,J as p,Jt as m,K as h,Kt as g,L as _,N as v,Nt as y,R as b,S as x,St as S,Tn as C,Tt as w,V as T,Vt as E,W as D,X as O,Xt as k,Y as A,Zt as j,at as ee,b as M,bt as te,en as ne,et as N,ft as P,h as re,i as ie,in as ae,it as oe,j as se,jt as ce,lt as le,mn as F,nn as ue,nt as de,q as fe,qt as pe,r as me,rt as he,t as I,tn as ge,tt as L,v as _e,vn as ve,vt as R,w as ye,x as be,xt as xe,yt as Se,z as Ce,zt as we}from"./api-DJZ703_F.js";import{t as Te}from"./bucket-18-viuwGcaj.js";import{_ as Ee,a as De,b as Oe,c as z,d as ke,f as Ae,g as je,h as B,l as Me,m as Ne,o as Pe,p as Fe,s as V,v as H,w as Ie,x as Le,y as Re}from"./index-cxBc2iRv.js";import{n as ze,r as U,t as W}from"./FactTile-G1pURLys.js";import{n as Be,t as Ve}from"./status-DUGxC7G7.js";var G=C(i()),K=ve(),He=G.forwardRef(function({children:e,size:t=16,...n},r){return t===16||t===`16`||t===`16px`?G.createElement(F,{width:t,height:t,ref:r,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,...n},(0,K.jsx)(`path`,{d:`M8,1C4.1,1,1,4.1,1,8s3.1,7,7,7s7-3.1,7-7S11.9,1,8,1z M10.7,11.5L8,8.8l-2.7,2.7l-0.8-0.8L7.2,8L4.5,5.3l0.8-0.8L8,7.2 l2.7-2.7l0.8,0.8L8.8,8l2.7,2.7L10.7,11.5z`}),(0,K.jsx)(`path`,{d:`M10.7,11.5L8,8.8l-2.7,2.7l-0.8-0.8L7.2,8L4.5,5.3l0.8-0.8L8,7.2l2.7-2.7l0.8,0.8L8.8,8 l2.7,2.7L10.7,11.5z`,"data-icon-path":`inner-path`,opacity:`0`}),e):t===20||t===`20`||t===`20px`?G.createElement(F,{width:t,height:t,ref:r,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,...n},(0,K.jsx)(`path`,{d:`M10,1c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4,9-9S15,1,10,1z M13.5,14.5L10,11l-3.5,3.5l-1-1L9,10L5.5,6.5l1-1L10,9l3.5-3.5l1,1 L11,10l3.5,3.5L13.5,14.5z`}),(0,K.jsx)(`path`,{fill:`none`,d:`M13.5,14.5L10,11l-3.5,3.5l-1-1L9,10L5.5,6.5l1-1L10,9l3.5-3.5l1,1L11,10l3.5,3.5L13.5,14.5z`,"data-icon-path":`inner-path`,opacity:`0`}),e):t===24||t===`24`||t===`24px`?G.createElement(F,{width:t,height:t,ref:r,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...n},(0,K.jsx)(`path`,{d:`M12,1C6,1,1,6,1,12s5,11,11,11s11-4.9,11-11S18.1,1,12,1z M16.2,17.5L12,13.3l-4.2,4.2l-1.3-1.3l4.2-4.2L6.5,7.8l1.3-1.3 l4.2,4.2l4.2-4.2l1.3,1.3L13.3,12l4.2,4.2L16.2,17.5z`}),(0,K.jsx)(`path`,{fill:`none`,d:`M16.2,17.5L12,13.3l-4.2,4.2l-1.3-1.3l4.2-4.2L6.5,7.8l1.3-1.3l4.2,4.2l4.2-4.2l1.3,1.3 L13.3,12l4.2,4.2L16.2,17.5z`,"data-icon-path":`inner-path`,opacity:`0`}),e):G.createElement(F,{width:t,height:t,ref:r,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,fill:`currentColor`,...n},(0,K.jsx)(`path`,{d:`M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14S23.7,2,16,2z M21.4,23L16,17.6L10.6,23L9,21.4l5.4-5.4L9,10.6L10.6,9 l5.4,5.4L21.4,9l1.6,1.6L17.6,16l5.4,5.4L21.4,23z`}),(0,K.jsx)(`path`,{fill:`none`,d:`M21.4,23L16,17.6L10.6,23L9,21.4l5.4-5.4L9,10.6L10.6,9l5.4,5.4L21.4,9l1.6,1.6L17.6,16 l5.4,5.4L21.4,23z`,"data-icon-path":`inner-path`,opacity:`0`}),e)}),q={success:j,error:d,caution:He,info:Ie,neutral:ae},Ue=`__TimerForAsyncTaskPolling`,We=`BACKGROUND_PROCESS_IN_PROGRESS`,Ge=2,Ke=300,qe=[`command`,`path`,`pattern`,`controlName`,`name`,`gridColumnValue`,`sqlExpression`,`skill`,`menuItemFilter`];function Je(e,t){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ye(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Xe(e){if(!e)return``;try{let t=JSON.parse(e);for(let e of qe){let n=t[e];if(typeof n==`string`&&n)return n.replace(/\s+/g,` `).slice(0,120)}}catch{}return``}function Ze(e){return(e??`tool`).replace(/^d365-erp-mcp-/,``)}function J(e){return[e.label,e.args,e.result,e.text].filter(Boolean).join(`
2
+ `).toLowerCase()}function Qe(e){let t=new Map;for(let n of e)n.type===`tool-result`&&n.id&&t.set(n.id,n);let n=[],r=new Set;return e.forEach((e,i)=>{if(e.type===`tool-result`)return;if(e.type===`denied`){let t=n[n.length-1];if(t&&(t.kind===`tool`||t.kind===`poll`)&&!r.has(t.key)){r.add(t.key),t.tone=`caution`,t.Icon=q.caution,t.typeLabel=`Denied`,t.text=e.text,t.haystack=J(t);return}}if(e.type===`tool`){let r=e.id?t.get(e.id):void 0,a=!!r?.result?.includes(We),o=r?r.ok===!1&&!a?`error`:a?`neutral`:`success`:`info`,s=r?Math.max(0,r.t-e.t):void 0,c=n[n.length-1];if(e.args?.includes(Ue)){let t=r?a?`neutral`:`success`:`info`;if(c?.kind===`poll`){c.polls=(c.polls??1)+1,c.label=`Waiting for background processing · ${c.polls} polls`,c.elapsedMs=r?r.t-c.t:void 0,c.result=r?.result,c.tone=r?a?`neutral`:`success`:`info`,c.Icon=q[c.tone],c.haystack=J(c);return}let o={key:`e${i}`,t:e.t,kind:`poll`,tone:t,Icon:q[t],typeLabel:`Tool`,label:`Waiting for background processing · 1 poll`,elapsedMs:s,args:e.args,result:r?.result,polls:1,haystack:``};o.haystack=J(o),n.push(o);return}let l=Xe(e.args),u={key:`e${i}`,t:e.t,kind:`tool`,tone:o,Icon:q[o],typeLabel:`Tool`,label:`${Ze(e.tool)}${l?` · ${l}`:``}`,elapsedMs:s,args:e.args,result:r?.result,haystack:``};u.haystack=J(u),n.push(u);return}let a=e.type===`message`,o=e.type===`error`?`error`:e.type===`denied`||e.type===`question`?`caution`:e.type===`finished`?`success`:`neutral`,s=e.text??e.type,c={key:`e${i}`,t:e.t,kind:a?`message`:`note`,tone:o,Icon:a?k:e.type===`answer`?we:e.type===`question`?w:q[o],typeLabel:a?`Message`:e.type===`denied`?`Denied`:e.type.charAt(0).toUpperCase()+e.type.slice(1),label:s.split(`
3
+ `)[0],text:s,haystack:``};c.haystack=J(c),n.push(c)}),n}function $e(e,t){return t===`messages`?e.kind===`message`:t===`tools`?e.kind===`tool`||e.kind===`poll`:t===`problems`?e.tone===`error`||e.tone===`caution`:!0}function et({text:e,query:t}){if(!t)return e;let n=e.toLowerCase(),r=[],i=0;for(let a=n.indexOf(t);a!==-1;a=n.indexOf(t,i))a>i&&r.push(e.slice(i,a)),r.push((0,K.jsx)(`mark`,{children:e.slice(a,a+t.length)},a)),i=a+t.length;return r.push(e.slice(i)),(0,K.jsx)(K.Fragment,{children:r})}var tt=[{id:`all`,label:`All`},{id:`messages`,label:`Messages`},{id:`tools`,label:`Tools`},{id:`problems`,label:`Problems`}];function nt({events:n,live:r=!1}){let[i,a]=(0,G.useState)(`all`),[o,s]=(0,G.useState)(null),c=o??(r?`desc`:`asc`),[u,d]=(0,G.useState)(``),[f,p]=(0,G.useState)(null),[m,g]=(0,G.useState)(0),_=(0,G.useMemo)(()=>Qe(n),[n]),v=(0,G.useMemo)(()=>{let e=_.filter(e=>$e(e,i));return c===`desc`?e.reverse():e},[_,i,c]),y=Je(u.trim().toLowerCase(),Ke),b=y.length>=Ge?y:``,x=(0,G.useMemo)(()=>b?v.filter(e=>e.haystack.includes(b)):[],[v,b]),S=(0,G.useMemo)(()=>new Set(x.map(e=>e.key)),[x]),C=v.find(e=>e.key===f)??null;(0,G.useEffect)(()=>g(0),[b,i]);function w(e){p(e),document.getElementById(`activity-row-${e}`)?.scrollIntoView({block:`nearest`})}function T(e){if(x.length===0)return;let t=(m+e+x.length)%x.length;g(t),w(x[t].key)}function E(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),w(t))}if(_.length===0)return(0,K.jsx)(`p`,{className:`run-case-empty`,children:`No activity recorded.`});let O=u.trim().toLowerCase()!==y,k=b?x.length===0?`No matches`:`${m+1} of ${x.length}`:``;return(0,K.jsxs)(`div`,{className:`activity-log`,children:[(0,K.jsxs)(`div`,{className:`activity-toolbar`,children:[(0,K.jsx)(de,{size:`md`,selectedIndex:tt.findIndex(e=>e.id===i),onChange:({index:e})=>a(tt[e??0].id),children:tt.map(e=>(0,K.jsx)(he,{name:e.id,text:e.label},e.id))}),(0,K.jsxs)(`div`,{className:`activity-search`,children:[(0,K.jsx)(oe,{size:`md`,labelText:`Find in activity`,placeholder:`Find in activity`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&T(e.shiftKey?-1:1)}}),(0,K.jsx)(`span`,{className:`activity-search-status`,role:`status`,"aria-live":`polite`,children:O?``:k}),(0,K.jsx)(Se,{kind:`ghost`,size:`md`,label:`Previous match`,onClick:()=>T(-1),disabled:x.length===0,children:(0,K.jsx)(ue,{})}),(0,K.jsx)(Se,{kind:`ghost`,size:`md`,label:`Next match`,onClick:()=>T(1),disabled:x.length===0,children:(0,K.jsx)(t,{})})]})]}),(0,K.jsxs)(`div`,{className:`activity-split`,children:[(0,K.jsx)(`div`,{className:`activity-list`,children:v.length===0?(0,K.jsx)(U,{title:`Nothing here`,children:`No rows match this filter.`}):(0,K.jsxs)(L,{size:`sm`,"aria-label":`Agent activity`,children:[(0,K.jsx)(h,{children:(0,K.jsxs)(D,{children:[(0,K.jsx)(l,{isSortable:!0,isSortHeader:!0,sortDirection:c===`desc`?`DESC`:`ASC`,onClick:()=>s(c===`desc`?`asc`:`desc`),children:`Time`}),(0,K.jsx)(l,{children:`Type`}),(0,K.jsx)(l,{children:`Action`}),(0,K.jsx)(l,{children:`Took`}),(0,K.jsx)(l,{"aria-label":`Has detail`})]})}),(0,K.jsx)(N,{children:v.map(t=>{let n=!!(t.args||t.result||t.text),r=b&&t.label.toLowerCase().includes(b),i=S.has(t.key)&&!r;return(0,K.jsxs)(D,{id:`activity-row-${t.key}`,className:`activity-row${S.has(t.key)?` is-match`:``}`,isSelected:t.key===f,"aria-current":t.key===f?`true`:void 0,tabIndex:0,onClick:()=>w(t.key),onKeyDown:e=>E(e,t.key),children:[(0,K.jsxs)(e,{children:[`+`,V(t.t)]}),(0,K.jsx)(e,{children:(0,K.jsx)(se,{type:`outline`,size:`sm`,children:t.typeLabel})}),(0,K.jsx)(e,{children:(0,K.jsxs)(`span`,{className:`infolog-line status-${t.tone}`,children:[(0,K.jsx)(t.Icon,{size:16,"aria-label":t.tone}),(0,K.jsx)(`span`,{className:`activity-label`,children:(0,K.jsx)(et,{text:t.label,query:b})}),i&&(0,K.jsx)(se,{type:`gray`,size:`sm`,children:`In detail`})]})}),(0,K.jsx)(e,{children:t.elapsedMs===void 0?``:V(t.elapsedMs)}),(0,K.jsx)(e,{children:n&&(0,K.jsx)(ge,{size:16,"aria-hidden":`true`})})]},t.key)})})]})}),(0,K.jsx)(`aside`,{className:`activity-detail`,"aria-label":`Selected action`,children:C?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h4`,{className:`plan-section-heading`,children:C.kind===`message`?`Message`:C.label}),(0,K.jsxs)(`p`,{className:`run-case-empty`,children:[`+`,V(C.t),` · `,C.typeLabel,C.elapsedMs===void 0?``:` · took ${V(C.elapsedMs)}`]}),C.text&&(C.kind===`message`||C.kind===`note`)&&(0,K.jsx)(`p`,{className:`agent-message`,children:C.text}),C.text&&C.typeLabel===`Denied`&&C.kind!==`note`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`run-case-empty`,children:`Why it was denied`}),(0,K.jsx)(`p`,{className:`agent-message`,children:C.text})]}),C.args&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`run-case-empty`,children:`Arguments`}),(0,K.jsx)(le,{type:`multi`,feedback:`Copied`,children:Ye(C.args)})]}),C.result&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`run-case-empty`,children:C.kind===`poll`?`Latest result`:`Result`}),(0,K.jsx)(le,{type:`multi`,feedback:`Copied`,children:Ye(C.result)})]})]}):(0,K.jsx)(U,{title:`Select an action`,children:`Pick a row to see its arguments, result or full message.`})})]})]})}var rt={search:``,kinds:[],outcomes:[],started:`any`,runBy:`any`,environment:``,sortKey:`startedAt`,sortDir:`DESC`,page:1,pageSize:25},it=rt,at=[{id:`any`,text:`Any time`},{id:`today`,text:`Today`},{id:`7d`,text:`Last 7 days`},{id:`30d`,text:`Last 30 days`}],ot=[{id:`any`,text:`Anyone`},{id:`copilot`,text:`GitHub Copilot`},{id:`claude`,text:`Claude Code`},{id:`cli`,text:`CLI (no Studio agent)`}],st=[`plan`,`suite`,`testcase`],ct=[`running`,`failed`,`passed`,`incomplete`,`not-started`,`interrupted`,`cancelled`,`no-results`],lt={id:``,text:`Any environment`},ut={status:`ASC`,name:`ASC`,kind:`ASC`,startedAt:`DESC`,duration:`DESC`},dt=3e3,ft=1e4;function pt(e,t){if(t===`any`)return!0;let n=Date.parse(e),r=new Date;if(t===`today`)return n>=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime();let i=t===`7d`?7:30;return n>=r.getTime()-i*24*60*60*1e3}function mt(e){return e.agent?e.agent.agent:`cli`}function ht(e,t,n){switch(n){case`status`:return ct.indexOf(e.outcome)-ct.indexOf(t.outcome);case`name`:return H(e).localeCompare(H(t),void 0,{sensitivity:`base`});case`kind`:return st.indexOf(e.kind)-st.indexOf(t.kind);case`duration`:return(e.durationMs??-1)-(t.durationMs??-1);default:return e.startedAt.localeCompare(t.startedAt)}}function gt(e){return e.search.trim()!==``||e.kinds.length>0||e.outcomes.length>0||e.started!==`any`||e.runBy!==`any`||e.environment!==``}function _t({onOpen:e}){let[t,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(null),[s,d]=(0,G.useState)(it),{finishedCount:f}=ke();function p(e){d(t=>{let n={...t,...e,...`page`in e?{}:{page:1}};return it=n,n})}function m(){return I.listRuns().then(({runs:e})=>(r(e),a(null),e)).catch(e=>(a(e instanceof Error?e.message:String(e)),null))}let g=t?.some(e=>e.outcome===`running`)??!1;(0,G.useEffect)(()=>{m();let e=setInterval(m,g?dt:ft);return()=>clearInterval(e)},[g,f]);let _=(0,G.useMemo)(()=>{let e=new Set;for(let n of t??[])n.agent&&e.add(B(n.agent.environment));return[...e].sort()},[t]),x=(0,G.useMemo)(()=>ct.filter(e=>t?.some(t=>t.outcome===e)),[t]),S=(0,G.useMemo)(()=>{let e=s.search.trim().toLowerCase(),n=(t??[]).filter(t=>(!e||`${t.name??``} ${t.targetName} ${t.agent?.environment??``} ${t.agent?.company??``}`.toLowerCase().includes(e))&&(s.kinds.length===0||s.kinds.includes(t.kind))&&(s.outcomes.length===0||s.outcomes.includes(t.outcome))&&pt(t.startedAt,s.started)&&(s.runBy===`any`||mt(t)===s.runBy)&&(!s.environment||t.agent&&B(t.agent.environment)===s.environment)),r=s.sortDir===`ASC`?1:-1;return n.sort((e,t)=>Number(t.outcome===`running`)-Number(e.outcome===`running`)||r*ht(e,t,s.sortKey)||t.startedAt.localeCompare(e.startedAt))},[t,s]);(0,G.useEffect)(()=>{je(S.map(e=>e.key))},[S]);let C=Math.max(1,Math.ceil(S.length/s.pageSize)),w=Math.min(s.page,C),E=S.slice((w-1)*s.pageSize,w*s.pageSize);function k(e,t){let n=s.sortKey===e;return(0,K.jsx)(l,{isSortable:!0,sortDirection:n?s.sortDir:`NONE`,isSortHeader:n,onClick:()=>p({sortKey:e,sortDir:n?s.sortDir===`DESC`?`ASC`:`DESC`:ut[e]}),children:t})}let A=gt(s),j=t?.length??0;return(0,K.jsxs)(`div`,{className:`runs-page`,children:[i&&(0,K.jsx)(v,{kind:`error`,title:`Could not load runs`,subtitle:i,lowContrast:!0,hideCloseButton:!0}),t===null?(0,K.jsx)(Ce,{columnCount:8,rowCount:8,showHeader:!1,showToolbar:!1,"aria-label":`Loading runs`}):j===0?(0,K.jsx)(U,{title:`Your runs will appear here`,children:`Run a plan, suite or test case from its page and it shows up here, live, while it runs.`}):(0,K.jsxs)(O,{title:`Test runs`,description:A?`${S.length} of ${j} runs match the filters.`:`${j} runs. Running runs stay at the top.`,children:[(0,K.jsx)(u,{"aria-label":`Filter runs`,children:(0,K.jsxs)(T,{className:`runs-toolbar`,children:[(0,K.jsx)(n,{persistent:!0,placeholder:`Search by name, plan, suite or environment`,labelText:`Search runs`,value:s.search,onChange:e=>p({search:e?e.target.value:``})}),(0,K.jsx)(c,{id:`runs-filter-kind`,type:`inline`,titleText:`Type`,label:`All`,items:st,itemToString:e=>e?Ae[e]:``,selectedItems:s.kinds,onChange:({selectedItems:e})=>p({kinds:e??[]})}),(0,K.jsx)(c,{id:`runs-filter-status`,type:`inline`,titleText:`Status`,label:`All`,items:x,itemToString:e=>e?Fe[e].label:``,selectedItems:s.outcomes,onChange:({selectedItems:e})=>p({outcomes:e??[]})}),(0,K.jsx)(b,{id:`runs-filter-started`,type:`inline`,titleText:`Started`,label:`Any time`,items:at,itemToString:e=>e?.text??``,selectedItem:at.find(e=>e.id===s.started),onChange:({selectedItem:e})=>p({started:e?.id??`any`})}),(0,K.jsx)(b,{id:`runs-filter-runby`,type:`inline`,titleText:`Run by`,label:`Anyone`,items:ot,itemToString:e=>e?.text??``,selectedItem:ot.find(e=>e.id===s.runBy),onChange:({selectedItem:e})=>p({runBy:e?.id??`any`})}),_.length>0&&(0,K.jsx)(b,{id:`runs-filter-env`,type:`inline`,titleText:`Environment`,label:`Any environment`,items:[lt,..._.map(e=>({id:e,text:e}))],itemToString:e=>e?.text??``,selectedItem:s.environment?{id:s.environment,text:s.environment}:lt,onChange:({selectedItem:e})=>p({environment:e?.id??``})}),A&&(0,K.jsx)(R,{kind:`ghost`,size:`lg`,onClick:()=>p({...rt,sortKey:s.sortKey,sortDir:s.sortDir,pageSize:s.pageSize}),children:`Clear filters`}),(0,K.jsx)(R,{kind:`ghost`,size:`lg`,hasIconOnly:!0,renderIcon:y,iconDescription:`Refresh`,tooltipPosition:`left`,onClick:()=>void m()})]})}),S.length===0?(0,K.jsx)(U,{title:`No runs match these filters`,action:(0,K.jsx)(R,{kind:`tertiary`,size:`md`,onClick:()=>p({...rt,sortKey:s.sortKey,sortDir:s.sortDir,pageSize:s.pageSize}),children:`Clear filters`}),children:`Try another search, or clear the filters to see every run.`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(L,{size:`lg`,"aria-label":`Test runs`,className:`runs-table`,children:[(0,K.jsx)(h,{children:(0,K.jsxs)(D,{children:[k(`status`,`Status`),k(`name`,`Run`),k(`kind`,`Type`),k(`startedAt`,`Started`),k(`duration`,`Duration`),(0,K.jsx)(l,{children:`Results`}),(0,K.jsx)(l,{children:`Environment`}),(0,K.jsx)(l,{children:`Run by`})]})}),(0,K.jsx)(N,{children:E.map(t=>(0,K.jsx)(vt,{row:t,onOpen:e},t.key))})]}),(0,K.jsx)(o,{page:w,pageSize:s.pageSize,pageSizes:[25,50,100],totalItems:S.length,onChange:({page:e,pageSize:t})=>p(t===s.pageSize?{page:e}:{pageSize:t,page:1})})]})]})]})}function vt({row:t,onOpen:n}){let r=t.outcome===`running`,i=Fe[t.outcome],a=H(t),o=Ne(t);return(0,K.jsxs)(D,{className:`runs-row`,onClick:()=>n(t.key),children:[(0,K.jsx)(e,{className:`runs-cell-nowrap`,children:r?(0,K.jsx)(ee,{status:`active`,description:`Running`}):(0,K.jsx)(De,{view:i,label:i.label})}),(0,K.jsxs)(e,{className:`runs-cell-name`,children:[(0,K.jsx)(xe,{href:`#/testruns/${encodeURIComponent(t.key)}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n(t.key)},children:a}),t.name&&t.name!==t.targetName&&(0,K.jsx)(`div`,{className:`runs-row-target`,children:t.targetName})]}),(0,K.jsx)(e,{children:Ae[t.kind]}),(0,K.jsx)(e,{className:`runs-cell-nowrap`,title:z(t.startedAt),children:Me(t.startedAt)}),(0,K.jsx)(e,{className:`runs-cell-nowrap`,children:t.durationMs===void 0?``:V(t.durationMs)}),(0,K.jsx)(e,{className:`runs-cell-results`,children:r&&t.cases.total>0?(0,K.jsx)(ie,{size:`small`,label:`${a} progress`,hideLabel:!0,value:o,max:t.cases.total,helperText:`${o} of ${t.cases.total} test cases`}):Ee(t)}),(0,K.jsx)(e,{className:`runs-cell-env`,children:t.agent&&(0,K.jsxs)(`span`,{title:`${B(t.agent.environment)} · ${t.agent.company}`,children:[B(t.agent.environment),` · `,t.agent.company]})}),(0,K.jsx)(e,{className:`runs-cell-nowrap`,children:t.agent?t.agent.agent===`claude`?`Claude Code`:`GitHub Copilot`:`CLI`})]})}function yt(e){if(!e.startsWith(`run:`))return null;let t=e.slice(4),n=t.indexOf(`:`);if(n<0)return null;let r=t.slice(0,n),i=t.slice(n+1);return r&&i?{planFile:r,runId:i}:null}var bt=3e3,Y={pending:{Icon:ae,tone:`neutral`},running:{Icon:Ie,tone:`info`},passed:{Icon:j,tone:`success`},failed:{Icon:d,tone:`error`},blocked:{Icon:He,tone:`caution`},skipped:{Icon:ce,tone:`neutral`}},xt={missing:Y.pending,incomplete:Y.running,passed:Y.passed,failed:Y.failed};function St(e,t,n){let r=()=>n(`Copied summary to clipboard.`),i=()=>n(`Could not copy to clipboard.`);typeof ClipboardItem<`u`&&navigator.clipboard.write?navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),"text/html":new Blob([t],{type:`text/html`})})]).then(r,()=>navigator.clipboard.writeText(e).then(r,i)):navigator.clipboard.writeText(e).then(r,i)}function Ct(e,t){let n=new Blob([t],{type:`text/markdown`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function wt({sub:e,onNavigate:t}){return e?(0,K.jsx)(Tt,{runKey:e,onNavigate:t},e):(0,K.jsx)(_t,{onOpen:e=>t(e)})}function Tt({runKey:e,onNavigate:t}){let[n,i]=(0,G.useState)(null),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),{finishedCount:f}=ke();function p(){return I.listRuns().then(({runs:e})=>i(e)).catch(e=>s(e instanceof Error?e.message:String(e)))}let m=n?.find(t=>t.key===e)??null,h=m?.outcome===`running`;(0,G.useEffect)(()=>{if(p(),n!==null&&!h)return;let e=setInterval(p,bt);return()=>clearInterval(e)},[h,f]);let g=!m&&e.startsWith(`agent:`)?n?.find(t=>t.agent?.id===e.slice(6)):void 0;if((0,G.useEffect)(()=>{g&&g.key!==e&&t(g.key)},[g?.key]),n===null)return(0,K.jsxs)(`div`,{className:`run-page`,"aria-busy":`true`,children:[(0,K.jsx)(a,{heading:!0,width:`40%`}),(0,K.jsx)(a,{paragraph:!0,lineCount:4})]});if(!m)return(0,K.jsxs)(`div`,{className:`run-page`,children:[(0,K.jsx)(Et,{onNavigate:t}),o&&(0,K.jsx)(v,{kind:`error`,title:`Error`,subtitle:o,lowContrast:!0,hideCloseButton:!0}),!g&&(0,K.jsx)(U,{title:`This run is no longer here`,action:(0,K.jsx)(R,{kind:`tertiary`,size:`md`,onClick:()=>t(null),children:`Back to test runs`}),children:`It may have been deleted, or the working folder changed.`})]});let _=Fe[m.outcome],y=H(m),b=Re().length>0?Re():n.map(e=>e.key),S=b.indexOf(m.key),C=S>0?b[S-1]:null,w=S>=0&&S<b.length-1?b[S+1]:null,T=yt(m.key),D=m.key.startsWith(`testrun:`)?m.key.slice(8):null,O=T!==null||D!==null,k=Ne(m),A=O&&!(D&&h),j=m.name&&m.name!==m.targetName?`${m.name} (${m.targetName})`:m.targetName;async function ee(){if(m?.agent){d(!0);try{await I.stopAgentRun(m.agent.id),await p()}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}}let te=()=>t(null),N=T?(0,K.jsx)(Nt,{planFile:T.planFile,runId:T.runId,planName:j,onError:s,onDeleted:te}):D?(0,K.jsx)(an,{file:D,suiteName:j,onError:s,onDeleted:te}):null,P=m.agent?(0,K.jsx)(kt,{runId:m.agent.id,onError:s}):null;return(0,K.jsxs)(`div`,{className:`run-page test-run-print-area`,children:[(0,K.jsx)(Et,{onNavigate:t}),(0,K.jsxs)(`div`,{className:`detail-header`,children:[(0,K.jsxs)(`div`,{className:`detail-header-top`,children:[(0,K.jsx)(`h2`,{children:y}),(0,K.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:(0,K.jsx)(se,{type:Ve[_.tone],size:`md`,children:_.label})}),(0,K.jsxs)(`div`,{className:`detail-header-actions`,children:[h&&m.agent&&(0,K.jsx)(R,{kind:`danger--tertiary`,size:`md`,renderIcon:Te,disabled:u,onClick:ee,children:u?`Stopping…`:`Stop run`}),A&&(0,K.jsx)(R,{kind:`tertiary`,size:`md`,renderIcon:E,onClick:()=>l(!0),children:`Rename`}),(0,K.jsx)(R,{kind:`ghost`,size:`md`,hasIconOnly:!0,renderIcon:ne,iconDescription:`Previous run`,tooltipPosition:`bottom`,disabled:!C,onClick:()=>C&&t(C)}),(0,K.jsx)(R,{kind:`ghost`,size:`md`,hasIconOnly:!0,renderIcon:ge,iconDescription:`Next run`,tooltipPosition:`bottom`,disabled:!w,onClick:()=>w&&t(w)})]})]}),(0,K.jsxs)(`p`,{className:`detail-path`,children:[Ae[m.kind],m.name&&m.name!==m.targetName?` · ${m.targetName}`:``,` · started `,z(m.startedAt)]}),(0,K.jsxs)(`dl`,{className:`run-case-meta`,children:[m.agent&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Environment`}),(0,K.jsx)(`dd`,{children:B(m.agent.environment)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Company`}),(0,K.jsx)(`dd`,{children:m.agent.company})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Depth`}),(0,K.jsx)(`dd`,{children:m.agent.depth===`full`?`Full run`:`Navigation only`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Run by`}),(0,K.jsx)(`dd`,{children:m.agent?m.agent.agent===`claude`?`Claude Code`:`GitHub Copilot`:`CLI`})]}),m.durationMs!==void 0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:h?`Elapsed`:`Duration`}),(0,K.jsx)(`dd`,{children:V(m.durationMs)})]})]})]}),o&&(0,K.jsx)(v,{kind:`error`,title:`Error`,subtitle:o,lowContrast:!0,onClose:()=>s(null)}),m.cases.total>0&&(0,K.jsx)(`div`,{className:`run-progress`,children:(0,K.jsx)(ie,{label:h?`Running`:`Progress`,value:k,max:m.cases.total,helperText:`${k} of ${m.cases.total} test cases finished${m.suites?`, across ${m.suites.total} suites`:``}`,status:h?`active`:m.outcome===`failed`?`error`:k===m.cases.total?`finished`:`active`})}),N&&P?(0,K.jsxs)(ye,{children:[(0,K.jsxs)(be,{"aria-label":`Run details`,contained:!0,children:[(0,K.jsx)(M,{children:`Results`}),(0,K.jsx)(M,{children:`Agent activity`})]}),(0,K.jsxs)(r,{children:[(0,K.jsx)(x,{children:N}),(0,K.jsx)(x,{children:P})]})]}):N??P,c&&(0,K.jsx)(Ot,{row:m,onClose:()=>l(!1),onRenamed:()=>{l(!1),p()}})]})}function Et({onNavigate:e}){return(0,K.jsx)(S,{noTrailingSlash:!0,className:`run-breadcrumb`,children:(0,K.jsx)(te,{href:`#/testruns`,onClick:t=>{t.preventDefault(),e(null)},children:`Test runs`})})}var Dt=120;function Ot({row:e,onClose:t,onRenamed:n}){let[r,i]=(0,G.useState)(e.name??e.targetName),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(null),{showToast:d}=me(),p=r.trim(),m=p.length>Dt;async function h(){c(!0),u(null);try{await I.renameRun(e.key,p),d(`Run renamed.`),n()}catch(e){u(e instanceof Error?e.message:String(e)),c(!1)}}return(0,K.jsx)(f,{open:!0,size:`sm`,modalHeading:`Rename run`,modalLabel:e.targetName,primaryButtonText:s?`Saving…`:`Save`,secondaryButtonText:`Cancel`,primaryButtonDisabled:s||m,onRequestSubmit:h,onRequestClose:t,onSecondarySubmit:t,children:(0,K.jsxs)(`div`,{className:`form-stack`,children:[(0,K.jsx)(_e,{id:`rename-run`,labelText:`Run name`,helperText:`Leave it empty to show the ${Ae[e.kind].toLowerCase()}'s name instead.`,value:r,onChange:e=>i(e.target.value),onBlur:()=>o(!0),invalid:a&&m,invalidText:`Use ${Dt} characters or fewer.`,maxCount:Dt,enableCounter:!0,"data-modal-primary-focus":!0}),l&&(0,K.jsx)(v,{kind:`error`,title:`Could not rename`,subtitle:l,lowContrast:!0,hideCloseButton:!0})]})})}function kt({runId:e,onError:t}){let[n,r]=(0,G.useState)(null);if((0,G.useEffect)(()=>{let n=!1,i;function a(){return I.getAgentRun(e).then(e=>(n||r(e),e.status!==`running`&&i&&clearInterval(i),e)).catch(e=>(n||t(e instanceof Error?e.message:String(e)),null))}return a().then(e=>{!n&&e?.status===`running`&&(i=setInterval(a,1500))}),()=>{n=!0,i&&clearInterval(i)}},[e]),!n)return(0,K.jsx)(a,{paragraph:!0,lineCount:4});let i=n.status===`running`,o=n.status===`failed`||n.status===`interrupted`?[...n.events].reverse().find(e=>e.type===`error`)?.text:void 0,s=n.events.filter(e=>e.type===`denied`).length;return(0,K.jsxs)(`div`,{className:`agent-run-detail`,children:[o&&(0,K.jsx)(v,{kind:n.status===`failed`?`error`:`warning`,title:n.status===`failed`?`Run failed`:`Run interrupted`,subtitle:o,lowContrast:!0,hideCloseButton:!0}),(0,K.jsxs)(`div`,{className:`run-actions`,children:[(0,K.jsx)(R,{kind:`tertiary`,size:`md`,renderIcon:g,onClick:()=>{window.location.href=`/api/agent/runs/${encodeURIComponent(n.id)}/log`},children:`Full log`}),(0,K.jsx)(`p`,{className:`run-actions-note`,children:s===0?`No tool calls were denied.`:`${s} tool ${s===1?`call was`:`calls were`} denied by the run's permissions.`})]}),(0,K.jsxs)(`section`,{className:`plan-section`,children:[(0,K.jsx)(`h4`,{className:`plan-section-heading`,children:`Activity`}),(0,K.jsx)(nt,{events:n.events,live:i},n.id)]})]})}function At(e){let t={missing:0,incomplete:0,passed:0,failed:0};for(let n of e.suites)t[n.status]++;return t}var jt=[`passed`,`failed`,`incomplete`,`missing`],Mt=[`passed`,`failed`,`blocked`,`skipped`];function Nt({planFile:t,runId:n,planName:r,onError:i,onDeleted:o}){let[c,u]=(0,G.useState)(null),[d,m]=(0,G.useState)(!0),[g,v]=(0,G.useState)(new Set),[y,b]=(0,G.useState)(!1),{showToast:x}=me();(0,G.useEffect)(()=>{let e=!1,r,a=!0;m(!0),i(null);function o(){return I.getPlanStatus(t,n).then(t=>{if(e)return t;if(u(t),a){a=!1;let e=t.suites.find(e=>e.testRun);e&&v(new Set([e.suiteId]))}return t}).catch(t=>(e||i(t instanceof Error?t.message:String(t)),null))}return o().then(t=>{e||!t||t.overall===`all-passed`||t.overall===`has-failures`||(r=setInterval(()=>{o().then(e=>{e&&(e.overall===`all-passed`||e.overall===`has-failures`)&&r&&clearInterval(r)})},bt))}).finally(()=>{e||m(!1)}),()=>{e=!0,r&&clearInterval(r)}},[t,n]);function S(){I.getPlanStatus(t,n).then(u).catch(e=>i(e instanceof Error?e.message:String(e)))}async function C(){b(!1);try{await I.deletePlanRun(t,n),x(`Run deleted.`),o()}catch(e){i(e instanceof Error?e.message:String(e))}}function w(e){v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}if(d)return(0,K.jsxs)(`div`,{"aria-busy":`true`,children:[(0,K.jsx)(a,{heading:!0,width:`40%`}),(0,K.jsx)(a,{paragraph:!0,lineCount:4})]});if(!c)return null;let T=At(c),E=c.suites.length,O=c.suites.reduce((e,t)=>e+Object.keys(t.testRun?.results??{}).length,0);return(0,K.jsxs)(`div`,{className:`plan-run-detail`,children:[(0,K.jsxs)(ze,{children:[jt.map(e=>(0,K.jsx)(W,{icon:xt[e].Icon,label:`Suites ${Be[e].toLowerCase()}`,value:T[e]},e)),(0,K.jsx)(W,{icon:Oe.suites,label:`Suites total`,value:E}),(0,K.jsx)(W,{icon:Le.testcases,label:`Test cases`,value:O})]}),(0,K.jsxs)(`div`,{className:`run-actions`,children:[(0,K.jsx)(R,{kind:`tertiary`,size:`md`,renderIcon:pe,onClick:()=>St(Yt(c,r),Xt(c,r),x),children:`Copy run summary`}),(0,K.jsxs)(_,{label:`Export run`,kind:`tertiary`,size:`md`,children:[(0,K.jsx)(P,{label:`Markdown (.md)`,onClick:()=>Ct(`${t}-${n}.md`,Yt(c,r))}),(0,K.jsx)(P,{label:`PDF`,onClick:()=>window.print()})]}),(0,K.jsx)(R,{kind:`danger--tertiary`,size:`md`,renderIcon:s,className:`form-actions-end`,onClick:()=>b(!0),children:`Delete run`})]}),(0,K.jsxs)(`section`,{className:`plan-section`,children:[(0,K.jsx)(`h4`,{className:`plan-section-heading`,children:`Suites`}),(0,K.jsxs)(L,{size:`lg`,"aria-label":`Suites in this run`,children:[(0,K.jsx)(h,{children:(0,K.jsxs)(D,{children:[(0,K.jsx)(A,{"aria-label":`Expand suite`}),(0,K.jsx)(l,{children:`Suite`}),(0,K.jsx)(l,{children:`Status`}),(0,K.jsx)(l,{children:`Test cases`})]})}),(0,K.jsx)(N,{children:c.suites.map(t=>{let r=Object.values(t.testRun?.results??{}),a=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(e,{children:t.suiteName}),(0,K.jsx)(e,{children:(0,K.jsx)(De,{view:xt[t.status],label:Be[t.status]})}),(0,K.jsx)(e,{children:t.testRun?`${r.filter(e=>Mt.includes(e.status)).length} of ${r.length} finished`:`Not run yet`})]});if(!t.testRun)return(0,K.jsxs)(D,{children:[(0,K.jsx)(e,{}),a]},t.suiteId);let o=g.has(t.suiteId);return(0,K.jsxs)(G.Fragment,{children:[(0,K.jsx)(p,{isExpanded:o,"aria-label":`Expand ${t.suiteName}`,onExpand:()=>w(t.suiteId),children:a}),o&&(0,K.jsx)(fe,{colSpan:4,children:(0,K.jsx)(an,{file:`${t.suiteId}-${n}`,suiteName:t.suiteName,onError:i,onDeleted:()=>{w(t.suiteId),S()}})})]},t.suiteId)})})]})]}),(0,K.jsx)(f,{danger:!0,size:`sm`,open:y,modalHeading:`Delete this run?`,primaryButtonText:`Delete`,secondaryButtonText:`Cancel`,onRequestClose:()=>b(!1),onRequestSubmit:C,children:(0,K.jsx)(`p`,{children:`The individual suites' test run files are not affected.`})})]})}function X(e){return e===0?`$0.00`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}var Z={pending:`Pending`,running:`Running`,passed:`Passed`,failed:`Failed`,blocked:`Blocked`,skipped:`Skipped`},Pt=[`failed`,`blocked`,`running`,`pending`,`skipped`,`passed`];function Ft(e){let t=new Set(Object.values(e.results).map(e=>e.status));return Pt.find(e=>t.has(e))??`pending`}function It(e){return Object.values(e.results).every(e=>e.status===`passed`||e.status===`failed`||e.status===`blocked`||e.status===`skipped`)}var Lt=[`passed`,`failed`,`blocked`,`skipped`];function Rt(e){let t={pending:0,running:0,passed:0,failed:0,blocked:0,skipped:0};for(let n of Object.values(e.results))t[n.status]++;return t}function zt(e){let t=0,n=0,r=!1,i=!1;for(let a of Object.values(e.results))a.tokensUsed!==void 0&&(t+=a.tokensUsed,r=!0),a.costUsd!==void 0&&(n+=a.costUsd,i=!0);return{tokens:t,cost:n,hasTokens:r,hasCost:i}}function Bt(e,t,n,r=1){let i=Ft(e),a=Rt(e),o=Object.keys(e.results).length,{tokens:s,cost:c,hasTokens:l,hasCost:u}=zt(e),d=Object.entries(e.results).sort(([,e],[,t])=>(e.sequence??1/0)-(t.sequence??1/0)),f=`#`.repeat(r),p=`#`.repeat(r+1),m=[`${f} ${n} — ${Z[i]}`,``,`${t}.json · Started at ${z(e.startedAt)}`,``,`**${a.passed}** Passed · **${a.failed}** Failed · **${a.blocked}** Blocked · **${a.skipped}** Skipped · **${o}** Total`+(l?` · **${s.toLocaleString()}** Tokens`:``)+(u?` · **${X(c)}**`:``),``];for(let[e,t]of d){let n=t.sequence===void 0?``:`${t.sequence}. `;if(m.push(`${p} ${n}${e} — ${Z[t.status]}`),t.startedAt&&m.push(`- Started: ${z(t.startedAt)}`),t.durationMs!==void 0&&m.push(`- Duration: ${V(t.durationMs)}`),t.tokensUsed!==void 0&&m.push(`- Tokens: ${t.tokensUsed.toLocaleString()}`),t.costUsd!==void 0&&m.push(`- Cost: ${X(t.costUsd)}`),t.inputs&&Object.keys(t.inputs).length>0){m.push(`- Inputs:`);for(let[e,n]of Object.entries(t.inputs))m.push(` - ${e} = ${n}`)}if(Object.keys(t.outputs).length>0){m.push(`- Outputs:`);for(let[e,n]of Object.entries(t.outputs))m.push(` - ${e} = ${n}`)}if(t.assertionResults.length>0){m.push(`- Assertions:`);for(let e of t.assertionResults)m.push(` - [${e.passed?`x`:` `}] ${e.description} — ${e.actual}`)}if(t.messages&&t.messages.length>0){m.push(`- Infolog:`);for(let e of t.messages)m.push(` - ${e}`)}m.push(``)}return m.join(`
4
+ `).trimEnd()+`
5
+ `}var Q={pending:`#525252`,running:`#0043ce`,passed:`#0e6027`,failed:`#a2191f`,blocked:`#483700`,skipped:`#525252`},Vt={pending:`#e0e0e0`,running:`#d0e2ff`,passed:`#a7f0ba`,failed:`#ffd7d9`,blocked:`#fddc69`,skipped:`#e0e0e0`},Ht=`#525252`,Ut={Info:Q.running,Warning:Q.blocked,Error:Q.failed};function $(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Wt(e,t){return`<font color="${e}">${t}</font>`}function Gt(e){let t=Q[e];return`<span style="display:inline-block;padding:2px 10px;border-radius:999px;font-weight:600;font-size:0.85em;color:${t};background:${Vt[e]}">${Wt(t,Z[e])}</span>`}function Kt(e){let{severity:t,segments:n}=$t(e),r=$(n.join(` › `));if(!t||!(t in Ut))return r;let i=Ut[t];return`<strong style="color:${i}">${Wt(i,`${t}:`)}</strong> ${r}`}var qt=`font-family: ui-monospace, Consolas, monospace; font-size: 0.9em;`;function Jt(e,t,n,r=1){let i=Ft(e),a=Rt(e),o=Object.keys(e.results).length,{tokens:s,cost:c,hasTokens:l,hasCost:u}=zt(e),d=Object.entries(e.results).sort(([,e],[,t])=>(e.sequence??1/0)-(t.sequence??1/0)),f=`h${r}`,p=`h${r+1}`,m=`<strong>${a.passed}</strong> Passed · <strong>${a.failed}</strong> Failed · <strong>${a.blocked}</strong> Blocked · <strong>${o}</strong> Total`+(l?` · <strong>${s.toLocaleString()}</strong> Tokens`:``)+(u?` · <strong>${$(X(c))}</strong>`:``),h=[`<${f} style="margin:0 0 4px">${$(n)} — ${Gt(i)}</${f}>`,`<p style="color:${Ht};margin:0 0 12px">${$(t)}.json · Started at ${$(z(e.startedAt))}</p>`,`<p style="margin:0 0 16px">${m}</p>`];for(let[e,t]of d){let n=t.sequence===void 0?``:`${t.sequence}. `;h.push(`<${p} style="margin:16px 0 4px">${n}${$(e)} — ${Gt(t.status)}</${p}>`);let r=[];if(t.startedAt&&r.push(`Started: ${$(z(t.startedAt))}`),t.durationMs!==void 0&&r.push(`Duration: ${$(V(t.durationMs))}`),t.tokensUsed!==void 0&&r.push(`Tokens: ${t.tokensUsed.toLocaleString()}`),t.costUsd!==void 0&&r.push(`Cost: ${$(X(t.costUsd))}`),r.length>0&&h.push(`<p style="margin:0 0 4px;color:${Ht}">${r.join(` · `)}</p>`),t.inputs&&Object.keys(t.inputs).length>0){h.push(`<p style="margin:8px 0 2px"><strong>Inputs</strong></p><ul style="margin:0 0 8px">`);for(let[e,n]of Object.entries(t.inputs))h.push(`<li><code style="${qt}">${$(e)}</code> = <code style="${qt}">${$(n)}</code></li>`);h.push(`</ul>`)}if(Object.keys(t.outputs).length>0){h.push(`<p style="margin:8px 0 2px"><strong>Outputs</strong></p><ul style="margin:0 0 8px">`);for(let[e,n]of Object.entries(t.outputs))h.push(`<li><code style="${qt}">${$(e)}</code> = <code style="${qt}">${$(n)}</code></li>`);h.push(`</ul>`)}if(t.assertionResults.length>0){h.push(`<p style="margin:8px 0 2px"><strong>Assertions</strong></p><ul style="margin:0 0 8px">`);for(let e of t.assertionResults){let t=e.passed?Q.passed:Q.failed;h.push(`<li><strong style="color:${t}">${Wt(t,e.passed?`Pass`:`Fail`)}</strong> ${$(e.description)} — ${$(e.actual)}</li>`)}h.push(`</ul>`)}if(t.messages&&t.messages.length>0){h.push(`<p style="margin:8px 0 2px"><strong>Infolog</strong></p><ul style="margin:0 0 8px">`);for(let e of t.messages)h.push(`<li>${Kt(e)}</li>`);h.push(`</ul>`)}}return h.join(`
6
+ `)}function Yt(e,t){let n=[`# ${t} — Run ${e.runId}`,``,`Started at ${z(e.startedAt)}`,``];for(let t of e.suites){if(!t.testRun){n.push(`## ${t.suiteName} — Not run yet`,``);continue}n.push(Bt(t.testRun,`${t.suiteId}-${e.runId}`,t.suiteName,2),``)}return n.join(`
7
+ `).trimEnd()+`
8
+ `}function Xt(e,t){let n=[`<h1 style="margin:0 0 4px">${$(t)} — Run ${$(e.runId)}</h1>`,`<p style="color:${Ht};margin:0 0 16px">Started at ${$(z(e.startedAt))}</p>`];for(let t of e.suites){if(!t.testRun){n.push(`<h2 style="margin:16px 0 4px">${$(t.suiteName)} — Not run yet</h2>`);continue}n.push(`<hr style="margin:20px 0">`,Jt(t.testRun,`${t.suiteId}-${e.runId}`,t.suiteName,2))}return n.join(`
9
+ `)}var Zt=[`failed`,`blocked`],Qt=3;function $t(e){let t=e.match(/^(Info|Warning|Error):\s*([\s\S]*)$/),n=t?t[1]:null,r=t?t[2]:e,i=r.split(` > `).map(e=>e.trim()).filter(Boolean);return{severity:n,segments:i.length>0?i:[r]}}var en={Info:{Icon:we,tone:`info`},Warning:{Icon:w,tone:`caution`},Error:{Icon:d,tone:`error`}};function tn({text:e}){let{severity:t,segments:n}=$t(e),r=t?en[t]:null;return(0,K.jsxs)(`span`,{className:`infolog-line ${r?`status-${r.tone}`:``}`,children:[r&&(0,K.jsx)(r.Icon,{size:16,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:n.join(` › `)})]})}function nn({values:e,empty:t}){let n=Object.entries(e??{});return n.length===0?(0,K.jsx)(`p`,{className:`run-case-empty`,children:t}):(0,K.jsx)(`ul`,{className:`run-case-list`,children:n.map(([e,t])=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`code`,{children:e}),` = `,(0,K.jsx)(`code`,{children:t})]},e))})}function rn({result:e}){let[t,n]=(0,G.useState)(!1),i=Object.keys(e.inputs??{}).length,a=Object.keys(e.outputs).length,o=e.assertionResults.filter(e=>!e.passed).length,s=e.messages??[],c=t?s:s.slice(0,Qt),l=Zt.includes(e.status)?2:0;return(0,K.jsxs)(`div`,{className:`run-case`,children:[(0,K.jsxs)(`dl`,{className:`run-case-meta`,children:[e.startedAt&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Started`}),(0,K.jsx)(`dd`,{children:z(e.startedAt)})]}),e.durationMs!==void 0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Duration`}),(0,K.jsx)(`dd`,{children:V(e.durationMs)})]}),e.tokensUsed!==void 0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Tokens`}),(0,K.jsx)(`dd`,{children:e.tokensUsed.toLocaleString()})]}),e.costUsd!==void 0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:`Cost`}),(0,K.jsx)(`dd`,{children:X(e.costUsd)})]})]}),(0,K.jsxs)(ye,{defaultSelectedIndex:l,children:[(0,K.jsxs)(be,{"aria-label":`Case details`,contained:!0,children:[(0,K.jsx)(M,{children:`Inputs (${i})`}),(0,K.jsx)(M,{children:`Outputs (${a})`}),(0,K.jsx)(M,{children:o>0?`Assertions (${e.assertionResults.length}, ${o} failed)`:`Assertions (${e.assertionResults.length})`}),(0,K.jsx)(M,{children:`Infolog (${s.length})`})]}),(0,K.jsxs)(r,{children:[(0,K.jsx)(x,{children:(0,K.jsx)(nn,{values:e.inputs,empty:`No inputs captured.`})}),(0,K.jsx)(x,{children:(0,K.jsx)(nn,{values:e.outputs,empty:`No outputs captured.`})}),(0,K.jsx)(x,{children:e.assertionResults.length===0?(0,K.jsx)(`p`,{className:`run-case-empty`,children:`No assertions captured.`}):(0,K.jsx)(`ul`,{className:`run-case-list`,children:e.assertionResults.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(De,{view:e.passed?Y.passed:Y.failed,label:e.passed?`Pass`:`Fail`}),` `,e.description,` — `,(0,K.jsx)(`span`,{className:`run-case-actual`,children:e.actual})]},t))})}),(0,K.jsx)(x,{children:s.length===0?(0,K.jsx)(`p`,{className:`run-case-empty`,children:`No infolog captured.`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ul`,{className:`run-case-list`,children:c.map((e,t)=>(0,K.jsx)(`li`,{children:(0,K.jsx)(tn,{text:e})},t))}),s.length>Qt&&(0,K.jsx)(R,{kind:`ghost`,size:`sm`,onClick:()=>n(e=>!e),children:t?`Show less`:`Show ${s.length-Qt} more`})]})})]})]})]})}function an({file:t,suiteName:n,onError:r,onDeleted:i}){let[o,c]=(0,G.useState)(null),[u,d]=(0,G.useState)(!0),[g,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(new Set),[C,w]=(0,G.useState)(!1),{showToast:T}=me();if((0,G.useEffect)(()=>{let e=!1,n;d(!0);function i(){return I.getTestRun(t).then(t=>(e||c(t),t)).catch(t=>(e||r(t instanceof Error?t.message:String(t)),null))}return i().then(t=>{e||!t||It(t)||(n=setInterval(()=>{i().then(e=>{e&&It(e)&&n&&clearInterval(n)})},bt))}).finally(()=>{e||d(!1)}),()=>{e=!0,n&&clearInterval(n)}},[t]),u)return(0,K.jsx)(a,{paragraph:!0,lineCount:3});if(!o)return null;let E=n??o.suiteId,O=Rt(o),k=Object.keys(o.results).length,{tokens:j,cost:ee,hasTokens:M,hasCost:te}=zt(o),ne=Object.entries(o.results).sort(([,e],[,t])=>(e.sequence??1/0)-(t.sequence??1/0)),ie=g.trim().toLowerCase(),ae=ne.filter(([e,t])=>e.toLowerCase().includes(ie)&&(!y||Zt.includes(t.status)));function se(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function ce(){St(Bt(o,t,E),Jt(o,t,E),T)}async function le(){w(!1);try{await I.deleteTestRun(t),i()}catch(e){r(e instanceof Error?e.message:String(e))}}return(0,K.jsxs)(`div`,{className:`suite-run`,children:[(0,K.jsxs)(`div`,{className:`run-actions`,children:[(0,K.jsx)(R,{kind:`tertiary`,size:`sm`,renderIcon:pe,onClick:ce,children:`Copy summary`}),(0,K.jsxs)(_,{label:`Export`,kind:`tertiary`,size:`sm`,children:[(0,K.jsx)(P,{label:`Markdown (.md)`,onClick:()=>Ct(`${t}.md`,Bt(o,t,E))}),(0,K.jsx)(P,{label:`PDF`,onClick:()=>window.print()})]}),(0,K.jsx)(R,{kind:`danger--ghost`,size:`sm`,renderIcon:s,className:`form-actions-end`,onClick:()=>w(!0),children:`Delete`})]}),(0,K.jsxs)(ze,{children:[Lt.map(e=>(0,K.jsx)(W,{icon:Y[e].Icon,label:Z[e],value:O[e]},e)),(0,K.jsx)(W,{icon:Le.testcases,label:`Total`,value:k}),M&&(0,K.jsx)(W,{icon:Le.tokens,label:`Tokens`,value:Pe(j)}),te&&(0,K.jsx)(W,{icon:m,label:`Cost`,value:X(ee)})]}),(0,K.jsxs)(`div`,{className:`run-filters`,children:[(0,K.jsx)(oe,{size:`md`,labelText:`Search test cases`,placeholder:`Search test cases`,value:g,onChange:e=>v(e.target.value)}),(0,K.jsx)(re,{id:`failures-only-${t}`,size:`sm`,labelText:`Show failures only`,labelA:`Off`,labelB:`On`,toggled:y,onToggle:b})]}),ne.length>0&&ae.length===0?(0,K.jsx)(U,{title:`No matches`,children:`No test cases match the current search or filter.`}):(0,K.jsxs)(L,{size:`lg`,"aria-label":`Test cases in ${E}`,children:[(0,K.jsx)(h,{children:(0,K.jsxs)(D,{children:[(0,K.jsx)(A,{"aria-label":`Expand test case`}),(0,K.jsx)(l,{children:`#`}),(0,K.jsx)(l,{children:`Test case`}),(0,K.jsx)(l,{children:`Status`}),(0,K.jsx)(l,{children:`Duration`})]})}),(0,K.jsx)(N,{children:ae.map(([t,n])=>{let r=x.has(t);return(0,K.jsxs)(G.Fragment,{children:[(0,K.jsxs)(p,{isExpanded:r,"aria-label":`Expand ${t}`,onExpand:()=>se(t),children:[(0,K.jsx)(e,{children:n.sequence??``}),(0,K.jsx)(e,{children:t}),(0,K.jsx)(e,{children:(0,K.jsx)(De,{view:Y[n.status],label:Z[n.status]})}),(0,K.jsx)(e,{children:n.durationMs===void 0?``:V(n.durationMs)})]}),r&&(0,K.jsx)(fe,{colSpan:5,children:(0,K.jsx)(rn,{result:n})})]},t)})})]}),(0,K.jsx)(f,{danger:!0,size:`sm`,open:C,modalHeading:`Delete this test run?`,primaryButtonText:`Delete`,secondaryButtonText:`Cancel`,onRequestClose:()=>w(!1),onRequestSubmit:le,children:(0,K.jsx)(`p`,{children:`"${t}.json" will be deleted. This cannot be undone.`})})]})}export{wt as TestRunsPage};