@multi-agent-protocol/sdk 0.0.4 → 0.0.5

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.
@@ -1,3 +1,5 @@
1
+ import { EventEmitter } from 'events';
2
+
1
3
  /**
2
4
  * Multi-Agent Protocol (MAP) Type Definitions - v2
3
5
  *
@@ -94,6 +96,29 @@ interface ParticipantCapabilities {
94
96
  };
95
97
  /** Streaming/backpressure capabilities */
96
98
  streaming?: StreamingCapabilities;
99
+ /**
100
+ * Protocols supported by this participant.
101
+ * Used for protocol capability discovery.
102
+ *
103
+ * @example ['acp', 'mcp']
104
+ */
105
+ protocols?: string[];
106
+ /**
107
+ * ACP (Agent Client Protocol) capability details.
108
+ * Only present if 'acp' is in the protocols array.
109
+ */
110
+ acp?: ACPCapability;
111
+ _meta?: Meta;
112
+ }
113
+ /**
114
+ * ACP capability advertisement.
115
+ * Describes what ACP features an agent supports.
116
+ */
117
+ interface ACPCapability {
118
+ /** ACP protocol version supported (e.g., '2024-10-07') */
119
+ version: string;
120
+ /** ACP features supported by this agent */
121
+ features?: string[];
97
122
  _meta?: Meta;
98
123
  }
99
124
  /** A participant in the MAP protocol */
@@ -408,6 +433,11 @@ interface MessageMeta {
408
433
  priority?: MessagePriority;
409
434
  delivery?: DeliverySemantics;
410
435
  ttlMs?: number;
436
+ /**
437
+ * Protocol identifier for tunneled protocols (e.g., 'acp').
438
+ * Used to identify the protocol of the payload.
439
+ */
440
+ protocol?: string;
411
441
  _meta?: Meta;
412
442
  }
413
443
  /** A message in the multi-agent system */
@@ -2121,6 +2151,1156 @@ declare class BaseConnection {
2121
2151
  close(): Promise<void>;
2122
2152
  }
2123
2153
 
