@mastra/playground-ui 6.9.5-alpha.0 → 6.9.6-alpha.0

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,46 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 6.9.6-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(agent): persist messages before tool suspension ([#10542](https://github.com/mastra-ai/mastra/pull/10542))
8
+
9
+ Fixes issues where thread and messages were not saved before suspension when tools require approval or call suspend() during execution. This caused conversation history to be lost if users refreshed during tool approval or suspension.
10
+
11
+ **Backend changes (@mastra/core):**
12
+ - Add assistant messages to messageList immediately after LLM execution
13
+ - Flush messages synchronously before suspension to persist state
14
+ - Create thread if it doesn't exist before flushing
15
+ - Add metadata helpers to persist and remove tool approval state
16
+ - Pass saveQueueManager and memory context through workflow for immediate persistence
17
+
18
+ **Frontend changes (@mastra/react):**
19
+ - Extract runId from pending approvals to enable resumption after refresh
20
+ - Convert `pendingToolApprovals` (DB format) to `requireApprovalMetadata` (runtime format)
21
+ - Handle both `dynamic-tool` and `tool-{NAME}` part types for approval state
22
+ - Change runId from hardcoded `agentId` to unique `uuid()`
23
+
24
+ **UI changes (@mastra/playground-ui):**
25
+ - Handle tool calls awaiting approval in message initialization
26
+ - Convert approval metadata format when loading initial messages
27
+
28
+ Fixes #9745, #9906
29
+
30
+ - Updated dependencies [[`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`58b0f0c`](https://github.com/mastra-ai/mastra/commit/58b0f0c87e28e838f5a05980f0f326e75ddc3132), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
31
+ - @mastra/core@0.24.6-alpha.0
32
+ - @mastra/react@0.0.21-alpha.0
33
+ - @mastra/client-js@0.16.15-alpha.0
34
+
35
+ ## 6.9.5
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [[`880f12b`](https://github.com/mastra-ai/mastra/commit/880f12bb45a3d49faf8d22969744ffb6e01c66fd)]:
40
+ - @mastra/core@0.24.5
41
+ - @mastra/client-js@0.16.14
42
+ - @mastra/react@0.0.20
43
+
3
44
  ## 6.9.5-alpha.0
4
45
 
5
46
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -10453,6 +10453,24 @@ const initializeMessageState = (initialMessages) => {
10453
10453
  args: part.toolInvocation.args,
10454
10454
  result: part.toolInvocation.result
10455
10455
  };
10456
+ } else if (part.toolInvocation.state === "call") {
10457
+ const toolCallId = part.toolInvocation.toolCallId;
10458
+ const pendingToolApprovals = message.metadata?.pendingToolApprovals;
10459
+ const suspensionData = pendingToolApprovals?.[toolCallId];
10460
+ if (suspensionData) {
10461
+ return {
10462
+ type: "tool-call",
10463
+ toolCallId,
10464
+ toolName: part.toolInvocation.toolName,
10465
+ args: part.toolInvocation.args,
10466
+ metadata: {
10467
+ mode: "stream",
10468
+ requireApprovalMetadata: {
10469
+ [toolCallId]: suspensionData
10470
+ }
10471
+ }
10472
+ };
10473
+ }
10456
10474
  }
10457
10475
  }
10458
10476
  if (part.type === "file") {