@multi-agent-protocol/sdk 0.0.3 → 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 */
@@ -739,6 +769,8 @@ interface ConnectRequestParams {
739
769
  name?: string;
740
770
  capabilities?: ParticipantCapabilities;
741
771
  sessionId?: SessionId;
772
+ /** Token to resume a previously disconnected session */
773
+ resumeToken?: string;
742
774
  /** Reclaim orphaned agents from previous connection */
743
775
  reclaimAgents?: AgentId[];
744
776
  /** Policy for unexpected disconnect */
@@ -777,6 +809,8 @@ interface DisconnectRequest extends MAPRequestBase<DisconnectRequestParams> {
777
809
  }
778
810
  interface DisconnectResponseResult {
779
811
  session: SessionInfo;
812
+ /** Token to resume this session later */
813
+ resumeToken?: string;
780
814
  _meta?: Meta;
781
815
  }
782
816
  interface SessionListRequestParams {
@@ -1767,8 +1801,6 @@ declare function isSuccessResponse<T>(response: MAPResponse<T>): response is MAP
1767
1801
  declare function isDirectAddress(address: Address): address is DirectAddress;
1768
1802
  /** Check if an address is a federated address */
1769
1803
  declare function isFederatedAddress(address: Address): address is FederatedAddress;
1770
- /** Check if an address is a scope address */
1771
- declare function isScopeAddress(address: Address): address is ScopeAddress;
1772
1804
  /** Check if an address is a broadcast address */
1773
1805
  declare function isBroadcastAddress(address: Address): address is BroadcastAddress;
1774
1806
  /** Check if an address is a hierarchical address */
@@ -1808,6 +1840,15 @@ declare function ndJsonStream(readable: ReadableStream<Uint8Array>, writable: Wr
1808
1840
  * @returns Stream interface for MAP messages
1809
1841
  */
1810
1842
  declare function websocketStream(ws: WebSocket): Stream;
1843
+ /**
1844
+ * Wait for a WebSocket to open with timeout.
1845
+ *
1846
+ * @param ws - WebSocket instance
1847
+ * @param timeoutMs - Timeout in milliseconds (default: 10000)
1848
+ * @returns Promise that resolves when WebSocket is open
1849
+ * @throws Error if connection times out or fails
1850
+ */
1851
+ declare function waitForOpen(ws: WebSocket, timeoutMs?: number): Promise<void>;
1811
1852
  /**
1812
1853
  * Creates a pair of connected in-memory streams for testing.
1813
1854
  *
@@ -2110,6 +2151,1156 @@ declare class BaseConnection {
2110
2151
  close(): Promise<void>;
2111
2152
  }
2112
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
+
2113
3304
  /**
2114
3305
  * Client connection for MAP protocol
2115
3306
  *
@@ -2166,6 +3357,29 @@ interface ClientConnectionOptions extends BaseConnectionOptions {
2166
3357
  /** Reconnection options */
2167
3358
  reconnection?: ReconnectionOptions;
2168
3359
  }
3360
+ /**
3361
+ * Options for ClientConnection.connect() static method
3362
+ */
3363
+ interface ClientConnectOptions {
3364
+ /** Client name for identification */
3365
+ name?: string;
3366
+ /** Client capabilities to advertise */
3367
+ capabilities?: ParticipantCapabilities;
3368
+ /** Authentication credentials */
3369
+ auth?: {
3370
+ method: 'bearer' | 'api-key' | 'mtls' | 'none';
3371
+ token?: string;
3372
+ };
3373
+ /**
3374
+ * Reconnection configuration.
3375
+ * - `true` = enable with defaults
3376
+ * - `false` or omitted = disabled
3377
+ * - `ReconnectionOptions` = enable with custom settings
3378
+ */
3379
+ reconnection?: boolean | ReconnectionOptions;
3380
+ /** Connection timeout in ms (default: 10000) */
3381
+ connectTimeout?: number;
3382
+ }
2169
3383
  /**
2170
3384
  * Client connection to a MAP system.
2171
3385
  *
@@ -2178,11 +3392,38 @@ interface ClientConnectionOptions extends BaseConnectionOptions {
2178
3392
  declare class ClientConnection {
2179
3393
  #private;
2180
3394
  constructor(stream: Stream, options?: ClientConnectionOptions);
3395
+ /**
3396
+ * Connect to a MAP server via WebSocket URL.
3397
+ *
3398
+ * Handles:
3399
+ * - WebSocket creation and connection
3400
+ * - Stream wrapping
3401
+ * - Auto-configuration of createStream for reconnection
3402
+ * - Initial MAP protocol connect handshake
3403
+ *
3404
+ * @param url - WebSocket URL (ws:// or wss://)
3405
+ * @param options - Connection options
3406
+ * @returns Connected ClientConnection instance
3407
+ *
3408
+ * @example
3409
+ * ```typescript
3410
+ * const client = await ClientConnection.connect('ws://localhost:8080', {
3411
+ * name: 'MyClient',
3412
+ * reconnection: true
3413
+ * });
3414
+ *
3415
+ * // Already connected, ready to use
3416
+ * const agents = await client.listAgents();
3417
+ * ```
3418
+ */
3419
+ static connect(url: string, options?: ClientConnectOptions): Promise<ClientConnection>;
2181
3420
  /**
2182
3421
  * Connect to the MAP system
2183
3422
  */
2184
3423
  connect(options?: {
2185
3424
  sessionId?: SessionId;
3425
+ /** Token to resume a previously disconnected session */
3426
+ resumeToken?: string;
2186
3427
  auth?: {
2187
3428
  method: 'bearer' | 'api-key' | 'mtls' | 'none';
2188
3429
  token?: string;
@@ -2190,8 +3431,10 @@ declare class ClientConnection {
2190
3431
  }): Promise<ConnectResponseResult>;
2191
3432
  /**
2192
3433
  * Disconnect from the MAP system
3434
+ * @param reason - Optional reason for disconnecting
3435
+ * @returns Resume token that can be used to resume this session later
2193
3436
  */
2194
- disconnect(reason?: string): Promise<void>;
3437
+ disconnect(reason?: string): Promise<string | undefined>;
2195
3438
  /**
2196
3439
  * Whether the client is connected
2197
3440
  */
@@ -2283,6 +3526,51 @@ declare class ClientConnection {
2283
3526
  timeout?: number;
2284
3527
  meta?: MessageMeta;
2285
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>;
2286
3574
  /**
2287
3575
  * Subscribe to events
2288
3576
  */
@@ -2467,6 +3755,39 @@ interface AgentConnectionOptions extends BaseConnectionOptions {
2467
3755
  /** Reconnection options */
2468
3756
  reconnection?: AgentReconnectionOptions;
2469
3757
  }
3758
+ /**
3759
+ * Options for AgentConnection.connect() static method
3760
+ */
3761
+ interface AgentConnectOptions {
3762
+ /** Agent name */
3763
+ name?: string;
3764
+ /** Agent role */
3765
+ role?: string;
3766
+ /** Agent capabilities to advertise */
3767
+ capabilities?: ParticipantCapabilities;
3768
+ /** Agent visibility settings */
3769
+ visibility?: AgentVisibility;
3770
+ /** Parent agent ID (for child agents) */
3771
+ parent?: AgentId;
3772
+ /** Initial scopes to join */
3773
+ scopes?: ScopeId[];
3774
+ /** Initial metadata */
3775
+ metadata?: Record<string, unknown>;
3776
+ /** Authentication credentials */
3777
+ auth?: {
3778
+ method: 'bearer' | 'api-key' | 'mtls' | 'none';
3779
+ token?: string;
3780
+ };
3781
+ /**
3782
+ * Reconnection configuration.
3783
+ * - `true` = enable with defaults
3784
+ * - `false` or omitted = disabled
3785
+ * - `AgentReconnectionOptions` = enable with custom settings
3786
+ */
3787
+ reconnection?: boolean | AgentReconnectionOptions;
3788
+ /** Connection timeout in ms (default: 10000) */
3789
+ connectTimeout?: number;
3790
+ }
2470
3791
  /**
2471
3792
  * Agent connection to a MAP system.
2472
3793
  *
@@ -2481,11 +3802,41 @@ interface AgentConnectionOptions extends BaseConnectionOptions {
2481
3802
  declare class AgentConnection {
2482
3803
  #private;
2483
3804
  constructor(stream: Stream, options?: AgentConnectionOptions);
3805
+ /**
3806
+ * Connect and register an agent via WebSocket URL.
3807
+ *
3808
+ * Handles:
3809
+ * - WebSocket creation and connection
3810
+ * - Stream wrapping
3811
+ * - Auto-configuration of createStream for reconnection
3812
+ * - Initial MAP protocol connect handshake
3813
+ * - Agent registration
3814
+ *
3815
+ * @param url - WebSocket URL (ws:// or wss://)
3816
+ * @param options - Connection and agent options
3817
+ * @returns Connected and registered AgentConnection instance
3818
+ *
3819
+ * @example
3820
+ * ```typescript
3821
+ * const agent = await AgentConnection.connect('ws://localhost:8080', {
3822
+ * name: 'Worker',
3823
+ * role: 'processor',
3824
+ * reconnection: true
3825
+ * });
3826
+ *
3827
+ * // Already registered, ready to work
3828
+ * agent.onMessage(handleMessage);
3829
+ * await agent.busy();
3830
+ * ```
3831
+ */
3832
+ static connect(url: string, options?: AgentConnectOptions): Promise<AgentConnection>;
2484
3833
  /**
2485
3834
  * Connect and register with the MAP system
2486
3835
  */
2487
3836
  connect(options?: {
2488
3837
  agentId?: AgentId;
3838
+ /** Token to resume a previously disconnected session */
3839
+ resumeToken?: string;
2489
3840
  auth?: {
2490
3841
  method: 'bearer' | 'api-key' | 'mtls' | 'none';
2491
3842
  token?: string;
@@ -2496,8 +3847,10 @@ declare class AgentConnection {
2496
3847
  }>;
2497
3848
  /**
2498
3849
  * Disconnect from the MAP system
3850
+ * @param reason - Optional reason for disconnecting
3851
+ * @returns Resume token that can be used to resume this session later
2499
3852
  */
2500
- disconnect(reason?: string): Promise<void>;
3853
+ disconnect(reason?: string): Promise<string | undefined>;
2501
3854
  /**
2502
3855
  * Whether the agent is connected
2503
3856
  */
@@ -3049,4 +4402,4 @@ declare function canAgentMessageAgent(senderAgent: Agent, targetAgentId: AgentId
3049
4402
  sharedScopes?: ScopeId[];
3050
4403
  }, config?: AgentPermissionConfig): boolean;
3051
4404
 
3052
- export { type AgentMessagingRule 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, AgentConnection as X, type AgentConnectionOptions as Y, type AgentIncludeOptions as Z, type AgentLifecycle as _, type MAPErrorData as a, type FederationAuth as a$, type AgentPermissionConfig as a0, type AgentPermissions as a1, type AgentReconnectionEventHandler as a2, type AgentReconnectionEventType as a3, type AgentReconnectionOptions as a4, type AgentRelationship as a5, type AgentRelationshipType as a6, type AgentState as a7, type AgentVisibility as a8, type AgentVisibilityRule as a9, type AuthRefreshRequestParams as aA, type AuthRefreshResponseResult as aB, BaseConnection as aC, type BroadcastAddress as aD, CAPABILITY_REQUIREMENTS as aE, CORE_METHODS as aF, type ClientAcceptanceRule as aG, ClientConnection as aH, type ClientConnectionOptions as aI, type ConnectRequest as aJ, type ConnectRequestParams as aK, type CorrelationId as aL, DEFAULT_AGENT_PERMISSION_CONFIG as aM, type DeliverySemantics as aN, type DirectAddress as aO, type DisconnectPolicy as aP, type DisconnectRequest as aQ, type DisconnectRequestParams as aR, ERROR_CODES as aS, EVENT_TYPES as aT, EXTENSION_METHODS as aU, type EventInput as aV, type EventNotification as aW, type EventNotificationParams as aX, FEDERATION_ERROR_CODES as aY, FEDERATION_METHODS as aZ, type FederatedAddress as a_, type AgentsGetRequest as aa, type AgentsGetRequestParams as ab, type AgentsListFilter as ac, type AgentsListRequest as ad, type AgentsListRequestParams as ae, type AgentsRegisterRequest as af, type AgentsRegisterRequestParams as ag, type AgentsResumeRequest as ah, type AgentsResumeRequestParams as ai, type AgentsResumeResponseResult as aj, type AgentsSpawnRequest as ak, type AgentsSpawnRequestParams as al, type AgentsStopRequest as am, type AgentsStopRequestParams as an, type AgentsStopResponseResult as ao, type AgentsSuspendRequest as ap, type AgentsSuspendRequestParams as aq, type AgentsSuspendResponseResult as ar, type AgentsUnregisterRequest as as, type AgentsUnregisterRequestParams as at, type AgentsUpdateRequest as au, type AgentsUpdateRequestParams as av, type AnyMessage as aw, type AuthMethod as ax, type AuthParams as ay, type AuthRefreshRequest as az, type FederationEnvelope as b, type ReconnectionEventType as b$, type FederationConnectRequest as b0, type FederationConnectRequestParams as b1, type FederationMetadata as b2, type FederationReplayConfig as b3, type FederationRouteRequest as b4, type FederationRouteRequestParams as b5, type GatewayReconnectionEvent as b6, type GatewayReconnectionEventHandler as b7, type GatewayReconnectionEventType as b8, type GatewayReconnectionOptions as b9, type MessageSentEventData as bA, type MessageVisibility as bB, type Meta as bC, type MultiAddress as bD, NOTIFICATION_METHODS as bE, type NotificationHandler as bF, OBSERVATION_METHODS as bG, type OverflowHandler as bH, type OverflowInfo as bI, PERMISSION_METHODS as bJ, PROTOCOL_ERROR_CODES as bK, PROTOCOL_VERSION as bL, type Participant as bM, type ParticipantAddress as bN, type PermissionAction as bO, type PermissionContext as bP, type PermissionParticipant as bQ, type PermissionResult as bR, type PermissionSystemConfig as bS, type PermissionsAgentUpdatedEventData as bT, type PermissionsClientUpdatedEventData as bU, type PermissionsUpdateRequest as bV, type PermissionsUpdateRequestParams as bW, type PermissionsUpdateResponseResult as bX, RESOURCE_ERROR_CODES as bY, ROUTING_ERROR_CODES as bZ, type ReconnectionEventHandler as b_, type GraphEdge as ba, type HierarchicalAddress as bb, type InjectDelivery as bc, type InjectDeliveryResult as bd, type InjectRequest as be, type InjectRequestParams as bf, type InjectResponseResult as bg, JSONRPC_VERSION as bh, type JoinPolicy as bi, LIFECYCLE_METHODS as bj, type MAPNotification as bk, type MAPNotificationBase as bl, type MAPRequest as bm, type MAPRequestBase as bn, type MAPResponse as bo, type MAPResponseError as bp, type MAPResponseSuccess as bq, MAP_METHODS as br, type MessageDeliveredEventData as bs, type MessageFailedEventData as bt, type MessageHandler as bu, type MessageMeta as bv, type MessageNotification as bw, type MessageNotificationParams as bx, type MessagePriority as by, type MessageRelationship as bz, type Message as c, type UnsubscribeRequestParams as c$, type ReconnectionOptions as c0, type ReplayRequest as c1, type ReplayRequestParams as c2, type ReplayResponseResult as c3, type ReplayedEvent as c4, type RequestHandler as c5, type RoleAddress as c6, SCOPE_METHODS as c7, SESSION_METHODS as c8, STATE_METHODS as c9, type SessionCloseRequest as cA, type SessionCloseRequestParams as cB, type SessionCloseResponseResult as cC, type SessionListRequest as cD, type SessionListRequestParams as cE, type SessionListResponseResult as cF, type SessionLoadRequest as cG, type SessionLoadRequestParams as cH, type SessionLoadResponseResult as cI, type StateChangeHandler as cJ, type StreamingCapabilities as cK, type StructureGraphRequest as cL, type StructureGraphRequestParams as cM, type StructureGraphResponseResult as cN, type StructureVisibilityRule as cO, type SubscribeRequest as cP, type SubscribeRequestParams as cQ, Subscription as cR, type SubscriptionAckNotification as cS, type SubscriptionAckParams as cT, type SubscriptionOptions$1 as cU, type SubscriptionState as cV, type SystemAcceptanceRule as cW, type SystemAddress as cX, type Timestamp as cY, type TransportType as cZ, type UnsubscribeRequest as c_, STEERING_METHODS as ca, STRUCTURE_METHODS as cb, type ScopeAddress as cc, type ScopeMessagingRule as cd, type ScopeVisibility as ce, type ScopeVisibilityRule as cf, type ScopesCreateRequest as cg, type ScopesCreateRequestParams as ch, type ScopesDeleteRequest as ci, type ScopesDeleteRequestParams as cj, type ScopesDeleteResponseResult as ck, type ScopesGetRequest as cl, type ScopesGetRequestParams as cm, type ScopesGetResponseResult as cn, type ScopesJoinRequest as co, type ScopesJoinRequestParams as cp, type ScopesLeaveRequest as cq, type ScopesLeaveRequestParams as cr, type ScopesListRequest as cs, type ScopesListRequestParams as ct, type ScopesMembersRequest as cu, type ScopesMembersRequestParams as cv, type ScopesMembersResponseResult as cw, type SendPolicy as cx, type SendRequest as cy, type SendRequestParams as cz, type FederationRoutingConfig as d, canAgentAcceptMessage as d0, canAgentMessageAgent as d1, canAgentSeeAgent as d2, canControlAgent as d3, canJoinScope as d4, canMessageAgent as d5, canPerformAction as d6, canPerformMethod as d7, canSeeAgent as d8, canSeeScope as d9, canSendToScope as da, createEvent as db, createStreamPair as dc, createSubscription as dd, deepMergePermissions as de, filterVisibleAgents as df, filterVisibleEvents as dg, filterVisibleScopes as dh, hasCapability as di, isAgentExposed as dj, isBroadcastAddress as dk, isDirectAddress as dl, isEventTypeExposed as dm, isFederatedAddress as dn, isHierarchicalAddress as dp, isOrphanedAgent as dq, isScopeAddress as dr, isScopeExposed as ds, isSuccessResponse as dt, mapVisibilityToRule as du, ndJsonStream as dv, resolveAgentPermissions as dw, websocketStream as dx, type SystemExposure as dy, 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 };