'use strict'; var chunkU72IZ5BP_cjs = require('./chunk-U72IZ5BP.cjs'); var chunkL56ROTL6_cjs = require('./chunk-L56ROTL6.cjs'); var chunkXOGNYKAF_cjs = require('./chunk-XOGNYKAF.cjs'); var chunkQQCQV7ZF_cjs = require('./chunk-QQCQV7ZF.cjs'); var chunkDIG2K5CV_cjs = require('./chunk-DIG2K5CV.cjs'); var chunkGZ4HWZWE_cjs = require('./chunk-GZ4HWZWE.cjs'); var chunkZ7LCIYK7_cjs = require('./chunk-Z7LCIYK7.cjs'); var chunkG54X6VE6_cjs = require('./chunk-G54X6VE6.cjs'); var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs'); var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs'); // src/server/handlers/agent-builder.ts var agent_builder_exports = {}; chunkO7I5CWRX_cjs.__export(agent_builder_exports, { CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE: () => CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE, CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE: () => CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE, GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE: () => GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE, GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE: () => GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE, LIST_AGENT_BUILDER_ACTIONS_ROUTE: () => LIST_AGENT_BUILDER_ACTIONS_ROUTE, LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE: () => LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE, OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE: () => OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE, OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE: () => OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, RESUME_AGENT_BUILDER_ACTION_ROUTE: () => RESUME_AGENT_BUILDER_ACTION_ROUTE, RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE: () => RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE, RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE: () => RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE, RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE: () => RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE, START_AGENT_BUILDER_ACTION_RUN_ROUTE: () => START_AGENT_BUILDER_ACTION_RUN_ROUTE, START_ASYNC_AGENT_BUILDER_ACTION_ROUTE: () => START_ASYNC_AGENT_BUILDER_ACTION_ROUTE, STREAM_AGENT_BUILDER_ACTION_ROUTE: () => STREAM_AGENT_BUILDER_ACTION_ROUTE, STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE: () => STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE }); var agentBuilderWorkflowsPromise; async function loadAgentBuilderWorkflows() { agentBuilderWorkflowsPromise ??= import('./dist-V3SVSSXI.cjs').then((mod) => mod.agentBuilderWorkflows); return agentBuilderWorkflowsPromise; } async function registerAgentBuilderWorkflows(mastra) { const agentBuilderWorkflows = await loadAgentBuilderWorkflows(); chunkGZ4HWZWE_cjs.WorkflowRegistry.registerTemporaryWorkflows(agentBuilderWorkflows, mastra); return agentBuilderWorkflows; } var LIST_AGENT_BUILDER_ACTIONS_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "GET", path: "/agent-builder", responseType: "json", responseSchema: chunkXOGNYKAF_cjs.listWorkflowsResponseSchema, summary: "List agent-builder actions", description: "Returns a list of all available agent-builder actions", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); logger.info("Listing agent builder actions"); return await chunkU72IZ5BP_cjs.LIST_WORKFLOWS_ROUTE.handler(ctx); } catch (error) { logger.error("Error listing agent builder actions", { error }); return chunkZ7LCIYK7_cjs.handleError(error, "Error getting agent builder workflows"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "GET", path: "/agent-builder/:actionId", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, responseSchema: chunkXOGNYKAF_cjs.workflowInfoSchema, summary: "Get action by ID", description: "Returns details for a specific agent-builder action", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId } = ctx; const logger = mastra.getLogger(); try { const agentBuilderWorkflows = await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(", ")}` }); } logger.info("Getting agent builder action by ID", { actionId }); return await chunkU72IZ5BP_cjs.GET_WORKFLOW_BY_ID_ROUTE.handler({ ...ctx, workflowId: actionId }); } catch (error) { logger.error("Error getting agent builder action by ID", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error getting agent builder action"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "GET", path: "/agent-builder/:actionId/runs", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkXOGNYKAF_cjs.listWorkflowRunsQuerySchema, responseSchema: chunkXOGNYKAF_cjs.workflowRunsResponseSchema, summary: "List action runs", description: "Returns a paginated list of execution runs for the specified action", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Listing agent builder action runs", { actionId }); return await chunkU72IZ5BP_cjs.LIST_WORKFLOW_RUNS_ROUTE.handler({ ...ctx, workflowId: actionId }); } catch (error) { logger.error("Error listing agent builder action runs", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error getting agent builder action runs"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "GET", path: "/agent-builder/:actionId/runs/:runId", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionRunPathParams, queryParamSchema: chunkXOGNYKAF_cjs.workflowRunResultQuerySchema, responseSchema: chunkXOGNYKAF_cjs.workflowRunResultSchema, summary: "Get action run by ID", description: "Returns details for a specific action run with metadata and processed execution state. Use the fields query parameter to reduce payload size.", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Getting agent builder action run by ID", { actionId, runId }); return await chunkU72IZ5BP_cjs.GET_WORKFLOW_RUN_BY_ID_ROUTE.handler({ ...ctx, workflowId: actionId }); } catch (error) { logger.error("Error getting agent builder action run", { error, actionId, runId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error getting agent builder action run"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/create-run", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.optionalRunIdSchema, responseSchema: chunkXOGNYKAF_cjs.createWorkflowRunResponseSchema, summary: "Create action run", description: "Creates a new action execution instance with an optional custom run ID", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Creating agent builder action run", { actionId, runId }); return await chunkU72IZ5BP_cjs.CREATE_WORKFLOW_RUN_ROUTE.handler({ ...ctx, workflowId: actionId }); } catch (error) { logger.error("Error creating agent builder action run", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error creating agent builder action run"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var STREAM_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/stream", responseType: "stream", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, bodySchema: chunkL56ROTL6_cjs.streamAgentBuilderBodySchema, responseSchema: chunkQQCQV7ZF_cjs.streamResponseSchema, summary: "Stream action execution", description: "Executes an action and streams the results in real-time", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Streaming agent builder action", { actionId, runId }); return await chunkU72IZ5BP_cjs.STREAM_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error streaming agent builder action", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error streaming agent builder action"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/start-async", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.optionalRunIdSchema, bodySchema: chunkL56ROTL6_cjs.startAsyncAgentBuilderBodySchema, responseSchema: chunkXOGNYKAF_cjs.workflowExecutionResultSchema, summary: "Start action asynchronously", description: "Starts an action execution asynchronously without streaming results", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Starting agent builder action asynchronously", { actionId, runId }); return await chunkU72IZ5BP_cjs.START_ASYNC_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error starting agent builder action asynchronously", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error starting agent builder action"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var START_AGENT_BUILDER_ACTION_RUN_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/start", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, bodySchema: chunkL56ROTL6_cjs.startAsyncAgentBuilderBodySchema, responseSchema: chunkXOGNYKAF_cjs.workflowControlResponseSchema, summary: "Start specific action run", description: "Starts execution of a specific action run by ID", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Starting specific agent builder action run", { actionId, runId }); return await chunkU72IZ5BP_cjs.START_WORKFLOW_RUN_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error starting agent builder action run", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error starting agent builder action run"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/observe", responseType: "stream", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, responseSchema: chunkQQCQV7ZF_cjs.streamResponseSchema, summary: "Observe action stream", description: "Observes and streams updates from an already running action execution", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Observing agent builder action stream", { actionId, runId }); return await chunkU72IZ5BP_cjs.OBSERVE_STREAM_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId }); } catch (error) { logger.error("Error observing agent builder action stream", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error observing agent builder action stream"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/resume-async", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, bodySchema: chunkL56ROTL6_cjs.resumeAgentBuilderBodySchema, responseSchema: chunkXOGNYKAF_cjs.workflowExecutionResultSchema, summary: "Resume action asynchronously", description: "Resumes a suspended action execution asynchronously without streaming", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, step, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Resuming agent builder action asynchronously", { actionId, runId, step }); return await chunkU72IZ5BP_cjs.RESUME_ASYNC_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error resuming agent builder action asynchronously", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error resuming agent builder action"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/resume-no-wait", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, bodySchema: chunkL56ROTL6_cjs.resumeAgentBuilderBodySchema, responseSchema: chunkXOGNYKAF_cjs.createWorkflowRunResponseSchema, summary: "Resume action without waiting", description: "Resumes a suspended action execution without waiting (fire-and-forget) and returns immediately with the runId. The action continues executing in the background.", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, step, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Resuming agent builder action without waiting", { actionId, runId, step }); return await chunkU72IZ5BP_cjs.RESUME_NO_WAIT_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error resuming agent builder action without waiting", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error resuming agent builder action"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var RESUME_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/resume", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, bodySchema: chunkL56ROTL6_cjs.resumeAgentBuilderBodySchema, responseSchema: chunkXOGNYKAF_cjs.workflowControlResponseSchema, summary: "Resume action", description: "Resumes a suspended action execution from a specific step", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, step, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Resuming agent builder action", { actionId, runId, step }); return await chunkU72IZ5BP_cjs.RESUME_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error resuming agent builder action", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error resuming agent builder action"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/resume-stream", responseType: "stream", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, bodySchema: chunkL56ROTL6_cjs.resumeAgentBuilderBodySchema, responseSchema: chunkQQCQV7ZF_cjs.streamResponseSchema, summary: "Resume action stream", description: "Resumes a suspended action execution and continues streaming results", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, step, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Resuming agent builder action stream", { actionId, runId, step }); return await chunkU72IZ5BP_cjs.RESUME_STREAM_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error resuming agent builder action stream", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error resuming agent builder action stream"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/runs/:runId/cancel", responseType: "json", pathParamSchema: chunkL56ROTL6_cjs.actionRunPathParams, responseSchema: chunkXOGNYKAF_cjs.workflowControlResponseSchema, summary: "Cancel action run", description: "Cancels an in-progress action execution", tags: ["Agent Builder"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Cancelling agent builder action run", { actionId, runId }); return await chunkU72IZ5BP_cjs.CANCEL_WORKFLOW_RUN_ROUTE.handler({ ...ctx, workflowId: actionId }); } catch (error) { logger.error("Error cancelling agent builder action run", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error cancelling agent builder action run"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/stream-legacy", responseType: "stream", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, bodySchema: chunkL56ROTL6_cjs.streamLegacyAgentBuilderBodySchema, responseSchema: chunkQQCQV7ZF_cjs.streamResponseSchema, summary: "[DEPRECATED] Stream agent-builder action with legacy format", description: "Legacy endpoint for streaming agent-builder action execution. Use /agent-builder/:actionId/stream instead.", tags: ["Agent Builder", "Legacy"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId, requestContext } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Streaming agent builder action (legacy)", { actionId, runId }); return await chunkU72IZ5BP_cjs.STREAM_LEGACY_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId, requestContext }); } catch (error) { logger.error("Error streaming agent builder action (legacy)", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error streaming agent builder action"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); var OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = chunkG54X6VE6_cjs.createRoute({ method: "POST", path: "/agent-builder/:actionId/observe-stream-legacy", responseType: "stream", pathParamSchema: chunkL56ROTL6_cjs.actionIdPathParams, queryParamSchema: chunkDIG2K5CV_cjs.runIdSchema, responseSchema: chunkQQCQV7ZF_cjs.streamResponseSchema, summary: "[DEPRECATED] Observe agent-builder action stream with legacy format", description: "Legacy endpoint for observing agent-builder action stream. Use /agent-builder/:actionId/observe instead.", tags: ["Agent Builder", "Legacy"], requiresAuth: true, handler: async (ctx) => { const { mastra, actionId, runId } = ctx; const logger = mastra.getLogger(); try { await registerAgentBuilderWorkflows(mastra); if (actionId && !chunkGZ4HWZWE_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) { throw new chunk64ITUOXI_cjs.HTTPException(400, { message: `Invalid agent-builder action: ${actionId}` }); } logger.info("Observing agent builder action stream (legacy)", { actionId, runId }); return await chunkU72IZ5BP_cjs.OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE.handler({ ...ctx, workflowId: actionId }); } catch (error) { logger.error("Error observing agent builder action stream (legacy)", { error, actionId }); return chunkZ7LCIYK7_cjs.handleError(error, "Error observing agent builder action stream"); } finally { chunkGZ4HWZWE_cjs.WorkflowRegistry.cleanup(); } } }); exports.CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE = CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE; exports.CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE = CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE; exports.GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE = GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE; exports.GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE = GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE; exports.LIST_AGENT_BUILDER_ACTIONS_ROUTE = LIST_AGENT_BUILDER_ACTIONS_ROUTE; exports.LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE = LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE; exports.OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE = OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE; exports.OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE; exports.RESUME_AGENT_BUILDER_ACTION_ROUTE = RESUME_AGENT_BUILDER_ACTION_ROUTE; exports.RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE = RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE; exports.RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE = RESUME_NO_WAIT_AGENT_BUILDER_ACTION_ROUTE; exports.RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE = RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE; exports.START_AGENT_BUILDER_ACTION_RUN_ROUTE = START_AGENT_BUILDER_ACTION_RUN_ROUTE; exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTION_ROUTE; exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE; exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE; exports.agent_builder_exports = agent_builder_exports; //# sourceMappingURL=chunk-JGWDTZ4A.cjs.map //# sourceMappingURL=chunk-JGWDTZ4A.cjs.map