2154
+ /**
2155
+ * ACP (Agent Client Protocol) types for ACP-over-MAP tunneling.
2156
+ *
2157
+ * These types are bundled directly in the MAP SDK for simplicity,
2158
+ * enabling ACP semantics to be preserved when routing through MAP.
2159
+ *
2160
+ * @see https://agentclientprotocol.com/
2161
+ * @module
2162
+ */
2163
+ /**
2164
+ * A unique identifier for a conversation session.
2165
+ */
2166
+ type ACPSessionId = string;
2167
+ /**
2168
+ * JSON-RPC request ID.
2169
+ */
2170
+ type ACPRequestId = string | number | null;
2171
+ /**
2172
+ * Protocol version identifier.
2173
+ */
2174
+ type ACPProtocolVersion = number;
2175
+ /**
2176
+ * Unique identifier for a tool call within a session.
2177
+ */
2178
+ type ACPToolCallId = string;
2179
+ /**
2180
+ * Unique identifier for a permission option.
2181
+ */
2182
+ type ACPPermissionOptionId = string;
2183
+ /**
2184
+ * Unique identifier for a session mode.
2185
+ */
2186
+ type ACPSessionModeId = string;
2187
+ /**
2188
+ * ACP JSON-RPC request structure.
2189
+ */
2190
+ interface ACPRequest<TParams = unknown> {
2191
+ jsonrpc: "2.0";
2192
+ id: ACPRequestId;
2193
+ method: string;
2194
+ params?: TParams;
2195
+ }
2196
+ /**
2197
+ * ACP JSON-RPC notification structure (no response expected).
2198
+ */
2199
+ interface ACPNotification<TParams = unknown> {
2200
+ jsonrpc: "2.0";
2201
+ method: string;
2202
+ params?: TParams;
2203
+ }
2204
+ /**
2205
+ * ACP JSON-RPC success response structure.
2206
+ */
2207
+ interface ACPSuccessResponse<TResult = unknown> {
2208
+ jsonrpc: "2.0";
2209
+ id: ACPRequestId;
2210
+ result: TResult;
2211
+ }
2212
+ /**
2213
+ * ACP JSON-RPC error object.
2214
+ */
2215
+ interface ACPErrorObject {
2216
+ code: ACPErrorCode;
2217
+ message: string;
2218
+ data?: unknown;
2219
+ }
2220
+ /**
2221
+ * ACP JSON-RPC error response structure.
2222
+ */
2223
+ interface ACPErrorResponse {
2224
+ jsonrpc: "2.0";
2225
+ id: ACPRequestId;
2226
+ error: ACPErrorObject;
2227
+ }
2228
+ /**
2229
+ * Union of all ACP JSON-RPC response types.
2230
+ */
2231
+ type ACPResponse<TResult = unknown> = ACPSuccessResponse<TResult> | ACPErrorResponse;
2232
+ /**
2233
+ * Union of all ACP JSON-RPC message types.
2234
+ */
2235
+ type ACPMessage = ACPRequest | ACPNotification | ACPSuccessResponse | ACPErrorResponse;
2236
+ /**
2237
+ * Predefined ACP error codes following JSON-RPC specification.
2238
+ */
2239
+ type ACPErrorCode = -32700 | -32600 | -32601 | -32602 | -32603 | -32800 | -32000 | -32002 | number;
2240
+ /**
2241
+ * Standard ACP error codes with semantic names.
2242
+ */
2243
+ declare const ACP_ERROR_CODES: {
2244
+ readonly PARSE_ERROR: -32700;
2245
+ readonly INVALID_REQUEST: -32600;
2246
+ readonly METHOD_NOT_FOUND: -32601;
2247
+ readonly INVALID_PARAMS: -32602;
2248
+ readonly INTERNAL_ERROR: -32603;
2249
+ readonly REQUEST_CANCELLED: -32800;
2250
+ readonly AUTH_REQUIRED: -32000;
2251
+ readonly SESSION_NOT_FOUND: -32002;
2252
+ };
2253
+ /**
2254
+ * Error class for ACP protocol errors.
2255
+ * Preserves the original ACP error code and data.
2256
+ */
2257
+ declare class ACPError extends Error {
2258
+ readonly code: ACPErrorCode;
2259
+ readonly data?: unknown;
2260
+ constructor(code: ACPErrorCode, message: string, data?: unknown);
2261
+ /**
2262
+ * Create an ACPError from an error response.
2263
+ */
2264
+ static fromResponse(error: ACPErrorObject): ACPError;
2265
+ /**
2266
+ * Convert to JSON-RPC error object.
2267
+ */
2268
+ toErrorObject(): ACPErrorObject;
2269
+ }
2270
+ /**
2271
+ * The _meta property for ACP extensibility.
2272
+ */
2273
+ type ACPMeta = {
2274
+ [key: string]: unknown;
2275
+ } | null;
2276
+ /**
2277
+ * Metadata about the implementation of a client or agent.
2278
+ */
2279
+ interface ACPImplementation {
2280
+ _meta?: ACPMeta;
2281
+ /** Programmatic name of the implementation. */
2282
+ name: string;
2283
+ /** Human-readable title for display. */
2284
+ title?: string | null;
2285
+ /** Version string (e.g., "1.0.0"). */
2286
+ version: string;
2287
+ }
2288
+ /**
2289
+ * File system capabilities supported by the client.
2290
+ */
2291
+ interface ACPFileSystemCapability {
2292
+ _meta?: ACPMeta;
2293
+ /** Whether the client supports fs/read_text_file. */
2294
+ readTextFile?: boolean;
2295
+ /** Whether the client supports fs/write_text_file. */
2296
+ writeTextFile?: boolean;
2297
+ }
2298
+ /**
2299
+ * Capabilities supported by the client.
2300
+ */
2301
+ interface ACPClientCapabilities {
2302
+ _meta?: ACPMeta;
2303
+ /** File system capabilities. */
2304
+ fs?: ACPFileSystemCapability;
2305
+ /** Whether the client supports terminal methods. */
2306
+ terminal?: boolean;
2307
+ }
2308
+ /**
2309
+ * Prompt capabilities supported by the agent.
2310
+ */
2311
+ interface ACPPromptCapabilities {
2312
+ _meta?: ACPMeta;
2313
+ /** Agent supports audio content. */
2314
+ audio?: boolean;
2315
+ /** Agent supports embedded resource context. */
2316
+ embeddedContext?: boolean;
2317
+ /** Agent supports image content. */
2318
+ image?: boolean;
2319
+ }
2320
+ /**
2321
+ * MCP capabilities supported by the agent.
2322
+ */
2323
+ interface ACPMcpCapabilities {
2324
+ _meta?: ACPMeta;
2325
+ /** Agent supports HTTP MCP servers. */
2326
+ http?: boolean;
2327
+ /** Agent supports SSE MCP servers. */
2328
+ sse?: boolean;
2329
+ }
2330
+ /**
2331
+ * Session capabilities supported by the agent.
2332
+ */
2333
+ interface ACPSessionCapabilities {
2334
+ _meta?: ACPMeta;
2335
+ /** Whether the agent supports session/fork. */
2336
+ fork?: {
2337
+ _meta?: ACPMeta;
2338
+ } | null;
2339
+ /** Whether the agent supports session/list. */
2340
+ list?: {
2341
+ _meta?: ACPMeta;
2342
+ } | null;
2343
+ /** Whether the agent supports session/resume. */
2344
+ resume?: {
2345
+ _meta?: ACPMeta;
2346
+ } | null;
2347
+ }
2348
+ /**
2349
+ * Capabilities supported by the agent.
2350
+ */
2351
+ interface ACPAgentCapabilities {
2352
+ _meta?: ACPMeta;
2353
+ /** Whether the agent supports session/load. */
2354
+ loadSession?: boolean;
2355
+ /** MCP capabilities. */
2356
+ mcpCapabilities?: ACPMcpCapabilities;
2357
+ /** Prompt capabilities. */
2358
+ promptCapabilities?: ACPPromptCapabilities;
2359
+ /** Session capabilities. */
2360
+ sessionCapabilities?: ACPSessionCapabilities;
2361
+ }
2362
+ /**
2363
+ * Describes an available authentication method.
2364
+ */
2365
+ interface ACPAuthMethod {
2366
+ _meta?: ACPMeta;
2367
+ /** Unique identifier for this auth method. */
2368
+ id: string;
2369
+ /** Human-readable name. */
2370
+ name: string;
2371
+ /** Optional description. */
2372
+ description?: string | null;
2373
+ }
2374
+ /**
2375
+ * Request parameters for the initialize method.
2376
+ */
2377
+ interface ACPInitializeRequest {
2378
+ _meta?: ACPMeta;
2379
+ /** The latest protocol version supported by the client. */
2380
+ protocolVersion: ACPProtocolVersion;
2381
+ /** Information about the client implementation. */
2382
+ clientInfo?: ACPImplementation | null;
2383
+ /** Capabilities supported by the client. */
2384
+ clientCapabilities?: ACPClientCapabilities;
2385
+ }
2386
+ /**
2387
+ * Response to the initialize method.
2388
+ */
2389
+ interface ACPInitializeResponse {
2390
+ _meta?: ACPMeta;
2391
+ /** The negotiated protocol version. */
2392
+ protocolVersion: ACPProtocolVersion;
2393
+ /** Information about the agent implementation. */
2394
+ agentInfo?: ACPImplementation | null;
2395
+ /** Capabilities supported by the agent. */
2396
+ agentCapabilities?: ACPAgentCapabilities;
2397
+ /** Available authentication methods. */
2398
+ authMethods?: ACPAuthMethod[];
2399
+ }
2400
+ /**
2401
+ * Request parameters for the authenticate method.
2402
+ */
2403
+ interface ACPAuthenticateRequest {
2404
+ _meta?: ACPMeta;
2405
+ /** The ID of the authentication method to use. */
2406
+ methodId: string;
2407
+ }
2408
+ /**
2409
+ * Response to the authenticate method.
2410
+ */
2411
+ interface ACPAuthenticateResponse {
2412
+ _meta?: ACPMeta;
2413
+ }
2414
+ /**
2415
+ * Environment variable for MCP server configuration.
2416
+ */
2417
+ interface ACPEnvVariable {
2418
+ _meta?: ACPMeta;
2419
+ name: string;
2420
+ value: string;
2421
+ }
2422
+ /**
2423
+ * HTTP header for MCP server configuration.
2424
+ */
2425
+ interface ACPHttpHeader {
2426
+ _meta?: ACPMeta;
2427
+ name: string;
2428
+ value: string;
2429
+ }
2430
+ /**
2431
+ * Stdio transport configuration for MCP.
2432
+ */
2433
+ interface ACPMcpServerStdio {
2434
+ _meta?: ACPMeta;
2435
+ name: string;
2436
+ command: string;
2437
+ args: string[];
2438
+ env: ACPEnvVariable[];
2439
+ }
2440
+ /**
2441
+ * HTTP transport configuration for MCP.
2442
+ */
2443
+ interface ACPMcpServerHttp {
2444
+ _meta?: ACPMeta;
2445
+ type: "http";
2446
+ name: string;
2447
+ url: string;
2448
+ headers: ACPHttpHeader[];
2449
+ }
2450
+ /**
2451
+ * SSE transport configuration for MCP.
2452
+ */
2453
+ interface ACPMcpServerSse {
2454
+ _meta?: ACPMeta;
2455
+ type: "sse";
2456
+ name: string;
2457
+ url: string;
2458
+ headers: ACPHttpHeader[];
2459
+ }
2460
+ /**
2461
+ * MCP server configuration (union of all transport types).
2462
+ */
2463
+ type ACPMcpServer = ACPMcpServerStdio | ACPMcpServerHttp | ACPMcpServerSse;
2464
+ /**
2465
+ * A mode the agent can operate in.
2466
+ */
2467
+ interface ACPSessionMode {
2468
+ _meta?: ACPMeta;
2469
+ id: ACPSessionModeId;
2470
+ name: string;
2471
+ description?: string | null;
2472
+ }
2473
+ /**
2474
+ * The set of modes and the currently active one.
2475
+ */
2476
+ interface ACPSessionModeState {
2477
+ _meta?: ACPMeta;
2478
+ availableModes: ACPSessionMode[];
2479
+ currentModeId: ACPSessionModeId;
2480
+ }
2481
+ /**
2482
+ * Request parameters for creating a new session.
2483
+ */
2484
+ interface ACPNewSessionRequest {
2485
+ _meta?: ACPMeta;
2486
+ /** The working directory for this session. */
2487
+ cwd: string;
2488
+ /** List of MCP servers to connect to. */
2489
+ mcpServers: ACPMcpServer[];
2490
+ }
2491
+ /**
2492
+ * Response from creating a new session.
2493
+ */
2494
+ interface ACPNewSessionResponse {
2495
+ _meta?: ACPMeta;
2496
+ /** Unique identifier for the created session. */
2497
+ sessionId: ACPSessionId;
2498
+ /** Initial mode state if supported. */
2499
+ modes?: ACPSessionModeState | null;
2500
+ }
2501
+ /**
2502
+ * Request parameters for loading an existing session.
2503
+ */
2504
+ interface ACPLoadSessionRequest {
2505
+ _meta?: ACPMeta;
2506
+ /** The ID of the session to load. */
2507
+ sessionId: ACPSessionId;
2508
+ /** The working directory for this session. */
2509
+ cwd: string;
2510
+ /** List of MCP servers to connect to. */
2511
+ mcpServers: ACPMcpServer[];
2512
+ }
2513
+ /**
2514
+ * Response from loading an existing session.
2515
+ */
2516
+ interface ACPLoadSessionResponse {
2517
+ _meta?: ACPMeta;
2518
+ /** Mode state if supported. */
2519
+ modes?: ACPSessionModeState | null;
2520
+ }
2521
+ /**
2522
+ * Request parameters for setting a session mode.
2523
+ */
2524
+ interface ACPSetSessionModeRequest {
2525
+ _meta?: ACPMeta;
2526
+ /** The ID of the session. */
2527
+ sessionId: ACPSessionId;
2528
+ /** The ID of the mode to set. */
2529
+ modeId: ACPSessionModeId;
2530
+ }
2531
+ /**
2532
+ * Response to session/set_mode method.
2533
+ */
2534
+ interface ACPSetSessionModeResponse {
2535
+ _meta?: ACPMeta;
2536
+ }
2537
+ /**
2538
+ * Optional annotations for content.
2539
+ */
2540
+ interface ACPAnnotations {
2541
+ _meta?: ACPMeta;
2542
+ audience?: ACPRole[] | null;
2543
+ lastModified?: string | null;
2544
+ priority?: number | null;
2545
+ }
2546
+ /**
2547
+ * Role in a conversation.
2548
+ */
2549
+ type ACPRole = "assistant" | "user";
2550
+ /**
2551
+ * Text content block.
2552
+ */
2553
+ interface ACPTextContent {
2554
+ _meta?: ACPMeta;
2555
+ type: "text";
2556
+ text: string;
2557
+ annotations?: ACPAnnotations | null;
2558
+ }
2559
+ /**
2560
+ * Image content block.
2561
+ */
2562
+ interface ACPImageContent {
2563
+ _meta?: ACPMeta;
2564
+ type: "image";
2565
+ data: string;
2566
+ mimeType: string;
2567
+ annotations?: ACPAnnotations | null;
2568
+ }
2569
+ /**
2570
+ * Audio content block.
2571
+ */
2572
+ interface ACPAudioContent {
2573
+ _meta?: ACPMeta;
2574
+ type: "audio";
2575
+ data: string;
2576
+ mimeType: string;
2577
+ annotations?: ACPAnnotations | null;
2578
+ }
2579
+ /**
2580
+ * Resource link content block.
2581
+ */
2582
+ interface ACPResourceLink {
2583
+ _meta?: ACPMeta;
2584
+ type: "resource_link";
2585
+ uri: string;
2586
+ name: string;
2587
+ title?: string | null;
2588
+ description?: string | null;
2589
+ mimeType?: string | null;
2590
+ size?: number | null;
2591
+ annotations?: ACPAnnotations | null;
2592
+ }
2593
+ /**
2594
+ * Text resource contents.
2595
+ */
2596
+ interface ACPTextResourceContents {
2597
+ _meta?: ACPMeta;
2598
+ uri: string;
2599
+ text: string;
2600
+ mimeType?: string | null;
2601
+ }
2602
+ /**
2603
+ * Binary resource contents.
2604
+ */
2605
+ interface ACPBlobResourceContents {
2606
+ _meta?: ACPMeta;
2607
+ uri: string;
2608
+ blob: string;
2609
+ mimeType?: string | null;
2610
+ }
2611
+ /**
2612
+ * Embedded resource content block.
2613
+ */
2614
+ interface ACPEmbeddedResource {
2615
+ _meta?: ACPMeta;
2616
+ type: "resource";
2617
+ resource: ACPTextResourceContents | ACPBlobResourceContents;
2618
+ annotations?: ACPAnnotations | null;
2619
+ }
2620
+ /**
2621
+ * Union of all content block types.
2622
+ */
2623
+ type ACPContentBlock = ACPTextContent | ACPImageContent | ACPAudioContent | ACPResourceLink | ACPEmbeddedResource;
2624
+ /**
2625
+ * Request parameters for sending a user prompt.
2626
+ */
2627
+ interface ACPPromptRequest {
2628
+ _meta?: ACPMeta;
2629
+ /** The ID of the session. */
2630
+ sessionId: ACPSessionId;
2631
+ /** The content blocks of the user's message. */
2632
+ prompt: ACPContentBlock[];
2633
+ }
2634
+ /**
2635
+ * Reasons why an agent stops processing.
2636
+ */
2637
+ type ACPStopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";
2638
+ /**
2639
+ * Response from processing a user prompt.
2640
+ */
2641
+ interface ACPPromptResponse {
2642
+ _meta?: ACPMeta;
2643
+ /** Why the agent stopped processing. */
2644
+ stopReason: ACPStopReason;
2645
+ }
2646
+ /**
2647
+ * Notification to cancel ongoing operations for a session.
2648
+ */
2649
+ interface ACPCancelNotification {
2650
+ _meta?: ACPMeta;
2651
+ /** The ID of the session to cancel operations for. */
2652
+ sessionId: ACPSessionId;
2653
+ }
2654
+ /**
2655
+ * Categories of tools.
2656
+ */
2657
+ type ACPToolKind = "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other";
2658
+ /**
2659
+ * Execution status of a tool call.
2660
+ */
2661
+ type ACPToolCallStatus = "pending" | "in_progress" | "completed" | "failed";
2662
+ /**
2663
+ * A file location being accessed by a tool.
2664
+ */
2665
+ interface ACPToolCallLocation {
2666
+ _meta?: ACPMeta;
2667
+ path: string;
2668
+ line?: number | null;
2669
+ }
2670
+ /**
2671
+ * A diff representing file modifications.
2672
+ */
2673
+ interface ACPDiff {
2674
+ _meta?: ACPMeta;
2675
+ path: string;
2676
+ oldText?: string | null;
2677
+ newText: string;
2678
+ }
2679
+ /**
2680
+ * Terminal reference.
2681
+ */
2682
+ interface ACPTerminal {
2683
+ _meta?: ACPMeta;
2684
+ terminalId: string;
2685
+ }
2686
+ /**
2687
+ * Standard content wrapper.
2688
+ */
2689
+ interface ACPContent {
2690
+ _meta?: ACPMeta;
2691
+ content: ACPContentBlock;
2692
+ }
2693
+ /**
2694
+ * Tool call content types.
2695
+ */
2696
+ type ACPToolCallContent = (ACPContent & {
2697
+ type: "content";
2698
+ }) | (ACPDiff & {
2699
+ type: "diff";
2700
+ }) | (ACPTerminal & {
2701
+ type: "terminal";
2702
+ });
2703
+ /**
2704
+ * A tool call requested by the language model.
2705
+ */
2706
+ interface ACPToolCall {
2707
+ _meta?: ACPMeta;
2708
+ toolCallId: ACPToolCallId;
2709
+ title: string;
2710
+ kind?: ACPToolKind;
2711
+ status?: ACPToolCallStatus;
2712
+ rawInput?: unknown;
2713
+ rawOutput?: unknown;
2714
+ content?: ACPToolCallContent[];
2715
+ locations?: ACPToolCallLocation[];
2716
+ }
2717
+ /**
2718
+ * An update to an existing tool call.
2719
+ */
2720
+ interface ACPToolCallUpdate {
2721
+ _meta?: ACPMeta;
2722
+ toolCallId: ACPToolCallId;
2723
+ title?: string | null;
2724
+ kind?: ACPToolKind | null;
2725
+ status?: ACPToolCallStatus | null;
2726
+ rawInput?: unknown;
2727
+ rawOutput?: unknown;
2728
+ content?: ACPToolCallContent[] | null;
2729
+ locations?: ACPToolCallLocation[] | null;
2730
+ }
2731
+ /**
2732
+ * Priority levels for plan entries.
2733
+ */
2734
+ type ACPPlanEntryPriority = "high" | "medium" | "low";
2735
+ /**
2736
+ * Status of a plan entry.
2737
+ */
2738
+ type ACPPlanEntryStatus = "pending" | "in_progress" | "completed";
2739
+ /**
2740
+ * A single entry in the execution plan.
2741
+ */
2742
+ interface ACPPlanEntry {
2743
+ _meta?: ACPMeta;
2744
+ content: string;
2745
+ priority: ACPPlanEntryPriority;
2746
+ status: ACPPlanEntryStatus;
2747
+ }
2748
+ /**
2749
+ * An execution plan.
2750
+ */
2751
+ interface ACPPlan {
2752
+ _meta?: ACPMeta;
2753
+ entries: ACPPlanEntry[];
2754
+ }
2755
+ /**
2756
+ * A streamed chunk of content.
2757
+ */
2758
+ interface ACPContentChunk {
2759
+ _meta?: ACPMeta;
2760
+ content: ACPContentBlock;
2761
+ }
2762
+ /**
2763
+ * Available command input type.
2764
+ */
2765
+ interface ACPUnstructuredCommandInput {
2766
+ _meta?: ACPMeta;
2767
+ }
2768
+ /**
2769
+ * Available command input.
2770
+ */
2771
+ type ACPAvailableCommandInput = ACPUnstructuredCommandInput;
2772
+ /**
2773
+ * Information about an available command.
2774
+ */
2775
+ interface ACPAvailableCommand {
2776
+ _meta?: ACPMeta;
2777
+ name: string;
2778
+ description: string;
2779
+ input?: ACPAvailableCommandInput | null;
2780
+ }
2781
+ /**
2782
+ * Available commands update.
2783
+ */
2784
+ interface ACPAvailableCommandsUpdate {
2785
+ _meta?: ACPMeta;
2786
+ availableCommands: ACPAvailableCommand[];
2787
+ }
2788
+ /**
2789
+ * Current mode update.
2790
+ */
2791
+ interface ACPCurrentModeUpdate {
2792
+ _meta?: ACPMeta;
2793
+ currentModeId: ACPSessionModeId;
2794
+ }
2795
+ /**
2796
+ * Session info update.
2797
+ */
2798
+ interface ACPSessionInfoUpdate {
2799
+ _meta?: ACPMeta;
2800
+ title?: string | null;
2801
+ updatedAt?: string | null;
2802
+ }
2803
+ /**
2804
+ * All session update types.
2805
+ */
2806
+ type ACPSessionUpdate = (ACPContentChunk & {
2807
+ sessionUpdate: "user_message_chunk";
2808
+ }) | (ACPContentChunk & {
2809
+ sessionUpdate: "agent_message_chunk";
2810
+ }) | (ACPContentChunk & {
2811
+ sessionUpdate: "agent_thought_chunk";
2812
+ }) | (ACPToolCall & {
2813
+ sessionUpdate: "tool_call";
2814
+ }) | (ACPToolCallUpdate & {
2815
+ sessionUpdate: "tool_call_update";
2816
+ }) | (ACPPlan & {
2817
+ sessionUpdate: "plan";
2818
+ }) | (ACPAvailableCommandsUpdate & {
2819
+ sessionUpdate: "available_commands_update";
2820
+ }) | (ACPCurrentModeUpdate & {
2821
+ sessionUpdate: "current_mode_update";
2822
+ }) | (ACPSessionInfoUpdate & {
2823
+ sessionUpdate: "session_info_update";
2824
+ });
2825
+ /**
2826
+ * Session notification containing an update.
2827
+ */
2828
+ interface ACPSessionNotification {
2829
+ _meta?: ACPMeta;
2830
+ sessionId: ACPSessionId;
2831
+ update: ACPSessionUpdate;
2832
+ }
2833
+ /**
2834
+ * Permission option kind.
2835
+ */
2836
+ type ACPPermissionOptionKind = "allow_once" | "allow_always" | "reject_once" | "reject_always";
2837
+ /**
2838
+ * A permission option.
2839
+ */
2840
+ interface ACPPermissionOption {
2841
+ _meta?: ACPMeta;
2842
+ optionId: ACPPermissionOptionId;
2843
+ name: string;
2844
+ kind: ACPPermissionOptionKind;
2845
+ }
2846
+ /**
2847
+ * Request for user permission to execute a tool call.
2848
+ */
2849
+ interface ACPRequestPermissionRequest {
2850
+ _meta?: ACPMeta;
2851
+ sessionId: ACPSessionId;
2852
+ toolCall: ACPToolCallUpdate;
2853
+ options: ACPPermissionOption[];
2854
+ }
2855
+ /**
2856
+ * Permission outcome when user selected an option.
2857
+ */
2858
+ interface ACPSelectedPermissionOutcome {
2859
+ _meta?: ACPMeta;
2860
+ outcome: "selected";
2861
+ optionId: ACPPermissionOptionId;
2862
+ }
2863
+ /**
2864
+ * Permission outcome when cancelled.
2865
+ */
2866
+ interface ACPCancelledPermissionOutcome {
2867
+ outcome: "cancelled";
2868
+ }
2869
+ /**
2870
+ * Permission request outcome.
2871
+ */
2872
+ type ACPRequestPermissionOutcome = ACPSelectedPermissionOutcome | ACPCancelledPermissionOutcome;
2873
+ /**
2874
+ * Response to a permission request.
2875
+ */
2876
+ interface ACPRequestPermissionResponse {
2877
+ _meta?: ACPMeta;
2878
+ outcome: ACPRequestPermissionOutcome;
2879
+ }
2880
+ /**
2881
+ * Request to read content from a text file.
2882
+ */
2883
+ interface ACPReadTextFileRequest {
2884
+ _meta?: ACPMeta;
2885
+ sessionId: ACPSessionId;
2886
+ path: string;
2887
+ line?: number | null;
2888
+ limit?: number | null;
2889
+ }
2890
+ /**
2891
+ * Response containing file contents.
2892
+ */
2893
+ interface ACPReadTextFileResponse {
2894
+ _meta?: ACPMeta;
2895
+ content: string;
2896
+ }
2897
+ /**
2898
+ * Request to write content to a text file.
2899
+ */
2900
+ interface ACPWriteTextFileRequest {
2901
+ _meta?: ACPMeta;
2902
+ sessionId: ACPSessionId;
2903
+ path: string;
2904
+ content: string;
2905
+ }
2906
+ /**
2907
+ * Response to write text file.
2908
+ */
2909
+ interface ACPWriteTextFileResponse {
2910
+ _meta?: ACPMeta;
2911
+ }
2912
+ /**
2913
+ * Request to create a new terminal.
2914
+ */
2915
+ interface ACPCreateTerminalRequest {
2916
+ _meta?: ACPMeta;
2917
+ sessionId: ACPSessionId;
2918
+ command: string;
2919
+ args?: string[];
2920
+ cwd?: string | null;
2921
+ env?: ACPEnvVariable[];
2922
+ outputByteLimit?: number | null;
2923
+ }
2924
+ /**
2925
+ * Response containing the terminal ID.
2926
+ */
2927
+ interface ACPCreateTerminalResponse {
2928
+ _meta?: ACPMeta;
2929
+ terminalId: string;
2930
+ }
2931
+ /**
2932
+ * Request to get terminal output.
2933
+ */
2934
+ interface ACPTerminalOutputRequest {
2935
+ _meta?: ACPMeta;
2936
+ sessionId: ACPSessionId;
2937
+ terminalId: string;
2938
+ }
2939
+ /**
2940
+ * Terminal exit status.
2941
+ */
2942
+ interface ACPTerminalExitStatus {
2943
+ _meta?: ACPMeta;
2944
+ exitCode?: number | null;
2945
+ signal?: string | null;
2946
+ }
2947
+ /**
2948
+ * Response containing terminal output.
2949
+ */
2950
+ interface ACPTerminalOutputResponse {
2951
+ _meta?: ACPMeta;
2952
+ output: string;
2953
+ truncated: boolean;
2954
+ exitStatus?: ACPTerminalExitStatus | null;
2955
+ }
2956
+ /**
2957
+ * Request to release a terminal.
2958
+ */
2959
+ interface ACPReleaseTerminalRequest {
2960
+ _meta?: ACPMeta;
2961
+ sessionId: ACPSessionId;
2962
+ terminalId: string;
2963
+ }
2964
+ /**
2965
+ * Response to release terminal.
2966
+ */
2967
+ interface ACPReleaseTerminalResponse {
2968
+ _meta?: ACPMeta;
2969
+ }
2970
+ /**
2971
+ * Request to wait for terminal exit.
2972
+ */
2973
+ interface ACPWaitForTerminalExitRequest {
2974
+ _meta?: ACPMeta;
2975
+ sessionId: ACPSessionId;
2976
+ terminalId: string;
2977
+ }
2978
+ /**
2979
+ * Response with terminal exit status.
2980
+ */
2981
+ interface ACPWaitForTerminalExitResponse {
2982
+ _meta?: ACPMeta;
2983
+ exitCode?: number | null;
2984
+ signal?: string | null;
2985
+ }
2986
+ /**
2987
+ * Request to kill a terminal command.
2988
+ */
2989
+ interface ACPKillTerminalCommandRequest {
2990
+ _meta?: ACPMeta;
2991
+ sessionId: ACPSessionId;
2992
+ terminalId: string;
2993
+ }
2994
+ /**
2995
+ * Response to kill terminal command.
2996
+ */
2997
+ interface ACPKillTerminalCommandResponse {
2998
+ _meta?: ACPMeta;
2999
+ }
3000
+ /**
3001
+ * Context for ACP messages tunneled through MAP.
3002
+ */
3003
+ interface ACPContext {
3004
+ /** Unique identifier for this virtual ACP stream. */
3005
+ streamId: string;
3006
+ /** ACP session ID (null before session/new is called). */
3007
+ sessionId: ACPSessionId | null;
3008
+ /** Direction of message flow. */
3009
+ direction: "client-to-agent" | "agent-to-client";
3010
+ /** Information about a pending client request (for agent→client requests). */
3011
+ pendingClientRequest?: {
3012
+ requestId: ACPRequestId;
3013
+ method: string;
3014
+ timeout?: number;
3015
+ };
3016
+ }
3017
+ /**
3018
+ * Envelope wrapping ACP JSON-RPC messages for transport through MAP.
3019
+ *
3020
+ * This is the payload format used when sending ACP messages via MAP's send().
3021
+ */
3022
+ interface ACPEnvelope {
3023
+ /**
3024
+ * The original ACP JSON-RPC message.
3025
+ */
3026
+ acp: {
3027
+ jsonrpc: "2.0";
3028
+ id?: ACPRequestId;
3029
+ method?: string;
3030
+ params?: unknown;
3031
+ result?: unknown;
3032
+ error?: ACPErrorObject;
3033
+ };
3034
+ /**
3035
+ * ACP-specific routing context.
3036
+ */
3037
+ acpContext: ACPContext;
3038
+ }
3039
+ /**
3040
+ * Handlers that the client provides for agent→client requests.
3041
+ */
3042
+ interface ACPClientHandlers {
3043
+ /**
3044
+ * Handle permission request from agent.
3045
+ */
3046
+ requestPermission(params: ACPRequestPermissionRequest): Promise<ACPRequestPermissionResponse>;
3047
+ /**
3048
+ * Handle session update notification from agent.
3049
+ */
3050
+ sessionUpdate(params: ACPSessionNotification): Promise<void>;
3051
+ /**
3052
+ * Handle read text file request (optional, based on capabilities).
3053
+ */
3054
+ readTextFile?(params: ACPReadTextFileRequest): Promise<ACPReadTextFileResponse>;
3055
+ /**
3056
+ * Handle write text file request (optional, based on capabilities).
3057
+ */
3058
+ writeTextFile?(params: ACPWriteTextFileRequest): Promise<ACPWriteTextFileResponse>;
3059
+ /**
3060
+ * Handle create terminal request (optional, based on capabilities).
3061
+ */
3062
+ createTerminal?(params: ACPCreateTerminalRequest): Promise<ACPCreateTerminalResponse>;
3063
+ /**
3064
+ * Handle terminal output request (optional, based on capabilities).
3065
+ */
3066
+ terminalOutput?(params: ACPTerminalOutputRequest): Promise<ACPTerminalOutputResponse>;
3067
+ /**
3068
+ * Handle release terminal request (optional, based on capabilities).
3069
+ */
3070
+ releaseTerminal?(params: ACPReleaseTerminalRequest): Promise<ACPReleaseTerminalResponse>;
3071
+ /**
3072
+ * Handle wait for terminal exit request (optional, based on capabilities).
3073
+ */
3074
+ waitForTerminalExit?(params: ACPWaitForTerminalExitRequest): Promise<ACPWaitForTerminalExitResponse>;
3075
+ /**
3076
+ * Handle kill terminal command request (optional, based on capabilities).
3077
+ */
3078
+ killTerminal?(params: ACPKillTerminalCommandRequest): Promise<ACPKillTerminalCommandResponse>;
3079
+ }
3080
+ /**
3081
+ * Context passed to agent handlers.
3082
+ */
3083
+ interface ACPAgentContext {
3084
+ /** The stream ID for this ACP session. */
3085
+ streamId: string;
3086
+ /** Current ACP session ID (null before newSession). */
3087
+ sessionId: ACPSessionId | null;
3088
+ /** The MAP participant ID of the client. */
3089
+ clientParticipantId: string;
3090
+ }
3091
+ /**
3092
+ * Handler interface for agents that support ACP.
3093
+ */
3094
+ interface ACPAgentHandler {
3095
+ /**
3096
+ * Handle initialize request.
3097
+ */
3098
+ initialize(params: ACPInitializeRequest, ctx: ACPAgentContext): Promise<ACPInitializeResponse>;
3099
+ /**
3100
+ * Handle authenticate request (optional).
3101
+ */
3102
+ authenticate?(params: ACPAuthenticateRequest, ctx: ACPAgentContext): Promise<ACPAuthenticateResponse>;
3103
+ /**
3104
+ * Handle new session request.
3105
+ */
3106
+ newSession(params: ACPNewSessionRequest, ctx: ACPAgentContext): Promise<ACPNewSessionResponse>;
3107
+ /**
3108
+ * Handle load session request (optional).
3109
+ */
3110
+ loadSession?(params: ACPLoadSessionRequest, ctx: ACPAgentContext): Promise<ACPLoadSessionResponse>;
3111
+ /**
3112
+ * Handle set session mode request (optional).
3113
+ */
3114
+ setSessionMode?(params: ACPSetSessionModeRequest, ctx: ACPAgentContext): Promise<ACPSetSessionModeResponse>;
3115
+ /**
3116
+ * Handle prompt request.
3117
+ */
3118
+ prompt(params: ACPPromptRequest, ctx: ACPAgentContext): Promise<ACPPromptResponse>;
3119
+ /**
3120
+ * Handle cancel notification.
3121
+ */
3122
+ cancel(params: ACPCancelNotification, ctx: ACPAgentContext): Promise<void>;
3123
+ }
3124
+ /**
3125
+ * Current stable ACP protocol version.
3126
+ */
3127
+ declare const ACP_PROTOCOL_VERSION = 20241007;
3128
+ /**
3129
+ * ACP method names.
3130
+ */
3131
+ declare const ACP_METHODS: {
3132
+ readonly INITIALIZE: "initialize";
3133
+ readonly AUTHENTICATE: "authenticate";
3134
+ readonly SESSION_NEW: "session/new";
3135
+ readonly SESSION_LOAD: "session/load";
3136
+ readonly SESSION_SET_MODE: "session/set_mode";
3137
+ readonly SESSION_PROMPT: "session/prompt";
3138
+ readonly SESSION_CANCEL: "session/cancel";
3139
+ readonly SESSION_UPDATE: "session/update";
3140
+ readonly REQUEST_PERMISSION: "request_permission";
3141
+ readonly FS_READ_TEXT_FILE: "fs/read_text_file";
3142
+ readonly FS_WRITE_TEXT_FILE: "fs/write_text_file";
3143
+ readonly TERMINAL_CREATE: "terminal/create";
3144
+ readonly TERMINAL_OUTPUT: "terminal/output";
3145
+ readonly TERMINAL_RELEASE: "terminal/release";
3146
+ readonly TERMINAL_WAIT_FOR_EXIT: "terminal/wait_for_exit";
3147
+ readonly TERMINAL_KILL: "terminal/kill";
3148
+ };
3149
+ /**
3150
+ * Check if a message is an ACP request.
3151
+ */
3152
+ declare function isACPRequest(msg: ACPMessage): msg is ACPRequest;
3153
+ /**
3154
+ * Check if a message is an ACP notification.
3155
+ */
3156
+ declare function isACPNotification(msg: ACPMessage): msg is ACPNotification;
3157
+ /**
3158
+ * Check if a message is an ACP response.
3159
+ */
3160
+ declare function isACPResponse(msg: ACPMessage): msg is ACPResponse;
3161
+ /**
3162
+ * Check if a response is an error response.
3163
+ */
3164
+ declare function isACPErrorResponse(response: ACPResponse): response is ACPErrorResponse;
3165
+ /**
3166
+ * Check if a response is a success response.
3167
+ */
3168
+ declare function isACPSuccessResponse<T>(response: ACPResponse<T>): response is ACPSuccessResponse<T>;
3169
+ /**
3170
+ * Check if a payload is an ACP envelope.
3171
+ */
3172
+ declare function isACPEnvelope(payload: unknown): payload is ACPEnvelope;
3173
+
3174
+ /**
3175
+ * ACPStreamConnection - Client-side virtual ACP connection over MAP.
3176
+ *
3177
+ * Provides a familiar ACP interface while using MAP's send/subscribe
3178
+ * primitives for transport. Supports request/response correlation,
3179
+ * timeout handling, and session lifecycle management.
3180
+ *
3181
+ * @module
3182
+ */
3183
+
3184
+ /**
3185
+ * Options for creating an ACP stream connection.
3186
+ */
3187
+ interface ACPStreamOptions {
3188
+ /** Target agent that will handle ACP requests */
3189
+ targetAgent: AgentId;
3190
+ /** Client-side handlers for agent→client requests */
3191
+ client: ACPClientHandlers;
3192
+ /** Optional: expose MAP events alongside ACP (for observability) */
3193
+ exposeMapEvents?: boolean;
3194
+ /** Request timeout in milliseconds (default: 30000) */
3195
+ timeout?: number;
3196
+ }
3197
+ /**
3198
+ * Events emitted by ACPStreamConnection.
3199
+ */
3200
+ interface ACPStreamEvents {
3201
+ /** Emitted when ACP session is lost after reconnection */
3202
+ sessionLost: (info: {
3203
+ sessionId: ACPSessionId;
3204
+ reason: string;
3205
+ }) => void;
3206
+ /** Emitted when the stream successfully reconnects */
3207
+ reconnected: () => void;
3208
+ /** Emitted when reconnection is in progress */
3209
+ reconnecting: () => void;
3210
+ /** Emitted when the stream is closed */
3211
+ close: () => void;
3212
+ /** Emitted on errors */
3213
+ error: (error: Error) => void;
3214
+ }
3215
+ /**
3216
+ * Virtual ACP connection over MAP.
3217
+ *
3218
+ * Provides the full ACP client interface, routing all requests through
3219
+ * the underlying MAP connection to a target agent.
3220
+ *
3221
+ * @example
3222
+ * ```typescript
3223
+ * const acp = new ACPStreamConnection(mapClient, {
3224
+ * targetAgent: 'coding-agent-1',
3225
+ * client: {
3226
+ * requestPermission: async (req) => ({ outcome: { outcome: 'selected', optionId: 'allow' } }),
3227
+ * sessionUpdate: async (update) => { console.log(update); },
3228
+ * }
3229
+ * });
3230
+ *
3231
+ * await acp.initialize({ protocolVersion: 20241007, clientInfo: { name: 'IDE', version: '1.0' } });
3232
+ * const { sessionId } = await acp.newSession({ cwd: '/project', mcpServers: [] });
3233
+ * const result = await acp.prompt({ sessionId, prompt: [{ type: 'text', text: 'Hello' }] });
3234
+ * ```
3235
+ */
3236
+ declare class ACPStreamConnection extends EventEmitter {
3237
+ #private;
3238
+ /**
3239
+ * Create a new ACP stream connection.
3240
+ *
3241
+ * @param mapClient - The underlying MAP client connection
3242
+ * @param options - Stream configuration options
3243
+ */
3244
+ constructor(mapClient: ClientConnection, options: ACPStreamOptions);
3245
+ /** Unique identifier for this ACP stream */
3246
+ get streamId(): string;
3247
+ /** Target agent this stream connects to */
3248
+ get targetAgent(): AgentId;
3249
+ /** Current ACP session ID (null until newSession called) */
3250
+ get sessionId(): ACPSessionId | null;
3251
+ /** Whether initialize() has been called */
3252
+ get initialized(): boolean;
3253
+ /** Agent capabilities from initialize response */
3254
+ get capabilities(): ACPAgentCapabilities | null;
3255
+ /** Whether the stream is closed */
3256
+ get isClosed(): boolean;
3257
+ /** Last processed event ID (for reconnection support) */
3258
+ get lastEventId(): string | null;
3259
+ /** Whether the stream is currently reconnecting */
3260
+ get isReconnecting(): boolean;
3261
+ /**
3262
+ * Initialize the ACP connection with the target agent.
3263
+ */
3264
+ initialize(params: ACPInitializeRequest): Promise<ACPInitializeResponse>;
3265
+ /**
3266
+ * Authenticate with the agent.
3267
+ */
3268
+ authenticate(params: ACPAuthenticateRequest): Promise<ACPAuthenticateResponse>;
3269
+ /**
3270
+ * Create a new ACP session.
3271
+ */
3272
+ newSession(params: ACPNewSessionRequest): Promise<ACPNewSessionResponse>;
3273
+ /**
3274
+ * Load an existing ACP session.
3275
+ */
3276
+ loadSession(params: ACPLoadSessionRequest): Promise<ACPLoadSessionResponse>;
3277
+ /**
3278
+ * Set the session mode.
3279
+ */
3280
+ setSessionMode(params: ACPSetSessionModeRequest): Promise<ACPSetSessionModeResponse>;
3281
+ /**
3282
+ * Send a prompt to the agent.
3283
+ * Updates are received via the sessionUpdate handler.
3284
+ */
3285
+ prompt(params: ACPPromptRequest): Promise<ACPPromptResponse>;
3286
+ /**
3287
+ * Cancel ongoing operations for the current session.
3288
+ */
3289
+ cancel(params?: Partial<ACPCancelNotification>): Promise<void>;
3290
+ /**
3291
+ * Close this ACP stream and clean up resources.
3292
+ */
3293
+ close(): Promise<void>;
3294
+ }
3295
+ /**
3296
+ * Create an ACP stream connection from a MAP client.
3297
+ *
3298
+ * @param mapClient - The underlying MAP client connection
3299
+ * @param options - Stream configuration options
3300
+ * @returns A new ACPStreamConnection instance
3301
+ */
3302
+ declare function createACPStream(mapClient: ClientConnection, options: ACPStreamOptions): ACPStreamConnection;
3303
+
2124
3304
  /**
2125
3305
  * Client connection for MAP protocol
2126
3306
  *
@@ -2346,6 +3526,51 @@ declare class ClientConnection {
2346
3526
  timeout?: number;
2347
3527
  meta?: MessageMeta;
2348
3528
  }): Promise<Message<T>>;
3529
+ /**
3530
+ * Create a virtual ACP stream connection to an agent.
3531
+ *
3532
+ * This allows clients to interact with ACP-compatible agents using the
3533
+ * familiar ACP interface while routing all messages through MAP.
3534
+ *
3535
+ * @param options - Stream configuration options
3536
+ * @returns ACPStreamConnection instance ready for initialize()
3537
+ *
3538
+ * @example
3539
+ * ```typescript
3540
+ * const acp = client.createACPStream({
3541
+ * targetAgent: 'coding-agent-1',
3542
+ * client: {
3543
+ * requestPermission: async (req) => ({
3544
+ * outcome: { outcome: 'selected', optionId: 'allow' }
3545
+ * }),
3546
+ * sessionUpdate: async (update) => {
3547
+ * console.log('Agent update:', update);
3548
+ * }
3549
+ * }
3550
+ * });
3551
+ *
3552
+ * await acp.initialize({
3553
+ * protocolVersion: 20241007,
3554
+ * clientInfo: { name: 'IDE', version: '1.0' }
3555
+ * });
3556
+ * const { sessionId } = await acp.newSession({ cwd: '/project', mcpServers: [] });
3557
+ * const result = await acp.prompt({
3558
+ * sessionId,
3559
+ * prompt: [{ type: 'text', text: 'Hello' }]
3560
+ * });
3561
+ *
3562
+ * await acp.close();
3563
+ * ```
3564
+ */
3565
+ createACPStream(options: Omit<ACPStreamOptions, 'mapClient'>): ACPStreamConnection;
3566
+ /**
3567
+ * Get an active ACP stream by ID.
3568
+ */
3569
+ getACPStream(streamId: string): ACPStreamConnection | undefined;
3570
+ /**
3571
+ * Get all active ACP streams.
3572
+ */
3573
+ get acpStreams(): ReadonlyMap<string, ACPStreamConnection>;
2349
3574
  /**
2350
3575
  * Subscribe to events
2351
3576
  */
