@mastra/react 1.4.2-alpha.1 → 1.4.2-alpha.13

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
@@ -737,6 +737,27 @@ const accumulateChunk = ({ chunk, conversation, metadata }) => {
737
737
  };
738
738
  return replaceAt(result, messageIndex, withParts(targetMessage, parts));
739
739
  }
740
+ case "tool-output-denied": {
741
+ const location = locateToolPart(result, chunk.payload.toolCallId, false);
742
+ if (!location || location.toolPartIndex < 0) return result;
743
+ const { messageIndex, toolPartIndex } = location;
744
+ const targetMessage = result[messageIndex];
745
+ if (!targetMessage || targetMessage.role !== "assistant") return result;
746
+ const parts = [...targetMessage.content.parts];
747
+ const toolPart = parts[toolPartIndex];
748
+ if (!isToolPart(toolPart)) return result;
749
+ parts[toolPartIndex] = {
750
+ ...toolPart,
751
+ toolInvocation: {
752
+ ...toolPart.toolInvocation,
753
+ state: "output-denied",
754
+ toolName: chunk.payload.toolName,
755
+ args: chunk.payload.args ?? toolPart.toolInvocation.args,
756
+ approval: chunk.payload.approval
757
+ }
758
+ };
759
+ return replaceAt(result, messageIndex, withParts(targetMessage, parts));
760
+ }
740
761
  case "tool-error":
741
762
  case "tool-result":
742
763
  case "background-task-completed":
@@ -1107,7 +1128,8 @@ const accumulateChunk = ({ chunk, conversation, metadata }) => {
1107
1128
  case "network-validation-start":
1108
1129
  case "network-validation-end":
1109
1130
  case "network-object":
1110
- case "network-object-result": return result;
1131
+ case "network-object-result":
1132
+ case "tool-output-denied": return result;
1111
1133
  default: return assertExhaustive(chunk, result);
1112
1134
  }
1113
1135
  };