@mastra/playground-ui 5.0.1-alpha.6 → 5.0.1-alpha.9

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.cjs.js CHANGED
@@ -3907,7 +3907,7 @@ const AssistantActionBar = () => {
3907
3907
  };
3908
3908
 
3909
3909
  const UserMessage = () => {
3910
- return /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Root, { className: "w-full flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-4 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Content, {}) }) });
3910
+ return /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Root, { className: "w-full flex justify-end pb-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Content, {}) }) });
3911
3911
  };
3912
3912
 
3913
3913
  const useAutoscroll = (ref, { enabled = true }) => {
@@ -4979,10 +4979,6 @@ function usePolling({
4979
4979
  };
4980
4980
  }
4981
4981
 
4982
- function formatDuration(duration, fixedPoint = 2) {
4983
- const durationInSecs = duration / 1e3;
4984
- return durationInSecs.toFixed(fixedPoint);
4985
- }
4986
4982
  function formatOtelTimestamp(otelTimestamp) {
4987
4983
  const date = new Date(otelTimestamp / 1e3);
4988
4984
  return new Intl.DateTimeFormat("en-US", {
@@ -5234,13 +5230,12 @@ const TraceRow = ({ trace, index, isActive }) => {
5234
5230
  const hasFailure = trace.trace.some((span) => span.status.code !== 0);
5235
5231
  return /* @__PURE__ */ jsxRuntime.jsxs(Row, { className: isActive ? "bg-surface4" : "", onClick: () => openTrace(trace.trace, index), children: [
5236
5232
  /* @__PURE__ */ jsxRuntime.jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
5237
- /* @__PURE__ */ jsxRuntime.jsx(TxtCell, { children: trace.traceId }),
5238
- /* @__PURE__ */ jsxRuntime.jsx(UnitCell, { unit: "ms", children: trace.duration / 1e3 }),
5239
- /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => openTrace(trace.trace, index), children: /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(TraceIcon, {}), children: [
5240
- trace.trace.length,
5241
- " span",
5242
- trace.trace.length > 1 ? "s" : ""
5243
- ] }) }) }),
5233
+ /* @__PURE__ */ jsxRuntime.jsxs(TxtCell, { title: trace.traceId, children: [
5234
+ trace.traceId.substring(0, 7),
5235
+ "..."
5236
+ ] }),
5237
+ /* @__PURE__ */ jsxRuntime.jsx(UnitCell, { unit: "ms", children: Math.round(trace.duration / 1e3) }),
5238
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => openTrace(trace.trace, index), children: /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(TraceIcon, {}), children: trace.trace.length }) }) }),
5244
5239
  /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: hasFailure ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: "Failed" }) : /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}), variant: "success", children: "Success" }) })
5245
5240
  ] });
5246
5241
  };
@@ -5250,11 +5245,11 @@ const TracesTable = ({ traces, isLoading, error }) => {
5250
5245
  const colsCount = 4;
5251
5246
  return /* @__PURE__ */ jsxRuntime.jsxs(Table, { size: "small", children: [
5252
5247
  /* @__PURE__ */ jsxRuntime.jsxs(Thead, { children: [
5253
- /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Time" }),
5248
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 120, children: "Time" }),
5254
5249
  /* @__PURE__ */ jsxRuntime.jsx(Th, { width: "auto", children: "Trace Id" }),
5255
- /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Duration" }),
5256
- /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Spans" }),
5257
- /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Status" })
5250
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 120, children: "Duration" }),
5251
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 120, children: "Spans" }),
5252
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 120, children: "Status" })
5258
5253
  ] }),
5259
5254
  isLoading ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsxRuntime.jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) })
5260
5255
  ] });
@@ -5376,11 +5371,11 @@ const variantClasses = {
5376
5371
  };
5377
5372
  const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
5378
5373
  const variantClass = variant ? variantClasses[variant] : "bg-accent3";
5379
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[166px] shrink-0", children: [
5374
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[80px] xl:w-[166px] shrink-0", children: [
5380
5375
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("absolute h-1 rounded-full", variantClass), style: { width: `${progressPercent}%` } }) }),
5381
5376
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
5382
5377
  /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
5383
- durationMs,
5378
+ Math.round(durationMs),
5384
5379
  "ms"
5385
5380
  ] }),
5386
5381
  tokenCount && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
@@ -5563,7 +5558,7 @@ const HeaderGroup = ({ children }) => {
5563
5558
  };
5564
5559
 
