@voltagent/server-core 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -450,6 +450,32 @@ declare const WORKFLOW_ROUTES: {
450
450
  };
451
451
  };
452
452
  };
453
+ readonly cancelWorkflow: {
454
+ readonly method: "post";
455
+ readonly path: "/workflows/:id/executions/:executionId/cancel";
456
+ readonly summary: "Cancel workflow execution";
457
+ readonly description: "Cancel a running workflow execution immediately. The workflow stops execution and the state is marked as cancelled. Cancelled workflows cannot be resumed.";
458
+ readonly tags: readonly ["Workflow Management"];
459
+ readonly operationId: "cancelWorkflow";
460
+ readonly responses: {
461
+ readonly 200: {
462
+ readonly description: "Successfully cancelled workflow execution";
463
+ readonly contentType: "application/json";
464
+ };
465
+ readonly 404: {
466
+ readonly description: "Workflow or execution not found";
467
+ readonly contentType: "application/json";
468
+ };
469
+ readonly 409: {
470
+ readonly description: "Workflow execution already completed or not cancellable";
471
+ readonly contentType: "application/json";
472
+ };
473
+ readonly 500: {
474
+ readonly description: "Failed to cancel workflow due to server error";
475
+ readonly contentType: "application/json";
476
+ };
477
+ };
478
+ };
453
479
  readonly resumeWorkflow: {
454
480
  readonly method: "post";
455
481
  readonly path: "/workflows/:id/executions/:executionId/resume";
@@ -1096,6 +1122,32 @@ declare const ALL_ROUTES: {
1096
1122
  };
1097
1123
  };
1098
1124
  };
