@mastra/server 1.81.0-alpha.1 → 1.81.0-alpha.2

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 (187) hide show
  1. package/dist/_types/@internal_core/dist/storage/index.d.ts +11 -0
  2. package/dist/{a2a-CSz0rw8E.js → a2a-UYs7rzN2.js} +2 -2
  3. package/dist/{a2a-CSz0rw8E.js.map → a2a-UYs7rzN2.js.map} +1 -1
  4. package/dist/{a2a-CmMIWPuz.cjs → a2a-eUB3oDRN.cjs} +2 -2
  5. package/dist/{a2a-CmMIWPuz.cjs.map → a2a-eUB3oDRN.cjs.map} +1 -1
  6. package/dist/{agent-builder-XhBB0Svr.js → agent-builder-5dpawFJf.js} +2 -2
  7. package/dist/{agent-builder-XhBB0Svr.js.map → agent-builder-5dpawFJf.js.map} +1 -1
  8. package/dist/{agent-builder-DIEX-as5.cjs → agent-builder-DwfHzUnt.cjs} +2 -2
  9. package/dist/{agent-builder-DIEX-as5.cjs.map → agent-builder-DwfHzUnt.cjs.map} +1 -1
  10. package/dist/{agents-D36tukip.cjs → agents-BjdRPzyV.cjs} +3 -2
  11. package/dist/agents-BjdRPzyV.cjs.map +1 -0
  12. package/dist/{agents-BVjnYswL.js → agents-BuI0JjjX.js} +3 -2
  13. package/dist/agents-BuI0JjjX.js.map +1 -0
  14. package/dist/{api-schema-manifest-BVPhF1ZS.js → api-schema-manifest-DafznVYs.js} +2 -2
  15. package/dist/{api-schema-manifest-BVPhF1ZS.js.map → api-schema-manifest-DafznVYs.js.map} +1 -1
  16. package/dist/{api-schema-manifest-BWId44SV.cjs → api-schema-manifest-GgyfF4dw.cjs} +2 -2
  17. package/dist/{api-schema-manifest-BWId44SV.cjs.map → api-schema-manifest-GgyfF4dw.cjs.map} +1 -1
  18. package/dist/{builder-registry-DWusXgse.cjs → builder-registry-CamBJItc.cjs} +2 -2
  19. package/dist/{builder-registry-DWusXgse.cjs.map → builder-registry-CamBJItc.cjs.map} +1 -1
  20. package/dist/{builder-registry-CtGv0Gj6.js → builder-registry-DHVK50Ba.js} +2 -2
  21. package/dist/{builder-registry-CtGv0Gj6.js.map → builder-registry-DHVK50Ba.js.map} +1 -1
  22. package/dist/{conversations-CJn0ioOZ.cjs → conversations-ORTpTqBg.cjs} +2 -2
  23. package/dist/{conversations-CJn0ioOZ.cjs.map → conversations-ORTpTqBg.cjs.map} +1 -1
  24. package/dist/{conversations-CABVTBQY.js → conversations-fdXV9K0J.js} +2 -2
  25. package/dist/{conversations-CABVTBQY.js.map → conversations-fdXV9K0J.js.map} +1 -1
  26. package/dist/{dist-BK1fCE4z.cjs → dist-BEtxPxkM.cjs} +1 -1
  27. package/dist/dist-BQ1uFC_1.js +1 -0
  28. package/dist/{dist-OpNBTIST.cjs → dist-CR3PolEz.cjs} +5 -4
  29. package/dist/{dist-OpNBTIST.cjs.map → dist-CR3PolEz.cjs.map} +1 -1
  30. package/dist/{dist-BLjE21MA.js → dist-CmG4sN60.js} +5 -4
  31. package/dist/{dist-BLjE21MA.js.map → dist-CmG4sN60.js.map} +1 -1
  32. package/dist/docs/SKILL.md +2 -2
  33. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  34. package/dist/docs/references/reference-observability-tracing-advanced-queries.md +226 -86
  35. package/dist/docs/references/reference-server-routes.md +18 -14
  36. package/dist/{editor-builder-CeiISBIO.cjs → editor-builder-6l27BFzD.cjs} +2 -2
  37. package/dist/{editor-builder-CeiISBIO.cjs.map → editor-builder-6l27BFzD.cjs.map} +1 -1
  38. package/dist/{editor-builder-DeD6EVm8.js → editor-builder-DxGZ7IN5.js} +2 -2
  39. package/dist/{editor-builder-DeD6EVm8.js.map → editor-builder-DxGZ7IN5.js.map} +1 -1
  40. package/dist/{mcp-Bt3h1lO7.cjs → mcp-B7Q8qwjn.cjs} +118 -3
  41. package/dist/mcp-B7Q8qwjn.cjs.map +1 -0
  42. package/dist/{mcp-mpYrlkUA.cjs → mcp-CMw0sq0y.cjs} +177 -4
  43. package/dist/mcp-CMw0sq0y.cjs.map +1 -0
  44. package/dist/{mcp-D4Cprr8R.js → mcp-CQ_pR-JC.js} +77 -4
  45. package/dist/mcp-CQ_pR-JC.js.map +1 -0
  46. package/dist/{mcp-D3F3iYew.js → mcp-DN9mT9q4.js} +154 -5
  47. package/dist/mcp-DN9mT9q4.js.map +1 -0
  48. package/dist/{observability-DHuljMXO.cjs → observability-DRbDeN1X.cjs} +2 -2
  49. package/dist/{observability-DHuljMXO.cjs.map → observability-DRbDeN1X.cjs.map} +1 -1
  50. package/dist/{observability-new-endpoints-CaTskbSh.cjs → observability-new-endpoints-BrB2CKix.cjs} +15 -4
  51. package/dist/observability-new-endpoints-BrB2CKix.cjs.map +1 -0
  52. package/dist/{observability-new-endpoints-CsUP8y2j.js → observability-new-endpoints-CQNVjYYq.js} +16 -5
  53. package/dist/observability-new-endpoints-CQNVjYYq.js.map +1 -0
  54. package/dist/{observability-BgIU0otL.js → observability-pX3wmG8T.js} +2 -2
  55. package/dist/{observability-BgIU0otL.js.map → observability-pX3wmG8T.js.map} +1 -1
  56. package/dist/{plans-Dydti0sT.cjs → plans-BHQFsFRU.cjs} +2 -2
  57. package/dist/{plans-Dydti0sT.cjs.map → plans-BHQFsFRU.cjs.map} +1 -1
  58. package/dist/{plans-B5GgYqx-.js → plans-D9BGMVkL.js} +2 -2
  59. package/dist/{plans-B5GgYqx-.js.map → plans-D9BGMVkL.js.map} +1 -1
  60. package/dist/{probe-image-size-BqH96zcz.js → probe-image-size-BjNoJxWf.js} +2 -2
  61. package/dist/{probe-image-size-BqH96zcz.js.map → probe-image-size-BjNoJxWf.js.map} +1 -1
  62. package/dist/{probe-image-size-BIZUe8Bp.cjs → probe-image-size-jS0ECSlc.cjs} +2 -2
  63. package/dist/{probe-image-size-BIZUe8Bp.cjs.map → probe-image-size-jS0ECSlc.cjs.map} +1 -1
  64. package/dist/{responses-CxvSoOLt.cjs → responses-4_RCBNJB.cjs} +2 -2
  65. package/dist/{responses-CxvSoOLt.cjs.map → responses-4_RCBNJB.cjs.map} +1 -1
  66. package/dist/{responses-DbiqhxP3.js → responses-Cb-9JV9A.js} +2 -2
  67. package/dist/{responses-DbiqhxP3.js.map → responses-Cb-9JV9A.js.map} +1 -1
  68. package/dist/{routes-CBrxFxzL.js → routes-4X2kSYEG.js} +19 -15
  69. package/dist/{routes-CBrxFxzL.js.map → routes-4X2kSYEG.js.map} +1 -1
  70. package/dist/{routes-By3cLbPV.cjs → routes-BqWcvAcz.cjs} +19 -15
  71. package/dist/routes-BqWcvAcz.cjs.map +1 -0
  72. package/dist/{scores-CnozEyM4.cjs → scores-DnEcBe2i.cjs} +2 -2
  73. package/dist/{scores-CnozEyM4.cjs.map → scores-DnEcBe2i.cjs.map} +1 -1
  74. package/dist/{scores-BjclMqFa.js → scores-DqImg-o-.js} +2 -2
  75. package/dist/{scores-BjclMqFa.js.map → scores-DqImg-o-.js.map} +1 -1
  76. package/dist/server/handlers/a2a.cjs +1 -1
  77. package/dist/server/handlers/a2a.js +1 -1
  78. package/dist/server/handlers/agent-builder.cjs +1 -1
  79. package/dist/server/handlers/agent-builder.js +1 -1
  80. package/dist/server/handlers/agents.cjs +1 -1
  81. package/dist/server/handlers/agents.d.ts.map +1 -1
  82. package/dist/server/handlers/agents.js +1 -1
  83. package/dist/server/handlers/builder-registry.cjs +1 -1
  84. package/dist/server/handlers/builder-registry.js +1 -1
  85. package/dist/server/handlers/conversations.cjs +1 -1
  86. package/dist/server/handlers/conversations.js +1 -1
  87. package/dist/server/handlers/editor-builder.cjs +1 -1
  88. package/dist/server/handlers/editor-builder.js +1 -1
  89. package/dist/server/handlers/error.cjs +5 -4
  90. package/dist/server/handlers/error.cjs.map +1 -1
  91. package/dist/server/handlers/error.d.ts.map +1 -1
  92. package/dist/server/handlers/error.js +5 -4
  93. package/dist/server/handlers/error.js.map +1 -1
  94. package/dist/server/handlers/favorites-enrichment.cjs +1 -1
  95. package/dist/server/handlers/favorites-enrichment.js +1 -1
  96. package/dist/server/handlers/mcp.cjs +5 -1
  97. package/dist/server/handlers/mcp.d.ts +507 -245
  98. package/dist/server/handlers/mcp.d.ts.map +1 -1
  99. package/dist/server/handlers/mcp.js +1 -1
  100. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  101. package/dist/server/handlers/observability-new-endpoints.d.ts +80 -16
  102. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  103. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  104. package/dist/server/handlers/observability-shared.cjs +56 -0
  105. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  106. package/dist/server/handlers/observability-shared.d.ts +29 -0
  107. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  108. package/dist/server/handlers/observability-shared.js +50 -1
  109. package/dist/server/handlers/observability-shared.js.map +1 -1
  110. package/dist/server/handlers/observability.cjs +2 -2
  111. package/dist/server/handlers/observability.js +2 -2
  112. package/dist/server/handlers/plans.cjs +1 -1
  113. package/dist/server/handlers/plans.js +1 -1
  114. package/dist/server/handlers/responses.cjs +1 -1
  115. package/dist/server/handlers/responses.js +1 -1
  116. package/dist/server/handlers/scores.cjs +1 -1
  117. package/dist/server/handlers/scores.js +1 -1
  118. package/dist/server/handlers/stored-agent-favorites.cjs +1 -1
  119. package/dist/server/handlers/stored-agent-favorites.js +1 -1
  120. package/dist/server/handlers/stored-agents.cjs +1 -1
  121. package/dist/server/handlers/stored-agents.js +1 -1
  122. package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
  123. package/dist/server/handlers/stored-skill-favorites.js +1 -1
  124. package/dist/server/handlers/stored-skills.cjs +1 -1
  125. package/dist/server/handlers/stored-skills.js +1 -1
  126. package/dist/server/handlers/system.cjs +2 -2
  127. package/dist/server/handlers/system.d.ts +8 -0
  128. package/dist/server/handlers/system.d.ts.map +1 -1
  129. package/dist/server/handlers/system.js +2 -2
  130. package/dist/server/handlers/tools.cjs +1 -1
  131. package/dist/server/handlers/tools.js +1 -1
  132. package/dist/server/handlers/workspace.cjs +1 -1
  133. package/dist/server/handlers/workspace.d.ts +4 -0
  134. package/dist/server/handlers/workspace.d.ts.map +1 -1
  135. package/dist/server/handlers/workspace.js +1 -1
  136. package/dist/server/handlers.cjs +11 -11
  137. package/dist/server/handlers.js +11 -11
  138. package/dist/server/schemas/index.cjs +3 -3
  139. package/dist/server/schemas/index.js +3 -3
  140. package/dist/server/schemas/mcp.d.ts +141 -0
  141. package/dist/server/schemas/mcp.d.ts.map +1 -1
  142. package/dist/server/schemas/system.d.ts +8 -0
  143. package/dist/server/schemas/system.d.ts.map +1 -1
  144. package/dist/server/schemas/workspace.d.ts +2 -0
  145. package/dist/server/schemas/workspace.d.ts.map +1 -1
  146. package/dist/server/server-adapter/index.cjs +1 -1
  147. package/dist/server/server-adapter/index.js +1 -1
  148. package/dist/server/server-adapter/routes/mcp.d.ts +256 -0
  149. package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -1
  150. package/dist/server/server-adapter/routes/observability.d.ts +42 -10
  151. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  152. package/dist/server/server-adapter/routes/system.d.ts +8 -0
  153. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  154. package/dist/server/server-adapter/routes/workspace.d.ts +4 -0
  155. package/dist/server/server-adapter/routes/workspace.d.ts.map +1 -1
  156. package/dist/{system-BxHpBJiq.cjs → system-CHCn8IQ3.cjs} +5 -1
  157. package/dist/system-CHCn8IQ3.cjs.map +1 -0
  158. package/dist/{system-CxwzIMsy.js → system-DOwo7OGf.js} +5 -1
  159. package/dist/system-DOwo7OGf.js.map +1 -0
  160. package/dist/{tools-Ck35EVD7.js → tools-BFpuzQsz.js} +2 -2
  161. package/dist/{tools-Ck35EVD7.js.map → tools-BFpuzQsz.js.map} +1 -1
  162. package/dist/{tools-CeJrnYDf.cjs → tools-Dy_j6URC.cjs} +2 -2
  163. package/dist/{tools-CeJrnYDf.cjs.map → tools-Dy_j6URC.cjs.map} +1 -1
  164. package/dist/{workspace-CyH_iu8w.cjs → workspace-BU6sQpbV.cjs} +14 -10
  165. package/dist/{workspace-C9dE6D1U.js.map → workspace-BU6sQpbV.cjs.map} +1 -1
  166. package/dist/{workspace-KeHGZvNV.cjs → workspace-C5BBUatQ.cjs} +3 -1
  167. package/dist/workspace-C5BBUatQ.cjs.map +1 -0
  168. package/dist/{workspace-C9dE6D1U.js → workspace-CS-GYTve.js} +14 -10
  169. package/dist/workspace-CS-GYTve.js.map +1 -0
  170. package/dist/{workspace-muaSMxVS.js → workspace-DBDA3UQl.js} +3 -1
  171. package/dist/workspace-DBDA3UQl.js.map +1 -0
  172. package/package.json +4 -4
  173. package/dist/agents-BVjnYswL.js.map +0 -1
  174. package/dist/agents-D36tukip.cjs.map +0 -1
  175. package/dist/dist-_M1jEPcL.js +0 -1
  176. package/dist/mcp-Bt3h1lO7.cjs.map +0 -1
  177. package/dist/mcp-D3F3iYew.js.map +0 -1
  178. package/dist/mcp-D4Cprr8R.js.map +0 -1
  179. package/dist/mcp-mpYrlkUA.cjs.map +0 -1
  180. package/dist/observability-new-endpoints-CaTskbSh.cjs.map +0 -1
  181. package/dist/observability-new-endpoints-CsUP8y2j.js.map +0 -1
  182. package/dist/routes-By3cLbPV.cjs.map +0 -1
  183. package/dist/system-BxHpBJiq.cjs.map +0 -1
  184. package/dist/system-CxwzIMsy.js.map +0 -1
  185. package/dist/workspace-CyH_iu8w.cjs.map +0 -1
  186. package/dist/workspace-KeHGZvNV.cjs.map +0 -1
  187. package/dist/workspace-muaSMxVS.js.map +0 -1
