@mastra/ai-sdk 1.4.1-alpha.1 → 1.4.1

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
@@ -13277,15 +13277,8 @@ function toAISdkStream(stream, options = {
13277
13277
 
13278
13278
  // src/chat-route.ts
13279
13279
  function extractV6NativeApproval(messages) {
13280
- let lastAssistantMsg;
13281
- for (let i = messages.length - 1; i >= 0; i--) {
13282
- const message = messages[i];
13283
- if (message.role === "assistant") {
13284
- lastAssistantMsg = message;
13285
- break;
13286
- }
13287
- }
13288
- if (!lastAssistantMsg) return null;
13280
+ const lastAssistantMsg = messages.at(-1);
13281
+ if (!lastAssistantMsg || lastAssistantMsg.role !== "assistant") return null;
13289
13282
  for (const part of lastAssistantMsg.parts ?? []) {
13290
13283
  if (!isToolUIPart2(part) || part.state !== "approval-responded") continue;
13291
13284
  const lastSep = part.approval.id.lastIndexOf(APPROVAL_ID_SEPARATOR);