@mastra/playground-ui 5.0.1-alpha.5 → 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.es.js CHANGED
@@ -3875,7 +3875,7 @@ const AssistantActionBar = () => {
3875
3875
  };
3876
3876
 
3877
3877
  const UserMessage = () => {
3878
- return /* @__PURE__ */ jsx(MessagePrimitive.Root, { className: "w-full flex justify-end", children: /* @__PURE__ */ jsx("div", { className: "max-w-[366px] px-5 py-4 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsx(MessagePrimitive.Content, {}) }) });
3878
+ return /* @__PURE__ */ jsx(MessagePrimitive.Root, { className: "w-full flex justify-end pb-4", children: /* @__PURE__ */ jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsx(MessagePrimitive.Content, {}) }) });
3879
3879
  };
3880
3880
 
3881
3881
  const useAutoscroll = (ref, { enabled = true }) => {
@@ -4947,10 +4947,6 @@ function usePolling({
4947
4947
  };
4948
4948
  }
4949
4949
 
4950
- function formatDuration(duration, fixedPoint = 2) {
4951
- const durationInSecs = duration / 1e3;
4952
- return durationInSecs.toFixed(fixedPoint);
4953
- }
4954
4950
  function formatOtelTimestamp(otelTimestamp) {
4955
4951
  const date = new Date(otelTimestamp / 1e3);
4956
4952
  return new Intl.DateTimeFormat("en-US", {
@@ -5202,13 +5198,12 @@ const TraceRow = ({ trace, index, isActive }) => {
5202
5198
  const hasFailure = trace.trace.some((span) => span.status.code !== 0);
5203
5199
  return /* @__PURE__ */ jsxs(Row, { className: isActive ? "bg-surface4" : "", onClick: () => openTrace(trace.trace, index), children: [
5204
5200
  /* @__PURE__ */ jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
5205
- /* @__PURE__ */ jsx(TxtCell, { children: trace.traceId }),
5206
- /* @__PURE__ */ jsx(UnitCell, { unit: "ms", children: trace.duration / 1e3 }),
5207
- /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx("button", { onClick: () => openTrace(trace.trace, index), children: /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(TraceIcon, {}), children: [
5208
- trace.trace.length,
5209
- " span",
5210
- trace.trace.length > 1 ? "s" : ""
5211
- ] }) }) }),
5201
+ /* @__PURE__ */ jsxs(TxtCell, { title: trace.traceId, children: [
5202
+ trace.traceId.substring(0, 7),
5203
+ "..."
5204
+ ] }),
5205
+ /* @__PURE__ */ jsx(UnitCell, { unit: "ms", children: Math.round(trace.duration / 1e3) }),
5206
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx("button", { onClick: () => openTrace(trace.trace, index), children: /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(TraceIcon, {}), children: trace.trace.length }) }) }),
5212
5207
  /* @__PURE__ */ jsx(Cell, { children: hasFailure ? /* @__PURE__ */ jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsx(X, {}), children: "Failed" }) : /* @__PURE__ */ jsx(Badge$1, { icon: /* @__PURE__ */ jsx(Check, {}), variant: "success", children: "Success" }) })
5213
5208
  ] });
5214
5209
  };
@@ -5218,11 +5213,11 @@ const TracesTable = ({ traces, isLoading, error }) => {
5218
5213
  const colsCount = 4;
5219
5214
  return /* @__PURE__ */ jsxs(Table, { size: "small", children: [
5220
5215
  /* @__PURE__ */ jsxs(Thead, { children: [
5221
- /* @__PURE__ */ jsx(Th, { width: 160, children: "Time" }),
5216
+ /* @__PURE__ */ jsx(Th, { width: 120, children: "Time" }),
5222
5217
  /* @__PURE__ */ jsx(Th, { width: "auto", children: "Trace Id" }),
5223
- /* @__PURE__ */ jsx(Th, { width: 160, children: "Duration" }),
5224
- /* @__PURE__ */ jsx(Th, { width: 160, children: "Spans" }),
5225
- /* @__PURE__ */ jsx(Th, { width: 160, children: "Status" })
5218
+ /* @__PURE__ */ jsx(Th, { width: 120, children: "Duration" }),
5219
+ /* @__PURE__ */ jsx(Th, { width: 120, children: "Spans" }),
5220
+ /* @__PURE__ */ jsx(Th, { width: 120, children: "Status" })
5226
5221
  ] }),
5227
5222
  isLoading ? /* @__PURE__ */ jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) })
5228
5223
  ] });
@@ -5344,11 +5339,11 @@ const variantClasses = {
5344
5339
  };
5345
5340
  const Time = ({ durationMs, tokenCount, variant, progressPercent }) => {
5346
5341
  const variantClass = variant ? variantClasses[variant] : "bg-accent3";
5347
- return /* @__PURE__ */ jsxs("div", { className: "w-[166px] shrink-0", children: [
5342
+ return /* @__PURE__ */ jsxs("div", { className: "w-[80px] xl:w-[166px] shrink-0", children: [
5348
5343
  /* @__PURE__ */ jsx("div", { className: "bg-surface4 relative h-[6px] w-full rounded-full p-px overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: clsx("absolute h-1 rounded-full", variantClass), style: { width: `${progressPercent}%` } }) }),
5349
5344
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 pt-0.5", children: [
5350
5345
  /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
5351
- durationMs,
5346
+ Math.round(durationMs),
5352
5347
  "ms"
5353
5348
  ] }),
5354
5349
  tokenCount && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon2 font-medium", children: [
@@ -5531,7 +5526,7 @@ const HeaderGroup = ({ children }) => {
5531
5526
  };
5532
5527
 
5533
5528
  function TraceDetails() {
5534
- const { trace, currentTraceIndex, prevTrace, nextTrace, traces, clearData } = useContext(TraceContext);
5529
+ const { trace, currentTraceIndex, prevTrace, nextTrace, traces } = useContext(TraceContext);
5535
5530
  const actualTrace = traces[currentTraceIndex];
5536
5531
  if (!actualTrace || !trace) return null;
5537
5532
  const hasFailure = trace.some((span) => span.status.code !== 0);
@@ -5552,7 +5547,7 @@ function TraceDetails() {
5552
5547
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 justify-between w-full", children: [
5553
5548
  /* @__PURE__ */ jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5 shrink-0", children: [
5554
5549
  "Trace ",
5555
- /* @__PURE__ */ jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 5) })
5550
+ /* @__PURE__ */ jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 7) })
5556
5551
  ] }),
