@mastra/ai-sdk 1.6.0 → 1.6.1-alpha.0

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
@@ -10,7 +10,7 @@ import { TripWire, MessageList, aiV5ModelMessageToV2PromptMessage } from '@mastr
10
10
  import { RequestContext } from '@mastra/core/di';
11
11
  import { WorkingMemory, MessageHistory, SemanticRecall } from '@mastra/core/processors';
12
12
 
13
- // ../../packages/_vendored/ai_v5/dist/chunk-I2JBSJEA.js
13
+ // ../../packages/_vendored/ai_v5/dist/chunk-RGIGIB4E.js
14
14
  var marker = "vercel.ai.error";
15
15
  var symbol = Symbol.for(marker);
16
16
  var _a;
@@ -13900,10 +13900,21 @@ async function handleChatStream({
13900
13900
  if (resumeData && !runId) {
13901
13901
  throw new Error("runId is required when resumeData is provided");
13902
13902
  }
13903
- const agentObj = agentVersion ? await mastra.getAgentById(agentId, agentVersion) : mastra.getAgentById(agentId);
13904
- if (!agentObj) {
13903
+ const baseAgent = mastra.getAgentById(agentId);
13904
+ if (!baseAgent) {
13905
13905
  throw new Error(`Agent ${agentId} not found`);
13906
13906
  }
13907
+ let agentObj = baseAgent;
13908
+ const editorAgent = mastra.getEditor?.()?.agent;
13909
+ if (editorAgent) {
13910
+ agentObj = await editorAgent.applyStoredOverrides(
13911
+ baseAgent,
13912
+ agentVersion ?? { status: "published" },
13913
+ requestContext
13914
+ );
13915
+ } else if (agentVersion) {
13916
+ agentObj = await mastra.getAgentById(agentId, agentVersion);
13917
+ }
13907
13918
  if (!Array.isArray(messages)) {
13908
13919
  throw new Error("Messages must be an array of UIMessage objects");
13909
13920
  }