@datalayer/agent-runtimes 1.6.30 → 1.6.33
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-embed/chunks/AgentInspector-C66D0b0W.js +1 -0
- package/dist-embed/chunks/{AgentInspectorDialog-DTQHUrHA.js → AgentInspectorDialog-DeK96QG1.js} +1 -1
- package/dist-embed/datalayer-app-main.js +8 -8
- package/lib/examples/pap/traces/account-tokens.json +6 -8
- package/lib/examples/pap/traces/conversation-control.json +16 -18
- package/lib/examples/pap/traces/conversation-streaming.json +10 -12
- package/lib/examples/pap/traces/mediated-sign-in.json +6 -8
- package/lib/examples/pap/traces/operations.json +38 -32
- package/lib/examples/pap/traces/two-companies.json +40 -37
- package/lib/examples/pap/traces/user-with-a-company.json +22 -22
- package/lib/portable/displays.d.ts +8 -1
- package/lib/portable/displays.js +46 -3
- package/package.json +2 -2
- package/dist-embed/chunks/AgentInspector-CPJcLyP9.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,B as s,I as te,T as f,r as p,ds as ce,f2 as ue,bB as P,dr as U,L,f3 as fe,f4 as J,v as V,P as xe,f5 as he,V as pe,f6 as me,e6 as G,bs as D,f7 as ge,f8 as be,f9 as X,fa as je,fb as Se}from"../datalayer-app-main.js";import{B as M,U as B}from"./index-BbcMy3Al.js";const ye={default:{bg:"canvas.default",borderColor:"border.default"},subtle:{bg:"canvas.subtle",borderColor:"border.default"},inset:{bg:"canvas.inset",borderColor:"border.default"},accent:{bg:"accent.subtle",borderColor:"accent.muted"},success:{bg:"success.subtle",borderColor:"success.muted"},attention:{bg:"attention.subtle",borderColor:"attention.muted"},danger:{bg:"danger.subtle",borderColor:"danger.muted"}},_e={sage:"--bgColor-success-emphasis",steel:"--bgColor-accent-emphasis",mauve:"--bgColor-done-emphasis",clay:"--bgColor-severe-emphasis"},we=e=>{const n=`var(${_e[e]})`;return`linear-gradient(160deg, color-mix(in srgb, ${n} 82%, black), color-mix(in srgb, ${n} 58%, black))`},ve=e=>({backgroundImage:`var(--metal-gradient-${e}, ${we(e)})`,color:"#FFFFFF","--fgColor-default":"#FFFFFF","--fgColor-muted":"rgba(255, 255, 255, 0.85)"}),Ce="card",ne={none:"none",small:"shadow.small",medium:"shadow.medium",large:"shadow.large",extraLarge:"shadow.extraLarge"},ke={cursor:"pointer",textAlign:"left",font:"inherit",transition:"border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",hover:{borderColor:"accent.emphasis",boxShadow:ne.medium},focusVisible:{outline:"2px solid",outlineColor:"accent.emphasis",outlineOffset:"2px"},reducedMotion:{transition:"none"}},E="cubic-bezier(0.22, 1, 0.36, 1)",re="data-card-icon",K=`[${re}]`,Ie=["&:hover","&:focus-visible","&:has(:focus-visible)"];function Ae(e){const n={boxShadow:"shadow.large",transform:"translateY(-3px)",borderColor:e},r={transition:`box-shadow 260ms ${E}, transform 260ms ${E}, border-color 260ms ${E}`,"&::after":{content:'""',position:"absolute",top:0,left:0,right:0,height:"2px",background:"linear-gradient(90deg, transparent, var(--fgColor-accent), transparent)",opacity:0,pointerEvents:"none",transition:`opacity 260ms ${E}`}},o={transition:`box-shadow 260ms ${E}, border-color 260ms ${E}`,[`& ${K}`]:{transition:"none"}};for(const a of Ie)r[a]=n,r[`${a}::after`]={opacity:1},r[`${a} ${K}`]={transform:"scale(1.06) rotate(-3deg)"},o[a]={transform:"none"},o[`${a} ${K}`]={transform:"none"};return r["@media (prefers-reduced-motion: reduce)"]=o,r}const Te={cursor:"not-allowed",opacity:.6,hover:{}},C=e=>{const{rounded:n,border:r,shadow:o,variant:a="default",surface:i,interactive:d,selected:x,dashed:u,disabled:h,accent:c,hoverEffect:m,sx:j,style:S,children:g,...z}=e,l=m==="lift"&&!h,y=r||d||x||u||l,b=ye[a],I=l?Ae(d?"accent.emphasis":"border.muted"):void 0,w=I?{...I,...j}:j;return t.jsx(s,{display:"flex",flexDirection:"column",...i?void 0:{bg:x?"accent.subtle":b.bg},color:"fg.default",borderRadius:n??Ce,boxShadow:ne[o??(i?"none":"small")],...y?{border:"1px solid",borderColor:x?"accent.emphasis":b.borderColor}:void 0,...u?{borderStyle:"dashed"}:void 0,...c?{borderTop:"3px solid",borderTopColor:c}:void 0,...d?ke:void 0,...h?Te:void 0,...d&&h?{"aria-disabled":!0}:void 0,...l?{position:"relative",overflow:"hidden"}:void 0,...z,style:i?{...ve(i),...S}:S,sx:w,children:g})};C.Header=e=>{const{title:n,description:r,leadingVisual:o,action:a}=e;return t.jsxs(s,{display:"flex",alignItems:"center",p:3,children:[o&&t.jsx(s,{mr:3,children:t.jsx(te,{size:"medium",icon:o,"aria-label":""})}),t.jsxs(s,{flexGrow:1,children:[t.jsx(f,{as:"div",display:"block",children:n}),t.jsx(f,{display:"block",color:"fg.muted",children:r})]}),a&&t.jsx(s,{children:a})]})};C.Image=({url:e,image:n,svg:r,height:o})=>t.jsxs(s,{display:"block",width:"100%",height:`${o}px`,backgroundImage:e?`url(${e})`:void 0,backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center",objectFit:"cover",children:[n&&t.jsx("img",{src:n,style:{maxHeight:`${o}px`}}),r&&t.jsx("img",{src:`data:image/svg+xml;utf8,${r}`,style:{maxHeight:o}})]});C.Cover=({height:e=110,image:n,gradient:r,color:o="neutral.emphasis",accessory:a,children:i,...d})=>t.jsxs(s,{position:"relative",width:"100%",height:`${e}px`,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bg:o,backgroundImage:n?`url(${n})`:r?`linear-gradient(135deg, ${r.from} 0%, ${r.to} 100%)`:void 0,backgroundSize:"cover",backgroundPosition:"center",color:"fg.onEmphasis",fontSize:4,fontWeight:"semibold",...d,children:[i,a&&t.jsx(s,{position:"absolute",top:2,right:2,display:"flex",alignItems:"center",gap:1,children:a})]});C.Content=({children:e,...n})=>t.jsx(s,{display:"block",p:3,...n,children:e});C.Footer=({children:e,...n})=>t.jsx(s,{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",mt:"auto",px:3,py:2,borderTop:"1px solid",borderColor:"border.muted",...n,children:e});C.Icon=({icon:e,color:n="accent.fg",bg:r="accent.subtle",size:o=46,...a})=>t.jsx(s,{[re]:"",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:o,height:o,borderRadius:`${Math.round(o*13/46)}px`,color:n,bg:r,mb:3,boxShadow:"inset 0 0 0 1px currentColor",transition:`transform 320ms ${E}`,...a,children:t.jsx(e,{size:Math.round(o*22/46),fill:"currentColor"})});C.Glass=({children:e,style:n,...r})=>t.jsx(s,{p:3,border:"1px solid",borderRadius:"bubble",...r,style:{background:"var(--metal-glass-bg, rgba(255, 255, 255, 0.16))",borderColor:"var(--metal-glass-border, rgba(255, 255, 255, 0.28))",...n},children:e});C.Actions=({children:e})=>t.jsx(s,{display:"block",p:3,mt:"auto",children:e});function N(e){const n=Number(e);return!isNaN(n)&&n>1e15?n/1e6:!isNaN(n)&&n>1e12?n/1e3:isNaN(n)?new Date(String(e)).getTime():n}function Y(e){return e==null?"—":e<.001?"<1µs":e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(1)}ms`:e<6e4?`${(e/1e3).toFixed(2)}s`:`${(e/6e4).toFixed(1)}m`}function ze(e){if(e==null||e==="")return"—";try{const n=N(e),r=new Date(n);return isNaN(r.getTime())?String(e):r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}catch{return String(e)}}const Q=["#0969da","#1a7f37","#cf222e","#8250df","#bf8700","#0550ae","#116329","#a40e26","#6639ba","#953800","#0e8a16","#e36209"];function $e(e){let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Q[Math.abs(n)%Q.length]}function oe(e){const n=new Map,r=e.map(i=>({...i,children:[],depth:0}));for(const i of r)n.set(i.span_id,i);const o=[];for(const i of r)if(i.parent_span_id&&n.has(i.parent_span_id)){const d=n.get(i.parent_span_id);d.children=d.children??[],d.children.push(i)}else o.push(i);function a(i,d){i.depth=d;for(const x of i.children??[])a(x,d+1)}for(const i of o)a(i,0);return o}const Oe="peer.service";function Ee(e,n){return e.service_name===n||e.attributes?.[Oe]===n}function Re(e,n){return n?e.filter(r=>Ee(r,n)):[...e]}const Z=[],Fe=()=>()=>{};function Ne(e){return p.useSyncExternalStore(e?e.subscribe:Fe,()=>e?e.spans():Z,()=>e?e.spans():Z)}const De="140px 1fr 160px 90px",Me="96px minmax(0, 1fr) 96px 64px";function Be(e){const n=e.attributes;if(!n)return null;const r=n["gen_ai.usage.input_tokens"]!=null?Number(n["gen_ai.usage.input_tokens"]):void 0,o=n["gen_ai.usage.output_tokens"]!=null?Number(n["gen_ai.usage.output_tokens"]):void 0;return r==null&&o==null?null:{input:r,output:o}}const Le=({spans:e,loading:n,selectedSpanId:r,onSelectSpan:o,emptyText:a,compact:i=!1,defaultExpanded:d=!1,renderSpanMark:x,describeSpan:u})=>{const[h,c]=p.useState(new Set),m=p.useMemo(()=>({has:l=>d?!h.has(l):h.has(l)}),[h,d]),j=i?Me:De,S=p.useMemo(()=>oe(e),[e]),g=p.useMemo(()=>{const l=[];function y(b,I){const w=b.children??[];if(l.push({span:b,depth:I,hasChildren:w.length>0}),m.has(b.span_id))for(const O of w)y(O,I+1)}for(const b of S)y(b,0);return l},[S,m]),z=p.useCallback(l=>{c(y=>{const b=new Set(y);return b.has(l)?b.delete(l):b.add(l),b})},[]);return n?t.jsx(s,{display:"flex",justifyContent:"center",p:5,children:t.jsx(ce,{size:"medium"})}):e.length===0?t.jsxs(M,{children:[t.jsx(M.Visual,{children:t.jsx(ue,{size:24})}),t.jsx(M.Heading,{children:"No traces found"}),t.jsx(M.Description,{children:a??"Send some telemetry data first."})]}):t.jsxs(s,{width:"100%",flex:1,minHeight:0,overflow:"auto",children:[t.jsx(s,{display:"grid",gridTemplateColumns:j,gap:2,px:3,position:"sticky",top:0,bg:"canvas.subtle",zIndex:1,borderBottom:"2px solid",borderColor:"border.default",children:["Time","Message","Scope","Duration"].map(l=>t.jsx(f,{sx:{fontWeight:"bold",fontSize:0,color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em",py:2,...l==="Duration"?{textAlign:"right"}:{}},children:l},l))}),g.map(({span:l,depth:y,hasChildren:b},I)=>{const w=r===l.span_id,O=m.has(l.span_id),A=y*(i?12:20),k=u?.(l);return t.jsxs(s,{"data-otel-span":l.span_id,"data-otel-span-name":l.span_name,onClick:()=>{b&&z(l.span_id),o?.(l)},display:"grid",gridTemplateColumns:j,gap:2,px:3,py:"5px",cursor:"pointer",bg:w?"accent.subtle":y>0?"canvas.inset":"canvas.default",borderBottom:"1px solid",borderColor:"border.muted",hover:{bg:w?"accent.subtle":"canvas.subtle"},children:[t.jsx(f,{sx:{fontSize:i?0:1,fontFamily:"mono",color:"fg.muted",whiteSpace:"nowrap",lineHeight:"22px"},children:ze(l.start_time)}),t.jsxs(s,{display:"flex",alignItems:"center",gap:1,overflow:"hidden",lineHeight:"22px",pl:`${A}px`,children:[b?t.jsx(s,{flexShrink:0,color:"fg.muted",display:"flex",alignItems:"center",children:O?t.jsx(P,{size:14}):t.jsx(U,{size:14})}):y>0?t.jsx(s,{flexShrink:0,width:"14px",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.subtle",fontSize:0,children:"─"}):null,x?.(l),t.jsx(f,{sx:{fontSize:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:k?0:1,maxWidth:k?"60%":void 0},title:l.span_name,children:l.span_name}),l.in_progress&&t.jsx(L,{variant:"attention",size:"small",children:"running"}),l.status_code==="ERROR"&&t.jsx(L,{variant:"danger",size:"small",children:"ERROR"}),(()=>{const $=Be(l);return $?t.jsxs(C,{border:!0,shadow:"none",display:"inline-flex",alignItems:"center",gap:"2px",px:1,fontSize:"10px",fontFamily:"mono",color:"fg.muted",flexShrink:0,lineHeight:"16px",children:[$.input!=null&&t.jsxs(s,{display:"inline-flex",alignItems:"center",gap:"1px",children:[t.jsx(f,{sx:{fontSize:"9px",color:"fg.subtle"},children:"↗"}),t.jsx(f,{children:$.input})]}),$.output!=null&&t.jsxs(s,{display:"inline-flex",alignItems:"center",gap:"1px",children:[t.jsx(f,{sx:{fontSize:"9px",color:"fg.subtle"},children:"↙"}),t.jsx(f,{children:$.output})]})]}):null})(),k&&t.jsx(f,{sx:{fontSize:1,color:"fg.muted",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:k,"data-otel-span-description":"",children:k}),l.otel_scope_name&&!i&&t.jsx(L,{size:"small",variant:"secondary",sx:{flexShrink:0,fontSize:"10px"},children:l.otel_scope_name})]}),t.jsx(f,{sx:{fontSize:1,color:"fg.muted",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"22px"},title:`${l.service_name} / ${l.otel_scope_name??""}`,children:l.service_name}),t.jsx(f,{sx:{fontSize:1,fontFamily:"mono",textAlign:"right",lineHeight:"22px",color:l.duration_ms!=null&&l.duration_ms>1e3?"danger.fg":"fg.default"},children:l.in_progress?"…":Y(l.duration_ms)})]},`${l.trace_id}-${l.span_id}-${I}`)})]})},We=20,se=({span:e,depth:n,selectedSpanId:r,onSelectSpan:o,expandedIds:a,toggleExpanded:i,traceMinTime:d,traceDuration:x})=>{const u=(e.children?.length??0)>0,h=a.has(e.span_id),c=r===e.span_id,m=$e(e.service_name),j=(N(e.start_time)-d)/x*100,S=Math.max((e.duration_ms||0)/x*100,.5);return t.jsxs(t.Fragment,{children:[t.jsxs(s,{display:"flex",alignItems:"center",height:28,pl:`${n*We}px`,pr:2,cursor:"pointer",bg:c?"accent.subtle":"canvas.default",borderBottom:"1px solid",borderColor:"border.muted",hover:{bg:c?"accent.subtle":"canvas.subtle"},onClick:()=>o?.(e),children:[t.jsx(s,{width:20,textAlign:"center",color:"fg.muted",userSelect:"none",flexShrink:0,cursor:u?"pointer":"default",onClick:g=>{g.stopPropagation(),u&&i(e.span_id)},children:u?h?t.jsx(P,{size:12}):t.jsx(U,{size:12}):t.jsx(f,{sx:{color:"fg.subtle",fontSize:0},children:"·"})}),t.jsx(s,{width:8,height:8,borderRadius:"50%",bg:m,flexShrink:0,mr:1}),t.jsx(f,{sx:{flex:"0 0 200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:1,fontWeight:c?"bold":"normal"},title:`${e.service_name} / ${e.span_name}`,children:e.span_name}),t.jsx(s,{flex:1,position:"relative",height:12,bg:"canvas.subtle",borderRadius:1,mx:2,overflow:"hidden",children:t.jsx(s,{position:"absolute",left:`${j}%`,width:`${S}%`,height:"100%",bg:m,borderRadius:1,opacity:c?1:.7})}),t.jsx(f,{sx:{minWidth:60,textAlign:"right",fontSize:0,fontFamily:"mono",color:"fg.muted",flexShrink:0},children:Y(e.duration_ms)})]}),u&&h&&e.children.map(g=>t.jsx(se,{span:g,depth:n+1,selectedSpanId:r,onSelectSpan:o,expandedIds:a,toggleExpanded:i,traceMinTime:d,traceDuration:x},g.span_id))]})},Pe=({spans:e,selectedSpanId:n,onSelectSpan:r,defaultExpandDepth:o=2})=>{const a=p.useMemo(()=>{const c=new Set;function m(j,S){for(const g of j)S<o&&c.add(g.span_id),g.children&&m(g.children,S+1)}return m(e,0),c},[e,o]),[i,d]=p.useState(a),x=p.useCallback(c=>{d(m=>{const j=new Set(m);return j.has(c)?j.delete(c):j.add(c),j})},[]),{traceMinTime:u,traceDuration:h}=p.useMemo(()=>{let c=1/0,m=-1/0;function j(S){for(const g of S){const z=N(g.start_time),l=N(g.end_time);z<c&&(c=z),l>m&&(m=l),g.children&&j(g.children)}}return j(e),c===1/0?{traceMinTime:0,traceDuration:1}:{traceMinTime:c,traceDuration:m-c||1}},[e]);return e.length===0?t.jsx(s,{p:3,color:"fg.muted",textAlign:"center",children:t.jsx(f,{children:"No span tree to display."})}):t.jsxs(s,{width:"100%",overflow:"auto",children:[t.jsxs(s,{display:"flex",alignItems:"center",height:28,px:2,borderBottom:"2px solid",borderColor:"border.default",bg:"canvas.subtle",children:[t.jsx(s,{width:20}),t.jsx(s,{width:8,mr:1}),t.jsx(f,{sx:{flex:"0 0 200px",fontSize:0,fontWeight:"bold",color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Span"}),t.jsx(f,{sx:{flex:1,mx:2,fontSize:0,fontWeight:"bold",color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Timeline"}),t.jsx(f,{sx:{minWidth:60,textAlign:"right",fontSize:0,fontWeight:"bold",color:"fg.muted",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Duration"})]}),e.map(c=>t.jsx(se,{span:c,depth:0,selectedSpanId:n,onSelectSpan:r,expandedIds:i,toggleExpanded:x,traceMinTime:u,traceDuration:h},c.span_id))]})},v=({label:e,value:n,mono:r=!1})=>n==null||n===""?null:t.jsxs(s,{display:"flex",py:1,borderBottom:"1px solid",borderColor:"border.muted",gap:2,children:[t.jsx(f,{sx:{width:140,minWidth:140,color:"fg.muted",fontSize:1,fontWeight:"bold"},children:e}),t.jsx(f,{sx:{fontSize:1,fontFamily:r?"mono":"normal",wordBreak:"break-all"},children:String(n)})]}),ee=({title:e,data:n,defaultOpen:r=!1})=>{const[o,a]=p.useState(r);return!n||Object.keys(n).length===0?null:t.jsxs(s,{mt:3,children:[t.jsxs(s,{display:"flex",alignItems:"center",gap:1,cursor:"pointer",py:1,userSelect:"none",onClick:()=>a(!o),children:[o?t.jsx(P,{size:16}):t.jsx(U,{size:16}),t.jsx(f,{sx:{fontSize:1,fontWeight:"bold"},children:e}),t.jsx(J,{children:Object.keys(n).length})]}),o&&t.jsx(C,{border:!0,shadow:"none",variant:"subtle",display:"block",p:2,mt:1,overflowX:"auto",children:Object.entries(n).map(([i,d])=>t.jsx(W,{attrKey:i,value:d,depth:0},i))})]})};function Ue(e){if(typeof e!="string")return e;const n=e.trim();if(!/^[[{]/.test(n))return e;try{const r=JSON.parse(n);return typeof r=="object"&&r!==null?r:e}catch{return e}}const W=({attrKey:e,value:n,depth:r})=>{const o=p.useMemo(()=>Ue(n),[n]),[a,i]=p.useState(r<1),d=typeof o=="object"&&o!==null&&!Array.isArray(o),x=Array.isArray(o),u=d||x;return t.jsxs(s,{borderBottom:r===0?"1px solid":"none",borderColor:"border.muted",pb:r===0?1:0,mb:r===0?1:0,children:[t.jsxs(s,{display:"flex",gap:2,py:1,pl:r*16+"px",alignItems:"flex-start",children:[u?t.jsx(s,{cursor:"pointer",color:"fg.muted",userSelect:"none",width:16,flexShrink:0,onClick:()=>i(!a),children:a?t.jsx(P,{size:12}):t.jsx(U,{size:12})}):t.jsx(s,{width:16,flexShrink:0}),t.jsx(f,{sx:{color:"accent.fg",fontSize:1,fontFamily:"mono",minWidth:180,wordBreak:"break-all",flexShrink:0},children:e}),!u&&t.jsx(f,{sx:{fontSize:1,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",color:typeof o=="string"?"accent.emphasis":"attention.fg"},children:typeof o=="string"?o:JSON.stringify(o)}),u&&!a&&t.jsx(f,{sx:{fontSize:0,color:"fg.muted",fontFamily:"mono"},children:x?`[${o.length} items]`:`{${Object.keys(o).length} keys}`})]}),u&&a&&t.jsx(s,{children:x?o.map((h,c)=>t.jsx(W,{attrKey:`[${c}]`,value:h,depth:r+1},c)):Object.entries(o).map(([h,c])=>t.jsx(W,{attrKey:h,value:c,depth:r+1},h))})]})},He=({span:e,traceSpans:n,onClose:r})=>{const[o,a]=p.useState("details");if(!e)return t.jsx(s,{p:5,color:"fg.muted",textAlign:"center",children:t.jsx(f,{children:"Select a span to view details."})});const i={},d={};if(e.attributes)for(const[u,h]of Object.entries(e.attributes))u.startsWith("gen_ai.")||u.startsWith("model_request")?i[u]=h:d[u]=h;const x=n&&n.length>0?oe(n):void 0;return t.jsxs(s,{height:"100%",overflow:"auto",borderLeft:"1px solid",borderColor:"border.default",bg:"canvas.default",display:"flex",flexDirection:"column",children:[t.jsxs(s,{px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",display:"flex",justifyContent:"space-between",alignItems:"center",bg:"canvas.subtle",flexShrink:0,children:[t.jsx(f,{sx:{fontSize:2,fontWeight:"bold"},children:e.span_name}),r&&t.jsx(te,{icon:fe,"aria-label":"Close detail panel",variant:"invisible",size:"small",onClick:r})]}),t.jsxs(B,{"aria-label":"Span detail tabs",children:[t.jsx(B.Item,{"aria-current":o==="details"?"page":void 0,onClick:()=>a("details"),children:"Details"}),x&&t.jsx(B.Item,{"aria-current":o==="tree"?"page":void 0,onClick:()=>a("tree"),children:"Trace Tree"}),t.jsx(B.Item,{"aria-current":o==="raw"?"page":void 0,onClick:()=>a("raw"),children:"Raw Data"})]}),t.jsxs(s,{flex:1,overflow:"auto",children:[o==="details"&&t.jsxs(s,{p:3,children:[t.jsx(v,{label:"span_name",value:e.span_name}),t.jsx(v,{label:"service_name",value:e.service_name}),t.jsx(v,{label:"otel_scope_name",value:e.otel_scope_name}),t.jsx(v,{label:"kind",value:e.kind}),t.jsx(v,{label:"trace_id",value:e.trace_id,mono:!0}),t.jsx(v,{label:"span_id",value:e.span_id,mono:!0}),t.jsx(v,{label:"parent_span_id",value:e.parent_span_id,mono:!0}),t.jsx(v,{label:"duration",value:Y(e.duration_ms)}),t.jsx(v,{label:"start_time",value:e.start_time,mono:!0}),t.jsx(v,{label:"end_time",value:e.end_time,mono:!0}),t.jsx(v,{label:"status_code",value:e.status_code}),t.jsx(v,{label:"status_message",value:e.status_message}),t.jsx(ee,{title:"Arguments",data:i,defaultOpen:Object.keys(i).length>0}),t.jsx(ee,{title:"Attributes",data:d}),e.events&&e.events.length>0&&t.jsxs(s,{mt:3,children:[t.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[t.jsx(f,{sx:{fontWeight:"bold",fontSize:1},children:"Events"}),t.jsx(J,{children:e.events.length})]}),e.events.map((u,h)=>t.jsxs(C,{border:!0,shadow:"none",variant:"subtle",display:"block",p:2,mt:2,children:[t.jsxs(s,{display:"flex",gap:2,children:[t.jsx(L,{children:u.name}),t.jsx(f,{sx:{fontSize:0,color:"fg.muted",fontFamily:"mono"},children:u.timestamp})]}),u.attributes&&Object.keys(u.attributes).length>0&&t.jsx(s,{mt:1,children:Object.entries(u.attributes).map(([c,m])=>t.jsx(W,{attrKey:c,value:m,depth:0},c))})]},h))]}),e.links&&e.links.length>0&&t.jsxs(s,{mt:3,children:[t.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[t.jsx(f,{sx:{fontWeight:"bold",fontSize:1},children:"Links"}),t.jsx(J,{children:e.links.length})]}),e.links.map((u,h)=>t.jsxs(f,{sx:{display:"block",fontSize:1,fontFamily:"mono",py:1,borderBottom:"1px solid",borderColor:"border.muted"},children:["trace: ",u.trace_id," → span: ",u.span_id]},h))]})]}),o==="tree"&&x&&t.jsx(Pe,{spans:x,selectedSpanId:e.span_id,defaultExpandDepth:4}),o==="raw"&&t.jsx(s,{as:"pre",p:3,fontSize:0,fontFamily:"mono",whiteSpace:"pre-wrap",wordBreak:"break-word",m:0,bg:"canvas.subtle",children:JSON.stringify(e,null,2)})]})]})},Ve=[{label:"Service",value:e=>e.service_name},{label:"Kind",value:e=>e.kind}];function Ge(e,n,r){return e.filter(o=>n.every((a,i)=>{const d=r[i];if(!d?.size)return!0;const x=a.value(o);return x!==void 0&&d.has(x)}))}function Ke(e,n){const r=new Set(e);return r.has(n)?r.delete(n):r.add(n),r}function Je({facet:e,options:n,selected:r,onChange:o}){const a=e.name??(i=>i);return t.jsxs(G,{children:[t.jsxs(G.Button,{size:"small","data-otel-facet":e.label.toLowerCase(),children:[e.label,r.size?` · ${r.size}`:""]}),t.jsx(G.Overlay,{width:"auto",children:t.jsxs(D,{selectionVariant:"multiple","aria-label":e.label,children:[t.jsx(D.Item,{selected:!r.size,onSelect:()=>o(new Set),children:"All"}),t.jsx(D.Divider,{}),n.map(i=>t.jsx(D.Item,{selected:r.has(i),onSelect:()=>o(Ke(r,i)),children:a(i)},i))]})})]})}function Xe(e,n){const r=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=`${e}.json`,a.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}const Ye=({tracer:e,spans:n,service:r,facets:o=Ve,compact:a=!1,maxHeight:i=420,detailPlacement:d="below",emptyText:x="Nothing recorded yet.",exportName:u="otel-spans",label:h="Spans",renderSpanMark:c,describeSpan:m})=>{const j=Ne(n?null:e),S=n??j,[g,z]=p.useState(0),[l,y]=p.useState(null),[b,I]=p.useState(()=>o.map(()=>new Set)),[w,O]=p.useState(null),A=p.useMemo(()=>{const _=Re(S,r);return g?_.filter(T=>N(T.start_time)>=g):_},[S,r,g]),k=l??A,$=l?A.length-l.length:0,ie=p.useMemo(()=>o.map(_=>[...new Set(A.map(T=>_.value(T)).filter(T=>T!==void 0))].sort()),[o,A]),R=p.useMemo(()=>Ge(k,o,b),[k,o,b]),F=p.useMemo(()=>w?S.find(_=>_.span_id===w)??null:null,[S,w]),le=p.useMemo(()=>F?S.filter(_=>_.trace_id===F.trace_id):[],[S,F]),H=d==="side"&&!a;return t.jsxs(C,{border:!0,shadow:"none",display:"block","data-otel-live-spans":"",color:"fg.default",minWidth:0,children:[t.jsxs(s,{role:"toolbar","aria-label":h,display:"flex",flexWrap:"wrap",gap:2,alignItems:"center",p:2,borderBottom:"1px solid",borderColor:"border.default",children:[o.map((_,T)=>t.jsx(Je,{facet:_,options:ie[T]??[],selected:b[T]??new Set,onChange:ae=>I(de=>o.map((Ze,q)=>q===T?ae:de[q]??new Set))},_.label)),t.jsx(s,{flex:1}),t.jsxs(f,{sx:{fontSize:0,color:"fg.muted"},"data-otel-span-count":"",children:[R.length===k.length?`${R.length} ${R.length===1?"span":"spans"}`:`${R.length} of ${k.length}`,$>0?` · ${$} new`:""]}),t.jsx(V,{size:"small",leadingVisual:l?xe:he,"aria-pressed":l!==null,onClick:()=>y(l?null:A),"data-otel-pause":"",children:l?"Resume":"Pause"}),t.jsx(V,{size:"small",leadingVisual:pe,onClick:()=>{y(null),O(null),e&&!n&&!r?e.clear():z(Date.now())},"data-otel-clear":"",children:"Clear"}),t.jsx(V,{size:"small",leadingVisual:me,disabled:!A.length,onClick:()=>Xe(u,{exportedAt:new Date().toISOString(),spans:[...A]}),"data-otel-export":"",children:"Export"})]}),t.jsxs(s,{display:H?"grid":"block",gridTemplateColumns:H?"minmax(0, 3fr) minmax(0, 2fr)":void 0,children:[t.jsx(s,{maxHeight:i,overflowY:"auto",minWidth:0,children:t.jsx(Le,{spans:R,selectedSpanId:w,onSelectSpan:_=>O(_.span_id),emptyText:x,compact:a,defaultExpanded:!0,renderSpanMark:c,describeSpan:m})}),F&&t.jsx(s,{"data-otel-live-detail":"",maxHeight:i,overflowY:"auto",minWidth:0,borderTop:H?"none":"1px solid",borderColor:"border.default",children:t.jsx(He,{span:F,traceSpans:le,onClose:()=>O(null)})})]})]})},qe=[{label:"Source",value:be,name:e=>ge[e]??e},{label:"Operation",value:e=>{const n=e.attributes??{},r=n[X.operation]??n["rpc.method"];return r===void 0?void 0:String(r)}},{label:"Agent",value:e=>e.service_name}];function Qe(e){const n=e.attributes?.[X.markIcon],r=e.attributes?.[X.markEmoji];return n||r?t.jsx(Se,{icon:typeof n=="string"?n:void 0,emoji:typeof r=="string"?r:void 0,size:14}):null}function nt({tracer:e,spans:n,agent:r,maxHeight:o=420,compact:a=!1,emptyText:i="Nothing recorded yet.",exportName:d="agent-inspector"}){return t.jsx("div",{"data-agent-inspector":r??"",children:t.jsx(Ye,{tracer:e,spans:n,service:r,facets:qe,compact:a,maxHeight:o,detailPlacement:"side",emptyText:i,exportName:d,label:r?`${r}'s Agent Inspector`:"Agent Inspector",renderSpanMark:Qe,describeSpan:je})})}export{qe as AGENT_INSPECTOR_FACETS,nt as AgentInspector,nt as default};
|
package/dist-embed/chunks/{AgentInspectorDialog-DTQHUrHA.js → AgentInspectorDialog-DeK96QG1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,D as n,r as t,T as i,_ as c}from"../datalayer-app-main.js";const g=t.lazy(()=>c(()=>import("./AgentInspector-
|
|
1
|
+
import{j as e,D as n,r as t,T as i,_ as c}from"../datalayer-app-main.js";const g=t.lazy(()=>c(()=>import("./AgentInspector-C66D0b0W.js"),[],import.meta.url));function d({tracer:r,title:a="Agent Inspector",agent:o,onClose:s}){return e.jsx(n,{title:a,onClose:s,width:"xlarge",height:"large","data-agent-inspector-dialog":"",children:e.jsx(t.Suspense,{fallback:e.jsx(i,{sx:{color:"fg.muted"},children:"Loading the Agent Inspector…"}),children:e.jsx(g,{tracer:r,agent:o,maxHeight:"calc(80vh - 140px)",emptyText:"Nothing recorded yet: what the agent does shows here as it does it."})})})}export{d as AgentInspectorDialog,d as default};
|