@mastra/react 1.4.4-alpha.7 → 1.4.4-alpha.8

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
@@ -2418,14 +2418,28 @@ const useChat = ({ agentId, resourceId, threadId, initialMessages, requestContex
2418
2418
  }
2419
2419
  return;
2420
2420
  }
2421
- await (await agent.approveToolCall({
2422
- runId: currentRunId,
2423
- toolCallId,
2424
- ...continuation
2425
- })).processDataStream({ onChunk: async (chunk) => {
2426
- await processStreamChunk(chunk, onChunk);
2427
- } });
2428
- setIsRunning(false);
2421
+ try {
2422
+ await (resumeData !== void 0 ? await agent.resumeStream(resumeData, {
2423
+ runId: currentRunId,
2424
+ toolCallId,
2425
+ ...continuation
2426
+ }) : await agent.approveToolCall({
2427
+ runId: currentRunId,
2428
+ toolCallId,
2429
+ ...continuation
2430
+ })).processDataStream({ onChunk: async (chunk) => {
2431
+ await processStreamChunk(chunk, onChunk);
2432
+ } });
2433
+ setIsRunning(false);
2434
+ } catch (error) {
2435
+ setToolCallApprovals((prev) => {
2436
+ const next = { ...prev };
2437
+ delete next[toolCallId];
2438
+ return next;
2439
+ });
2440
+ setIsRunning(false);
2441
+ throw error;
2442
+ }
2429
2443
  };
2430
2444
  const declineToolCall = async (toolCallId) => {
2431
2445
  const onChunk = _onChunk.current;