@voltagent/server-core 1.0.8 → 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
@@ -1,6 +1,10 @@
1
1
  import { LogFilter, Logger, LogLevel, LogEntry } from '@voltagent/internal';
2
2
  import { z } from 'zod';
3
- import { ServerProviderDeps, IServerProvider } from '@voltagent/core';
3
+ import { MCPServerRegistry, A2AServerRegistry, ServerProviderDeps, IServerProvider } from '@voltagent/core';
4
+ import { Tool, CallToolResult, Prompt, GetPromptRequest, GetPromptResult, Resource, ResourceContents, ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
5
+ export { CallToolResult, GetPromptRequest, GetPromptResult, Prompt, Resource, ResourceContents, ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
6
+ import { MCPServerLike as MCPServerLike$1, MCPServerDeps, MCPServerMetadata as MCPServerMetadata$1 } from '@voltagent/internal/mcp';
7
+ import { A2AServerLike, A2AServerMetadata } from '@voltagent/internal/a2a';
4
8
  import jwt from 'jsonwebtoken';
5
9
  import { IncomingMessage, Server } from 'node:http';
6
10
  import { Socket } from 'node:net';
@@ -35,13 +39,15 @@ interface PortConfig {
35
39
  /**
36
40
  * Options for server startup display
37
41
  */
42
+ interface ServerEndpointSummary {
43
+ path: string;
44
+ method: string;
45
+ description?: string;
46
+ group?: string;
47
+ }
38
48
  interface ServerStartupOptions {
39
49
  enableSwaggerUI?: boolean;
40
- customEndpoints?: Array<{
41
- path: string;
42
- method: string;
43
- description?: string;
44
- }>;
50
+ customEndpoints?: ServerEndpointSummary[];
45
51
  }
46
52
  /**
47
53
  * Common server configuration that all implementations should support
@@ -444,6 +450,32 @@ declare const WORKFLOW_ROUTES: {
444
450
  };
445
451
  };
446
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
+ };
447
479
  readonly resumeWorkflow: {
448
480
  readonly method: "post";
449
481
  readonly path: "/workflows/:id/executions/:executionId/resume";
@@ -1090,6 +1122,32 @@ declare const ALL_ROUTES: {
1090
1122
  };
1091
1123
  };
1092
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
+ };
1093
1151
  readonly resumeWorkflow: {
1094
1152
  readonly method: "post";
1095
1153
  readonly path: "/workflows/:id/executions/:executionId/resume";
@@ -1335,6 +1393,277 @@ declare const ALL_ROUTES: {
1335
1393
  * Helper to get all routes as an array
1336
1394
  */
1337
1395
  declare function getAllRoutesArray(): RouteDefinition[];
1396
+ /**
1397
+ * MCP route definitions
1398
+ */
1399
+ declare const MCP_ROUTES: {
1400
+ listServers: {
1401
+ method: "get";
1402
+ path: string;
1403
+ summary: string;
1404
+ description: string;
1405
+ tags: string[];
1406
+ operationId: string;
1407
+ responses: {
1408
+ 200: {
1409
+ description: string;
1410
+ contentType: string;
1411
+ };
1412
+ 500: {
1413
+ description: string;
1414
+ contentType: string;
1415
+ };
1416
+ };
1417
+ };
1418
+ getServer: {
1419
+ method: "get";
1420
+ path: string;
1421
+ summary: string;
1422
+ description: string;
1423
+ tags: string[];
1424
+ operationId: string;
1425
+ responses: {
1426
+ 200: {
1427
+ description: string;
1428
+ contentType: string;
1429
+ };
1430
+ 404: {
1431
+ description: string;
1432
+ contentType: string;
1433
+ };
1434
+ };
1435
+ };
1436
+ listTools: {
1437
+ method: "get";
1438
+ path: string;
1439
+ summary: string;
1440
+ description: string;
1441
+ tags: string[];
1442
+ operationId: string;
1443
+ responses: {
1444
+ 200: {
1445
+ description: string;
1446
+ contentType: string;
1447
+ };
1448
+ 404: {
1449
+ description: string;
1450
+ contentType: string;
1451
+ };
1452
+ 500: {
1453
+ description: string;
1454
+ contentType: string;
1455
+ };
1456
+ };
1457
+ };
1458
+ invokeTool: {
1459
+ method: "post";
1460
+ path: string;
1461
+ summary: string;
1462
+ description: string;
1463
+ tags: string[];
1464
+ operationId: string;
1465
+ responses: {
1466
+ 200: {
1467
+ description: string;
1468
+ contentType: string;
1469
+ };
1470
+ 404: {
1471
+ description: string;
1472
+ contentType: string;
1473
+ };
1474
+ 500: {
1475
+ description: string;
1476
+ contentType: string;
1477
+ };
1478
+ };
1479
+ };
1480
+ setLogLevel: {
1481
+ method: "post";
1482
+ path: string;
1483
+ summary: string;
1484
+ description: string;
1485
+ tags: string[];
1486
+ operationId: string;
1487
+ responses: {
1488
+ 200: {
1489
+ description: string;
1490
+ contentType: string;
1491
+ };
1492
+ 404: {
1493
+ description: string;
1494
+ contentType: string;
1495
+ };
1496
+ 500: {
1497
+ description: string;
1498
+ contentType: string;
1499
+ };
1500
+ };
1501
+ };
1502
+ listPrompts: {
1503
+ method: "get";
1504
+ path: string;
1505
+ summary: string;
1506
+ description: string;
1507
+ tags: string[];
1508
+ operationId: string;
1509
+ responses: {
1510
+ 200: {
1511
+ description: string;
1512
+ contentType: string;
1513
+ };
1514
+ 404: {
1515
+ description: string;
1516
+ contentType: string;
1517
+ };
1518
+ 500: {
1519
+ description: string;
1520
+ contentType: string;
1521
+ };
1522
+ };
1523
+ };
1524
+ getPrompt: {
1525
+ method: "get";
1526
+ path: string;
1527
+ summary: string;
1528
+ description: string;
1529
+ tags: string[];
1530
+ operationId: string;
1531
+ responses: {
1532
+ 200: {
1533
+ description: string;
1534
+ contentType: string;
1535
+ };
1536
+ 400: {
1537
+ description: string;
1538
+ contentType: string;
1539
+ };
1540
+ 404: {
1541
+ description: string;
1542
+ contentType: string;
1543
+ };
1544
+ 500: {
1545
+ description: string;
1546
+ contentType: string;
1547
+ };
1548
+ };
1549
+ };
1550
+ listResources: {
1551
+ method: "get";
1552
+ path: string;
1553
+ summary: string;
1554
+ description: string;
1555
+ tags: string[];
1556
+ operationId: string;
1557
+ responses: {
1558
+ 200: {
1559
+ description: string;
1560
+ contentType: string;
1561
+ };
1562
+ 404: {
1563
+ description: string;
1564
+ contentType: string;
1565
+ };
1566
+ 500: {
1567
+ description: string;
1568
+ contentType: string;
1569
+ };
1570
+ };
1571
+ };
1572
+ readResource: {
1573
+ method: "get";
1574
+ path: string;
1575
+ summary: string;
1576
+ description: string;
1577
+ tags: string[];
1578
+ operationId: string;
1579
+ responses: {
1580
+ 200: {
1581
+ description: string;
1582
+ contentType: string;
1583
+ };
1584
+ 400: {
1585
+ description: string;
1586
+ contentType: string;
1587
+ };
1588
+ 404: {
1589
+ description: string;
1590
+ contentType: string;
1591
+ };
1592
+ 500: {
1593
+ description: string;
1594
+ contentType: string;
1595
+ };
1596
+ };
1597
+ };
1598
+ listResourceTemplates: {
1599
+ method: "get";
1600
+ path: string;
1601
+ summary: string;
1602
+ description: string;
1603
+ tags: string[];
1604
+ operationId: string;
1605
+ responses: {
1606
+ 200: {
1607
+ description: string;
1608
+ contentType: string;
1609
+ };
1610
+ 404: {
1611
+ description: string;
1612
+ contentType: string;
1613
+ };
1614
+ 500: {
1615
+ description: string;
1616
+ contentType: string;
1617
+ };
1618
+ };
1619
+ };
1620
+ };
1621
+ declare const A2A_ROUTES: {
1622
+ agentCard: {
1623
+ method: "get";
1624
+ path: string;
1625
+ summary: string;
1626
+ description: string;
1627
+ tags: string[];
1628
+ operationId: string;
1629
+ responses: {
1630
+ 200: {
1631
+ description: string;
1632
+ contentType: string;
1633
+ };
1634
+ 404: {
1635
+ description: string;
1636
+ contentType: string;
1637
+ };
1638
+ 400: {
1639
+ description: string;
1640
+ contentType: string;
1641
+ };
1642
+ };
1643
+ };
1644
+ jsonRpc: {
1645
+ method: "post";
1646
+ path: string;
1647
+ summary: string;
1648
+ description: string;
1649
+ tags: string[];
1650
+ operationId: string;
1651
+ responses: {
1652
+ 200: {
1653
+ description: string;
1654
+ contentType: string;
1655
+ };
1656
+ 400: {
1657
+ description: string;
1658
+ contentType: string;
1659
+ };
1660
+ 404: {
1661
+ description: string;
1662
+ contentType: string;
1663
+ };
1664
+ };
1665
+ };
1666
+ };
1338
1667
  /**
1339
1668
  * Helper to get routes by tag
1340
1669
  */
@@ -2190,14 +2519,14 @@ declare const WorkflowStreamEventSchema: z.ZodObject<{
2190
2519
  from: z.ZodString;
2191
2520
  input: z.ZodOptional<z.ZodAny>;
2192
2521
  output: z.ZodOptional<z.ZodAny>;
2193
- status: z.ZodEnum<["pending", "running", "success", "error", "suspended"]>;
2522
+ status: z.ZodEnum<["pending", "running", "success", "error", "suspended", "cancelled"]>;
2194
2523
  timestamp: z.ZodString;
2195
2524
  stepIndex: z.ZodOptional<z.ZodNumber>;
2196
2525
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2197
2526
  error: z.ZodOptional<z.ZodAny>;
2198
2527
  }, "strip", z.ZodTypeAny, {
2199
2528
  type: string;
2200
- status: "success" | "error" | "running" | "pending" | "suspended";
2529
+ status: "success" | "error" | "running" | "pending" | "suspended" | "cancelled";
2201
2530
  executionId: string;
2202
2531
  timestamp: string;
2203
2532
  from: string;
@@ -2208,7 +2537,7 @@ declare const WorkflowStreamEventSchema: z.ZodObject<{
2208
2537
  metadata?: Record<string, any> | undefined;
2209
2538
  }, {
2210
2539
  type: string;
2211
- status: "success" | "error" | "running" | "pending" | "suspended";
2540
+ status: "success" | "error" | "running" | "pending" | "suspended" | "cancelled";
2212
2541
  executionId: string;
2213
2542
  timestamp: string;
2214
2543
  from: string;
@@ -2276,6 +2605,48 @@ declare const WorkflowSuspendResponseSchema: z.ZodObject<{
2276
2605
  };
2277
2606
  };
2278
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
+ }>;
2279
2650
  declare const WorkflowResumeRequestSchema: z.ZodOptional<z.ZodObject<{
2280
2651
  resumeData: z.ZodOptional<z.ZodAny>;
2281
2652
  options: z.ZodOptional<z.ZodObject<{
@@ -2337,6 +2708,277 @@ declare const WorkflowResumeResponseSchema: z.ZodObject<{
2337
2708
  };
2338
2709
  }>;
2339
2710
 
2711
+ declare const DEFAULT_MCP_ROUTE_PREFIX: "/mcp";
2712
+ declare const DEFAULT_MCP_SSE_SEGMENT: "sse";
2713
+ declare const DEFAULT_MCP_MESSAGES_SEGMENT: "messages";
2714
+ declare const DEFAULT_MCP_HTTP_SEGMENT: "mcp";
2715
+ declare const MCP_SESSION_QUERY_PARAM: "sessionId";
2716
+
2717
+ interface McpRouteOptions {
2718
+ basePath?: string;
2719
+ httpSegment?: string;
2720
+ sseSegment?: string;
2721
+ messageSegment?: string;
2722
+ }
2723
+ interface McpRoutePaths {
2724
+ basePath: string;
2725
+ httpPath: string;
2726
+ ssePath: string;
2727
+ messagePath: string;
2728
+ }
2729
+ declare function buildMcpRoutePaths(serverId: string, options?: McpRouteOptions): McpRoutePaths;
2730
+
2731
+ interface FilterContext {
2732
+ transport: "stdio" | "sse" | "http";
2733
+ sessionId?: string;
2734
+ userRole?: string;
2735
+ metadata?: Record<string, unknown>;
2736
+ }
2737
+ interface MCPAgentMetadata {
2738
+ id: string;
2739
+ name: string;
2740
+ description?: string;
2741
+ purpose?: string;
2742
+ instructions?: string;
2743
+ }
2744
+ interface MCPToolMetadata {
2745
+ id?: string;
2746
+ name: string;
2747
+ description?: string;
2748
+ }
2749
+ interface MCPWorkflowSummary {
2750
+ id: string;
2751
+ name: string;
2752
+ purpose?: string;
2753
+ metadata?: Record<string, unknown>;
2754
+ }
2755
+ interface MCPServerPackageInfo {
2756
+ name: string;
2757
+ version: string;
2758
+ description?: string;
2759
+ installCommand?: string[];
2760
+ homepage?: string;
2761
+ }
2762
+ interface MCPServerRemoteInfo {
2763
+ environment: string;
2764
+ url: string;
2765
+ headers?: Record<string, string>;
2766
+ description?: string;
2767
+ }
2768
+ interface ProtocolConfig {
2769
+ stdio?: boolean;
2770
+ sse?: boolean;
2771
+ http?: boolean;
2772
+ [key: string]: unknown;
2773
+ }
2774
+ type ProtocolRecord = ProtocolConfig & Record<string, unknown>;
2775
+ interface MCPServerCapabilitiesConfig {
2776
+ logging?: boolean;
2777
+ prompts?: boolean;
2778
+ resources?: boolean;
2779
+ elicitation?: boolean;
2780
+ [key: string]: unknown;
2781
+ }
2782
+ type CapabilityRecord = MCPServerCapabilitiesConfig & Record<string, unknown>;
2783
+ interface MCPServerMetadata extends MCPServerMetadata$1 {
2784
+ protocols?: ProtocolRecord;
2785
+ capabilities?: CapabilityRecord;
2786
+ agents?: MCPAgentMetadata[];
2787
+ workflows?: MCPWorkflowSummary[];
2788
+ tools?: MCPToolMetadata[];
2789
+ releaseDate?: string;
2790
+ packages?: MCPServerPackageInfo[];
2791
+ remotes?: MCPServerRemoteInfo[];
2792
+ }
2793
+ type MCPToolOrigin = "tool" | "agent" | "workflow";
2794
+ interface MCPListedTool {
2795
+ name: string;
2796
+ type: MCPToolOrigin;
2797
+ definition: Tool;
2798
+ }
2799
+ interface MCPServerLike extends MCPServerLike$1 {
2800
+ initialize(deps: MCPServerDeps): void;
2801
+ listTools?(contextOverrides?: Partial<Omit<FilterContext, "transport">>): MCPListedTool[];
2802
+ executeTool?(name: string, args: unknown, contextOverrides?: Partial<Omit<FilterContext, "transport">>): Promise<CallToolResult>;
2803
+ setLogLevel?(level: string): Promise<void> | void;
2804
+ listPrompts?(): Promise<Prompt[]>;
2805
+ getPrompt?(params: GetPromptRequest["params"]): Promise<GetPromptResult>;
2806
+ listResources?(): Promise<Resource[]>;
2807
+ readResource?(uri: string): Promise<ResourceContents | ResourceContents[]>;
2808
+ listResourceTemplates?(): Promise<ResourceTemplate[]>;
2809
+ }
2810
+
2811
+ interface McpServerLookupResult {
2812
+ server?: MCPServerLike;
2813
+ metadata?: MCPServerMetadata;
2814
+ }
2815
+ declare function listMcpServers(registry: MCPServerRegistry): MCPServerMetadata[];
2816
+ declare function lookupMcpServer(registry: MCPServerRegistry, serverId: string): McpServerLookupResult;
2817
+
2818
+ declare class McpSessionStore<T> {
2819
+ private readonly sessions;
2820
+ set(sessionId: string, value: T): void;
2821
+ get(sessionId: string): T | undefined;
2822
+ delete(sessionId: string): void;
2823
+ has(sessionId: string): boolean;
2824
+ ids(): string[];
2825
+ values(): T[];
2826
+ clear(): void;
2827
+ }
2828
+
2829
+ interface McpServerListResponse {
2830
+ servers: MCPServerMetadata[];
2831
+ }
2832
+ interface McpServerDetailResponse extends MCPServerMetadata {
2833
+ }
2834
+ interface McpToolListResponse {
2835
+ server: MCPServerMetadata;
2836
+ tools: MCPListedTool[];
2837
+ }
2838
+ interface McpInvokeToolRequest {
2839
+ arguments?: unknown;
2840
+ context?: Partial<Omit<FilterContext, "transport">>;
2841
+ }
2842
+ type McpInvokeToolResponse = CallToolResult;
2843
+ interface McpSetLogLevelRequest {
2844
+ level: string;
2845
+ }
2846
+ type McpSetLogLevelResponse = {
2847
+ success: true;
2848
+ };
2849
+ interface McpPromptListResponse {
2850
+ prompts: Prompt[];
2851
+ }
2852
+ type McpPromptDetailResponse = GetPromptResult;
2853
+ interface McpResourceListResponse {
2854
+ resources: Resource[];
2855
+ }
2856
+ type McpResourceDetailResponse = ResourceContents | ResourceContents[];
2857
+ interface McpResourceTemplateListResponse {
2858
+ resourceTemplates: ResourceTemplate[];
2859
+ }
2860
+ declare function handleListMcpServers(registry: MCPServerRegistry): ApiResponse<McpServerListResponse>;
2861
+ declare function handleGetMcpServer(registry: MCPServerRegistry, serverId: string): ApiResponse<McpServerDetailResponse>;
2862
+ declare function handleListMcpServerTools(registry: MCPServerRegistry, logger: Logger, serverId: string): ApiResponse<McpToolListResponse>;
2863
+ declare function handleInvokeMcpServerTool(registry: MCPServerRegistry, logger: Logger, serverId: string, toolName: string, request: McpInvokeToolRequest): Promise<ApiResponse<McpInvokeToolResponse>>;
2864
+ declare function handleSetMcpLogLevel(registry: MCPServerRegistry, logger: Logger, serverId: string, request: McpSetLogLevelRequest): Promise<ApiResponse<McpSetLogLevelResponse>>;
2865
+ declare function handleListMcpPrompts(registry: MCPServerRegistry, logger: Logger, serverId: string): Promise<ApiResponse<McpPromptListResponse>>;
2866
+ declare function handleGetMcpPrompt(registry: MCPServerRegistry, logger: Logger, serverId: string, params: GetPromptRequest["params"]): Promise<ApiResponse<McpPromptDetailResponse>>;
2867
+ declare function handleListMcpResources(registry: MCPServerRegistry, logger: Logger, serverId: string): Promise<ApiResponse<McpResourceListResponse>>;
2868
+ declare function handleGetMcpResource(registry: MCPServerRegistry, logger: Logger, serverId: string, uri: string): Promise<ApiResponse<McpResourceDetailResponse>>;
2869
+ declare function handleListMcpResourceTemplates(registry: MCPServerRegistry, logger: Logger, serverId: string): Promise<ApiResponse<McpResourceTemplateListResponse>>;
2870
+
2871
+ type A2AJsonRpcId = string | number | null;
2872
+ interface JsonRpcError<Data = unknown> {
2873
+ code: number;
2874
+ message: string;
2875
+ data?: Data;
2876
+ }
2877
+ interface JsonRpcResponse<Result = unknown, ErrorData = unknown> {
2878
+ jsonrpc: "2.0";
2879
+ id: A2AJsonRpcId;
2880
+ result?: Result;
2881
+ error?: JsonRpcError<ErrorData> | null;
2882
+ }
2883
+ interface JsonRpcStream<Result = unknown, ErrorData = unknown> {
2884
+ kind: "stream";
2885
+ id: A2AJsonRpcId;
2886
+ stream: AsyncGenerator<JsonRpcResponse<Result, ErrorData>>;
2887
+ }
2888
+ type JsonRpcHandlerResult<Result = unknown, ErrorData = unknown> = JsonRpcResponse<Result, ErrorData> | JsonRpcStream<Result, ErrorData>;
2889
+ interface JsonRpcRequest<Params = unknown> {
2890
+ jsonrpc: "2.0";
2891
+ id: A2AJsonRpcId;
2892
+ method: string;
2893
+ params?: Params;
2894
+ }
2895
+ interface A2ARequestContext {
2896
+ userId?: string;
2897
+ sessionId?: string;
2898
+ metadata?: Record<string, unknown>;
2899
+ }
2900
+ interface AgentCardSkill {
2901
+ id: string;
2902
+ name: string;
2903
+ description?: string;
2904
+ tags?: string[];
2905
+ }
2906
+ interface AgentCardProviderInfo {
2907
+ organization?: string;
2908
+ url?: string;
2909
+ }
2910
+ interface AgentCardCapabilities {
2911
+ streaming: boolean;
2912
+ pushNotifications: boolean;
2913
+ stateTransitionHistory: boolean;
2914
+ }
2915
+ interface AgentCard {
2916
+ name: string;
2917
+ description?: string;
2918
+ url: string;
2919
+ provider?: AgentCardProviderInfo;
2920
+ version: string;
2921
+ capabilities: AgentCardCapabilities;
2922
+ defaultInputModes: string[];
2923
+ defaultOutputModes: string[];
2924
+ skills: AgentCardSkill[];
2925
+ }
2926
+ interface A2AServerLikeWithHandlers extends A2AServerLike {
2927
+ getAgentCard?(agentId: string, context?: A2ARequestContext): AgentCard;
2928
+ handleRequest?(agentId: string, request: JsonRpcRequest, context?: A2ARequestContext): Promise<JsonRpcHandlerResult>;
2929
+ }
2930
+ declare const A2AErrorCode: {
2931
+ readonly PARSE_ERROR: -32700;
2932
+ readonly INVALID_REQUEST: -32600;
2933
+ readonly METHOD_NOT_FOUND: -32601;
2934
+ readonly INVALID_PARAMS: -32602;
2935
+ readonly INTERNAL_ERROR: -32603;
2936
+ readonly TASK_NOT_FOUND: -32001;
2937
+ readonly TASK_NOT_CANCELABLE: -32002;
2938
+ readonly PUSH_NOTIFICATION_UNSUPPORTED: -32003;
2939
+ readonly UNSUPPORTED_OPERATION: -32004;
2940
+ };
2941
+ type A2AErrorCode = (typeof A2AErrorCode)[keyof typeof A2AErrorCode];
2942
+ declare class VoltA2AError extends Error {
2943
+ code: A2AErrorCode;
2944
+ data?: unknown | undefined;
2945
+ taskId?: string | undefined;
2946
+ constructor(code: A2AErrorCode, message: string, data?: unknown | undefined, taskId?: string | undefined);
2947
+ toJsonRpcError(): JsonRpcError;
2948
+ static parseError(details?: unknown): VoltA2AError;
2949
+ static invalidRequest(message?: string, details?: unknown): VoltA2AError;
2950
+ static methodNotFound(method: string): VoltA2AError;
2951
+ static invalidParams(message?: string, details?: unknown): VoltA2AError;
2952
+ static taskNotFound(taskId: string): VoltA2AError;
2953
+ static taskNotCancelable(taskId: string): VoltA2AError;
2954
+ static unsupportedOperation(message?: string): VoltA2AError;
2955
+ static internal(message?: string, details?: unknown): VoltA2AError;
2956
+ }
2957
+ declare function normalizeError(id: A2AJsonRpcId, cause: unknown): JsonRpcResponse<never>;
2958
+ declare function isJsonRpcRequest(value: unknown): value is JsonRpcRequest;
2959
+
2960
+ interface A2AServerLookupResult {
2961
+ server?: A2AServerLikeWithHandlers;
2962
+ metadata?: A2AServerMetadata;
2963
+ }
2964
+ declare function listA2AServers(registry: A2AServerRegistry<A2AServerLikeWithHandlers>): A2AServerMetadata[];
2965
+ declare function lookupA2AServer(registry: A2AServerRegistry<A2AServerLikeWithHandlers>, serverId: string): A2AServerLookupResult;
2966
+
2967
+ declare const DEFAULT_A2A_ROUTE_PREFIX: "/a2a";
2968
+ declare const DEFAULT_A2A_WELL_KNOWN_PREFIX: "/.well-known";
2969
+ declare function buildAgentCardPath(agentId: string): string;
2970
+ declare function buildA2AEndpointPath(serverId: string): string;
2971
+
2972
+ declare function parseJsonRpcRequest(payload: unknown): JsonRpcRequest;
2973
+ declare function resolveAgentCard(registry: A2AServerRegistry<A2AServerLikeWithHandlers>, serverId: string, agentId: string, context?: A2ARequestContext): AgentCard;
2974
+ declare function executeA2ARequest(params: {
2975
+ registry: A2AServerRegistry<A2AServerLikeWithHandlers>;
2976
+ serverId: string;
2977
+ request: JsonRpcRequest;
2978
+ context?: A2ARequestContext;
2979
+ logger?: Logger;
2980
+ }): Promise<JsonRpcHandlerResult>;
2981
+
2340
2982
  /**
2341
2983
  * Handler for listing all agents
2342
2984
  * Returns agent data array
@@ -2404,6 +3046,11 @@ declare function handleStreamWorkflow(workflowId: string, body: any, deps: Serve
2404
3046
  * Returns suspension result
2405
3047
  */
2406
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>;
2407
3054
  /**
2408
3055
  * Handler for resuming a workflow
2409
3056
  * Returns resume result
@@ -2773,6 +3420,7 @@ declare const portManager: PortManager;
2773
3420
  /**
2774
3421
  * Shared server utilities for all server implementations
2775
3422
  */
3423
+
2776
3424
  declare const colors: {
2777
3425
  reset: string;
2778
3426
  bright: string;
@@ -2805,13 +3453,7 @@ declare const preferredPorts: {
2805
3453
  /**
2806
3454
  * Print server startup message with formatted console output
2807
3455
  */
2808
- declare function printServerStartup(port: number, options?: {
2809
- enableSwaggerUI?: boolean;
2810
- customEndpoints?: Array<{
2811
- path: string;
2812
- method: string;
2813
- }>;
2814
- }): void;
3456
+ declare function printServerStartup(port: number, options?: ServerStartupOptions): void;
2815
3457
  /**
2816
3458
  * Get all ports to try in order
2817
3459
  */
@@ -3106,6 +3748,7 @@ declare abstract class BaseServerProvider implements IServerProvider {
3106
3748
  * Handle graceful shutdown
3107
3749
  */
3108
3750
  protected setupGracefulShutdown(): void;
3751
+ private collectFeatureEndpoints;
3109
3752
  }
3110
3753
 
3111
3754
  /**
@@ -3184,4 +3827,4 @@ declare const DEFAULT_CORS_OPTIONS: {
3184
3827
  credentials: boolean;
3185
3828
  };
3186
3829
 
3187
- export { AGENT_ROUTES, ALL_ROUTES, AgentListSchema, AgentParamsSchema, AgentResponseSchema, type ApiResponse, type AppSetupConfig, type AuthFrameworkAdapter, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, CustomEndpointError, type CustomEndpointHandler, DEFAULT_CORS_OPTIONS, DEFAULT_PUBLIC_ROUTES, type ErrorResponse, ErrorSchema, GenerateOptionsSchema, type HttpMethod, type IWebSocket, type JWTAuthOptions, LOG_ROUTES, type LogFilterOptions, type LogHandlerResponse, type LogStreamClient, LogStreamManager, OBSERVABILITY_ROUTES, ObjectRequestSchema, ObjectResponseSchema, type OpenApiInfo, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ResponseDefinition, type RouteDefinition, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, type StreamResponse, StreamTextEventSchema, SubAgentResponseSchema, type SuccessResponse, TextRequestSchema, TextResponseSchema, UPDATE_ROUTES, WORKFLOW_ROUTES, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, cleanupWebSockets, closeAllObservabilityConnections, colors, createAuthErrorResponse, createAuthMiddlewareFactory, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createUserContext, createWebSocketRouter, createWebSocketServer, 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, handleGetWorkflow, handleGetWorkflowState, handleGetWorkflows, handleInstallUpdates, handleObservabilityConnection, handleResumeWorkflow, handleStreamObject, handleStreamText, handleStreamWorkflow, handleSuspendWorkflow, handleWebSocketConnection, injectUserIntoBody, isErrorResponse, isSuccessResponse, jwtAuth, mapHandlerResponse, mapLogResponse, pathMatches, portManager, preferredPorts, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, 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 };