1125
+ readonly cancelWorkflow: {
1126
+ readonly method: "post";
1127
+ readonly path: "/workflows/:id/executions/:executionId/cancel";
1128
+ readonly summary: "Cancel workflow execution";
1129
+ readonly description: "Cancel a running workflow execution immediately. The workflow stops execution and the state is marked as cancelled. Cancelled workflows cannot be resumed.";
1130
+ readonly tags: readonly ["Workflow Management"];
1131
+ readonly operationId: "cancelWorkflow";
1132
+ readonly responses: {
1133
+ readonly 200: {
1134
+ readonly description: "Successfully cancelled workflow execution";
1135
+ readonly contentType: "application/json";
1136
+ };
1137
+ readonly 404: {
1138
+ readonly description: "Workflow or execution not found";
1139
+ readonly contentType: "application/json";
1140
+ };
1141
+ readonly 409: {
1142
+ readonly description: "Workflow execution already completed or not cancellable";
1143
+ readonly contentType: "application/json";
1144
+ };
1145
+ readonly 500: {
1146
+ readonly description: "Failed to cancel workflow due to server error";
1147
+ readonly contentType: "application/json";
1148
+ };
1149
+ };
1150
+ };
1099
1151
  readonly resumeWorkflow: {
1100
1152
  readonly method: "post";
1101
1153
  readonly path: "/workflows/:id/executions/:executionId/resume";
@@ -2467,14 +2519,14 @@ declare const WorkflowStreamEventSchema: z.ZodObject<{
2467
2519
  from: z.ZodString;
2468
2520
  input: z.ZodOptional<z.ZodAny>;
2469
2521
  output: z.ZodOptional<z.ZodAny>;
2470
- status: z.ZodEnum<["pending", "running", "success", "error", "suspended"]>;
2522
+ status: z.ZodEnum<["pending", "running", "success", "error", "suspended", "cancelled"]>;
2471
2523
  timestamp: z.ZodString;
2472
2524
  stepIndex: z.ZodOptional<z.ZodNumber>;
2473
2525
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2474
2526
  error: z.ZodOptional<z.ZodAny>;
2475
2527
  }, "strip", z.ZodTypeAny, {
2476
2528
  type: string;
2477
- status: "success" | "error" | "running" | "pending" | "suspended";
2529
+ status: "success" | "error" | "running" | "pending" | "suspended" | "cancelled";
2478
2530
  executionId: string;
2479
2531
  timestamp: string;
2480
2532
  from: string;
@@ -2485,7 +2537,7 @@ declare const WorkflowStreamEventSchema: z.ZodObject<{
2485
2537
  metadata?: Record<string, any> | undefined;
2486
2538
  }, {
2487
2539
  type: string;
2488
- status: "success" | "error" | "running" | "pending" | "suspended";
2540
+ status: "success" | "error" | "running" | "pending" | "suspended" | "cancelled";
2489
2541
  executionId: string;
2490
2542
  timestamp: string;
2491
2543
  from: string;
@@ -2553,6 +2605,48 @@ declare const WorkflowSuspendResponseSchema: z.ZodObject<{
2553
2605
  };
2554
2606
  };
2555
2607
  }>;
2608
+ declare const WorkflowCancelRequestSchema: z.ZodObject<{
2609
+ reason: z.ZodOptional<z.ZodString>;
2610
+ }, "strip", z.ZodTypeAny, {
2611
+ reason?: string | undefined;
2612
+ }, {
2613
+ reason?: string | undefined;
2614
+ }>;
2615
+ declare const WorkflowCancelResponseSchema: z.ZodObject<{
2616
+ success: z.ZodLiteral<true>;
2617
+ data: z.ZodObject<{
2618
+ executionId: z.ZodString;
2619
+ status: z.ZodLiteral<"cancelled">;
2620
+ cancelledAt: z.ZodString;
2621
+ reason: z.ZodOptional<z.ZodString>;
2622
+ }, "strip", z.ZodTypeAny, {
2623
+ status: "cancelled";
2624
+ executionId: string;
2625
+ cancelledAt: string;
2626
+ reason?: string | undefined;
2627
+ }, {
2628
+ status: "cancelled";
2629
+ executionId: string;
2630
+ cancelledAt: string;
2631
+ reason?: string | undefined;
2632
+ }>;
2633
+ }, "strip", z.ZodTypeAny, {
2634
+ success: true;
2635
+ data: {
2636
+ status: "cancelled";
2637
+ executionId: string;
2638
+ cancelledAt: string;
2639
+ reason?: string | undefined;
2640
+ };
2641
+ }, {
2642
+ success: true;
2643
+ data: {
2644
+ status: "cancelled";
2645
+ executionId: string;
2646
+ cancelledAt: string;
2647
+ reason?: string | undefined;
2648
+ };
2649
+ }>;
2556
2650
  declare const WorkflowResumeRequestSchema: z.ZodOptional<z.ZodObject<{
2557
2651
  resumeData: z.ZodOptional<z.ZodAny>;
2558
2652
  options: z.ZodOptional<z.ZodObject<{
@@ -2952,6 +3046,11 @@ declare function handleStreamWorkflow(workflowId: string, body: any, deps: Serve
2952
3046
  * Returns suspension result
2953
3047
  */
2954
3048
  declare function handleSuspendWorkflow(executionId: string, body: any, deps: ServerProviderDeps, logger: Logger): Promise<ApiResponse>;
3049
+ /**
3050
+ * Handler for cancelling a workflow
3051
+ * Returns cancellation result
3052
+ */
3053
+ declare function handleCancelWorkflow(executionId: string, body: any, deps: ServerProviderDeps, logger: Logger): Promise<ApiResponse>;
2955
3054
  /**
2956
3055
  * Handler for resuming a workflow
2957
3056
  * Returns resume result
@@ -3728,4 +3827,4 @@ declare const DEFAULT_CORS_OPTIONS: {
3728
3827
  credentials: boolean;
3729
3828
  };
3730
3829
 
3731
- export { A2AErrorCode, type A2AJsonRpcId, type A2ARequestContext, type A2AServerLikeWithHandlers, type A2AServerLookupResult, A2A_ROUTES, AGENT_ROUTES, ALL_ROUTES, type AgentCard, type AgentCardCapabilities, type AgentCardProviderInfo, type AgentCardSkill, AgentListSchema, AgentParamsSchema, AgentResponseSchema, type ApiResponse, type AppSetupConfig, type AuthFrameworkAdapter, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_CORS_OPTIONS, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, type ErrorResponse, ErrorSchema, type FilterContext, GenerateOptionsSchema, type HttpMethod, type IWebSocket, type JWTAuthOptions, type JsonRpcError, type JsonRpcHandlerResult, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcStream, LOG_ROUTES, type LogFilterOptions, type LogHandlerResponse, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_ROUTES, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, OBSERVABILITY_ROUTES, ObjectRequestSchema, ObjectResponseSchema, type OpenApiInfo, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ResponseDefinition, type RouteDefinition, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, type StreamResponse, StreamTextEventSchema, SubAgentResponseSchema, type SuccessResponse, TextRequestSchema, TextResponseSchema, UPDATE_ROUTES, VoltA2AError, WORKFLOW_ROUTES, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createAuthErrorResponse, createAuthMiddlewareFactory, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createUserContext, createWebSocketRouter, createWebSocketServer, executeA2ARequest, extractBearerToken, extractToken, formatSSE, getAllRoutesArray, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getOpenApiDoc, getOrCreateLogger, getPortsToTry, getResponseStatus, getRoutesByTag, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleChatStream, handleCheckUpdates, handleExecuteWorkflow, handleGenerateObject, handleGenerateText, handleGetAgent, handleGetAgentHistory, handleGetAgents, handleGetLogs, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleGetWorkflow, handleGetWorkflowState, handleGetWorkflows, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleObservabilityConnection, handleResumeWorkflow, handleSetMcpLogLevel, handleStreamObject, handleStreamText, handleStreamWorkflow, handleSuspendWorkflow, handleWebSocketConnection, injectUserIntoBody, isErrorResponse, isJsonRpcRequest, isSuccessResponse, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, mapHandlerResponse, mapLogResponse, normalizeError, parseJsonRpcRequest, pathMatches, portManager, preferredPorts, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, resolveAgentCard, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, shouldEnableSwaggerUI, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
3830
+ export { A2AErrorCode, type A2AJsonRpcId, type A2ARequestContext, type A2AServerLikeWithHandlers, type A2AServerLookupResult, A2A_ROUTES, AGENT_ROUTES, ALL_ROUTES, type AgentCard, type AgentCardCapabilities, type AgentCardProviderInfo, type AgentCardSkill, AgentListSchema, AgentParamsSchema, AgentResponseSchema, type ApiResponse, type AppSetupConfig, type AuthFrameworkAdapter, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_CORS_OPTIONS, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, type ErrorResponse, ErrorSchema, type FilterContext, GenerateOptionsSchema, type HttpMethod, type IWebSocket, type JWTAuthOptions, type JsonRpcError, type JsonRpcHandlerResult, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcStream, LOG_ROUTES, type LogFilterOptions, type LogHandlerResponse, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_ROUTES, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, OBSERVABILITY_ROUTES, ObjectRequestSchema, ObjectResponseSchema, type OpenApiInfo, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ResponseDefinition, type RouteDefinition, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, type StreamResponse, StreamTextEventSchema, SubAgentResponseSchema, type SuccessResponse, TextRequestSchema, TextResponseSchema, UPDATE_ROUTES, VoltA2AError, WORKFLOW_ROUTES, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowCancelRequestSchema, WorkflowCancelResponseSchema, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createAuthErrorResponse, createAuthMiddlewareFactory, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createUserContext, createWebSocketRouter, createWebSocketServer, executeA2ARequest, extractBearerToken, extractToken, formatSSE, getAllRoutesArray, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getOpenApiDoc, getOrCreateLogger, getPortsToTry, getResponseStatus, getRoutesByTag, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleCancelWorkflow, handleChatStream, handleCheckUpdates, handleExecuteWorkflow, handleGenerateObject, handleGenerateText, handleGetAgent, handleGetAgentHistory, handleGetAgents, handleGetLogs, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleGetWorkflow, handleGetWorkflowState, handleGetWorkflows, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleObservabilityConnection, handleResumeWorkflow, handleSetMcpLogLevel, handleStreamObject, handleStreamText, handleStreamWorkflow, handleSuspendWorkflow, handleWebSocketConnection, injectUserIntoBody, isErrorResponse, isJsonRpcRequest, isSuccessResponse, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, mapHandlerResponse, mapLogResponse, normalizeError, parseJsonRpcRequest, pathMatches, portManager, preferredPorts, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, resolveAgentCard, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, shouldEnableSwaggerUI, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
package/dist/index.d.ts CHANGED
@@ -450,6 +450,32 @@ declare const WORKFLOW_ROUTES: {
450
450
  };
451
451
  };
452
452
  };
453
+ readonly cancelWorkflow: {
454
+ readonly method: "post";
455
+ readonly path: "/workflows/:id/executions/:executionId/cancel";
456
+ readonly summary: "Cancel workflow execution";
457
+ readonly description: "Cancel a running workflow execution immediately. The workflow stops execution and the state is marked as cancelled. Cancelled workflows cannot be resumed.";
458
+ readonly tags: readonly ["Workflow Management"];
459
+ readonly operationId: "cancelWorkflow";
460
+ readonly responses: {
461
+ readonly 200: {
462
+ readonly description: "Successfully cancelled workflow execution";
463
+ readonly contentType: "application/json";
464
+ };
465
+ readonly 404: {
466
+ readonly description: "Workflow or execution not found";
467
+ readonly contentType: "application/json";
468
+ };
469
+ readonly 409: {
470
+ readonly description: "Workflow execution already completed or not cancellable";
471
+ readonly contentType: "application/json";
472
+ };
473
+ readonly 500: {
474
+ readonly description: "Failed to cancel workflow due to server error";
475
+ readonly contentType: "application/json";
476
+ };
477
+ };
478
+ };
453
479
  readonly resumeWorkflow: {
454
480
  readonly method: "post";
455
481
  readonly path: "/workflows/:id/executions/:executionId/resume";
@@ -1096,6 +1122,32 @@ declare const ALL_ROUTES: {
1096
1122
  };
1097
1123
  };
1098
1124
  };
1125
+ readonly cancelWorkflow: {
1126
+ readonly method: "post";
1127
+ readonly path: "/workflows/:id/executions/:executionId/cancel";
1128
+ readonly summary: "Cancel workflow execution";
1129
+ readonly description: "Cancel a running workflow execution immediately. The workflow stops execution and the state is marked as cancelled. Cancelled workflows cannot be resumed.";
1130
+ readonly tags: readonly ["Workflow Management"];
1131
+ readonly operationId: "cancelWorkflow";
1132
+ readonly responses: {
1133
+ readonly 200: {
1134
+ readonly description: "Successfully cancelled workflow execution";
1135
+ readonly contentType: "application/json";
1136
+ };
1137
+ readonly 404: {
1138
+ readonly description: "Workflow or execution not found";
1139
+ readonly contentType: "application/json";
1140
+ };
1141
+ readonly 409: {
1142
+ readonly description: "Workflow execution already completed or not cancellable";
1143
+ readonly contentType: "application/json";
1144
+ };
1145
+ readonly 500: {
1146
+ readonly description: "Failed to cancel workflow due to server error";
1147
+ readonly contentType: "application/json";
1148
+ };
1149
+ };
1150
+ };
1099
1151
  readonly resumeWorkflow: {
1100
1152
  readonly method: "post";
1101
1153
  readonly path: "/workflows/:id/executions/:executionId/resume";
@@ -2467,14 +2519,14 @@ declare const WorkflowStreamEventSchema: z.ZodObject<{
2467
2519
  from: z.ZodString;
2468
2520
  input: z.ZodOptional<z.ZodAny>;
2469
2521
  output: z.ZodOptional<z.ZodAny>;
2470
- status: z.ZodEnum<["pending", "running", "success", "error", "suspended"]>;
2522
+ status: z.ZodEnum<["pending", "running", "success", "error", "suspended", "cancelled"]>;
2471
2523
  timestamp: z.ZodString;
2472
2524
  stepIndex: z.ZodOptional<z.ZodNumber>;
2473
2525
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2474
2526
  error: z.ZodOptional<z.ZodAny>;
2475
2527
  }, "strip", z.ZodTypeAny, {
2476
2528
  type: string;
2477
- status: "success" | "error" | "running" | "pending" | "suspended";
2529
+ status: "success" | "error" | "running" | "pending" | "suspended" | "cancelled";
2478
2530
  executionId: string;
2479
2531
  timestamp: string;
2480
2532
  from: string;
@@ -2485,7 +2537,7 @@ declare const WorkflowStreamEventSchema: z.ZodObject<{
2485
2537
  metadata?: Record<string, any> | undefined;
2486
2538
  }, {
2487
2539
  type: string;
2488
- status: "success" | "error" | "running" | "pending" | "suspended";
2540
+ status: "success" | "error" | "running" | "pending" | "suspended" | "cancelled";
2489
2541
  executionId: string;
2490
2542
  timestamp: string;
2491
2543
  from: string;
@@ -2553,6 +2605,48 @@ declare const WorkflowSuspendResponseSchema: z.ZodObject<{
2553
2605
  };
2554
2606
  };
2555
2607
  }>;
2608
+ declare const WorkflowCancelRequestSchema: z.ZodObject<{
2609
+ reason: z.ZodOptional<z.ZodString>;
2610
+ }, "strip", z.ZodTypeAny, {
2611
+ reason?: string | undefined;
2612
+ }, {
2613
+ reason?: string | undefined;
2614
+ }>;
2615
+ declare const WorkflowCancelResponseSchema: z.ZodObject<{
2616
+ success: z.ZodLiteral<true>;
2617
+ data: z.ZodObject<{
2618
+ executionId: z.ZodString;
2619
+ status: z.ZodLiteral<"cancelled">;
2620
+ cancelledAt: z.ZodString;
2621
+ reason: z.ZodOptional<z.ZodString>;
2622
+ }, "strip", z.ZodTypeAny, {
2623
+ status: "cancelled";
2624
+ executionId: string;
2625
+ cancelledAt: string;
2626
+ reason?: string | undefined;
2627
+ }, {
2628
+ status: "cancelled";
2629
+ executionId: string;
2630
+ cancelledAt: string;
2631
+ reason?: string | undefined;
2632
+ }>;
2633
+ }, "strip", z.ZodTypeAny, {
2634
+ success: true;
2635
+ data: {
2636
+ status: "cancelled";
2637
+ executionId: string;
2638
+ cancelledAt: string;
2639
+ reason?: string | undefined;
2640
+ };
2641
+ }, {
2642
+ success: true;
2643
+ data: {
2644
+ status: "cancelled";
2645
+ executionId: string;
2646
+ cancelledAt: string;
2647
+ reason?: string | undefined;
2648
+ };
2649
+ }>;
2556
2650
  declare const WorkflowResumeRequestSchema: z.ZodOptional<z.ZodObject<{
2557
2651
  resumeData: z.ZodOptional<z.ZodAny>;
2558
2652
  options: z.ZodOptional<z.ZodObject<{
@@ -2952,6 +3046,11 @@ declare function handleStreamWorkflow(workflowId: string, body: any, deps: Serve
2952
3046
  * Returns suspension result
2953
3047
  */
2954
3048
  declare function handleSuspendWorkflow(executionId: string, body: any, deps: ServerProviderDeps, logger: Logger): Promise<ApiResponse>;
3049
+ /**
3050
+ * Handler for cancelling a workflow
3051
+ * Returns cancellation result
3052
+ */
3053
+ declare function handleCancelWorkflow(executionId: string, body: any, deps: ServerProviderDeps, logger: Logger): Promise<ApiResponse>;
2955
3054
  /**
2956
3055
  * Handler for resuming a workflow
2957
3056
  * Returns resume result
@@ -3728,4 +3827,4 @@ declare const DEFAULT_CORS_OPTIONS: {
3728
3827
  credentials: boolean;
3729
3828
  };
3730
3829
 
3731
- export { A2AErrorCode, type A2AJsonRpcId, type A2ARequestContext, type A2AServerLikeWithHandlers, type A2AServerLookupResult, A2A_ROUTES, AGENT_ROUTES, ALL_ROUTES, type AgentCard, type AgentCardCapabilities, type AgentCardProviderInfo, type AgentCardSkill, AgentListSchema, AgentParamsSchema, AgentResponseSchema, type ApiResponse, type AppSetupConfig, type AuthFrameworkAdapter, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_CORS_OPTIONS, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, type ErrorResponse, ErrorSchema, type FilterContext, GenerateOptionsSchema, type HttpMethod, type IWebSocket, type JWTAuthOptions, type JsonRpcError, type JsonRpcHandlerResult, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcStream, LOG_ROUTES, type LogFilterOptions, type LogHandlerResponse, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_ROUTES, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, OBSERVABILITY_ROUTES, ObjectRequestSchema, ObjectResponseSchema, type OpenApiInfo, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ResponseDefinition, type RouteDefinition, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, type StreamResponse, StreamTextEventSchema, SubAgentResponseSchema, type SuccessResponse, TextRequestSchema, TextResponseSchema, UPDATE_ROUTES, VoltA2AError, WORKFLOW_ROUTES, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createAuthErrorResponse, createAuthMiddlewareFactory, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createUserContext, createWebSocketRouter, createWebSocketServer, executeA2ARequest, extractBearerToken, extractToken, formatSSE, getAllRoutesArray, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getOpenApiDoc, getOrCreateLogger, getPortsToTry, getResponseStatus, getRoutesByTag, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleChatStream, handleCheckUpdates, handleExecuteWorkflow, handleGenerateObject, handleGenerateText, handleGetAgent, handleGetAgentHistory, handleGetAgents, handleGetLogs, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleGetWorkflow, handleGetWorkflowState, handleGetWorkflows, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleObservabilityConnection, handleResumeWorkflow, handleSetMcpLogLevel, handleStreamObject, handleStreamText, handleStreamWorkflow, handleSuspendWorkflow, handleWebSocketConnection, injectUserIntoBody, isErrorResponse, isJsonRpcRequest, isSuccessResponse, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, mapHandlerResponse, mapLogResponse, normalizeError, parseJsonRpcRequest, pathMatches, portManager, preferredPorts, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, resolveAgentCard, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, shouldEnableSwaggerUI, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
3830
+ export { A2AErrorCode, type A2AJsonRpcId, type A2ARequestContext, type A2AServerLikeWithHandlers, type A2AServerLookupResult, A2A_ROUTES, AGENT_ROUTES, ALL_ROUTES, type AgentCard, type AgentCardCapabilities, type AgentCardProviderInfo, type AgentCardSkill, AgentListSchema, AgentParamsSchema, AgentResponseSchema, type ApiResponse, type AppSetupConfig, type AuthFrameworkAdapter, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_CORS_OPTIONS, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, type ErrorResponse, ErrorSchema, type FilterContext, GenerateOptionsSchema, type HttpMethod, type IWebSocket, type JWTAuthOptions, type JsonRpcError, type JsonRpcHandlerResult, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcStream, LOG_ROUTES, type LogFilterOptions, type LogHandlerResponse, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_ROUTES, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, OBSERVABILITY_ROUTES, ObjectRequestSchema, ObjectResponseSchema, type OpenApiInfo, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ResponseDefinition, type RouteDefinition, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, type StreamResponse, StreamTextEventSchema, SubAgentResponseSchema, type SuccessResponse, TextRequestSchema, TextResponseSchema, UPDATE_ROUTES, VoltA2AError, WORKFLOW_ROUTES, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowCancelRequestSchema, WorkflowCancelResponseSchema, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createAuthErrorResponse, createAuthMiddlewareFactory, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createUserContext, createWebSocketRouter, createWebSocketServer, executeA2ARequest, extractBearerToken, extractToken, formatSSE, getAllRoutesArray, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getOpenApiDoc, getOrCreateLogger, getPortsToTry, getResponseStatus, getRoutesByTag, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleCancelWorkflow, handleChatStream, handleCheckUpdates, handleExecuteWorkflow, handleGenerateObject, handleGenerateText, handleGetAgent, handleGetAgentHistory, handleGetAgents, handleGetLogs, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleGetWorkflow, handleGetWorkflowState, handleGetWorkflows, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleObservabilityConnection, handleResumeWorkflow, handleSetMcpLogLevel, handleStreamObject, handleStreamText, handleStreamWorkflow, handleSuspendWorkflow, handleWebSocketConnection, injectUserIntoBody, isErrorResponse, isJsonRpcRequest, isSuccessResponse, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, mapHandlerResponse, mapLogResponse, normalizeError, parseJsonRpcRequest, pathMatches, portManager, preferredPorts, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, resolveAgentCard, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, shouldEnableSwaggerUI, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
package/dist/index.js CHANGED
@@ -70,6 +70,8 @@ __export(index_exports, {
70
70
  VoltA2AError: () => VoltA2AError,
71
71
  WORKFLOW_ROUTES: () => WORKFLOW_ROUTES,
72
72
  WebSocketRouter: () => WebSocketRouter,
73
+ WorkflowCancelRequestSchema: () => WorkflowCancelRequestSchema,
74
+ WorkflowCancelResponseSchema: () => WorkflowCancelResponseSchema,
73
75
  WorkflowExecutionParamsSchema: () => WorkflowExecutionParamsSchema,
74
76
  WorkflowExecutionRequestSchema: () => WorkflowExecutionRequestSchema,
75
77
  WorkflowExecutionResponseSchema: () => WorkflowExecutionResponseSchema,
@@ -113,6 +115,7 @@ __export(index_exports, {
113
115
  getSpanByIdHandler: () => getSpanByIdHandler,
114
116
  getTraceByIdHandler: () => getTraceByIdHandler,
115
117
  getTracesHandler: () => getTracesHandler,
118
+ handleCancelWorkflow: () => handleCancelWorkflow,
116
119
  handleChatStream: () => handleChatStream,
117
120
  handleCheckUpdates: () => handleCheckUpdates,
118
121
  handleExecuteWorkflow: () => handleExecuteWorkflow,
@@ -366,7 +369,7 @@ var WorkflowStreamEventSchema = import_zod.z.object({
366
369
  from: import_zod.z.string().describe("Source of the event"),
367
370
  input: import_zod.z.any().optional(),
368
371
  output: import_zod.z.any().optional(),
369
- status: import_zod.z.enum(["pending", "running", "success", "error", "suspended"]),
372
+ status: import_zod.z.enum(["pending", "running", "success", "error", "suspended", "cancelled"]),
370
373
  timestamp: import_zod.z.string(),
371
374
  stepIndex: import_zod.z.number().optional(),
372
375
  metadata: import_zod.z.record(import_zod.z.any()).optional(),
@@ -386,6 +389,18 @@ var WorkflowSuspendResponseSchema = import_zod.z.object({
386
389
  })
387
390
  }).describe("Workflow suspension result")
388
391
  });
392
+ var WorkflowCancelRequestSchema = import_zod.z.object({
393
+ reason: import_zod.z.string().optional().describe("Reason for cancellation")
394
+ });
395
+ var WorkflowCancelResponseSchema = import_zod.z.object({
396
+ success: import_zod.z.literal(true),
397
+ data: import_zod.z.object({
398
+ executionId: import_zod.z.string(),
399
+ status: import_zod.z.literal("cancelled"),
400
+ cancelledAt: import_zod.z.string(),
401
+ reason: import_zod.z.string().optional()
402
+ }).describe("Workflow cancellation result")
403
+ });
389
404
  var WorkflowResumeRequestSchema = import_zod.z.object({
390
405
  resumeData: import_zod.z.any().optional().describe("Data to pass to the resumed step (validated against step's resumeSchema)"),
391
406
  options: import_zod.z.object({
@@ -717,6 +732,32 @@ var WORKFLOW_ROUTES = {
717
732
  }
718
733
  }
719
734
  },
735
+ cancelWorkflow: {
736
+ method: "post",
737
+ path: "/workflows/:id/executions/:executionId/cancel",
738
+ summary: "Cancel workflow execution",
739
+ description: "Cancel a running workflow execution immediately. The workflow stops execution and the state is marked as cancelled. Cancelled workflows cannot be resumed.",
740
+ tags: ["Workflow Management"],
741
+ operationId: "cancelWorkflow",
742
+ responses: {
743
+ 200: {
744
+ description: "Successfully cancelled workflow execution",
745
+ contentType: "application/json"
746
+ },
747
+ 404: {
748
+ description: "Workflow or execution not found",
749
+ contentType: "application/json"
750
+ },
751
+ 409: {
752
+ description: "Workflow execution already completed or not cancellable",
753
+ contentType: "application/json"
754
+ },
755
+ 500: {
756
+ description: "Failed to cancel workflow due to server error",
757
+ contentType: "application/json"
758
+ }
759
+ }
760
+ },
720
761
  resumeWorkflow: {
721
762
  method: "post",
722
763
  path: "/workflows/:id/executions/:executionId/resume",
@@ -2356,7 +2397,7 @@ async function handleSuspendWorkflow(executionId, body, deps, logger) {
2356
2397
  if (!suspendController) {
2357
2398
  return {
2358
2399
  success: false,
2359
- error: "No active execution found or workflow already completed"
2400
+ error: "Workflow execution not found or already completed"
2360
2401
  };
2361
2402
  }
2362
2403
  suspendController.suspend(reason || "API request");
@@ -2382,6 +2423,55 @@ async function handleSuspendWorkflow(executionId, body, deps, logger) {
2382
2423
  }
2383
2424
  }
2384
2425
  __name(handleSuspendWorkflow, "handleSuspendWorkflow");
2426
+ async function handleCancelWorkflow(executionId, body, deps, logger) {
2427
+ try {
2428
+ const { reason } = body || {};
2429
+ if (!deps.workflowRegistry.activeExecutions) {
2430
+ return {
2431
+ success: false,
2432
+ error: "Workflow cancellation not supported"
2433
+ };
2434
+ }
2435
+ const suspendController = deps.workflowRegistry.activeExecutions.get(executionId);
2436
+ if (!suspendController) {
2437
+ return {
2438
+ success: false,
2439
+ error: "No active execution found or workflow already completed"
2440
+ };
2441
+ }
2442
+ if (suspendController.isCancelled?.()) {
2443
+ return {
2444
+ success: true,
2445
+ data: {
2446
+ executionId,
2447
+ status: "cancelled",
2448
+ cancelledAt: (/* @__PURE__ */ new Date()).toISOString(),
2449
+ reason: suspendController.getCancelReason?.()
2450
+ }
2451
+ };
2452
+ }
2453
+ const cancellationReason = reason || "API request";
2454
+ suspendController.cancel(cancellationReason);
2455
+ deps.workflowRegistry.activeExecutions.delete(executionId);
2456
+ await new Promise((resolve) => setTimeout(resolve, 50));
2457
+ return {
2458
+ success: true,
2459
+ data: {
2460
+ executionId,
2461
+ status: "cancelled",
2462
+ cancelledAt: (/* @__PURE__ */ new Date()).toISOString(),
2463
+ reason: cancellationReason
2464
+ }
2465
+ };
2466
+ } catch (error) {
2467
+ logger.error("Failed to cancel workflow", { error });
2468
+ return {
2469
+ success: false,
2470
+ error: error instanceof Error ? error.message : "Failed to cancel workflow"
2471
+ };
2472
+ }
2473
+ }
2474
+ __name(handleCancelWorkflow, "handleCancelWorkflow");
2385
2475
  async function handleResumeWorkflow(workflowId, executionId, body, deps, logger) {
2386
2476
  try {
2387
2477
  const { resumeData, options } = body || {};
@@ -4186,6 +4276,8 @@ var DEFAULT_CORS_OPTIONS = {
4186
4276
  VoltA2AError,
4187
4277
  WORKFLOW_ROUTES,
4188
4278
  WebSocketRouter,
4279
+ WorkflowCancelRequestSchema,
4280
+ WorkflowCancelResponseSchema,
4189
4281
  WorkflowExecutionParamsSchema,
4190
4282
  WorkflowExecutionRequestSchema,
4191
4283
  WorkflowExecutionResponseSchema,
@@ -4229,6 +4321,7 @@ var DEFAULT_CORS_OPTIONS = {
4229
4321
  getSpanByIdHandler,
4230
4322
  getTraceByIdHandler,
4231
4323
  getTracesHandler,
4324
+ handleCancelWorkflow,
4232
4325
  handleChatStream,
4233
4326
  handleCheckUpdates,
4234
4327
  handleExecuteWorkflow,