@@ -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-BLjE21MA.js").then((mod) => mod.agentBuilderWorkflows);
32
+ agentBuilderWorkflowsPromise ??= import("./dist-CmG4sN60.js").then((mod) => mod.agentBuilderWorkflows);
33
33
  return agentBuilderWorkflowsPromise;
34
34
  }
35
35
  async function registerAgentBuilderWorkflows(mastra) {
@@ -623,4 +623,4 @@ const OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({
623
623
  });
624
624
  export { agent_builder_exports as _, LIST_AGENT_BUILDER_ACTIONS_ROUTE as a, OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE as c, RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE as d, RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE as f, STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE as g, STREAM_AGENT_BUILDER_ACTION_ROUTE as h, GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE as i, RESUME_AGENT_BUILDER_ACTION_ROUTE as l, START_ASYNC_AGENT_BUILDER_ACTION_ROUTE as m, CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE as n, LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE as o, START_AGENT_BUILDER_ACTION_RUN_ROUTE as p, GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE as r, OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE as s, CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE as t, RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE as u };
625
625
 
626
- //# sourceMappingURL=agent-builder-XhBB0Svr.js.map
626
+ //# sourceMappingURL=agent-builder-5dpawFJf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-builder-XhBB0Svr.js","names":[],"sources":["../src/server/handlers/agent-builder.ts"],"sourcesContent":["import type { agentBuilderWorkflows as agentBuilderWorkflowsType } from '@mastra/agent-builder';\nimport { HTTPException } from '../http-exception';\nimport {\n actionIdPathParams,\n actionRunPathParams,\n createWorkflowRunResponseSchema,\n listWorkflowRunsQuerySchema,\n resumeAgentBuilderBodySchema,\n streamAgentBuilderBodySchema,\n startAsyncAgentBuilderBodySchema,\n workflowExecutionResultSchema,\n workflowControlResponseSchema,\n workflowRunsResponseSchema,\n workflowInfoSchema,\n listWorkflowsResponseSchema,\n streamLegacyAgentBuilderBodySchema,\n workflowRunResultSchema,\n workflowRunResultQuerySchema,\n} from '../schemas/agent-builder';\nimport { streamResponseSchema } from '../schemas/agents';\nimport { optionalRunIdSchema, runIdSchema } from '../schemas/common';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { WorkflowRegistry } from '../utils';\nimport { handleError } from './error';\nimport * as workflows from './workflows';\n\ntype AgentBuilderWorkflows = typeof agentBuilderWorkflowsType;\n\nlet agentBuilderWorkflowsPromise: Promise<AgentBuilderWorkflows> | undefined;\n\nasync function loadAgentBuilderWorkflows(): Promise<AgentBuilderWorkflows> {\n agentBuilderWorkflowsPromise ??= import('@mastra/agent-builder').then(mod => mod.agentBuilderWorkflows);\n return agentBuilderWorkflowsPromise;\n}\n\nasync function registerAgentBuilderWorkflows(\n mastra: Parameters<typeof WorkflowRegistry.registerTemporaryWorkflows>[1],\n) {\n const agentBuilderWorkflows = await loadAgentBuilderWorkflows();\n WorkflowRegistry.registerTemporaryWorkflows(agentBuilderWorkflows, mastra);\n return agentBuilderWorkflows;\n}\n\n// ============================================================================\n// Route Definitions (handlers call workflow route handlers with transformed parameters)\n// ============================================================================\n\nexport const LIST_AGENT_BUILDER_ACTIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder',\n responseType: 'json',\n responseSchema: listWorkflowsResponseSchema,\n summary: 'List agent-builder actions',\n description: 'Returns a list of all available agent-builder actions',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n logger.info('Listing agent builder actions');\n\n // Call workflow list handler\n return await workflows.LIST_WORKFLOWS_ROUTE.handler(ctx);\n } catch (error) {\n logger.error('Error listing agent builder actions', { error });\n return handleError(error, 'Error getting agent builder workflows');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n responseSchema: workflowInfoSchema,\n summary: 'Get action by ID',\n description: 'Returns details for a specific agent-builder action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n const agentBuilderWorkflows = await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, {\n message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(', ')}`,\n });\n }\n\n logger.info('Getting agent builder action by ID', { actionId });\n\n return await workflows.GET_WORKFLOW_BY_ID_ROUTE.handler({ ...ctx, workflowId: actionId });\n } catch (error) {\n logger.error('Error getting agent builder action by ID', { error, actionId });\n return handleError(error, 'Error getting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: listWorkflowRunsQuerySchema,\n responseSchema: workflowRunsResponseSchema,\n summary: 'List action runs',\n description: 'Returns a paginated list of execution runs for the specified action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Listing agent builder action runs', { actionId });\n\n return await workflows.LIST_WORKFLOW_RUNS_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error listing agent builder action runs', { error, actionId });\n return handleError(error, 'Error getting agent builder action runs');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs/:runId',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n queryParamSchema: workflowRunResultQuerySchema,\n responseSchema: workflowRunResultSchema,\n summary: 'Get action run by ID',\n description:\n 'Returns details for a specific action run with metadata and processed execution state. Use the fields query parameter to reduce payload size.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Getting agent builder action run by ID', { actionId, runId });\n\n return await workflows.GET_WORKFLOW_RUN_BY_ID_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error getting agent builder action run', { error, actionId, runId });\n return handleError(error, 'Error getting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/create-run',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Create action run',\n description: 'Creates a new action execution instance with an optional custom run ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Creating agent builder action run', { actionId, runId });\n\n return await workflows.CREATE_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error creating agent builder action run', { error, actionId });\n return handleError(error, 'Error creating agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Stream action execution',\n description: 'Executes an action and streams the results in real-time',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action', { actionId, runId });\n\n return await workflows.STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Start action asynchronously',\n description: 'Starts an action execution asynchronously without streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting agent builder action asynchronously', { actionId, runId });\n\n return await workflows.START_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error starting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Start specific action run',\n description: 'Starts execution of a specific action run by ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting specific agent builder action run', { actionId, runId });\n\n return await workflows.START_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action run', { error, actionId });\n return handleError(error, 'Error starting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: 'Observe action stream',\n description: 'Observes and streams updates from an already running action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Resume action asynchronously',\n description: 'Resumes a suspended action execution asynchronously without streaming',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action asynchronously', { actionId, runId, step });\n\n return await workflows.RESUME_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n/**\n * Fire-and-forget resume for agent-builder actions: returns immediately with the runId without\n * waiting for completion. Delegates to the workflows `resume-no-wait` route.\n *\n * TODO(v2): fold this behavior into the `resume-async` route in Mastra v2 and remove this route.\n * Kept separate in v1 to avoid breaking the existing `resume-async` response contract.\n */\nexport const RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-no-wait',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Resume action without waiting',\n description:\n 'Resumes a suspended action execution without waiting (fire-and-forget) and returns immediately with the runId. The action continues executing in the background.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action without waiting', { actionId, runId, step });\n\n return await workflows.RESUME_NO_WAIT_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action without waiting', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Resume action',\n description: 'Resumes a suspended action execution from a specific step',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action', { actionId, runId, step });\n\n return await workflows.RESUME_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Resume action stream',\n description: 'Resumes a suspended action execution and continues streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action stream', { actionId, runId, step });\n\n return await workflows.RESUME_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action stream', { error, actionId });\n return handleError(error, 'Error resuming agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/runs/:runId/cancel',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n responseSchema: workflowControlResponseSchema,\n summary: 'Cancel action run',\n description: 'Cancels an in-progress action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Cancelling agent builder action run', { actionId, runId });\n\n return await workflows.CANCEL_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error cancelling agent builder action run', { error, actionId });\n return handleError(error, 'Error cancelling agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n// Legacy routes (deprecated)\nexport const STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamLegacyAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Stream agent-builder action with legacy format',\n description:\n 'Legacy endpoint for streaming agent-builder action execution. Use /agent-builder/:actionId/stream instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action (legacy)', { actionId, runId });\n\n return await workflows.STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action (legacy)', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe-stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Observe agent-builder action stream with legacy format',\n description:\n 'Legacy endpoint for observing agent-builder action stream. Use /agent-builder/:actionId/observe instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream (legacy)', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream (legacy)', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAI;AAEJ,eAAe,4BAA4D;CACzE,iCAAiC,OAAO,qBAAwB,CAAC,MAAK,QAAO,IAAI,qBAAqB;CACtG,OAAO;AACT;AAEA,eAAe,8BACb,QACA;CACA,MAAM,wBAAwB,MAAM,0BAA0B;CAC9D,iBAAiB,2BAA2B,uBAAuB,MAAM;CACzE,OAAO;AACT;AAMA,MAAa,mCAAmC,YAAY;CAC1D,QAAQ;CACR,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,eAAe;CACtB,cAAc;CACd,SAAS,OAAM,QAAO;EACpB,MAAM,EAAE,WAAW;EACnB,MAAM,SAAS,OAAO,UAAU;EAChC,IAAI;GACF,MAAM,8BAA8B,MAAM;GAC1C,OAAO,KAAK,+BAA+B;GAG3C,OAAO,MAAA,qBAAqC,QAAQ,GAAG;EACzD,SAAS,OAAO;GACd,OAAO,MAAM,uCAAuC,EAAE,MAAM,CAAC;GAC7D,OAAO,YAAY,OA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AAa,mDAAmD,YAAY;CAC1E,QAAQ;CACR,MAAM;CACN,cAAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,SAAS;CACT,aACE;CACF,MAAM,CAAC,iBAAiB,QAAQ;CAChC,cAAc;CACd,SAAS,OAAM,QAAO;EACpB,MAAM,EAAE,QAAQ,UAAU,UAAU;EACpC,MAAM,SAAS,OAAO,UAAU;EAChC,IAAI;GACF,MAAM,8BAA8B,MAAM;GAE1C,IAAI,YAAY,CAAC,iBAAiB,uBAAuB,QAAQ,GAC/D,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,iCAAiC,WAAW,CAAC;GAGvF,OAAO,KAAK,kDAAkD;IAAE;IAAU;GAAM,CAAC;GAEjF,OAAO,MAAA,qCAAqD,QAAQ;IAClE,GAAG;IACH,YAAY;GACd,CAAC;EACH,SAAS,OAAO;GACd,OAAO,MAAM,wDAAwD;IAAE;IAAO;GAAS,CAAC;GACxF,OAAO,YAAY,OAAO,6CAA6C;EACzE,UAAU;GACR,iBAAiB,QAAQ;EAC3B;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"agent-builder-5dpawFJf.js","names":[],"sources":["../src/server/handlers/agent-builder.ts"],"sourcesContent":["import type { agentBuilderWorkflows as agentBuilderWorkflowsType } from '@mastra/agent-builder';\nimport { HTTPException } from '../http-exception';\nimport {\n actionIdPathParams,\n actionRunPathParams,\n createWorkflowRunResponseSchema,\n listWorkflowRunsQuerySchema,\n resumeAgentBuilderBodySchema,\n streamAgentBuilderBodySchema,\n startAsyncAgentBuilderBodySchema,\n workflowExecutionResultSchema,\n workflowControlResponseSchema,\n workflowRunsResponseSchema,\n workflowInfoSchema,\n listWorkflowsResponseSchema,\n streamLegacyAgentBuilderBodySchema,\n workflowRunResultSchema,\n workflowRunResultQuerySchema,\n} from '../schemas/agent-builder';\nimport { streamResponseSchema } from '../schemas/agents';\nimport { optionalRunIdSchema, runIdSchema } from '../schemas/common';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { WorkflowRegistry } from '../utils';\nimport { handleError } from './error';\nimport * as workflows from './workflows';\n\ntype AgentBuilderWorkflows = typeof agentBuilderWorkflowsType;\n\nlet agentBuilderWorkflowsPromise: Promise<AgentBuilderWorkflows> | undefined;\n\nasync function loadAgentBuilderWorkflows(): Promise<AgentBuilderWorkflows> {\n agentBuilderWorkflowsPromise ??= import('@mastra/agent-builder').then(mod => mod.agentBuilderWorkflows);\n return agentBuilderWorkflowsPromise;\n}\n\nasync function registerAgentBuilderWorkflows(\n mastra: Parameters<typeof WorkflowRegistry.registerTemporaryWorkflows>[1],\n) {\n const agentBuilderWorkflows = await loadAgentBuilderWorkflows();\n WorkflowRegistry.registerTemporaryWorkflows(agentBuilderWorkflows, mastra);\n return agentBuilderWorkflows;\n}\n\n// ============================================================================\n// Route Definitions (handlers call workflow route handlers with transformed parameters)\n// ============================================================================\n\nexport const LIST_AGENT_BUILDER_ACTIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder',\n responseType: 'json',\n responseSchema: listWorkflowsResponseSchema,\n summary: 'List agent-builder actions',\n description: 'Returns a list of all available agent-builder actions',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n logger.info('Listing agent builder actions');\n\n // Call workflow list handler\n return await workflows.LIST_WORKFLOWS_ROUTE.handler(ctx);\n } catch (error) {\n logger.error('Error listing agent builder actions', { error });\n return handleError(error, 'Error getting agent builder workflows');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n responseSchema: workflowInfoSchema,\n summary: 'Get action by ID',\n description: 'Returns details for a specific agent-builder action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n const agentBuilderWorkflows = await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, {\n message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(', ')}`,\n });\n }\n\n logger.info('Getting agent builder action by ID', { actionId });\n\n return await workflows.GET_WORKFLOW_BY_ID_ROUTE.handler({ ...ctx, workflowId: actionId });\n } catch (error) {\n logger.error('Error getting agent builder action by ID', { error, actionId });\n return handleError(error, 'Error getting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: listWorkflowRunsQuerySchema,\n responseSchema: workflowRunsResponseSchema,\n summary: 'List action runs',\n description: 'Returns a paginated list of execution runs for the specified action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Listing agent builder action runs', { actionId });\n\n return await workflows.LIST_WORKFLOW_RUNS_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error listing agent builder action runs', { error, actionId });\n return handleError(error, 'Error getting agent builder action runs');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs/:runId',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n queryParamSchema: workflowRunResultQuerySchema,\n responseSchema: workflowRunResultSchema,\n summary: 'Get action run by ID',\n description:\n 'Returns details for a specific action run with metadata and processed execution state. Use the fields query parameter to reduce payload size.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Getting agent builder action run by ID', { actionId, runId });\n\n return await workflows.GET_WORKFLOW_RUN_BY_ID_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error getting agent builder action run', { error, actionId, runId });\n return handleError(error, 'Error getting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/create-run',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Create action run',\n description: 'Creates a new action execution instance with an optional custom run ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Creating agent builder action run', { actionId, runId });\n\n return await workflows.CREATE_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error creating agent builder action run', { error, actionId });\n return handleError(error, 'Error creating agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Stream action execution',\n description: 'Executes an action and streams the results in real-time',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action', { actionId, runId });\n\n return await workflows.STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Start action asynchronously',\n description: 'Starts an action execution asynchronously without streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting agent builder action asynchronously', { actionId, runId });\n\n return await workflows.START_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error starting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Start specific action run',\n description: 'Starts execution of a specific action run by ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting specific agent builder action run', { actionId, runId });\n\n return await workflows.START_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action run', { error, actionId });\n return handleError(error, 'Error starting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: 'Observe action stream',\n description: 'Observes and streams updates from an already running action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Resume action asynchronously',\n description: 'Resumes a suspended action execution asynchronously without streaming',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action asynchronously', { actionId, runId, step });\n\n return await workflows.RESUME_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n/**\n * Fire-and-forget resume for agent-builder actions: returns immediately with the runId without\n * waiting for completion. Delegates to the workflows `resume-no-wait` route.\n *\n * TODO(v2): fold this behavior into the `resume-async` route in Mastra v2 and remove this route.\n * Kept separate in v1 to avoid breaking the existing `resume-async` response contract.\n */\nexport const RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-no-wait',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Resume action without waiting',\n description:\n 'Resumes a suspended action execution without waiting (fire-and-forget) and returns immediately with the runId. The action continues executing in the background.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action without waiting', { actionId, runId, step });\n\n return await workflows.RESUME_NO_WAIT_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action without waiting', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Resume action',\n description: 'Resumes a suspended action execution from a specific step',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action', { actionId, runId, step });\n\n return await workflows.RESUME_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Resume action stream',\n description: 'Resumes a suspended action execution and continues streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action stream', { actionId, runId, step });\n\n return await workflows.RESUME_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action stream', { error, actionId });\n return handleError(error, 'Error resuming agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/runs/:runId/cancel',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n responseSchema: workflowControlResponseSchema,\n summary: 'Cancel action run',\n description: 'Cancels an in-progress action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Cancelling agent builder action run', { actionId, runId });\n\n return await workflows.CANCEL_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error cancelling agent builder action run', { error, actionId });\n return handleError(error, 'Error cancelling agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n// Legacy routes (deprecated)\nexport const STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamLegacyAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Stream agent-builder action with legacy format',\n description:\n 'Legacy endpoint for streaming agent-builder action execution. Use /agent-builder/:actionId/stream instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action (legacy)', { actionId, runId });\n\n return await workflows.STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action (legacy)', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe-stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Observe agent-builder action stream with legacy format',\n description:\n 'Legacy endpoint for observing agent-builder action stream. Use /agent-builder/:actionId/observe instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream (legacy)', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream (legacy)', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAI;AAEJ,eAAe,4BAA4D;CACzE,iCAAiC,OAAO,qBAAwB,CAAC,MAAK,QAAO,IAAI,qBAAqB;CACtG,OAAO;AACT;AAEA,eAAe,8BACb,QACA;CACA,MAAM,wBAAwB,MAAM,0BAA0B;CAC9D,iBAAiB,2BAA2B,uBAAuB,MAAM;CACzE,OAAO;AACT;AAMA,MAAa,mCAAmC,YAAY;CAC1D,QAAQ;CACR,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,eAAe;CACtB,cAAc;CACd,SAAS,OAAM,QAAO;EACpB,MAAM,EAAE,WAAW;EACnB,MAAM,SAAS,OAAO,UAAU;EAChC,IAAI;GACF,MAAM,8BAA8B,MAAM;GAC1C,OAAO,KAAK,+BAA+B;GAG3C,OAAO,MAAA,qBAAqC,QAAQ,GAAG;EACzD,SAAS,OAAO;GACd,OAAO,MAAM,uCAAuC,EAAE,MAAM,CAAC;GAC7D,OAAO,YAAY,OAAO,uCAAuC;EACnE,UAAU;GACR,iBAAiB,QAAQ;EAC3B;CACF;AACF,CAAC;AAED,MAAa,uCAAuC,YAAY;CAC9D,QAAQ;CACR,MAAM;CACN,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,eAAe;CACtB,cAAc;CACd,S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AU;EACpC,MAAM,SAAS,OAAO,UAAU;EAChC,IAAI;GACF,MAAM,8BAA8B,MAAM;GAE1C,IAAI,YAAY,CAAC,iBAAiB,uBAAuB,QAAQ,GAC/D,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,iCAAiC,WAAW,CAAC;GAGvF,OAAO,KAAK,kDAAkD;IAAE;IAAU;GAAM,CAAC;GAEjF,OAAO,MAAA,qCAAqD,QAAQ;IAClE,GAAG;IACH,YAAY;GACd,CAAC;EACH,SAAS,OAAO;GACd,OAAO,MAAM,wDAAwD;IAAE;IAAO;GAAS,CAAC;GACxF,OAAO,YAAY,OAAO,6CAA6C;EACzE,UAAU;GACR,iBAAiB,QAAQ;EAC3B;CACF;AACF,CAAC"}
@@ -29,7 +29,7 @@ var agent_builder_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll
29
29
  });
