@multi-agent-protocol/sdk 0.0.2 → 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.js CHANGED
@@ -225,9 +225,6 @@ function isDirectAddress(address) {
225
225
  function isFederatedAddress(address) {
226
226
  return typeof address === "object" && "system" in address && "agent" in address;
227
227
  }
228
- function isScopeAddress(address) {
229
- return typeof address === "object" && "scope" in address;
230
- }
231
228
  function isBroadcastAddress(address) {
232
229
  return typeof address === "object" && "broadcast" in address;
233
230
  }
@@ -717,6 +714,30 @@ function websocketStream(ws) {
717
714
  });
718
715
  return { readable, writable };
719
716
  }
717
+ function waitForOpen(ws, timeoutMs = 1e4) {
718
+ return new Promise((resolve, reject) => {
719
+ if (ws.readyState === WebSocket.OPEN) {
720
+ resolve();
721
+ return;
722
+ }
723
+ const timeout = setTimeout(() => {
724
+ ws.close();
725
+ reject(new Error(`WebSocket connection timeout after ${timeoutMs}ms`));
726
+ }, timeoutMs);
727
+ const onOpen = () => {
728
+ clearTimeout(timeout);
729
+ ws.removeEventListener("error", onError);
730
+ resolve();
731
+ };
732
+ const onError = () => {
733
+ clearTimeout(timeout);
734
+ ws.removeEventListener("open", onOpen);
735
+ reject(new Error("WebSocket connection failed"));
736
+ };
737
+ ws.addEventListener("open", onOpen, { once: true });
738
+ ws.addEventListener("error", onError, { once: true });
739
+ });
740
+ }
720
741
  function createStreamPair() {
721
742
  const clientToServer = [];
722
743
  const serverToClient = [];
@@ -1523,9 +1544,16 @@ var CausalEventBuffer = class {
1523
1544
  this.#options = {
1524
1545
  maxWaitTime: options.maxWaitTime ?? 5e3,
1525
1546
  maxBufferSize: options.maxBufferSize ?? 1e3,
1547
+ multiCauseMode: options.multiCauseMode ?? "all",
1526
1548
  onForcedRelease: options.onForcedRelease
1527
1549
  };
1528
1550
  }
1551
+ /**
1552
+ * Get the current multi-cause mode.
1553
+ */
1554
+ get multiCauseMode() {
1555
+ return this.#options.multiCauseMode;
1556
+ }
1529
1557
  /**
1530
1558
  * Push an event into the buffer.
1531
1559
  *
@@ -1541,13 +1569,14 @@ var CausalEventBuffer = class {
1541
1569
  if (!event.receivedAt) {
1542
1570
  event = { ...event, receivedAt: Date.now() };
1543
1571
  }
1544
- const missingPredecessors = this.#getMissingPredecessors(event);
1545
- if (missingPredecessors.length === 0) {
1572
+ const shouldRelease = this.#shouldReleaseEvent(event);
1573
+ if (shouldRelease) {
1546
1574
  ready.push(event);
1547
1575
  this.#releaseWaiting(event.eventId, ready);
1548
1576
  } else {
1549
1577
  this.#pending.set(event.eventId, event);
1550
- for (const predecessorId of missingPredecessors) {
1578
+ const predecessors = event.causedBy ?? [];
1579
+ for (const predecessorId of predecessors) {
1551
1580
  if (!this.#waitingFor.has(predecessorId)) {
1552
1581
  this.#waitingFor.set(predecessorId, /* @__PURE__ */ new Set());
1553
1582
  }
@@ -1606,6 +1635,20 @@ var CausalEventBuffer = class {
1606
1635
  this.#pending.clear();
1607
1636
  this.#waitingFor.clear();
1608
1637
  }