5557
5552
  hasFailure && /* @__PURE__ */ jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsx(X, {}), children: "Failed" })
5558
5553
  ] })
@@ -5584,7 +5579,7 @@ const SyntaxHighlighter = ({ data }) => {
5584
5579
  };
5585
5580
 
5586
5581
  function SpanDetail() {
5587
- const { span, setSpan, trace } = useContext(TraceContext);
5582
+ const { span, setSpan, trace, setIsOpen } = useContext(TraceContext);
5588
5583
  if (!span || !trace) return null;
5589
5584
  const prevSpan = () => {
5590
5585
  const currentIndex = trace.findIndex((t) => t.id === span.id);
@@ -5608,8 +5603,9 @@ function SpanDetail() {
5608
5603
  ] }),
5609
5604
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5", as: "h2", children: [
5610
5605
  "Span ",
5611
- /* @__PURE__ */ jsx("span", { className: "ml-2 text-icon3", children: span.id.substring(0, 5) })
5612
- ] }) })
5606
+ /* @__PURE__ */ jsx("span", { className: "ml-2 text-icon3", children: span.id.substring(0, 7) })
5607
+ ] }) }),
5608
+ /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx(Button, { className: "bg-transparent border-none", onClick: () => setIsOpen(false), children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(X, {}) }) }) })
5613
5609
  ] }),
5614
5610
  /* @__PURE__ */ jsxs("div", { className: "p-5", children: [
5615
5611
  /* @__PURE__ */ jsxs(Txt, { variant: "header-md", as: "h3", className: "text-icon-6 flex items-center gap-4 pb-3", children: [
@@ -5617,11 +5613,11 @@ function SpanDetail() {
5617
5613
  span.name
5618
5614
  ] }),
5619
5615
  /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 items-center", children: span.status.code === 0 ? /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(LatencyIcon, {}), variant: "success", children: [
5620
- formatDuration(span.duration),
5616
+ Math.round(span.duration / 1e3),
5621
5617
  "ms"
5622
5618
  ] }) : /* @__PURE__ */ jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsx(X, {}), children: [
5623
5619
  "Failed in ",
5624
- formatDuration(span.duration),
5620
+ Math.round(span.duration / 1e3),
5625
5621
  "ms"
5626
5622
  ] }) }),
5627
5623
  /* @__PURE__ */ jsx("hr", { className: "border-border1 border-sm my-5" }),
@@ -5694,10 +5690,10 @@ const TracesSidebar = ({ onResize }) => {
5694
5690
  return /* @__PURE__ */ jsx(
5695
5691
  MastraResizablePanel,
5696
5692
  {
5697
- className: "h-full",
5698
- defaultWidth: 70,
5693
+ className: "h-full absolute right-0 inset-y-0 bg-surface2",
5694
+ defaultWidth: 80,
5699
5695
  minimumWidth: 50,
5700
- maximumWidth: 70,
5696
+ maximumWidth: 80,
5701
5697
  setCurrentWidth: onResize,
5702
5698
  children: /* @__PURE__ */ jsxs("div", { className: "h-full grid grid-cols-2", children: [
5703
5699
  /* @__PURE__ */ jsx("div", { className: "overflow-x-scroll w-full h-[calc(100%-40px)]", children: /* @__PURE__ */ jsx(TraceDetails, {}) }),
@@ -5715,7 +5711,7 @@ function AgentTracesInner({ agentName, baseUrl, className }) {
5715
5711
  const { traces, firstCallLoading, error } = useTraces(agentName, baseUrl);
5716
5712
  const { isOpen: open } = useContext(TraceContext);
5717
5713
  return /* @__PURE__ */ jsxs("div", { className: clsx("h-full relative overflow-hidden flex", className), children: [
5718
- /* @__PURE__ */ jsx("div", { className: clsx("h-full overflow-y-scroll", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
5714
+ /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
5719
5715
  open && /* @__PURE__ */ jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
5720
5716
  ] });
5721
5717
  }
@@ -6175,7 +6171,7 @@ function WorkflowTracesInner({ workflowName, baseUrl }) {
6175
6171
  const { traces, error, firstCallLoading } = useTraces(workflowName, baseUrl, true);
6176
6172
  const { isOpen: open } = useContext(TraceContext);
6177
6173
  return /* @__PURE__ */ jsxs("main", { className: "h-full relative overflow-hidden flex", children: [
6178
- /* @__PURE__ */ jsx("div", { className: clsx("h-full", open ? "w-auto" : "w-full"), children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
6174
+ /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-scroll w-full", children: /* @__PURE__ */ jsx(TracesTable, { traces, isLoading: firstCallLoading, error }) }),
6179
6175
  open && /* @__PURE__ */ jsx(TracesSidebar, { width: sidebarWidth, onResize: setSidebarWidth })
6180
6176
  ] });
6181
6177
  }