@mastra/playground-ui 6.2.2-alpha.0 → 6.2.2-alpha.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 6.2.2-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#8034](https://github.com/mastra-ai/mastra/pull/8034))
8
+ - Updated dependency [`zod@^4.1.9` ↗︎](https://www.npmjs.com/package/zod/v/4.1.9) (from `^4.1.8`, in `dependencies`)
9
+
10
+ - dependencies updates: ([#8050](https://github.com/mastra-ai/mastra/pull/8050))
11
+ - Updated dependency [`@xyflow/react@^12.8.5` ↗︎](https://www.npmjs.com/package/@xyflow/react/v/12.8.5) (from `^12.8.4`, in `dependencies`)
12
+
13
+ - Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
14
+
15
+ - Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55)]:
16
+ - @mastra/core@0.18.0-alpha.2
17
+ - @mastra/client-js@0.13.2-alpha.2
18
+
19
+ ## 6.2.2-alpha.1
20
+
21
+ ### Patch Changes
22
+
23
+ - dependencies updates: ([#8019](https://github.com/mastra-ai/mastra/pull/8019))
24
+ - Updated dependency [`motion@^12.23.13` ↗︎](https://www.npmjs.com/package/motion/v/12.23.13) (from `^12.23.12`, in `dependencies`)
25
+
26
+ - show the tool-output stream in the playground for streamVNext ([#7983](https://github.com/mastra-ai/mastra/pull/7983))
27
+
28
+ - Updated dependencies [[`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb)]:
29
+ - @mastra/core@0.17.2-alpha.1
30
+ - @mastra/client-js@0.13.2-alpha.1
31
+
3
32
  ## 6.2.2-alpha.0
4
33
 
5
34
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -4321,7 +4321,10 @@ const useCodemirrorTheme$2 = () => {
4321
4321
  []
4322
4322
  );
4323
4323
  };
4324
- const SyntaxHighlighter$2 = ({ data, className }) => {
4324
+ const SyntaxHighlighter$2 = ({
4325
+ data,
4326
+ className
4327
+ }) => {
4325
4328
  const formattedCode = JSON.stringify(data, null, 2);
4326
4329
  const theme = useCodemirrorTheme$2();
4327
4330
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx("rounded-md bg-surface4 p-1 font-mono relative", className), children: [
@@ -4494,7 +4497,7 @@ const NetworkChoiceMetadataDialogTrigger = ({
4494
4497
  ] });
4495
4498
  };
4496
4499
 
4497
- const ToolBadge = ({ toolName, args, result, networkMetadata }) => {
4500
+ const ToolBadge = ({ toolName, args, result, networkMetadata, toolOutput }) => {
4498
4501
  let argSlot = null;
4499
4502
  try {
4500
4503
  const { __mastraMetadata: _, ...formattedArgs } = typeof args === "object" ? args : JSON.parse(args);
@@ -4502,7 +4505,7 @@ const ToolBadge = ({ toolName, args, result, networkMetadata }) => {
4502
4505
  } catch {
4503
4506
  argSlot = /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: args });
4504
4507
  }
4505
- let resultSlot = typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result });
4508
+ let resultSlot = typeof result === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap bg-surface4 p-4 rounded-md", children: result }) : /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: result });
4506
4509
  return /* @__PURE__ */ jsxRuntime.jsx(
4507
4510
  BadgeWrapper,
4508
4511
  {
@@ -4520,9 +4523,13 @@ const ToolBadge = ({ toolName, args, result, networkMetadata }) => {
4520
4523
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool arguments" }),
4521
4524
  argSlot
4522
4525
  ] }),
4523
- result !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4526
+ resultSlot !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4524
4527
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool result" }),
4525
4528
  resultSlot
4529
+ ] }),
4530
+ toolOutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4531
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium pb-2", children: "Tool output" }),
4532
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-40 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlighter$2, { data: toolOutput }) })
4526
4533
  ] })
4527
4534
  ] })
4528
4535
  }
@@ -8762,6 +8769,7 @@ const ToolFallbackInner = ({ toolName, result, args }) => {
8762
8769
  toolName,
8763
8770
  args,
8764
8771
  result,
8772
+ toolOutput: args?.__mastraMetadata?.toolOutput || [],
8765
8773
  networkMetadata: args?.__mastraMetadata?.networkMetadata
8766
8774
  }
8767
8775
  );
@@ -9910,6 +9918,34 @@ const handleStreamChunk = async ({
9910
9918
  case "tool-output": {
9911
9919
  if (chunk.payload.output?.type.startsWith("workflow-")) {
9912
9920
  handleWorkflowChunk({ workflowChunk: chunk.payload.output, setMessages, entityName: chunk.payload.toolName });
9921
+ } else {
9922
+ setMessages((currentConversation) => {
9923
+ const lastMessage = currentConversation[currentConversation.length - 1];
9924
+ if (lastMessage && lastMessage.role === "assistant" && Array.isArray(lastMessage.content)) {
9925
+ const updatedContent = lastMessage.content.map((part) => {
9926
+ if (typeof part === "object" && part.type === "tool-call" && part.toolCallId === chunk.payload.toolCallId) {
9927
+ const existingToolOutput = part.args?.__mastraMetadata?.toolOutput || [];
9928
+ return {
9929
+ ...part,
9930
+ args: {
9931
+ ...part.args,
9932
+ __mastraMetadata: {
9933
+ ...part.args?.__mastraMetadata,
9934
+ toolOutput: [...existingToolOutput, chunk?.payload?.output]
9935
+ }
9936
+ }
9937
+ };
9938
+ }
9939
+ return part;
9940
+ });
9941
+ const updatedMessage = {
9942
+ ...lastMessage,
9943
+ content: updatedContent
9944
+ };
9945
+ return [...currentConversation.slice(0, -1), updatedMessage];
9946
+ }
9947
+ return currentConversation;
9948
+ });
9913
9949
  }
9914
9950
  break;
9915
9951
  }