@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.
- package/dist/{index-C7XPWnxS.d.cts → index-DMcRbXOS.d.cts} +1358 -5
- package/dist/{index-C7XPWnxS.d.ts → index-DMcRbXOS.d.ts} +1358 -5
- package/dist/index.cjs +1319 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +246 -15
- package/dist/index.d.ts +246 -15
- package/dist/index.js +1297 -15
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +1046 -159
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1046 -159
- package/dist/testing.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { R as RequestId, M as MAPError, a as MAPErrorData, E as ErrorCategory, F as FederationBufferConfig, b as FederationEnvelope, c as Message, S as Stream, B as BaseConnectionOptions, P as ParticipantCapabilities, d as FederationRoutingConfig, e as EventType, C as ConnectResponseResult, f as SessionId, g as FederationConnectResponseResult, h as FederationRouteResponseResult, i as ConnectionState, j as ParticipantId, k as ParticipantType, A as AgentId, l as ScopeId, m as Agent, n as Scope, o as Address, p as SubscriptionFilter, q as Event, r as AgentsGetResponseResult, s as AgentsListResponseResult, t as AgentsRegisterResponseResult, u as AgentsSpawnResponseResult, v as AgentsUnregisterResponseResult, w as AgentsUpdateResponseResult, x as ProtocolVersion, y as SessionInfo, D as DisconnectResponseResult, z as ScopesCreateResponseResult, G as ScopesJoinResponseResult, H as ScopesLeaveResponseResult, I as ScopesListResponseResult, J as MessageId, K as SendResponseResult, L as SubscriptionId, N as SubscribeResponseResult, U as UnsubscribeResponseResult } from './index-
|
|
2
|
-
export {
|
|
1
|
+
import { R as RequestId, M as MAPError, a as MAPErrorData, E as ErrorCategory, F as FederationBufferConfig, b as FederationEnvelope, c as Message, S as Stream, B as BaseConnectionOptions, P as ParticipantCapabilities, d as FederationRoutingConfig, e as EventType, C as ConnectResponseResult, f as SessionId, g as FederationConnectResponseResult, h as FederationRouteResponseResult, i as ConnectionState, j as ParticipantId, k as ParticipantType, A as AgentId, l as ScopeId, m as Agent, n as Scope, o as Address, p as SubscriptionFilter, q as Event, r as AgentsGetResponseResult, s as AgentsListResponseResult, t as AgentsRegisterResponseResult, u as AgentsSpawnResponseResult, v as AgentsUnregisterResponseResult, w as AgentsUpdateResponseResult, x as ProtocolVersion, y as SessionInfo, D as DisconnectResponseResult, z as ScopesCreateResponseResult, G as ScopesJoinResponseResult, H as ScopesLeaveResponseResult, I as ScopesListResponseResult, J as MessageId, K as SendResponseResult, L as SubscriptionId, N as SubscribeResponseResult, U as UnsubscribeResponseResult, O as AgentConnection, Q as ACPAgentHandler, T as ACPSessionNotification, V as ACPRequestPermissionRequest, W as ACPRequestPermissionResponse, X as ACPReadTextFileRequest, Y as ACPReadTextFileResponse, Z as ACPWriteTextFileRequest, _ as ACPWriteTextFileResponse, $ as ACPCreateTerminalRequest, a0 as ACPCreateTerminalResponse, a1 as ACPTerminalOutputRequest, a2 as ACPTerminalOutputResponse, a3 as ACPReleaseTerminalRequest, a4 as ACPReleaseTerminalResponse, a5 as ACPWaitForTerminalExitRequest, a6 as ACPWaitForTerminalExitResponse, a7 as ACPKillTerminalCommandRequest, a8 as ACPKillTerminalCommandResponse, a9 as ACPSessionId } from './index-DMcRbXOS.cjs';
|
|
2
|
+
export { aa as ACPAgentCapabilities, ab as ACPAgentContext, ac as ACPAnnotations, ad as ACPAudioContent, ae as ACPAuthMethod, af as ACPAuthenticateRequest, ag as ACPAuthenticateResponse, ah as ACPAvailableCommand, ai as ACPAvailableCommandsUpdate, aj as ACPBlobResourceContents, ak as ACPCancelNotification, al as ACPCancelledPermissionOutcome, am as ACPCapability, an as ACPClientCapabilities, ao as ACPClientHandlers, ap as ACPContent, aq as ACPContentBlock, ar as ACPContentChunk, as as ACPContext, at as ACPCurrentModeUpdate, au as ACPDiff, av as ACPEmbeddedResource, aw as ACPEnvVariable, ax as ACPEnvelope, ay as ACPError, az as ACPErrorCode, aA as ACPErrorObject, aB as ACPErrorResponse, aC as ACPFileSystemCapability, aD as ACPHttpHeader, aE as ACPImageContent, aF as ACPImplementation, aG as ACPInitializeRequest, aH as ACPInitializeResponse, aI as ACPLoadSessionRequest, aJ as ACPLoadSessionResponse, aK as ACPMcpCapabilities, aL as ACPMcpServer, aM as ACPMcpServerHttp, aN as ACPMcpServerSse, aO as ACPMcpServerStdio, aP as ACPMessage, aQ as ACPMeta, aR as ACPNewSessionRequest, aS as ACPNewSessionResponse, aT as ACPNotification, aU as ACPPermissionOption, aV as ACPPermissionOptionId, aW as ACPPermissionOptionKind, aX as ACPPlan, aY as ACPPlanEntry, aZ as ACPPlanEntryPriority, a_ as ACPPlanEntryStatus, a$ as ACPPromptCapabilities, b0 as ACPPromptRequest, b1 as ACPPromptResponse, b2 as ACPProtocolVersion, b3 as ACPRequest, b4 as ACPRequestId, b5 as ACPRequestPermissionOutcome, b6 as ACPResourceLink, b7 as ACPResponse, b8 as ACPRole, b9 as ACPSelectedPermissionOutcome, ba as ACPSessionCapabilities, bb as ACPSessionInfoUpdate, bc as ACPSessionMode, bd as ACPSessionModeId, be as ACPSessionModeState, bf as ACPSessionUpdate, bg as ACPSetSessionModeRequest, bh as ACPSetSessionModeResponse, bi as ACPStopReason, bj as ACPStreamConnection, bk as ACPStreamEvents, bl as ACPStreamOptions, bm as ACPSuccessResponse, bn as ACPTerminal, bo as ACPTerminalExitStatus, bp as ACPTextContent, bq as ACPTextResourceContents, br as ACPToolCall, bs as ACPToolCallContent, bt as ACPToolCallId, bu as ACPToolCallLocation, bv as ACPToolCallStatus, bw as ACPToolCallUpdate, bx as ACPToolKind, by as ACP_ERROR_CODES, bz as ACP_METHODS, bA as ACP_PROTOCOL_VERSION, bB as AGENT_ERROR_CODES, bC as AUTH_ERROR_CODES, bD as AUTH_METHODS, bE as AcceptanceContext, bF as AgentAcceptanceRule, bG as AgentConnectOptions, bH as AgentConnectionOptions, bI as AgentIncludeOptions, bJ as AgentLifecycle, bK as AgentMessagingRule, bL as AgentPermissionConfig, bM as AgentPermissions, bN as AgentReconnectionEventHandler, bO as AgentReconnectionEventType, bP as AgentReconnectionOptions, bQ as AgentRelationship, bR as AgentRelationshipType, bS as AgentState, bT as AgentVisibility, bU as AgentVisibilityRule, bV as AgentsGetRequest, bW as AgentsGetRequestParams, bX as AgentsListFilter, bY as AgentsListRequest, bZ as AgentsListRequestParams, b_ as AgentsRegisterRequest, b$ as AgentsRegisterRequestParams, c0 as AgentsResumeRequest, c1 as AgentsResumeRequestParams, c2 as AgentsResumeResponseResult, c3 as AgentsSpawnRequest, c4 as AgentsSpawnRequestParams, c5 as AgentsStopRequest, c6 as AgentsStopRequestParams, c7 as AgentsStopResponseResult, c8 as AgentsSuspendRequest, c9 as AgentsSuspendRequestParams, ca as AgentsSuspendResponseResult, cb as AgentsUnregisterRequest, cc as AgentsUnregisterRequestParams, cd as AgentsUpdateRequest, ce as AgentsUpdateRequestParams, cf as AnyMessage, cg as AuthMethod, ch as AuthParams, ci as AuthRefreshRequest, cj as AuthRefreshRequestParams, ck as AuthRefreshResponseResult, cl as BaseConnection, cm as BroadcastAddress, cn as CAPABILITY_REQUIREMENTS, co as CORE_METHODS, cp as ClientAcceptanceRule, cq as ClientConnectOptions, cr as ClientConnection, cs as ClientConnectionOptions, ct as ConnectRequest, cu as ConnectRequestParams, cv as CorrelationId, cw as DEFAULT_AGENT_PERMISSION_CONFIG, cx as DeliverySemantics, cy as DirectAddress, cz as DisconnectPolicy, cA as DisconnectRequest, cB as DisconnectRequestParams, cC as ERROR_CODES, cD as EVENT_TYPES, cE as EXTENSION_METHODS, cF as EventInput, cG as EventNotification, cH as EventNotificationParams, cI as FEDERATION_ERROR_CODES, cJ as FEDERATION_METHODS, cK as FederatedAddress, cL as FederationAuth, cM as FederationConnectRequest, cN as FederationConnectRequestParams, cO as FederationMetadata, cP as FederationReplayConfig, cQ as FederationRouteRequest, cR as FederationRouteRequestParams, cS as GatewayReconnectionEvent, cT as GatewayReconnectionEventHandler, cU as GatewayReconnectionEventType, cV as GatewayReconnectionOptions, cW as GraphEdge, cX as HierarchicalAddress, cY as InjectDelivery, cZ as InjectDeliveryResult, c_ as InjectRequest, c$ as InjectRequestParams, d0 as InjectResponseResult, d1 as JSONRPC_VERSION, d2 as JoinPolicy, d3 as LIFECYCLE_METHODS, d4 as MAPNotification, d5 as MAPNotificationBase, d6 as MAPRequest, d7 as MAPRequestBase, d8 as MAPResponse, d9 as MAPResponseError, da as MAPResponseSuccess, db as MAP_METHODS, dc as MessageDeliveredEventData, dd as MessageFailedEventData, de as MessageHandler, df as MessageMeta, dg as MessageNotification, dh as MessageNotificationParams, di as MessagePriority, dj as MessageRelationship, dk as MessageSentEventData, dl as MessageVisibility, dm as Meta, dn as MultiAddress, dp as NOTIFICATION_METHODS, dq as NotificationHandler, dr as OBSERVATION_METHODS, ds as OverflowHandler, dt as OverflowInfo, du as PERMISSION_METHODS, dv as PROTOCOL_ERROR_CODES, dw as PROTOCOL_VERSION, dx as Participant, dy as ParticipantAddress, dz as PermissionAction, dA as PermissionContext, dB as PermissionParticipant, dC as PermissionResult, dD as PermissionSystemConfig, dE as PermissionsAgentUpdatedEventData, dF as PermissionsClientUpdatedEventData, dG as PermissionsUpdateRequest, dH as PermissionsUpdateRequestParams, dI as PermissionsUpdateResponseResult, dJ as RESOURCE_ERROR_CODES, dK as ROUTING_ERROR_CODES, dL as ReconnectionEventHandler, dM as ReconnectionEventType, dN as ReconnectionOptions, dO as ReplayRequest, dP as ReplayRequestParams, dQ as ReplayResponseResult, dR as ReplayedEvent, dS as RequestHandler, dT as RoleAddress, dU as SCOPE_METHODS, dV as SESSION_METHODS, dW as STATE_METHODS, dX as STEERING_METHODS, dY as STRUCTURE_METHODS, dZ as ScopeAddress, d_ as ScopeMessagingRule, d$ as ScopeVisibility, e0 as ScopeVisibilityRule, e1 as ScopesCreateRequest, e2 as ScopesCreateRequestParams, e3 as ScopesDeleteRequest, e4 as ScopesDeleteRequestParams, e5 as ScopesDeleteResponseResult, e6 as ScopesGetRequest, e7 as ScopesGetRequestParams, e8 as ScopesGetResponseResult, e9 as ScopesJoinRequest, ea as ScopesJoinRequestParams, eb as ScopesLeaveRequest, ec as ScopesLeaveRequestParams, ed as ScopesListRequest, ee as ScopesListRequestParams, ef as ScopesMembersRequest, eg as ScopesMembersRequestParams, eh as ScopesMembersResponseResult, ei as SendPolicy, ej as SendRequest, ek as SendRequestParams, el as SessionCloseRequest, em as SessionCloseRequestParams, en as SessionCloseResponseResult, eo as SessionListRequest, ep as SessionListRequestParams, eq as SessionListResponseResult, er as SessionLoadRequest, es as SessionLoadRequestParams, et as SessionLoadResponseResult, eu as StateChangeHandler, ev as StreamingCapabilities, ew as StructureGraphRequest, ex as StructureGraphRequestParams, ey as StructureGraphResponseResult, ez as StructureVisibilityRule, eA as SubscribeRequest, eB as SubscribeRequestParams, eC as Subscription, eD as SubscriptionAckNotification, eE as SubscriptionAckParams, eF as SubscriptionOptions, eG as SubscriptionState, eH as SystemAcceptanceRule, eI as SystemAddress, eJ as Timestamp, eK as TransportType, eL as UnsubscribeRequest, eM as UnsubscribeRequestParams, eN as canAgentAcceptMessage, eO as canAgentMessageAgent, eP as canAgentSeeAgent, eQ as canControlAgent, eR as canJoinScope, eS as canMessageAgent, eT as canPerformAction, eU as canPerformMethod, eV as canSeeAgent, eW as canSeeScope, eX as canSendToScope, eY as createACPStream, eZ as createEvent, e_ as createStreamPair, e$ as createSubscription, f0 as deepMergePermissions, f1 as filterVisibleAgents, f2 as filterVisibleEvents, f3 as filterVisibleScopes, f4 as hasCapability, f5 as isACPEnvelope, f6 as isACPErrorResponse, f7 as isACPNotification, f8 as isACPRequest, f9 as isACPResponse, fa as isACPSuccessResponse, fb as isAgentExposed, fc as isBroadcastAddress, fd as isDirectAddress, fe as isEventTypeExposed, ff as isFederatedAddress, fg as isHierarchicalAddress, fh as isOrphanedAgent, fi as isScopeExposed, fj as isSuccessResponse, fk as mapVisibilityToRule, fl as ndJsonStream, fm as resolveAgentPermissions, fn as waitForOpen, fo as websocketStream } from './index-DMcRbXOS.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export { monotonicFactory, ulid } from 'ulid';
|
|
5
|
+
import 'events';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* JSON-RPC 2.0 utilities for MAP protocol
|
|
@@ -1117,6 +1118,7 @@ declare const AgentSchema: z.ZodObject<{
|
|
|
1117
1118
|
state: string;
|
|
1118
1119
|
role?: string | undefined;
|
|
1119
1120
|
parent?: string | undefined;
|
|
1121
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1120
1122
|
name?: string | undefined;
|
|
1121
1123
|
capabilities?: {
|
|
1122
1124
|
_meta?: Record<string, unknown> | undefined;
|
|
@@ -1141,7 +1143,6 @@ declare const AgentSchema: z.ZodObject<{
|
|
|
1141
1143
|
canStop?: boolean | undefined;
|
|
1142
1144
|
} | undefined;
|
|
1143
1145
|
} | undefined;
|
|
1144
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1145
1146
|
visibility?: "system" | "public" | "parent-only" | "scope" | undefined;
|
|
1146
1147
|
scopes?: string[] | undefined;
|
|
1147
1148
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -1166,6 +1167,7 @@ declare const AgentSchema: z.ZodObject<{
|
|
|
1166
1167
|
state: string;
|
|
1167
1168
|
role?: string | undefined;
|
|
1168
1169
|
parent?: string | undefined;
|
|
1170
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1169
1171
|
name?: string | undefined;
|
|
1170
1172
|
capabilities?: {
|
|
1171
1173
|
_meta?: Record<string, unknown> | undefined;
|
|
@@ -1190,7 +1192,6 @@ declare const AgentSchema: z.ZodObject<{
|
|
|
1190
1192
|
canStop?: boolean | undefined;
|
|
1191
1193
|
} | undefined;
|
|
1192
1194
|
} | undefined;
|
|
1193
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1194
1195
|
visibility?: "system" | "public" | "parent-only" | "scope" | undefined;
|
|
1195
1196
|
scopes?: string[] | undefined;
|
|
1196
1197
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -1226,8 +1227,8 @@ declare const ScopeSchema: z.ZodObject<{
|
|
|
1226
1227
|
id: string;
|
|
1227
1228
|
parent?: string | undefined;
|
|
1228
1229
|
children?: string[] | undefined;
|
|
1229
|
-
name?: string | undefined;
|
|
1230
1230
|
_meta?: Record<string, unknown> | undefined;
|
|
1231
|
+
name?: string | undefined;
|
|
1231
1232
|
visibility?: "public" | "private" | "unlisted" | undefined;
|
|
1232
1233
|
metadata?: Record<string, unknown> | undefined;
|
|
1233
1234
|
joinPolicy?: "open" | "invite" | "approval" | undefined;
|
|
@@ -1237,8 +1238,8 @@ declare const ScopeSchema: z.ZodObject<{
|
|
|
1237
1238
|
id: string;
|
|
1238
1239
|
parent?: string | undefined;
|
|
1239
1240
|
children?: string[] | undefined;
|
|
1240
|
-
name?: string | undefined;
|
|
1241
1241
|
_meta?: Record<string, unknown> | undefined;
|
|
1242
|
+
name?: string | undefined;
|
|
1242
1243
|
visibility?: "public" | "private" | "unlisted" | undefined;
|
|
1243
1244
|
metadata?: Record<string, unknown> | undefined;
|
|
1244
1245
|
joinPolicy?: "open" | "invite" | "approval" | undefined;
|
|
@@ -1257,8 +1258,8 @@ declare const MessageMetaSchema: z.ZodObject<{
|
|
|
1257
1258
|
isResult: z.ZodOptional<z.ZodBoolean>;
|
|
1258
1259
|
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1259
1260
|
}, "strict", z.ZodTypeAny, {
|
|
1260
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1261
1261
|
correlationId?: string | undefined;
|
|
1262
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1262
1263
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1263
1264
|
isResult?: boolean | undefined;
|
|
1264
1265
|
causationId?: string | undefined;
|
|
@@ -1268,8 +1269,8 @@ declare const MessageMetaSchema: z.ZodObject<{
|
|
|
1268
1269
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1269
1270
|
expiresAt?: number | undefined;
|
|
1270
1271
|
}, {
|
|
1271
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1272
1272
|
correlationId?: string | undefined;
|
|
1273
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1273
1274
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1274
1275
|
isResult?: boolean | undefined;
|
|
1275
1276
|
causationId?: string | undefined;
|
|
@@ -1297,8 +1298,8 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1297
1298
|
isResult: z.ZodOptional<z.ZodBoolean>;
|
|
1298
1299
|
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1299
1300
|
}, "strict", z.ZodTypeAny, {
|
|
1300
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1301
1301
|
correlationId?: string | undefined;
|
|
1302
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1302
1303
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1303
1304
|
isResult?: boolean | undefined;
|
|
1304
1305
|
causationId?: string | undefined;
|
|
@@ -1308,8 +1309,8 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1308
1309
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1309
1310
|
expiresAt?: number | undefined;
|
|
1310
1311
|
}, {
|
|
1311
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1312
1312
|
correlationId?: string | undefined;
|
|
1313
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1313
1314
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1314
1315
|
isResult?: boolean | undefined;
|
|
1315
1316
|
causationId?: string | undefined;
|
|
@@ -1324,10 +1325,11 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1324
1325
|
id: string;
|
|
1325
1326
|
timestamp: number;
|
|
1326
1327
|
from: string;
|
|
1328
|
+
payload?: unknown;
|
|
1327
1329
|
_meta?: Record<string, unknown> | undefined;
|
|
1328
1330
|
meta?: {
|
|
1329
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1330
1331
|
correlationId?: string | undefined;
|
|
1332
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1331
1333
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1332
1334
|
isResult?: boolean | undefined;
|
|
1333
1335
|
causationId?: string | undefined;
|
|
@@ -1337,16 +1339,16 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1337
1339
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1338
1340
|
expiresAt?: number | undefined;
|
|
1339
1341
|
} | undefined;
|
|
1340
|
-
payload?: unknown;
|
|
1341
1342
|
to?: unknown;
|
|
1342
1343
|
}, {
|
|
1343
1344
|
id: string;
|
|
1344
1345
|
timestamp: number;
|
|
1345
1346
|
from: string;
|
|
1347
|
+
payload?: unknown;
|
|
1346
1348
|
_meta?: Record<string, unknown> | undefined;
|
|
1347
1349
|
meta?: {
|
|
1348
|
-
_meta?: Record<string, unknown> | undefined;
|
|
1349
1350
|
correlationId?: string | undefined;
|
|
1351
|
+
_meta?: Record<string, unknown> | undefined;
|
|
1350
1352
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1351
1353
|
isResult?: boolean | undefined;
|
|
1352
1354
|
causationId?: string | undefined;
|
|
@@ -1356,7 +1358,6 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1356
1358
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1357
1359
|
expiresAt?: number | undefined;
|
|
1358
1360
|
} | undefined;
|
|
1359
|
-
payload?: unknown;
|
|
1360
1361
|
to?: unknown;
|
|
1361
1362
|
}>;
|
|
1362
1363
|
declare const EventSchema: z.ZodObject<{
|
|
@@ -2017,6 +2018,12 @@ interface CausalEvent {
|
|
|
2017
2018
|
/** Timestamp when the event was received */
|
|
2018
2019
|
receivedAt?: number;
|
|
2019
2020
|
}
|
|
2021
|
+
/**
|
|
2022
|
+
* Mode for handling events with multiple causal dependencies.
|
|
2023
|
+
* - "all": Wait for ALL causes before releasing (stricter, default)
|
|
2024
|
+
* - "any": Release when ANY cause is seen (more permissive)
|
|
2025
|
+
*/
|
|
2026
|
+
type MultiCauseMode = "all" | "any";
|
|
2020
2027
|
/**
|
|
2021
2028
|
* Options for CausalEventBuffer
|
|
2022
2029
|
*/
|
|
@@ -2031,6 +2038,12 @@ interface CausalEventBufferOptions {
|
|
|
2031
2038
|
* Default: 1000. Prevents unbounded memory growth.
|
|
2032
2039
|
*/
|
|
2033
2040
|
maxBufferSize?: number;
|
|
2041
|
+
/**
|
|
2042
|
+
* Mode for handling events with multiple causes.
|
|
2043
|
+
* - "all" (default): Wait for ALL causes before releasing
|
|
2044
|
+
* - "any": Release when ANY cause is seen
|
|
2045
|
+
*/
|
|
2046
|
+
multiCauseMode?: MultiCauseMode;
|
|
2034
2047
|
/**
|
|
2035
2048
|
* Callback when an event is released despite missing predecessors (timeout or buffer overflow).
|
|
2036
2049
|
*/
|
|
@@ -2077,6 +2090,10 @@ interface CausalBufferPushResult {
|
|
|
2077
2090
|
declare class CausalEventBuffer {
|
|
2078
2091
|
#private;
|
|
2079
2092
|
constructor(options?: CausalEventBufferOptions);
|
|
2093
|
+
/**
|
|
2094
|
+
* Get the current multi-cause mode.
|
|
2095
|
+
*/
|
|
2096
|
+
get multiCauseMode(): MultiCauseMode;
|
|
2080
2097
|
/**
|
|
2081
2098
|
* Push an event into the buffer.
|
|
2082
2099
|
*
|
|
@@ -2285,4 +2302,218 @@ declare function isValidEnvelope(obj: unknown): obj is FederationEnvelope<unknow
|
|
|
2285
2302
|
*/
|
|
2286
2303
|
declare function withPayload<T, U>(envelope: FederationEnvelope<T>, newPayload: U): FederationEnvelope<U>;
|
|
2287
2304
|
|
|
2288
|
-
|
|
2305
|
+
/**
|
|
2306
|
+
* Address utilities for recipient disambiguation
|
|
2307
|
+
*
|
|
2308
|
+
* Provides utilities for parsing and formatting message addresses
|
|
2309
|
+
* with type prefixes to distinguish between agent and scope recipients.
|
|
2310
|
+
*
|
|
2311
|
+
* Format: "{type}:{id}"
|
|
2312
|
+
* - agent:abc123 -> agent recipient
|
|
2313
|
+
* - scope:room-1 -> scope recipient
|
|
2314
|
+
*/
|
|
2315
|
+
/** Valid address types */
|
|
2316
|
+
type AddressType = "agent" | "scope";
|
|
2317
|
+
/** Parsed address components */
|
|
2318
|
+
interface AddressComponents {
|
|
2319
|
+
type: AddressType;
|
|
2320
|
+
id: string;
|
|
2321
|
+
}
|
|
2322
|
+
/**
|
|
2323
|
+
* Error thrown when an address format is invalid.
|
|
2324
|
+
*/
|
|
2325
|
+
declare class InvalidAddressError extends Error {
|
|
2326
|
+
constructor(address: string, reason: string);
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* Format an address with type prefix.
|
|
2330
|
+
*
|
|
2331
|
+
* @param type - The address type (agent or scope)
|
|
2332
|
+
* @param id - The entity ID
|
|
2333
|
+
* @returns Formatted address string
|
|
2334
|
+
* @throws InvalidAddressError if parameters are invalid
|
|
2335
|
+
*
|
|
2336
|
+
* @example
|
|
2337
|
+
* formatAddress("agent", "abc123") // "agent:abc123"
|
|
2338
|
+
* formatAddress("scope", "room-1") // "scope:room-1"
|
|
2339
|
+
*/
|
|
2340
|
+
declare function formatAddress(type: AddressType, id: string): string;
|
|
2341
|
+
/**
|
|
2342
|
+
* Parse an address string into its components.
|
|
2343
|
+
*
|
|
2344
|
+
* @param address - The address string to parse
|
|
2345
|
+
* @returns Parsed address components
|
|
2346
|
+
* @throws InvalidAddressError if format is invalid
|
|
2347
|
+
*
|
|
2348
|
+
* @example
|
|
2349
|
+
* parseAddress("agent:abc123") // { type: "agent", id: "abc123" }
|
|
2350
|
+
* parseAddress("scope:room-1") // { type: "scope", id: "room-1" }
|
|
2351
|
+
*/
|
|
2352
|
+
declare function parseAddress(address: string): AddressComponents;
|
|
2353
|
+
/**
|
|
2354
|
+
* Check if a string is a valid prefixed address.
|
|
2355
|
+
*
|
|
2356
|
+
* @param address - The string to check
|
|
2357
|
+
* @returns true if valid prefixed address format
|
|
2358
|
+
*
|
|
2359
|
+
* @example
|
|
2360
|
+
* isAddress("agent:abc123") // true
|
|
2361
|
+
* isAddress("scope:room-1") // true
|
|
2362
|
+
* isAddress("abc123") // false (no prefix)
|
|
2363
|
+
* isAddress("invalid:abc") // false (invalid type)
|
|
2364
|
+
*/
|
|
2365
|
+
declare function isAddress(address: string): boolean;
|
|
2366
|
+
/**
|
|
2367
|
+
* Check if an address is for an agent.
|
|
2368
|
+
*
|
|
2369
|
+
* @param address - The address string to check
|
|
2370
|
+
* @returns true if address is for an agent
|
|
2371
|
+
*/
|
|
2372
|
+
declare function isAgentAddress(address: string): boolean;
|
|
2373
|
+
/**
|
|
2374
|
+
* Check if an address is for a scope.
|
|
2375
|
+
*
|
|
2376
|
+
* @param address - The address string to check
|
|
2377
|
+
* @returns true if address is for a scope
|
|
2378
|
+
*/
|
|
2379
|
+
declare function isScopeAddress(address: string): boolean;
|
|
2380
|
+
/**
|
|
2381
|
+
* Extract the ID from an address, or return the original if not prefixed.
|
|
2382
|
+
*
|
|
2383
|
+
* Useful for backward compatibility when handling both prefixed and unprefixed addresses.
|
|
2384
|
+
*
|
|
2385
|
+
* @param address - The address string
|
|
2386
|
+
* @returns The extracted ID or the original string
|
|
2387
|
+
*/
|
|
2388
|
+
declare function extractId(address: string): string;
|
|
2389
|
+
/**
|
|
2390
|
+
* Extract the type from an address, or return undefined if not prefixed.
|
|
2391
|
+
*
|
|
2392
|
+
* @param address - The address string
|
|
2393
|
+
* @returns The address type or undefined
|
|
2394
|
+
*/
|
|
2395
|
+
declare function extractType(address: string): AddressType | undefined;
|
|
2396
|
+
/**
|
|
2397
|
+
* Convenience function to create an agent address.
|
|
2398
|
+
*
|
|
2399
|
+
* @param agentId - The agent ID
|
|
2400
|
+
* @returns Formatted agent address
|
|
2401
|
+
*/
|
|
2402
|
+
declare function toAgent(agentId: string): string;
|
|
2403
|
+
/**
|
|
2404
|
+
* Convenience function to create a scope address.
|
|
2405
|
+
*
|
|
2406
|
+
* @param scopeId - The scope ID
|
|
2407
|
+
* @returns Formatted scope address
|
|
2408
|
+
*/
|
|
2409
|
+
declare function toScope(scopeId: string): string;
|
|
2410
|
+
|
|
2411
|
+
/**
|
|
2412
|
+
* ACPAgentAdapter - Agent-side helper for ACP-over-MAP.
|
|
2413
|
+
*
|
|
2414
|
+
* Simplifies implementing ACP-compatible agents by handling the
|
|
2415
|
+
* MAP↔ACP translation layer automatically.
|
|
2416
|
+
*
|
|
2417
|
+
* @module
|
|
2418
|
+
*/
|
|
2419
|
+
|
|
2420
|
+
/**
|
|
2421
|
+
* Adapter for implementing ACP-compatible agents.
|
|
2422
|
+
*
|
|
2423
|
+
* Handles the ACP envelope protocol, request routing, and provides
|
|
2424
|
+
* helper methods for agent→client communication.
|
|
2425
|
+
*
|
|
2426
|
+
* @example
|
|
2427
|
+
* ```typescript
|
|
2428
|
+
* const mapAgent = await AgentConnection.connect('ws://localhost:8080', {
|
|
2429
|
+
* name: 'CodingAgent',
|
|
2430
|
+
* capabilities: { protocols: ['acp'], acp: { version: '2024-10-07' } }
|
|
2431
|
+
* });
|
|
2432
|
+
*
|
|
2433
|
+
* const adapter = new ACPAgentAdapter(mapAgent, {
|
|
2434
|
+
* initialize: async (params, ctx) => ({
|
|
2435
|
+
* protocolVersion: 20241007,
|
|
2436
|
+
* agentInfo: { name: 'CodingAgent', version: '1.0.0' },
|
|
2437
|
+
* agentCapabilities: { loadSession: true }
|
|
2438
|
+
* }),
|
|
2439
|
+
* newSession: async (params, ctx) => ({
|
|
2440
|
+
* sessionId: generateId()
|
|
2441
|
+
* }),
|
|
2442
|
+
* prompt: async (params, ctx) => {
|
|
2443
|
+
* await adapter.sendSessionUpdate(ctx.streamId, {
|
|
2444
|
+
* sessionId: params.sessionId,
|
|
2445
|
+
* update: { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: 'Hello!' } }
|
|
2446
|
+
* });
|
|
2447
|
+
* return { stopReason: 'end_turn' };
|
|
2448
|
+
* },
|
|
2449
|
+
* cancel: async (params, ctx) => {}
|
|
2450
|
+
* });
|
|
2451
|
+
* ```
|
|
2452
|
+
*/
|
|
2453
|
+
declare class ACPAgentAdapter {
|
|
2454
|
+
#private;
|
|
2455
|
+
/**
|
|
2456
|
+
* Create a new ACP agent adapter.
|
|
2457
|
+
*
|
|
2458
|
+
* @param mapAgent - The underlying MAP agent connection
|
|
2459
|
+
* @param handler - Handler implementing ACP agent methods
|
|
2460
|
+
* @param options - Optional configuration
|
|
2461
|
+
*/
|
|
2462
|
+
constructor(mapAgent: AgentConnection, handler: ACPAgentHandler, options?: {
|
|
2463
|
+
clientRequestTimeout?: number;
|
|
2464
|
+
});
|
|
2465
|
+
/**
|
|
2466
|
+
* Send a session update notification to the client.
|
|
2467
|
+
*/
|
|
2468
|
+
sendSessionUpdate(streamId: string, notification: ACPSessionNotification): Promise<void>;
|
|
2469
|
+
/**
|
|
2470
|
+
* Request permission from the client.
|
|
2471
|
+
*/
|
|
2472
|
+
requestPermission(streamId: string, request: ACPRequestPermissionRequest): Promise<ACPRequestPermissionResponse>;
|
|
2473
|
+
/**
|
|
2474
|
+
* Read a text file from the client.
|
|
2475
|
+
*/
|
|
2476
|
+
readTextFile(streamId: string, request: ACPReadTextFileRequest): Promise<ACPReadTextFileResponse>;
|
|
2477
|
+
/**
|
|
2478
|
+
* Write a text file on the client.
|
|
2479
|
+
*/
|
|
2480
|
+
writeTextFile(streamId: string, request: ACPWriteTextFileRequest): Promise<ACPWriteTextFileResponse>;
|
|
2481
|
+
/**
|
|
2482
|
+
* Create a terminal on the client.
|
|
2483
|
+
*/
|
|
2484
|
+
createTerminal(streamId: string, request: ACPCreateTerminalRequest): Promise<ACPCreateTerminalResponse>;
|
|
2485
|
+
/**
|
|
2486
|
+
* Get terminal output from the client.
|
|
2487
|
+
*/
|
|
2488
|
+
terminalOutput(streamId: string, request: ACPTerminalOutputRequest): Promise<ACPTerminalOutputResponse>;
|
|
2489
|
+
/**
|
|
2490
|
+
* Release a terminal on the client.
|
|
2491
|
+
*/
|
|
2492
|
+
releaseTerminal(streamId: string, request: ACPReleaseTerminalRequest): Promise<ACPReleaseTerminalResponse>;
|
|
2493
|
+
/**
|
|
2494
|
+
* Wait for a terminal to exit on the client.
|
|
2495
|
+
*/
|
|
2496
|
+
waitForTerminalExit(streamId: string, request: ACPWaitForTerminalExitRequest): Promise<ACPWaitForTerminalExitResponse>;
|
|
2497
|
+
/**
|
|
2498
|
+
* Kill a terminal command on the client.
|
|
2499
|
+
*/
|
|
2500
|
+
killTerminal(streamId: string, request: ACPKillTerminalCommandRequest): Promise<ACPKillTerminalCommandResponse>;
|
|
2501
|
+
/**
|
|
2502
|
+
* Get the current session ID for a stream.
|
|
2503
|
+
*/
|
|
2504
|
+
getSessionId(streamId: string): ACPSessionId | null;
|
|
2505
|
+
/**
|
|
2506
|
+
* Get the client participant ID for a stream.
|
|
2507
|
+
*/
|
|
2508
|
+
getClientParticipantId(streamId: string): ParticipantId | undefined;
|
|
2509
|
+
/**
|
|
2510
|
+
* Check if a stream is active.
|
|
2511
|
+
*/
|
|
2512
|
+
hasStream(streamId: string): boolean;
|
|
2513
|
+
/**
|
|
2514
|
+
* Remove a stream context (e.g., on disconnect).
|
|
2515
|
+
*/
|
|
2516
|
+
removeStream(streamId: string): boolean;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
export { ACPAgentAdapter, ACPAgentHandler, ACPCreateTerminalRequest, ACPCreateTerminalResponse, ACPKillTerminalCommandRequest, ACPKillTerminalCommandResponse, ACPReadTextFileRequest, ACPReadTextFileResponse, ACPReleaseTerminalRequest, ACPReleaseTerminalResponse, ACPRequestPermissionRequest, ACPRequestPermissionResponse, ACPSessionId, ACPSessionNotification, ACPTerminalOutputRequest, ACPTerminalOutputResponse, ACPWaitForTerminalExitRequest, ACPWaitForTerminalExitResponse, ACPWriteTextFileRequest, ACPWriteTextFileResponse, Address, type AddressComponents, AddressSchema, type AddressType, type AddressValidated, Agent, AgentConnection, type AgentExposure, AgentId, AgentIdSchema, type AgentIdValidated, AgentLifecycleSchema, AgentRelationshipSchema, AgentSchema, AgentStateSchema, type AgentStateValidated, type AgentValidated, AgentVisibilitySchema, AgentsGetResponseResult, AgentsListResponseResult, AgentsRegisterResponseResult, AgentsSpawnResponseResult, AgentsUnregisterResponseResult, AgentsUpdateResponseResult, BaseConnectionOptions, BroadcastAddressSchema, type CapabilityPath, type CausalBufferPushResult, type CausalEvent, CausalEventBuffer, type CausalEventBufferOptions, ConnectResponseResult, type ConnectedParticipant, ConnectionState, CorrelationIdSchema, type CreateEnvelopeOptions, DEFAULT_RETRY_POLICY, DeliverySemanticsSchema, DirectAddressSchema, DisconnectResponseResult, ErrorCategory, ErrorCategorySchema, Event, type EventExposure, EventSchema, EventType, EventTypeSchema, type EventValidated, FederatedAddressSchema, FederationBufferConfig, FederationConnectResponseResult, FederationEnvelope, FederationOutageBuffer, FederationRouteResponseResult, FederationRoutingConfig, GatewayConnection, type GatewayConnectionOptions, HierarchicalAddressSchema, InvalidAddressError, JsonRpcVersionSchema, MAPConnectionError, MAPError, MAPErrorData, MAPErrorDataSchema, MAPErrorSchema, type MAPErrorValidated, MAPNotificationSchema, type MAPNotificationValidated, MAPRequestError, MAPRequestSchema, type MAPRequestValidated, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, type MAPResponseValidated, type MAPRouter, type MAPRouterConfig, type MAPRouterFactory, MAPTimeoutError, METHOD_REGISTRY, Message, MessageId, MessageIdSchema, type MessageIdValidated, MessageMetaSchema, MessagePrioritySchema, MessageRelationshipSchema, MessageSchema, type MessageValidated, MessageVisibilitySchema, MetaSchema, type MethodCategory, type MethodInfo, MultiAddressSchema, ParticipantAddressSchema, ParticipantCapabilities, ParticipantCapabilitiesSchema, type ParticipantCapabilitiesValidated, ParticipantId, ParticipantIdSchema, type ParticipantIdValidated, ParticipantType, ParticipantTypeSchema, type ParticipantTypeValidated, type PeerBufferStats, type ProcessEnvelopeResult, ProtocolVersion, ProtocolVersionSchema, RequestId, RequestIdSchema, type RetryCallbacks, type RetryPolicy, type RetryState, RoleAddressSchema, type RouterLimits, Scope, ScopeAddressSchema, type ScopeExposure, ScopeId, ScopeIdSchema, type ScopeIdValidated, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, type ScopeValidated, ScopeVisibilitySchema, ScopesCreateResponseResult, ScopesJoinResponseResult, ScopesLeaveResponseResult, ScopesListResponseResult, SendResponseResult, SessionId, SessionIdSchema, type SessionIdValidated, SessionInfo, Stream, SubscribeResponseResult, SubscriptionFilter, SubscriptionFilterSchema, type SubscriptionFilterValidated, SubscriptionId, SubscriptionIdSchema, SystemAddressSchema, type SystemExposure, TimestampSchema, TransportTypeSchema, UnsubscribeResponseResult, buildAgentsGetResponse, buildAgentsListResponse, buildAgentsRegisterResponse, buildAgentsSpawnResponse, buildAgentsUnregisterResponse, buildAgentsUpdateResponse, buildConnectResponse, buildDisconnectResponse, buildScopesCreateResponse, buildScopesJoinResponse, buildScopesLeaveResponse, buildScopesListResponse, buildSendResponse, buildSubscribeResponse, buildUnsubscribeResponse, calculateDelay, compareUlid, createErrorResponse, createFederationEnvelope, createNotification, createRequest, createRetryPolicy, createSuccessResponse, extractId, extractType, formatAddress, getEnvelopeRoutingInfo, getMethodInfo, getMethodsByCategory, getRequiredCapabilities, hasRequiredCapabilities, isAddress, isAgentAddress, isEnvelopeAtDestination, isErrorResponse, isNotification, isRequest, isResponse, isScopeAddress, isValidEnvelope, isValidUlid, parseAddress, processFederationEnvelope, retryable, sleep, sortCausalOrder, toAgent, toScope, ulidTimestamp, unwrapEnvelope, validateCausalOrder, withPayload, withRetry };
|