1638
+ /**
1639
+ * Check if an event should be released based on its predecessors and the multi-cause mode.
1640
+ */
1641
+ #shouldReleaseEvent(event) {
1642
+ if (!event.causedBy || event.causedBy.length === 0) {
1643
+ return true;
1644
+ }
1645
+ const missingPredecessors = this.#getMissingPredecessors(event);
1646
+ if (this.#options.multiCauseMode === "any") {
1647
+ return missingPredecessors.length < event.causedBy.length;
1648
+ } else {
1649
+ return missingPredecessors.length === 0;
1650
+ }
1651
+ }
1609
1652
  /**
1610
1653
  * Get missing predecessors for an event.
1611
1654
  * A predecessor is considered "missing" if it hasn't been released yet
@@ -1629,9 +1672,21 @@ var CausalEventBuffer = class {
1629
1672
  for (const waitingEventId of waitingEventIds) {
1630
1673
  const waitingEvent = this.#pending.get(waitingEventId);
1631
1674
  if (!waitingEvent) continue;
1632
- const stillMissing = this.#getMissingPredecessors(waitingEvent);
1633
- if (stillMissing.length === 0) {
1675
+ if (this.#shouldReleaseEvent(waitingEvent)) {
1634
1676
  this.#pending.delete(waitingEventId);
1677
+ if (waitingEvent.causedBy) {
1678
+ for (const otherPredId of waitingEvent.causedBy) {
1679
+ if (otherPredId !== predecessorId) {
1680
+ const waiting = this.#waitingFor.get(otherPredId);
1681
+ if (waiting) {
1682
+ waiting.delete(waitingEventId);
1683
+ if (waiting.size === 0) {
1684
+ this.#waitingFor.delete(otherPredId);
1685
+ }
1686
+ }
1687
+ }
1688
+ }
1689
+ }
1635
1690
  ready.push(waitingEvent);
1636
1691
  this.#releaseWaiting(waitingEventId, ready);
1637
1692
  }
@@ -1745,7 +1800,7 @@ function sortCausalOrder(events) {
1745
1800
  }
1746
1801
 
1747
1802
  // src/connection/client.ts
1748
- var ClientConnection = class {
1803
+ var ClientConnection = class _ClientConnection {
1749
1804
  #connection;
1750
1805
  #subscriptions = /* @__PURE__ */ new Map();
1751
1806
  #subscriptionStates = /* @__PURE__ */ new Map();
@@ -1769,6 +1824,59 @@ var ClientConnection = class {
1769
1824
  }
1770
1825
  }
1771
1826
  // ===========================================================================
1827
+ // Static Factory Methods
1828
+ // ===========================================================================
1829
+ /**
1830
+ * Connect to a MAP server via WebSocket URL.
1831
+ *
1832
+ * Handles:
1833
+ * - WebSocket creation and connection
1834
+ * - Stream wrapping
1835
+ * - Auto-configuration of createStream for reconnection
1836
+ * - Initial MAP protocol connect handshake
1837
+ *
1838
+ * @param url - WebSocket URL (ws:// or wss://)
1839
+ * @param options - Connection options
1840
+ * @returns Connected ClientConnection instance
1841
+ *
1842
+ * @example
1843
+ * ```typescript
1844
+ * const client = await ClientConnection.connect('ws://localhost:8080', {
1845
+ * name: 'MyClient',
1846
+ * reconnection: true
1847
+ * });
1848
+ *
1849
+ * // Already connected, ready to use
1850
+ * const agents = await client.listAgents();
1851
+ * ```
1852
+ */
1853
+ static async connect(url, options) {
1854
+ const parsedUrl = new URL(url);
1855
+ if (!["ws:", "wss:"].includes(parsedUrl.protocol)) {
1856
+ throw new Error(
1857
+ `Unsupported protocol: ${parsedUrl.protocol}. Use ws: or wss:`
1858
+ );
1859
+ }
1860
+ const timeout = options?.connectTimeout ?? 1e4;
1861
+ const ws = new WebSocket(url);
1862
+ await waitForOpen(ws, timeout);
1863
+ const stream = websocketStream(ws);
1864
+ const createStream = async () => {
1865
+ const newWs = new WebSocket(url);
1866
+ await waitForOpen(newWs, timeout);
1867
+ return websocketStream(newWs);
1868
+ };
1869
+ const reconnection = options?.reconnection === true ? { enabled: true } : typeof options?.reconnection === "object" ? options.reconnection : void 0;
1870
+ const client = new _ClientConnection(stream, {
1871
+ name: options?.name,
1872
+ capabilities: options?.capabilities,
1873
+ createStream,
1874
+ reconnection
1875
+ });
1876
+ await client.connect({ auth: options?.auth });
1877
+ return client;
1878
+ }
1879
+ // ===========================================================================
1772
1880
  // Connection Lifecycle
