@mastra/server 1.57.0 → 1.58.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.
Files changed (109) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/{a2a-uPi5sPwb.js → a2a-CHi9AJ0n.js} +598 -178
  3. package/dist/a2a-CHi9AJ0n.js.map +1 -0
  4. package/dist/{a2a-DKnwIgiw.cjs → a2a-D3ZYeXIx.cjs} +598 -178
  5. package/dist/a2a-D3ZYeXIx.cjs.map +1 -0
  6. package/dist/{api-schema-manifest-7-NC9Dyc.cjs → api-schema-manifest-J5hfk5ZZ.cjs} +2 -2
  7. package/dist/{api-schema-manifest-7-NC9Dyc.cjs.map → api-schema-manifest-J5hfk5ZZ.cjs.map} +1 -1
  8. package/dist/{api-schema-manifest-C5hpdIE_.js → api-schema-manifest-R8CsF6RX.js} +2 -2
  9. package/dist/{api-schema-manifest-C5hpdIE_.js.map → api-schema-manifest-R8CsF6RX.js.map} +1 -1
  10. package/dist/{datasets-Cvix7Rms.cjs → datasets-BMeFvFwT.cjs} +43 -1
  11. package/dist/datasets-BMeFvFwT.cjs.map +1 -0
  12. package/dist/{datasets-dhXnHLAL.js → datasets-BeBH9Seg.js} +38 -2
  13. package/dist/datasets-BeBH9Seg.js.map +1 -0
  14. package/dist/{dist-COHIL6fR.cjs → dist-DgY0llRv.cjs} +116 -28
  15. package/dist/dist-DgY0llRv.cjs.map +1 -0
  16. package/dist/{dist-DGqlUp0b.js → dist-IUXZtNBY.js} +116 -28
  17. package/dist/dist-IUXZtNBY.js.map +1 -0
  18. package/dist/docs/SKILL.md +1 -1
  19. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  20. package/dist/docs/references/docs-agents-a2a.md +36 -2
  21. package/dist/route-builder-CIk5k35M.js.map +1 -1
  22. package/dist/route-builder-CgLVYL1c.cjs.map +1 -1
  23. package/dist/{routes-hSY4wTeS.cjs → routes-BzR8iVj4.cjs} +2 -2
  24. package/dist/{routes-hSY4wTeS.cjs.map → routes-BzR8iVj4.cjs.map} +1 -1
  25. package/dist/{routes-CRoTKPvQ.js → routes-C7iRCN_l.js} +2 -2
  26. package/dist/{routes-CRoTKPvQ.js.map → routes-C7iRCN_l.js.map} +1 -1
  27. package/dist/server/a2a/store.cjs +26 -2
  28. package/dist/server/a2a/store.cjs.map +1 -1
  29. package/dist/server/a2a/store.d.ts +18 -2
  30. package/dist/server/a2a/store.d.ts.map +1 -1
  31. package/dist/server/a2a/store.js +26 -3
  32. package/dist/server/a2a/store.js.map +1 -1
  33. package/dist/server/a2a/task-state.d.ts +4 -0
  34. package/dist/server/a2a/task-state.d.ts.map +1 -0
  35. package/dist/server/a2a/tasks.d.ts +1 -1
  36. package/dist/server/a2a/tasks.d.ts.map +1 -1
  37. package/dist/server/handlers/a2a.cjs +1 -1
  38. package/dist/server/handlers/a2a.d.ts +3 -2
  39. package/dist/server/handlers/a2a.d.ts.map +1 -1
  40. package/dist/server/handlers/a2a.js +1 -1
  41. package/dist/server/handlers/agent-builder.cjs +1 -1
  42. package/dist/server/handlers/agent-builder.js +1 -1
  43. package/dist/server/handlers/agent-versions.cjs +6 -0
  44. package/dist/server/handlers/agent-versions.cjs.map +1 -1
  45. package/dist/server/handlers/agent-versions.d.ts.map +1 -1
  46. package/dist/server/handlers/agent-versions.js +6 -0
  47. package/dist/server/handlers/agent-versions.js.map +1 -1
  48. package/dist/server/handlers/datasets.cjs +26 -11
  49. package/dist/server/handlers/datasets.cjs.map +1 -1
  50. package/dist/server/handlers/datasets.d.ts +136 -0
  51. package/dist/server/handlers/datasets.d.ts.map +1 -1
  52. package/dist/server/handlers/datasets.js +26 -11
  53. package/dist/server/handlers/datasets.js.map +1 -1
  54. package/dist/server/handlers/mcp-client-versions.cjs +1 -1
  55. package/dist/server/handlers/mcp-client-versions.js +1 -1
  56. package/dist/server/handlers/observability.cjs +20 -9
  57. package/dist/server/handlers/observability.cjs.map +1 -1
  58. package/dist/server/handlers/observability.d.ts.map +1 -1
  59. package/dist/server/handlers/observability.js +20 -9
  60. package/dist/server/handlers/observability.js.map +1 -1
  61. package/dist/server/handlers/prompt-block-versions.cjs +1 -1
  62. package/dist/server/handlers/prompt-block-versions.js +1 -1
  63. package/dist/server/handlers/scorer-versions.cjs +1 -1
  64. package/dist/server/handlers/scorer-versions.js +1 -1
  65. package/dist/server/handlers/stored-agents.cjs +16 -1
  66. package/dist/server/handlers/stored-agents.cjs.map +1 -1
  67. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  68. package/dist/server/handlers/stored-agents.js +16 -1
  69. package/dist/server/handlers/stored-agents.js.map +1 -1
  70. package/dist/server/handlers/stored-mcp-clients.cjs +1 -1
  71. package/dist/server/handlers/stored-mcp-clients.js +1 -1
  72. package/dist/server/handlers/stored-prompt-blocks.cjs +1 -1
  73. package/dist/server/handlers/stored-prompt-blocks.js +1 -1
  74. package/dist/server/handlers/stored-scorers.cjs +1 -1
  75. package/dist/server/handlers/stored-scorers.js +1 -1
  76. package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
  77. package/dist/server/handlers/stored-skill-favorites.js +1 -1
  78. package/dist/server/handlers/stored-skills.cjs +1 -1
  79. package/dist/server/handlers/stored-skills.js +1 -1
  80. package/dist/server/handlers/system.cjs +1 -1
  81. package/dist/server/handlers/system.js +1 -1
  82. package/dist/server/handlers/validate-agent-instructions.cjs +52 -0
  83. package/dist/server/handlers/validate-agent-instructions.cjs.map +1 -0
  84. package/dist/server/handlers/validate-agent-instructions.d.ts +13 -0
  85. package/dist/server/handlers/validate-agent-instructions.d.ts.map +1 -0
  86. package/dist/server/handlers/validate-agent-instructions.js +51 -0
  87. package/dist/server/handlers/validate-agent-instructions.js.map +1 -0
  88. package/dist/server/handlers/workflows.cjs +12 -0
  89. package/dist/server/handlers/workflows.cjs.map +1 -1
  90. package/dist/server/handlers/workflows.d.ts.map +1 -1
  91. package/dist/server/handlers/workflows.js +12 -0
  92. package/dist/server/handlers/workflows.js.map +1 -1
  93. package/dist/server/handlers.cjs +1 -1
  94. package/dist/server/handlers.js +1 -1
  95. package/dist/server/schemas/datasets.d.ts +53 -0
  96. package/dist/server/schemas/datasets.d.ts.map +1 -1
  97. package/dist/server/schemas/index.cjs +3 -2
  98. package/dist/server/schemas/index.js +3 -3
  99. package/dist/server/server-adapter/index.cjs +1 -1
  100. package/dist/server/server-adapter/index.js +1 -1
  101. package/dist/server/server-adapter/routes/datasets.d.ts +136 -0
  102. package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
  103. package/package.json +5 -5
  104. package/dist/a2a-DKnwIgiw.cjs.map +0 -1
  105. package/dist/a2a-uPi5sPwb.js.map +0 -1
  106. package/dist/datasets-Cvix7Rms.cjs.map +0 -1
  107. package/dist/datasets-dhXnHLAL.js.map +0 -1
  108. package/dist/dist-COHIL6fR.cjs.map +0 -1
  109. package/dist/dist-DGqlUp0b.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"a2a.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/a2a.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,SAAS,EACT,UAAU,EAEV,IAAI,EACJ,0BAA0B,EAC1B,mCAAmC,EACnC,oCAAoC,EACpC,sCAAsC,EACtC,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC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EAAE,6BAA6B,CAAC;IACvD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,OAAO,CAAC,GAAG,CAAC,CAyHf;AAMD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEAyB/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sEA+BhC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { a as getAgentExecutionHandler, c as handleListTaskPushNotificationConfig, d as handleSetTaskPushNotificationConfig, f as handleTaskCancel, i as getAgentCardByIdHandler, l as handleMessageSend, m as handleTaskResubscribe, n as GET_AGENT_CARD_ROUTE, o as handleDeleteTaskPushNotificationConfig, p as handleTaskGet, s as handleGetTaskPushNotificationConfig, t as AGENT_EXECUTION_ROUTE, u as handleMessageStream } from "../../a2a-uPi5sPwb.js";
