agent-comms 2.20.2 → 2.21.1

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.
Files changed (52) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +1 -1
  4. package/dist/core/agent-registry.d.ts +38 -0
  5. package/dist/core/agent-registry.d.ts.map +1 -0
  6. package/dist/core/agent-registry.js +117 -0
  7. package/dist/core/agent-registry.js.map +1 -0
  8. package/dist/core/connection-approval.d.ts +48 -0
  9. package/dist/core/connection-approval.d.ts.map +1 -0
  10. package/dist/core/connection-approval.js +89 -0
  11. package/dist/core/connection-approval.js.map +1 -0
  12. package/dist/core/delivery-engine.d.ts +82 -0
  13. package/dist/core/delivery-engine.d.ts.map +1 -0
  14. package/dist/core/delivery-engine.js +464 -0
  15. package/dist/core/delivery-engine.js.map +1 -0
  16. package/dist/core/federation-bridge.d.ts +32 -0
  17. package/dist/core/federation-bridge.d.ts.map +1 -0
  18. package/dist/core/federation-bridge.js +113 -0
  19. package/dist/core/federation-bridge.js.map +1 -0
  20. package/dist/core/mesh-store-shared.d.ts +39 -0
  21. package/dist/core/mesh-store-shared.d.ts.map +1 -0
  22. package/dist/core/mesh-store-shared.js +32 -0
  23. package/dist/core/mesh-store-shared.js.map +1 -0
  24. package/dist/core/mesh-store.d.ts +65 -256
  25. package/dist/core/mesh-store.d.ts.map +1 -1
  26. package/dist/core/mesh-store.js +211 -1917
  27. package/dist/core/mesh-store.js.map +1 -1
  28. package/dist/core/peer-lifecycle.d.ts +36 -0
  29. package/dist/core/peer-lifecycle.d.ts.map +1 -0
  30. package/dist/core/peer-lifecycle.js +85 -0
  31. package/dist/core/peer-lifecycle.js.map +1 -0
  32. package/dist/core/room-lifecycle.d.ts +82 -0
  33. package/dist/core/room-lifecycle.d.ts.map +1 -0
  34. package/dist/core/room-lifecycle.js +459 -0
  35. package/dist/core/room-lifecycle.js.map +1 -0
  36. package/dist/core/room-messaging.d.ts +31 -0
  37. package/dist/core/room-messaging.d.ts.map +1 -0
  38. package/dist/core/room-messaging.js +120 -0
  39. package/dist/core/room-messaging.js.map +1 -0
  40. package/dist/core/room-protocol.d.ts +85 -0
  41. package/dist/core/room-protocol.d.ts.map +1 -0
  42. package/dist/core/room-protocol.js +479 -0
  43. package/dist/core/room-protocol.js.map +1 -0
  44. package/dist/core/room-wire-extensions.d.ts +36 -0
  45. package/dist/core/room-wire-extensions.d.ts.map +1 -0
  46. package/dist/core/room-wire-extensions.js +52 -0
  47. package/dist/core/room-wire-extensions.js.map +1 -0
  48. package/dist/core/stale-agent-checker.d.ts +28 -0
  49. package/dist/core/stale-agent-checker.d.ts.map +1 -0
  50. package/dist/core/stale-agent-checker.js +77 -0
  51. package/dist/core/stale-agent-checker.js.map +1 -0
  52. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-bridge.js","sourceRoot":"","sources":["../../src/core/federation-bridge.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsBH,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D,+JAA+J;IAC/J,KAAK,CAAC,cAAc,CAAC,KAAoB;QACvC,MAAM,QAAQ,GAAG,OAAO,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACpD,MAAM,WAAW,GAAkB;YACjC,GAAG,KAAK;YACR,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC;SACnC,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC5C,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC;YAC5C,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,WAAW;SACnB,CAAC,C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AAS,EAAE,CAAC;gBACnB,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBACvE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shared constants and helpers for MeshStore and its collaborator classes — module-level constants, types, and free functions with no `this` dependency, split out purely to keep mesh-store.ts under the repo's max-lines cap.
