@mastra/deployer 0.19.0 → 0.19.1-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 +18 -0
- package/dist/server/handlers/routes/agents/handlers.d.ts +9 -1
- package/dist/server/handlers/routes/agents/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/agents/router.d.ts.map +1 -1
- package/dist/server/index.cjs +47 -2
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +47 -2
- package/dist/server/index.js.map +1 -1
- package/package.json +5 -5
package/dist/server/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import { stream } from 'hono/streaming';
|
|
|
23
23
|
import { bodyLimit } from 'hono/body-limit';
|
|
24
24
|
import { getAgentBuilderActionsHandler as getAgentBuilderActionsHandler$1, getAgentBuilderActionByIdHandler as getAgentBuilderActionByIdHandler$1, getAgentBuilderActionRunsHandler as getAgentBuilderActionRunsHandler$1, getAgentBuilderActionRunExecutionResultHandler as getAgentBuilderActionRunExecutionResultHandler$1, getAgentBuilderActionRunByIdHandler as getAgentBuilderActionRunByIdHandler$1, resumeAgentBuilderActionHandler as resumeAgentBuilderActionHandler$1, resumeAsyncAgentBuilderActionHandler as resumeAsyncAgentBuilderActionHandler$1, streamAgentBuilderActionHandler as streamAgentBuilderActionHandler$1, streamVNextAgentBuilderActionHandler as streamVNextAgentBuilderActionHandler$1, createAgentBuilderActionRunHandler as createAgentBuilderActionRunHandler$1, startAsyncAgentBuilderActionHandler as startAsyncAgentBuilderActionHandler$1, startAgentBuilderActionRunHandler as startAgentBuilderActionRunHandler$1, watchAgentBuilderActionHandler as watchAgentBuilderActionHandler$1, cancelAgentBuilderActionRunHandler as cancelAgentBuilderActionRunHandler$1, sendAgentBuilderActionRunEventHandler as sendAgentBuilderActionRunEventHandler$1 } from '@mastra/server/handlers/agent-builder';
|
|
25
25
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
26
|
+
import { getProviderConfig, PROVIDER_REGISTRY } from '@mastra/core/llm';
|
|
26
27
|
import { getAgentsHandler as getAgentsHandler$1, getAgentByIdHandler as getAgentByIdHandler$1, getEvalsByAgentIdHandler as getEvalsByAgentIdHandler$1, getLiveEvalsByAgentIdHandler as getLiveEvalsByAgentIdHandler$1, generateLegacyHandler as generateLegacyHandler$1, generateHandler as generateHandler$1, streamNetworkHandler as streamNetworkHandler$1, generateVNextHandler as generateVNextHandler$1, streamVNextGenerateHandler as streamVNextGenerateHandler$1, streamGenerateLegacyHandler as streamGenerateLegacyHandler$1, streamGenerateHandler as streamGenerateHandler$1, streamVNextUIMessageHandler as streamVNextUIMessageHandler$1, updateAgentModelHandler as updateAgentModelHandler$1, reorderAgentModelListHandler as reorderAgentModelListHandler$1, updateAgentModelInModelListHandler as updateAgentModelInModelListHandler$1 } from '@mastra/server/handlers/agents';
|
|
27
28
|
import { Agent } from '@mastra/core/agent';
|
|
28
29
|
import { z } from 'zod';
|
|
@@ -2381,6 +2382,27 @@ async function getAgentsHandler(c2) {
|
|
|
2381
2382
|
});
|
|
2382
2383
|
return c2.json(serializedAgents);
|
|
2383
2384
|
}
|
|
2385
|
+
async function getProvidersHandler(c2) {
|
|
2386
|
+
try {
|
|
2387
|
+
const providers = [];
|
|
2388
|
+
for (const [providerId, config] of Object.entries(PROVIDER_REGISTRY)) {
|
|
2389
|
+
const hasApiKey = !!(typeof config.apiKeyEnvVar === `string` ? process.env[config.apiKeyEnvVar] : Array.isArray(config.apiKeyEnvVar) ? config.apiKeyEnvVar.every((k) => !!process.env[k]) : false);
|
|
2390
|
+
const providerConfig = getProviderConfig(providerId);
|
|
2391
|
+
providers.push({
|
|
2392
|
+
id: providerId,
|
|
2393
|
+
name: config.name,
|
|
2394
|
+
envVar: config.apiKeyEnvVar,
|
|
2395
|
+
connected: hasApiKey,
|
|
2396
|
+
models: [...config.models],
|
|
2397
|
+
// Convert readonly array to mutable
|
|
2398
|
+
docUrl: providerConfig?.docUrl || null
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
return c2.json({ providers });
|
|
2402
|
+
} catch (error) {
|
|
2403
|
+
return handleError(error, "Error getting providers");
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2384
2406
|
async function getAgentByIdHandler(c2) {
|
|
2385
2407
|
const mastra = c2.get("mastra");
|
|
2386
2408
|
const agentId = c2.req.param("agentId");
|
|
@@ -2694,8 +2716,18 @@ async function getModelProvidersHandler(c2) {
|
|
|
2694
2716
|
const providers = Object.entries(AllowedProviderKeys);
|
|
2695
2717
|
const envKeys = Object.keys(envVars);
|
|
2696
2718
|
const availableProviders = providers.filter(([_, value]) => envKeys.includes(value) && !!envVars[value]);
|
|
2697
|
-
const
|
|
2698
|
-
|
|
2719
|
+
const providerInfo = availableProviders.map(([key, envVar]) => {
|
|
2720
|
+
const providerConfig = getProviderConfig(key);
|
|
2721
|
+
return {
|
|
2722
|
+
id: key,
|
|
2723
|
+
name: key.charAt(0).toUpperCase() + key.slice(1).replace(/-/g, " "),
|
|
2724
|
+
envVar,
|
|
2725
|
+
hasApiKey: !!envVars[envVar],
|
|
2726
|
+
docUrl: providerConfig?.docUrl || null,
|
|
2727
|
+
models: providerConfig?.models || []
|
|
2728
|
+
};
|
|
2729
|
+
});
|
|
2730
|
+
return c2.json(providerInfo);
|
|
2699
2731
|
}
|
|
2700
2732
|
async function updateAgentModelInModelListHandler(c2) {
|
|
2701
2733
|
try {
|
|
@@ -3016,6 +3048,19 @@ function agentsRouter(bodyLimitOptions) {
|
|
|
3016
3048
|
}),
|
|
3017
3049
|
getAgentsHandler
|
|
3018
3050
|
);
|
|
3051
|
+
router.get(
|
|
3052
|
+
"/providers",
|
|
3053
|
+
w({
|
|
3054
|
+
description: "Get all available model providers with connection status",
|
|
3055
|
+
tags: ["agents"],
|
|
3056
|
+
responses: {
|
|
3057
|
+
200: {
|
|
3058
|
+
description: "List of model providers with their connection status"
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
}),
|
|
3062
|
+
getProvidersHandler
|
|
3063
|
+
);
|
|
3019
3064
|
router.get(
|
|
3020
3065
|
"/:agentId",
|
|
3021
3066
|
w({
|