1
+ import { a as getAgentExecutionHandler, c as handleListTaskPushNotificationConfig, d as handleSetTaskPushNotificationConfig, f as handleTaskCancel, i as getAgentCardByIdHandler, l as handleMessageSend, m as handleTaskResubscribe, n as GET_AGENT_CARD_ROUTE, o as handleDeleteTaskPushNotificationConfig, p as handleTaskGet, s as handleGetTaskPushNotificationConfig, t as AGENT_EXECUTION_ROUTE, u as handleMessageStream } from "../../a2a-CHi9AJ0n.js";
2
2
  export { AGENT_EXECUTION_ROUTE, GET_AGENT_CARD_ROUTE, getAgentCardByIdHandler, getAgentExecutionHandler, handleDeleteTaskPushNotificationConfig, handleGetTaskPushNotificationConfig, handleListTaskPushNotificationConfig, handleMessageSend, handleMessageStream, handleSetTaskPushNotificationConfig, handleTaskCancel, handleTaskGet, handleTaskResubscribe };
@@ -30,7 +30,7 @@ var agent_builder_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll
30
30
  });
31
31
  let agentBuilderWorkflowsPromise;
32
32
  async function loadAgentBuilderWorkflows() {
33
- agentBuilderWorkflowsPromise ??= Promise.resolve().then(() => require("../../dist-COHIL6fR.cjs")).then((mod) => mod.agentBuilderWorkflows);
33
+ agentBuilderWorkflowsPromise ??= Promise.resolve().then(() => require("../../dist-DgY0llRv.cjs")).then((mod) => mod.agentBuilderWorkflows);
34
34
  return agentBuilderWorkflowsPromise;
35
35
  }
