@mastra/react 0.2.36-alpha.0 → 0.2.36-alpha.10
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 +83 -0
- package/dist/index.cjs +40 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -27
- package/dist/index.js.map +1 -1
- package/dist/lib/ai-sdk/types.d.ts +4 -2
- package/dist/lib/ai-sdk/types.d.ts.map +1 -1
- package/dist/lib/ai-sdk/utils/toUIMessage.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
1
1
|
# @mastra/react
|
|
2
2
|
|
|
3
|
+
## 0.2.36-alpha.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`e281ae5`](https://github.com/mastra-ai/mastra/commit/e281ae50e6087affc242de13f471112835bc60b4)]:
|
|
8
|
+
- @mastra/client-js@1.18.0-alpha.10
|
|
9
|
+
|
|
10
|
+
## 0.2.36-alpha.9
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`5688881`](https://github.com/mastra-ai/mastra/commit/5688881669c7ed157f31ac77f6fc5f8d95ceea32)]:
|
|
15
|
+
- @mastra/core@1.33.0-alpha.9
|
|
16
|
+
- @mastra/client-js@1.18.0-alpha.9
|
|
17
|
+
|
|
18
|
+
## 0.2.36-alpha.8
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4)]:
|
|
23
|
+
- @mastra/core@1.33.0-alpha.8
|
|
24
|
+
- @mastra/client-js@1.18.0-alpha.8
|
|
25
|
+
|
|
26
|
+
## 0.2.36-alpha.7
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [[`6742347`](https://github.com/mastra-ai/mastra/commit/6742347d71955d7639adc9ddf6ff8282de7ee3ba), [`7b0ad1f`](https://github.com/mastra-ai/mastra/commit/7b0ad1f5c53dc118c6da12ae82ae2587037dc2b8), [`62666c3`](https://github.com/mastra-ai/mastra/commit/62666c367eaeac3941ead454b1d38810cc855721), [`4af2160`](https://github.com/mastra-ai/mastra/commit/4af2160322f4718cac421930cce85641e9512389), [`136c959`](https://github.com/mastra-ai/mastra/commit/136c9592fb0eeb0cd212f28629d8a29b7557a2fc), [`4df7cc7`](https://github.com/mastra-ai/mastra/commit/4df7cc79342fd065fe7fdeef93c094db14b12bcd), [`284b0d7`](https://github.com/mastra-ai/mastra/commit/284b0d78d0edb306413447e5268007491006937c), [`aca3121`](https://github.com/mastra-ai/mastra/commit/aca31211233dac25459f140ea4fcfb3a5af64c18), [`9cdf38e`](https://github.com/mastra-ai/mastra/commit/9cdf38e58506e1109c8b38f97cd7770978a4218e), [`990851e`](https://github.com/mastra-ai/mastra/commit/990851edcb0e30be5c2c18b6532f1a876cc2d335), [`6068a6c`](https://github.com/mastra-ai/mastra/commit/6068a6c42950fad3ebfc92346417896ba60803d2), [`00106be`](https://github.com/mastra-ai/mastra/commit/00106bede59b81e5b0e9cd6aad8d3b5dbc336387), [`e2a079c`](https://github.com/mastra-ai/mastra/commit/e2a079cc3755b1895f7bd5dc36e9be81b11c7c22), [`534a456`](https://github.com/mastra-ai/mastra/commit/534a456a25e4df1e5407e7e632f4cb3b1fa14f9d), [`36bae07`](https://github.com/mastra-ai/mastra/commit/36bae07c0e70b1b3006f2fd20830e8883dcbd066)]:
|
|
31
|
+
- @mastra/core@1.33.0-alpha.7
|
|
32
|
+
- @mastra/client-js@1.18.0-alpha.7
|
|
33
|
+
|
|
34
|
+
## 0.2.36-alpha.6
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Fixed Studio streaming render behavior for interleaved reasoning and improved chat autoscroll during rapid output. ([#16331](https://github.com/mastra-ai/mastra/pull/16331))
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`b560d6f`](https://github.com/mastra-ai/mastra/commit/b560d6f88b9b904b15c10f75c949eb145bc27684), [`d416efd`](https://github.com/mastra-ai/mastra/commit/d416efdee26c1755328e21cc62584f8566e21432), [`36b3bbf`](https://github.com/mastra-ai/mastra/commit/36b3bbf5a8d59f7e23d47e29340e76c681b4929c), [`b275631`](https://github.com/mastra-ai/mastra/commit/b275631dc10541a482b2e2d4a3e3cfa843bd5fa1)]:
|
|
41
|
+
- @mastra/core@1.33.0-alpha.6
|
|
42
|
+
- @mastra/client-js@1.18.0-alpha.6
|
|
43
|
+
|
|
44
|
+
## 0.2.36-alpha.5
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [[`bae019e`](https://github.com/mastra-ai/mastra/commit/bae019ecb6694da96909f7ec7b9eb3a0a33aa887), [`33f5061`](https://github.com/mastra-ai/mastra/commit/33f5061cd1c0335020c3faae61ce96de822854fa), [`99869ec`](https://github.com/mastra-ai/mastra/commit/99869ecb1f2aa6dfcc44fa4e843e5ee0344efa64), [`d86f031`](https://github.com/mastra-ai/mastra/commit/d86f031eb6b0b2570145afafea664e59bf688962)]:
|
|
49
|
+
- @mastra/core@1.33.0-alpha.5
|
|
50
|
+
- @mastra/client-js@1.18.0-alpha.5
|
|
51
|
+
|
|
52
|
+
## 0.2.36-alpha.4
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Handle `background-task-suspended` chunks in `toUIMessage` so suspend metadata is restored after resume. ([#16260](https://github.com/mastra-ai/mastra/pull/16260))
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
|
|
59
|
+
- @mastra/core@1.33.0-alpha.4
|
|
60
|
+
- @mastra/client-js@1.18.0-alpha.4
|
|
61
|
+
|
|
62
|
+
## 0.2.36-alpha.3
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [[`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047), [`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047), [`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047)]:
|
|
67
|
+
- @mastra/core@1.33.0-alpha.3
|
|
68
|
+
- @mastra/client-js@1.17.2-alpha.3
|
|
69
|
+
|
|
70
|
+
## 0.2.36-alpha.2
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies [[`d1fdbd0`](https://github.com/mastra-ai/mastra/commit/d1fdbd012add5623cb7e6b7f882b605ab358bbb4), [`d91ebe2`](https://github.com/mastra-ai/mastra/commit/d91ebe28ee065d8f2ed6df741c3c07f58d359529), [`e41e7c8`](https://github.com/mastra-ai/mastra/commit/e41e7c88285feefe5cddea22105b40092bcf217f)]:
|
|
75
|
+
- @mastra/core@1.33.0-alpha.2
|
|
76
|
+
- @mastra/client-js@1.17.2-alpha.2
|
|
77
|
+
|
|
78
|
+
## 0.2.36-alpha.1
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- Updated dependencies [[`dccd8f1`](https://github.com/mastra-ai/mastra/commit/dccd8f1f8b8f1ad203b77556207e5529567c616d)]:
|
|
83
|
+
- @mastra/core@1.33.0-alpha.1
|
|
84
|
+
- @mastra/client-js@1.17.2-alpha.1
|
|
85
|
+
|
|
3
86
|
## 0.2.36-alpha.0
|
|
4
87
|
|
|
5
88
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -385,23 +385,21 @@ var toUIMessage = ({ chunk, conversation, metadata }) => {
|
|
|
385
385
|
return [...result, newMessage];
|
|
386
386
|
}
|
|
387
387
|
const parts = [...lastMessage.parts];
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
const lastPartIndex = parts.length - 1;
|
|
389
|
+
const lastPart = parts[lastPartIndex];
|
|
390
|
+
if (lastPart?.type === "reasoning") {
|
|
391
|
+
parts[lastPartIndex] = {
|
|
392
|
+
...lastPart,
|
|
393
|
+
text: lastPart.text + chunk.payload.text,
|
|
394
|
+
state: "streaming"
|
|
395
|
+
};
|
|
396
|
+
} else {
|
|
390
397
|
parts.push({
|
|
391
398
|
type: "reasoning",
|
|
392
399
|
text: chunk.payload.text,
|
|
393
400
|
state: "streaming",
|
|
394
401
|
providerMetadata: chunk.payload.providerMetadata
|
|
395
402
|
});
|
|
396
|
-
} else {
|
|
397
|
-
const reasoningPart = parts[reasoningPartIndex];
|
|
398
|
-
if (reasoningPart.type === "reasoning") {
|
|
399
|
-
parts[reasoningPartIndex] = {
|
|
400
|
-
...reasoningPart,
|
|
401
|
-
text: reasoningPart.text + chunk.payload.text,
|
|
402
|
-
state: "streaming"
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
403
|
}
|
|
406
404
|
return [
|
|
407
405
|
...result.slice(0, -1),
|
|
@@ -691,17 +689,29 @@ var toUIMessage = ({ chunk, conversation, metadata }) => {
|
|
|
691
689
|
}
|
|
692
690
|
];
|
|
693
691
|
}
|
|
694
|
-
case "tool-call-suspended":
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
const
|
|
698
|
-
return
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
692
|
+
case "tool-call-suspended":
|
|
693
|
+
case "background-task-suspended": {
|
|
694
|
+
const isBgTaskEvent = chunk.type === "background-task-suspended";
|
|
695
|
+
const location = isBgTaskEvent ? locateToolPart(result, chunk.payload.toolCallId, isBgTaskEvent) : { messageIndex: result.length - 1 };
|
|
696
|
+
if (!location) return result;
|
|
697
|
+
const { messageIndex } = location;
|
|
698
|
+
const targetMessage = result[messageIndex];
|
|
699
|
+
if (!targetMessage || targetMessage.role !== "assistant") return result;
|
|
700
|
+
const lastSuspendedTools = targetMessage.metadata?.mode === "stream" ? targetMessage.metadata?.suspendedTools : {};
|
|
701
|
+
const nextMessage = {
|
|
702
|
+
...targetMessage,
|
|
703
|
+
metadata: mergeBgTaskMetadata(
|
|
704
|
+
targetMessage.metadata,
|
|
705
|
+
"stream",
|
|
706
|
+
{
|
|
707
|
+
resetRunningCount: isBgTaskEvent,
|
|
708
|
+
perTaskEntry: isBgTaskEvent ? {
|
|
709
|
+
toolCallId: chunk.payload.toolCallId,
|
|
710
|
+
suspendedAt: chunk.payload.suspendedAt,
|
|
711
|
+
taskId: chunk.payload.taskId
|
|
712
|
+
} : void 0
|
|
713
|
+
},
|
|
714
|
+
{
|
|
705
715
|
suspendedTools: {
|
|
706
716
|
...lastSuspendedTools,
|
|
707
717
|
[chunk.payload.toolName]: {
|
|
@@ -713,8 +723,9 @@ var toUIMessage = ({ chunk, conversation, metadata }) => {
|
|
|
713
723
|
}
|
|
714
724
|
}
|
|
715
725
|
}
|
|
716
|
-
|
|
717
|
-
|
|
726
|
+
)
|
|
727
|
+
};
|
|
728
|
+
return [...result.slice(0, messageIndex), nextMessage, ...result.slice(messageIndex + 1)];
|
|
718
729
|
}
|
|
719
730
|
case "finish": {
|
|
720
731
|
const lastMessage = result[result.length - 1];
|
|
@@ -906,22 +917,24 @@ var locateToolPart = (messages, toolCallId, allowMetadataOnlyMatch) => {
|
|
|
906
917
|
}
|
|
907
918
|
return { messageIndex, toolPartIndex };
|
|
908
919
|
};
|
|
909
|
-
var mergeBgTaskMetadata = (existing, mode, args) => {
|
|
920
|
+
var mergeBgTaskMetadata = (existing, mode, args, otherMetadata) => {
|
|
910
921
|
const existingAny = existing ?? {};
|
|
911
922
|
const existingBgTasks = existingAny.backgroundTasks ?? {};
|
|
912
923
|
const nextBgTasks = { ...existingBgTasks };
|
|
913
924
|
if (args.perTaskEntry) {
|
|
914
|
-
const { toolCallId, startedAt, completedAt, taskId } = args.perTaskEntry;
|
|
925
|
+
const { toolCallId, startedAt, completedAt, taskId, suspendedAt } = args.perTaskEntry;
|
|
915
926
|
const prev = existingBgTasks[toolCallId] ?? { taskId };
|
|
916
927
|
nextBgTasks[toolCallId] = {
|
|
917
928
|
...prev,
|
|
918
929
|
taskId,
|
|
919
930
|
...startedAt !== void 0 ? { startedAt } : {},
|
|
920
|
-
...completedAt !== void 0 ? { completedAt } : {}
|
|
931
|
+
...completedAt !== void 0 ? { completedAt } : {},
|
|
932
|
+
...suspendedAt !== void 0 ? { suspendedAt } : {}
|
|
921
933
|
};
|
|
922
934
|
}
|
|
923
935
|
return {
|
|
924
936
|
...existingAny,
|
|
937
|
+
...otherMetadata ?? {},
|
|
925
938
|
mode,
|
|
926
939
|
...args.resetRunningCount ? { runningBackgroundTasksCount: void 0 } : {},
|
|
927
940
|
backgroundTasks: nextBgTasks
|