@mastra/ai-sdk 1.4.5 → 1.4.7

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
@@ -9,7 +9,7 @@ import { TripWire, MessageList, aiV5ModelMessageToV2PromptMessage } from '@mastr
9
9
  import { RequestContext } from '@mastra/core/di';
10
10
  import { WorkingMemory, MessageHistory, SemanticRecall } from '@mastra/core/processors';
11
11
 
12
- // ../../packages/_vendored/ai_v5/dist/chunk-LPCSE373.js
12
+ // ../../packages/_vendored/ai_v5/dist/chunk-OMTTDYJT.js
13
13
  var marker = "vercel.ai.error";
14
14
  var symbol = Symbol.for(marker);
15
15
  var _a;
@@ -13862,7 +13862,9 @@ function toAISdkStream(stream, options = {
13862
13862
  function extractV6NativeApproval(messages) {
13863
13863
  const lastAssistantMsg = messages.at(-1);
13864
13864
  if (!lastAssistantMsg || lastAssistantMsg.role !== "assistant") return null;
13865
- for (const part of lastAssistantMsg.parts ?? []) {
13865
+ const parts = lastAssistantMsg.parts ?? [];
13866
+ for (let i = parts.length - 1; i >= 0; i--) {
13867
+ const part = parts[i];
13866
13868
  if (!isToolUIPart2(part) || part.state !== "approval-responded") continue;
13867
13869
  const lastSep = part.approval.id.lastIndexOf(APPROVAL_ID_SEPARATOR);
13868
13870
  if (lastSep === -1) continue;