@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.es.js CHANGED
@@ -5391,27 +5391,46 @@ function MastraRuntimeProvider({
5391
5391
  if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
5392
5392
  if (initialMessages && threadId && memory) {
5393
5393
  const convertedMessages = initialMessages?.map((message) => {
5394
- const toolInvocationsAsContentParts = (message.toolInvocations || []).map((toolInvocation) => ({
5395
- type: "tool-call",
5396
- toolCallId: toolInvocation?.toolCallId,
5397
- toolName: toolInvocation?.toolName,
5398
- args: toolInvocation?.args,
5399
- result: toolInvocation?.result
5400
- }));
5401
5394
  const attachmentsAsContentParts = (message.experimental_attachments || []).map((image) => ({
5402
5395
  type: image.contentType.startsWith(`image/`) ? "image" : image.contentType.startsWith(`audio/`) ? "audio" : "file",
5403
5396
  mimeType: image.contentType,
5404
5397
  image: image.url
5405
5398
  }));
5406
- const reasoning = message?.parts?.find(({ type }) => type === "reasoning")?.details?.map((detail) => detail?.text)?.join(" ");
5399
+ const formattedParts = (message.parts || []).map((part) => {
5400
+ if (part.type === "reasoning") {
5401
+ return {
5402
+ type: "reasoning",
5403
+ text: part.reasoning || part?.details?.filter((detail) => detail.type === "text")?.map((detail) => detail.text).join(" ")
5404
+ };
5405
+ }
5406
+ if (part.type === "tool-invocation") {
5407
+ if (part.toolInvocation.state === "result") {
5408
+ return {
5409
+ type: "tool-call",
5410
+ toolCallId: part.toolInvocation.toolCallId,
5411
+ toolName: part.toolInvocation.toolName,
5412
+ args: part.toolInvocation.args,
5413
+ result: part.toolInvocation.result
5414
+ };
5415
+ }
5416
+ }
5417
+ if (part.type === "file") {
5418
+ return {
5419
+ type: "file",
5420
+ mimeType: part.mimeType,
5421
+ data: part.data
5422
+ };
5423
+ }
5424
+ if (part.type === "text") {
5425
+ return {
5426
+ type: "text",
5427
+ text: part.text
5428
+ };
5429
+ }
5430
+ }).filter(Boolean);
5407
5431
  return {
5408
5432
  ...message,
5409
- content: [
5410
- ...reasoning ? [{ type: "reasoning", text: reasoning }] : [],
5411
- ...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
5412
- ...toolInvocationsAsContentParts,
5413
- ...attachmentsAsContentParts
5414
- ]
5433
+ content: [...formattedParts, ...attachmentsAsContentParts]
5415
5434
  };
5416
5435
  }).filter(Boolean);
5417
5436
  setMessages(convertedMessages);
@@ -13194,7 +13213,7 @@ const TracesTableError = ({ error, colsCount }) => {
13194
13213
  };
13195
13214
  const TraceRow = ({ trace, index, isActive }) => {
13196
13215
  const { openTrace } = useOpenTrace();
13197
- const hasFailure = trace.trace.some((span) => span.status.code !== 0);
13216
+ const hasFailure = trace.trace.some((span) => span.status.code === 2);
13198
13217
  return /* @__PURE__ */ jsxs(Row, { className: isActive ? "bg-surface4" : "", onClick: () => openTrace(trace.trace, index), children: [
13199
13218
  /* @__PURE__ */ jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
13200
13219
  /* @__PURE__ */ jsxs(TxtCell, { title: trace.traceId, children: [
@@ -13565,7 +13584,7 @@ function TraceDetails() {
13565
13584
  const { trace, currentTraceIndex, prevTrace, nextTrace, traces } = useContext(TraceContext);
13566
13585
  const actualTrace = traces[currentTraceIndex];
13567
13586
  if (!actualTrace || !trace) return null;
13568
- const hasFailure = trace.some((span) => span.status.code !== 0);
13587
+ const hasFailure = trace.some((span) => span.status.code === 2);
13569
13588
  return /* @__PURE__ */ jsxs("aside", { children: [
13570
13589
  /* @__PURE__ */ jsxs(Header, { children: [
13571
13590
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
@@ -13687,11 +13706,11 @@ function SpanDetail() {
13687
13706
  /* @__PURE__ */ jsx(Icon, { size: "lg", className: "bg-surface4 p-1 rounded-md", children: /* @__PURE__ */ jsx(SpanIcon, { className: variantClass }) }),
13688
13707
  span.name
13689
13708
  ] }),
13690
- /* @__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: [
13709
+ /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 items-center", children: span.status.code === 2 ? /* @__PURE__ */ jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsx(X, {}), children: [
13710
+ "Failed in ",
13691
13711
  toSigFigs(span.duration, 3),
13692
13712
  "ms"
13693
- ] }) : /* @__PURE__ */ jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsx(X, {}), children: [
13694
- "Failed in ",
13713
+ ] }) : /* @__PURE__ */ jsxs(Badge$1, { icon: /* @__PURE__ */ jsx(LatencyIcon, {}), variant: "success", children: [
13695
13714
  toSigFigs(span.duration, 3),
13696
13715
  "ms"
13697
13716
  ] }) }),