@mastra/agent-builder 1.0.0-beta.5 → 1.0.0-beta.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @mastra/agent-builder
2
2
 
3
+ ## 1.0.0-beta.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Add support for AI SDK v6 (LanguageModelV3) ([#11191](https://github.com/mastra-ai/mastra/pull/11191))
8
+
9
+ Agents can now use `LanguageModelV3` models from AI SDK v6 beta providers like `@ai-sdk/openai@^3.0.0-beta`.
10
+
11
+ **New features:**
12
+ - Usage normalization: V3's nested usage format is normalized to Mastra's flat format with `reasoningTokens`, `cachedInputTokens`, and raw data preserved in a `raw` field
13
+
14
+ **Backward compatible:** All existing V1 and V2 models continue to work unchanged.
15
+
16
+ - Updated dependencies [[`fb5a834`](https://github.com/mastra-ai/mastra/commit/fb5a834f8bd01e66384ac3e2a719641b14d40760), [`4f94ed8`](https://github.com/mastra-ai/mastra/commit/4f94ed8177abfde3ec536e3574883e075423350c), [`ac3cc23`](https://github.com/mastra-ai/mastra/commit/ac3cc2397d1966bc0fc2736a223abc449d3c7719), [`a86f4df`](https://github.com/mastra-ai/mastra/commit/a86f4df0407311e0d2ea49b9a541f0938810d6a9), [`029540c`](https://github.com/mastra-ai/mastra/commit/029540ca1e582fc2dd8d288ecd4a9b0f31a954ef), [`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`01b20fe`](https://github.com/mastra-ai/mastra/commit/01b20fefb7c67c2b7d79417598ef4e60256d1225), [`0dbf199`](https://github.com/mastra-ai/mastra/commit/0dbf199110f22192ce5c95b1c8148d4872b4d119), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
17
+ - @mastra/memory@1.0.0-beta.6
18
+ - @mastra/core@1.0.0-beta.14
19
+
3
20
  ## 1.0.0-beta.5
4
21
 
5
22
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __commonJS, require_token_error, __toESM } from './chunk-E53QBCQN.js';
2
- import { Agent, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '@mastra/core/agent';
2
+ import { Agent, isSupportedLanguageModel, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '@mastra/core/agent';
3
3
  import { Memory } from '@mastra/memory';
4
4
  import { exec as exec$1, execFile as execFile$1, spawn as spawn$1 } from 'child_process';
5
5
  import { mkdtemp, rm, readFile, writeFile, readdir, mkdir, copyFile, stat } from 'fs/promises';
@@ -3478,7 +3478,8 @@ Return the actual exported names of the units, as well as the file names.`,
3478
3478
  listDirectory: tools.listDirectory
3479
3479
  }
3480
3480
  });
3481
- const isV2 = model.specificationVersion === "v2";
3481
+ const resolvedModel = await agent.getModel();
3482
+ const isSupported = isSupportedLanguageModel(resolvedModel);
3482
3483
  const prompt = `Analyze the Mastra project directory structure at "${templateDir}".
3483
3484
 
3484
3485
  List directory contents using listDirectory tool, and then analyze each file with readFile tool.
@@ -3497,7 +3498,7 @@ Return the actual exported names of the units, as well as the file names.`,
3497
3498
  networks: z.array(z.object({ name: z.string(), file: z.string() })).optional(),
3498
3499
  other: z.array(z.object({ name: z.string(), file: z.string() })).optional()
3499
3500
  });
3500
- const result = isV2 ? await tryGenerateWithJsonFallback(agent, prompt, {
3501
+ const result = isSupported ? await tryGenerateWithJsonFallback(agent, prompt, {
3501
3502
  structuredOutput: {
3502
3503
  schema: output
3503
3504
  },
@@ -4247,8 +4248,9 @@ For each task:
4247
4248
 
4248
4249
  Start by listing your tasks and work through them systematically!
4249
4250
  `;
4250
- const isV2 = model.specificationVersion === "v2";
4251
- const result = isV2 ? await agentBuilder.stream(prompt) : await agentBuilder.streamLegacy(prompt);
4251
+ const resolvedModel = await agentBuilder.getModel();
4252
+ const isSupported = isSupportedLanguageModel(resolvedModel);
4253
+ const result = isSupported ? await agentBuilder.stream(prompt) : await agentBuilder.streamLegacy(prompt);
4252
4254
  const actualResolutions = [];
4253
4255
  for await (const chunk of result.fullStream) {
4254
4256
  if (chunk.type === "step-finish" || chunk.type === "step-start") {
@@ -4489,9 +4491,10 @@ Be thorough and methodical. Always use listDirectory to verify actual file exist
4489
4491
  Start by running validateCode with all validation types to get a complete picture of any issues, then systematically fix them.` : `Continue validation and fixing for the template integration at ${targetPath}. This is iteration ${currentIteration} of validation.
4490
4492
 
4491
4493
  Previous iterations may have fixed some issues, so start by re-running validateCode to see the current state, then fix any remaining issues.`;
4492
- const isV2 = model.specificationVersion === "v2";
4494
+ const resolvedModel = await validationAgent.getModel();
4495
+ const isSupported = isSupportedLanguageModel(resolvedModel);
4493
4496
  const output = z.object({ success: z.boolean() });
4494
- const result = isV2 ? await tryStreamWithJsonFallback(validationAgent, iterationPrompt, {
4497
+ const result = isSupported ? await tryStreamWithJsonFallback(validationAgent, iterationPrompt, {
4495
4498
  structuredOutput: {
4496
4499
  schema: output
4497
4500
  }