@mastra/react 1.3.5-alpha.3 → 1.4.0-alpha.4

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
@@ -1047,7 +1047,18 @@ const accumulateChunk = ({ chunk, conversation, metadata }) => {
1047
1047
  });
1048
1048
  return [...result, newMessage];
1049
1049
  }
1050
- case "step-start":
1050
+ case "step-start": {
1051
+ const stepMessageId = typeof chunk.payload?.messageId === "string" ? chunk.payload.messageId : void 0;
1052
+ if (!stepMessageId) return result;
1053
+ const lastMessage = result[result.length - 1];
1054
+ if (!lastMessage || lastMessage.role !== "assistant") return result;
1055
+ if (result.some((message) => message.id === stepMessageId)) return result;
1056
+ if (!lastMessage.content.parts.some((part) => !String(part.type).startsWith("data-"))) return replaceLast(result, {
1057
+ ...lastMessage,
1058
+ id: stepMessageId
1059
+ });
1060
+ return appendAssistantMessage(finishStreamingAssistantMessage(result), stepMessageId, [], metadata);
1061
+ }
1051
1062
  case "step-finish":
1052
1063
  case "step-output":
1053
1064
  case "raw":
@@ -2970,10 +2981,12 @@ function useCancelWorkflowRun() {
2970
2981
  //#endregion
2971
2982
  //#region src/workflows/WorkflowStepFactory/WorkflowStepFactory.tsx
2972
2983
  const renderUnknown = (step, UnknownStep) => UnknownStep?.(step) ?? null;
2973
- const WorkflowStepFactoryComponent = ({ step, Step, MapStep, ForEachStep, ParallelStep, Conditional, LoopStep, SleepStep, SleepUntilStep, NestedWorkflowStep, UnknownStep }) => {
2984
+ const WorkflowStepFactoryComponent = ({ step, Step, MapStep, AgentStep, ToolStep, ForEachStep, ParallelStep, Conditional, LoopStep, SleepStep, SleepUntilStep, NestedWorkflowStep, UnknownStep }) => {
2974
2985
  switch (step.kind) {
2975
2986
  case "step": return /* @__PURE__ */ jsx(Fragment$1, { children: Step?.(step) ?? renderUnknown(step, UnknownStep) });
2976
2987
  case "map-step": return /* @__PURE__ */ jsx(Fragment$1, { children: MapStep?.(step) ?? renderUnknown(step, UnknownStep) });
2988
+ case "agent-step": return /* @__PURE__ */ jsx(Fragment$1, { children: AgentStep?.(step) ?? renderUnknown(step, UnknownStep) });
2989
+ case "tool-step": return /* @__PURE__ */ jsx(Fragment$1, { children: ToolStep?.(step) ?? renderUnknown(step, UnknownStep) });
2977
2990
  case "foreach-step": return /* @__PURE__ */ jsx(Fragment$1, { children: ForEachStep?.(step) ?? renderUnknown(step, UnknownStep) });
2978
2991
  case "parallel-step": return /* @__PURE__ */ jsx(Fragment$1, { children: ParallelStep?.(step) ?? renderUnknown(step, UnknownStep) });
2979
2992
  case "conditional": return /* @__PURE__ */ jsx(Fragment$1, { children: Conditional?.(step) ?? renderUnknown(step, UnknownStep) });