1773
1881
  // ===========================================================================
1774
1882
  /**
@@ -1781,6 +1889,7 @@ var ClientConnection = class {
1781
1889
  name: this.#options.name,
1782
1890
  capabilities: this.#options.capabilities,
1783
1891
  sessionId: options?.sessionId,
1892
+ resumeToken: options?.resumeToken,
1784
1893
  auth: options?.auth
1785
1894
  };
1786
1895
  const result = await this.#connection.sendRequest(CORE_METHODS.CONNECT, params);
@@ -1793,14 +1902,18 @@ var ClientConnection = class {
1793
1902
  }
1794
1903
  /**
1795
1904
  * Disconnect from the MAP system
1905
+ * @param reason - Optional reason for disconnecting
1906
+ * @returns Resume token that can be used to resume this session later
1796
1907
  */
1797
1908
  async disconnect(reason) {
1798
- if (!this.#connected) return;
1909
+ if (!this.#connected) return void 0;
1910
+ let resumeToken;
1799
1911
  try {
1800
- await this.#connection.sendRequest(
1912
+ const result = await this.#connection.sendRequest(
1801
1913
  CORE_METHODS.DISCONNECT,
1802
1914
  reason ? { reason } : void 0
1803
1915
  );
1916
+ resumeToken = result.resumeToken;
1804
1917
  } finally {
1805
1918
  for (const subscription of this.#subscriptions.values()) {
1806
1919
  subscription._close();
@@ -1809,6 +1922,7 @@ var ClientConnection = class {
1809
1922
  await this.#connection.close();
1810
1923
  this.#connected = false;
1811
1924
  }
1925
+ return resumeToken;
1812
1926
  }
1813
1927
  /**
1814
1928
  * Whether the client is connected
@@ -2344,7 +2458,7 @@ var ClientConnection = class {
2344
2458
  };
2345
2459
 
2346
2460
  // src/connection/agent.ts
2347
- var AgentConnection = class {
2461
+ var AgentConnection = class _AgentConnection {
2348
2462
  #connection;
2349
2463
  #subscriptions = /* @__PURE__ */ new Map();
2350
2464
  #options;
@@ -2371,6 +2485,66 @@ var AgentConnection = class {
2371
2485
  }
2372
2486
  }
2373
2487
  // ===========================================================================
2488
+ // Static Factory Methods
2489
+ // ===========================================================================
2490
+ /**
2491
+ * Connect and register an agent via WebSocket URL.
2492
+ *
2493
+ * Handles:
2494
+ * - WebSocket creation and connection
2495
+ * - Stream wrapping
2496
+ * - Auto-configuration of createStream for reconnection
2497
+ * - Initial MAP protocol connect handshake
2498
+ * - Agent registration
2499
+ *
2500
+ * @param url - WebSocket URL (ws:// or wss://)
2501
+ * @param options - Connection and agent options
2502
+ * @returns Connected and registered AgentConnection instance
2503
+ *
2504
+ * @example
2505
+ * ```typescript
2506
+ * const agent = await AgentConnection.connect('ws://localhost:8080', {
2507
+ * name: 'Worker',
2508
+ * role: 'processor',
2509
+ * reconnection: true
2510
+ * });
2511
+ *
2512
+ * // Already registered, ready to work
2513
+ * agent.onMessage(handleMessage);
2514
+ * await agent.busy();
2515
+ * ```
2516
+ */
2517
+ static async connect(url, options) {
2518
+ const parsedUrl = new URL(url);
2519
+ if (!["ws:", "wss:"].includes(parsedUrl.protocol)) {
2520
+ throw new Error(
2521
+ `Unsupported protocol: ${parsedUrl.protocol}. Use ws: or wss:`
2522
+ );
2523
+ }
2524
+ const timeout = options?.connectTimeout ?? 1e4;
2525
+ const ws = new WebSocket(url);
2526
+ await waitForOpen(ws, timeout);
2527
+ const stream = websocketStream(ws);
2528
+ const createStream = async () => {
2529
+ const newWs = new WebSocket(url);
2530
+ await waitForOpen(newWs, timeout);
2531
+ return websocketStream(newWs);
2532
+ };
2533
+ const reconnection = options?.reconnection === true ? { enabled: true } : typeof options?.reconnection === "object" ? options.reconnection : void 0;
2534
+ const agent = new _AgentConnection(stream, {
2535
+ name: options?.name,
2536
+ role: options?.role,
2537
+ capabilities: options?.capabilities,
2538
+ visibility: options?.visibility,
2539
+ parent: options?.parent,
2540
+ scopes: options?.scopes,
2541
+ createStream,
2542
+ reconnection
2543
+ });
2544
+ await agent.connect({ auth: options?.auth });
2545
+ return agent;
2546
+ }
2547
+ // ===========================================================================
2374
2548
  // Connection Lifecycle
2375
2549
  // ===========================================================================
2376
2550
  /**
@@ -2383,6 +2557,7 @@ var AgentConnection = class {
2383
2557
  participantId: options?.agentId,
2384
2558
  name: this.#options.name,
2385
2559
  capabilities: this.#options.capabilities,
2560
+ resumeToken: options?.resumeToken,
2386
2561
  auth: options?.auth
2387
2562
  };
2388
2563
  const connectResult = await this.#connection.sendRequest(CORE_METHODS.CONNECT, connectParams);
@@ -2407,9 +2582,12 @@ var AgentConnection = class {
2407
2582
  }
2408
2583
  /**
2409
2584
  * Disconnect from the MAP system
2585
+ * @param reason - Optional reason for disconnecting
2586
+ * @returns Resume token that can be used to resume this session later
2410
2587
  */
2411
2588
  async disconnect(reason) {
2412
- if (!this.#connected) return;
2589
+ if (!this.#connected) return void 0;
2590
+ let resumeToken;
2413
2591
  try {
2414
2592
  if (this.#agentId) {
2415
2593
  await this.#connection.sendRequest(LIFECYCLE_METHODS.AGENTS_UNREGISTER, {
@@ -2417,10 +2595,11 @@ var AgentConnection = class {
2417
2595
  reason
2418
2596
  });
2419
2597
  }
2420
- await this.#connection.sendRequest(
2598
+ const result = await this.#connection.sendRequest(
2421
2599
  CORE_METHODS.DISCONNECT,
2422
2600
  reason ? { reason } : void 0
2423
2601
  );
2602
+ resumeToken = result.resumeToken;
2424
2603
  } finally {
2425
2604
  for (const subscription of this.#subscriptions.values()) {
2426
2605
  subscription._close();
@@ -2429,6 +2608,7 @@ var AgentConnection = class {
2429
2608
  await this.#connection.close();
2430
2609
  this.#connected = false;
2431
2610
  }
2611
+ return resumeToken;
2432
2612
  }
2433
2613
  /**
2434
2614
  * Whether the agent is connected
@@ -4348,6 +4528,89 @@ function canAgentMessageAgent(senderAgent, targetAgentId, context, config = DEFA
4348
4528
  return false;
4349
4529
  }
4350
4530
 
4351
- export { AGENT_ERROR_CODES, AUTH_ERROR_CODES, AUTH_METHODS, AddressSchema, AgentConnection, AgentIdSchema, AgentLifecycleSchema, AgentRelationshipSchema, AgentSchema, AgentStateSchema, AgentVisibilitySchema, BaseConnection, BroadcastAddressSchema, CAPABILITY_REQUIREMENTS, CORE_METHODS, CausalEventBuffer, ClientConnection, CorrelationIdSchema, DEFAULT_AGENT_PERMISSION_CONFIG, DEFAULT_RETRY_POLICY, DeliverySemanticsSchema, DirectAddressSchema, ERROR_CODES, EVENT_TYPES, EXTENSION_METHODS, ErrorCategorySchema, EventSchema, EventTypeSchema, FEDERATION_ERROR_CODES, FEDERATION_METHODS, FederatedAddressSchema, FederationOutageBuffer, GatewayConnection, HierarchicalAddressSchema, JSONRPC_VERSION, JsonRpcVersionSchema, LIFECYCLE_METHODS, MAPConnectionError, MAPErrorDataSchema, MAPErrorSchema, MAPNotificationSchema, MAPRequestError, MAPRequestSchema, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, MAPTimeoutError, MAP_METHODS, METHOD_REGISTRY, MessageIdSchema, MessageMetaSchema, MessagePrioritySchema, MessageRelationshipSchema, MessageSchema, MessageVisibilitySchema, MetaSchema, MultiAddressSchema, NOTIFICATION_METHODS, OBSERVATION_METHODS, PERMISSION_METHODS, PROTOCOL_ERROR_CODES, PROTOCOL_VERSION, ParticipantAddressSchema, ParticipantCapabilitiesSchema, ParticipantIdSchema, ParticipantTypeSchema, ProtocolVersionSchema, RESOURCE_ERROR_CODES, ROUTING_ERROR_CODES, RequestIdSchema, RoleAddressSchema, SCOPE_METHODS, SESSION_METHODS, STATE_METHODS, STEERING_METHODS, STRUCTURE_METHODS, ScopeAddressSchema, ScopeIdSchema, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, ScopeVisibilitySchema, SessionIdSchema, Subscription, SubscriptionFilterSchema, SubscriptionIdSchema, SystemAddressSchema, TimestampSchema, TransportTypeSchema, buildAgentsGetResponse, buildAgentsListResponse, buildAgentsRegisterResponse, buildAgentsSpawnResponse, buildAgentsUnregisterResponse, buildAgentsUpdateResponse, buildConnectResponse, buildDisconnectResponse, buildScopesCreateResponse, buildScopesJoinResponse, buildScopesLeaveResponse, buildScopesListResponse, buildSendResponse, buildSubscribeResponse, buildUnsubscribeResponse, calculateDelay, canAgentAcceptMessage, canAgentMessageAgent, canAgentSeeAgent, canControlAgent, canJoinScope, canMessageAgent, canPerformAction, canPerformMethod, canSeeAgent, canSeeScope, canSendToScope, compareUlid, createErrorResponse, createEvent, createFederationEnvelope, createNotification, createRequest, createRetryPolicy, createStreamPair, createSubscription, createSuccessResponse, deepMergePermissions, filterVisibleAgents, filterVisibleEvents, filterVisibleScopes, getEnvelopeRoutingInfo, getMethodInfo, getMethodsByCategory, getRequiredCapabilities, hasCapability, hasRequiredCapabilities, isAgentExposed, isBroadcastAddress, isDirectAddress, isEnvelopeAtDestination, isErrorResponse, isEventTypeExposed, isFederatedAddress, isHierarchicalAddress, isNotification, isOrphanedAgent, isRequest, isResponse, isScopeAddress, isScopeExposed, isSuccessResponse, isValidEnvelope, isValidUlid, mapVisibilityToRule, ndJsonStream, processFederationEnvelope, resolveAgentPermissions, retryable, sleep, sortCausalOrder, ulidTimestamp, unwrapEnvelope, validateCausalOrder, websocketStream, withPayload, withRetry };
4531
+ // src/server/messages/address.ts
4532
+ var SEPARATOR = ":";
4533
+ var VALID_ADDRESS_TYPES = ["agent", "scope"];
4534
+ var InvalidAddressError = class extends Error {
4535
+ constructor(address, reason) {
4536
+ super(`Invalid address "${address}": ${reason}`);
4537
+ this.name = "InvalidAddressError";
4538
+ }
4539
+ };
4540
+ function formatAddress(type, id) {
4541
+ if (!id) {
4542
+ throw new InvalidAddressError("", "ID cannot be empty");
4543
+ }
4544
+ if (id.includes(SEPARATOR)) {
4545
+ throw new InvalidAddressError(id, "ID cannot contain colon separator");
4546
+ }
4547
+ return `${type}${SEPARATOR}${id}`;
4548
+ }
4549
+ function parseAddress(address) {
4550
+ const separatorIndex = address.indexOf(SEPARATOR);
4551
+ if (separatorIndex === -1) {
4552
+ throw new InvalidAddressError(address, "missing type prefix");
4553
+ }
4554
+ const type = address.slice(0, separatorIndex);
4555
+ const id = address.slice(separatorIndex + 1);
4556
+ if (!VALID_ADDRESS_TYPES.includes(type)) {
4557
+ throw new InvalidAddressError(address, `invalid type "${type}", must be agent or scope`);
4558
+ }
4559
+ if (!id) {
4560
+ throw new InvalidAddressError(address, "ID cannot be empty");
4561
+ }
4562
+ return {
4563
+ type,
4564
+ id
4565
+ };
4566
+ }
4567
+ function isAddress(address) {
4568
+ try {
4569
+ parseAddress(address);
4570
+ return true;
4571
+ } catch {
4572
+ return false;
4573
+ }
4574
+ }
4575
+ function isAgentAddress(address) {
4576
+ try {
4577
+ const parsed = parseAddress(address);
4578
+ return parsed.type === "agent";
4579
+ } catch {
4580
+ return false;
4581
+ }
4582
+ }
4583
+ function isScopeAddress(address) {
4584
+ try {
4585
+ const parsed = parseAddress(address);
4586
+ return parsed.type === "scope";
4587
+ } catch {
4588
+ return false;
4589
+ }
4590
+ }
4591
+ function extractId(address) {
4592
+ try {
4593
+ const parsed = parseAddress(address);
4594
+ return parsed.id;
4595
+ } catch {
4596
+ return address;
4597
+ }
4598
+ }
4599
+ function extractType(address) {
4600
+ try {
4601
+ const parsed = parseAddress(address);
4602
+ return parsed.type;
4603
+ } catch {
4604
+ return void 0;
4605
+ }
4606
+ }
4607
+ function toAgent(agentId) {
4608
+ return formatAddress("agent", agentId);
4609
+ }
4610
+ function toScope(scopeId) {
4611
+ return formatAddress("scope", scopeId);
4612
+ }
4613
+
4614
+ export { AGENT_ERROR_CODES, AUTH_ERROR_CODES, AUTH_METHODS, AddressSchema, AgentConnection, AgentIdSchema, AgentLifecycleSchema, AgentRelationshipSchema, AgentSchema, AgentStateSchema, AgentVisibilitySchema, BaseConnection, BroadcastAddressSchema, CAPABILITY_REQUIREMENTS, CORE_METHODS, CausalEventBuffer, ClientConnection, CorrelationIdSchema, DEFAULT_AGENT_PERMISSION_CONFIG, DEFAULT_RETRY_POLICY, DeliverySemanticsSchema, DirectAddressSchema, ERROR_CODES, EVENT_TYPES, EXTENSION_METHODS, ErrorCategorySchema, EventSchema, EventTypeSchema, FEDERATION_ERROR_CODES, FEDERATION_METHODS, FederatedAddressSchema, FederationOutageBuffer, GatewayConnection, HierarchicalAddressSchema, InvalidAddressError, JSONRPC_VERSION, JsonRpcVersionSchema, LIFECYCLE_METHODS, MAPConnectionError, MAPErrorDataSchema, MAPErrorSchema, MAPNotificationSchema, MAPRequestError, MAPRequestSchema, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, MAPTimeoutError, MAP_METHODS, METHOD_REGISTRY, MessageIdSchema, MessageMetaSchema, MessagePrioritySchema, MessageRelationshipSchema, MessageSchema, MessageVisibilitySchema, MetaSchema, MultiAddressSchema, NOTIFICATION_METHODS, OBSERVATION_METHODS, PERMISSION_METHODS, PROTOCOL_ERROR_CODES, PROTOCOL_VERSION, ParticipantAddressSchema, ParticipantCapabilitiesSchema, ParticipantIdSchema, ParticipantTypeSchema, ProtocolVersionSchema, RESOURCE_ERROR_CODES, ROUTING_ERROR_CODES, RequestIdSchema, RoleAddressSchema, SCOPE_METHODS, SESSION_METHODS, STATE_METHODS, STEERING_METHODS, STRUCTURE_METHODS, ScopeAddressSchema, ScopeIdSchema, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, ScopeVisibilitySchema, SessionIdSchema, Subscription, SubscriptionFilterSchema, SubscriptionIdSchema, SystemAddressSchema, TimestampSchema, TransportTypeSchema, buildAgentsGetResponse, buildAgentsListResponse, buildAgentsRegisterResponse, buildAgentsSpawnResponse, buildAgentsUnregisterResponse, buildAgentsUpdateResponse, buildConnectResponse, buildDisconnectResponse, buildScopesCreateResponse, buildScopesJoinResponse, buildScopesLeaveResponse, buildScopesListResponse, buildSendResponse, buildSubscribeResponse, buildUnsubscribeResponse, calculateDelay, canAgentAcceptMessage, canAgentMessageAgent, canAgentSeeAgent, canControlAgent, canJoinScope, canMessageAgent, canPerformAction, canPerformMethod, canSeeAgent, canSeeScope, canSendToScope, compareUlid, createErrorResponse, createEvent, createFederationEnvelope, createNotification, createRequest, createRetryPolicy, createStreamPair, createSubscription, createSuccessResponse, deepMergePermissions, extractId, extractType, filterVisibleAgents, filterVisibleEvents, filterVisibleScopes, formatAddress, getEnvelopeRoutingInfo, getMethodInfo, getMethodsByCategory, getRequiredCapabilities, hasCapability, hasRequiredCapabilities, isAddress, isAgentAddress, isAgentExposed, isBroadcastAddress, isDirectAddress, isEnvelopeAtDestination, isErrorResponse, isEventTypeExposed, isFederatedAddress, isHierarchicalAddress, isNotification, isOrphanedAgent, isRequest, isResponse, isScopeAddress, isScopeExposed, isSuccessResponse, isValidEnvelope, isValidUlid, mapVisibilityToRule, ndJsonStream, parseAddress, processFederationEnvelope, resolveAgentPermissions, retryable, sleep, sortCausalOrder, toAgent, toScope, ulidTimestamp, unwrapEnvelope, validateCausalOrder, waitForOpen, websocketStream, withPayload, withRetry };
4352
4615
  //# sourceMappingURL=index.js.map
4353
4616
  //# sourceMappingURL=index.js.map