@mastra/playground-ui 5.1.19 → 5.1.20-alpha.1

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
@@ -5424,27 +5424,46 @@ function MastraRuntimeProvider({
5424
5424
  if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
5425
5425
  if (initialMessages && threadId && memory) {
5426
5426
  const convertedMessages = initialMessages?.map((message) => {
5427
- const toolInvocationsAsContentParts = (message.toolInvocations || []).map((toolInvocation) => ({
5428
- type: "tool-call",
5429
- toolCallId: toolInvocation?.toolCallId,
5430
- toolName: toolInvocation?.toolName,
5431
- args: toolInvocation?.args,
5432
- result: toolInvocation?.result
5433
- }));
5434
5427
  const attachmentsAsContentParts = (message.experimental_attachments || []).map((image) => ({
5435
5428
  type: image.contentType.startsWith(`image/`) ? "image" : image.contentType.startsWith(`audio/`) ? "audio" : "file",
5436
5429
  mimeType: image.contentType,
5437
5430
  image: image.url
5438
5431
  }));
5439
- const reasoning = message?.parts?.find(({ type }) => type === "reasoning")?.details?.map((detail) => detail?.text)?.join(" ");
5432
+ const formattedParts = (message.parts || []).map((part) => {
5433
+ if (part.type === "reasoning") {
5434
+ return {
5435
+ type: "reasoning",
5436
+ text: part.reasoning || part?.details?.filter((detail) => detail.type === "text")?.map((detail) => detail.text).join(" ")
5437
+ };
5438
+ }
5439
+ if (part.type === "tool-invocation") {
5440
+ if (part.toolInvocation.state === "result") {
5441
+ return {
5442
+ type: "tool-call",
5443
+ toolCallId: part.toolInvocation.toolCallId,
5444
+ toolName: part.toolInvocation.toolName,
5445
+ args: part.toolInvocation.args,
5446
+ result: part.toolInvocation.result
5447
+ };
5448
+ }
5449
+ }
5450
+ if (part.type === "file") {
5451
+ return {
5452
+ type: "file",
5453
+ mimeType: part.mimeType,
5454
+ data: part.data
5455
+ };
5456
+ }
5457
+ if (part.type === "text") {
5458
+ return {
5459
+ type: "text",
5460
+ text: part.text
5461
+ };
5462
+ }
5463
+ }).filter(Boolean);
5440
5464
  return {
5441
5465
  ...message,
5442
- content: [
5443
- ...reasoning ? [{ type: "reasoning", text: reasoning }] : [],
5444
- ...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
5445
- ...toolInvocationsAsContentParts,
5446
- ...attachmentsAsContentParts
5447
- ]
5466
+ content: [...formattedParts, ...attachmentsAsContentParts]
5448
5467
  };
5449
5468
  }).filter(Boolean);
5450
5469
  setMessages(convertedMessages);
@@ -13227,7 +13246,7 @@ const TracesTableError = ({ error, colsCount }) => {
13227
13246
  };
13228
13247
  const TraceRow = ({ trace, index, isActive }) => {
13229
13248
  const { openTrace } = useOpenTrace();
13230
- const hasFailure = trace.trace.some((span) => span.status.code !== 0);
13249
+ const hasFailure = trace.trace.some((span) => span.status.code === 2);
13231
13250
  return /* @__PURE__ */ jsxRuntime.jsxs(Row, { className: isActive ? "bg-surface4" : "", onClick: () => openTrace(trace.trace, index), children: [
13232
13251
  /* @__PURE__ */ jsxRuntime.jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
13233
13252
  /* @__PURE__ */ jsxRuntime.jsxs(TxtCell, { title: trace.traceId, children: [
@@ -13598,7 +13617,7 @@ function TraceDetails() {
13598
13617
  const { trace, currentTraceIndex, prevTrace, nextTrace, traces } = React.useContext(TraceContext);
13599
13618
  const actualTrace = traces[currentTraceIndex];
13600
13619
  if (!actualTrace || !trace) return null;
13601
- const hasFailure = trace.some((span) => span.status.code !== 0);
13620
+ const hasFailure = trace.some((span) => span.status.code === 2);
13602
13621
  return /* @__PURE__ */ jsxRuntime.jsxs("aside", { children: [
13603
13622
  /* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
13604
13623
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
@@ -13720,11 +13739,11 @@ function SpanDetail() {
13720
13739
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: "bg-surface4 p-1 rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(SpanIcon, { className: variantClass }) }),
13721
13740
  span.name
13722
13741
  ] }),
13723
- /* @__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: [
13742
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 items-center", children: span.status.code === 2 ? /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: [
13743
+ "Failed in ",
13724
13744
  toSigFigs(span.duration, 3),
13725
13745
  "ms"
13726
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: [
13727
- "Failed in ",
13746
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(LatencyIcon, {}), variant: "success", children: [
13728
13747
  toSigFigs(span.duration, 3),
13729
13748
  "ms"
13730
13749
  ] }) }),