3
+ */
4
+ import type { Clock } from "wire-mesh-core/ports/clock";
5
+ import type { IdentityPort } from "wire-mesh-core/ports/identity";
6
+ import type { RevocationView } from "wire-mesh-core/domain/revocation-view";
7
+ import type { IdentitySlot } from "./identity-store.js";
8
+ /** The identity/clock/persistence collaborators MeshStore mints and persists room-membership grants against. Set via setIdentity(), mirroring the transport's own setTransport() contract. */
9
+ export interface MeshStoreIdentity {
10
+ identity: IdentityPort;
11
+ clock: Clock;
12
+ slot: IdentitySlot;
13
+ revocation: RevocationView;
14
+ }
15
+ /**
16
+ * Lifetime of a freshly minted room:member grant (owner root grant or member join/invite grant alike). Deliberately generous rather than the "short expires, periodic re-issue" pattern the design calls for to bound kick-convergence to gossip-independent expiry -- that re-issue mechanism is P3.7's own deliverable (riding room.members refreshes), and shipping a short expiry before it exists would let ordinary grants go stale with nothing to renew them. 30 days comfortably outlives any realistic room lifetime for now; P3.7 tightens this once re-issue-on-refresh lands.
17
+ */
18
+ export declare const ROOM_TOKEN_LIFETIME_MS: number;
19
+ /** A human's decision on a pending room.join request -- reject carries an optional reason, mirroring rejectConnection's own equivalent room-independent decision. */
20
+ export type RoomJoinDecision = {
21
+ kind: "accept";
22
+ } | {
23
+ kind: "reject";
24
+ reason?: string;
25
+ };
26
+ /**
27
+ * Bound on pending delivery events held per target agent. Events beyond the bound drop oldest-first: a long-offline agent's queue cannot grow without limit in memory or in synced snapshots (#28).
28
+ */
29
+ export declare const MAX_QUEUED_DELIVERIES_PER_AGENT = 100;
30
+ /** The coordinator's own bind host -- always loopback, since the mesh coordinator role only ever needs to be reachable from other local peers on this machine. Shared between mesh-store.ts's own init() and PeerLifecycle's handleBecomeCoordinator. */
31
+ export declare const COORDINATOR_HOST = "127.0.0.1";
32
+ /**
33
+ * Merge an incoming append-only message history into the local one: add entries the local list does not have and union read receipts on the ones it does. Local ordering is preserved; unseen entries are appended.
34
+ */
35
+ export declare function mergeMessageHistories<T extends {
36
+ id: string;
37
+ readBy: string[];
38
+ }>(local: T[], incoming: T[]): void;
39
+ //# sourceMappingURL=mesh-store-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh-store-shared.d.ts","sourceRoot":"","sources":["../../src/core/mesh-store-shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,8LAA8L;AAC9L,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAE/D,qKAAqK;AACrK,MAAM,MAAM,gBAAgB,GAC1B;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,yPAAyP;AACzP,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,EAC1C,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,IAAI,CAajC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Shared constants and helpers for MeshStore and its collaborator classes — module-level constants, types, and free functions with no `this` dependency, split out purely to keep mesh-store.ts under the repo's max-lines cap.
3
+ */
4
+ /**
5
+ * Lifetime of a freshly minted room:member grant (owner root grant or member join/invite grant alike). Deliberately generous rather than the "short expires, periodic re-issue" pattern the design calls for to bound kick-convergence to gossip-independent expiry -- that re-issue mechanism is P3.7's own deliverable (riding room.members refreshes), and shipping a short expiry before it exists would let ordinary grants go stale with nothing to renew them. 30 days comfortably outlives any realistic room lifetime for now; P3.7 tightens this once re-issue-on-refresh lands.
6
+ */
7
+ export const ROOM_TOKEN_LIFETIME_MS = 30 * 24 * 60 * 60 * 1000;
8
+ /**
9
+ * Bound on pending delivery events held per target agent. Events beyond the bound drop oldest-first: a long-offline agent's queue cannot grow without limit in memory or in synced snapshots (#28).
10
+ */
11
+ export const MAX_QUEUED_DELIVERIES_PER_AGENT = 100;
12
+ /** The coordinator's own bind host -- always loopback, since the mesh coordinator role only ever needs to be reachable from other local peers on this machine. Shared between mesh-store.ts's own init() and PeerLifecycle's handleBecomeCoordinator. */
13
+ export const COORDINATOR_HOST = "127.0.0.1";
14
+ /**
15
+ * Merge an incoming append-only message history into the local one: add entries the local list does not have and union read receipts on the ones it does. Local ordering is preserved; unseen entries are appended.
16
+ */
17
+ export function mergeMessageHistories(local, incoming) {
18
+ const byId = new Map(local.map((m) => [m.id, m]));
19
+ for (const msg of incoming) {
20
+ const existing = byId.get(msg.id);
21
+ if (existing === undefined) {
22
+ local.push(msg);
23
+ byId.set(msg.id, msg);
24
+ continue;
25
+ }
26
+ for (const reader of msg.readBy) {
27
+ if (!existing.readBy.includes(reader))
28
+ existing.readBy.push(reader);
29
+ }
30
+ }
31
+ }
32
+ //# sourceMappingURL=mesh-store-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh-store-shared.js","sourceRoot":"","sources":["../../src/core/mesh-store-shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAM/D;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,yPAAyP;AACzP,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAEnC,KAAU,EAAE,QAAa;IACzB,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;YACtB,SAAS;QACX,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,79 +1,65 @@
1
1
  /**
2
2
  * MeshStore — transport-agnostic peer mesh for agent communication.
3
3
  *
4
- * Each bridge instance is a peer in the mesh. Peers discover each other
5
- * via a coordinator (the first instance to bind the well-known port).
6
- * All state is held in memory and synchronised between peers.
7
- * Delivery events are pushed directly over the transport — no polling,
8
- * no filesystem.
4
+ * Each bridge instance is a peer in the mesh. Peers discover each other via a coordinator (the first instance to bind the well-known port). All state is held in memory and synchronised between peers. Delivery events are pushed directly over the transport — no polling, no filesystem.
9
5
  *
10
- * Transport is set via setTransport() (e.g. WireMeshTransport for encrypted
11
- * connections) before init() or any other transport-using method is called
12
- * -- there is no default, since every real bridge builds its own transport
13
- * from this store's own events getter, which needs the store to already
14
- * exist.
6
+ * Transport is set via setTransport() (e.g. WireMeshTransport for encrypted connections) before init() or any other transport-using method is called -- there is no default, since every real bridge builds its own transport from this store's own events getter, which needs the store to already exist.
7
+ *
8
+ * MeshStore itself is an orchestrator: it owns the shared state (the core agents/rooms/messages/dms/deliveryQueues Maps and a handful of smaller fields) and constructs the collaborators that implement almost every behaviour against direct references into that state -- DeliveryEngine, FederationBridge, RoomProtocol, RoomMessaging, RoomLifecycle, AgentRegistry, ConnectionApproval, StaleAgentChecker, and PeerLifecycle. Every public method below that isn't inherently a MeshStore-level concern (transport/identity wiring, init/shutdown lifecycle, the events getter, mesh visibility, listener management, federation-adapter passthroughs) is a thin delegating wrapper to whichever collaborator now owns the real implementation, kept here only because CommsStore/MeshOnlyFeatures and a handful of concrete-only call sites (tests, bridge-mesh.ts, the web server, etc.) reach these names directly on a MeshStore-typed value.
15
9
  */
