@mastra/react 0.0.0-remove-unused-model-providers-api-20251030210744 → 0.0.0-span-scorring-test-20251124132129

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.js CHANGED
@@ -424,11 +424,10 @@ const toUIMessage = ({ chunk, conversation, metadata }) => {
424
424
  const lastMessage = result[result.length - 1];
425
425
  if (!lastMessage || lastMessage.role !== "assistant") return result;
426
426
  const parts = lastMessage.parts.map((part) => {
427
- if (part.type === "text" && part.state === "streaming") {
428
- return { ...part, state: "done" };
429
- }
430
- if (part.type === "reasoning" && part.state === "streaming") {
431
- return { ...part, state: "done" };
427
+ if (typeof part === "object" && part !== null && "type" in part && "state" in part && part.state === "streaming") {
428
+ if (part.type === "text" || part.type === "reasoning") {
429
+ return { ...part, state: "done" };
430
+ }
432
431
  }
433
432
  return part;
434
433
  });
@@ -693,7 +692,9 @@ const toAssistantUIMessage = (message) => {
693
692
 
694
693
  const resolveInitialMessages = (messages) => {
695
694
  return messages.map((message) => {
696
- const networkPart = message.parts.find((part) => part.type === "text" && part.text.includes('"isNetwork":true'));
695
+ const networkPart = message.parts.find(
696
+ (part) => typeof part === "object" && part !== null && "type" in part && part.type === "text" && "text" in part && typeof part.text === "string" && part.text.includes('"isNetwork":true')
697
+ );
697
698
  if (networkPart && networkPart.type === "text") {
698
699
  try {
699
700
  const json = JSON.parse(networkPart.text);