36
36
  async function registerAgentBuilderWorkflows(mastra) {
@@ -29,7 +29,7 @@ var agent_builder_exports = /* @__PURE__ */ __exportAll({
29
29
  });
30
30
  let agentBuilderWorkflowsPromise;
31
31
  async function loadAgentBuilderWorkflows() {
32
- agentBuilderWorkflowsPromise ??= import("../../dist-DGqlUp0b.js").then((mod) => mod.agentBuilderWorkflows);
32
+ agentBuilderWorkflowsPromise ??= import("../../dist-IUXZtNBY.js").then((mod) => mod.agentBuilderWorkflows);
33
33
  return agentBuilderWorkflowsPromise;
34
34
  }
35
35
  async function registerAgentBuilderWorkflows(mastra) {
@@ -5,6 +5,7 @@ const require_utils = require("../../utils-wESuBh27.cjs");
5
5
  const require_server_handlers_error = require("./error.cjs");
6
6
  const require_version_common = require("../../version-common-CEBQY7M8.cjs");
7
7
  const require_agent_versions = require("../../agent-versions-CdQGF-3e.cjs");
8
+ const require_server_handlers_validate_agent_instructions = require("./validate-agent-instructions.cjs");
8
9
  const require_server_handlers_version_helpers = require("./version-helpers.cjs");
9
10
  //#region src/server/handlers/agent-versions.ts
10
11
  /**
@@ -162,6 +163,11 @@ const ACTIVATE_AGENT_VERSION_ROUTE = require_route_builder.createRoute({
162
163
  const version = await agentsStore.getVersion(versionId);
163
164
  if (!version) throw new require_http_exception.HTTPException(404, { message: `Version with id ${versionId} not found` });
164
165
  if (version.agentId !== agentId) throw new require_http_exception.HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });
166
+ await require_server_handlers_validate_agent_instructions.validateAgentInstructionReferences({
167
+ instructions: version.instructions,
168
+ mastra,
169
+ requestContext
170
+ });
165
171
  await agentsStore.update({
166
172
  id: agentId,
167
173
  activeVersionId: versionId,
@@ -1 +1 @@
1
- {"version":3,"file":"agent-versions.cjs","names":["createRoute","agentVersionPathParams","listVersionsQuerySchema","listVersionsResponseSchema","HTTPException","getStoredResourceScope","handleError","createVersionBodySchema","createVersionResponseSchema","extractConfigFromVersion","calculateChangedFields","createVersionWithRetry","enforceRetentionLimit","versionIdPathParams","getVersionResponseSchema","activateVersionResponseSchema","restoreVersionResponseSchema","deleteVersionResponseSchema","compareVersionsQuerySchema","compareVersionsResponseSchema","computeVersionDiffs"],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error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BAAmB,GAAG,YAAY,CAAC;GAE7E,IAAI,UAAU,YAAY,SACxB,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,uBAAuB,UAAU,CAAC;GAgBlG,OAAO;IACL,OAHYgB,wCAAAA,oBAVKX,wCAAAA,yBACjB,aACA,sBAQyC,GAN1BA,wCAAAA,yBACf,WACA,sBAImD,CAG/C;IACJ;IACA;GACF;EACF,SAAS,OAAO;GACd,OAAOH,8BAAAA,YAAY,OAAO,gCAAgC;EAC5D;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"agent-versions.cjs","names":["createRoute","agentVersionPathParams","listVersionsQuerySchema","listVersionsResponseSchema","HTTPException","getStoredResourceScope","handleError","createVersionBodySchema","createVersionResponseSchema","extractConfigFromVersion","calculateChangedFields","createVersionWithRetry","enforceRetentionLimit","versionIdPathParams","getVersionResponseSchema","activateVersionResponseSchema","validateAgentInstructionReferences","restoreVersionResponseSchema","deleteVersionResponseSchema","compareVersionsQuerySchema","compareVersionsResponseSchema","computeVersionDiffs"],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport { validateAgentInstructionReferences } from './validate-agent-instructions';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n await validateAgentInstructionReferences({\n instructions: version.instructions,\n mastra,\n requestContext,\n });\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAiGtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;4EA2DrC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CACpD,WAAW,CAAC,OAAO,sBAAsB,EAAE,OAAO,0BAA0B,EAAE,SAAS,CAAC,EACxF,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,EAC7C,MAAM,EACN,YAAY,CACV,OAAO,sBAAsB,EAC7B,OAAO,0BAA0B,EACjC,SAAS,EACT,OAAO,6BAA6B,CACrC,EACD,KAAK,EACL,0CAA0C,CAkE1C,CAAC"}
@@ -4,6 +4,7 @@ import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../
4
4
  import { handleError } from "./error.js";
5
5
  import { a as createVersionBodySchema, n as compareVersionsQuerySchema, o as deleteVersionResponseSchema, s as listVersionsQuerySchema, t as activateVersionResponseSchema } from "../../version-common-Cmd1f9JX.js";
6
6
  import { a as getVersionResponseSchema, c as versionIdPathParams, i as createVersionResponseSchema, o as listVersionsResponseSchema, r as compareVersionsResponseSchema, s as restoreVersionResponseSchema, t as agentVersionPathParams } from "../../agent-versions-Bsrpa_zb.js";
7
+ import { validateAgentInstructionReferences } from "./validate-agent-instructions.js";
7
8
  import { calculateChangedFields, computeVersionDiffs, createVersionWithRetry, enforceRetentionLimit, extractConfigFromVersion } from "./version-helpers.js";
8
9
  //#region src/server/handlers/agent-versions.ts
9
10
  /**
@@ -161,6 +162,11 @@ const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({
161
162
  const version = await agentsStore.getVersion(versionId);
162
163
  if (!version) throw new HTTPException(404, { message: `Version with id ${versionId} not found` });
163
164
  if (version.agentId !== agentId) throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });
165
+ await validateAgentInstructionReferences({
166
+ instructions: version.instructions,
167
+ mastra,
168
+ requestContext
169
+ });
164
170
  await agentsStore.update({
165
171
  id: agentId,
166
172
  activeVersionId: versionId,
@@ -1 +1 @@
1
- {"version":3,"file":"agent-versions.js","names":[],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing agent versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;AAmCA,MAAM,yBAAyB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AASA,MAAa,4BAA4B,YAAY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,SAAS,mBAAmB,KAAK,YAAY,CAAC;GAE/E,IAAI,YAAY,YAAY,SAC1B,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,uBAAuB,UAAU,CAAC;GAGpG,MAAM,YAAY,MAAM,YAAY,WAAW,EAAE;GACjD,IAAI,CAAC,WACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,YAAY,CAAC;GAE7E,IAAI,UAAU,YAAY,SACxB,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,uBAAuB,UAAU,CAAC;GAgBlG,OAAO;IACL,OAHY,oBAVK,yBACjB,aACA,sBAQyC,GAN1B,yBACf,WACA,sBAImD,CAG/C;IACJ;IACA;GACF;EACF,SAAS,OAAO;GACd,OAAO,YAAY,OAAO,gCAAgC;EAC5D;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"agent-versions.js","names":[],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport { validateAgentInstructionReferences } from './validate-agent-instructions';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n await validateAgentInstructionReferences({\n instructions: version.instructions,\n mastra,\n requestContext,\n });\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing agent versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAoCA,MAAM,yBAAyB;CAC7B;CACA;CACA;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AAY,QAAQ,OAAO,GACd,MAAM,uBAAuB,QAAQ,cAAc,CAAC;GAGrF,MAAM,cAAc,MAAM,YAAY,WAAW,IAAI;GACrD,IAAI,CAAC,aACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,YAAY,CAAC;GAE/E,IAAI,YAAY,YAAY,SAC1B,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,uBAAuB,UAAU,CAAC;GAGpG,MAAM,YAAY,MAAM,YAAY,WAAW,EAAE;GACjD,IAAI,CAAC,WACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,YAAY,CAAC;GAE7E,IAAI,UAAU,YAAY,SACxB,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,uBAAuB,UAAU,CAAC;GAgBlG,OAAO;IACL,OAHY,oBAVK,yBACjB,aACA,sBAQyC,GAN1B,yBACf,WACA,sBAImD,CAG/C;IACJ;IACA;GACF;EACF,SAAS,OAAO;GACd,OAAO,YAAY,OAAO,gCAAgC;EAC5D;CACF;AACF,CAAC"}
@@ -4,7 +4,7 @@ const require_common = require("../../common-spbwhiWS.cjs");
4
4
  const require_route_builder = require("../../route-builder-CgLVYL1c.cjs");
5
5
  const require_constants = require("../../constants-ChBaIptn.cjs");
6
6
  const require_server_handlers_error = require("./error.cjs");
7
- const require_datasets = require("../../datasets-Cvix7Rms.cjs");
7
+ const require_datasets = require("../../datasets-BMeFvFwT.cjs");
8
8
  let zod = require("zod");
9
9
  let _mastra_core_agent = require("@mastra/core/agent");
10
10
  let _mastra_core_error = require("@mastra/core/error");
@@ -391,7 +391,7 @@ const LIST_ALL_EXPERIMENTS_ROUTE = require_route_builder.createRoute({
391
391
  method: "GET",
392
392
  path: "/experiments",
393
393
  responseType: "json",
394
- queryParamSchema: require_datasets.paginationQuerySchema,
394
+ queryParamSchema: require_datasets.listExperimentsQuerySchema,
395
395
  responseSchema: require_datasets.listExperimentsResponseSchema,
396
396
  summary: "List all experiments",
397
397
  description: "Returns a paginated list of all experiments across all datasets",
@@ -400,15 +400,21 @@ const LIST_ALL_EXPERIMENTS_ROUTE = require_route_builder.createRoute({
400
400
  handler: async ({ mastra, ...params }) => {
401
401
  assertDatasetsAvailable();
402
402
  try {
403
- const { page, perPage } = params;
403
+ const { page, perPage, experimentSetId, comparisonId, variantId, trialIndex } = params;
404
404
  const storage = mastra.getStorage();
405
405
  if (!storage) throw new require_http_exception.HTTPException(500, { message: "Storage not configured" });
406
406
  const experimentsStore = await storage.getStore("experiments");
407
407
  if (!experimentsStore) throw new require_http_exception.HTTPException(500, { message: "Experiments storage not available" });
408
- const result = await experimentsStore.listExperiments({ pagination: {
409
- page: page ?? 0,
410
- perPage: perPage ?? 20
411
- } });
408
+ const result = await experimentsStore.listExperiments({
409
+ experimentSetId,
410
+ comparisonId,
411
+ variantId,
412
+ trialIndex,
413
+ pagination: {
414
+ page: page ?? 0,
415
+ perPage: perPage ?? 20
416
+ }
417
+ });
412
418
  return {
413
419
  experiments: result.experiments,
414
420
  pagination: result.pagination
@@ -447,7 +453,7 @@ const LIST_EXPERIMENTS_ROUTE = require_route_builder.createRoute({
447
453
  path: "/datasets/:datasetId/experiments",
448
454
  responseType: "json",
449
455
  pathParamSchema: require_datasets.datasetIdPathParams,
450
- queryParamSchema: require_datasets.paginationQuerySchema,
456
+ queryParamSchema: require_datasets.listExperimentsQuerySchema,
451
457
  responseSchema: require_datasets.listExperimentsResponseSchema,
452
458
  summary: "List experiments for dataset",
453
459
  description: "Returns a paginated list of experiments for the dataset",
@@ -456,10 +462,14 @@ const LIST_EXPERIMENTS_ROUTE = require_route_builder.createRoute({
456
462
  handler: async ({ mastra, datasetId, ...params }) => {
457
463
  assertDatasetsAvailable();
458
464
  try {
459
- const { page, perPage } = params;
465
+ const { page, perPage, experimentSetId, comparisonId, variantId, trialIndex } = params;
460
466
  const result = await (await mastra.datasets.get({ id: datasetId })).listExperiments({
461
467
  page: page ?? 0,
462
- perPage: perPage ?? 10
468
+ perPage: perPage ?? 10,
469
+ experimentSetId,
470
+ comparisonId,
471
+ variantId,
472
+ trialIndex
463
473
  });
464
474
  return {
465
475
  experiments: result.experiments,
@@ -485,15 +495,20 @@ const TRIGGER_EXPERIMENT_ROUTE = require_route_builder.createRoute({
485
495
  handler: async ({ mastra, datasetId, ...params }) => {
486
496
  assertDatasetsAvailable();
487
497
  try {
488
- const { targetType, targetId, scorerIds, version, agentVersion, maxConcurrency, requestContext: rawRequestContext, versions } = params;
498
+ const { targetType, targetId, name, description, metadata, scorerIds, version, agentVersion, maxConcurrency, provenance, grouping, requestContext: rawRequestContext, versions } = params;
489
499
  const requestContext = rawRequestContext instanceof _mastra_core_request_context.RequestContext ? rawRequestContext.all : rawRequestContext;
490
500
  const result = await (await mastra.datasets.get({ id: datasetId })).startExperimentAsync({
491
501
  targetType,
492
502
  targetId,
503
+ name,
504
+ description,
505
+ metadata,
493
506
  scorers: scorerIds,
494
507
  version,
495
508
  agentVersion,
496
509
  maxConcurrency,
510
+ provenance,
511
+ grouping,
497
512
  requestContext,
498
513
  versions
499
514
  });