5565
5560
  function TraceDetails() {
5566
- const { trace, currentTraceIndex, prevTrace, nextTrace, traces, clearData } = React.useContext(TraceContext);
5561
+ const { trace, currentTraceIndex, prevTrace, nextTrace, traces } = React.useContext(TraceContext);
5567
5562
  const actualTrace = traces[currentTraceIndex];
5568
5563
  if (!actualTrace || !trace) return null;
5569
5564
  const hasFailure = trace.some((span) => span.status.code !== 0);
@@ -5584,7 +5579,7 @@ function TraceDetails() {
5584
5579
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 justify-between w-full", children: [
5585
5580
  /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5 shrink-0", children: [
5586
5581
  "Trace ",
5587
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 5) })
5582
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 7) })
5588
5583
  ] }),
5589
5584
  hasFailure && /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: "Failed" })
5590
5585
  ] })
@@ -5616,7 +5611,7 @@ const SyntaxHighlighter = ({ data }) => {
5616
5611
  };
5617
5612
 
5618
5613
  function SpanDetail() {
5619
- const { span, setSpan, trace } = React.useContext(TraceContext);
5614
+ const { span, setSpan, trace, setIsOpen } = React.useContext(TraceContext);
5620
5615
  if (!span || !trace) return null;
5621
5616
  const prevSpan = () => {
5622
5617
  const currentIndex = trace.findIndex((t) => t.id === span.id);
@@ -5640,8 +5635,9 @@ function SpanDetail() {
5640
5635
  ] }),
5641
5636
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5", as: "h2", children: [
5642
5637
  "Span ",
5643
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: span.id.substring(0, 5) })
5644
- ] }) })
5638
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: span.id.substring(0, 7) })
5639
+ ] }) }),
5640
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { className: "bg-transparent border-none", onClick: () => setIsOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) }) }) })
5645
5641
  ] }),
5646
5642
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5", children: [
5647
5643
  /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "header-md", as: "h3", className: "text-icon-6 flex items-center gap-4 pb-3", children: [
@@ -5649,11 +5645,11 @@ function SpanDetail() {
5649
5645
  span.name
5650
5646
  ] }),
5651
5647
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 items-center", children: span.status.code === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(LatencyIcon, {}), variant: "success", children: [
5652
- formatDuration(span.duration),
5648
+ Math.round(span.duration / 1e3),
5653
5649
  "ms"
5654
5650
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: [
5655
5651
  "Failed in ",
5656
- formatDuration(span.duration),
5652
+ Math.round(span.duration / 1e3),
5657
5653
  "ms"
5658
5654
  ] }) }),
5659
5655
  /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-border1 border-sm my-5" }),
@@ -5726,10 +5722,10 @@ const TracesSidebar = ({ onResize }) => {
5726
5722
  return /* @__PURE__ */ jsxRuntime.jsx(
5727
5723
  MastraResizablePanel,
5728
5724
  {
5729
- className: "h-full",
5730
- defaultWidth: 70,
5725
+ className: "h-full absolute right-0 inset-y-0 bg-surface2",
5726
+ defaultWidth: 80,
5731
5727
  minimumWidth: 50,
5732
- maximumWidth: 70,
5728
+ maximumWidth: 80,
5733
5729
  setCurrentWidth: onResize,
5734
5730
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full grid grid-cols-2", children: [
5735
5731
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-scroll w-full h-[calc(100%-40px)]", children: /* @__PURE__ */ jsxRuntime.jsx(TraceDetails, {}) }),
@@ -5747,7 +5743,7 @@ function AgentTracesInner({ agentName, baseUrl, className }) {
5747
5743
  const { traces, firstCallLoading, error } = useTraces(agentName, baseUrl);
5748
5744
  const { isOpen: open } = React.useContext(TraceContext);
5749
5745
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("h-full relative overflow-hidden flex", className), children: [
5750
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("h-full overflow-y-scroll", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
5746
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
5751
5747
  open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
5752
5748
  ] });
5753
5749
  }
@@ -6207,7 +6203,7 @@ function WorkflowTracesInner({ workflowName, baseUrl }) {
6207
6203
  const { traces, error, firstCallLoading } = useTraces(workflowName, baseUrl, true);
6208
6204
  const { isOpen: open } = React.useContext(TraceContext);
6209
6205
  return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
6210
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("h-full", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
6206
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsxRuntime.jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
6211
6207
  open && /* @__PURE__ */ jsxRuntime.jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
6212
6208
  ] });
6213
6209
  }