30
30
  let agentBuilderWorkflowsPromise;
31
31
  async function loadAgentBuilderWorkflows() {
32
- agentBuilderWorkflowsPromise ??= Promise.resolve().then(() => require("./dist-OpNBTIST.cjs")).then((mod) => mod.agentBuilderWorkflows);
32
+ agentBuilderWorkflowsPromise ??= Promise.resolve().then(() => require("./dist-CR3PolEz.cjs")).then((mod) => mod.agentBuilderWorkflows);
33
33
  return agentBuilderWorkflowsPromise;
34
34
  }
35
35
  async function registerAgentBuilderWorkflows(mastra) {
@@ -724,4 +724,4 @@ Object.defineProperty(exports, "agent_builder_exports", {
724
724
  }
725
725
  });
726
726
 
727
- //# sourceMappingURL=agent-builder-DIEX-as5.cjs.map
727
+ //# sourceMappingURL=agent-builder-DwfHzUnt.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-builder-DIEX-as5.cjs","names":["createRoute","listWorkflowsResponseSchema","handleError","actionIdPathParams","workflowInfoSchema","WorkflowRegistry","HTTPException","listWorkflowRunsQuerySchema","workflowRunsResponseSchema","actionRunPathParams","workflowRunResultQuerySchema","workflowRunResultSchema","optionalRunIdSchema","createWorkflowRunResponseSchema","runIdSchema","streamAgentBuilderBodySchema","streamResponseSchema","startAsyncAgentBuilderBodySchema","workflowExecutionResultSchema","workflowControlResponseSchema","resumeAgentBuilderBodySchema","streamLegacyAgentBuilderBodySchema"],"sources":["../src/server/handlers/agent-builder.ts"],"sourcesContent":["import type { agentBuilderWorkflows as agentBuilderWorkflowsType } from '@mastra/agent-builder';\nimport { HTTPException } from '../http-exception';\nimport {\n actionIdPathParams,\n actionRunPathParams,\n createWorkflowRunResponseSchema,\n listWorkflowRunsQuerySchema,\n resumeAgentBuilderBodySchema,\n streamAgentBuilderBodySchema,\n startAsyncAgentBuilderBodySchema,\n workflowExecutionResultSchema,\n workflowControlResponseSchema,\n workflowRunsResponseSchema,\n workflowInfoSchema,\n listWorkflowsResponseSchema,\n streamLegacyAgentBuilderBodySchema,\n workflowRunResultSchema,\n workflowRunResultQuerySchema,\n} from '../schemas/agent-builder';\nimport { streamResponseSchema } from '../schemas/agents';\nimport { optionalRunIdSchema, runIdSchema } from '../schemas/common';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { WorkflowRegistry } from '../utils';\nimport { handleError } from './error';\nimport * as workflows from './workflows';\n\ntype AgentBuilderWorkflows = typeof agentBuilderWorkflowsType;\n\nlet agentBuilderWorkflowsPromise: Promise<AgentBuilderWorkflows> | undefined;\n\nasync function loadAgentBuilderWorkflows(): Promise<AgentBuilderWorkflows> {\n agentBuilderWorkflowsPromise ??= import('@mastra/agent-builder').then(mod => mod.agentBuilderWorkflows);\n return agentBuilderWorkflowsPromise;\n}\n\nasync function registerAgentBuilderWorkflows(\n mastra: Parameters<typeof WorkflowRegistry.registerTemporaryWorkflows>[1],\n) {\n const agentBuilderWorkflows = await loadAgentBuilderWorkflows();\n WorkflowRegistry.registerTemporaryWorkflows(agentBuilderWorkflows, mastra);\n return agentBuilderWorkflows;\n}\n\n// ============================================================================\n// Route Definitions (handlers call workflow route handlers with transformed parameters)\n// ============================================================================\n\nexport const LIST_AGENT_BUILDER_ACTIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder',\n responseType: 'json',\n responseSchema: listWorkflowsResponseSchema,\n summary: 'List agent-builder actions',\n description: 'Returns a list of all available agent-builder actions',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n logger.info('Listing agent builder actions');\n\n // Call workflow list handler\n return await workflows.LIST_WORKFLOWS_ROUTE.handler(ctx);\n } catch (error) {\n logger.error('Error listing agent builder actions', { error });\n return handleError(error, 'Error getting agent builder workflows');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n responseSchema: workflowInfoSchema,\n summary: 'Get action by ID',\n description: 'Returns details for a specific agent-builder action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n const agentBuilderWorkflows = await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, {\n message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(', ')}`,\n });\n }\n\n logger.info('Getting agent builder action by ID', { actionId });\n\n return await workflows.GET_WORKFLOW_BY_ID_ROUTE.handler({ ...ctx, workflowId: actionId });\n } catch (error) {\n logger.error('Error getting agent builder action by ID', { error, actionId });\n return handleError(error, 'Error getting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: listWorkflowRunsQuerySchema,\n responseSchema: workflowRunsResponseSchema,\n summary: 'List action runs',\n description: 'Returns a paginated list of execution runs for the specified action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Listing agent builder action runs', { actionId });\n\n return await workflows.LIST_WORKFLOW_RUNS_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error listing agent builder action runs', { error, actionId });\n return handleError(error, 'Error getting agent builder action runs');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs/:runId',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n queryParamSchema: workflowRunResultQuerySchema,\n responseSchema: workflowRunResultSchema,\n summary: 'Get action run by ID',\n description:\n 'Returns details for a specific action run with metadata and processed execution state. Use the fields query parameter to reduce payload size.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Getting agent builder action run by ID', { actionId, runId });\n\n return await workflows.GET_WORKFLOW_RUN_BY_ID_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error getting agent builder action run', { error, actionId, runId });\n return handleError(error, 'Error getting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/create-run',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Create action run',\n description: 'Creates a new action execution instance with an optional custom run ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Creating agent builder action run', { actionId, runId });\n\n return await workflows.CREATE_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error creating agent builder action run', { error, actionId });\n return handleError(error, 'Error creating agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Stream action execution',\n description: 'Executes an action and streams the results in real-time',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action', { actionId, runId });\n\n return await workflows.STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Start action asynchronously',\n description: 'Starts an action execution asynchronously without streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting agent builder action asynchronously', { actionId, runId });\n\n return await workflows.START_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error starting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Start specific action run',\n description: 'Starts execution of a specific action run by ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting specific agent builder action run', { actionId, runId });\n\n return await workflows.START_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action run', { error, actionId });\n return handleError(error, 'Error starting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: 'Observe action stream',\n description: 'Observes and streams updates from an already running action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Resume action asynchronously',\n description: 'Resumes a suspended action execution asynchronously without streaming',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action asynchronously', { actionId, runId, step });\n\n return await workflows.RESUME_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n/**\n * Fire-and-forget resume for agent-builder actions: returns immediately with the runId without\n * waiting for completion. Delegates to the workflows `resume-no-wait` route.\n *\n * TODO(v2): fold this behavior into the `resume-async` route in Mastra v2 and remove this route.\n * Kept separate in v1 to avoid breaking the existing `resume-async` response contract.\n */\nexport const RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-no-wait',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Resume action without waiting',\n description:\n 'Resumes a suspended action execution without waiting (fire-and-forget) and returns immediately with the runId. The action continues executing in the background.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action without waiting', { actionId, runId, step });\n\n return await workflows.RESUME_NO_WAIT_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action without waiting', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Resume action',\n description: 'Resumes a suspended action execution from a specific step',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action', { actionId, runId, step });\n\n return await workflows.RESUME_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Resume action stream',\n description: 'Resumes a suspended action execution and continues streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action stream', { actionId, runId, step });\n\n return await workflows.RESUME_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action stream', { error, actionId });\n return handleError(error, 'Error resuming agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/runs/:runId/cancel',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n responseSchema: workflowControlResponseSchema,\n summary: 'Cancel action run',\n description: 'Cancels an in-progress action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Cancelling agent builder action run', { actionId, runId });\n\n return await workflows.CANCEL_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error cancelling agent builder action run', { error, actionId });\n return handleError(error, 'Error cancelling agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n// Legacy routes (deprecated)\nexport const STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamLegacyAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Stream agent-builder action with legacy format',\n description:\n 'Legacy endpoint for streaming agent-builder action execution. Use /agent-builder/:actionId/stream instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action (legacy)', { actionId, runId });\n\n return await workflows.STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action (legacy)', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe-stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Observe agent-builder action stream with legacy format',\n description:\n 'Legacy endpoint for observing agent-builder action stream. Use /agent-builder/:actionId/observe instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream (legacy)', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream (legacy)', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAI;AAEJ,eAAe,4BAA4D;CACzE,iCAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAiC,qBAAA,CAAA,CAAA,CAAgC,MAAK,QAAO,IAAI,qBAAqB;CACtG,OAAO;AACT;AAEA,eAAe,8BACb,QACA;CACA,MAAM,wBAAwB,MAAM,0B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createRoute","listWorkflowsResponseSchema","handleError","actionIdPathParams","workflowInfoSchema","WorkflowRegistry","HTTPException","listWorkflowRunsQuerySchema","workflowRunsResponseSchema","actionRunPathParams","workflowRunResultQuerySchema","workflowRunResultSchema","optionalRunIdSchema","createWorkflowRunResponseSchema","runIdSchema","streamAgentBuilderBodySchema","streamResponseSchema","startAsyncAgentBuilderBodySchema","workflowExecutionResultSchema","workflowControlResponseSchema","resumeAgentBuilderBodySchema","streamLegacyAgentBuilderBodySchema"],"sources":["../src/server/handlers/agent-builder.ts"],"sourcesContent":["import type { agentBuilderWorkflows as agentBuilderWorkflowsType } from '@mastra/agent-builder';\nimport { HTTPException } from '../http-exception';\nimport {\n actionIdPathParams,\n actionRunPathParams,\n createWorkflowRunResponseSchema,\n listWorkflowRunsQuerySchema,\n resumeAgentBuilderBodySchema,\n streamAgentBuilderBodySchema,\n startAsyncAgentBuilderBodySchema,\n workflowExecutionResultSchema,\n workflowControlResponseSchema,\n workflowRunsResponseSchema,\n workflowInfoSchema,\n listWorkflowsResponseSchema,\n streamLegacyAgentBuilderBodySchema,\n workflowRunResultSchema,\n workflowRunResultQuerySchema,\n} from '../schemas/agent-builder';\nimport { streamResponseSchema } from '../schemas/agents';\nimport { optionalRunIdSchema, runIdSchema } from '../schemas/common';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { WorkflowRegistry } from '../utils';\nimport { handleError } from './error';\nimport * as workflows from './workflows';\n\ntype AgentBuilderWorkflows = typeof agentBuilderWorkflowsType;\n\nlet agentBuilderWorkflowsPromise: Promise<AgentBuilderWorkflows> | undefined;\n\nasync function loadAgentBuilderWorkflows(): Promise<AgentBuilderWorkflows> {\n agentBuilderWorkflowsPromise ??= import('@mastra/agent-builder').then(mod => mod.agentBuilderWorkflows);\n return agentBuilderWorkflowsPromise;\n}\n\nasync function registerAgentBuilderWorkflows(\n mastra: Parameters<typeof WorkflowRegistry.registerTemporaryWorkflows>[1],\n) {\n const agentBuilderWorkflows = await loadAgentBuilderWorkflows();\n WorkflowRegistry.registerTemporaryWorkflows(agentBuilderWorkflows, mastra);\n return agentBuilderWorkflows;\n}\n\n// ============================================================================\n// Route Definitions (handlers call workflow route handlers with transformed parameters)\n// ============================================================================\n\nexport const LIST_AGENT_BUILDER_ACTIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder',\n responseType: 'json',\n responseSchema: listWorkflowsResponseSchema,\n summary: 'List agent-builder actions',\n description: 'Returns a list of all available agent-builder actions',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n logger.info('Listing agent builder actions');\n\n // Call workflow list handler\n return await workflows.LIST_WORKFLOWS_ROUTE.handler(ctx);\n } catch (error) {\n logger.error('Error listing agent builder actions', { error });\n return handleError(error, 'Error getting agent builder workflows');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n responseSchema: workflowInfoSchema,\n summary: 'Get action by ID',\n description: 'Returns details for a specific agent-builder action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n const agentBuilderWorkflows = await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, {\n message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(', ')}`,\n });\n }\n\n logger.info('Getting agent builder action by ID', { actionId });\n\n return await workflows.GET_WORKFLOW_BY_ID_ROUTE.handler({ ...ctx, workflowId: actionId });\n } catch (error) {\n logger.error('Error getting agent builder action by ID', { error, actionId });\n return handleError(error, 'Error getting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: listWorkflowRunsQuerySchema,\n responseSchema: workflowRunsResponseSchema,\n summary: 'List action runs',\n description: 'Returns a paginated list of execution runs for the specified action',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Listing agent builder action runs', { actionId });\n\n return await workflows.LIST_WORKFLOW_RUNS_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error listing agent builder action runs', { error, actionId });\n return handleError(error, 'Error getting agent builder action runs');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/agent-builder/:actionId/runs/:runId',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n queryParamSchema: workflowRunResultQuerySchema,\n responseSchema: workflowRunResultSchema,\n summary: 'Get action run by ID',\n description:\n 'Returns details for a specific action run with metadata and processed execution state. Use the fields query parameter to reduce payload size.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Getting agent builder action run by ID', { actionId, runId });\n\n return await workflows.GET_WORKFLOW_RUN_BY_ID_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error getting agent builder action run', { error, actionId, runId });\n return handleError(error, 'Error getting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/create-run',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Create action run',\n description: 'Creates a new action execution instance with an optional custom run ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Creating agent builder action run', { actionId, runId });\n\n return await workflows.CREATE_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error creating agent builder action run', { error, actionId });\n return handleError(error, 'Error creating agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Stream action execution',\n description: 'Executes an action and streams the results in real-time',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action', { actionId, runId });\n\n return await workflows.STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: optionalRunIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Start action asynchronously',\n description: 'Starts an action execution asynchronously without streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting agent builder action asynchronously', { actionId, runId });\n\n return await workflows.START_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error starting agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const START_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/start',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: startAsyncAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Start specific action run',\n description: 'Starts execution of a specific action run by ID',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Starting specific agent builder action run', { actionId, runId });\n\n return await workflows.START_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error starting agent builder action run', { error, actionId });\n return handleError(error, 'Error starting agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: 'Observe action stream',\n description: 'Observes and streams updates from an already running action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-async',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowExecutionResultSchema,\n summary: 'Resume action asynchronously',\n description: 'Resumes a suspended action execution asynchronously without streaming',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action asynchronously', { actionId, runId, step });\n\n return await workflows.RESUME_ASYNC_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action asynchronously', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n/**\n * Fire-and-forget resume for agent-builder actions: returns immediately with the runId without\n * waiting for completion. Delegates to the workflows `resume-no-wait` route.\n *\n * TODO(v2): fold this behavior into the `resume-async` route in Mastra v2 and remove this route.\n * Kept separate in v1 to avoid breaking the existing `resume-async` response contract.\n */\nexport const RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-no-wait',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: createWorkflowRunResponseSchema,\n summary: 'Resume action without waiting',\n description:\n 'Resumes a suspended action execution without waiting (fire-and-forget) and returns immediately with the runId. The action continues executing in the background.',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action without waiting', { actionId, runId, step });\n\n return await workflows.RESUME_NO_WAIT_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action without waiting', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume',\n responseType: 'json',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: workflowControlResponseSchema,\n summary: 'Resume action',\n description: 'Resumes a suspended action execution from a specific step',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action', { actionId, runId, step });\n\n return await workflows.RESUME_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action', { error, actionId });\n return handleError(error, 'Error resuming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/resume-stream',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: resumeAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: 'Resume action stream',\n description: 'Resumes a suspended action execution and continues streaming results',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, step, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Resuming agent builder action stream', { actionId, runId, step });\n\n return await workflows.RESUME_STREAM_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error resuming agent builder action stream', { error, actionId });\n return handleError(error, 'Error resuming agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/runs/:runId/cancel',\n responseType: 'json',\n pathParamSchema: actionRunPathParams,\n responseSchema: workflowControlResponseSchema,\n summary: 'Cancel action run',\n description: 'Cancels an in-progress action execution',\n tags: ['Agent Builder'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Cancelling agent builder action run', { actionId, runId });\n\n return await workflows.CANCEL_WORKFLOW_RUN_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error cancelling agent builder action run', { error, actionId });\n return handleError(error, 'Error cancelling agent builder action run');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\n// Legacy routes (deprecated)\nexport const STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n bodySchema: streamLegacyAgentBuilderBodySchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Stream agent-builder action with legacy format',\n description:\n 'Legacy endpoint for streaming agent-builder action execution. Use /agent-builder/:actionId/stream instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId, requestContext } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Streaming agent builder action (legacy)', { actionId, runId });\n\n return await workflows.STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n requestContext,\n });\n } catch (error) {\n logger.error('Error streaming agent builder action (legacy)', { error, actionId });\n return handleError(error, 'Error streaming agent builder action');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n\nexport const OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({\n method: 'POST',\n path: '/agent-builder/:actionId/observe-stream-legacy',\n responseType: 'stream',\n pathParamSchema: actionIdPathParams,\n queryParamSchema: runIdSchema,\n responseSchema: streamResponseSchema,\n summary: '[DEPRECATED] Observe agent-builder action stream with legacy format',\n description:\n 'Legacy endpoint for observing agent-builder action stream. Use /agent-builder/:actionId/observe instead.',\n tags: ['Agent Builder', 'Legacy'],\n requiresAuth: true,\n handler: async ctx => {\n const { mastra, actionId, runId } = ctx;\n const logger = mastra.getLogger();\n try {\n await registerAgentBuilderWorkflows(mastra);\n\n if (actionId && !WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {\n throw new HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` });\n }\n\n logger.info('Observing agent builder action stream (legacy)', { actionId, runId });\n\n return await workflows.OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE.handler({\n ...ctx,\n workflowId: actionId,\n });\n } catch (error) {\n logger.error('Error observing agent builder action stream (legacy)', { error, actionId });\n return handleError(error, 'Error observing agent builder action stream');\n } finally {\n WorkflowRegistry.cleanup();\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAI;AAEJ,eAAe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AAwD;IAAE;IAAO;GAAS,CAAC;GACxF,OAAOJ,8BAAAA,YAAY,OAAO,6CAA6C;EACzE,UAAU;GACR,cAAA,iBAAiB,QAAQ;EAC3B;CACF;AACF,CAAC"}
@@ -8,7 +8,7 @@ const require_constants = require("./constants-Co1XjPjd.cjs");
8
8
  const require_server_handlers_error = require("./server/handlers/error.cjs");
