@anvia/studio 0.7.14 → 0.7.16
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/index.d.ts +13 -1
- package/dist/index.js +43 -7
- package/dist/index.js.map +1 -1
- package/dist/ui/assets/agents-page-nyn87qWN.js +2 -0
- package/dist/ui/assets/agents-page-nyn87qWN.js.map +1 -0
- package/dist/ui/assets/anvia.png +0 -0
- package/dist/ui/assets/evals-page-CrS8Nw5a.js +2 -0
- package/dist/ui/assets/{evals-page-w-gdHmQ3.js.map → evals-page-CrS8Nw5a.js.map} +1 -1
- package/dist/ui/assets/index-D5lHtsjb.js +154 -0
- package/dist/ui/assets/index-D5lHtsjb.js.map +1 -0
- package/dist/ui/assets/index-Dl647xDC.css +1 -0
- package/dist/ui/assets/knowledge-page-bW8GeV7O.js +2 -0
- package/dist/ui/assets/knowledge-page-bW8GeV7O.js.map +1 -0
- package/dist/ui/assets/logo.png +0 -0
- package/dist/ui/assets/mcps-page-CQV4bt_B.js +2 -0
- package/dist/ui/assets/mcps-page-CQV4bt_B.js.map +1 -0
- package/dist/ui/assets/memory-page-BCS0r7-V.js +2 -0
- package/dist/ui/assets/memory-page-BCS0r7-V.js.map +1 -0
- package/dist/ui/assets/pipelines-page-COYYrCkj.js +8 -0
- package/dist/ui/assets/pipelines-page-COYYrCkj.js.map +1 -0
- package/dist/ui/assets/{renderers-CIC1VVRv.js → renderers-m-gqGocU.js} +2 -2
- package/dist/ui/assets/{renderers-CIC1VVRv.js.map → renderers-m-gqGocU.js.map} +1 -1
- package/dist/ui/assets/{sessions-page-CmDz8RxM.js → sessions-page-DozrArmB.js} +2 -2
- package/dist/ui/assets/{sessions-page-CmDz8RxM.js.map → sessions-page-DozrArmB.js.map} +1 -1
- package/dist/ui/assets/status-page-BLRlLRKt.js +2 -0
- package/dist/ui/assets/status-page-BLRlLRKt.js.map +1 -0
- package/dist/ui/assets/tool-runner-BB55tqKT.js +2 -0
- package/dist/ui/assets/tool-runner-BB55tqKT.js.map +1 -0
- package/dist/ui/assets/tools-page-JpNgNaFG.js +2 -0
- package/dist/ui/assets/tools-page-JpNgNaFG.js.map +1 -0
- package/dist/ui/assets/trace-browser-41yNH-qC.js +10 -0
- package/dist/ui/assets/{trace-browser-DaE4vnXd.js.map → trace-browser-41yNH-qC.js.map} +1 -1
- package/dist/ui/assets/transcript-item-DGNb8jMo.js +3 -0
- package/dist/ui/assets/transcript-item-DGNb8jMo.js.map +1 -0
- package/dist/ui/index.html +12 -7
- package/package.json +4 -4
- package/dist/ui/assets/agents-page-B8Tw2e11.js +0 -2
- package/dist/ui/assets/agents-page-B8Tw2e11.js.map +0 -1
- package/dist/ui/assets/evals-page-w-gdHmQ3.js +0 -2
- package/dist/ui/assets/index-BImv2lI7.js +0 -154
- package/dist/ui/assets/index-BImv2lI7.js.map +0 -1
- package/dist/ui/assets/index-C3lio5tU.css +0 -1
- package/dist/ui/assets/knowledge-page-Diqg4sSt.js +0 -2
- package/dist/ui/assets/knowledge-page-Diqg4sSt.js.map +0 -1
- package/dist/ui/assets/mcps-page-XTpTg88A.js +0 -2
- package/dist/ui/assets/mcps-page-XTpTg88A.js.map +0 -1
- package/dist/ui/assets/memory-page-DXesSt0M.js +0 -2
- package/dist/ui/assets/memory-page-DXesSt0M.js.map +0 -1
- package/dist/ui/assets/pipelines-page-Bk0Qm7db.js +0 -8
- package/dist/ui/assets/pipelines-page-Bk0Qm7db.js.map +0 -1
- package/dist/ui/assets/status-page-oWsYfXZZ.js +0 -2
- package/dist/ui/assets/status-page-oWsYfXZZ.js.map +0 -1
- package/dist/ui/assets/tools-page-C-ht7C6S.js +0 -2
- package/dist/ui/assets/tools-page-C-ht7C6S.js.map +0 -1
- package/dist/ui/assets/trace-browser-DaE4vnXd.js +0 -10
- package/dist/ui/assets/transcript-item-BqGgawoe.js +0 -3
- package/dist/ui/assets/transcript-item-BqGgawoe.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{i as e,r as t,s as n,t as r}from"./utils-BN2yP0LH.js";import{a as i,c as a,l as o,m as s,p as c,r as l,s as u,u as d}from"./format-C9HPGfkW.js";import{t as f}from"./PathIcon-DX1w_Nk9.js";import{B as p,D as m,E as ee,F as h,H as g,I as _,O as v,R as y,T as b,V as x,W as S,g as C,k as w,w as T,y as E,z as D}from"./index-D5lHtsjb.js";import{t as O}from"./badge-BH7gz3tB.js";var te=[[`path`,{d:`M5.5 12.002H19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10.9999 18.002C10.9999 18.002 4.99998 13.583 4.99997 12.0019C4.99996 10.4208 11 6.00195 11 6.00195`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],ne=[[`path`,{d:`M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],re=[[`path`,{d:`M11 6H15.5C17.9853 6 20 8.01472 20 10.5C20 12.9853 17.9853 15 15.5 15H4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.99998 12C6.99998 12 4.00001 14.2095 4 15C3.99999 15.7906 7 18 7 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],ie=[[`path`,{d:`M4 12C4 8.22876 4 6.34315 5.17157 5.17157C6.34315 4 8.22876 4 12 4C15.7712 4 17.6569 4 18.8284 5.17157C20 6.34315 20 8.22876 20 12C20 15.7712 20 17.6569 18.8284 18.8284C17.6569 20 15.7712 20 12 20C8.22876 20 6.34315 20 5.17157 18.8284C4 17.6569 4 15.7712 4 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.5 2V4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M14.5 2V4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M9.5 20V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M14.5 20V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M13 9L9 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M15 13L13 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}],[`path`,{d:`M22 14.5L20 14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`7`}],[`path`,{d:`M4 9.5L2 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`8`}],[`path`,{d:`M4 14.5L2 14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`9`}],[`path`,{d:`M22 9.5L20 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`10`}]],ae=[[`path`,{d:`M7 19H13C15.8284 19 17.2426 19 18.1213 18.1213C19 17.2426 19 15.8284 19 13V10M19 10C19.7002 10 21.0085 11.9943 21.5 12.5M19 10C18.2998 10 16.9915 11.9943 16.5 12.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5 7L5 17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`5`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`3`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`4`}]],oe=[[`path`,{d:`M15.5 12C15.5 13.933 13.933 15.5 12 15.5C10.067 15.5 8.5 13.933 8.5 12C8.5 10.067 10.067 8.5 12 8.5C13.933 8.5 15.5 10.067 15.5 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M21.011 14.0965C21.5329 13.9558 21.7939 13.8854 21.8969 13.7508C22 13.6163 22 13.3998 22 12.9669V11.0332C22 10.6003 22 10.3838 21.8969 10.2493C21.7938 10.1147 21.5329 10.0443 21.011 9.90358C19.0606 9.37759 17.8399 7.33851 18.3433 5.40087C18.4817 4.86799 18.5509 4.60156 18.4848 4.44529C18.4187 4.28902 18.2291 4.18134 17.8497 3.96596L16.125 2.98673C15.7528 2.77539 15.5667 2.66972 15.3997 2.69222C15.2326 2.71472 15.0442 2.90273 14.6672 3.27873C13.208 4.73448 10.7936 4.73442 9.33434 3.27864C8.95743 2.90263 8.76898 2.71463 8.60193 2.69212C8.43489 2.66962 8.24877 2.77529 7.87653 2.98663L6.15184 3.96587C5.77253 4.18123 5.58287 4.28891 5.51678 4.44515C5.45068 4.6014 5.51987 4.86787 5.65825 5.4008C6.16137 7.3385 4.93972 9.37763 2.98902 9.9036C2.46712 10.0443 2.20617 10.1147 2.10308 10.2492C2 10.3838 2 10.6003 2 11.0332V12.9669C2 13.3998 2 13.6163 2.10308 13.7508C2.20615 13.8854 2.46711 13.9558 2.98902 14.0965C4.9394 14.6225 6.16008 16.6616 5.65672 18.5992C5.51829 19.1321 5.44907 19.3985 5.51516 19.5548C5.58126 19.7111 5.77092 19.8188 6.15025 20.0341L7.87495 21.0134C8.24721 21.2247 8.43334 21.3304 8.6004 21.3079C8.76746 21.2854 8.95588 21.0973 9.33271 20.7213C10.7927 19.2644 13.2088 19.2643 14.6689 20.7212C15.0457 21.0973 15.2341 21.2853 15.4012 21.3078C15.5682 21.3303 15.7544 21.2246 16.1266 21.0133L17.8513 20.034C18.2307 19.8187 18.4204 19.711 18.4864 19.5547C18.5525 19.3984 18.4833 19.132 18.3448 18.5991C17.8412 16.6616 19.0609 14.6226 21.011 14.0965Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],k=n(e(),1),A=t();function se(e){try{return JSON.stringify(e,null,2)??`undefined`}catch{return String(e)}}function ce(e){return(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-lg bg-card/85 px-4 py-4 text-sm leading-6 text-foreground`,children:(0,A.jsx)(de,{depth:0,path:`$`,value:e.value})})}var le=16,ue=20;function de(e){return me(e.value)?(0,A.jsx)(fe,{arrayIndex:e.arrayIndex,depth:e.depth,path:e.path,propertyKey:e.propertyKey,trailingComma:e.trailingComma,value:e.value}):(0,A.jsxs)(`div`,{className:`min-w-max whitespace-pre`,style:{paddingLeft:`${j(e.depth)}px`},children:[(0,A.jsx)(M,{arrayIndex:e.arrayIndex,propertyKey:e.propertyKey}),(0,A.jsx)(pe,{value:e.value}),e.trailingComma?(0,A.jsx)(`span`,{className:`text-foreground`,children:`,`}):null]})}function fe(e){let[t,n]=(0,k.useState)(e.depth===0),r=Array.isArray(e.value)?e.value:void 0,i=r===void 0?Object.entries(e.value):r.map((e,t)=>[String(t),e]),a=r===void 0?`{`:`[`,o=r===void 0?`}`:`]`,s=r===void 0?`{…}`:`[…]`;return i.length===0?(0,A.jsxs)(`div`,{className:`min-w-max whitespace-pre`,style:{paddingLeft:`${j(e.depth)}px`},children:[(0,A.jsx)(M,{arrayIndex:e.arrayIndex,propertyKey:e.propertyKey}),(0,A.jsxs)(`span`,{className:`text-foreground`,children:[a,o,e.trailingComma?`,`:``]})]}):(0,A.jsxs)(`div`,{className:`grid min-w-max`,children:[(0,A.jsxs)(`button`,{"aria-expanded":t,className:`grid min-w-max grid-cols-[16px_auto] items-center gap-1 rounded-lg py-0.5 pr-2 text-left transition duration-200 hover:bg-accent/45 hover:text-accent-foreground`,onClick:()=>n(e=>!e),style:{paddingLeft:`${e.depth*le}px`},type:`button`,children:[(0,A.jsx)(`span`,{className:`grid h-4 w-4 place-items-center text-muted-foreground [&_svg]:h-3 [&_svg]:w-3`,children:t?(0,A.jsx)(h,{icon:g,"aria-hidden":`true`}):(0,A.jsx)(h,{icon:ne,"aria-hidden":`true`})}),(0,A.jsxs)(`span`,{className:`whitespace-pre`,children:[(0,A.jsx)(M,{arrayIndex:e.arrayIndex,propertyKey:e.propertyKey}),t?(0,A.jsx)(`span`,{className:`text-foreground`,children:a}):(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:s}),!t&&e.trailingComma?(0,A.jsx)(`span`,{className:`text-foreground`,children:`,`}):null]})]}),t?(0,A.jsxs)(A.Fragment,{children:[i.map(([t,n],a)=>(0,A.jsx)(de,{arrayIndex:r===void 0?void 0:Number(t),depth:e.depth+1,path:`${e.path}.${t}`,propertyKey:r===void 0?t:void 0,trailingComma:a<i.length-1,value:n},`${e.path}.${t}`)),(0,A.jsxs)(`div`,{className:`min-w-max whitespace-pre text-foreground`,style:{paddingLeft:`${j(e.depth)}px`},children:[o,e.trailingComma?`,`:``]})]}):null]})}function j(e){return e*le+ue}function M(e){return e.propertyKey===void 0?e.arrayIndex===void 0?null:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[`[`,e.arrayIndex,`]`]}),(0,A.jsx)(`span`,{className:`text-foreground`,children:` `})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:JSON.stringify(e.propertyKey)}),(0,A.jsx)(`span`,{className:`text-foreground`,children:`: `})]})}function pe(e){return typeof e.value==`string`?(0,A.jsx)(`span`,{className:`text-foreground`,children:JSON.stringify(e.value)}):typeof e.value==`number`?(0,A.jsx)(`span`,{className:`text-foreground`,children:String(e.value)}):typeof e.value==`boolean`?(0,A.jsx)(`span`,{className:`text-chart-4`,children:String(e.value)}):e.value===null?(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`null`}):e.value===void 0?(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`undefined`}):(0,A.jsx)(`span`,{className:`text-foreground`,children:se(e.value)})}function me(e){return Array.isArray(e)||s(e)}function he(e){return e.label===`Message Id`}function ge(e){let t=`h-3.5 w-3.5 shrink-0`;switch(e.label){case`System prompt`:return(0,A.jsx)(h,{icon:oe,"aria-hidden":`true`,className:t});case`Prompt`:return(0,A.jsx)(h,{icon:x,"aria-hidden":`true`,className:t});case`Output`:case`Assistant output`:return(0,A.jsx)(h,{icon:re,"aria-hidden":`true`,className:t});default:return null}}function _e(e,t){if(e===`Output`){let e=ve(t);if(e.length>0)return e}let n=N(t,e);if(n.length>0)return n;if(!s(t))return[{label:e,text:Se(t)}];let r=[];for(let[e,n]of Object.entries(t)){let t=N(n,e);if(t.length>0){r.push(...t);continue}r.push({label:F(e),text:Se(n)})}return r.length>0?r:[{label:e,text:`Empty object`}]}function ve(e){if(!s(e))return[];let t=[],n=N(e.choice,`choice`);return t.push(...n),typeof e.messageId==`string`&&e.messageId.length>0&&t.push({label:`Message Id`,text:e.messageId}),t}function N(e,t){if(typeof e==`string`&&t===void 0)return[{label:`Value`,text:e}];if(Array.isArray(e))return t===`chatHistory`?ye(e):t===`history`?be(e):e.map((e,n)=>({label:P(e,n,t),text:S(e)||u(e)})).filter(e=>e.text.length>0);if(!s(e))return[];let n=Array.isArray(e.chatHistory)?e.chatHistory:void 0;if(n!==void 0){let t=xe(e);return t.push(...N(n,`chatHistory`)),t}if(Array.isArray(e.prompt))return N(e.prompt,`prompt`);let r=[];r.push(...xe(e));let i=Array.isArray(e.history)?e.history:[];i.length>0&&r.push(...N(i,`history`));let a=S(e.prompt);return a.length>0&&r.push({label:i.length>0?`Current prompt`:`Prompt`,text:a}),r}function ye(e){let t=e.map((e,t)=>({label:P(e,t,`chatHistory`),text:S(e)||u(e)})).filter(e=>e.text.length>0),n=t.at(-1),r=t.slice(0,-1),i=[];return r.length>0&&i.push({label:`Conversation history (${r.length})`,text:r.map((e,t)=>`${t+1}. ${e.label}\n${e.text}`).join(`
|
|
2
|
+
|
|
3
|
+
`)}),n!==void 0&&i.push({label:r.length>0?`Current prompt`:`Prompt`,text:n.text}),i}function be(e){let t=e.map((e,t)=>({label:P(e,t,`history`),text:S(e)||u(e)})).filter(e=>e.text.length>0);return t.length===0?[]:[{label:`Conversation history (${t.length})`,text:t.map((e,t)=>`${t+1}. ${e.label}\n${e.text}`).join(`
|
|
4
|
+
|
|
5
|
+
`)}]}function P(e,t,n){if(s(e)){let t=typeof e.type==`string`?e.type:void 0;if(n===`choice`){if(t===`text`)return`Assistant output`;if(t===`reasoning`)return`Reasoning`}if(t===`reasoning`)return`Reasoning`;if(typeof e.role==`string`)return F(e.role);if(t!==void 0)return F(t)}return`${n===void 0?`Item`:`${F(n)} item`} ${t+1}`}function F(e){return e.replace(/[_-]+/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).trim().replace(/\b\w/g,e=>e.toUpperCase())}function xe(e){let t=e.instructions;return typeof t!=`string`||t.trim().length===0?[]:[{label:`System prompt`,text:t}]}function Se(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Ce(e){let t=new Map;for(let n of e.observations){let e=Number.isFinite(n.turn)?n.turn:t.size+1;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].sort(([e],[t])=>e-t).map(([e,t])=>({turn:e,observations:t,durationMs:t.reduce((e,t)=>e+(t.durationMs??0),0)}))}function we(e){let t=new Map;for(let n of e)t.set(n.id,{observation:n,children:[]});let n=[];for(let r of e){let e=t.get(r.id);if(e===void 0)continue;let i=r.parentObservationId,a=i===void 0?void 0:t.get(i);a===void 0?n.push(e):a.children.push(e)}return n}function Te(e,t,n){if(n===`agent`)return{title:`agent.run`,tone:`agent`,startedAt:o(e.startedAt),durationMs:e.durationMs,firstDeltaMs:R(e.observations),usage:d(e.usage),input:e.input,output:e.output,error:e.error,metadata:Ee(e)};if(n.startsWith(`turn:`)){let r=Number(n.slice(5)),i=t.find(e=>e.turn===r);return{title:`turn.${Number.isFinite(r)?r:1}`,tone:`turn`,startedAt:o(i?.observations[0]?.startedAt??e.startedAt),durationMs:i?.durationMs,firstDeltaMs:R(i?.observations??[]),usage:ze(i?.observations??[]),input:i?.observations[0]?.input,output:i?.observations.at(-1)?.output,metadata:De(r,i?.observations??[])}}if(n.startsWith(`observation:`)){let t=n.slice(12),r=e.observations.find(e=>e.id===t);if(r!==void 0)return{title:L(r),tone:r.kind,startedAt:o(r.startedAt),durationMs:r.durationMs,firstDeltaMs:z(r.metadata),usage:B(r),input:r.input,output:r.output,error:r.error,metadata:Oe(r)}}return{title:e.name??`Agent`,tone:`trace`,startedAt:o(e.startedAt),durationMs:e.durationMs,firstDeltaMs:R(e.observations),usage:d(e.usage),input:e.input,output:e.output,error:e.error,metadata:Ee(e)}}function Ee(e){let t=s(e.metadata)?e.metadata:{},n=I({status:e.status,traceId:e.trace?.traceId??e.id,observationId:e.trace?.observationId,sessionId:e.sessionId,observationCount:e.observationCount,messageCount:Fe(t.messages),startedAt:e.startedAt,endedAt:e.endedAt,durationMs:e.durationMs});return I({...t,status:e.status,traceId:e.trace?.traceId??e.id,observationId:e.trace?.observationId,sessionId:e.sessionId,observationCount:e.observationCount,messageCount:Fe(t.messages),startedAt:e.startedAt,endedAt:e.endedAt,durationMs:e.durationMs,trace:s(t.trace)?t.trace:n})}function De(e,t){return I({turn:e,observationCount:t.length,generationCount:t.filter(e=>e.kind===`generation`).length,toolCount:t.filter(e=>e.kind===`tool`).length,agentCount:t.filter(e=>e.kind===`agent`).length,firstDeltaMs:R(t),status:Pe(t),startedAt:t[0]?.startedAt,endedAt:t.at(-1)?.endedAt})}function Oe(e){let t=I({...s(e.metadata)?e.metadata:{},status:e.status,kind:e.kind,turn:e.turn,parentObservationId:e.parentObservationId??null,startedAt:e.startedAt,endedAt:e.endedAt??null,durationMs:e.durationMs});return I({...t,trace:s(t.trace)?t.trace:I({status:e.status,kind:e.kind,turn:e.turn,parentObservationId:e.parentObservationId??null,startedAt:e.startedAt,endedAt:e.endedAt??null,durationMs:e.durationMs}),modelInfo:s(t.modelInfo)?t.modelInfo:ke(t),modelCall:s(t.modelCall)?t.modelCall:Ae(t),response:s(t.response)?t.response:je(t),tools:s(t.tools)?t.tools:Me(t),timing:s(t.timing)?t.timing:Ne(t)})}function ke(e){let t=I({provider:e.provider,model:e.model,requestedModel:e.requestedModel,defaultModel:e.defaultModel});return Object.keys(t).length===0?void 0:t}function Ae(e){let t=I({messageCount:e.historyCount,documentCount:e.documentCount,toolCount:e.toolCount,toolNames:e.toolNames,temperature:e.temperature,maxTokens:e.maxTokens,toolChoice:e.toolChoice,hasOutputSchema:e.hasOutputSchema,additionalParamKeys:e.additionalParamKeys}),n=I({request:Object.keys(t).length===0?void 0:t,providerRequest:e.providerRequest});return Object.keys(n).length===0?void 0:n}function je(e){let t=I({messageId:e.messageId,usage:e.usage,providerResponse:e.providerResponse});return Object.keys(t).length===0?void 0:t}function Me(e){let t=I({count:e.toolCount,names:e.toolNames,toolChoice:e.toolChoice,internalCallId:e.internalCallId,toolCallId:e.toolCallId,skipped:e.skipped,description:e.toolDescription,parameterKeys:e.parameterKeys,requiredParameterKeys:e.requiredParameterKeys,approvalRequired:e.approvalRequired,mcpServerName:e.mcpServerName,argumentBytes:e.argumentBytes,resultBytes:e.resultBytes});return Object.keys(t).length===0?void 0:t}function Ne(e){let t=I({firstDeltaMs:e.firstDeltaMs,durationMs:e.durationMs,startedAt:e.startedAt,endedAt:e.endedAt});return Object.keys(t).length===0?void 0:t}function Pe(e){return e.length===0?`empty`:e.some(e=>e.status===`error`)?`error`:e.some(e=>e.status===`running`)?`running`:`success`}function Fe(e){return Array.isArray(e)?e.length:void 0}function I(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function L(e){return e.kind===`agent`?e.name:e.kind===`tool`?`tool.${e.name}`:e.name}function R(e){for(let t of e){let e=z(t.metadata);if(e!==void 0)return e}}function z(e){if(!(!s(e)||typeof e.firstDeltaMs!=`number`))return e.firstDeltaMs}function Ie(e){switch(e){case`success`:return`bg-foreground`;case`error`:return`bg-destructive`;case`running`:return`bg-muted-foreground`}}function Le(e){switch(e.tone){case`trace`:return(0,A.jsx)(h,{icon:f,"aria-hidden":`true`});case`agent`:return(0,A.jsx)(h,{icon:p,"aria-hidden":`true`});case`turn`:return(0,A.jsx)(h,{icon:ae,"aria-hidden":`true`});case`generation`:return(0,A.jsx)(h,{icon:ie,"aria-hidden":`true`});case`tool`:return(0,A.jsx)(h,{icon:D,"aria-hidden":`true`})}}function Re(e){switch(e){case`trace`:return`bg-foreground text-background`;case`agent`:return`bg-muted-foreground text-background`;case`turn`:return`bg-chart-4 text-background`;case`generation`:return`bg-foreground text-background`;case`tool`:return`bg-destructive text-background`}}function B(e){return!s(e.output)||!s(e.output.usage)?``:Be(e.output.usage)}function ze(e){return e.map(B).filter(e=>e.length>0).join(` + `)}function Be(e){let t=typeof e.inputTokens==`number`?e.inputTokens:0,n=typeof e.outputTokens==`number`?e.outputTokens:0,r=typeof e.totalTokens==`number`?e.totalTokens:t+n;return r===0?``:`${t} -> ${n} (Σ ${r})`}function Ve({className:e,...t}){return(0,A.jsx)(`div`,{className:r(`rounded-xl border border-border/80 bg-card/95 text-card-foreground shadow-sm shadow-black/20`,e),...t})}function He(e,t){return k.useReducer((e,n)=>t[e][n]??e,e)}var V=`ScrollArea`,[Ue,We]=m(V),[Ge,H]=Ue(V),Ke=k.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=k.useState(null),[l,u]=k.useState(null),[d,f]=k.useState(null),[p,m]=k.useState(null),[h,g]=k.useState(null),[_,v]=k.useState(0),[x,S]=k.useState(0),[C,w]=k.useState(!1),[T,E]=k.useState(!1),D=y(t,e=>c(e)),O=ee(i);return(0,A.jsx)(Ge,{scope:n,type:r,dir:O,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:C,onScrollbarXEnabledChange:w,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:T,onScrollbarYEnabledChange:E,onCornerWidthChange:v,onCornerHeightChange:S,children:(0,A.jsx)(b.div,{dir:O,...o,ref:D,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":x+`px`,...e.style}})})});Ke.displayName=V;var qe=`ScrollAreaViewport`,Je=k.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=H(qe,n),s=y(t,k.useRef(null),o.onViewportChange);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ye,{nonce:i}),(0,A.jsx)(b.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,A.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Je.displayName=qe;var Ye=k.memo(({nonce:e})=>(0,A.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e}),(e,t)=>e.nonce===t.nonce),U=`ScrollAreaScrollbar`,Xe=k.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=H(U,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return k.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,A.jsx)(Ze,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,A.jsx)(Qe,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,A.jsx)($e,{...r,ref:t,forceMount:n}):i.type===`always`?(0,A.jsx)(W,{...r,ref:t,"data-state":`visible`}):null});Xe.displayName=U;var Ze=k.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=H(U,e.__scopeScrollArea),[a,o]=k.useState(!1);return k.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,A.jsx)(C,{present:n||a,children:(0,A.jsx)($e,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Qe=k.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=H(U,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Y(()=>c(`SCROLL_END`),100),[s,c]=He(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return k.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),k.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,A.jsx)(C,{present:n||s!==`hidden`,children:(0,A.jsx)(W,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:v(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:v(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),$e=k.forwardRef((e,t)=>{let n=H(U,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=k.useState(!1),s=e.orientation===`horizontal`,c=Y(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return X(n.viewport,c),X(n.content,c),(0,A.jsx)(C,{present:r||a,children:(0,A.jsx)(W,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),W=k.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=H(U,e.__scopeScrollArea),a=k.useRef(null),o=k.useRef(0),[s,c]=k.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=lt(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return ut(e,o.current,s,t)}return n===`horizontal`?(0,A.jsx)(et,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=dt(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,A.jsx)(tt,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=dt(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),et=k.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=H(U,e.__scopeScrollArea),[o,s]=k.useState(),c=k.useRef(null),l=y(t,c,a.onScrollbarXChange);return k.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,A.jsx)(it,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":J(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),pt(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:q(o.paddingLeft),paddingEnd:q(o.paddingRight)}})}})}),tt=k.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=H(U,e.__scopeScrollArea),[o,s]=k.useState(),c=k.useRef(null),l=y(t,c,a.onScrollbarYChange);return k.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,A.jsx)(it,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":J(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),pt(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:q(o.paddingTop),paddingEnd:q(o.paddingBottom)}})}})}),[nt,rt]=Ue(U),it=k.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=H(U,n),[m,ee]=k.useState(null),h=y(t,e=>ee(e)),g=k.useRef(null),_=k.useRef(``),x=p.viewport,S=r.content-r.viewport,C=T(u),w=T(c),E=Y(d,10);function D(e){g.current&&l({x:e.clientX-g.current.left,y:e.clientY-g.current.top})}return k.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&C(e,S)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[x,m,S,C]),k.useEffect(w,[r,w]),X(m,E),X(p.content,E),(0,A.jsx)(nt,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:T(a),onThumbPointerUp:T(o),onThumbPositionChange:w,onThumbPointerDown:T(s),children:(0,A.jsx)(b.div,{...f,ref:h,style:{position:`absolute`,...f.style},onPointerDown:v(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),g.current=m.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),D(e))}),onPointerMove:v(e.onPointerMove,D),onPointerUp:v(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=_.current,p.viewport&&(p.viewport.style.scrollBehavior=``),g.current=null})})})}),G=`ScrollAreaThumb`,at=k.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=rt(G,e.__scopeScrollArea);return(0,A.jsx)(C,{present:n||i.hasThumb,children:(0,A.jsx)(ot,{ref:t,...r})})}),ot=k.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=H(G,n),o=rt(G,n),{onThumbPositionChange:s}=o,c=y(t,e=>o.onThumbChange(e)),l=k.useRef(void 0),u=Y(()=>{l.current&&=(l.current(),void 0)},100);return k.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=mt(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,A.jsx)(b.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:v(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:v(e.onPointerUp,o.onThumbPointerUp)})});at.displayName=G;var K=`ScrollAreaCorner`,st=k.forwardRef((e,t)=>{let n=H(K,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,A.jsx)(ct,{...e,ref:t}):null});st.displayName=K;var ct=k.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=H(K,n),[a,o]=k.useState(0),[s,c]=k.useState(0),l=!!(a&&s);return X(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),X(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,A.jsx)(b.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function q(e){return e?parseInt(e,10):0}function lt(e,t){let n=e/t;return isNaN(n)?0:n}function J(e){let t=lt(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ut(e,t,n,r=`ltr`){let i=J(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return ft([c,l],d)(e)}function dt(e,t,n=`ltr`){let r=J(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=w(e,n===`ltr`?[0,o]:[o*-1,0]);return ft([0,o],[0,s])(c)}function ft(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function pt(e,t){return e>0&&e<t}var mt=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Y(e,t){let n=T(e),r=k.useRef(0);return k.useEffect(()=>()=>window.clearTimeout(r.current),[]),k.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function X(e,t){let n=T(t);E(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var ht=Ke,gt=Je,_t=st;function vt({className:e,children:t,...n}){return(0,A.jsxs)(ht,{className:r(`relative overflow-hidden`,e),...n,children:[(0,A.jsx)(gt,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,A.jsx)(yt,{}),(0,A.jsx)(_t,{})]})}function yt({className:e,orientation:t=`vertical`,...n}){return(0,A.jsx)(Xe,{orientation:t,className:r(`flex touch-none select-none transition-colors`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent p-px`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent p-px`,e),...n,children:(0,A.jsx)(at,{className:`relative flex-1 rounded-lg bg-muted-foreground/40`})})}function bt(e){if(!e.tracesEnabled)return(0,A.jsx)(`div`,{className:`w-full rounded-lg border border-dashed border-border p-8 text-sm font-medium text-muted-foreground`,children:`Tracing is disabled`});let t=e.selectedTraceId.length===0?void 0:e.traces.find(t=>t.id===e.selectedTraceId),n=t===void 0||e.traceSessionDetailId!==t.sessionId?[]:e.traces.filter(e=>e.sessionId===t.sessionId);return(0,A.jsx)(`section`,{className:`grid h-full min-h-0 w-full content-stretch pb-6 pl-0 pr-6`,"aria-label":`Tracing`,children:e.selectedTraceId.length===0?(0,A.jsx)(xt,{agents:e.agents,traces:e.traces,traceLoadState:e.traceLoadState,onSelectTrace:e.onSelectTrace}):(0,A.jsx)(St,{selectedTrace:t,selectedSessionTraces:n,selectedTraceId:e.selectedTraceId,traceLoadState:e.traceLoadState,onBack:()=>e.onSelectTrace(``),onShowSessionTraces:e.onShowSessionTraces})})}function xt(e){return(0,A.jsx)(Ve,{className:`min-h-0 overflow-hidden rounded-xl border-border/80 bg-card/80`,"aria-label":`Traces`,children:(0,A.jsx)(vt,{className:`h-full min-h-0`,children:(0,A.jsxs)(`div`,{className:`grid min-w-280 gap-1 p-2`,children:[(0,A.jsxs)(`div`,{className:`sticky top-0 z-10 grid min-h-11 grid-cols-[minmax(220px,1.3fr)_150px_120px_120px_120px_120px_110px_90px] items-center gap-4 rounded-lg border border-border/60 bg-card/95 px-4 text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground backdrop-blur`,children:[(0,A.jsx)(`span`,{children:`Trace`}),(0,A.jsx)(`span`,{children:`Session`}),(0,A.jsx)(`span`,{children:`Agent`}),(0,A.jsx)(`span`,{children:`Status`}),(0,A.jsx)(`span`,{children:`Started`}),(0,A.jsx)(`span`,{children:`Duration`}),(0,A.jsx)(`span`,{children:`First delta`}),(0,A.jsx)(`span`,{children:`Events`})]}),e.traceLoadState===`loading`&&e.traces.length===0?(0,A.jsx)(`div`,{className:`px-5 py-4 text-sm font-medium text-muted-foreground`,children:`Loading traces`}):null,e.traceLoadState===`idle`&&e.traces.length===0?(0,A.jsx)(`div`,{className:`px-5 py-4 text-sm font-medium text-muted-foreground`,children:`No traces found`}):null,e.traces.map(t=>(0,A.jsxs)(_,{className:`grid h-auto min-h-14 w-full grid-cols-[minmax(220px,1.3fr)_150px_120px_120px_120px_120px_110px_90px] items-center justify-start gap-4 whitespace-normal rounded-lg border border-transparent bg-transparent px-4 py-2.5 text-left text-muted-foreground shadow-none transition duration-200 hover:border-border/70 hover:bg-accent/70 hover:text-accent-foreground`,type:`button`,variant:`ghost`,onClick:()=>e.onSelectTrace(t.id),children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-muted-foreground`,children:t.id}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium`,children:t.sessionId}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium`,children:c(e.agents,t)}),(0,A.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium capitalize`,children:[(0,A.jsx)(`span`,{className:r(`h-2.5 w-2.5 shrink-0 rounded-lg`,Ie(t.status))}),(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:t.status})]}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium`,children:a(t.startedAt)}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium`,children:l(i(t.durationMs))}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium`,children:l(i(R(t.observations)))}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium tabular-nums`,children:t.observationCount})]},t.id))]})})})}function St(e){return(0,A.jsxs)(`div`,{className:`grid h-full min-h-0 min-w-0 grid-rows-[auto_minmax(0,1fr)] gap-2 overflow-hidden rounded-xl border border-border/80 bg-card/70 p-2 shadow-sm`,children:[(0,A.jsxs)(`header`,{className:`grid min-h-16 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 overflow-hidden rounded-lg border border-border/60 bg-card/95 px-4 py-3`,children:[(0,A.jsx)(_,{"aria-label":`Back to traces`,className:`h-8 min-h-8 w-8 text-muted-foreground hover:text-foreground`,size:`icon`,type:`button`,variant:`ghost`,onClick:e.onBack,children:(0,A.jsx)(h,{icon:te,"aria-hidden":`true`})}),(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-1`,children:[(0,A.jsx)(`strong`,{className:`min-w-0 truncate text-sm font-semibold text-foreground`,children:e.selectedTrace?.name??`Trace detail`}),(0,A.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 overflow-hidden text-xs font-medium text-muted-foreground`,children:e.selectedTrace===void 0?e.traceLoadState===`loading`?`Loading trace`:`Trace not found`:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:r(`h-2 w-2 shrink-0 rounded-lg`,Ie(e.selectedTrace.status))}),(0,A.jsx)(`span`,{className:`shrink-0 capitalize`,children:e.selectedTrace.status}),(0,A.jsx)(`span`,{className:`shrink-0`,"aria-hidden":`true`,children:`/`}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Session `,(0,A.jsx)(`span`,{className:` font-semibold`,children:e.selectedTrace.sessionId})]})]})})]}),(0,A.jsx)(`span`,{className:`hidden max-w-[42vw] truncate rounded-lg bg-muted px-2 py-1 text-xs font-medium text-muted-foreground md:block`,children:e.selectedTraceId})]}),(0,A.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden`,children:e.selectedTrace===void 0?(0,A.jsx)(Ve,{className:`grid h-full place-items-center rounded-lg border-border bg-card p-6 text-sm font-medium text-muted-foreground`,children:e.traceLoadState===`loading`?`Loading trace`:`Trace not found`}):(0,A.jsx)(Ct,{traces:e.selectedSessionTraces.length>0?e.selectedSessionTraces:[e.selectedTrace],onShowSessionTraces:e.onShowSessionTraces})})]})}function Ct(e){let t=(0,k.useMemo)(()=>[...e.traces].sort((e,t)=>Date.parse(e.startedAt)-Date.parse(t.startedAt)),[e.traces]),n=t[0]?.id??``,[r,a]=(0,k.useState)(n),[o,s]=(0,k.useState)(`trace`);(0,k.useEffect)(()=>{a(n),s(`trace`)},[n]);let c=t.find(e=>e.id===r)??t[0],l=c===void 0?[]:Ce(c),u=(e,t)=>{a(e),s(t)};return c===void 0?(0,A.jsx)(`section`,{className:`grid h-full min-h-0 w-full place-items-center text-sm font-medium text-muted-foreground`,"aria-label":`Traces`,children:`No trace selected`}):(0,A.jsx)(`section`,{className:`grid h-full min-h-0 w-full content-stretch overflow-hidden`,"aria-label":`Traces`,children:(0,A.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-[320px_minmax(0,1fr)] overflow-hidden max-md:grid-cols-1`,children:[(0,A.jsxs)(`nav`,{className:`grid min-h-0 auto-rows-min content-start overflow-auto border-r border-border/80 bg-card/35 pr-2 max-md:max-h-80 max-md:border-b max-md:border-r-0`,"aria-label":`Trace timeline`,children:[(0,A.jsxs)(`div`,{className:`sticky top-0 z-30 flex min-h-11 items-center justify-between bg-card/90 py-0 pl-0 pr-5 text-xs font-medium text-muted-foreground backdrop-blur`,children:[(0,A.jsx)(`span`,{children:`Search`}),(0,A.jsx)(`strong`,{className:`text-foreground`,children:`Timeline`})]}),t.map(e=>{let t=c.id===e.id,n=Ce(e);return(0,A.jsxs)(`div`,{className:`contents`,children:[(0,A.jsx)(Z,{active:t&&o===`trace`,ancestorLevels:[],hasChildren:!0,isLastSibling:!0,level:0,tone:`trace`,title:e.name??`Agent`,subtitle:i(e.durationMs),onSelect:()=>u(e.id,`trace`)}),(0,A.jsx)(Z,{active:t&&o===`agent`,ancestorLevels:[],hasChildren:n.length>0,isLastSibling:!0,level:1,tone:`agent`,title:`agent.run`,subtitle:i(e.durationMs),onSelect:()=>u(e.id,`agent`)}),n.map(r=>(0,A.jsxs)(`div`,{className:`contents`,children:[(0,A.jsx)(Z,{active:t&&o===`turn:${r.turn}`,ancestorLevels:[],hasChildren:r.observations.length>0,isLastSibling:r.turn===n.at(-1)?.turn,level:2,tone:`turn`,title:`turn.${r.turn}`,subtitle:i(r.durationMs),onSelect:()=>u(e.id,`turn:${r.turn}`)}),(0,A.jsx)(wt,{activeKey:o,isLastTurn:r.turn===n.at(-1)?.turn,observations:r.observations,onSelect:t=>u(e.id,`observation:${t}`),traceActive:t})]},`${e.id}:turn:${r.turn}`))]},e.id)})]}),(0,A.jsx)(Et,{trace:c,turns:l,activeKey:o,onShowSessionTraces:e.onShowSessionTraces})]})})}function Z(e){let t=e=>22+e*22;return(0,A.jsxs)(_,{className:r(`relative grid h-auto min-h-0 w-full min-w-0 grid-cols-[20px_minmax(0,1fr)] items-start justify-start gap-2 whitespace-normal rounded-lg border-0 bg-transparent px-3 py-2.5 text-left text-muted-foreground shadow-none transition duration-200 hover:bg-accent/70 hover:text-accent-foreground`,e.active&&`bg-muted/45 text-foreground hover:bg-muted/45 hover:text-foreground`),type:`button`,variant:`ghost`,onClick:e.onSelect,style:{paddingLeft:`${12+e.level*22}px`},children:[e.ancestorLevels.map(e=>(0,A.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 w-px bg-muted-foreground/35`,style:{left:`${t(e)}px`},"aria-hidden":`true`},`ancestor-line-${e}`)),e.level>0?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`pointer-events-none absolute top-0 w-px bg-muted-foreground/35`,style:{left:`${t(e.level-1)}px`,height:`18px`},"aria-hidden":`true`}),e.isLastSibling?null:(0,A.jsx)(`span`,{className:`pointer-events-none absolute bottom-0 w-px bg-muted-foreground/35`,style:{left:`${t(e.level-1)}px`,top:`18px`},"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`pointer-events-none absolute h-px bg-muted-foreground/35`,style:{left:`${t(e.level-1)}px`,top:`18px`,width:`22px`},"aria-hidden":`true`})]}):null,e.hasChildren?(0,A.jsx)(`span`,{className:`pointer-events-none absolute bottom-0 w-px bg-muted-foreground/35`,style:{left:`${t(e.level)}px`,top:`18px`},"aria-hidden":`true`}):null,(0,A.jsx)(`span`,{className:r(`relative z-10 grid h-5 w-5 place-items-center rounded-lg bg-transparent [&_svg]:h-3 [&_svg]:w-3 [&_svg]:opacity-100`,Re(e.tone)),children:(0,A.jsx)(Le,{tone:e.tone})}),(0,A.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,A.jsx)(`strong`,{className:`min-w-0 truncate text-sm font-medium leading-5 text-current`,children:e.title}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-muted-foreground`,children:e.subtitle})]})]})}function wt(e){let t=we(e.observations);return(0,A.jsx)(A.Fragment,{children:t.map((n,r)=>(0,A.jsx)(Tt,{activeKey:e.activeKey,ancestorLevels:e.isLastTurn?[]:[1],isLastSibling:r===t.length-1,level:3,node:n,onSelect:e.onSelect,traceActive:e.traceActive},n.observation.id))})}function Tt(e){let t=B(e.node.observation),n=e.isLastSibling?e.ancestorLevels:[...e.ancestorLevels,e.level];return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Z,{active:e.traceActive&&e.activeKey===`observation:${e.node.observation.id}`,ancestorLevels:e.ancestorLevels,hasChildren:e.node.children.length>0,isLastSibling:e.isLastSibling,level:e.level,tone:e.node.observation.kind,title:L(e.node.observation),subtitle:t.length>0?`${i(e.node.observation.durationMs)} · ${t}`:i(e.node.observation.durationMs),onSelect:()=>e.onSelect(e.node.observation.id)}),e.node.children.map((t,r)=>(0,A.jsx)(Tt,{activeKey:e.activeKey,ancestorLevels:n,isLastSibling:r===e.node.children.length-1,level:e.level+1,node:t,onSelect:e.onSelect,traceActive:e.traceActive},t.observation.id))]})}function Et(e){let t=Te(e.trace,e.turns,e.activeKey);return(0,A.jsxs)(`section`,{className:`grid min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden bg-card/70`,"aria-label":`Trace detail`,children:[(0,A.jsx)(`header`,{className:`border-b border-border/60 bg-card/70 px-6 py-5`,children:(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,A.jsx)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,A.jsx)(`span`,{className:r(`grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-foreground text-background [&_svg]:h-4 [&_svg]:w-4 [&_svg]:opacity-100`,t.tone!==`trace`&&`bg-muted text-foreground`,Re(t.tone)),children:(0,A.jsx)(Le,{tone:t.tone})}),(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-1`,children:[(0,A.jsx)(`h2`,{className:`m-0 min-w-0 truncate text-2xl font-semibold leading-none tracking-[-0.01em] text-foreground`,children:t.title}),(0,A.jsx)(`div`,{className:` text-xs font-medium text-muted-foreground`,children:t.startedAt})]})]})}),(0,A.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[repeat(auto-fit,minmax(150px,1fr))] gap-2`,children:[(0,A.jsx)(Q,{label:`Duration`,value:i(t.durationMs)}),t.firstDeltaMs===void 0?null:(0,A.jsx)(Q,{label:`First delta`,value:i(t.firstDeltaMs)}),t.usage.length===0?null:(0,A.jsx)(Q,{label:`Usage`,value:t.usage}),(0,A.jsxs)(`button`,{className:`grid min-w-0 gap-1 rounded-lg bg-card/85 px-4 py-3 text-left transition duration-200 hover:bg-accent hover:text-accent-foreground`,type:`button`,onClick:()=>e.onShowSessionTraces(e.trace.sessionId),children:[(0,A.jsx)(`span`,{className:` text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:`Session`}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold text-current`,children:e.trace.sessionId})]})]})]})}),(0,A.jsx)(`div`,{className:`min-w-0 overflow-auto`,children:(0,A.jsxs)(`div`,{className:`grid min-w-0 content-start gap-6 p-6`,children:[t.input===void 0?null:(0,A.jsx)($,{title:`Input`,value:t.input}),t.output===void 0?null:(0,A.jsx)($,{title:`Output`,value:t.output,tone:`success`}),t.error===void 0?null:(0,A.jsx)($,{title:`Error`,value:t.error,tone:`error`}),(0,A.jsx)($,{title:`Metadata`,value:t.metadata,rawJson:!0})]})})]})}function Q(e){return(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-1 rounded-lg bg-card/85 px-4 py-3`,children:[(0,A.jsx)(`span`,{className:` text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:e.label}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold text-foreground`,children:e.value})]})}function $(e){let t=_e(e.title,e.value);return(0,A.jsxs)(`section`,{className:`grid min-w-0 gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`h3`,{className:`m-0 text-lg font-semibold leading-tight text-foreground`,children:e.title}),(0,A.jsx)(`span`,{className:`h-px flex-1 bg-border/80`,"aria-hidden":`true`})]}),e.rawJson?(0,A.jsx)(ce,{value:e.value}):(0,A.jsx)(`div`,{className:`grid min-w-0 gap-3`,children:t.map(t=>(0,A.jsxs)(`article`,{className:r(`grid min-w-0 gap-3 rounded-lg bg-card/85 px-4 py-4`,e.compact&&`grid-cols-[150px_minmax(0,1fr)] items-start gap-4 max-lg:grid-cols-1`),children:[(0,A.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:[(0,A.jsx)(ge,{label:t.label}),t.label]}),(0,A.jsx)(Dt,{compact:e.compact,item:t,tone:e.tone})]},`${t.label}-${t.text}`))})]})}function Dt(e){let t=Ot(e.item);return t.length>0?(0,A.jsx)(`div`,{className:`grid min-w-0 gap-5`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(`span`,{className:` text-xs font-semibold tabular-nums text-muted-foreground`,children:e.index}),(0,A.jsx)(O,{className:r(`px-1.5 py-0.5`,e.role===`User`&&`border-border/80 bg-muted-foreground/15 text-muted-foreground`,e.role===`Assistant`&&`border-border/80 bg-foreground/15 text-foreground`,e.role===`Tool`&&`border-destructive/40 bg-destructive/15 text-destructive`),children:e.role})]}),(0,A.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-7 text-foreground [overflow-wrap:anywhere]`,children:e.text})]},`${e.index}-${e.role}-${e.text}`))}):(0,A.jsx)(`p`,{className:r(`m-0 whitespace-pre-wrap text-sm leading-7 text-foreground [overflow-wrap:anywhere]`,e.compact&&` text-sm leading-6`,e.tone===`success`&&!he(e.item)&&`text-foreground`,e.tone===`error`&&`text-destructive`),children:e.item.text})}function Ot(e){return e.label.startsWith(`Conversation history`)?e.text.split(`
|
|
6
|
+
|
|
7
|
+
`).flatMap(e=>{let[t,...n]=e.split(`
|
|
8
|
+
`),r=/^(\d+)\.\s+(.+)$/.exec(t??``);return r===null?[]:[{index:r[1]??``,role:r[2]??`Message`,text:n.join(`
|
|
9
|
+
`)}]}):[]}export{bt as TraceBrowser};
|
|
10
|
+
//# sourceMappingURL=trace-browser-41yNH-qC.js.map
|