@multi-agent-protocol/sdk 0.0.3 → 0.0.4
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-Z76qC_Us.d.cts} +133 -5
- package/dist/{index-C7XPWnxS.d.ts → index-Z76qC_Us.d.ts} +133 -5
- package/dist/index.cjs +287 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -3
- package/dist/index.d.ts +125 -3
- package/dist/index.js +278 -15
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +336 -99
- 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 +336 -99
- package/dist/testing.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
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 } from './index-
|
|
2
|
-
export { O as AGENT_ERROR_CODES, Q as AUTH_ERROR_CODES, T as AUTH_METHODS, V as AcceptanceContext, W as AgentAcceptanceRule, X as
|
|
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-Z76qC_Us.cjs';
|
|
2
|
+
export { O as AGENT_ERROR_CODES, Q as AUTH_ERROR_CODES, T as AUTH_METHODS, V as AcceptanceContext, W as AgentAcceptanceRule, X as AgentConnectOptions, Y as AgentConnection, Z as AgentConnectionOptions, _ as AgentIncludeOptions, $ as AgentLifecycle, a0 as AgentMessagingRule, a1 as AgentPermissionConfig, a2 as AgentPermissions, a3 as AgentReconnectionEventHandler, a4 as AgentReconnectionEventType, a5 as AgentReconnectionOptions, a6 as AgentRelationship, a7 as AgentRelationshipType, a8 as AgentState, a9 as AgentVisibility, aa as AgentVisibilityRule, ab as AgentsGetRequest, ac as AgentsGetRequestParams, ad as AgentsListFilter, ae as AgentsListRequest, af as AgentsListRequestParams, ag as AgentsRegisterRequest, ah as AgentsRegisterRequestParams, ai as AgentsResumeRequest, aj as AgentsResumeRequestParams, ak as AgentsResumeResponseResult, al as AgentsSpawnRequest, am as AgentsSpawnRequestParams, an as AgentsStopRequest, ao as AgentsStopRequestParams, ap as AgentsStopResponseResult, aq as AgentsSuspendRequest, ar as AgentsSuspendRequestParams, as as AgentsSuspendResponseResult, at as AgentsUnregisterRequest, au as AgentsUnregisterRequestParams, av as AgentsUpdateRequest, aw as AgentsUpdateRequestParams, ax as AnyMessage, ay as AuthMethod, az as AuthParams, aA as AuthRefreshRequest, aB as AuthRefreshRequestParams, aC as AuthRefreshResponseResult, aD as BaseConnection, aE as BroadcastAddress, aF as CAPABILITY_REQUIREMENTS, aG as CORE_METHODS, aH as ClientAcceptanceRule, aI as ClientConnectOptions, aJ as ClientConnection, aK as ClientConnectionOptions, aL as ConnectRequest, aM as ConnectRequestParams, aN as CorrelationId, aO as DEFAULT_AGENT_PERMISSION_CONFIG, aP as DeliverySemantics, aQ as DirectAddress, aR as DisconnectPolicy, aS as DisconnectRequest, aT as DisconnectRequestParams, aU as ERROR_CODES, aV as EVENT_TYPES, aW as EXTENSION_METHODS, aX as EventInput, aY as EventNotification, aZ as EventNotificationParams, a_ as FEDERATION_ERROR_CODES, a$ as FEDERATION_METHODS, b0 as FederatedAddress, b1 as FederationAuth, b2 as FederationConnectRequest, b3 as FederationConnectRequestParams, b4 as FederationMetadata, b5 as FederationReplayConfig, b6 as FederationRouteRequest, b7 as FederationRouteRequestParams, b8 as GatewayReconnectionEvent, b9 as GatewayReconnectionEventHandler, ba as GatewayReconnectionEventType, bb as GatewayReconnectionOptions, bc as GraphEdge, bd as HierarchicalAddress, be as InjectDelivery, bf as InjectDeliveryResult, bg as InjectRequest, bh as InjectRequestParams, bi as InjectResponseResult, bj as JSONRPC_VERSION, bk as JoinPolicy, bl as LIFECYCLE_METHODS, bm as MAPNotification, bn as MAPNotificationBase, bo as MAPRequest, bp as MAPRequestBase, bq as MAPResponse, br as MAPResponseError, bs as MAPResponseSuccess, bt as MAP_METHODS, bu as MessageDeliveredEventData, bv as MessageFailedEventData, bw as MessageHandler, bx as MessageMeta, by as MessageNotification, bz as MessageNotificationParams, bA as MessagePriority, bB as MessageRelationship, bC as MessageSentEventData, bD as MessageVisibility, bE as Meta, bF as MultiAddress, bG as NOTIFICATION_METHODS, bH as NotificationHandler, bI as OBSERVATION_METHODS, bJ as OverflowHandler, bK as OverflowInfo, bL as PERMISSION_METHODS, bM as PROTOCOL_ERROR_CODES, bN as PROTOCOL_VERSION, bO as Participant, bP as ParticipantAddress, bQ as PermissionAction, bR as PermissionContext, bS as PermissionParticipant, bT as PermissionResult, bU as PermissionSystemConfig, bV as PermissionsAgentUpdatedEventData, bW as PermissionsClientUpdatedEventData, bX as PermissionsUpdateRequest, bY as PermissionsUpdateRequestParams, bZ as PermissionsUpdateResponseResult, b_ as RESOURCE_ERROR_CODES, b$ as ROUTING_ERROR_CODES, c0 as ReconnectionEventHandler, c1 as ReconnectionEventType, c2 as ReconnectionOptions, c3 as ReplayRequest, c4 as ReplayRequestParams, c5 as ReplayResponseResult, c6 as ReplayedEvent, c7 as RequestHandler, c8 as RoleAddress, c9 as SCOPE_METHODS, ca as SESSION_METHODS, cb as STATE_METHODS, cc as STEERING_METHODS, cd as STRUCTURE_METHODS, ce as ScopeAddress, cf as ScopeMessagingRule, cg as ScopeVisibility, ch as ScopeVisibilityRule, ci as ScopesCreateRequest, cj as ScopesCreateRequestParams, ck as ScopesDeleteRequest, cl as ScopesDeleteRequestParams, cm as ScopesDeleteResponseResult, cn as ScopesGetRequest, co as ScopesGetRequestParams, cp as ScopesGetResponseResult, cq as ScopesJoinRequest, cr as ScopesJoinRequestParams, cs as ScopesLeaveRequest, ct as ScopesLeaveRequestParams, cu as ScopesListRequest, cv as ScopesListRequestParams, cw as ScopesMembersRequest, cx as ScopesMembersRequestParams, cy as ScopesMembersResponseResult, cz as SendPolicy, cA as SendRequest, cB as SendRequestParams, cC as SessionCloseRequest, cD as SessionCloseRequestParams, cE as SessionCloseResponseResult, cF as SessionListRequest, cG as SessionListRequestParams, cH as SessionListResponseResult, cI as SessionLoadRequest, cJ as SessionLoadRequestParams, cK as SessionLoadResponseResult, cL as StateChangeHandler, cM as StreamingCapabilities, cN as StructureGraphRequest, cO as StructureGraphRequestParams, cP as StructureGraphResponseResult, cQ as StructureVisibilityRule, cR as SubscribeRequest, cS as SubscribeRequestParams, cT as Subscription, cU as SubscriptionAckNotification, cV as SubscriptionAckParams, cW as SubscriptionOptions, cX as SubscriptionState, cY as SystemAcceptanceRule, cZ as SystemAddress, c_ as Timestamp, c$ as TransportType, d0 as UnsubscribeRequest, d1 as UnsubscribeRequestParams, d2 as canAgentAcceptMessage, d3 as canAgentMessageAgent, d4 as canAgentSeeAgent, d5 as canControlAgent, d6 as canJoinScope, d7 as canMessageAgent, d8 as canPerformAction, d9 as canPerformMethod, da as canSeeAgent, db as canSeeScope, dc as canSendToScope, dd as createEvent, de as createStreamPair, df as createSubscription, dg as deepMergePermissions, dh as filterVisibleAgents, di as filterVisibleEvents, dj as filterVisibleScopes, dk as hasCapability, dl as isAgentExposed, dm as isBroadcastAddress, dn as isDirectAddress, dp as isEventTypeExposed, dq as isFederatedAddress, dr as isHierarchicalAddress, ds as isOrphanedAgent, dt as isScopeExposed, du as isSuccessResponse, dv as mapVisibilityToRule, dw as ndJsonStream, dx as resolveAgentPermissions, dy as waitForOpen, dz as websocketStream } from './index-Z76qC_Us.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export { monotonicFactory, ulid } from 'ulid';
|
|
5
5
|
|
|
@@ -2017,6 +2017,12 @@ interface CausalEvent {
|
|
|
2017
2017
|
/** Timestamp when the event was received */
|
|
2018
2018
|
receivedAt?: number;
|
|
2019
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Mode for handling events with multiple causal dependencies.
|
|
2022
|
+
* - "all": Wait for ALL causes before releasing (stricter, default)
|
|
2023
|
+
* - "any": Release when ANY cause is seen (more permissive)
|
|
2024
|
+
*/
|
|
2025
|
+
type MultiCauseMode = "all" | "any";
|
|
2020
2026
|
/**
|
|
2021
2027
|
* Options for CausalEventBuffer
|
|
2022
2028
|
*/
|
|
@@ -2031,6 +2037,12 @@ interface CausalEventBufferOptions {
|
|
|
2031
2037
|
* Default: 1000. Prevents unbounded memory growth.
|
|
2032
2038
|
*/
|
|
2033
2039
|
maxBufferSize?: number;
|
|
2040
|
+
/**
|
|
2041
|
+
* Mode for handling events with multiple causes.
|
|
2042
|
+
* - "all" (default): Wait for ALL causes before releasing
|
|
2043
|
+
* - "any": Release when ANY cause is seen
|
|
2044
|
+
*/
|
|
2045
|
+
multiCauseMode?: MultiCauseMode;
|
|
2034
2046
|
/**
|
|
2035
2047
|
* Callback when an event is released despite missing predecessors (timeout or buffer overflow).
|
|
2036
2048
|
*/
|
|
@@ -2077,6 +2089,10 @@ interface CausalBufferPushResult {
|
|
|
2077
2089
|
declare class CausalEventBuffer {
|
|
2078
2090
|
#private;
|
|
2079
2091
|
constructor(options?: CausalEventBufferOptions);
|
|
2092
|
+
/**
|
|
2093
|
+
* Get the current multi-cause mode.
|
|
2094
|
+
*/
|
|
2095
|
+
get multiCauseMode(): MultiCauseMode;
|
|
2080
2096
|
/**
|
|
2081
2097
|
* Push an event into the buffer.
|
|
2082
2098
|
*
|
|
@@ -2285,4 +2301,110 @@ declare function isValidEnvelope(obj: unknown): obj is FederationEnvelope<unknow
|
|
|
2285
2301
|
*/
|
|
2286
2302
|
declare function withPayload<T, U>(envelope: FederationEnvelope<T>, newPayload: U): FederationEnvelope<U>;
|
|
2287
2303
|
|
|
2288
|
-
|
|
2304
|
+
/**
|
|
2305
|
+
* Address utilities for recipient disambiguation
|
|
2306
|
+
*
|
|
2307
|
+
* Provides utilities for parsing and formatting message addresses
|
|
2308
|
+
* with type prefixes to distinguish between agent and scope recipients.
|
|
2309
|
+
*
|
|
2310
|
+
* Format: "{type}:{id}"
|
|
2311
|
+
* - agent:abc123 -> agent recipient
|
|
2312
|
+
* - scope:room-1 -> scope recipient
|
|
2313
|
+
*/
|
|
2314
|
+
/** Valid address types */
|
|
2315
|
+
type AddressType = "agent" | "scope";
|
|
2316
|
+
/** Parsed address components */
|
|
2317
|
+
interface AddressComponents {
|
|
2318
|
+
type: AddressType;
|
|
2319
|
+
id: string;
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Error thrown when an address format is invalid.
|
|
2323
|
+
*/
|
|
2324
|
+
declare class InvalidAddressError extends Error {
|
|
2325
|
+
constructor(address: string, reason: string);
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Format an address with type prefix.
|
|
2329
|
+
*
|
|
2330
|
+
* @param type - The address type (agent or scope)
|
|
2331
|
+
* @param id - The entity ID
|
|
2332
|
+
* @returns Formatted address string
|
|
2333
|
+
* @throws InvalidAddressError if parameters are invalid
|
|
2334
|
+
*
|
|
2335
|
+
* @example
|
|
2336
|
+
* formatAddress("agent", "abc123") // "agent:abc123"
|
|
2337
|
+
* formatAddress("scope", "room-1") // "scope:room-1"
|
|
2338
|
+
*/
|
|
2339
|
+
declare function formatAddress(type: AddressType, id: string): string;
|
|
2340
|
+
/**
|
|
2341
|
+
* Parse an address string into its components.
|
|
2342
|
+
*
|
|
2343
|
+
* @param address - The address string to parse
|
|
2344
|
+
* @returns Parsed address components
|
|
2345
|
+
* @throws InvalidAddressError if format is invalid
|
|
2346
|
+
*
|
|
2347
|
+
* @example
|
|
2348
|
+
* parseAddress("agent:abc123") // { type: "agent", id: "abc123" }
|
|
2349
|
+
* parseAddress("scope:room-1") // { type: "scope", id: "room-1" }
|
|
2350
|
+
*/
|
|
2351
|
+
declare function parseAddress(address: string): AddressComponents;
|
|
2352
|
+
/**
|
|
2353
|
+
* Check if a string is a valid prefixed address.
|
|
2354
|
+
*
|
|
2355
|
+
* @param address - The string to check
|
|
2356
|
+
* @returns true if valid prefixed address format
|
|
2357
|
+
*
|
|
2358
|
+
* @example
|
|
2359
|
+
* isAddress("agent:abc123") // true
|
|
2360
|
+
* isAddress("scope:room-1") // true
|
|
2361
|
+
* isAddress("abc123") // false (no prefix)
|
|
2362
|
+
* isAddress("invalid:abc") // false (invalid type)
|
|
2363
|
+
*/
|
|
2364
|
+
declare function isAddress(address: string): boolean;
|
|
2365
|
+
/**
|
|
2366
|
+
* Check if an address is for an agent.
|
|
2367
|
+
*
|
|
2368
|
+
* @param address - The address string to check
|
|
2369
|
+
* @returns true if address is for an agent
|
|
2370
|
+
*/
|
|
2371
|
+
declare function isAgentAddress(address: string): boolean;
|
|
2372
|
+
/**
|
|
2373
|
+
* Check if an address is for a scope.
|
|
2374
|
+
*
|
|
2375
|
+
* @param address - The address string to check
|
|
2376
|
+
* @returns true if address is for a scope
|
|
2377
|
+
*/
|
|
2378
|
+
declare function isScopeAddress(address: string): boolean;
|
|
2379
|
+
/**
|
|
2380
|
+
* Extract the ID from an address, or return the original if not prefixed.
|
|
2381
|
+
*
|
|
2382
|
+
* Useful for backward compatibility when handling both prefixed and unprefixed addresses.
|
|
2383
|
+
*
|
|
2384
|
+
* @param address - The address string
|
|
2385
|
+
* @returns The extracted ID or the original string
|
|
2386
|
+
*/
|
|
2387
|
+
declare function extractId(address: string): string;
|
|
2388
|
+
/**
|
|
2389
|
+
* Extract the type from an address, or return undefined if not prefixed.
|
|
2390
|
+
*
|
|
2391
|
+
* @param address - The address string
|
|
2392
|
+
* @returns The address type or undefined
|
|
2393
|
+
*/
|
|
2394
|
+
declare function extractType(address: string): AddressType | undefined;
|
|
2395
|
+
/**
|
|
2396
|
+
* Convenience function to create an agent address.
|
|
2397
|
+
*
|
|
2398
|
+
* @param agentId - The agent ID
|
|
2399
|
+
* @returns Formatted agent address
|
|
2400
|
+
*/
|
|
2401
|
+
declare function toAgent(agentId: string): string;
|
|
2402
|
+
/**
|
|
2403
|
+
* Convenience function to create a scope address.
|
|
2404
|
+
*
|
|
2405
|
+
* @param scopeId - The scope ID
|
|
2406
|
+
* @returns Formatted scope address
|
|
2407
|
+
*/
|
|
2408
|
+
declare function toScope(scopeId: string): string;
|
|
2409
|
+
|
|
2410
|
+
export { Address, type AddressComponents, AddressSchema, type AddressType, type AddressValidated, Agent, 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 };
|
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 } from './index-
|
|
2
|
-
export { O as AGENT_ERROR_CODES, Q as AUTH_ERROR_CODES, T as AUTH_METHODS, V as AcceptanceContext, W as AgentAcceptanceRule, X as
|
|
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-Z76qC_Us.js';
|
|
2
|
+
export { O as AGENT_ERROR_CODES, Q as AUTH_ERROR_CODES, T as AUTH_METHODS, V as AcceptanceContext, W as AgentAcceptanceRule, X as AgentConnectOptions, Y as AgentConnection, Z as AgentConnectionOptions, _ as AgentIncludeOptions, $ as AgentLifecycle, a0 as AgentMessagingRule, a1 as AgentPermissionConfig, a2 as AgentPermissions, a3 as AgentReconnectionEventHandler, a4 as AgentReconnectionEventType, a5 as AgentReconnectionOptions, a6 as AgentRelationship, a7 as AgentRelationshipType, a8 as AgentState, a9 as AgentVisibility, aa as AgentVisibilityRule, ab as AgentsGetRequest, ac as AgentsGetRequestParams, ad as AgentsListFilter, ae as AgentsListRequest, af as AgentsListRequestParams, ag as AgentsRegisterRequest, ah as AgentsRegisterRequestParams, ai as AgentsResumeRequest, aj as AgentsResumeRequestParams, ak as AgentsResumeResponseResult, al as AgentsSpawnRequest, am as AgentsSpawnRequestParams, an as AgentsStopRequest, ao as AgentsStopRequestParams, ap as AgentsStopResponseResult, aq as AgentsSuspendRequest, ar as AgentsSuspendRequestParams, as as AgentsSuspendResponseResult, at as AgentsUnregisterRequest, au as AgentsUnregisterRequestParams, av as AgentsUpdateRequest, aw as AgentsUpdateRequestParams, ax as AnyMessage, ay as AuthMethod, az as AuthParams, aA as AuthRefreshRequest, aB as AuthRefreshRequestParams, aC as AuthRefreshResponseResult, aD as BaseConnection, aE as BroadcastAddress, aF as CAPABILITY_REQUIREMENTS, aG as CORE_METHODS, aH as ClientAcceptanceRule, aI as ClientConnectOptions, aJ as ClientConnection, aK as ClientConnectionOptions, aL as ConnectRequest, aM as ConnectRequestParams, aN as CorrelationId, aO as DEFAULT_AGENT_PERMISSION_CONFIG, aP as DeliverySemantics, aQ as DirectAddress, aR as DisconnectPolicy, aS as DisconnectRequest, aT as DisconnectRequestParams, aU as ERROR_CODES, aV as EVENT_TYPES, aW as EXTENSION_METHODS, aX as EventInput, aY as EventNotification, aZ as EventNotificationParams, a_ as FEDERATION_ERROR_CODES, a$ as FEDERATION_METHODS, b0 as FederatedAddress, b1 as FederationAuth, b2 as FederationConnectRequest, b3 as FederationConnectRequestParams, b4 as FederationMetadata, b5 as FederationReplayConfig, b6 as FederationRouteRequest, b7 as FederationRouteRequestParams, b8 as GatewayReconnectionEvent, b9 as GatewayReconnectionEventHandler, ba as GatewayReconnectionEventType, bb as GatewayReconnectionOptions, bc as GraphEdge, bd as HierarchicalAddress, be as InjectDelivery, bf as InjectDeliveryResult, bg as InjectRequest, bh as InjectRequestParams, bi as InjectResponseResult, bj as JSONRPC_VERSION, bk as JoinPolicy, bl as LIFECYCLE_METHODS, bm as MAPNotification, bn as MAPNotificationBase, bo as MAPRequest, bp as MAPRequestBase, bq as MAPResponse, br as MAPResponseError, bs as MAPResponseSuccess, bt as MAP_METHODS, bu as MessageDeliveredEventData, bv as MessageFailedEventData, bw as MessageHandler, bx as MessageMeta, by as MessageNotification, bz as MessageNotificationParams, bA as MessagePriority, bB as MessageRelationship, bC as MessageSentEventData, bD as MessageVisibility, bE as Meta, bF as MultiAddress, bG as NOTIFICATION_METHODS, bH as NotificationHandler, bI as OBSERVATION_METHODS, bJ as OverflowHandler, bK as OverflowInfo, bL as PERMISSION_METHODS, bM as PROTOCOL_ERROR_CODES, bN as PROTOCOL_VERSION, bO as Participant, bP as ParticipantAddress, bQ as PermissionAction, bR as PermissionContext, bS as PermissionParticipant, bT as PermissionResult, bU as PermissionSystemConfig, bV as PermissionsAgentUpdatedEventData, bW as PermissionsClientUpdatedEventData, bX as PermissionsUpdateRequest, bY as PermissionsUpdateRequestParams, bZ as PermissionsUpdateResponseResult, b_ as RESOURCE_ERROR_CODES, b$ as ROUTING_ERROR_CODES, c0 as ReconnectionEventHandler, c1 as ReconnectionEventType, c2 as ReconnectionOptions, c3 as ReplayRequest, c4 as ReplayRequestParams, c5 as ReplayResponseResult, c6 as ReplayedEvent, c7 as RequestHandler, c8 as RoleAddress, c9 as SCOPE_METHODS, ca as SESSION_METHODS, cb as STATE_METHODS, cc as STEERING_METHODS, cd as STRUCTURE_METHODS, ce as ScopeAddress, cf as ScopeMessagingRule, cg as ScopeVisibility, ch as ScopeVisibilityRule, ci as ScopesCreateRequest, cj as ScopesCreateRequestParams, ck as ScopesDeleteRequest, cl as ScopesDeleteRequestParams, cm as ScopesDeleteResponseResult, cn as ScopesGetRequest, co as ScopesGetRequestParams, cp as ScopesGetResponseResult, cq as ScopesJoinRequest, cr as ScopesJoinRequestParams, cs as ScopesLeaveRequest, ct as ScopesLeaveRequestParams, cu as ScopesListRequest, cv as ScopesListRequestParams, cw as ScopesMembersRequest, cx as ScopesMembersRequestParams, cy as ScopesMembersResponseResult, cz as SendPolicy, cA as SendRequest, cB as SendRequestParams, cC as SessionCloseRequest, cD as SessionCloseRequestParams, cE as SessionCloseResponseResult, cF as SessionListRequest, cG as SessionListRequestParams, cH as SessionListResponseResult, cI as SessionLoadRequest, cJ as SessionLoadRequestParams, cK as SessionLoadResponseResult, cL as StateChangeHandler, cM as StreamingCapabilities, cN as StructureGraphRequest, cO as StructureGraphRequestParams, cP as StructureGraphResponseResult, cQ as StructureVisibilityRule, cR as SubscribeRequest, cS as SubscribeRequestParams, cT as Subscription, cU as SubscriptionAckNotification, cV as SubscriptionAckParams, cW as SubscriptionOptions, cX as SubscriptionState, cY as SystemAcceptanceRule, cZ as SystemAddress, c_ as Timestamp, c$ as TransportType, d0 as UnsubscribeRequest, d1 as UnsubscribeRequestParams, d2 as canAgentAcceptMessage, d3 as canAgentMessageAgent, d4 as canAgentSeeAgent, d5 as canControlAgent, d6 as canJoinScope, d7 as canMessageAgent, d8 as canPerformAction, d9 as canPerformMethod, da as canSeeAgent, db as canSeeScope, dc as canSendToScope, dd as createEvent, de as createStreamPair, df as createSubscription, dg as deepMergePermissions, dh as filterVisibleAgents, di as filterVisibleEvents, dj as filterVisibleScopes, dk as hasCapability, dl as isAgentExposed, dm as isBroadcastAddress, dn as isDirectAddress, dp as isEventTypeExposed, dq as isFederatedAddress, dr as isHierarchicalAddress, ds as isOrphanedAgent, dt as isScopeExposed, du as isSuccessResponse, dv as mapVisibilityToRule, dw as ndJsonStream, dx as resolveAgentPermissions, dy as waitForOpen, dz as websocketStream } from './index-Z76qC_Us.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export { monotonicFactory, ulid } from 'ulid';
|
|
5
5
|
|
|
@@ -2017,6 +2017,12 @@ interface CausalEvent {
|
|
|
2017
2017
|
/** Timestamp when the event was received */
|
|
2018
2018
|
receivedAt?: number;
|
|
2019
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Mode for handling events with multiple causal dependencies.
|
|
2022
|
+
* - "all": Wait for ALL causes before releasing (stricter, default)
|
|
2023
|
+
* - "any": Release when ANY cause is seen (more permissive)
|
|
2024
|
+
*/
|
|
2025
|
+
type MultiCauseMode = "all" | "any";
|
|
2020
2026
|
/**
|
|
2021
2027
|
* Options for CausalEventBuffer
|
|
2022
2028
|
*/
|
|
@@ -2031,6 +2037,12 @@ interface CausalEventBufferOptions {
|
|
|
2031
2037
|
* Default: 1000. Prevents unbounded memory growth.
|
|
2032
2038
|
*/
|
|
2033
2039
|
maxBufferSize?: number;
|
|
2040
|
+
/**
|
|
2041
|
+
* Mode for handling events with multiple causes.
|
|
2042
|
+
* - "all" (default): Wait for ALL causes before releasing
|
|
2043
|
+
* - "any": Release when ANY cause is seen
|
|
2044
|
+
*/
|
|
2045
|
+
multiCauseMode?: MultiCauseMode;
|
|
2034
2046
|
/**
|
|
2035
2047
|
* Callback when an event is released despite missing predecessors (timeout or buffer overflow).
|
|
2036
2048
|
*/
|
|
@@ -2077,6 +2089,10 @@ interface CausalBufferPushResult {
|
|
|
2077
2089
|
declare class CausalEventBuffer {
|
|
2078
2090
|
#private;
|
|
2079
2091
|
constructor(options?: CausalEventBufferOptions);
|
|
2092
|
+
/**
|
|
2093
|
+
* Get the current multi-cause mode.
|
|
2094
|
+
*/
|
|
2095
|
+
get multiCauseMode(): MultiCauseMode;
|
|
2080
2096
|
/**
|
|
2081
2097
|
* Push an event into the buffer.
|
|
2082
2098
|
*
|
|
@@ -2285,4 +2301,110 @@ declare function isValidEnvelope(obj: unknown): obj is FederationEnvelope<unknow
|
|
|
2285
2301
|
*/
|
|
2286
2302
|
declare function withPayload<T, U>(envelope: FederationEnvelope<T>, newPayload: U): FederationEnvelope<U>;
|
|
2287
2303
|
|
|
2288
|
-
|
|
2304
|
+
/**
|
|
2305
|
+
* Address utilities for recipient disambiguation
|
|
2306
|
+
*
|
|
2307
|
+
* Provides utilities for parsing and formatting message addresses
|
|
2308
|
+
* with type prefixes to distinguish between agent and scope recipients.
|
|
2309
|
+
*
|
|
2310
|
+
* Format: "{type}:{id}"
|
|
2311
|
+
* - agent:abc123 -> agent recipient
|
|
2312
|
+
* - scope:room-1 -> scope recipient
|
|
2313
|
+
*/
|
|
2314
|
+
/** Valid address types */
|
|
2315
|
+
type AddressType = "agent" | "scope";
|
|
2316
|
+
/** Parsed address components */
|
|
2317
|
+
interface AddressComponents {
|
|
2318
|
+
type: AddressType;
|
|
2319
|
+
id: string;
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Error thrown when an address format is invalid.
|
|
2323
|
+
*/
|
|
2324
|
+
declare class InvalidAddressError extends Error {
|
|
2325
|
+
constructor(address: string, reason: string);
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Format an address with type prefix.
|
|
2329
|
+
*
|
|
2330
|
+
* @param type - The address type (agent or scope)
|
|
2331
|
+
* @param id - The entity ID
|
|
2332
|
+
* @returns Formatted address string
|
|
2333
|
+
* @throws InvalidAddressError if parameters are invalid
|
|
2334
|
+
*
|
|
2335
|
+
* @example
|
|
2336
|
+
* formatAddress("agent", "abc123") // "agent:abc123"
|
|
2337
|
+
* formatAddress("scope", "room-1") // "scope:room-1"
|
|
2338
|
+
*/
|
|
2339
|
+
declare function formatAddress(type: AddressType, id: string): string;
|
|
2340
|
+
/**
|
|
2341
|
+
* Parse an address string into its components.
|
|
2342
|
+
*
|
|
2343
|
+
* @param address - The address string to parse
|
|
2344
|
+
* @returns Parsed address components
|
|
2345
|
+
* @throws InvalidAddressError if format is invalid
|
|
2346
|
+
*
|
|
2347
|
+
* @example
|
|
2348
|
+
* parseAddress("agent:abc123") // { type: "agent", id: "abc123" }
|
|
2349
|
+
* parseAddress("scope:room-1") // { type: "scope", id: "room-1" }
|
|
2350
|
+
*/
|
|
2351
|
+
declare function parseAddress(address: string): AddressComponents;
|
|
2352
|
+
/**
|
|
2353
|
+
* Check if a string is a valid prefixed address.
|
|
2354
|
+
*
|
|
2355
|
+
* @param address - The string to check
|
|
2356
|
+
* @returns true if valid prefixed address format
|
|
2357
|
+
*
|
|
2358
|
+
* @example
|
|
2359
|
+
* isAddress("agent:abc123") // true
|
|
2360
|
+
* isAddress("scope:room-1") // true
|
|
2361
|
+
* isAddress("abc123") // false (no prefix)
|
|
2362
|
+
* isAddress("invalid:abc") // false (invalid type)
|
|
2363
|
+
*/
|
|
2364
|
+
declare function isAddress(address: string): boolean;
|
|
2365
|
+
/**
|
|
2366
|
+
* Check if an address is for an agent.
|
|
2367
|
+
*
|
|
2368
|
+
* @param address - The address string to check
|
|
2369
|
+
* @returns true if address is for an agent
|
|
2370
|
+
*/
|
|
2371
|
+
declare function isAgentAddress(address: string): boolean;
|
|
2372
|
+
/**
|
|
2373
|
+
* Check if an address is for a scope.
|
|
2374
|
+
*
|
|
2375
|
+
* @param address - The address string to check
|
|
2376
|
+
* @returns true if address is for a scope
|
|
2377
|
+
*/
|
|
2378
|
+
declare function isScopeAddress(address: string): boolean;
|
|
2379
|
+
/**
|
|
2380
|
+
* Extract the ID from an address, or return the original if not prefixed.
|
|
2381
|
+
*
|
|
2382
|
+
* Useful for backward compatibility when handling both prefixed and unprefixed addresses.
|
|
2383
|
+
*
|
|
2384
|
+
* @param address - The address string
|
|
2385
|
+
* @returns The extracted ID or the original string
|
|
2386
|
+
*/
|
|
2387
|
+
declare function extractId(address: string): string;
|
|
2388
|
+
/**
|
|
2389
|
+
* Extract the type from an address, or return undefined if not prefixed.
|
|
2390
|
+
*
|
|
2391
|
+
* @param address - The address string
|
|
2392
|
+
* @returns The address type or undefined
|
|
2393
|
+
*/
|
|
2394
|
+
declare function extractType(address: string): AddressType | undefined;
|
|
2395
|
+
/**
|
|
2396
|
+
* Convenience function to create an agent address.
|
|
2397
|
+
*
|
|
2398
|
+
* @param agentId - The agent ID
|
|
2399
|
+
* @returns Formatted agent address
|
|
2400
|
+
*/
|
|
2401
|
+
declare function toAgent(agentId: string): string;
|
|
2402
|
+
/**
|
|
2403
|
+
* Convenience function to create a scope address.
|
|
2404
|
+
*
|
|
2405
|
+
* @param scopeId - The scope ID
|
|
2406
|
+
* @returns Formatted scope address
|
|
2407
|
+
*/
|
|
2408
|
+
declare function toScope(scopeId: string): string;
|
|
2409
|
+
|
|
2410
|
+
export { Address, type AddressComponents, AddressSchema, type AddressType, type AddressValidated, Agent, 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 };
|