@mastra/core 0.21.1 → 0.22.0-alpha.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/CHANGELOG.md +121 -0
- package/dist/agent/__tests__/mock-model.d.ts +6 -0
- package/dist/agent/__tests__/mock-model.d.ts.map +1 -0
- package/dist/agent/agent.d.ts +10 -4
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.types.d.ts +4 -3
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/input-processor/index.cjs +6 -6
- package/dist/agent/input-processor/index.js +1 -1
- package/dist/agent/message-list/index.d.ts +14 -1
- package/dist/agent/message-list/index.d.ts.map +1 -1
- package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts +22 -0
- package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts.map +1 -0
- package/dist/agent/test-utils.d.ts +1 -0
- package/dist/agent/test-utils.d.ts.map +1 -1
- package/dist/agent/types.d.ts +11 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/utils.d.ts +1 -1
- package/dist/agent/utils.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +7 -4
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +7 -4
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/schema.d.ts +4 -4
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -0
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
- package/dist/ai-tracing/chunk-tracing.d.ts +76 -0
- package/dist/ai-tracing/chunk-tracing.d.ts.map +1 -0
- package/dist/ai-tracing/exporters/base.d.ts +111 -0
- package/dist/ai-tracing/exporters/base.d.ts.map +1 -0
- package/dist/ai-tracing/exporters/cloud.d.ts +6 -8
- package/dist/ai-tracing/exporters/cloud.d.ts.map +1 -1
- package/dist/ai-tracing/exporters/console.d.ts +6 -6
- package/dist/ai-tracing/exporters/console.d.ts.map +1 -1
- package/dist/ai-tracing/exporters/index.d.ts +1 -0
- package/dist/ai-tracing/exporters/index.d.ts.map +1 -1
- package/dist/ai-tracing/index.cjs +48 -32
- package/dist/ai-tracing/index.d.ts +1 -0
- package/dist/ai-tracing/index.d.ts.map +1 -1
- package/dist/ai-tracing/index.js +1 -1
- package/dist/ai-tracing/spans/base.d.ts +4 -1
- package/dist/ai-tracing/spans/base.d.ts.map +1 -1
- package/dist/ai-tracing/spans/default.d.ts.map +1 -1
- package/dist/ai-tracing/tracers/base.d.ts +15 -1
- package/dist/ai-tracing/tracers/base.d.ts.map +1 -1
- package/dist/ai-tracing/types.d.ts +85 -11
- package/dist/ai-tracing/types.d.ts.map +1 -1
- package/dist/ai-tracing/utils.d.ts +14 -0
- package/dist/ai-tracing/utils.d.ts.map +1 -1
- package/dist/{chunk-FESSBG5D.cjs → chunk-34L2Z6PH.cjs} +12 -12
- package/dist/{chunk-FESSBG5D.cjs.map → chunk-34L2Z6PH.cjs.map} +1 -1
- package/dist/{chunk-3V4O35FO.js → chunk-3CVE7NQC.js} +729 -268
- package/dist/chunk-3CVE7NQC.js.map +1 -0
- package/dist/{chunk-44ODA6L3.cjs → chunk-5GIAZ3CH.cjs} +736 -271
- package/dist/chunk-5GIAZ3CH.cjs.map +1 -0
- package/dist/{chunk-5DZ4RYWL.js → chunk-5NYWRAJN.js} +3 -3
- package/dist/{chunk-5DZ4RYWL.js.map → chunk-5NYWRAJN.js.map} +1 -1
- package/dist/{chunk-APY2BE4K.cjs → chunk-634YFL42.cjs} +75 -49
- package/dist/chunk-634YFL42.cjs.map +1 -0
- package/dist/{chunk-HP7B2TQQ.js → chunk-A3TQYIIR.js} +198 -37
- package/dist/chunk-A3TQYIIR.js.map +1 -0
- package/dist/{chunk-KAV4EP3T.cjs → chunk-A4B6IAKN.cjs} +4 -4
- package/dist/{chunk-KAV4EP3T.cjs.map → chunk-A4B6IAKN.cjs.map} +1 -1
- package/dist/{chunk-T3PBU7JK.js → chunk-AGD5B3FB.js} +74 -48
- package/dist/chunk-AGD5B3FB.js.map +1 -0
- package/dist/{chunk-AJK7QPSD.cjs → chunk-CAZTWPDK.cjs} +11 -11
- package/dist/{chunk-AJK7QPSD.cjs.map → chunk-CAZTWPDK.cjs.map} +1 -1
- package/dist/{chunk-HBJVAMCS.js → chunk-F7OMDF5K.js} +93 -58
- package/dist/chunk-F7OMDF5K.js.map +1 -0
- package/dist/{chunk-DGQW5VRR.cjs → chunk-FMNZ3BPT.cjs} +202 -40
- package/dist/chunk-FMNZ3BPT.cjs.map +1 -0
- package/dist/{chunk-5NR2GY4U.js → chunk-GB5BIA4V.js} +5 -3
- package/dist/chunk-GB5BIA4V.js.map +1 -0
- package/dist/{chunk-A3QHQYMC.js → chunk-HGNRQ3OG.js} +12 -2
- package/dist/chunk-HGNRQ3OG.js.map +1 -0
- package/dist/{chunk-NHKXTGR6.js → chunk-HZIF7HQC.js} +3 -3
- package/dist/{chunk-NHKXTGR6.js.map → chunk-HZIF7HQC.js.map} +1 -1
- package/dist/{chunk-MUAFIPD7.js → chunk-ITFEGBP2.js} +4 -4
- package/dist/{chunk-MUAFIPD7.js.map → chunk-ITFEGBP2.js.map} +1 -1
- package/dist/{chunk-J2OKI2L3.js → chunk-KQBF5ZEN.js} +10 -5
- package/dist/chunk-KQBF5ZEN.js.map +1 -0
- package/dist/chunk-LJFJTTZQ.cjs +4 -0
- package/dist/chunk-LJFJTTZQ.cjs.map +1 -0
- package/dist/{chunk-OXAN5SM7.cjs → chunk-LRSB62Z6.cjs} +12 -2
- package/dist/chunk-LRSB62Z6.cjs.map +1 -0
- package/dist/{chunk-3ORA5EFD.cjs → chunk-LZUSZT7R.cjs} +5 -3
- package/dist/chunk-LZUSZT7R.cjs.map +1 -0
- package/dist/{chunk-U6CUPKV2.js → chunk-MHICZASQ.js} +5 -5
- package/dist/{chunk-U6CUPKV2.js.map → chunk-MHICZASQ.js.map} +1 -1
- package/dist/{chunk-H4KO46HZ.js → chunk-MKCC5K77.js} +3 -3
- package/dist/{chunk-H4KO46HZ.js.map → chunk-MKCC5K77.js.map} +1 -1
- package/dist/{chunk-W3DS6F6G.cjs → chunk-O4KVF3MI.cjs} +4 -4
- package/dist/{chunk-W3DS6F6G.cjs.map → chunk-O4KVF3MI.cjs.map} +1 -1
- package/dist/{chunk-462DRETM.cjs → chunk-QBPTDMR7.cjs} +121 -85
- package/dist/chunk-QBPTDMR7.cjs.map +1 -0
- package/dist/{chunk-XVREJCOW.cjs → chunk-RWWOJXMF.cjs} +6 -6
- package/dist/{chunk-XVREJCOW.cjs.map → chunk-RWWOJXMF.cjs.map} +1 -1
- package/dist/{chunk-NUURZ3AY.js → chunk-RXBG6UV2.js} +7 -4
- package/dist/chunk-RXBG6UV2.js.map +1 -0
- package/dist/{chunk-F6BMIPYW.js → chunk-SF75RENF.js} +3 -3
- package/dist/{chunk-F6BMIPYW.js.map → chunk-SF75RENF.js.map} +1 -1
- package/dist/{chunk-SE4PA467.cjs → chunk-VF676YCO.cjs} +2 -2
- package/dist/chunk-VF676YCO.cjs.map +1 -0
- package/dist/{chunk-FLXB6WXO.js → chunk-VQLW7LPO.js} +5 -3
- package/dist/chunk-VQLW7LPO.js.map +1 -0
- package/dist/{chunk-6OLRLZJ3.js → chunk-WM4RO23J.js} +2 -2
- package/dist/chunk-WM4RO23J.js.map +1 -0
- package/dist/{chunk-OY6UJ3QL.cjs → chunk-YGL6E6PD.cjs} +5 -3
- package/dist/chunk-YGL6E6PD.cjs.map +1 -0
- package/dist/{chunk-XHPBKALR.cjs → chunk-YOVX3R5U.cjs} +17 -14
- package/dist/chunk-YOVX3R5U.cjs.map +1 -0
- package/dist/{chunk-L5A4MRCK.cjs → chunk-ZABG3SZ2.cjs} +4 -4
- package/dist/{chunk-L5A4MRCK.cjs.map → chunk-ZABG3SZ2.cjs.map} +1 -1
- package/dist/{chunk-BV6CD4IZ.cjs → chunk-ZDW322JC.cjs} +12 -7
- package/dist/chunk-ZDW322JC.cjs.map +1 -0
- package/dist/chunk-ZV5CC35D.js +3 -0
- package/dist/chunk-ZV5CC35D.js.map +1 -0
- package/dist/index.cjs +56 -52
- package/dist/index.js +11 -11
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +10 -6
- package/dist/llm/index.d.ts +1 -0
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +1 -1
- package/dist/llm/model/embedding-router.d.ts +50 -0
- package/dist/llm/model/embedding-router.d.ts.map +1 -0
- package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
- package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
- package/dist/llm/model/index.d.ts +1 -0
- package/dist/llm/model/index.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/provider-options.d.ts +42 -0
- package/dist/llm/model/provider-options.d.ts.map +1 -0
- package/dist/llm/model/provider-types.generated.d.ts +30 -3
- package/dist/llm/model/router.d.ts.map +1 -1
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/loop.d.ts.map +1 -1
- package/dist/loop/network/index.d.ts +4 -1
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
- package/dist/loop/test-utils/generateText.d.ts.map +1 -1
- package/dist/loop/test-utils/mock-server-response.d.ts +7 -2
- package/dist/loop/test-utils/mock-server-response.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
- package/dist/loop/test-utils/telemetry.d.ts.map +1 -1
- package/dist/loop/test-utils/textStream.d.ts.map +1 -1
- package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
- package/dist/loop/test-utils/tools.d.ts.map +1 -1
- package/dist/loop/test-utils/utils.d.ts +2 -0
- package/dist/loop/test-utils/utils.d.ts.map +1 -1
- package/dist/loop/types.d.ts +2 -1
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +42 -42
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +28 -28
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +14 -14
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +42 -42
- package/dist/loop/workflows/schema.d.ts +14 -14
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.js +1 -1
- package/dist/memory/memory.d.ts +3 -2
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/memory/types.d.ts +10 -1
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/models-dev-4VGIWYS3.js +3 -0
- package/dist/{models-dev-3VEABUH4.js.map → models-dev-4VGIWYS3.js.map} +1 -1
- package/dist/models-dev-AXZASLL2.cjs +12 -0
- package/dist/{models-dev-L42ORGVT.cjs.map → models-dev-AXZASLL2.cjs.map} +1 -1
- package/dist/netlify-26MMY5X4.js +3 -0
- package/dist/{netlify-NYFKA6UB.js.map → netlify-26MMY5X4.js.map} +1 -1
- package/dist/netlify-F3MVGV4Y.cjs +12 -0
- package/dist/{netlify-3B6HDHRP.cjs.map → netlify-F3MVGV4Y.cjs.map} +1 -1
- package/dist/processors/index.cjs +11 -11
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry.json +62 -8
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.js +1 -1
- package/dist/scores/index.cjs +9 -9
- package/dist/scores/index.js +2 -2
- package/dist/scores/scoreTraces/index.cjs +8 -8
- package/dist/scores/scoreTraces/index.js +3 -3
- package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +5 -3
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.js +3 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/stream/RunOutput.d.ts +72 -0
- package/dist/stream/RunOutput.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output.d.ts +11 -12
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
- package/dist/stream/base/base.d.ts +7 -0
- package/dist/stream/base/base.d.ts.map +1 -0
- package/dist/stream/base/consume-stream.d.ts +5 -0
- package/dist/stream/base/consume-stream.d.ts.map +1 -0
- package/dist/stream/base/output-format-handlers.d.ts +1 -2
- package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +14 -10
- package/dist/stream/index.d.ts +2 -1
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +2 -2
- package/dist/stream/types.d.ts +18 -2
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +2 -2
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tools/index.cjs +6 -6
- package/dist/tools/index.js +2 -2
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/stream.d.ts +7 -0
- package/dist/tools/stream.d.ts.map +1 -1
- package/dist/tools/tool-builder/builder.d.ts +75 -2
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/tool.d.ts +2 -2
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +17 -12
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils.cjs +17 -17
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/workflows/default.d.ts +1 -0
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
- package/dist/workflows/evented/workflow.d.ts +5 -3
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/index.cjs +12 -12
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.js +1 -1
- package/dist/workflows/legacy/machine.d.ts +1 -1
- package/dist/workflows/step.d.ts +4 -1
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +1 -0
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +33 -24
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +15 -12
- package/src/llm/model/provider-types.generated.d.ts +30 -3
- package/dist/chunk-3ORA5EFD.cjs.map +0 -1
- package/dist/chunk-3V4O35FO.js.map +0 -1
- package/dist/chunk-44ODA6L3.cjs.map +0 -1
- package/dist/chunk-462DRETM.cjs.map +0 -1
- package/dist/chunk-5NR2GY4U.js.map +0 -1
- package/dist/chunk-6OLRLZJ3.js.map +0 -1
- package/dist/chunk-A3QHQYMC.js.map +0 -1
- package/dist/chunk-APY2BE4K.cjs.map +0 -1
- package/dist/chunk-BV6CD4IZ.cjs.map +0 -1
- package/dist/chunk-DGQW5VRR.cjs.map +0 -1
- package/dist/chunk-FLXB6WXO.js.map +0 -1
- package/dist/chunk-HBJVAMCS.js.map +0 -1
- package/dist/chunk-HP7B2TQQ.js.map +0 -1
- package/dist/chunk-J2OKI2L3.js.map +0 -1
- package/dist/chunk-NUURZ3AY.js.map +0 -1
- package/dist/chunk-OXAN5SM7.cjs.map +0 -1
- package/dist/chunk-OY6UJ3QL.cjs.map +0 -1
- package/dist/chunk-SE4PA467.cjs.map +0 -1
- package/dist/chunk-T3PBU7JK.js.map +0 -1
- package/dist/chunk-XHPBKALR.cjs.map +0 -1
- package/dist/models-dev-3VEABUH4.js +0 -3
- package/dist/models-dev-L42ORGVT.cjs +0 -12
- package/dist/netlify-3B6HDHRP.cjs +0 -12
- package/dist/netlify-NYFKA6UB.js +0 -3
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
import { ModelsDevGateway, parseModelRouterId } from './chunk-
|
|
2
|
-
import { NetlifyGateway } from './chunk-
|
|
1
|
+
import { ModelsDevGateway, parseModelRouterId } from './chunk-GB5BIA4V.js';
|
|
2
|
+
import { NetlifyGateway } from './chunk-VQLW7LPO.js';
|
|
3
3
|
import { RuntimeContext } from './chunk-HLRWYUFN.js';
|
|
4
4
|
import { MastraError } from './chunk-T3JFFQH2.js';
|
|
5
|
-
import { createHash } from 'crypto';
|
|
6
|
-
import { createOpenAICompatible } from '@ai-sdk/openai-compatible-v5';
|
|
7
5
|
import fs from 'fs';
|
|
8
6
|
import { createRequire } from 'module';
|
|
9
7
|
import os from 'os';
|
|
10
8
|
import path from 'path';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (prefixedGateway) {
|
|
16
|
-
return prefixedGateway;
|
|
17
|
-
}
|
|
18
|
-
const unprefixedGateways = gateways2.filter((g) => !g.prefix);
|
|
19
|
-
for (const gateway of unprefixedGateways) {
|
|
20
|
-
return gateway;
|
|
21
|
-
}
|
|
22
|
-
throw new MastraError({
|
|
23
|
-
id: "MODEL_ROUTER_NO_GATEWAY_FOUND",
|
|
24
|
-
category: "USER",
|
|
25
|
-
domain: "MODEL_ROUTER",
|
|
26
|
-
text: `No Mastra model router gateway found for model id ${gatewayId}`
|
|
27
|
-
});
|
|
28
|
-
}
|
|
9
|
+
import { createHash } from 'crypto';
|
|
10
|
+
import { createOpenAICompatible } from '@ai-sdk/openai-compatible-v5';
|
|
11
|
+
import { createGoogleGenerativeAI } from '@ai-sdk/google-v5';
|
|
12
|
+
import { createOpenAI } from '@ai-sdk/openai-v5';
|
|
29
13
|
|
|
30
14
|
// src/llm/model/provider-registry.json
|
|
31
15
|
var provider_registry_default = {
|
|
@@ -151,6 +135,7 @@ var provider_registry_default = {
|
|
|
151
135
|
models: [
|
|
152
136
|
"black-forest-labs/flux.1-dev",
|
|
153
137
|
"deepseek-ai/deepseek-v3.1",
|
|
138
|
+
"deepseek-ai/deepseek-v3.1-terminus",
|
|
154
139
|
"google/gemma-3-27b-it",
|
|
155
140
|
"microsoft/phi-4-mini-instruct",
|
|
156
141
|
"moonshotai/kimi-k2-instruct",
|
|
@@ -604,7 +589,7 @@ var provider_registry_default = {
|
|
|
604
589
|
apiKeyEnvVar: "BASETEN_API_KEY",
|
|
605
590
|
apiKeyHeader: "Authorization",
|
|
606
591
|
name: "Baseten",
|
|
607
|
-
models: ["Qwen3/Qwen3-Coder-480B-A35B-Instruct", "moonshotai/Kimi-K2-Instruct-0905"],
|
|
592
|
+
models: ["Qwen3/Qwen3-Coder-480B-A35B-Instruct", "moonshotai/Kimi-K2-Instruct-0905", "zai-org/GLM-4.6"],
|
|
608
593
|
docUrl: "https://docs.baseten.co/development/model-apis/overview",
|
|
609
594
|
gateway: "models.dev"
|
|
610
595
|
},
|
|
@@ -635,7 +620,8 @@ var provider_registry_default = {
|
|
|
635
620
|
apiKeyHeader: "Authorization",
|
|
636
621
|
name: "OpenCode Zen",
|
|
637
622
|
models: [
|
|
638
|
-
"an-
|
|
623
|
+
"an-gbt",
|
|
624
|
+
"big-pickle",
|
|
639
625
|
"claude-3-5-haiku",
|
|
640
626
|
"claude-haiku-4-5",
|
|
641
627
|
"claude-opus-4-1",
|
|
@@ -796,7 +782,7 @@ var provider_registry_default = {
|
|
|
796
782
|
models: [
|
|
797
783
|
"anthropic/claude-3.5-haiku",
|
|
798
784
|
"anthropic/claude-3.7-sonnet",
|
|
799
|
-
"anthropic/claude-4.5
|
|
785
|
+
"anthropic/claude-haiku-4.5",
|
|
800
786
|
"anthropic/claude-opus-4",
|
|
801
787
|
"anthropic/claude-opus-4.1",
|
|
802
788
|
"anthropic/claude-sonnet-4",
|
|
@@ -1055,16 +1041,23 @@ var provider_registry_default = {
|
|
|
1055
1041
|
name: "Anthropic",
|
|
1056
1042
|
models: [
|
|
1057
1043
|
"claude-3-5-haiku-20241022",
|
|
1044
|
+
"claude-3-5-haiku-latest",
|
|
1058
1045
|
"claude-3-5-sonnet-20240620",
|
|
1059
1046
|
"claude-3-5-sonnet-20241022",
|
|
1060
1047
|
"claude-3-7-sonnet-20250219",
|
|
1048
|
+
"claude-3-7-sonnet-latest",
|
|
1061
1049
|
"claude-3-haiku-20240307",
|
|
1062
1050
|
"claude-3-opus-20240229",
|
|
1063
1051
|
"claude-3-sonnet-20240229",
|
|
1052
|
+
"claude-haiku-4-5",
|
|
1064
1053
|
"claude-haiku-4-5-20251001",
|
|
1054
|
+
"claude-opus-4-0",
|
|
1055
|
+
"claude-opus-4-1",
|
|
1065
1056
|
"claude-opus-4-1-20250805",
|
|
1066
1057
|
"claude-opus-4-20250514",
|
|
1058
|
+
"claude-sonnet-4-0",
|
|
1067
1059
|
"claude-sonnet-4-20250514",
|
|
1060
|
+
"claude-sonnet-4-5",
|
|
1068
1061
|
"claude-sonnet-4-5-20250929"
|
|
1069
1062
|
],
|
|
1070
1063
|
docUrl: "https://docs.anthropic.com/en/docs/about-claude/models",
|
|
@@ -1101,7 +1094,8 @@ var provider_registry_default = {
|
|
|
1101
1094
|
"Qwen/Qwen3-30B-A3B-Instruct-2507",
|
|
1102
1095
|
"Qwen/Qwen3-30B-A3B-Thinking-2507",
|
|
1103
1096
|
"Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
|
1104
|
-
"ZhipuAI/GLM-4.5"
|
|
1097
|
+
"ZhipuAI/GLM-4.5",
|
|
1098
|
+
"ZhipuAI/GLM-4.6"
|
|
1105
1099
|
],
|
|
1106
1100
|
docUrl: "https://modelscope.cn/docs/model-service/API-Inference/intro",
|
|
1107
1101
|
gateway: "models.dev"
|
|
@@ -1123,6 +1117,27 @@ var provider_registry_default = {
|
|
|
1123
1117
|
docUrl: "https://llama.developer.meta.com/docs/models",
|
|
1124
1118
|
gateway: "models.dev"
|
|
1125
1119
|
},
|
|
1120
|
+
scaleway: {
|
|
1121
|
+
url: "https://api.scaleway.ai/v1",
|
|
1122
|
+
apiKeyEnvVar: "SCALEWAY_API_KEY",
|
|
1123
|
+
apiKeyHeader: "Authorization",
|
|
1124
|
+
name: "Scaleway",
|
|
1125
|
+
models: [
|
|
1126
|
+
"deepseek-r1-distill-llama-70b",
|
|
1127
|
+
"gemma-3-27b-it",
|
|
1128
|
+
"gpt-oss-120b",
|
|
1129
|
+
"llama-3.1-8b-instruct",
|
|
1130
|
+
"llama-3.3-70b-instruct",
|
|
1131
|
+
"mistral-nemo-instruct-2407",
|
|
1132
|
+
"mistral-small-3.2-24b-instruct-2506",
|
|
1133
|
+
"pixtral-12b-2409",
|
|
1134
|
+
"qwen3-235b-a22b-instruct-2507",
|
|
1135
|
+
"qwen3-coder-30b-a3b-instruct",
|
|
1136
|
+
"voxtral-small-24b-2507"
|
|
1137
|
+
],
|
|
1138
|
+
docUrl: "https://www.scaleway.com/en/docs/generative-apis/",
|
|
1139
|
+
gateway: "models.dev"
|
|
1140
|
+
},
|
|
1126
1141
|
cerebras: {
|
|
1127
1142
|
url: "https://api.cerebras.ai/v1",
|
|
1128
1143
|
apiKeyEnvVar: "CEREBRAS_API_KEY",
|
|
@@ -1247,6 +1262,7 @@ var provider_registry_default = {
|
|
|
1247
1262
|
nvidia: [
|
|
1248
1263
|
"black-forest-labs/flux.1-dev",
|
|
1249
1264
|
"deepseek-ai/deepseek-v3.1",
|
|
1265
|
+
"deepseek-ai/deepseek-v3.1-terminus",
|
|
1250
1266
|
"google/gemma-3-27b-it",
|
|
1251
1267
|
"microsoft/phi-4-mini-instruct",
|
|
1252
1268
|
"moonshotai/kimi-k2-instruct",
|
|
@@ -1596,7 +1612,7 @@ var provider_registry_default = {
|
|
|
1596
1612
|
"moonshotai/Kimi-K2-Instruct",
|
|
1597
1613
|
"openai/gpt-oss-120b"
|
|
1598
1614
|
],
|
|
1599
|
-
baseten: ["Qwen3/Qwen3-Coder-480B-A35B-Instruct", "moonshotai/Kimi-K2-Instruct-0905"],
|
|
1615
|
+
baseten: ["Qwen3/Qwen3-Coder-480B-A35B-Instruct", "moonshotai/Kimi-K2-Instruct-0905", "zai-org/GLM-4.6"],
|
|
1600
1616
|
huggingface: [
|
|
1601
1617
|
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
1602
1618
|
"Qwen/Qwen3-Coder-480B-A35B-Instruct",
|
|
@@ -1611,7 +1627,8 @@ var provider_registry_default = {
|
|
|
1611
1627
|
"zai-org/GLM-4.6"
|
|
1612
1628
|
],
|
|
1613
1629
|
opencode: [
|
|
1614
|
-
"an-
|
|
1630
|
+
"an-gbt",
|
|
1631
|
+
"big-pickle",
|
|
1615
1632
|
"claude-3-5-haiku",
|
|
1616
1633
|
"claude-haiku-4-5",
|
|
1617
1634
|
"claude-opus-4-1",
|
|
@@ -1713,7 +1730,7 @@ var provider_registry_default = {
|
|
|
1713
1730
|
openrouter: [
|
|
1714
1731
|
"anthropic/claude-3.5-haiku",
|
|
1715
1732
|
"anthropic/claude-3.7-sonnet",
|
|
1716
|
-
"anthropic/claude-4.5
|
|
1733
|
+
"anthropic/claude-haiku-4.5",
|
|
1717
1734
|
"anthropic/claude-opus-4",
|
|
1718
1735
|
"anthropic/claude-opus-4.1",
|
|
1719
1736
|
"anthropic/claude-sonnet-4",
|
|
@@ -1894,16 +1911,23 @@ var provider_registry_default = {
|
|
|
1894
1911
|
lmstudio: ["openai/gpt-oss-20b", "qwen/qwen3-30b-a3b-2507", "qwen/qwen3-coder-30b"],
|
|
1895
1912
|
anthropic: [
|
|
1896
1913
|
"claude-3-5-haiku-20241022",
|
|
1914
|
+
"claude-3-5-haiku-latest",
|
|
1897
1915
|
"claude-3-5-sonnet-20240620",
|
|
1898
1916
|
"claude-3-5-sonnet-20241022",
|
|
1899
1917
|
"claude-3-7-sonnet-20250219",
|
|
1918
|
+
"claude-3-7-sonnet-latest",
|
|
1900
1919
|
"claude-3-haiku-20240307",
|
|
1901
1920
|
"claude-3-opus-20240229",
|
|
1902
1921
|
"claude-3-sonnet-20240229",
|
|
1922
|
+
"claude-haiku-4-5",
|
|
1903
1923
|
"claude-haiku-4-5-20251001",
|
|
1924
|
+
"claude-opus-4-0",
|
|
1925
|
+
"claude-opus-4-1",
|
|
1904
1926
|
"claude-opus-4-1-20250805",
|
|
1905
1927
|
"claude-opus-4-20250514",
|
|
1928
|
+
"claude-sonnet-4-0",
|
|
1906
1929
|
"claude-sonnet-4-20250514",
|
|
1930
|
+
"claude-sonnet-4-5",
|
|
1907
1931
|
"claude-sonnet-4-5-20250929"
|
|
1908
1932
|
],
|
|
1909
1933
|
"fireworks-ai": [
|
|
@@ -1924,7 +1948,8 @@ var provider_registry_default = {
|
|
|
1924
1948
|
"Qwen/Qwen3-30B-A3B-Instruct-2507",
|
|
1925
1949
|
"Qwen/Qwen3-30B-A3B-Thinking-2507",
|
|
1926
1950
|
"Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
|
1927
|
-
"ZhipuAI/GLM-4.5"
|
|
1951
|
+
"ZhipuAI/GLM-4.5",
|
|
1952
|
+
"ZhipuAI/GLM-4.6"
|
|
1928
1953
|
],
|
|
1929
1954
|
llama: [
|
|
1930
1955
|
"cerebras-llama-4-maverick-17b-128e-instruct",
|
|
@@ -1935,6 +1960,19 @@ var provider_registry_default = {
|
|
|
1935
1960
|
"llama-4-maverick-17b-128e-instruct-fp8",
|
|
1936
1961
|
"llama-4-scout-17b-16e-instruct-fp8"
|
|
1937
1962
|
],
|
|
1963
|
+
scaleway: [
|
|
1964
|
+
"deepseek-r1-distill-llama-70b",
|
|
1965
|
+
"gemma-3-27b-it",
|
|
1966
|
+
"gpt-oss-120b",
|
|
1967
|
+
"llama-3.1-8b-instruct",
|
|
1968
|
+
"llama-3.3-70b-instruct",
|
|
1969
|
+
"mistral-nemo-instruct-2407",
|
|
1970
|
+
"mistral-small-3.2-24b-instruct-2506",
|
|
1971
|
+
"pixtral-12b-2409",
|
|
1972
|
+
"qwen3-235b-a22b-instruct-2507",
|
|
1973
|
+
"qwen3-coder-30b-a3b-instruct",
|
|
1974
|
+
"voxtral-small-24b-2507"
|
|
1975
|
+
],
|
|
1938
1976
|
cerebras: ["gpt-oss-120b", "qwen-3-235b-a22b-instruct-2507", "qwen-3-coder-480b"],
|
|
1939
1977
|
netlify: [
|
|
1940
1978
|
"anthropic/claude-3-5-haiku-20241022",
|
|
@@ -2160,8 +2198,8 @@ var GatewayRegistry = class _GatewayRegistry {
|
|
|
2160
2198
|
}
|
|
2161
2199
|
this.isRefreshing = true;
|
|
2162
2200
|
try {
|
|
2163
|
-
const { ModelsDevGateway: ModelsDevGateway2 } = await import('./models-dev-
|
|
2164
|
-
const { NetlifyGateway: NetlifyGateway2 } = await import('./netlify-
|
|
2201
|
+
const { ModelsDevGateway: ModelsDevGateway2 } = await import('./models-dev-4VGIWYS3.js');
|
|
2202
|
+
const { NetlifyGateway: NetlifyGateway2 } = await import('./netlify-26MMY5X4.js');
|
|
2165
2203
|
const { fetchProvidersFromGateways, writeRegistryFiles } = await import('./registry-generator-DXRSYYYT.js');
|
|
2166
2204
|
const gateways2 = [new ModelsDevGateway2({}), new NetlifyGateway2()];
|
|
2167
2205
|
const { providers, models } = await fetchProvidersFromGateways(gateways2);
|
|
@@ -2270,6 +2308,24 @@ if (autoRefreshEnabled) {
|
|
|
2270
2308
|
GatewayRegistry.getInstance({ useDynamicLoading: isDev }).startAutoRefresh();
|
|
2271
2309
|
}
|
|
2272
2310
|
|
|
2311
|
+
// src/llm/model/gateways/index.ts
|
|
2312
|
+
function findGatewayForModel(gatewayId, gateways2) {
|
|
2313
|
+
const prefixedGateway = gateways2.find((g) => g.prefix && gatewayId.startsWith(`${g.prefix}/`));
|
|
2314
|
+
if (prefixedGateway) {
|
|
2315
|
+
return prefixedGateway;
|
|
2316
|
+
}
|
|
2317
|
+
const unprefixedGateways = gateways2.filter((g) => !g.prefix);
|
|
2318
|
+
for (const gateway of unprefixedGateways) {
|
|
2319
|
+
return gateway;
|
|
2320
|
+
}
|
|
2321
|
+
throw new MastraError({
|
|
2322
|
+
id: "MODEL_ROUTER_NO_GATEWAY_FOUND",
|
|
2323
|
+
category: "USER",
|
|
2324
|
+
domain: "MODEL_ROUTER",
|
|
2325
|
+
text: `No Mastra model router gateway found for model id ${gatewayId}`
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2273
2329
|
// src/llm/model/router.ts
|
|
2274
2330
|
function getStaticProvidersByGateway(name) {
|
|
2275
2331
|
return Object.fromEntries(Object.entries(PROVIDER_REGISTRY).filter(([_provider, config]) => config.gateway === name));
|
|
@@ -2325,7 +2381,11 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
2325
2381
|
async doStream(options) {
|
|
2326
2382
|
let apiKey;
|
|
2327
2383
|
try {
|
|
2328
|
-
|
|
2384
|
+
if (this.config.url) {
|
|
2385
|
+
apiKey = this.config.apiKey || "";
|
|
2386
|
+
} else {
|
|
2387
|
+
apiKey = this.config.apiKey || await this.gateway.getApiKey(this.config.routerId);
|
|
2388
|
+
}
|
|
2329
2389
|
} catch (error) {
|
|
2330
2390
|
return {
|
|
2331
2391
|
stream: new ReadableStream({
|
|
@@ -2356,7 +2416,8 @@ var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
|
2356
2416
|
name: providerId,
|
|
2357
2417
|
apiKey,
|
|
2358
2418
|
baseURL: this.config.url,
|
|
2359
|
-
headers: this.config.headers
|
|
2419
|
+
headers: this.config.headers,
|
|
2420
|
+
supportsStructuredOutputs: true
|
|
2360
2421
|
}).chatModel(modelId);
|
|
2361
2422
|
_ModelRouterLanguageModel.modelInstances.set(key, modelInstance2);
|
|
2362
2423
|
return modelInstance2;
|
|
@@ -2393,7 +2454,107 @@ async function resolveModelConfig(modelConfig, runtimeContext = new RuntimeConte
|
|
|
2393
2454
|
}
|
|
2394
2455
|
throw new Error("Invalid model configuration provided");
|
|
2395
2456
|
}
|
|
2457
|
+
var ModelRouterEmbeddingModel = class {
|
|
2458
|
+
specificationVersion = "v2";
|
|
2459
|
+
modelId;
|
|
2460
|
+
provider;
|
|
2461
|
+
maxEmbeddingsPerCall = 2048;
|
|
2462
|
+
supportsParallelCalls = true;
|
|
2463
|
+
providerModel;
|
|
2464
|
+
constructor(config) {
|
|
2465
|
+
let normalizedConfig;
|
|
2466
|
+
if (typeof config === "string") {
|
|
2467
|
+
const parts = config.split("/");
|
|
2468
|
+
if (parts.length !== 2) {
|
|
2469
|
+
throw new Error(`Invalid model string format: "${config}". Expected format: "provider/model"`);
|
|
2470
|
+
}
|
|
2471
|
+
const [providerId, modelId] = parts;
|
|
2472
|
+
normalizedConfig = { providerId, modelId };
|
|
2473
|
+
} else if ("providerId" in config && "modelId" in config) {
|
|
2474
|
+
normalizedConfig = {
|
|
2475
|
+
providerId: config.providerId,
|
|
2476
|
+
modelId: config.modelId,
|
|
2477
|
+
url: config.url,
|
|
2478
|
+
apiKey: config.apiKey,
|
|
2479
|
+
headers: config.headers
|
|
2480
|
+
};
|
|
2481
|
+
} else {
|
|
2482
|
+
const parts = config.id.split("/");
|
|
2483
|
+
if (parts.length !== 2) {
|
|
2484
|
+
throw new Error(`Invalid model string format: "${config.id}". Expected format: "provider/model"`);
|
|
2485
|
+
}
|
|
2486
|
+
const [providerId, modelId] = parts;
|
|
2487
|
+
normalizedConfig = {
|
|
2488
|
+
providerId,
|
|
2489
|
+
modelId,
|
|
2490
|
+
url: config.url,
|
|
2491
|
+
apiKey: config.apiKey,
|
|
2492
|
+
headers: config.headers
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
this.provider = normalizedConfig.providerId;
|
|
2496
|
+
this.modelId = normalizedConfig.modelId;
|
|
2497
|
+
if (normalizedConfig.url) {
|
|
2498
|
+
const apiKey = normalizedConfig.apiKey || "";
|
|
2499
|
+
this.providerModel = createOpenAICompatible({
|
|
2500
|
+
name: normalizedConfig.providerId,
|
|
2501
|
+
apiKey,
|
|
2502
|
+
baseURL: normalizedConfig.url,
|
|
2503
|
+
headers: normalizedConfig.headers
|
|
2504
|
+
}).textEmbeddingModel(normalizedConfig.modelId);
|
|
2505
|
+
} else {
|
|
2506
|
+
const registry = GatewayRegistry.getInstance();
|
|
2507
|
+
const providerConfig = registry.getProviderConfig(normalizedConfig.providerId);
|
|
2508
|
+
if (!providerConfig) {
|
|
2509
|
+
throw new Error(`Unknown provider: ${normalizedConfig.providerId}`);
|
|
2510
|
+
}
|
|
2511
|
+
let apiKey = normalizedConfig.apiKey;
|
|
2512
|
+
if (!apiKey) {
|
|
2513
|
+
const apiKeyEnvVar = providerConfig.apiKeyEnvVar;
|
|
2514
|
+
if (Array.isArray(apiKeyEnvVar)) {
|
|
2515
|
+
for (const envVar of apiKeyEnvVar) {
|
|
2516
|
+
apiKey = process.env[envVar];
|
|
2517
|
+
if (apiKey) break;
|
|
2518
|
+
}
|
|
2519
|
+
} else {
|
|
2520
|
+
apiKey = process.env[apiKeyEnvVar];
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
if (!apiKey) {
|
|
2524
|
+
const envVarDisplay = Array.isArray(providerConfig.apiKeyEnvVar) ? providerConfig.apiKeyEnvVar.join(" or ") : providerConfig.apiKeyEnvVar;
|
|
2525
|
+
throw new Error(`API key not found for provider ${normalizedConfig.providerId}. Set ${envVarDisplay}`);
|
|
2526
|
+
}
|
|
2527
|
+
if (normalizedConfig.providerId === "openai") {
|
|
2528
|
+
this.providerModel = createOpenAI({ apiKey }).textEmbeddingModel(
|
|
2529
|
+
normalizedConfig.modelId
|
|
2530
|
+
);
|
|
2531
|
+
} else if (normalizedConfig.providerId === "google") {
|
|
2532
|
+
this.providerModel = createGoogleGenerativeAI({ apiKey }).textEmbedding(
|
|
2533
|
+
normalizedConfig.modelId
|
|
2534
|
+
);
|
|
2535
|
+
} else {
|
|
2536
|
+
if (!providerConfig.url) {
|
|
2537
|
+
throw new Error(`Provider ${normalizedConfig.providerId} does not have a URL configured`);
|
|
2538
|
+
}
|
|
2539
|
+
this.providerModel = createOpenAICompatible({
|
|
2540
|
+
name: normalizedConfig.providerId,
|
|
2541
|
+
apiKey,
|
|
2542
|
+
baseURL: providerConfig.url
|
|
2543
|
+
}).textEmbeddingModel(normalizedConfig.modelId);
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
if (this.providerModel.maxEmbeddingsPerCall !== void 0) {
|
|
2547
|
+
this.maxEmbeddingsPerCall = this.providerModel.maxEmbeddingsPerCall;
|
|
2548
|
+
}
|
|
2549
|
+
if (this.providerModel.supportsParallelCalls !== void 0) {
|
|
2550
|
+
this.supportsParallelCalls = this.providerModel.supportsParallelCalls;
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
async doEmbed(args) {
|
|
2554
|
+
return this.providerModel.doEmbed(args);
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2396
2557
|
|
|
2397
|
-
export { ModelRouterLanguageModel, PROVIDER_REGISTRY, getProviderConfig, parseModelString, resolveModelConfig };
|
|
2398
|
-
//# sourceMappingURL=chunk-
|
|
2399
|
-
//# sourceMappingURL=chunk-
|
|
2558
|
+
export { ModelRouterEmbeddingModel, ModelRouterLanguageModel, PROVIDER_REGISTRY, getProviderConfig, parseModelString, resolveModelConfig };
|
|
2559
|
+
//# sourceMappingURL=chunk-A3TQYIIR.js.map
|
|
2560
|
+
//# sourceMappingURL=chunk-A3TQYIIR.js.map
|