@@ -3177,4 +4402,4 @@ declare function canAgentMessageAgent(senderAgent: Agent, targetAgentId: AgentId
3177
4402
  sharedScopes?: ScopeId[];
3178
4403
  }, config?: AgentPermissionConfig): boolean;
3179
4404
 
3180
- export { type AgentLifecycle as $, type AgentId as A, type BaseConnectionOptions as B, type ConnectResponseResult as C, type DisconnectResponseResult as D, type ErrorCategory as E, type FederationBufferConfig as F, type ScopesJoinResponseResult as G, type ScopesLeaveResponseResult as H, type ScopesListResponseResult as I, type MessageId as J, type SendResponseResult as K, type SubscriptionId as L, type MAPError as M, type SubscribeResponseResult as N, AGENT_ERROR_CODES as O, type ParticipantCapabilities as P, AUTH_ERROR_CODES as Q, type RequestId as R, type Stream as S, AUTH_METHODS as T, type UnsubscribeResponseResult as U, type AcceptanceContext as V, type AgentAcceptanceRule as W, type AgentConnectOptions as X, AgentConnection as Y, type AgentConnectionOptions as Z, type AgentIncludeOptions as _, type MAPErrorData as a, FEDERATION_METHODS as a$, type AgentMessagingRule as a0, type AgentPermissionConfig as a1, type AgentPermissions as a2, type AgentReconnectionEventHandler as a3, type AgentReconnectionEventType as a4, type AgentReconnectionOptions as a5, type AgentRelationship as a6, type AgentRelationshipType as a7, type AgentState as a8, type AgentVisibility as a9, type AuthRefreshRequest as aA, type AuthRefreshRequestParams as aB, type AuthRefreshResponseResult as aC, BaseConnection as aD, type BroadcastAddress as aE, CAPABILITY_REQUIREMENTS as aF, CORE_METHODS as aG, type ClientAcceptanceRule as aH, type ClientConnectOptions as aI, ClientConnection as aJ, type ClientConnectionOptions as aK, type ConnectRequest as aL, type ConnectRequestParams as aM, type CorrelationId as aN, DEFAULT_AGENT_PERMISSION_CONFIG as aO, type DeliverySemantics as aP, type DirectAddress as aQ, type DisconnectPolicy as aR, type DisconnectRequest as aS, type DisconnectRequestParams as aT, ERROR_CODES as aU, EVENT_TYPES as aV, EXTENSION_METHODS as aW, type EventInput as aX, type EventNotification as aY, type EventNotificationParams as aZ, FEDERATION_ERROR_CODES as a_, type AgentVisibilityRule as aa, type AgentsGetRequest as ab, type AgentsGetRequestParams as ac, type AgentsListFilter as ad, type AgentsListRequest as ae, type AgentsListRequestParams as af, type AgentsRegisterRequest as ag, type AgentsRegisterRequestParams as ah, type AgentsResumeRequest as ai, type AgentsResumeRequestParams as aj, type AgentsResumeResponseResult as ak, type AgentsSpawnRequest as al, type AgentsSpawnRequestParams as am, type AgentsStopRequest as an, type AgentsStopRequestParams as ao, type AgentsStopResponseResult as ap, type AgentsSuspendRequest as aq, type AgentsSuspendRequestParams as ar, type AgentsSuspendResponseResult as as, type AgentsUnregisterRequest as at, type AgentsUnregisterRequestParams as au, type AgentsUpdateRequest as av, type AgentsUpdateRequestParams as aw, type AnyMessage as ax, type AuthMethod as ay, type AuthParams as az, type FederationEnvelope as b, ROUTING_ERROR_CODES as b$, type FederatedAddress as b0, type FederationAuth as b1, type FederationConnectRequest as b2, type FederationConnectRequestParams as b3, type FederationMetadata as b4, type FederationReplayConfig as b5, type FederationRouteRequest as b6, type FederationRouteRequestParams as b7, type GatewayReconnectionEvent as b8, type GatewayReconnectionEventHandler as b9, type MessagePriority as bA, type MessageRelationship as bB, type MessageSentEventData as bC, type MessageVisibility as bD, type Meta as bE, type MultiAddress as bF, NOTIFICATION_METHODS as bG, type NotificationHandler as bH, OBSERVATION_METHODS as bI, type OverflowHandler as bJ, type OverflowInfo as bK, PERMISSION_METHODS as bL, PROTOCOL_ERROR_CODES as bM, PROTOCOL_VERSION as bN, type Participant as bO, type ParticipantAddress as bP, type PermissionAction as bQ, type PermissionContext as bR, type PermissionParticipant as bS, type PermissionResult as bT, type PermissionSystemConfig as bU, type PermissionsAgentUpdatedEventData as bV, type PermissionsClientUpdatedEventData as bW, type PermissionsUpdateRequest as bX, type PermissionsUpdateRequestParams as bY, type PermissionsUpdateResponseResult as bZ, RESOURCE_ERROR_CODES as b_, type GatewayReconnectionEventType as ba, type GatewayReconnectionOptions as bb, type GraphEdge as bc, type HierarchicalAddress as bd, type InjectDelivery as be, type InjectDeliveryResult as bf, type InjectRequest as bg, type InjectRequestParams as bh, type InjectResponseResult as bi, JSONRPC_VERSION as bj, type JoinPolicy as bk, LIFECYCLE_METHODS as bl, type MAPNotification as bm, type MAPNotificationBase as bn, type MAPRequest as bo, type MAPRequestBase as bp, type MAPResponse as bq, type MAPResponseError as br, type MAPResponseSuccess as bs, MAP_METHODS as bt, type MessageDeliveredEventData as bu, type MessageFailedEventData as bv, type MessageHandler as bw, type MessageMeta as bx, type MessageNotification as by, type MessageNotificationParams as bz, type Message as c, type TransportType as c$, type ReconnectionEventHandler as c0, type ReconnectionEventType as c1, type ReconnectionOptions as c2, type ReplayRequest as c3, type ReplayRequestParams as c4, type ReplayResponseResult as c5, type ReplayedEvent as c6, type RequestHandler as c7, type RoleAddress as c8, SCOPE_METHODS as c9, type SendRequest as cA, type SendRequestParams as cB, type SessionCloseRequest as cC, type SessionCloseRequestParams as cD, type SessionCloseResponseResult as cE, type SessionListRequest as cF, type SessionListRequestParams as cG, type SessionListResponseResult as cH, type SessionLoadRequest as cI, type SessionLoadRequestParams as cJ, type SessionLoadResponseResult as cK, type StateChangeHandler as cL, type StreamingCapabilities as cM, type StructureGraphRequest as cN, type StructureGraphRequestParams as cO, type StructureGraphResponseResult as cP, type StructureVisibilityRule as cQ, type SubscribeRequest as cR, type SubscribeRequestParams as cS, Subscription as cT, type SubscriptionAckNotification as cU, type SubscriptionAckParams as cV, type SubscriptionOptions$1 as cW, type SubscriptionState as cX, type SystemAcceptanceRule as cY, type SystemAddress as cZ, type Timestamp as c_, SESSION_METHODS as ca, STATE_METHODS as cb, STEERING_METHODS as cc, STRUCTURE_METHODS as cd, type ScopeAddress as ce, type ScopeMessagingRule as cf, type ScopeVisibility as cg, type ScopeVisibilityRule as ch, type ScopesCreateRequest as ci, type ScopesCreateRequestParams as cj, type ScopesDeleteRequest as ck, type ScopesDeleteRequestParams as cl, type ScopesDeleteResponseResult as cm, type ScopesGetRequest as cn, type ScopesGetRequestParams as co, type ScopesGetResponseResult as cp, type ScopesJoinRequest as cq, type ScopesJoinRequestParams as cr, type ScopesLeaveRequest as cs, type ScopesLeaveRequestParams as ct, type ScopesListRequest as cu, type ScopesListRequestParams as cv, type ScopesMembersRequest as cw, type ScopesMembersRequestParams as cx, type ScopesMembersResponseResult as cy, type SendPolicy as cz, type FederationRoutingConfig as d, type UnsubscribeRequest as d0, type UnsubscribeRequestParams as d1, canAgentAcceptMessage as d2, canAgentMessageAgent as d3, canAgentSeeAgent as d4, canControlAgent as d5, canJoinScope as d6, canMessageAgent as d7, canPerformAction as d8, canPerformMethod as d9, type SystemExposure as dA, canSeeAgent as da, canSeeScope as db, canSendToScope as dc, createEvent as dd, createStreamPair as de, createSubscription as df, deepMergePermissions as dg, filterVisibleAgents as dh, filterVisibleEvents as di, filterVisibleScopes as dj, hasCapability as dk, isAgentExposed as dl, isBroadcastAddress as dm, isDirectAddress as dn, isEventTypeExposed as dp, isFederatedAddress as dq, isHierarchicalAddress as dr, isOrphanedAgent as ds, isScopeExposed as dt, isSuccessResponse as du, mapVisibilityToRule as dv, ndJsonStream as dw, resolveAgentPermissions as dx, waitForOpen as dy, websocketStream as dz, type EventType as e, type SessionId as f, type FederationConnectResponseResult as g, type FederationRouteResponseResult as h, type ConnectionState as i, type ParticipantId as j, type ParticipantType as k, type ScopeId as l, type Agent as m, type Scope as n, type Address as o, type SubscriptionFilter as p, type Event as q, type AgentsGetResponseResult as r, type AgentsListResponseResult as s, type AgentsRegisterResponseResult as t, type AgentsSpawnResponseResult as u, type AgentsUnregisterResponseResult as v, type AgentsUpdateResponseResult as w, type ProtocolVersion as x, type SessionInfo as y, type ScopesCreateResponseResult as z };
4405
+ export { type ACPCreateTerminalRequest as $, type AgentId as A, type BaseConnectionOptions as B, type ConnectResponseResult as C, type DisconnectResponseResult as D, type ErrorCategory as E, type FederationBufferConfig as F, type ScopesJoinResponseResult as G, type ScopesLeaveResponseResult as H, type ScopesListResponseResult as I, type MessageId as J, type SendResponseResult as K, type SubscriptionId as L, type MAPError as M, type SubscribeResponseResult as N, AgentConnection as O, type ParticipantCapabilities as P, type ACPAgentHandler as Q, type RequestId as R, type Stream as S, type ACPSessionNotification as T, type UnsubscribeResponseResult as U, type ACPRequestPermissionRequest as V, type ACPRequestPermissionResponse as W, type ACPReadTextFileRequest as X, type ACPReadTextFileResponse as Y, type ACPWriteTextFileRequest as Z, type ACPWriteTextFileResponse as _, type MAPErrorData as a, type ACPPromptCapabilities as a$, type ACPCreateTerminalResponse as a0, type ACPTerminalOutputRequest as a1, type ACPTerminalOutputResponse as a2, type ACPReleaseTerminalRequest as a3, type ACPReleaseTerminalResponse as a4, type ACPWaitForTerminalExitRequest as a5, type ACPWaitForTerminalExitResponse as a6, type ACPKillTerminalCommandRequest as a7, type ACPKillTerminalCommandResponse as a8, type ACPSessionId as a9, type ACPErrorObject as aA, type ACPErrorResponse as aB, type ACPFileSystemCapability as aC, type ACPHttpHeader as aD, type ACPImageContent as aE, type ACPImplementation as aF, type ACPInitializeRequest as aG, type ACPInitializeResponse as aH, type ACPLoadSessionRequest as aI, type ACPLoadSessionResponse as aJ, type ACPMcpCapabilities as aK, type ACPMcpServer as aL, type ACPMcpServerHttp as aM, type ACPMcpServerSse as aN, type ACPMcpServerStdio as aO, type ACPMessage as aP, type ACPMeta as aQ, type ACPNewSessionRequest as aR, type ACPNewSessionResponse as aS, type ACPNotification as aT, type ACPPermissionOption as aU, type ACPPermissionOptionId as aV, type ACPPermissionOptionKind as aW, type ACPPlan as aX, type ACPPlanEntry as aY, type ACPPlanEntryPriority as aZ, type ACPPlanEntryStatus as a_, type ACPAgentCapabilities as aa, type ACPAgentContext as ab, type ACPAnnotations as ac, type ACPAudioContent as ad, type ACPAuthMethod as ae, type ACPAuthenticateRequest as af, type ACPAuthenticateResponse as ag, type ACPAvailableCommand as ah, type ACPAvailableCommandsUpdate as ai, type ACPBlobResourceContents as aj, type ACPCancelNotification as ak, type ACPCancelledPermissionOutcome as al, type ACPCapability as am, type ACPClientCapabilities as an, type ACPClientHandlers as ao, type ACPContent as ap, type ACPContentBlock as aq, type ACPContentChunk as ar, type ACPContext as as, type ACPCurrentModeUpdate as at, type ACPDiff as au, type ACPEmbeddedResource as av, type ACPEnvVariable as aw, type ACPEnvelope as ax, ACPError as ay, type ACPErrorCode as az, type FederationEnvelope as b, type AgentsRegisterRequestParams as b$, type ACPPromptRequest as b0, type ACPPromptResponse as b1, type ACPProtocolVersion as b2, type ACPRequest as b3, type ACPRequestId as b4, type ACPRequestPermissionOutcome as b5, type ACPResourceLink as b6, type ACPResponse as b7, type ACPRole as b8, type ACPSelectedPermissionOutcome as b9, ACP_PROTOCOL_VERSION as bA, AGENT_ERROR_CODES as bB, AUTH_ERROR_CODES as bC, AUTH_METHODS as bD, type AcceptanceContext as bE, type AgentAcceptanceRule as bF, type AgentConnectOptions as bG, type AgentConnectionOptions as bH, type AgentIncludeOptions as bI, type AgentLifecycle as bJ, type AgentMessagingRule as bK, type AgentPermissionConfig as bL, type AgentPermissions as bM, type AgentReconnectionEventHandler as bN, type AgentReconnectionEventType as bO, type AgentReconnectionOptions as bP, type AgentRelationship as bQ, type AgentRelationshipType as bR, type AgentState as bS, type AgentVisibility as bT, type AgentVisibilityRule as bU, type AgentsGetRequest as bV, type AgentsGetRequestParams as bW, type AgentsListFilter as bX, type AgentsListRequest as bY, type AgentsListRequestParams as bZ, type AgentsRegisterRequest as b_, type ACPSessionCapabilities as ba, type ACPSessionInfoUpdate as bb, type ACPSessionMode as bc, type ACPSessionModeId as bd, type ACPSessionModeState as be, type ACPSessionUpdate as bf, type ACPSetSessionModeRequest as bg, type ACPSetSessionModeResponse as bh, type ACPStopReason as bi, ACPStreamConnection as bj, type ACPStreamEvents as bk, type ACPStreamOptions as bl, type ACPSuccessResponse as bm, type ACPTerminal as bn, type ACPTerminalExitStatus as bo, type ACPTextContent as bp, type ACPTextResourceContents as bq, type ACPToolCall as br, type ACPToolCallContent as bs, type ACPToolCallId as bt, type ACPToolCallLocation as bu, type ACPToolCallStatus as bv, type ACPToolCallUpdate as bw, type ACPToolKind as bx, ACP_ERROR_CODES as by, ACP_METHODS as bz, type Message as c, type InjectRequestParams as c$, type AgentsResumeRequest as c0, type AgentsResumeRequestParams as c1, type AgentsResumeResponseResult as c2, type AgentsSpawnRequest as c3, type AgentsSpawnRequestParams as c4, type AgentsStopRequest as c5, type AgentsStopRequestParams as c6, type AgentsStopResponseResult as c7, type AgentsSuspendRequest as c8, type AgentsSuspendRequestParams as c9, type DisconnectRequest as cA, type DisconnectRequestParams as cB, ERROR_CODES as cC, EVENT_TYPES as cD, EXTENSION_METHODS as cE, type EventInput as cF, type EventNotification as cG, type EventNotificationParams as cH, FEDERATION_ERROR_CODES as cI, FEDERATION_METHODS as cJ, type FederatedAddress as cK, type FederationAuth as cL, type FederationConnectRequest as cM, type FederationConnectRequestParams as cN, type FederationMetadata as cO, type FederationReplayConfig as cP, type FederationRouteRequest as cQ, type FederationRouteRequestParams as cR, type GatewayReconnectionEvent as cS, type GatewayReconnectionEventHandler as cT, type GatewayReconnectionEventType as cU, type GatewayReconnectionOptions as cV, type GraphEdge as cW, type HierarchicalAddress as cX, type InjectDelivery as cY, type InjectDeliveryResult as cZ, type InjectRequest as c_, type AgentsSuspendResponseResult as ca, type AgentsUnregisterRequest as cb, type AgentsUnregisterRequestParams as cc, type AgentsUpdateRequest as cd, type AgentsUpdateRequestParams as ce, type AnyMessage as cf, type AuthMethod as cg, type AuthParams as ch, type AuthRefreshRequest as ci, type AuthRefreshRequestParams as cj, type AuthRefreshResponseResult as ck, BaseConnection as cl, type BroadcastAddress as cm, CAPABILITY_REQUIREMENTS as cn, CORE_METHODS as co, type ClientAcceptanceRule as cp, type ClientConnectOptions as cq, ClientConnection as cr, type ClientConnectionOptions as cs, type ConnectRequest as ct, type ConnectRequestParams as cu, type CorrelationId as cv, DEFAULT_AGENT_PERMISSION_CONFIG as cw, type DeliverySemantics as cx, type DirectAddress as cy, type DisconnectPolicy as cz, type FederationRoutingConfig as d, type ScopeVisibility as d$, type InjectResponseResult as d0, JSONRPC_VERSION as d1, type JoinPolicy as d2, LIFECYCLE_METHODS as d3, type MAPNotification as d4, type MAPNotificationBase as d5, type MAPRequest as d6, type MAPRequestBase as d7, type MAPResponse as d8, type MAPResponseError as d9, type PermissionContext as dA, type PermissionParticipant as dB, type PermissionResult as dC, type PermissionSystemConfig as dD, type PermissionsAgentUpdatedEventData as dE, type PermissionsClientUpdatedEventData as dF, type PermissionsUpdateRequest as dG, type PermissionsUpdateRequestParams as dH, type PermissionsUpdateResponseResult as dI, RESOURCE_ERROR_CODES as dJ, ROUTING_ERROR_CODES as dK, type ReconnectionEventHandler as dL, type ReconnectionEventType as dM, type ReconnectionOptions as dN, type ReplayRequest as dO, type ReplayRequestParams as dP, type ReplayResponseResult as dQ, type ReplayedEvent as dR, type RequestHandler as dS, type RoleAddress as dT, SCOPE_METHODS as dU, SESSION_METHODS as dV, STATE_METHODS as dW, STEERING_METHODS as dX, STRUCTURE_METHODS as dY, type ScopeAddress as dZ, type ScopeMessagingRule as d_, type MAPResponseSuccess as da, MAP_METHODS as db, type MessageDeliveredEventData as dc, type MessageFailedEventData as dd, type MessageHandler as de, type MessageMeta as df, type MessageNotification as dg, type MessageNotificationParams as dh, type MessagePriority as di, type MessageRelationship as dj, type MessageSentEventData as dk, type MessageVisibility as dl, type Meta as dm, type MultiAddress as dn, NOTIFICATION_METHODS as dp, type NotificationHandler as dq, OBSERVATION_METHODS as dr, type OverflowHandler as ds, type OverflowInfo as dt, PERMISSION_METHODS as du, PROTOCOL_ERROR_CODES as dv, PROTOCOL_VERSION as dw, type Participant as dx, type ParticipantAddress as dy, type PermissionAction as dz, type EventType as e, createSubscription as e$, type ScopeVisibilityRule as e0, type ScopesCreateRequest as e1, type ScopesCreateRequestParams as e2, type ScopesDeleteRequest as e3, type ScopesDeleteRequestParams as e4, type ScopesDeleteResponseResult as e5, type ScopesGetRequest as e6, type ScopesGetRequestParams as e7, type ScopesGetResponseResult as e8, type ScopesJoinRequest as e9, type SubscribeRequest as eA, type SubscribeRequestParams as eB, Subscription as eC, type SubscriptionAckNotification as eD, type SubscriptionAckParams as eE, type SubscriptionOptions$1 as eF, type SubscriptionState as eG, type SystemAcceptanceRule as eH, type SystemAddress as eI, type Timestamp as eJ, type TransportType as eK, type UnsubscribeRequest as eL, type UnsubscribeRequestParams as eM, canAgentAcceptMessage as eN, canAgentMessageAgent as eO, canAgentSeeAgent as eP, canControlAgent as eQ, canJoinScope as eR, canMessageAgent as eS, canPerformAction as eT, canPerformMethod as eU, canSeeAgent as eV, canSeeScope as eW, canSendToScope as eX, createACPStream as eY, createEvent as eZ, createStreamPair as e_, type ScopesJoinRequestParams as ea, type ScopesLeaveRequest as eb, type ScopesLeaveRequestParams as ec, type ScopesListRequest as ed, type ScopesListRequestParams as ee, type ScopesMembersRequest as ef, type ScopesMembersRequestParams as eg, type ScopesMembersResponseResult as eh, type SendPolicy as ei, type SendRequest as ej, type SendRequestParams as ek, type SessionCloseRequest as el, type SessionCloseRequestParams as em, type SessionCloseResponseResult as en, type SessionListRequest as eo, type SessionListRequestParams as ep, type SessionListResponseResult as eq, type SessionLoadRequest as er, type SessionLoadRequestParams as es, type SessionLoadResponseResult as et, type StateChangeHandler as eu, type StreamingCapabilities as ev, type StructureGraphRequest as ew, type StructureGraphRequestParams as ex, type StructureGraphResponseResult as ey, type StructureVisibilityRule as ez, type SessionId as f, deepMergePermissions as f0, filterVisibleAgents as f1, filterVisibleEvents as f2, filterVisibleScopes as f3, hasCapability as f4, isACPEnvelope as f5, isACPErrorResponse as f6, isACPNotification as f7, isACPRequest as f8, isACPResponse as f9, isACPSuccessResponse as fa, isAgentExposed as fb, isBroadcastAddress as fc, isDirectAddress as fd, isEventTypeExposed as fe, isFederatedAddress as ff, isHierarchicalAddress as fg, isOrphanedAgent as fh, isScopeExposed as fi, isSuccessResponse as fj, mapVisibilityToRule as fk, ndJsonStream as fl, resolveAgentPermissions as fm, waitForOpen as fn, websocketStream as fo, type SystemExposure as fp, type FederationConnectResponseResult as g, type FederationRouteResponseResult as h, type ConnectionState as i, type ParticipantId as j, type ParticipantType as k, type ScopeId as l, type Agent as m, type Scope as n, type Address as o, type SubscriptionFilter as p, type Event as q, type AgentsGetResponseResult as r, type AgentsListResponseResult as s, type AgentsRegisterResponseResult as t, type AgentsSpawnResponseResult as u, type AgentsUnregisterResponseResult as v, type AgentsUpdateResponseResult as w, type ProtocolVersion as x, type SessionInfo as y, type ScopesCreateResponseResult as z };