16
- import type { SerialisedState } from "./wire-protocol.js";
17
10
  import { DiscoveryManager } from "./discovery.js";
18
11
  import { FederationManager } from "./federation.js";
19
12
  import type { FedLink } from "./federation.js";
20
- import type { RevocationView } from "wire-mesh-core/domain/revocation-view";
21
- import type { IdentityPort } from "wire-mesh-core/ports/identity";
22
- import type { Clock } from "wire-mesh-core/ports/clock";
13
+ import type { MeshStoreIdentity } from "./mesh-store-shared.js";
14
+ export type { MeshStoreIdentity } from "./mesh-store-shared.js";
23
15
  import type { RoomVerbHandler } from "./room-router.js";
24
- import type { IdentitySlot } from "./identity-store.js";
25
- import type { MeshStatePatch } from "./wire-protocol.js";
26
- import type { MeshTransport, TransportEvents } from "./transport.js";
16
+ import type { MeshStatePatch, SerialisedState } from "./wire-protocol.js";
17
+ import type { ListenerInfo, MeshTransport, TransportEvents } from "./transport.js";
27
18
  import type { CommsStore } from "./comms-store.js";
28
- import { RoomType, StreamingBehavior } from "./types.js";
29
- import type { AgentIdentity, AgentStatus, DeliveryEvent, DmMessage, MeshVisibility, NetworkInterface, Room, RoomMessage, Visibility } from "./types.js";
30
- import type { ListenerInfo } from "./transport.js";
31
- /** The identity/clock/persistence collaborators MeshStore mints and persists room-membership grants against. Set via setIdentity(), mirroring the transport's own setTransport() contract. */
32
- export interface MeshStoreIdentity {
33
- identity: IdentityPort;
34
- clock: Clock;
35
- slot: IdentitySlot;
36
- revocation: RevocationView;
37
- }
19
+ import type { AgentIdentity, AgentStatus, DeliveryEvent, DmMessage, MeshVisibility, NetworkInterface, Room, RoomMessage, RoomType, StreamingBehavior, Visibility } from "./types.js";
38
20
  export declare class MeshStore implements CommsStore {
39
21
  peerId: string;
40
22
  readonly startedAt: string;
41
23
  readonly coordinatorPort: number;
42
- private agents;
43
- private rooms;
44
- private messages;
45
- private dms;
46
- private deliveryQueues;
47
- private identityCache;
48
- /** Directed room-domain requests (room.send, room.read) that failed because their target member wasn't reachable at send time, held for retry when that member's own connection is (re)established -- the wire-authenticated fan-out's substitute for the legacy full-state-sync's own automatic eventual consistency, since a direct request to a disconnected peer fails immediately with no protocol-level retry of its own. Keyed by member device-id hex, bounded oldest-first per member with the same cap ordinary delivery queues use. */
49
- private pendingRoomRequests;
24
+ private readonly agents;
25
+ private readonly rooms;
26
+ private readonly messages;
27
+ private readonly dms;
28
+ private readonly deliveryQueues;
29
+ private readonly identityCache;
30
+ private readonly peerInfo;
31
+ private readonly localDeliveryKeys;
32
+ private readonly pendingMarkReadTimers;
33
+ /** DM paths this store has itself sent an outbound room.join for -- section 6's own basis for auto-approving the counterpart's reciprocal room.join without a second human decision. Shared between RoomProtocol (reads, in handleRoomJoin) and RoomLifecycle (writes, in requestDmAccess). Never cleared: a DM conversation, once opened, stays open, and holding a stale entry here costs nothing beyond a few bytes per DM this node has ever initiated. */
34
+ private readonly dmRequestsInitiatedByMe;
50
35
  private transport;
51
36
  private storeIdentity;
52
- private peerInfo;
53
- private staleCheckTimer;
54
37
  private isShutDown;
55
38
  private initialised;
56
- private pendingMarkReadTimers;
39
+ discovery: DiscoveryManager;
40
+ federation: FederationManager;
41
+ private readonly deliveryEngine;
42
+ private readonly federationBridge;
43
+ private readonly roomProtocol;
44
+ private readonly roomMessaging;
45
+ private readonly roomLifecycle;
46
+ private readonly agentRegistry;
47
+ private readonly connectionApproval;
48
+ private readonly staleAgentChecker;
49
+ private readonly peerLifecycle;
57
50
  /** This store's own current AgentStatus, synchronously -- the value WireMeshTransport's presence re-advertisement timer reads on every tick. undefined before registerAgent has ever run (no self agent record exists yet), in which case there is nothing yet to advertise. */
58
51
  get selfStatus(): AgentStatus | undefined;
59
52
  /** Whether the mesh has a live coordinator connection. */
60
53
  get connected(): boolean;
61
- private pendingInboundConnections;
62
- private pendingRoomJoins;
63
- private dmRequestsInitiatedByMe;
64
54
  onDelivery: ((agentId: string, event: DeliveryEvent) => void | Promise<void>) | undefined;
65
55
  /** Fires for every state patch — both locally generated and remote. */
66
56
  onPatch: ((patch: MeshStatePatch) => void | Promise<void>) | undefined;
67
57
  /**
68
- * Fires for a transport-level error a caller may want to observe (a connection rejected for presenting a certificate that doesn't match its claimed peer ID, this store's own inability to join or create a mesh, etc). Previously wired to `this.events.onError` inside this class's own methods, but the `events` getter never actually implemented `onError` on the object it returns, so every one of those calls was silently a no-op -- this store had no way to observe its own transport failures at all. Left undefined by default (matching onDelivery/onPatch): a caller that wants visibility sets it, exactly like those two.
58
+ * Fires for a transport-level error a caller may want to observe (a connection rejected for presenting a certificate that doesn't match its claimed peer ID, this store's own inability to join or create a mesh, etc). Left undefined by default (matching onDelivery/onPatch): a caller that wants visibility sets it, exactly like those two.
69
59
  */
70
60
  onError: ((error: Error) => void) | undefined;
71
61
  /** Serialise the full mesh state for state_sync messages. */
72
62
  serialise(): SerialisedState;
73
- private lastLocalDeliveryKey;
74
- private localDeliveryKeys;
75
- discovery: DiscoveryManager;
76
- federation: FederationManager;
77
63
  constructor(coordinatorPort?: number);
78
64
  /** Sets the transport (e.g. WireMeshTransport for encrypted connections). Must be called before init() or any other transport-using method. */
79
65
  setTransport(transport: MeshTransport): void;
@@ -84,96 +70,12 @@ export declare class MeshStore implements CommsStore {
84
70
  /** The set identity, or throws if setIdentity() hasn't been called yet -- the single place every identity-using method reads through, mirroring requireTransport() above. */
85
71
  private requireIdentity;
86
72
  init(): Promise<void>;
87
- private handlePeerList;
88
- private handlePeerJoined;
89
- private handleIntroduction;
90
- private handlePeerConnected;
91
- /**
92
- * Merge a peer's state snapshot into the local state. Agents and rooms
93
- * accept the incoming copy when it carries a revision at least as high as
94
- * the local one, so a peer holding stale entities converges when it
95
- * receives a fresher snapshot, while its own stale copies are rejected by
96
- * peers that stayed current (#27). Message and DM histories are
97
- * append-only: add unseen entries and union read receipts.
98
- */
99
- applyStateSync(state: SerialisedState): void;
100
- private handleDataMessage;
101
- private handleBecomeCoordinator;
102
- private handlePeerDisconnected;
103
- private handleConnectionRequest;
104
- /** Accept a pending inbound connection. */
105
- acceptConnection(connectionId: string): Promise<void>;
106
- /** Reject a pending inbound connection. */
107
- rejectConnection(connectionId: string, reason: string): Promise<void>;
108
- /** List all pending inbound connections awaiting approval. */
109
- listPendingConnections(): {
110
- connectionId: string;
111
- peerId: string;
112
- dataPort: number;
113
- name: string;
114
- fingerprint: string;
115
- }[];
116
- /** Initiate an outbound connection to a remote coordinator requiring approval.
117
- * Fires the connect_request and returns immediately. The connection
118
- * completes asynchronously when the coordinator accepts or rejects. */
119
- connectToRemote(host: string, port: number): Promise<void>;
120
- /** Start only the data server without connecting to a coordinator.
121
- * Used for testing scenarios where the peer connects via connectToRemote. */
122
- startDataServerOnly(): Promise<void>;
123
73
  /** Returns the TransportEvents object that bridges should pass to the transport constructor. */
124
74
  get events(): TransportEvents;
125
- /** Applies a peer's gossiped presence status to this store's own local record, without broadcasting it back onto the mesh -- gossip itself is already how this fact propagates (each side's WireMeshTransport re-advertises its own status periodically), so re-broadcasting a received one would just bounce it around indefinitely. Silently ignored for a device-id this store doesn't yet have an agent record for: presence gossip is a transport-layer fact about an already-known peer's current status, not itself a source of truth for who that peer is -- that still comes only from agent_upsert/registerAgent, which carries the name/harness/cwd/tags a fabricated partial record here never could. */
126
- private handlePresenceAdvert;
127
- /** Verifies a gossiped revocation-entry and, if it verifies, records it in this store's own RevocationView -- future verifyRoomToken calls against this token's (token-id, issuer) pair fail with "revoked" from this point on. A failing entry is dropped silently: the same "hostile input produces a verdict, never a throw" contract verifyRevocationEntry itself already guarantees, so there is nothing further for a caller to react to. */
128
- private handleRevocationAnnounce;
129
- /** Append to a target agent's delivery queue, bounded oldest-first (#28). */
130
- private queueDelivery;
131
- /**
132
- * Merge an incoming room record into the local one. Scalar fields follow
133
- * the version gate the caller already applied (an equal or higher version
134
- * reaches here), while membership is always element-merged per agent by
135
- * highest operation revision, so concurrent joins of different agents
136
- * survive and a kick racing a join converges with the kick honoured
137
- * (#27). The members and invited views are re-derived from the merged
138
- * operations.
139
- */
140
- private mergeRoom;
141
- /**
142
- * Derive the members and invited views from the per-agent operation maps.
143
- * An agent is in the list when their latest join strictly outranks their
144
- * latest leave; equal revisions mean the leave wins, so a kick racing a
145
- * concurrent join converges with the kick honoured (#27).
146
- */
147
- private refreshMembership;
148
- /** Record a membership operation at the room's current revision. */
149
- private recordMemberOp;
150
- /** Merge per-agent operation maps by highest revision per agent. */
151
- private static mergeMemberOps;
152
- /** Bump an entity's sync revision; call before broadcasting a local mutation. */
153
- private bump;
154
- private applyPatch;
155
- private broadcastPatch;
156
- private deliverLocallyAndBroadcast;
157
- /**
158
- * Fire onDelivery for an event targeting this peer's own agent, deduped
159
- * against events already delivered in this process. Used both for live
160
- * deliveries and for replays of events that accumulated while this
161
- * process was down (#28): the dedup set is per-process, so a replayed
162
- * event this process never saw fires, and one it already handled does
163
- * not.
164
- */
165
- private fireLocalDelivery;
166
- private deliverToRoom;
167
- private notifyRoomsOfStatus;
168
- private notifyRoomsOfNameChange;
169
- private emitDeliveryStatus;
170
- private findMessageSender;
171
- /** Like findMessageSender, but also returns the room-path a room.read needs to address: room itself for a room message, or the specific DM key (this.dms is keyed by dmRoomPath/"self:...", not the bare pair) the message was actually found under. */
172
- private findMessageLocation;
173
75
  /**
174
- * Marks a message read by readBy (always this store's own identity -- see the auto-mark-read timers in fireLocalDelivery and drainDelivery, its only callers) and notifies the message's own author via a directed, wire-authenticated room.read (P3.5), replacing the legacy message_read patch's mesh-wide broadcast: only the author is a genuine audience for "did you read my message" per core/room's own always-voluntary read-receipt design, and a direct request to them is strictly more than the old broadcast actually needed. Silently does nothing beyond the local readBy update when the author is this store itself (a self-DM, or an already-own message) or when this store holds no room:member token for the message's own room-path -- read receipts stay best-effort by design, never a reason to throw.
76
+ * Room verb handlers this store registers with its own WireMeshTransport, keyed by params.verb per room-router.ts's own dispatch discipline.
175
77
  */
176
- private markRead;
78
+ get roomVerbHandlers(): Partial<Record<string, RoomVerbHandler>>;
177
79
  readIdentity(harness: string, cwd: string): Promise<{
178
80
  id: string;
179
81
  } | undefined>;
@@ -190,77 +92,6 @@ export declare class MeshStore implements CommsStore {
190
92
  updateAgent(id: string, patch: Partial<Pick<AgentIdentity, "name" | "visibility" | "status" | "tags" | "pid">>): Promise<AgentIdentity>;
191
93
  listAgents(requesterId: string): Promise<AgentIdentity[]>;
192
94
  setAgentOffline(id: string): Promise<void>;
193
- /**
194
- * Mints and persists the room owner's own self-signed room:member grant: issuer = bearer = owner, no parent, delegationsRemaining: 0. This is deliberately NOT the parent every later member grant chains through -- a delegations-remaining: 0 parent cannot mint any child at all (mintCapabilityToken refuses a child whose own delegationsRemaining isn't strictly less than its parent's, and there is no value less than 0), so a later join/invite grant is its own independent, parent-less, owner-issued root-level token instead (still satisfying the "chain roots at the path's own owner" obligation, since rootIssuer is just the token's own issuer when it carries no parent). This root grant exists purely so the owner has a token to present for its own room actions, uniformly with every other member, per the design's own "every code path that checks membership does the same thing regardless of who it is checking" reasoning.
195
- */
196
- private mintOwnerRootGrant;
197
- /**
198
- * Room verb handlers this store registers with its own WireMeshTransport, keyed by params.verb per room-router.ts's own dispatch discipline. A getter (not a plain field) so every access reads through the current `this` binding without needing a constructor-time closure -- mirrors the `events` getter's own reasoning below.
199
- */
200
- get roomVerbHandlers(): Partial<Record<string, RoomVerbHandler>>;
201
- /** Reads the "reply" message-ref out of a room.send's own params (if any) and returns the hex id it names -- room.send's replyTo carries a single parent message, so the first reply-relation ref is the one that matters; any further refs are a future relation this handler doesn't yet act on. */
202
- private static replyToFromRefs;
203
- /** Reads room.send's own "streaming-behavior" extension field (open params tail, not a named schema field) and validates it against the same StreamingBehavior contract every other delivery path already enforces -- an unrecognised or malformed value is dropped rather than rejecting the whole send, matching core/room's own obligation to ignore what it doesn't understand instead of failing closed on an extension field. */
204
- private static streamingBehaviorFromParams;
205
- /**
206
- * Receiving side of a directed room.send (P3.5): verifies the presented token against all six of core/room's own obligations, then delivers the message locally exactly once -- the manage-response this returns IS the delivery receipt, so there is no separate "delivered" event to emit the way the legacy broadcastPatch path needed one. Branches on the room-path's own shape: an owner-named path stores a RoomMessage in this room's own history and fires a room_message event; a DM path stores a DmMessage keyed by the same dm-path sendDm already uses and fires a dm event -- both ride the identical room:member-gated verb, since a DM is just a room-path variant, not a separate verb.
207
- */
208
- private handleRoomSend;
209
- /**
210
- * Receiving side of a directed room.read (P3.5): verifies the presented token the same way handleRoomSend does, then for each read message-id in the batch, updates this store's own local copy of that message's readBy (this store holds one because it's the message's own author -- the reason it's the one being notified) and fires a delivery_status event locally, replacing what markRead used to broadcast via the legacy message_read patch. Read receipts stay voluntary and best-effort by design: a message-id this store doesn't recognise (already expired from history, or simply never this store's own) is silently skipped rather than treated as an error.
211
- */
212
- private handleRoomRead;
213
- /**
214
- * Receiving side of room.members (P3.6): a plain membership + room-state refresh for an already-admitted member, verified the same way handleRoomSend/handleRoomRead are -- room.members grants nothing new, it just answers "who's here, and what's this room called" on demand, the same information room.join's own response already carries at admission time. A DM path has no Room record (this.rooms never holds one for a dm-shaped path) and no name/description/type to report, so its own members list is derived directly from the path's own two participants instead.
215
- */
216
- private handleRoomMembers;
217
- /**
218
- * Sends one directed room.send to a single member's own session, attaching this store's own persisted room:member token for the given room path -- the primitive P3.5's own directed fan-out (deliverToRoom) will loop over per member once it replaces the legacy broadcastPatch path this store still uses for message delivery today. Throws if this store holds no token for the room: never a member, or a token that expired or was revoked with nothing fresh persisted in its place.
219
- */
220
- sendRoomMessageDirected(roomPath: string, memberId: string, text: string): Promise<void>;
221
- /** Records a room-domain request that couldn't reach memberId right now, for a later flushPendingRoomRequests to retry once that member reconnects. Bounded oldest-first with the same cap ordinary delivery queues use, so an indefinitely-offline member cannot grow this without limit. */
222
- private queuePendingRoomRequest;
223
- /**
224
- * Sends one directed room-domain request (room.send, room.read, or any future room:member-gated verb) to a single member, queuing it for retry instead of throwing when the member isn't currently reachable -- the fan-out's own per-recipient primitive, distinct from sendRoomMessageDirected's deliberate throw-on-failure contract for a caller sending to one specific, known recipient. Silently drops a request this store no longer holds a token for (no longer a member of the room) rather than queuing something that will only fail again on retry.
225
- */
226
- private sendRoomRequestToMember;
227
- /** Retries every room.send queued for memberId since it was last reachable, dropping (not re-queuing) any whose room this store no longer holds a token for. Called once a connection to memberId is (re)established -- handlePeerConnected fires for both a fresh introduction and a reconnection after downtime, exactly the two cases a queued send needs to be retried on. */
228
- private flushPendingRoomRequests;
229
- /**
230
- * Owner-side admission for an incoming room.join request, against either a named room this store owns or a DM path this store is a participant of. Named-room admission always needs a human decision; DM admission needs one only for the party being contacted first -- the reply half of the two-round consent flow (section 6) auto-approves, since a reply on a path this node itself opened is not unsolicited contact.
231
- */
232
- private handleRoomJoin;
233
- /** Shared admission continuation for both room.join branches above: waits for a human decision (unless auto-approved), then mints and returns the requester's own independent, parent-less room:member grant. */
234
- private admitRoomJoin;
235
- /**
236
- * Room metadata (name/description/type) riding room-join-ok/room-members-ok's own open extension tail (P3.6), agent-comms' own convention for the "namespaced room-state extension" the design names -- core/room itself has no concept of a display name or description, so this is application data, not a wire-level field. Absent entirely for a DM path (room is undefined there; a DM has no name/description/type to report) rather than a hollow placeholder.
237
- */
238
- private static roomStateExtension;
239
- /** The receiving-side counterpart of roomStateExtension: narrows an incoming response's own "room-state" field (an unknown, since it rides the wire schema's open catchall tail) to the shape this store's own convention actually sends, or undefined for a peer running without it (an older version, or a DM's own room-join-ok, which never carries one). */
240
- private static parseRoomStateExtension;
241
- /**
242
- * The inviter's own display name and cwd, riding room-invite's own open extension tail -- agent-comms' own application data, the same convention roomStateExtension already establishes for room metadata. Unlike room-state (which needs gossip on the requester's own side of room.join/members), the inviter here is always this store's own local agent record: inviteToRoom only ever succeeds for the room's real owner, which per this store's own organising fact (one bridge is one agent is one device) is always this.peerId, so the record is always this store's own registration, never a gossip-dependent lookup.
243
- */
244
- private static inviterAgentExtension;
245
- /** The receiving-side counterpart of inviterAgentExtension: narrows an incoming room.invite's own "inviter-agent" field to the shape this store's own convention sends, or undefined for a peer running without it (an older version) -- the caller falls back to the inviter's bare device-id in that case, the same honest degradation parseRoomStateExtension's own absent case already accepts. */
246
- private static parseInviterAgentExtension;
247
- /**
248
- * Receiving side of a real, wire-level room.invite (P3.8): unlike every other room verb, the request itself is deliberately ungated (the sender already IS the room's own owner, with no need to prove capability to invite) -- the security instead lives entirely in the embedded params.token, which must genuinely name this store's own identity as bearer and root at the room path's own claimed owner. Persists the verified token via saveRoomToken (mirroring joinRemoteRoom's own persistence) and fires a local room_invite delivery event carrying the room's real name/description (room-state) and the inviter's real name/cwd (inviter-agent) when the sender includes them, falling back to the bare device-id and room path otherwise.
249
- */
250
- private handleRoomInvite;
251
- /**
252
- * Receiving side of a real, wire-level room.leave (P3.8), covering both an actual member leaving and a decline of a never-joined invite -- the same wire request either way, since both are "give up a room:member grant I hold," per leaveRemoteRoom's own reasoning. Distinguishes the two purely from this store's own membership/invited lists (never from anything the sender claims), revokes the sender's grant for real via revokeMemberGrant, and notifies accordingly: member_left broadcast to the room's other members for a real leave, a local invite_declined event (carrying the sender's own optional reason extension) for a decline -- there is no third party to notify for a decline, since nobody else ever knew about an invite that was never accepted.
253
- */
254
- private handleRoomLeave;
255
- /** Every room.join request currently held open awaiting this store's own accept/reject decision. */
256
- listPendingRoomJoins(): {
257
- roomPath: string;
258
- requesterId: string;
259
- }[];
260
- /** Approves a pending room.join request, resuming handleRoomJoin's own suspended mint-and-respond continuation. */
261
- acceptRoomJoin(roomPath: string, requesterId: string): void;
262
- /** Denies a pending room.join request, optionally with a reason surfaced to the requester in the resulting manage-error's own message field. */
263
- rejectRoomJoin(roomPath: string, requesterId: string, reason?: string): void;
264
95
  createRoom(opts: {
265
96
  name: string;
266
97
  type: RoomType;
@@ -270,65 +101,50 @@ export declare class MeshStore implements CommsStore {
270
101
  }): Promise<Room>;
271
102
  getRoom(id: string): Promise<Room | undefined>;
272
103
  listRooms(requesterId: string): Promise<Room[]>;
273
- /**
274
- * The remote-join path: roomPath names an owner-named room this store has never seen replicated, so joining it means sending a real wire-level room.join request to the room's own owner and persisting whatever grant comes back, rather than mutating already-known local state. Only ever called for this store's own local agent (one bridge is one agent is one device, per the design's own organising fact) -- there is no wire mechanism by which this node could join a room on a different local agent's behalf.
275
- */
276
- private joinRemoteRoom;
277
- /**
278
- * Refreshes this store's own local copy of a named room's membership and room-state via a real room.members request (P3.6): the same information room.join's own response carries at admission time, available on demand for a member whose local copy may have drifted (a kick, an invite, a rename since it joined). Sent to the room's own owner, the authoritative source for that room's real state. Named rooms only, matching joinRemoteRoom's own restriction -- a DM's "membership" is already fully known from the path itself (the sorted pair of exactly two participants), and this codebase has no Room-object representation for a DM to refresh into (DM state lives in this.dms, keyed by message history, not this.rooms). Throws if this store holds no room:member token for roomPath -- refreshing membership presupposes already being a member, the same NOT_A_MEMBER contract sendRoomMessageDirected already uses.
279
- */
104
+ /** Refreshes this store's own local copy of a named room's membership and room-state via a real room.members request (P3.6). Concrete-only -- reached directly by tests. */
280
105
  refreshRoomMembers(roomPath: string): Promise<Room>;
281
- /**
282
- * The requester's own half of section 6's two-round DM consent flow: sends an ungated room.join scoped to dmRoomPath(this, counterpart) directly to the counterpart, records having initiated it so the counterpart's own reciprocal room.join back auto-approves rather than surfacing as a fresh, unsolicited request, and persists whatever grant comes back. Deliberately outside the CommsStore interface, like connection approval, since it is a wire-mesh-specific concern FileStore has no equivalent for. Safe to call again for the same counterpart later (e.g. after an earlier request expired or was rejected) -- it always sends a fresh request rather than checking for an existing token first.
283
- */
106
+ /** The requester's own half of section 6's two-round DM consent flow. Deliberately outside the CommsStore interface, like connection approval, since it is a wire-mesh-specific concern FileStore has no equivalent for. Concrete-only -- reached directly by tests. */
284
107
  requestDmAccess(counterpart: string): Promise<void>;
285
- /**
286
- * Joins a room. For this store's own identity, "already known locally" is not the right gate for skipping real admission: the legacy full-state-sync replicates a room's metadata to every mesh-connected peer the moment it's created, well before that peer has ever been admitted, so a room already present in this.rooms says nothing about whether this store actually holds a valid room:member token for it. The real gate is that token's presence -- absent, this always goes through joinRemoteRoom's real wire-level admission regardless of what this.rooms already knows, so a peer that merely heard about a room never mistakes hearing about it for having joined it. Joining on behalf of a DIFFERENT agentId (this store's own convergence/admin bookkeeping, exercised directly by state-sync-convergence.test.ts) is untouched -- that's a pure local CRDT mutation with no admission concept at all.
287
- */
288
108
  joinRoom(roomId: string, agentId: string): Promise<Room>;
289
- /**
290
- * Leaves a room. For this store's own identity leaving a room it does not itself own, the local Room object is only ever this store's own static snapshot from when it joined or was invited (P3.6/P3.8) -- mutating it directly, as the legacy branch below does, would tell nobody but this store itself. The real effect needs a wire round trip to the room's own owner instead, so this always defers to leaveRemoteRoom in that case. Leaving on behalf of a DIFFERENT agentId, or the owner leaving their own room (this store's own authoritative copy), is untouched -- that is the legacy CRDT mutation state-sync-convergence.test.ts exercises directly.
291
- */
292
109
  leaveRoom(roomId: string, agentId: string): Promise<void>;
293
- /**
294
- * The remote-leave path: roomPath names a room this store is a member of but does not own, so leaving for real means telling the owner over a real, wire-authenticated room.leave rather than mutating a local Room record nobody else reads. Also declineInvite's own mechanism (P3.8): the moment a target receives an invite (handleRoomInvite), it already holds a real, persisted room:member token exactly as if it had joined -- declining is simply leaving before ever really participating, and the owner's own receiving side (handleRoomLeave) tells the two cases apart by checking its own membership/invited lists, not by a separate verb. reason rides room.leave's own open extension tail so the owner can still surface a real decline reason without a second wire shape.
295
- */
296
- private leaveRemoteRoom;
297
- /**
298
- * Invites targetId to roomId, over a real, wire-authenticated room.invite (P3.8): mints a fresh room:member grant for the target, records its own token-id the same way admitRoomJoin does (kickFromRoom can revoke an invited member's own grant exactly as it can a joined one), and pushes the grant to the target directly in the invite request itself -- room.invite is deliberately ungated (the room's own owner needs no capability to invite, per core/room's design), so the target's own verification of the embedded token is what proves this invite is genuine, not anything about the connection it arrived on. Retains the local CRDT invited-list bookkeeping (still this store's own record of who it has invited) but no longer broadcasts it: the target learns of the invite from the real request, not a mesh-wide patch.
299
- */
300
110
  inviteToRoom(roomId: string, targetId: string, inviterId: string): Promise<void>;
301
- /**
302
- * Declines a pending invite, over the same real room.leave request leaveRemoteRoom already sends for an actual leave (P3.8): the moment this store received the invite (handleRoomInvite), it already holds a real, persisted room:member token, so declining before ever really participating is simply leaving early -- the owner's own receiving side (handleRoomLeave) tells the two cases apart from its own membership/invited lists, not from a separate verb. Uses parseRoomPath rather than any locally cached Room record to find the owner to leave, since handleRoomInvite never constructs one -- there is nothing here to read a room.owner field off in the first place.
303
- */
304
111
  declineInvite(roomId: string, agentId: string, reason: string): Promise<void>;
305
- /**
306
- * Kicks targetId from roomId. Beyond the legacy CRDT membership removal (retired in P3.8 along with every other non-message broadcastPatch caller), this revokes the member's own room:member grant for real: mints a revocation-entry for the token-id this identity recorded when it admitted them (admitRoomJoin's own saveIssuedRoomGrant), records it in this store's own RevocationView immediately (so this identity's own future verifications see the kick without waiting on its own gossip), and announces it to every connected peer so each one's independent verification of the target's token -- not just this room's owner -- also starts failing as "revoked" from here on. Silently skips the revocation step (kick still happens; only the token-side enforcement doesn't) when no issued-grant record exists for this member, e.g. a grant predating this bookkeeping.
307
- */
308
- /**
309
- * Revokes memberId's own room:member grant for roomId for real, if this identity ever recorded issuing one: mints a revocation-entry for its token-id, records it in this store's own RevocationView immediately, announces it to every connected peer, and forgets the issued-grant record (a later re-admission mints and records a genuinely fresh one rather than leaving a stale entry alongside it). Silently does nothing when no issued-grant record exists (a grant predating this bookkeeping, or a member who was never actually admitted a token at all) -- shared by kickFromRoom (owner-initiated) and handleRoomLeave (member-initiated, including a decline).
310
- */
311
- private revokeMemberGrant;
312
112
  kickFromRoom(roomId: string, targetId: string, kickerId: string): Promise<void>;
313
- /**
314
- * Destroys roomId, revoking every member's own room:member grant for real first (P3.8) -- the same revocation machinery kickFromRoom already uses, since destroying a room out from under its members is exactly as much a membership revocation as kicking them individually would be, just for all of them at once. Room-existence notification (agent_upsert/room_delete) stays on the legacy broadcastPatch for now: replacing it needs the same broader informational-events redesign the rest of P3.8 already tracks as separate, larger work, not something this specific fix should improvise alone.
315
- */
316
113
  destroyRoom(roomId: string, agentId: string): Promise<void>;
317
- /**
318
- * Sends a room message via a real, wire-authenticated room.send fan-out (P3.5): one directed request per member, each carrying this sender's own persisted room:member token, rather than the legacy broadcastPatch's full-state replication. A member unreachable right now is queued for retry (see sendRoomRequestToMember/flushPendingRoomRequests) instead of blocking or failing the whole send -- delivery to any one recipient is independent of every other.
319
- */
320
114
  sendRoomMessage(roomId: string, from: string, content: string, replyTo?: string, streamingBehavior?: StreamingBehavior): Promise<RoomMessage>;
321
115
  readRoomMessages(roomId: string, since?: string): Promise<RoomMessage[]>;
322
- /**
323
- * Sends a DM via the same wire-authenticated room.send fan-out sendRoomMessage uses (P3.5): a DM is just a dm-shaped room path with exactly one other member, so it rides the identical mechanism rather than a separate one. Self-DM is the one exception -- a purely local scratchpad note that never leaves the process, so it needs no token and no wire round trip at all.
324
- */
325
116
  sendDm(from: string, to: string, content: string, streamingBehavior?: StreamingBehavior): Promise<DmMessage>;
326
117
  deliver(agentId: string, event: DeliveryEvent): Promise<void>;
327
118
  drainDelivery(agentId: string): Promise<DeliveryEvent[]>;
328
- private startStaleCheck;
329
- private stopStaleCheck;
330
- private probeStaleAgents;
331
- private isProcessAlive;
119
+ /** Merge a peer's state snapshot into the local state (#27/#28). Concrete-only -- reached directly by tests. */
120
+ applyStateSync(state: SerialisedState): void;
121
+ /** Sends one directed room.send to a single member's own session (P3.5). Concrete-only -- reached directly by tests. */
122
+ sendRoomMessageDirected(roomPath: string, memberId: string, text: string): Promise<void>;
123
+ /** Starts only the data server without connecting to a coordinator. Used for testing scenarios where the peer connects via connectToRemote. */
124
+ startDataServerOnly(): Promise<void>;
125
+ /** Accept a pending inbound connection. */
126
+ acceptConnection(connectionId: string): Promise<void>;
127
+ /** Reject a pending inbound connection. */
128
+ rejectConnection(connectionId: string, reason: string): Promise<void>;
129
+ /** List all pending inbound connections awaiting approval. */
130
+ listPendingConnections(): {
131
+ connectionId: string;
132
+ peerId: string;
133
+ dataPort: number;
134
+ name: string;
135
+ fingerprint: string;
136
+ }[];
137
+ /** Initiate an outbound connection to a remote coordinator requiring approval. */
138
+ connectToRemote(host: string, port: number): Promise<void>;
139
+ /** Every room.join request currently held open awaiting this store's own accept/reject decision. */
140
+ listPendingRoomJoins(): {
141
+ roomPath: string;
142
+ requesterId: string;
143
+ }[];
144
+ /** Approves a pending room.join request. */
145
+ acceptRoomJoin(roomPath: string, requesterId: string): void;
146
+ /** Denies a pending room.join request, optionally with a reason. */
147
+ rejectRoomJoin(roomPath: string, requesterId: string, reason?: string): void;
332
148
  /** Set mesh discovery visibility. Delegates to discovery manager. */
333
149
  setVisibility(level: MeshVisibility, adapter?: string): Promise<void>;
334
150
  /** Get current mesh discovery visibility. */
@@ -346,13 +162,6 @@ export declare class MeshStore implements CommsStore {
346
162
  fedTrustedFingerprints(): string[];
347
163
  fedListen(host: string, port: number): Promise<void>;
348
164
  fedStopListening(): Promise<void>;
349
- private handleFedAgentVisible;
350
- private handleFedAgentGone;
351
- private handleFedRoomMessage;
352
- private handleFedRoomJoin;
353
- private handleFedRoomLeave;
354
- private getVisibleAgentsForFed;
355
- private getFederatedRoomMembershipsForFed;
356
165
  shutdown(): Promise<void>;
357
166
  }
358
167
  //# sourceMappingURL=mesh-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-store.d.ts","sourceRoot":"","sources":["../../src/core/mesh-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAY/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAkBxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAaxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAe,cAAc,EAAY,MAAM,oBAAoB,CAAC;AACh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