@multi-agent-protocol/sdk 0.0.5 → 0.0.7
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/README.md +164 -5
- package/dist/{index-DMcRbXOS.d.cts → index-BQXp4_rd.d.cts} +543 -12
- package/dist/{index-DMcRbXOS.d.ts → index-BQXp4_rd.d.ts} +543 -12
- package/dist/index.cjs +774 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +520 -12
- package/dist/index.d.ts +520 -12
- package/dist/index.js +773 -5
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +442 -8
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +442 -8
- package/dist/testing.js.map +1 -1
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
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 AgentVisibility, Q as ScopeVisibility, T as AgentState, V as MessageMeta, W as AgentConnection, X as ACPAgentHandler, Y as ACPSessionNotification, Z as ACPRequestPermissionRequest, _ as ACPRequestPermissionResponse, $ as ACPReadTextFileRequest, a0 as ACPReadTextFileResponse, a1 as ACPWriteTextFileRequest, a2 as ACPWriteTextFileResponse, a3 as ACPCreateTerminalRequest, a4 as ACPCreateTerminalResponse, a5 as ACPTerminalOutputRequest, a6 as ACPTerminalOutputResponse, a7 as ACPReleaseTerminalRequest, a8 as ACPReleaseTerminalResponse, a9 as ACPWaitForTerminalExitRequest, aa as ACPWaitForTerminalExitResponse, ab as ACPKillTerminalCommandRequest, ac as ACPKillTerminalCommandResponse, ad as ACPSessionId } from './index-BQXp4_rd.js';
|
|
2
|
+
export { ae as ACPAgentCapabilities, af as ACPAgentContext, ag as ACPAnnotations, ah as ACPAudioContent, ai as ACPAuthMethod, aj as ACPAuthenticateRequest, ak as ACPAuthenticateResponse, al as ACPAvailableCommand, am as ACPAvailableCommandsUpdate, an as ACPBlobResourceContents, ao as ACPCancelNotification, ap as ACPCancelledPermissionOutcome, aq as ACPCapability, ar as ACPClientCapabilities, as as ACPClientHandlers, at as ACPContent, au as ACPContentBlock, av as ACPContentChunk, aw as ACPContext, ax as ACPCurrentModeUpdate, ay as ACPDiff, az as ACPEmbeddedResource, aA as ACPEnvVariable, aB as ACPEnvelope, aC as ACPError, aD as ACPErrorCode, aE as ACPErrorObject, aF as ACPErrorResponse, aG as ACPFileSystemCapability, aH as ACPHttpHeader, aI as ACPImageContent, aJ as ACPImplementation, aK as ACPInitializeRequest, aL as ACPInitializeResponse, aM as ACPLoadSessionRequest, aN as ACPLoadSessionResponse, aO as ACPMcpCapabilities, aP as ACPMcpServer, aQ as ACPMcpServerHttp, aR as ACPMcpServerSse, aS as ACPMcpServerStdio, aT as ACPMessage, aU as ACPMeta, aV as ACPNewSessionRequest, aW as ACPNewSessionResponse, aX as ACPNotification, aY as ACPPermissionOption, aZ as ACPPermissionOptionId, a_ as ACPPermissionOptionKind, a$ as ACPPlan, b0 as ACPPlanEntry, b1 as ACPPlanEntryPriority, b2 as ACPPlanEntryStatus, b3 as ACPPromptCapabilities, b4 as ACPPromptRequest, b5 as ACPPromptResponse, b6 as ACPProtocolVersion, b7 as ACPRequest, b8 as ACPRequestId, b9 as ACPRequestPermissionOutcome, ba as ACPResourceLink, bb as ACPResponse, bc as ACPRole, bd as ACPSelectedPermissionOutcome, be as ACPSessionCapabilities, bf as ACPSessionInfoUpdate, bg as ACPSessionMode, bh as ACPSessionModeId, bi as ACPSessionModeState, bj as ACPSessionUpdate, bk as ACPSetSessionModeRequest, bl as ACPSetSessionModeResponse, bm as ACPStopReason, bn as ACPStreamConnection, bo as ACPStreamEvents, bp as ACPStreamOptions, bq as ACPSuccessResponse, br as ACPTerminal, bs as ACPTerminalExitStatus, bt as ACPTextContent, bu as ACPTextResourceContents, bv as ACPToolCall, bw as ACPToolCallContent, bx as ACPToolCallId, by as ACPToolCallLocation, bz as ACPToolCallStatus, bA as ACPToolCallUpdate, bB as ACPToolKind, bC as ACP_ERROR_CODES, bD as ACP_METHODS, bE as ACP_PROTOCOL_VERSION, bF as AGENT_ERROR_CODES, bG as AUTH_ERROR_CODES, bH as AUTH_METHODS, bI as AcceptanceContext, bJ as AgentAcceptanceRule, bK as AgentConnectOptions, bL as AgentConnectionOptions, bM as AgentIncludeOptions, bN as AgentLifecycle, bO as AgentMeshConnectOptions, bP as AgentMessagingRule, bQ as AgentPermissionConfig, bR as AgentPermissions, bS as AgentReconnectionEventHandler, bT as AgentReconnectionEventType, bU as AgentReconnectionOptions, bV as AgentRelationship, bW as AgentRelationshipType, bX as AgentVisibilityRule, bY as AgenticMeshStreamConfig, bZ as AgentsGetRequest, b_ as AgentsGetRequestParams, b$ as AgentsListFilter, c0 as AgentsListRequest, c1 as AgentsListRequestParams, c2 as AgentsRegisterRequest, c3 as AgentsRegisterRequestParams, c4 as AgentsResumeRequest, c5 as AgentsResumeRequestParams, c6 as AgentsResumeResponseResult, c7 as AgentsSpawnRequest, c8 as AgentsSpawnRequestParams, c9 as AgentsStopRequest, ca as AgentsStopRequestParams, cb as AgentsStopResponseResult, cc as AgentsSuspendRequest, cd as AgentsSuspendRequestParams, ce as AgentsSuspendResponseResult, cf as AgentsUnregisterRequest, cg as AgentsUnregisterRequestParams, ch as AgentsUpdateRequest, ci as AgentsUpdateRequestParams, cj as AnyMessage, ck as AuthCredentials, cl as AuthError, cm as AuthErrorCode, cn as AuthMethod, co as AuthPrincipal, cp as AuthRefreshRequest, cq as AuthRefreshRequestParams, cr as AuthRefreshResponseResult, cs as AuthResult, ct as AuthenticateRequest, cu as AuthenticateRequestParams, cv as AuthenticateResponseResult, cw as BaseConnection, cx as BroadcastAddress, cy as CAPABILITY_REQUIREMENTS, cz as CORE_METHODS, cA as ClientAcceptanceRule, cB as ClientConnectOptions, cC as ClientConnection, cD as ClientConnectionOptions, cE as ConnectRequest, cF as ConnectRequestParams, cG as CorrelationId, cH as DEFAULT_AGENT_PERMISSION_CONFIG, cI as DeliverySemantics, cJ as DirectAddress, cK as DisconnectPolicy, cL as DisconnectRequest, cM as DisconnectRequestParams, cN as ERROR_CODES, cO as EVENT_TYPES, cP as EXTENSION_METHODS, cQ as EventInput, cR as EventNotification, cS as EventNotificationParams, cT as FEDERATION_ERROR_CODES, cU as FEDERATION_METHODS, cV as FederatedAddress, cW as FederationAuth, cX as FederationConnectRequest, cY as FederationConnectRequestParams, cZ as FederationMetadata, c_ as FederationReplayConfig, c$ as FederationRouteRequest, d0 as FederationRouteRequestParams, d1 as GatewayReconnectionEvent, d2 as GatewayReconnectionEventHandler, d3 as GatewayReconnectionEventType, d4 as GatewayReconnectionOptions, d5 as GraphEdge, d6 as HierarchicalAddress, d7 as InjectDelivery, d8 as InjectDeliveryResult, d9 as InjectRequest, da as InjectRequestParams, db as InjectResponseResult, dc as JSONRPC_VERSION, dd as JoinPolicy, de as LIFECYCLE_METHODS, df as MAPNotification, dg as MAPNotificationBase, dh as MAPRequest, di as MAPRequestBase, dj as MAPResponse, dk as MAPResponseError, dl as MAPResponseSuccess, dm as MAP_METHODS, dn as MeshConnectOptions, dp as MeshPeerEndpoint, dq as MeshTransportAdapter, dr as MessageDeliveredEventData, ds as MessageFailedEventData, dt as MessageHandler, du as MessageNotification, dv as MessageNotificationParams, dw as MessagePriority, dx as MessageRelationship, dy as MessageSentEventData, dz as MessageVisibility, dA as Meta, dB as MultiAddress, dC as NOTIFICATION_METHODS, dD as NotificationHandler, dE as OBSERVATION_METHODS, dF as OverflowHandler, dG as OverflowInfo, dH as PERMISSION_METHODS, dI as PROTOCOL_ERROR_CODES, dJ as PROTOCOL_VERSION, dK as Participant, dL as ParticipantAddress, dM as PermissionAction, dN as PermissionContext, dO as PermissionParticipant, dP as PermissionResult, dQ as PermissionSystemConfig, dR as PermissionsAgentUpdatedEventData, dS as PermissionsClientUpdatedEventData, dT as PermissionsUpdateRequest, dU as PermissionsUpdateRequestParams, dV as PermissionsUpdateResponseResult, dW as RESOURCE_ERROR_CODES, dX as ROUTING_ERROR_CODES, dY as ReconnectionEventHandler, dZ as ReconnectionEventType, d_ as ReconnectionOptions, d$ as ReplayRequest, e0 as ReplayRequestParams, e1 as ReplayResponseResult, e2 as ReplayedEvent, e3 as RequestHandler, e4 as RoleAddress, e5 as SCOPE_METHODS, e6 as SESSION_METHODS, e7 as STATE_METHODS, e8 as STEERING_METHODS, e9 as STRUCTURE_METHODS, ea as ScopeAddress, eb as ScopeMessagingRule, ec as ScopeVisibilityRule, ed as ScopesCreateRequest, ee as ScopesCreateRequestParams, ef as ScopesDeleteRequest, eg as ScopesDeleteRequestParams, eh as ScopesDeleteResponseResult, ei as ScopesGetRequest, ej as ScopesGetRequestParams, ek as ScopesGetResponseResult, el as ScopesJoinRequest, em as ScopesJoinRequestParams, en as ScopesLeaveRequest, eo as ScopesLeaveRequestParams, ep as ScopesListRequest, eq as ScopesListRequestParams, er as ScopesMembersRequest, es as ScopesMembersRequestParams, et as ScopesMembersResponseResult, eu as SendPolicy, ev as SendRequest, ew as SendRequestParams, ex as ServerAuthCapabilities, ey as SessionCloseRequest, ez as SessionCloseRequestParams, eA as SessionCloseResponseResult, eB as SessionListRequest, eC as SessionListRequestParams, eD as SessionListResponseResult, eE as SessionLoadRequest, eF as SessionLoadRequestParams, eG as SessionLoadResponseResult, eH as StandardAuthMethod, eI as StateChangeHandler, eJ as StreamingCapabilities, eK as StructureGraphRequest, eL as StructureGraphRequestParams, eM as StructureGraphResponseResult, eN as StructureVisibilityRule, eO as SubscribeRequest, eP as SubscribeRequestParams, eQ as Subscription, eR as SubscriptionAckNotification, eS as SubscriptionAckParams, eT as SubscriptionOptions, eU as SubscriptionState, eV as SystemAcceptanceRule, eW as SystemAddress, eX as Timestamp, eY as TransportType, eZ as UnsubscribeRequest, e_ as UnsubscribeRequestParams, e$ as agenticMeshStream, f0 as canAgentAcceptMessage, f1 as canAgentMessageAgent, f2 as canAgentSeeAgent, f3 as canControlAgent, f4 as canJoinScope, f5 as canMessageAgent, f6 as canPerformAction, f7 as canPerformMethod, f8 as canSeeAgent, f9 as canSeeScope, fa as canSendToScope, fb as createACPStream, fc as createEvent, fd as createStreamPair, fe as createSubscription, ff as deepMergePermissions, fg as filterVisibleAgents, fh as filterVisibleEvents, fi as filterVisibleScopes, fj as hasCapability, fk as isACPEnvelope, fl as isACPErrorResponse, fm as isACPNotification, fn as isACPRequest, fo as isACPResponse, fp as isACPSuccessResponse, fq as isAgentExposed, fr as isBroadcastAddress, fs as isDirectAddress, ft as isEventTypeExposed, fu as isFederatedAddress, fv as isHierarchicalAddress, fw as isOrphanedAgent, fx as isScopeExposed, fy as isSuccessResponse, fz as mapVisibilityToRule, fA as ndJsonStream, fB as resolveAgentPermissions, fC as waitForOpen, fD as websocketStream } from './index-BQXp4_rd.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export { monotonicFactory, ulid } from 'ulid';
|
|
5
5
|
import 'events';
|
|
@@ -109,6 +109,9 @@ declare class MAPRequestError extends Error {
|
|
|
109
109
|
static authFailed(details?: string): MAPRequestError;
|
|
110
110
|
static tokenExpired(): MAPRequestError;
|
|
111
111
|
static permissionDenied(required?: string): MAPRequestError;
|
|
112
|
+
static insufficientScope(required?: string): MAPRequestError;
|
|
113
|
+
static methodNotSupported(method: string): MAPRequestError;
|
|
114
|
+
static invalidCredentials(details?: string): MAPRequestError;
|
|
112
115
|
static addressNotFound(address: string): MAPRequestError;
|
|
113
116
|
static agentNotFound(agentId: string): MAPRequestError;
|
|
114
117
|
static scopeNotFound(scopeId: string): MAPRequestError;
|
|
@@ -1260,6 +1263,7 @@ declare const MessageMetaSchema: z.ZodObject<{
|
|
|
1260
1263
|
}, "strict", z.ZodTypeAny, {
|
|
1261
1264
|
correlationId?: string | undefined;
|
|
1262
1265
|
_meta?: Record<string, unknown> | undefined;
|
|
1266
|
+
expiresAt?: number | undefined;
|
|
1263
1267
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1264
1268
|
isResult?: boolean | undefined;
|
|
1265
1269
|
causationId?: string | undefined;
|
|
@@ -1267,10 +1271,10 @@ declare const MessageMetaSchema: z.ZodObject<{
|
|
|
1267
1271
|
spanId?: string | undefined;
|
|
1268
1272
|
priority?: "urgent" | "high" | "normal" | "low" | undefined;
|
|
1269
1273
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1270
|
-
expiresAt?: number | undefined;
|
|
1271
1274
|
}, {
|
|
1272
1275
|
correlationId?: string | undefined;
|
|
1273
1276
|
_meta?: Record<string, unknown> | undefined;
|
|
1277
|
+
expiresAt?: number | undefined;
|
|
1274
1278
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1275
1279
|
isResult?: boolean | undefined;
|
|
1276
1280
|
causationId?: string | undefined;
|
|
@@ -1278,7 +1282,6 @@ declare const MessageMetaSchema: z.ZodObject<{
|
|
|
1278
1282
|
spanId?: string | undefined;
|
|
1279
1283
|
priority?: "urgent" | "high" | "normal" | "low" | undefined;
|
|
1280
1284
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1281
|
-
expiresAt?: number | undefined;
|
|
1282
1285
|
}>;
|
|
1283
1286
|
declare const MessageSchema: z.ZodObject<{
|
|
1284
1287
|
id: z.ZodString;
|
|
@@ -1300,6 +1303,7 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1300
1303
|
}, "strict", z.ZodTypeAny, {
|
|
1301
1304
|
correlationId?: string | undefined;
|
|
1302
1305
|
_meta?: Record<string, unknown> | undefined;
|
|
1306
|
+
expiresAt?: number | undefined;
|
|
1303
1307
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1304
1308
|
isResult?: boolean | undefined;
|
|
1305
1309
|
causationId?: string | undefined;
|
|
@@ -1307,10 +1311,10 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1307
1311
|
spanId?: string | undefined;
|
|
1308
1312
|
priority?: "urgent" | "high" | "normal" | "low" | undefined;
|
|
1309
1313
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1310
|
-
expiresAt?: number | undefined;
|
|
1311
1314
|
}, {
|
|
1312
1315
|
correlationId?: string | undefined;
|
|
1313
1316
|
_meta?: Record<string, unknown> | undefined;
|
|
1317
|
+
expiresAt?: number | undefined;
|
|
1314
1318
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1315
1319
|
isResult?: boolean | undefined;
|
|
1316
1320
|
causationId?: string | undefined;
|
|
@@ -1318,7 +1322,6 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1318
1322
|
spanId?: string | undefined;
|
|
1319
1323
|
priority?: "urgent" | "high" | "normal" | "low" | undefined;
|
|
1320
1324
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1321
|
-
expiresAt?: number | undefined;
|
|
1322
1325
|
}>>;
|
|
1323
1326
|
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1324
1327
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -1330,6 +1333,7 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1330
1333
|
meta?: {
|
|
1331
1334
|
correlationId?: string | undefined;
|
|
1332
1335
|
_meta?: Record<string, unknown> | undefined;
|
|
1336
|
+
expiresAt?: number | undefined;
|
|
1333
1337
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1334
1338
|
isResult?: boolean | undefined;
|
|
1335
1339
|
causationId?: string | undefined;
|
|
@@ -1337,7 +1341,6 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1337
1341
|
spanId?: string | undefined;
|
|
1338
1342
|
priority?: "urgent" | "high" | "normal" | "low" | undefined;
|
|
1339
1343
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1340
|
-
expiresAt?: number | undefined;
|
|
1341
1344
|
} | undefined;
|
|
1342
1345
|
to?: unknown;
|
|
1343
1346
|
}, {
|
|
@@ -1349,6 +1352,7 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1349
1352
|
meta?: {
|
|
1350
1353
|
correlationId?: string | undefined;
|
|
1351
1354
|
_meta?: Record<string, unknown> | undefined;
|
|
1355
|
+
expiresAt?: number | undefined;
|
|
1352
1356
|
relationship?: "peer" | "parent-to-child" | "child-to-parent" | "broadcast" | "supervisor-to-supervised" | undefined;
|
|
1353
1357
|
isResult?: boolean | undefined;
|
|
1354
1358
|
causationId?: string | undefined;
|
|
@@ -1356,7 +1360,6 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
1356
1360
|
spanId?: string | undefined;
|
|
1357
1361
|
priority?: "urgent" | "high" | "normal" | "low" | undefined;
|
|
1358
1362
|
delivery?: "at-most-once" | "at-least-once" | "exactly-once" | undefined;
|
|
1359
|
-
expiresAt?: number | undefined;
|
|
1360
1363
|
} | undefined;
|
|
1361
1364
|
to?: unknown;
|
|
1362
1365
|
}>;
|
|
@@ -1379,20 +1382,20 @@ declare const EventSchema: z.ZodObject<{
|
|
|
1379
1382
|
declare const SubscriptionFilterSchema: z.ZodObject<{
|
|
1380
1383
|
eventTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["agent.registered", "agent.unregistered", "agent.state-changed", "agent.spawned", "scope.created", "scope.deleted", "scope.joined", "scope.left", "message.sent", "message.delivered", "session.started", "session.ended", "system.error", "system.shutdown"]>, "many">>;
|
|
1381
1384
|
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1382
|
-
|
|
1385
|
+
fromAgents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1383
1386
|
includeChildren: z.ZodOptional<z.ZodBoolean>;
|
|
1384
1387
|
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1385
1388
|
}, "strict", z.ZodTypeAny, {
|
|
1386
|
-
agents?: string[] | undefined;
|
|
1387
1389
|
_meta?: Record<string, unknown> | undefined;
|
|
1388
1390
|
scopes?: string[] | undefined;
|
|
1389
1391
|
eventTypes?: ("agent.registered" | "agent.unregistered" | "agent.state-changed" | "agent.spawned" | "scope.created" | "scope.deleted" | "scope.joined" | "scope.left" | "message.sent" | "message.delivered" | "session.started" | "session.ended" | "system.error" | "system.shutdown")[] | undefined;
|
|
1392
|
+
fromAgents?: string[] | undefined;
|
|
1390
1393
|
includeChildren?: boolean | undefined;
|
|
1391
1394
|
}, {
|
|
1392
|
-
agents?: string[] | undefined;
|
|
1393
1395
|
_meta?: Record<string, unknown> | undefined;
|
|
1394
1396
|
scopes?: string[] | undefined;
|
|
1395
1397
|
eventTypes?: ("agent.registered" | "agent.unregistered" | "agent.state-changed" | "agent.spawned" | "scope.created" | "scope.deleted" | "scope.joined" | "scope.left" | "message.sent" | "message.delivered" | "session.started" | "session.ended" | "system.error" | "system.shutdown")[] | undefined;
|
|
1398
|
+
fromAgents?: string[] | undefined;
|
|
1396
1399
|
includeChildren?: boolean | undefined;
|
|
1397
1400
|
}>;
|
|
1398
1401
|
declare const MAPErrorDataSchema: z.ZodObject<{
|
|
@@ -2408,6 +2411,511 @@ declare function toAgent(agentId: string): string;
|
|
|
2408
2411
|
*/
|
|
2409
2412
|
declare function toScope(scopeId: string): string;
|
|
2410
2413
|
|
|
2414
|
+
/**
|
|
2415
|
+
* Type definitions for MAPMeshPeer
|
|
2416
|
+
*
|
|
2417
|
+
* These types define the configuration and interfaces for decentralized
|
|
2418
|
+
* P2P mesh peers that run their own MAP server.
|
|
2419
|
+
*/
|
|
2420
|
+
|
|
2421
|
+
/**
|
|
2422
|
+
* Peer endpoint for mesh connections.
|
|
2423
|
+
*/
|
|
2424
|
+
interface PeerEndpoint {
|
|
2425
|
+
/** Unique peer identifier */
|
|
2426
|
+
peerId: string;
|
|
2427
|
+
/** Transport-specific address (IP, hostname, etc.) */
|
|
2428
|
+
address: string;
|
|
2429
|
+
/** Optional port number */
|
|
2430
|
+
port?: number;
|
|
2431
|
+
/** Additional transport-specific metadata */
|
|
2432
|
+
metadata?: Record<string, unknown>;
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Transport adapter interface (subset used by MAPMeshPeer).
|
|
2436
|
+
* Full interface is defined in agentic-mesh.
|
|
2437
|
+
*/
|
|
2438
|
+
interface TransportAdapter {
|
|
2439
|
+
/** Whether the transport is currently active */
|
|
2440
|
+
readonly active: boolean;
|
|
2441
|
+
/** Start the transport */
|
|
2442
|
+
start(): Promise<void>;
|
|
2443
|
+
/** Stop the transport */
|
|
2444
|
+
stop(): Promise<void>;
|
|
2445
|
+
/** Connect to a peer endpoint */
|
|
2446
|
+
connect(endpoint: PeerEndpoint): Promise<boolean>;
|
|
2447
|
+
/** Check if connected to a peer */
|
|
2448
|
+
isConnected(peerId: string): boolean;
|
|
2449
|
+
/** Event emitter methods */
|
|
2450
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
2451
|
+
off(event: string, handler: (...args: unknown[]) => void): void;
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
* Git sync configuration for MAPMeshPeer.
|
|
2455
|
+
*/
|
|
2456
|
+
interface MeshGitConfig {
|
|
2457
|
+
/** Enable git sync service */
|
|
2458
|
+
enabled: boolean;
|
|
2459
|
+
/** Local repository path */
|
|
2460
|
+
repoPath: string;
|
|
2461
|
+
/** HTTP port for git-remote-mesh helper (default: 3456) */
|
|
2462
|
+
httpPort?: number;
|
|
2463
|
+
/** HTTP host to bind (default: 127.0.0.1) */
|
|
2464
|
+
httpHost?: string;
|
|
2465
|
+
/** Additional git transport options */
|
|
2466
|
+
options?: Record<string, unknown>;
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* MAP server configuration options.
|
|
2470
|
+
*/
|
|
2471
|
+
interface MeshMapServerConfig {
|
|
2472
|
+
/** System name for the MAP server */
|
|
2473
|
+
systemName?: string;
|
|
2474
|
+
/** Additional server options */
|
|
2475
|
+
[key: string]: unknown;
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Configuration for creating a MAPMeshPeer.
|
|
2479
|
+
*/
|
|
2480
|
+
interface MAPMeshPeerConfig {
|
|
2481
|
+
/** Unique peer identifier */
|
|
2482
|
+
peerId: string;
|
|
2483
|
+
/** Display name for this peer */
|
|
2484
|
+
peerName?: string;
|
|
2485
|
+
/** Transport adapter (from agentic-mesh) */
|
|
2486
|
+
transport: TransportAdapter;
|
|
2487
|
+
/** Git sync configuration (optional) */
|
|
2488
|
+
git?: MeshGitConfig;
|
|
2489
|
+
/** Initial peers to connect to on start */
|
|
2490
|
+
peers?: PeerEndpoint[];
|
|
2491
|
+
/** MAP server configuration */
|
|
2492
|
+
map?: MeshMapServerConfig;
|
|
2493
|
+
}
|
|
2494
|
+
/**
|
|
2495
|
+
* Configuration for creating a local agent.
|
|
2496
|
+
*/
|
|
2497
|
+
interface CreateAgentConfig {
|
|
2498
|
+
/** Agent ID (auto-generated if not provided) */
|
|
2499
|
+
agentId?: AgentId;
|
|
2500
|
+
/** Agent name */
|
|
2501
|
+
name?: string;
|
|
2502
|
+
/** Agent role */
|
|
2503
|
+
role?: string;
|
|
2504
|
+
/** Initial scopes to join */
|
|
2505
|
+
scopes?: ScopeId[];
|
|
2506
|
+
/** Agent visibility settings */
|
|
2507
|
+
visibility?: AgentVisibility;
|
|
2508
|
+
/** Initial metadata */
|
|
2509
|
+
metadata?: Record<string, unknown>;
|
|
2510
|
+
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Result of a send operation.
|
|
2513
|
+
*/
|
|
2514
|
+
interface SendResult {
|
|
2515
|
+
/** IDs of participants who received the message */
|
|
2516
|
+
delivered: string[];
|
|
2517
|
+
/** Failed deliveries with reasons */
|
|
2518
|
+
failed?: Array<{
|
|
2519
|
+
participantId: string;
|
|
2520
|
+
reason: string;
|
|
2521
|
+
}>;
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* Local agent on this peer's MapServer.
|
|
2525
|
+
*/
|
|
2526
|
+
interface LocalAgent {
|
|
2527
|
+
/** Agent ID */
|
|
2528
|
+
readonly agentId: AgentId;
|
|
2529
|
+
/** Agent name */
|
|
2530
|
+
readonly name: string;
|
|
2531
|
+
/** Agent role */
|
|
2532
|
+
readonly role?: string;
|
|
2533
|
+
/** Current agent state */
|
|
2534
|
+
readonly state: AgentState;
|
|
2535
|
+
/** Mark agent as busy */
|
|
2536
|
+
busy(): Promise<void>;
|
|
2537
|
+
/** Mark agent as idle */
|
|
2538
|
+
idle(): Promise<void>;
|
|
2539
|
+
/** Update agent state */
|
|
2540
|
+
updateState(state: AgentState): Promise<void>;
|
|
2541
|
+
/** Update agent metadata */
|
|
2542
|
+
updateMetadata(metadata: Record<string, unknown>): Promise<void>;
|
|
2543
|
+
/** Send a message */
|
|
2544
|
+
send(to: Address, payload: unknown, meta?: MessageMeta): Promise<SendResult>;
|
|
2545
|
+
/** Register message handler */
|
|
2546
|
+
onMessage(handler: (message: Message) => void | Promise<void>): () => void;
|
|
2547
|
+
/** Unregister this agent */
|
|
2548
|
+
unregister(reason?: string): Promise<void>;
|
|
2549
|
+
}
|
|
2550
|
+
/**
|
|
2551
|
+
* Configuration for creating a scope.
|
|
2552
|
+
*/
|
|
2553
|
+
interface CreateScopeConfig {
|
|
2554
|
+
/** Scope ID (auto-generated if not provided) */
|
|
2555
|
+
scopeId?: ScopeId;
|
|
2556
|
+
/** Scope name */
|
|
2557
|
+
name?: string;
|
|
2558
|
+
/** Scope description */
|
|
2559
|
+
description?: string;
|
|
2560
|
+
/** Scope visibility */
|
|
2561
|
+
visibility?: ScopeVisibility;
|
|
2562
|
+
/** Scope metadata */
|
|
2563
|
+
metadata?: Record<string, unknown>;
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* Options for sync operations.
|
|
2567
|
+
*/
|
|
2568
|
+
interface SyncOptions {
|
|
2569
|
+
/** Branch to sync (default: current branch) */
|
|
2570
|
+
branch?: string;
|
|
2571
|
+
/** Remote name to use */
|
|
2572
|
+
remoteName?: string;
|
|
2573
|
+
/** Bidirectional sync (pull then push) */
|
|
2574
|
+
bidirectional?: boolean;
|
|
2575
|
+
/** Force sync (overwrite conflicts) */
|
|
2576
|
+
force?: boolean;
|
|
2577
|
+
/** Use rebase instead of merge */
|
|
2578
|
+
rebase?: boolean;
|
|
2579
|
+
}
|
|
2580
|
+
/**
|
|
2581
|
+
* Options for pull operations.
|
|
2582
|
+
*/
|
|
2583
|
+
interface PullOptions {
|
|
2584
|
+
/** Use rebase instead of merge */
|
|
2585
|
+
rebase?: boolean;
|
|
2586
|
+
/** Fast-forward only (fail if not possible) */
|
|
2587
|
+
ffOnly?: boolean;
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2590
|
+
* Options for push operations.
|
|
2591
|
+
*/
|
|
2592
|
+
interface PushOptions {
|
|
2593
|
+
/** Force push */
|
|
2594
|
+
force?: boolean;
|
|
2595
|
+
/** Set upstream tracking */
|
|
2596
|
+
setUpstream?: boolean;
|
|
2597
|
+
/** Push all branches */
|
|
2598
|
+
all?: boolean;
|
|
2599
|
+
/** Push tags */
|
|
2600
|
+
tags?: boolean;
|
|
2601
|
+
}
|
|
2602
|
+
/**
|
|
2603
|
+
* Options for clone operations.
|
|
2604
|
+
*/
|
|
2605
|
+
interface CloneOptions {
|
|
2606
|
+
/** Branch to clone */
|
|
2607
|
+
branch?: string;
|
|
2608
|
+
/** Shallow clone depth */
|
|
2609
|
+
depth?: number;
|
|
2610
|
+
/** Clone as bare repository */
|
|
2611
|
+
bare?: boolean;
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* Result of a git sync operation.
|
|
2615
|
+
*/
|
|
2616
|
+
interface SyncResult {
|
|
2617
|
+
/** Whether operation succeeded */
|
|
2618
|
+
success: boolean;
|
|
2619
|
+
/** Type of operation performed */
|
|
2620
|
+
operation: 'fetch' | 'pull' | 'push' | 'clone' | 'sync';
|
|
2621
|
+
/** Peer ID involved */
|
|
2622
|
+
peerId: string;
|
|
2623
|
+
/** Branch involved */
|
|
2624
|
+
branch?: string;
|
|
2625
|
+
/** Commits transferred */
|
|
2626
|
+
commits?: string[];
|
|
2627
|
+
/** Error message if failed */
|
|
2628
|
+
error?: string;
|
|
2629
|
+
/** Command output */
|
|
2630
|
+
output?: string;
|
|
2631
|
+
}
|
|
2632
|
+
/**
|
|
2633
|
+
* Git sync client for a specific repository.
|
|
2634
|
+
*/
|
|
2635
|
+
interface GitSyncClient {
|
|
2636
|
+
/** Bidirectional sync with a peer */
|
|
2637
|
+
sync(peerId: string, options?: SyncOptions): Promise<SyncResult>;
|
|
2638
|
+
/** Fetch from a peer */
|
|
2639
|
+
fetch(peerId: string, branch?: string): Promise<SyncResult>;
|
|
2640
|
+
/** Pull from a peer */
|
|
2641
|
+
pull(peerId: string, branch?: string, options?: PullOptions): Promise<SyncResult>;
|
|
2642
|
+
/** Push to a peer */
|
|
2643
|
+
push(peerId: string, branch?: string, options?: PushOptions): Promise<SyncResult>;
|
|
2644
|
+
/** Clone from a peer */
|
|
2645
|
+
clone(peerId: string, destPath: string, options?: CloneOptions): Promise<SyncResult>;
|
|
2646
|
+
/** List refs on remote peer */
|
|
2647
|
+
listRemoteRefs(peerId: string): Promise<Array<{
|
|
2648
|
+
ref: string;
|
|
2649
|
+
sha: string;
|
|
2650
|
+
}>>;
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* Git sync service exposed by MAPMeshPeer.
|
|
2654
|
+
*/
|
|
2655
|
+
interface GitSyncService {
|
|
2656
|
+
/** Whether the git service is running */
|
|
2657
|
+
readonly isRunning: boolean;
|
|
2658
|
+
/** HTTP port for git-remote-mesh helper */
|
|
2659
|
+
readonly httpPort: number;
|
|
2660
|
+
/** Create a sync client for a specific repository */
|
|
2661
|
+
createSyncClient(repoPath: string): GitSyncClient;
|
|
2662
|
+
/** Sync with a peer */
|
|
2663
|
+
sync(peerId: string, options?: SyncOptions): Promise<SyncResult>;
|
|
2664
|
+
/** Pull from a peer */
|
|
2665
|
+
pull(peerId: string, branch?: string, options?: PullOptions): Promise<SyncResult>;
|
|
2666
|
+
/** Push to a peer */
|
|
2667
|
+
push(peerId: string, branch?: string, options?: PushOptions): Promise<SyncResult>;
|
|
2668
|
+
/** Clone from a peer */
|
|
2669
|
+
clone(peerId: string, destPath: string, options?: CloneOptions): Promise<SyncResult>;
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Event subscription for MAPMeshPeer.
|
|
2673
|
+
*/
|
|
2674
|
+
interface MeshEventSubscription {
|
|
2675
|
+
/** Subscription ID */
|
|
2676
|
+
readonly id: SubscriptionId;
|
|
2677
|
+
/** Async iterator for events */
|
|
2678
|
+
[Symbol.asyncIterator](): AsyncIterator<Event>;
|
|
2679
|
+
/** Unsubscribe */
|
|
2680
|
+
unsubscribe(): Promise<void>;
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* Events emitted by MAPMeshPeer.
|
|
2684
|
+
*/
|
|
2685
|
+
interface MAPMeshPeerEvents {
|
|
2686
|
+
/** Peer started */
|
|
2687
|
+
started: () => void;
|
|
2688
|
+
/** Peer stopped */
|
|
2689
|
+
stopped: () => void;
|
|
2690
|
+
/** Connected to a peer */
|
|
2691
|
+
'peer:connected': (peerId: string, endpoint: PeerEndpoint) => void;
|
|
2692
|
+
/** Disconnected from a peer */
|
|
2693
|
+
'peer:disconnected': (peerId: string, reason?: string) => void;
|
|
2694
|
+
/** Agent registered on this peer */
|
|
2695
|
+
'agent:registered': (agent: Agent) => void;
|
|
2696
|
+
/** Agent unregistered from this peer */
|
|
2697
|
+
'agent:unregistered': (agent: Agent) => void;
|
|
2698
|
+
/** Scope created */
|
|
2699
|
+
'scope:created': (scope: Scope) => void;
|
|
2700
|
+
/** Scope deleted */
|
|
2701
|
+
'scope:deleted': (scope: Scope) => void;
|
|
2702
|
+
/** Error occurred */
|
|
2703
|
+
error: (error: Error) => void;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
/**
|
|
2707
|
+
* MAPMeshPeer - Decentralized P2P mesh peer
|
|
2708
|
+
*
|
|
2709
|
+
* Wraps agentic-mesh's MeshPeer to provide a unified interface for
|
|
2710
|
+
* decentralized MAP networks where each peer runs its own MapServer.
|
|
2711
|
+
*
|
|
2712
|
+
* @module
|
|
2713
|
+
*/
|
|
2714
|
+
|
|
2715
|
+
/**
|
|
2716
|
+
* Decentralized P2P mesh peer with MAP protocol support.
|
|
2717
|
+
*
|
|
2718
|
+
* Each MAPMeshPeer runs its own MapServer and can connect to other peers
|
|
2719
|
+
* for agent discovery, messaging, and git synchronization.
|
|
2720
|
+
*
|
|
2721
|
+
* @example
|
|
2722
|
+
* ```typescript
|
|
2723
|
+
* import { createNebulaTransport } from 'agentic-mesh';
|
|
2724
|
+
* import { MAPMeshPeer } from '@multi-agent-protocol/sdk';
|
|
2725
|
+
*
|
|
2726
|
+
* // Create transport
|
|
2727
|
+
* const transport = createNebulaTransport({
|
|
2728
|
+
* configPath: '/etc/nebula/config.yml',
|
|
2729
|
+
* });
|
|
2730
|
+
*
|
|
2731
|
+
* // Create mesh peer
|
|
2732
|
+
* const peer = await MAPMeshPeer.create({
|
|
2733
|
+
* peerId: 'worker-1',
|
|
2734
|
+
* peerName: 'Worker Node 1',
|
|
2735
|
+
* transport,
|
|
2736
|
+
* git: {
|
|
2737
|
+
* enabled: true,
|
|
2738
|
+
* repoPath: '/workspace/project',
|
|
2739
|
+
* },
|
|
2740
|
+
* peers: [
|
|
2741
|
+
* { peerId: 'coordinator', address: '10.0.0.1', port: 4242 },
|
|
2742
|
+
* ],
|
|
2743
|
+
* });
|
|
2744
|
+
*
|
|
2745
|
+
* // Start the peer
|
|
2746
|
+
* await peer.start();
|
|
2747
|
+
*
|
|
2748
|
+
* // Create a local agent
|
|
2749
|
+
* const agent = await peer.createAgent({
|
|
2750
|
+
* name: 'DataProcessor',
|
|
2751
|
+
* role: 'processor',
|
|
2752
|
+
* });
|
|
2753
|
+
*
|
|
2754
|
+
* // Connect to another peer
|
|
2755
|
+
* await peer.connectToPeer({ peerId: 'worker-2', address: '10.0.0.3' });
|
|
2756
|
+
*
|
|
2757
|
+
* // Sync code with connected peer
|
|
2758
|
+
* await peer.git?.sync('worker-2', { branch: 'main' });
|
|
2759
|
+
*
|
|
2760
|
+
* // Clean shutdown
|
|
2761
|
+
* await peer.stop();
|
|
2762
|
+
* ```
|
|
2763
|
+
*/
|
|
2764
|
+
declare class MAPMeshPeer {
|
|
2765
|
+
#private;
|
|
2766
|
+
private constructor();
|
|
2767
|
+
/**
|
|
2768
|
+
* Create a new MAPMeshPeer.
|
|
2769
|
+
*
|
|
2770
|
+
* Requires `agentic-mesh` to be installed as a peer dependency.
|
|
2771
|
+
*
|
|
2772
|
+
* @param config - Peer configuration
|
|
2773
|
+
* @returns Promise resolving to the created peer (not yet started)
|
|
2774
|
+
*/
|
|
2775
|
+
static create(config: MAPMeshPeerConfig): Promise<MAPMeshPeer>;
|
|
2776
|
+
/** Unique peer identifier */
|
|
2777
|
+
get peerId(): string;
|
|
2778
|
+
/** Display name for this peer */
|
|
2779
|
+
get peerName(): string;
|
|
2780
|
+
/** Whether the peer is currently running */
|
|
2781
|
+
get isRunning(): boolean;
|
|
2782
|
+
/** List of connected peer IDs */
|
|
2783
|
+
get connectedPeers(): string[];
|
|
2784
|
+
/** Git sync service (null if git not enabled) */
|
|
2785
|
+
get git(): GitSyncService | null;
|
|
2786
|
+
/**
|
|
2787
|
+
* Start the mesh peer.
|
|
2788
|
+
*
|
|
2789
|
+
* This starts the transport, MAP server, and git service (if enabled),
|
|
2790
|
+
* then connects to any initial peers specified in the config.
|
|
2791
|
+
*/
|
|
2792
|
+
start(): Promise<void>;
|
|
2793
|
+
/**
|
|
2794
|
+
* Stop the mesh peer.
|
|
2795
|
+
*
|
|
2796
|
+
* This disconnects from all peers, unregisters all agents,
|
|
2797
|
+
* stops the git service, MAP server, and transport.
|
|
2798
|
+
*/
|
|
2799
|
+
stop(): Promise<void>;
|
|
2800
|
+
/**
|
|
2801
|
+
* Connect to a remote peer.
|
|
2802
|
+
*
|
|
2803
|
+
* After connecting, agents on both peers will be discoverable
|
|
2804
|
+
* and messages can be routed between them.
|
|
2805
|
+
*
|
|
2806
|
+
* @param endpoint - Peer endpoint to connect to
|
|
2807
|
+
*/
|
|
2808
|
+
connectToPeer(endpoint: PeerEndpoint): Promise<void>;
|
|
2809
|
+
/**
|
|
2810
|
+
* Disconnect from a peer.
|
|
2811
|
+
*
|
|
2812
|
+
* @param peerId - ID of peer to disconnect from
|
|
2813
|
+
* @param reason - Optional reason for disconnecting
|
|
2814
|
+
*/
|
|
2815
|
+
disconnectFromPeer(peerId: string, reason?: string): Promise<void>;
|
|
2816
|
+
/**
|
|
2817
|
+
* Check if connected to a specific peer.
|
|
2818
|
+
*
|
|
2819
|
+
* @param peerId - Peer ID to check
|
|
2820
|
+
* @returns true if connected
|
|
2821
|
+
*/
|
|
2822
|
+
isConnectedTo(peerId: string): boolean;
|
|
2823
|
+
/**
|
|
2824
|
+
* Create and register a local agent on this peer's MapServer.
|
|
2825
|
+
*
|
|
2826
|
+
* @param config - Agent configuration
|
|
2827
|
+
* @returns The created agent
|
|
2828
|
+
*/
|
|
2829
|
+
createAgent(config: CreateAgentConfig): Promise<LocalAgent>;
|
|
2830
|
+
/**
|
|
2831
|
+
* Get a local agent by ID.
|
|
2832
|
+
*
|
|
2833
|
+
* @param agentId - Agent ID to look up
|
|
2834
|
+
* @returns The agent, or undefined if not found
|
|
2835
|
+
*/
|
|
2836
|
+
getAgent(agentId: AgentId): LocalAgent | undefined;
|
|
2837
|
+
/**
|
|
2838
|
+
* Get all local agents on this peer.
|
|
2839
|
+
*/
|
|
2840
|
+
getLocalAgents(): Agent[];
|
|
2841
|
+
/**
|
|
2842
|
+
* Get all known agents (local and discovered from connected peers).
|
|
2843
|
+
*/
|
|
2844
|
+
getAllAgents(): Agent[];
|
|
2845
|
+
/**
|
|
2846
|
+
* Create a scope on this peer's MapServer.
|
|
2847
|
+
*
|
|
2848
|
+
* @param config - Scope configuration
|
|
2849
|
+
* @returns The created scope
|
|
2850
|
+
*/
|
|
2851
|
+
createScope(config: CreateScopeConfig): Scope;
|
|
2852
|
+
/**
|
|
2853
|
+
* Get a scope by ID.
|
|
2854
|
+
*
|
|
2855
|
+
* @param scopeId - Scope ID to look up
|
|
2856
|
+
* @returns The scope, or undefined if not found
|
|
2857
|
+
*/
|
|
2858
|
+
getScope(scopeId: ScopeId): Scope | undefined;
|
|
2859
|
+
/**
|
|
2860
|
+
* List all scopes on this peer.
|
|
2861
|
+
*/
|
|
2862
|
+
listScopes(): Scope[];
|
|
2863
|
+
/**
|
|
2864
|
+
* Send a message from an agent to an address.
|
|
2865
|
+
*
|
|
2866
|
+
* Messages are routed to local agents or forwarded to connected peers.
|
|
2867
|
+
*
|
|
2868
|
+
* @param from - Sending agent ID
|
|
2869
|
+
* @param to - Destination address
|
|
2870
|
+
* @param payload - Message payload
|
|
2871
|
+
* @param meta - Optional message metadata
|
|
2872
|
+
* @returns Send result with delivery status
|
|
2873
|
+
*/
|
|
2874
|
+
send(from: AgentId, to: Address, payload: unknown, meta?: MessageMeta): Promise<SendResult>;
|
|
2875
|
+
/**
|
|
2876
|
+
* Subscribe to events from this peer's MapServer.
|
|
2877
|
+
*
|
|
2878
|
+
* @param filter - Optional filter for event types
|
|
2879
|
+
* @returns Event subscription
|
|
2880
|
+
*/
|
|
2881
|
+
subscribe(filter?: SubscriptionFilter): MeshEventSubscription;
|
|
2882
|
+
/**
|
|
2883
|
+
* Register a handler for peer connection events.
|
|
2884
|
+
*
|
|
2885
|
+
* @param handler - Function called when a peer connects
|
|
2886
|
+
* @returns Unsubscribe function
|
|
2887
|
+
*/
|
|
2888
|
+
onPeerConnected(handler: (peerId: string, endpoint: PeerEndpoint) => void): () => void;
|
|
2889
|
+
/**
|
|
2890
|
+
* Register a handler for peer disconnection events.
|
|
2891
|
+
*
|
|
2892
|
+
* @param handler - Function called when a peer disconnects
|
|
2893
|
+
* @returns Unsubscribe function
|
|
2894
|
+
*/
|
|
2895
|
+
onPeerDisconnected(handler: (peerId: string, reason?: string) => void): () => void;
|
|
2896
|
+
/**
|
|
2897
|
+
* Register a handler for agent registration events.
|
|
2898
|
+
*
|
|
2899
|
+
* @param handler - Function called when an agent registers
|
|
2900
|
+
* @returns Unsubscribe function
|
|
2901
|
+
*/
|
|
2902
|
+
onAgentRegistered(handler: (agent: Agent) => void): () => void;
|
|
2903
|
+
/**
|
|
2904
|
+
* Register a handler for agent unregistration events.
|
|
2905
|
+
*
|
|
2906
|
+
* @param handler - Function called when an agent unregisters
|
|
2907
|
+
* @returns Unsubscribe function
|
|
2908
|
+
*/
|
|
2909
|
+
onAgentUnregistered(handler: (agent: Agent) => void): () => void;
|
|
2910
|
+
/**
|
|
2911
|
+
* Register a handler for error events.
|
|
2912
|
+
*
|
|
2913
|
+
* @param handler - Function called when an error occurs
|
|
2914
|
+
* @returns Unsubscribe function
|
|
2915
|
+
*/
|
|
2916
|
+
onError(handler: (error: Error) => void): () => void;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2411
2919
|
/**
|
|
2412
2920
|
* ACPAgentAdapter - Agent-side helper for ACP-over-MAP.
|
|
2413
2921
|
*
|
|
@@ -2516,4 +3024,4 @@ declare class ACPAgentAdapter {
|
|
|
2516
3024
|
removeStream(streamId: string): boolean;
|
|
2517
3025
|
}
|
|
2518
3026
|
|
|
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 };
|
|
3027
|
+
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, AgentState, AgentStateSchema, type AgentStateValidated, type AgentValidated, AgentVisibility, AgentVisibilitySchema, AgentsGetResponseResult, AgentsListResponseResult, AgentsRegisterResponseResult, AgentsSpawnResponseResult, AgentsUnregisterResponseResult, AgentsUpdateResponseResult, BaseConnectionOptions, BroadcastAddressSchema, type CapabilityPath, type CausalBufferPushResult, type CausalEvent, CausalEventBuffer, type CausalEventBufferOptions, type CloneOptions, ConnectResponseResult, type ConnectedParticipant, ConnectionState, CorrelationIdSchema, type CreateAgentConfig, type CreateEnvelopeOptions, type CreateScopeConfig, 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, type GitSyncClient, type GitSyncService, HierarchicalAddressSchema, InvalidAddressError, JsonRpcVersionSchema, type LocalAgent, MAPConnectionError, MAPError, MAPErrorData, MAPErrorDataSchema, MAPErrorSchema, type MAPErrorValidated, MAPMeshPeer, type MAPMeshPeerConfig, type MAPMeshPeerEvents, MAPNotificationSchema, type MAPNotificationValidated, MAPRequestError, MAPRequestSchema, type MAPRequestValidated, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, type MAPResponseValidated, type MAPRouter, type MAPRouterConfig, type MAPRouterFactory, MAPTimeoutError, METHOD_REGISTRY, type MeshEventSubscription, type MeshGitConfig, type MeshMapServerConfig, Message, MessageId, MessageIdSchema, type MessageIdValidated, MessageMeta, 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 PeerEndpoint, type ProcessEnvelopeResult, ProtocolVersion, ProtocolVersionSchema, type PullOptions, type PushOptions, RequestId, RequestIdSchema, type RetryCallbacks, type RetryPolicy, type RetryState, RoleAddressSchema, type RouterLimits, Scope, ScopeAddressSchema, type ScopeExposure, ScopeId, ScopeIdSchema, type ScopeIdValidated, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, type ScopeValidated, ScopeVisibility, ScopeVisibilitySchema, ScopesCreateResponseResult, ScopesJoinResponseResult, ScopesLeaveResponseResult, ScopesListResponseResult, SendResponseResult, type SendResult, SessionId, SessionIdSchema, type SessionIdValidated, SessionInfo, Stream, SubscribeResponseResult, SubscriptionFilter, SubscriptionFilterSchema, type SubscriptionFilterValidated, SubscriptionId, SubscriptionIdSchema, type SyncOptions, type SyncResult, SystemAddressSchema, type SystemExposure, TimestampSchema, type TransportAdapter, 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 };
|