@mastra/playground-ui 20.0.0-alpha.5 → 20.0.0-alpha.7

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,23 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 20.0.0-alpha.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Changed the Editor tab URL from /agents/:agentId/playground to /agents/:agentId/editor in Mastra Studio ([#14795](https://github.com/mastra-ai/mastra/pull/14795))
8
+
9
+ ## 20.0.0-alpha.6
10
+
11
+ ### Patch Changes
12
+
13
+ - Fix restored subagent tool results so approval cards and nested tool state appear correctly in the dev server. ([#14348](https://github.com/mastra-ai/mastra/pull/14348))
14
+
15
+ - Updated dependencies [[`e333b77`](https://github.com/mastra-ai/mastra/commit/e333b77e2d76ba57ccec1818e08cebc1993469ff), [`60a224d`](https://github.com/mastra-ai/mastra/commit/60a224dd497240e83698cfa5bfd02e3d1d854844), [`949b7bf`](https://github.com/mastra-ai/mastra/commit/949b7bfd4e40f2b2cba7fef5eb3f108a02cfe938), [`d084b66`](https://github.com/mastra-ai/mastra/commit/d084b6692396057e83c086b954c1857d20b58a14), [`79c699a`](https://github.com/mastra-ai/mastra/commit/79c699acf3cd8a77e11c55530431f48eb48456e9), [`62757b6`](https://github.com/mastra-ai/mastra/commit/62757b6db6e8bb86569d23ad0b514178f57053f8), [`7e86302`](https://github.com/mastra-ai/mastra/commit/7e86302a77f16adbb771af43f72472872d13593e), [`3d70b0b`](https://github.com/mastra-ai/mastra/commit/3d70b0b3524d817173ad870768f259c06d61bd23), [`bbfd3c0`](https://github.com/mastra-ai/mastra/commit/bbfd3c0302ac10be63e5fca93b5068690f472dea), [`3b45a13`](https://github.com/mastra-ai/mastra/commit/3b45a138d09d040779c0aba1edbbfc1b57442d23), [`8127d96`](https://github.com/mastra-ai/mastra/commit/8127d96280492e335d49b244501088dfdd59a8f1)]:
16
+ - @mastra/client-js@1.11.0-alpha.6
17
+ - @mastra/core@1.18.0-alpha.3
18
+ - @mastra/react@0.2.18-alpha.6
19
+ - @mastra/ai-sdk@1.3.0-alpha.0
20
+
3
21
  ## 20.0.0-alpha.5
4
22
 
5
23
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -5886,14 +5886,17 @@ const AgentBadge = ({
5886
5886
  }) => {
5887
5887
  const selectionReason = metadata?.mode === "network" ? metadata.selectionReason : void 0;
5888
5888
  const agentNetworkInput = metadata?.mode === "network" ? metadata.agentInput : void 0;
5889
- let toolCalled = messages.length > 0;
5889
+ const parentRequireApprovalMetadata = metadata?.mode === "stream" || metadata?.mode === "network" || metadata?.mode === "generate" ? metadata?.requireApprovalMetadata : void 0;
5890
+ const parentSuspendedTools = metadata?.mode === "stream" || metadata?.mode === "network" || metadata?.mode === "generate" ? metadata?.suspendedTools : void 0;
5891
+ const allChildToolsComplete = messages.length > 0 && messages.every((message) => {
5892
+ if (message.type === "text") {
5893
+ return true;
5894
+ }
5895
+ return message.toolOutput !== void 0;
5896
+ });
5897
+ let toolCalled = allChildToolsComplete;
5890
5898
  if (isNetwork) {
5891
- toolCalled = toolCalledProp ?? messages.every((message) => {
5892
- if (message.type === "text") {
5893
- return true;
5894
- }
5895
- return !!message.toolOutput;
5896
- });
5899
+ toolCalled = toolCalledProp ?? allChildToolsComplete;
5897
5900
  }
5898
5901
  let suspendPayloadSlot = typeof suspendPayload === "string" ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto", children: suspendPayload }) : /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { data: suspendPayload, "data-testid": "tool-suspend-payload" });
5899
5902
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5902,7 +5905,7 @@ const AgentBadge = ({
5902
5905
  "data-testid": "agent-badge",
5903
5906
  icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, { className: "text-accent1" }),
5904
5907
  title: agentId,
5905
- initialCollapsed: isComplete,
5908
+ initialCollapsed: isComplete && !toolApprovalMetadata,
5906
5909
  extraInfo: metadata?.mode === "network" && /* @__PURE__ */ jsxRuntime.jsx(
5907
5910
  NetworkChoiceMetadataDialogTrigger,
5908
5911
  {
@@ -5936,7 +5939,9 @@ const AgentBadge = ({
5936
5939
  resume: () => {
5937
5940
  },
5938
5941
  metadata: {
5939
- mode: "stream"
5942
+ mode: "stream",
5943
+ requireApprovalMetadata: parentRequireApprovalMetadata,
5944
+ suspendedTools: parentSuspendedTools
5940
5945
  }
5941
5946
  }
5942
5947
  ) }, index);
@@ -6011,12 +6016,28 @@ const AgentBadgeWrapper = ({
6011
6016
  return /* @__PURE__ */ jsxRuntime.jsx(LoadingBadge, {});
6012
6017
  }
6013
6018
  const convertedMessages = data?.messages ? ui.toAISdkV5Messages(data.messages) : [];
6014
- const childMessages = result?.childMessages ?? react.resolveToChildMessages(convertedMessages);
6019
+ let childMessages = result?.childMessages?.length ? result.childMessages : void 0;
6020
+ if (!childMessages && result?.subAgentToolResults?.length) {
6021
+ const toolMessages = result.subAgentToolResults.map((tr) => ({
6022
+ type: "tool",
6023
+ toolName: tr.toolName,
6024
+ toolCallId: tr.toolCallId,
6025
+ args: tr.args,
6026
+ toolOutput: tr.result
6027
+ }));
6028
+ if (result.text) {
6029
+ toolMessages.push({ type: "text", content: result.text });
6030
+ }
6031
+ childMessages = toolMessages;
6032
+ }
6033
+ if (!childMessages) {
6034
+ childMessages = react.resolveToChildMessages(convertedMessages);
6035
+ }
6015
6036
  return /* @__PURE__ */ jsxRuntime.jsx(
6016
6037
  AgentBadge,
6017
6038
  {
6018
6039
  agentId,
6019
- messages: childMessages,
6040
+ messages: childMessages ?? [],
6020
6041
  metadata,
6021
6042
  toolCallId,
6022
6043
  toolApprovalMetadata,
@@ -38909,7 +38930,7 @@ function AgentPageTabs({
38909
38930
  showPlayground && /* @__PURE__ */ jsxRuntime.jsx(
38910
38931
  TabLink,
38911
38932
  {
38912
- href: `/agents/${agentId}/playground`,
38933
+ href: `/agents/${agentId}/editor`,
38913
38934
  active: activeTab === "versions",
38914
38935
  icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GitBranch, {}),
38915
38936
  label: "Editor"