9
9
  const require_utils$1 = require("./utils-BbYUI6Yn.cjs");
10
10
  const require_stored_agents = require("./stored-agents-LCHZldYH.cjs");
11
- const require_workspace = require("./workspace-KeHGZvNV.cjs");
11
+ const require_workspace = require("./workspace-C5BBUatQ.cjs");
12
12
  const require_server_handlers_tool_schema_overrides = require("./server/handlers/tool-schema-overrides.cjs");
13
13
  let zod_v4 = require("zod/v4");
14
14
  let _mastra_core_utils_zod_to_json = require("@mastra/core/utils/zod-to-json");
@@ -1667,6 +1667,7 @@ const ABORT_AGENT_RUN_ROUTE = require_route_builder.createRoute({
1667
1667
  permission: require_utils$1.MastraFGAPermissions.MEMORY_WRITE
1668
1668
  });
1669
1669
  }
1670
+ if (typeof agent.__abortRunAcknowledged === "function") return { aborted: await agent.__abortRunAcknowledged(runId) };
1670
1671
  return { aborted: await agent.abortRunStream(runId) };
1671
1672
  } catch (error) {
1672
1673
  return require_server_handlers_error.handleError(error, "error aborting agent run");
@@ -3287,4 +3288,4 @@ Object.defineProperty(exports, "isProviderConnected", {
3287
3288
  }
3288
3289
  });
3289
3290
 
3290
- //# sourceMappingURL=agents-D36tukip.cjs.map
3291
+ //# sourceMappingURL=agents-BjdRPzyV.cjs.map