agent-comms 8.3.1 → 8.4.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 (150) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +27 -16
  4. package/dist/bridges/user/web/frontend/mesh-client.js +1 -1
  5. package/dist/bridges/user/web/frontend/mesh-client.js.map +1 -1
  6. package/dist/bridges/user/web/server.d.ts +1 -1
  7. package/dist/bridges/user/web/server.d.ts.map +1 -1
  8. package/dist/bridges/user/web/server.js +6 -12
  9. package/dist/bridges/user/web/server.js.map +1 -1
  10. package/dist/bridges/user/web/test/lan-web-server.integration.test.js +30 -1
  11. package/dist/bridges/user/web/test/lan-web-server.integration.test.js.map +1 -1
  12. package/dist/bridges/user/web/test/orpc-router.integration.test.js +15 -1
  13. package/dist/bridges/user/web/test/orpc-router.integration.test.js.map +1 -1
  14. package/dist/bridges/user/web/test/web-access.unit.test.js +127 -2
  15. package/dist/bridges/user/web/test/web-access.unit.test.js.map +1 -1
  16. package/dist/bridges/user/web/web-access.d.ts +9 -6
  17. package/dist/bridges/user/web/web-access.d.ts.map +1 -1
  18. package/dist/bridges/user/web/web-access.js +70 -22
  19. package/dist/bridges/user/web/web-access.js.map +1 -1
  20. package/dist/core/coordinator-role.d.ts +68 -0
  21. package/dist/core/coordinator-role.d.ts.map +1 -0
  22. package/dist/core/coordinator-role.js +161 -0
  23. package/dist/core/coordinator-role.js.map +1 -0
  24. package/dist/core/delivery-engine.d.ts.map +1 -1
  25. package/dist/core/delivery-engine.js +2 -0
  26. package/dist/core/delivery-engine.js.map +1 -1
  27. package/dist/core/election-sessions.d.ts +31 -0
  28. package/dist/core/election-sessions.d.ts.map +1 -0
  29. package/dist/core/election-sessions.js +59 -0
  30. package/dist/core/election-sessions.js.map +1 -0
  31. package/dist/core/loopback-address.d.ts +6 -0
  32. package/dist/core/loopback-address.d.ts.map +1 -0
  33. package/dist/core/loopback-address.js +21 -0
  34. package/dist/core/loopback-address.js.map +1 -0
  35. package/dist/core/mesh-store-options.d.ts +2 -0
  36. package/dist/core/mesh-store-options.d.ts.map +1 -1
  37. package/dist/core/mesh-store.d.ts +8 -2
  38. package/dist/core/mesh-store.d.ts.map +1 -1
  39. package/dist/core/mesh-store.js +41 -46
  40. package/dist/core/mesh-store.js.map +1 -1
  41. package/dist/core/peer-lifecycle.d.ts +18 -10
  42. package/dist/core/peer-lifecycle.d.ts.map +1 -1
  43. package/dist/core/peer-lifecycle.js +50 -9
  44. package/dist/core/peer-lifecycle.js.map +1 -1
  45. package/dist/core/pending-connection.d.ts +24 -0
  46. package/dist/core/pending-connection.d.ts.map +1 -0
  47. package/dist/core/pending-connection.js +25 -0
  48. package/dist/core/pending-connection.js.map +1 -0
  49. package/dist/core/stale-agent-checker.d.ts +4 -2
  50. package/dist/core/stale-agent-checker.d.ts.map +1 -1
  51. package/dist/core/stale-agent-checker.js +5 -4
  52. package/dist/core/stale-agent-checker.js.map +1 -1
  53. package/dist/core/transport-events.d.ts +2 -0
  54. package/dist/core/transport-events.d.ts.map +1 -1
  55. package/dist/core/transport-events.js +8 -0
  56. package/dist/core/transport-events.js.map +1 -1
  57. package/dist/core/transport.d.ts +22 -2
  58. package/dist/core/transport.d.ts.map +1 -1
  59. package/dist/core/wire-mesh-transport-options.d.ts +14 -0
  60. package/dist/core/wire-mesh-transport-options.d.ts.map +1 -1
  61. package/dist/core/wire-mesh-transport-options.js +23 -1
  62. package/dist/core/wire-mesh-transport-options.js.map +1 -1
  63. package/dist/core/wire-mesh-transport.d.ts +7 -5
  64. package/dist/core/wire-mesh-transport.d.ts.map +1 -1
  65. package/dist/core/wire-mesh-transport.js +53 -52
  66. package/dist/core/wire-mesh-transport.js.map +1 -1
  67. package/dist/core/ws-dial.d.ts +3 -1
  68. package/dist/core/ws-dial.d.ts.map +1 -1
  69. package/dist/core/ws-dial.js +15 -0
  70. package/dist/core/ws-dial.js.map +1 -1
  71. package/dist/test/agent-comms-version-gossip.integration.test.js +2 -0
  72. package/dist/test/agent-comms-version-gossip.integration.test.js.map +1 -1
  73. package/dist/test/agent-self-gossip.integration.test.js +2 -0
  74. package/dist/test/agent-self-gossip.integration.test.js.map +1 -1
  75. package/dist/test/become-coordinator-actual-port.integration.test.js +2 -0
  76. package/dist/test/become-coordinator-actual-port.integration.test.js.map +1 -1
  77. package/dist/test/coordinator-claim-sessions.integration.test.d.ts +5 -0
  78. package/dist/test/coordinator-claim-sessions.integration.test.d.ts.map +1 -0
  79. package/dist/test/coordinator-claim-sessions.integration.test.js +276 -0
  80. package/dist/test/coordinator-claim-sessions.integration.test.js.map +1 -0
  81. package/dist/test/coordinator-election.integration.test.d.ts +5 -0
  82. package/dist/test/coordinator-election.integration.test.d.ts.map +1 -0
  83. package/dist/test/coordinator-election.integration.test.js +182 -0
  84. package/dist/test/coordinator-election.integration.test.js.map +1 -0
  85. package/dist/test/coordinator-failover.unit.test.d.ts +1 -1
  86. package/dist/test/coordinator-failover.unit.test.js +171 -68
  87. package/dist/test/coordinator-failover.unit.test.js.map +1 -1
  88. package/dist/test/coordinator-role.unit.test.d.ts +5 -0
  89. package/dist/test/coordinator-role.unit.test.d.ts.map +1 -0
  90. package/dist/test/coordinator-role.unit.test.js +296 -0
  91. package/dist/test/coordinator-role.unit.test.js.map +1 -0
  92. package/dist/test/data-sync-frame-handling.integration.test.js +2 -0
  93. package/dist/test/data-sync-frame-handling.integration.test.js.map +1 -1
  94. package/dist/test/delivery-engine-delivery.unit.test.js +3 -0
  95. package/dist/test/delivery-engine-delivery.unit.test.js.map +1 -1
  96. package/dist/test/delivery-engine-directed-notify.unit.test.js +3 -0
  97. package/dist/test/delivery-engine-directed-notify.unit.test.js.map +1 -1
  98. package/dist/test/delivery-engine-own-agent.unit.test.js +3 -0
  99. package/dist/test/delivery-engine-own-agent.unit.test.js.map +1 -1
  100. package/dist/test/delivery-engine.unit.test.js +12 -0
  101. package/dist/test/delivery-engine.unit.test.js.map +1 -1
  102. package/dist/test/gossip-directory-aggregation.integration.test.js +2 -0
  103. package/dist/test/gossip-directory-aggregation.integration.test.js.map +1 -1
  104. package/dist/test/gossip-listener-addresses.integration.test.js +2 -0
  105. package/dist/test/gossip-listener-addresses.integration.test.js.map +1 -1
  106. package/dist/test/hosted-rooms-gossip.integration.test.js +2 -0
  107. package/dist/test/hosted-rooms-gossip.integration.test.js.map +1 -1
  108. package/dist/test/hub-mode-session.integration.test.js +2 -0
  109. package/dist/test/hub-mode-session.integration.test.js.map +1 -1
  110. package/dist/test/hub-session-dispatch.unit.test.js +2 -0
  111. package/dist/test/hub-session-dispatch.unit.test.js.map +1 -1
  112. package/dist/test/listener-policy.integration.test.js +2 -0
  113. package/dist/test/listener-policy.integration.test.js.map +1 -1
  114. package/dist/test/loopback-address.unit.test.d.ts +5 -0
  115. package/dist/test/loopback-address.unit.test.d.ts.map +1 -0
  116. package/dist/test/loopback-address.unit.test.js +28 -0
  117. package/dist/test/loopback-address.unit.test.js.map +1 -0
  118. package/dist/test/mesh-graph-trace.integration.test.js +2 -0
  119. package/dist/test/mesh-graph-trace.integration.test.js.map +1 -1
  120. package/dist/test/mesh-store-orchestration.unit.test.js +23 -6
  121. package/dist/test/mesh-store-orchestration.unit.test.js.map +1 -1
  122. package/dist/test/peer-lifecycle.unit.test.js +35 -15
  123. package/dist/test/peer-lifecycle.unit.test.js.map +1 -1
  124. package/dist/test/presence-readvertise.integration.test.js +49 -0
  125. package/dist/test/presence-readvertise.integration.test.js.map +1 -1
  126. package/dist/test/query-version.integration.test.js +2 -0
  127. package/dist/test/query-version.integration.test.js.map +1 -1
  128. package/dist/test/room-join-admission.integration.test.js +3 -0
  129. package/dist/test/room-join-admission.integration.test.js.map +1 -1
  130. package/dist/test/room-router.unit.test.js +2 -0
  131. package/dist/test/room-router.unit.test.js.map +1 -1
  132. package/dist/test/room-send-retry-queue.integration.test.js +3 -0
  133. package/dist/test/room-send-retry-queue.integration.test.js.map +1 -1
  134. package/dist/test/stale-agent-checker.unit.test.js +5 -0
  135. package/dist/test/stale-agent-checker.unit.test.js.map +1 -1
  136. package/dist/test/test-transport.d.ts +3 -0
  137. package/dist/test/test-transport.d.ts.map +1 -1
  138. package/dist/test/test-transport.js +19 -0
  139. package/dist/test/test-transport.js.map +1 -1
  140. package/dist/test/wire-mesh-transport-gateway-trust.integration.test.js +2 -0
  141. package/dist/test/wire-mesh-transport-gateway-trust.integration.test.js.map +1 -1
  142. package/dist/test/wire-mesh-transport-hub.integration.test.js +2 -0
  143. package/dist/test/wire-mesh-transport-hub.integration.test.js.map +1 -1
  144. package/dist/test/wire-mesh-transport-shutdown-unref.integration.test.js +10 -26
  145. package/dist/test/wire-mesh-transport-shutdown-unref.integration.test.js.map +1 -1
  146. package/dist/test/wire-mesh-transport.integration.test.js +51 -51
  147. package/dist/test/wire-mesh-transport.integration.test.js.map +1 -1
  148. package/dist/test/wss-remote-connect.integration.test.js +2 -0
  149. package/dist/test/wss-remote-connect.integration.test.js.map +1 -1
  150. package/package.json +2 -2
@@ -1,22 +1,20 @@
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 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.
4
+ * Each bridge instance is a peer in the mesh. Peers find each other through first contact (a UDP presence beaconing over loopback multicast to stores on this machine and over limited broadcast to other machines on the LAN) or through the well-known port, whose holder introduces joiners; neither is required for peers to keep talking once connected. The coordinator duties are held by an elected CoordinatorRole, not by the port holder. All state is held in memory and synchronised between peers. Delivery events are pushed directly over the transport, with no polling and no filesystem.
5
5
  *
6
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
7
  *
8
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, 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) 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.
9
9
  */
10
- import { deviceIdToHex } from "wire-mesh-core/domain/device-id";
10
+ import { bytesToHex, deviceIdToHex } from "wire-mesh-core/domain/device-id";
11
11
  import * as os from "node:os";
12
- import { nanoid } from "./nanoid.js";
13
12
  import { MembershipProofs } from "./membership-proofs.js";
14
- import { ROOM_JOIN_APPROVAL_TIMEOUT_MS } from "./request-timeouts.js";
13
+ import { ROOM_JOIN_APPROVAL_TIMEOUT_MS, ROOM_REQUEST_TIMEOUT_MS, } from "./request-timeouts.js";
15
14
  import { CommsError } from "./store.js";
16
15
  import { DiscoveryManager } from "./discovery.js";
17
16
  import { MdnsDiscoveryBackend } from "./discovery-mdns.js";
18
17
  import { TailscaleDiscoveryBackend } from "./discovery-tailscale.js";
19
- import { COORDINATOR_HOST } from "./mesh-store-shared.js";
20
18
  import { GatewayTrust } from "./gateway-trust.js";
21
19
  import { ReceiverSet } from "./receiver-set.js";
22
20
  import { ConnectionCodeLedger, } from "./connection-code.js";
@@ -29,6 +27,7 @@ import { ConnectionApproval } from "./connection-approval.js";
29
27
  import { CapabilityAskAdmission } from "./capability-ask.js";
30
28
  import { StaleAgentChecker } from "./stale-agent-checker.js";
31
29
  import { PeerLifecycle } from "./peer-lifecycle.js";
30
+ import { CoordinatorRole, } from "./coordinator-role.js";
32
31
  import { DEFAULT_PRESENCE_STALE_AFTER_MS } from "./gossip-extensions.js";
33
32
  import { getPeerAgentCommsVersions, getPeerWireMeshCoreVersion, } from "./peer-versions.js";
34
33
  import { createTransportEvents } from "./transport-events.js";
@@ -36,8 +35,8 @@ import { createTransportEvents } from "./transport-events.js";
36
35
  // Constants
37
36
  // ---------------------------------------------------------------------------
38
37
  const DEFAULT_COORDINATOR_PORT = 19876;
39
- /** Length of the randomly generated peer ID. */
40
- const PEER_ID_LENGTH = 8;
38
+ /** A device-id is a SHA-256 digest, so the stand-in peer ID a store starts with (every bridge replaces it with its identity's own device-id) has the same shape and can take part in the coordinator election. */
39
+ const DEVICE_ID_BYTE_LENGTH = 32;
41
40
  // ---------------------------------------------------------------------------
42
41
  // MeshStore
43
42
  // ---------------------------------------------------------------------------
@@ -86,7 +85,16 @@ export class MeshStore {
86
85
  connectionApproval;
87
86
  capabilityAskAdmission;
88
87
  staleAgentChecker;
88
+ coordinatorRole;
89
89
  peerLifecycle;
90
+ /** Whether this store holds the elected coordinator role (agent-comms#341), and so runs the stale-agent probe, announces departures, and fronts local Claude Code sessions. Independent of whether its transport holds the well-known port. */
91
+ get holdsCoordinatorRole() {
92
+ return this.coordinatorRole.isHolder();
93
+ }
94
+ /** The coordinator claim this store currently accepts (the elected holder's device-id and the term that put it there), or undefined before it has made or heard one. */
95
+ get coordinatorClaim() {
96
+ return this.coordinatorRole.current();
97
+ }
90
98
  /** 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. */
91
99
  get selfStatus() {
92
100
  return this.agents.get(this.peerId)?.status;
@@ -164,7 +172,7 @@ export class MeshStore {
164
172
  */
165
173
  onError;
166
174
  /**
167
- * Fires whenever this store's own coordinator role changes: true right after becoming coordinator (a fresh bind in init(), or a takeover via PeerLifecycle.handleBecomeCoordinator), false right before shutdown() drops it. There is no live "lost the role to someone else while still running" case today: the role is only ever given up in shutdown(), so this callback mirrors that lifecycle. Left undefined by default (matching onDelivery/onPatch/onError): a caller that wants to react to owning the coordinator role -- e.g. bridge-mesh.ts starting/stopping the cc-peer front (agent-comms#157), a Node/filesystem-specific capability that has no place in this transport-agnostic core -- sets it, exactly like those three.
175
+ * Fires whenever this store gains or loses the elected coordinator role (agent-comms#341): true once a claim naming this store is accepted, false when a superseding claim is accepted or right before shutdown() gives the role up. Holding the well-known port has no bearing on it. A call runs only once the previous one has finished, so a caller stopping something asynchronously is never asked to start it again mid-stop. Left undefined by default (matching onDelivery/onPatch/onError): a caller that wants to react to owning the coordinator role (e.g. bridge-mesh.ts starting/stopping the cc-peer front (agent-comms#157), a Node/filesystem-specific capability that has no place in this transport-agnostic core) sets it, exactly like those three.
168
176
  */
169
177
  onCoordinatorRoleChanged;
170
178
  /** This process's own currently-running cc-peer package version, when it is actually fronting a cc-peer session or running the one-shot `bridge cc-peer` command (agent-comms#198) -- undefined by default (matching onDelivery/onPatch/onError/onCoordinatorRoleChanged), since every other bridge never loads the cc-peer package at all. Set once, right after construction, by front-runtime.ts/bridges/cc-peer/run.ts (a plain closure over cc-peer's own exported CC_PEER_VERSION constant) -- read by both this store's own WireMeshTransport construction (bridge-mesh.ts, for the gossiped versions advert) and CommsTool (for whoami/update/list_agents' own self-report), so the one field backs both surfaces. */
@@ -180,8 +188,8 @@ export class MeshStore {
180
188
  };
181
189
  }
182
190
  constructor(options) {
183
- const { coordinatorPort = DEFAULT_COORDINATOR_PORT, hubUrl, roomJoinApprovalTimeoutMs = ROOM_JOIN_APPROVAL_TIMEOUT_MS, presenceStaleAfterMs = DEFAULT_PRESENCE_STALE_AFTER_MS, slot, } = options ?? {};
184
- this.peerId = nanoid(PEER_ID_LENGTH);
191
+ const { coordinatorPort = DEFAULT_COORDINATOR_PORT, hubUrl, roomJoinApprovalTimeoutMs = ROOM_JOIN_APPROVAL_TIMEOUT_MS, presenceStaleAfterMs = DEFAULT_PRESENCE_STALE_AFTER_MS, coordinatorClaimWaitMs = ROOM_REQUEST_TIMEOUT_MS, slot, } = options ?? {};
192
+ this.peerId = bytesToHex(crypto.getRandomValues(new Uint8Array(DEVICE_ID_BYTE_LENGTH)));
185
193
  this.startedAt = new Date().toISOString();
186
194
  this.coordinatorPort = coordinatorPort;
187
195
  this.hubUrl = hubUrl;
@@ -279,6 +287,23 @@ export class MeshStore {
279
287
  peerInfo: this.peerInfo,
280
288
  notifyRoomsOfStatus: async (agentId, status) => this.deliveryEngine.notifyRoomsOfStatus(agentId, status),
281
289
  broadcastPatch: async (patch) => this.deliveryEngine.broadcastPatch(patch),
290
+ bump: (agent) => {
291
+ this.deliveryEngine.bump(agent);
292
+ },
293
+ });
294
+ this.coordinatorRole = new CoordinatorRole({
295
+ getPeerId: () => this.peerId,
296
+ requireTransport: () => this.requireTransport(),
297
+ claimWaitMs: coordinatorClaimWaitMs,
298
+ onGained: async () => {
299
+ this.staleAgentChecker.start();
300
+ await this.onCoordinatorRoleChanged?.(true);
301
+ },
302
+ onLost: async () => {
303
+ this.staleAgentChecker.stop();
304
+ await this.onCoordinatorRoleChanged?.(false);
305
+ },
306
+ onError: this.reportError,
282
307
  });
283
308
  this.peerLifecycle = new PeerLifecycle({
284
309
  peerInfo: this.peerInfo,
@@ -291,8 +316,7 @@ export class MeshStore {
291
316
  serialise: () => this.serialise(),
292
317
  roomProtocol: this.roomProtocol,
293
318
  deliveryEngine: this.deliveryEngine,
294
- staleAgentChecker: this.staleAgentChecker,
295
- onCoordinatorRoleChanged: async () => this.onCoordinatorRoleChanged?.(true),
319
+ coordinatorRole: this.coordinatorRole,
296
320
  onError: this.reportError,
297
321
  });
298
322
  }
@@ -340,37 +364,7 @@ export class MeshStore {
340
364
  port: this.requireTransport().dataPort,
341
365
  startedAt: this.startedAt,
342
366
  });
343
- // Try joining an existing mesh; fall back to becoming coordinator.
344
- //
345
- // Single attempt: connect to an existing coordinator, or become one. If the coordinator port is occupied but unresponsive (e.g. an orphan process from a previous session), degrade gracefully instead of retrying. Retrying tls.connect after a failed handshake to a non-TLS endpoint can freeze the event loop (Node.js TLS session cache bug), so we only try once.
346
- let connected = false;
347
- try {
348
- await this.requireTransport().connectToCoordinator(COORDINATOR_HOST, this.coordinatorPort, this.peerId, this.requireTransport().dataPort);
349
- connected = true;
350
- }
351
- catch {
352
- let eaddrinuseMessage;
353
- try {
354
- // The same takeover PeerLifecycle runs for a handover or a crash race: bind, adopt the peer list (only this store's own entry exists yet), start stale-agent probing, and start whatever the coordinator role owns.
355
- await this.peerLifecycle.handleBecomeCoordinator([]);
356
- connected = true;
357
- }
358
- catch (coordErr) {
359
- const msg = coordErr instanceof Error ? coordErr.message : String(coordErr);
360
- if (!msg.includes("EADDRINUSE")) {
361
- throw coordErr;
362
- }
363
- // EADDRINUSE — connectToCoordinator already failed above, so whatever holds this port never answered as a reachable coordinator either. Degrade, naming the actual mismatch rather than a generic "unavailable".
364
- eaddrinuseMessage = msg;
365
- }
366
- if (!connected) {
367
- this.events.onError?.(new Error(`MeshStore: could not join or create a mesh on port ${String(this.coordinatorPort)}. ` +
368
- `port ${String(this.coordinatorPort)} is already in use by something that never answered as a reachable coordinator -- a stale process from a previous run, or an incompatible agent-comms version. ` +
369
- "agent-comms will run without mesh connectivity until this is resolved. " +
370
- `(${eaddrinuseMessage ?? "unknown reason"})`));
371
- return;
372
- }
373
- }
367
+ await this.peerLifecycle.joinWellKnownPort();
374
368
  this.requireTransport().unref();
375
369
  // First contact (agent-comms#341): a coordinator-free presence on this machine or LAN, owned by PeerLifecycle; a no-op unless a firstContactPort was configured, which only bridge-mesh (every real bridge's shared bootstrap) does.
376
370
  this.peerLifecycle.startFirstContact();
@@ -385,6 +379,7 @@ export class MeshStore {
385
379
  connectionApproval: this.connectionApproval,
386
380
  deliveryEngine: this.deliveryEngine,
387
381
  roomProtocol: this.roomProtocol,
382
+ coordinatorRole: this.coordinatorRole,
388
383
  reportError: this.reportError,
389
384
  });
390
385
  }
@@ -748,10 +743,10 @@ export class MeshStore {
748
743
  .broadcastPatch({ type: "agent_offline", agentId: this.peerId })
749
744
  .catch(() => undefined);
750
745
  }
751
- this.staleAgentChecker.stop();
752
- // Graceful coordinator handover (agent-comms#170) -- a no-op unless this side currently holds the coordinator role, so this runs unconditionally rather than being gated behind an isCoordinator check duplicated here. Must run before the transport shuts down: the handoff message rides the very peer sessions shutdown() is about to close.
746
+ // Gives the elected coordinator role up (stopping the stale-agent probe and firing onCoordinatorRoleChanged(false)) when this store held it; survivors recover it from this store's departure.
747
+ await this.coordinatorRole.stop();
748
+ // Graceful handover of the well-known port listener (agent-comms#170): a no-op unless this side currently holds it, so this runs unconditionally rather than being gated behind an isCoordinator check duplicated here. Must run before the transport shuts down: the handoff message rides the very peer sessions shutdown() is about to close.
753
749
  await this.peerLifecycle.sendCoordinatorHandover();
754
- await this.onCoordinatorRoleChanged?.(false);
755
750
  await this.requireTransport().shutdown();
756
751
  await farewell;
757
752
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-store.js","sourceRoot":"","sources":["../../src/core/mesh-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,oBAAoB,GAIr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c;iBAC3B,cAAc,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;iBAC/D,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC;QAED,+LAA+L;QAC/L,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QAClC,iVAAiV;QACjV,MAAM,IAAI,CAAC,aAAa,CAAC,uBAAuB,EAAE,CAAC;QACnD,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,CAAC;QACzC,MAAM,QAAQ,CAAC;IACjB,CAAC;CACF"}
@@ -1,10 +1,12 @@
1
1
  /**
2
- * PeerLifecycle — the TransportEvents callbacks around a peer's own comings and goings on the mesh: peer-list/peer-joined bookkeeping, the coordinator's own new-peer introduction handshake, post-connection state-sync, inbound data-message routing (state_sync/state_update), taking over as coordinator, and peer disconnection. Split out of mesh-store.ts to reduce it under the repo's max-lines cap.
2
+ * PeerLifecycle: the TransportEvents callbacks around a peer's own comings and goings on the mesh: peer-list/peer-joined bookkeeping, the well-known port holder's new-peer introduction handshake, post-connection state-sync, claiming the elected coordinator role when this store is alone, inbound data-message routing (state_sync/state_update), taking over the well-known port listener, and peer disconnection. Split out of mesh-store.ts to reduce it under the repo's max-lines cap.
3
+ *
4
+ * Two roles are kept apart here (agent-comms#341). The well-known port listener is only the compatibility first-contact address and introduction path, and is still passed on by graceful handover and recovered by the bind race. The coordinator duties (the stale-agent probe, single-authority departure announcements, the default cc-peer front) follow the elected CoordinatorRole instead, whose holder need not be the peer that bound the port.
3
5
  */
4
6
  import type { MeshMessage, PeerInfo, SerialisedState } from "./wire-protocol.js";
5
7
  import type { DeliveryEngine } from "./delivery-engine.js";
6
8
  import type { RoomProtocol } from "./room-protocol.js";
7
- import type { StaleAgentChecker } from "./stale-agent-checker.js";
9
+ import type { CoordinatorRole } from "./coordinator-role.js";
8
10
  import type { ConnectionHandle, MeshTransport } from "./transport.js";
9
11
  import type { AgentIdentity } from "./types.js";
10
12
  /** The state and collaborators PeerLifecycle needs from MeshStore. peerInfo/agents are direct references into MeshStore's own fields; coordinatorPort is a readonly value copied once; serialise is MeshStore's own retained method (constraint: it must stay directly on MeshStore.prototype, so PeerLifecycle calls it through this closure rather than owning it); roomProtocol/deliveryEngine/staleAgentChecker are the already-constructed instances (construction order: ... -\> roomProtocol -\> ... -\> staleAgentChecker -\> peerLifecycle), narrowed to what peer-lifecycle bookkeeping ever needs. */
@@ -20,10 +22,9 @@ export interface PeerLifecycleDeps {
20
22
  requireTransport: () => MeshTransport;
21
23
  serialise: () => SerialisedState;
22
24
  roomProtocol: Pick<RoomProtocol, "flushPendingRoomRequests">;
23
- deliveryEngine: Pick<DeliveryEngine, "applyStateSync" | "applyPatch" | "notifyRoomsOfStatus" | "broadcastPatch">;
24
- staleAgentChecker: Pick<StaleAgentChecker, "start">;
25
- /** Fires right after this side takes over as coordinator -- MeshStore's own hook for starting a coordinator-only capability that doesn't belong in the transport-agnostic core itself (e.g. the cc-peer front, agent-comms#157). Optional and left unset by most callers, mirroring MeshStore's own onDelivery/onPatch/onError callback fields. */
26
- onCoordinatorRoleChanged?: (() => void | Promise<void>) | undefined;
25
+ deliveryEngine: Pick<DeliveryEngine, "applyStateSync" | "applyPatch" | "notifyRoomsOfStatus" | "broadcastPatch" | "bump">;
26
+ /** The elected coordinator role: claimed when this side takes the port listener, or finds it held by something that never answers, with no incumbent known; recovered when its holder departs; and the authority retireDepartedAgent checks. Announcing it to each new session is the transport's onElectionSessionEnrolled, not a PeerLifecycle concern. */
27
+ coordinatorRole: Pick<CoordinatorRole, "claimIfVacant" | "claimIfVacantAfterWait" | "handleDeparture" | "isHolder">;
27
28
  /** Reports a failed takeover or rejoin. The crash-race path runs detached from any caller that could handle a rejection, so this is the only signal that a coordinator loss was noticed but not recovered from. */
28
29
  onError?: ((error: Error) => void) | undefined;
29
30
  }
@@ -38,6 +39,12 @@ export declare class PeerLifecycle {
38
39
  startFirstContact(): void;
39
40
  /** Stops the presence and releases its port. Idempotent, and a no-op when none was started. */
40
41
  stopFirstContact(): void;
42
+ /**
43
+ * init()'s single attempt at the well-known port: connect to whoever holds it, or bind it through the same takeover a handover or crash race runs (which, knowing of no elected incumbent, claims the coordinator role as the first store on this machine as far as it can tell). If the port is occupied but unresponsive (e.g. an orphan process from a previous session), carry on without it instead of retrying: first contact still forms the mesh, and with nothing answering on the port this store claims the coordinator role the same way, unless first contact brings it an incumbent's claim first. Retrying tls.connect after a failed handshake to a non-TLS endpoint can freeze the event loop (Node.js TLS session cache bug), so this only tries once. A bind failure other than EADDRINUSE is rethrown.
44
+ */
45
+ joinWellKnownPort(): Promise<void>;
46
+ /** Claims the elected role for a store that knows of no incumbent and met nobody on the well-known port. With no first-contact presence configured, the port is the only way another store could reach this one, so it claims at once. With one, an incumbent that never held the port may still be about to announce itself over a first-contact session, so the claim waits for it rather than taking the role at an equal term and winning the tiebreak against a holder that was there first. */
47
+ private claimWhileAlone;
41
48
  handlePeerList(peers: readonly PeerInfo[]): void;
42
49
  handlePeerJoined(peer: Readonly<PeerInfo>): void;
43
50
  handleIntroduction(handle: Readonly<ConnectionHandle>, msg: Readonly<{
@@ -46,17 +53,18 @@ export declare class PeerLifecycle {
46
53
  }>): Promise<void>;
47
54
  handlePeerConnected(handle: Readonly<ConnectionHandle>, _info: Readonly<PeerInfo>): Promise<void>;
48
55
  handleDataMessage(handle: Readonly<ConnectionHandle>, msg: MeshMessage): Promise<void>;
56
+ /** Takes over the well-known port listener (a fresh bind in init, a graceful handover, or winning the crash race) and dials the peers named. Holding the port no longer carries the coordinator duties; the one link left is that a port holder which knows of no elected incumbent claims the role, since it is then the first on its machine as far as it can tell. */
49
57
  handleBecomeCoordinator(peerList: readonly PeerInfo[]): Promise<void>;
50
58
  handlePeerDisconnected(handle: Readonly<ConnectionHandle>): void;
51
- /** The awaitable form of handlePeerDisconnected, which TransportEvents forces to be synchronous. A departing peer leaves the peer list; when it was this side's own coordinator, its vacated role is contested before anything else, so whoever wins is already coordinator by the time the departed peer's agent record is retired. */
59
+ /** The awaitable form of handlePeerDisconnected, which TransportEvents forces to be synchronous. A departing peer leaves the peer list. When it held the elected coordinator role, the role is recovered first (the lowest surviving device-id claims at a raised term), so the new holder is already in place by the time the departed peer's agent record is retired; when it held the well-known port this side dialled, the vacated port is contested too. */
52
60
  handlePeerDeparture(peerId: string): Promise<void>;
53
- /** Races every other surviving peer to rebind the coordinator port, which is what makes a coordinator CRASH recoverable at all: unlike the graceful handover, a killed coordinator names no successor, so each survivor contests independently and the operating system's own exclusive bind decides the single winner. The winner runs the ordinary takeover path (handleBecomeCoordinator) over the peers it still holds connections to; a loser -- the one case where the bind fails specifically because the port is already taken -- re-introduces itself to the winner so it is a full member of the new mesh again, with its own data port known to whoever joins next. Direct peer-to-peer data connections are untouched throughout, so traffic between survivors never depends on the outcome of this race. */
61
+ /** Races every other surviving peer to rebind the well-known port, which is what keeps the compatibility first-contact address answering after its holder CRASHES: unlike the graceful handover, a killed holder names no successor, so each survivor contests independently and the operating system's own exclusive bind decides the single winner. The winner runs the ordinary takeover path (handleBecomeCoordinator) over the peers it still holds connections to; a loser (the one case where the bind fails specifically because the port is already taken) re-introduces itself to the winner so it is a full member of the new mesh again, with its own data port known to whoever joins next. Direct peer-to-peer data connections are untouched throughout, so traffic between survivors never depends on the outcome of this race. */
54
62
  private contestCoordinatorRole;
55
63
  /** Re-introduces this side to whichever survivor won the bind race, over a fresh coordinator connection to the same well-known port. Without it this peer would keep its existing data connections but be unknown to the new coordinator, so it would never appear in the peer list handed to the next joiner. A refused dial is reported as "nothing-listening" rather than as an error: it means the winner released the port again (or never finished taking it), which the caller answers by re-entering the bind race. Any other failure is reported here, since it says the coordinator is there and this peer still cannot reach it. */
56
64
  private rejoinUnderNewCoordinator;
57
- /** Marks a departed peer's own agent offline and announces it, but only from the coordinator -- the same single-authority rule StaleAgentChecker's PID probe already follows, so a departure produces one announcement rather than one per surviving peer. An agent's id is its peer's id (AgentRegistry.registerAgent), so the departed peer names its own record directly; the PID probe remains the backstop for an agent whose process dies without its session closing. */
65
+ /** Marks a departed peer's own agent offline and announces it, but only from the elected coordinator: the same single-authority rule StaleAgentChecker's PID probe already follows, so a departure produces one announcement rather than one per surviving peer. An agent's id is its peer's id (AgentRegistry.registerAgent), so the departed peer names its own record directly; the PID probe remains the backstop for an agent whose process dies without its session closing, and an already-offline record is left alone, so a successor that took over late announces nothing twice. */
58
66
  private retireDepartedAgent;
59
- /** Graceful coordinator handover (agent-comms#170): called by MeshStore.shutdown() while the transport is still up. A no-op unless this side currently holds the coordinator role and at least one other peer remains connected -- neither condition is this class's own business to log or report on, since a solo coordinator shutting down or a non-coordinator peer shutting down are both entirely ordinary. When both hold, picks the longest-running remaining peer (the one with the earliest recorded PeerInfo.startedAt, matching the README's documented policy) as the successor and sends it become_coordinator carrying every other remaining peer -- exactly the peerList shape handleBecomeCoordinator already expects (it dials each entry itself; the successor doesn't need to be told about itself). The crash-race path (each surviving peer independently racing to rebind the coordinator port) is a separate mechanism and untouched by this method. */
67
+ /** Graceful handover of the well-known port listener (agent-comms#170): called by MeshStore.shutdown() while the transport is still up. The elected coordinator role needs no handover, since survivors recover it from the departure itself. A no-op unless this side currently holds the port listener and at least one other peer remains connected. Neither condition is this class's own business to log or report on, since a solo coordinator shutting down or a non-coordinator peer shutting down are both entirely ordinary. When both hold, picks the longest-running remaining peer (the one with the earliest recorded PeerInfo.startedAt, matching the README's documented policy) as the successor and sends it become_coordinator carrying every other remaining peer, exactly the peerList shape handleBecomeCoordinator already expects (it dials each entry itself; the successor doesn't need to be told about itself). The crash-race path (each surviving peer independently racing to rebind the coordinator port) is a separate mechanism and untouched by this method. */
60
68
  sendCoordinatorHandover(): Promise<void>;
61
69
  }
62
70
  //# sourceMappingURL=peer-lifecycle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"peer-lifecycle.d.ts","sourceRoot":"","sources":["../../src/core/peer-lifecycle.ts"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IAiB3E,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAIhE,kcAAkc;IAC5b,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxD,mzBAAmzB;YACryB,sBAAsB;IA0CpC,+mBAA+mB;YACjmB,yBAAyB;IAuBvC,+jBAA+jB;YACjjB,mBAAmB;IAejC,miCAAmiC;IAC7hC,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;CAuB/C"}
@@ -1,5 +1,7 @@
1
1
  /**
2
- * PeerLifecycle — the TransportEvents callbacks around a peer's own comings and goings on the mesh: peer-list/peer-joined bookkeeping, the coordinator's own new-peer introduction handshake, post-connection state-sync, inbound data-message routing (state_sync/state_update), taking over as coordinator, and peer disconnection. Split out of mesh-store.ts to reduce it under the repo's max-lines cap.
2
+ * PeerLifecycle: the TransportEvents callbacks around a peer's own comings and goings on the mesh: peer-list/peer-joined bookkeeping, the well-known port holder's new-peer introduction handshake, post-connection state-sync, claiming the elected coordinator role when this store is alone, inbound data-message routing (state_sync/state_update), taking over the well-known port listener, and peer disconnection. Split out of mesh-store.ts to reduce it under the repo's max-lines cap.
3
+ *
4
+ * Two roles are kept apart here (agent-comms#341). The well-known port listener is only the compatibility first-contact address and introduction path, and is still passed on by graceful handover and recovered by the bind race. The coordinator duties (the stale-agent probe, single-authority departure announcements, the default cc-peer front) follow the elected CoordinatorRole instead, whose holder need not be the peer that bound the port.
3
5
  */
4
6
  import { normaliseWireState } from "./wire-protocol.js";
5
7
  import { isAddrInUse, isConnectionRefused } from "./bind-retry.js";
@@ -42,6 +44,42 @@ export class PeerLifecycle {
42
44
  this.firstContact?.stop();
43
45
  this.firstContact = undefined;
44
46
  }
47
+ /**
48
+ * init()'s single attempt at the well-known port: connect to whoever holds it, or bind it through the same takeover a handover or crash race runs (which, knowing of no elected incumbent, claims the coordinator role as the first store on this machine as far as it can tell). If the port is occupied but unresponsive (e.g. an orphan process from a previous session), carry on without it instead of retrying: first contact still forms the mesh, and with nothing answering on the port this store claims the coordinator role the same way, unless first contact brings it an incumbent's claim first. Retrying tls.connect after a failed handshake to a non-TLS endpoint can freeze the event loop (Node.js TLS session cache bug), so this only tries once. A bind failure other than EADDRINUSE is rethrown.
49
+ */
50
+ async joinWellKnownPort() {
51
+ const transport = this.deps.requireTransport();
52
+ const port = this.deps.coordinatorPort;
53
+ try {
54
+ await transport.connectToCoordinator(COORDINATOR_HOST, port, this.deps.getPeerId(), transport.dataPort);
55
+ return;
56
+ }
57
+ catch {
58
+ // Nothing reachable answered as the port holder; fall through to binding it.
59
+ }
60
+ try {
61
+ await this.handleBecomeCoordinator([]);
62
+ return;
63
+ }
64
+ catch (error) {
65
+ if (!isAddrInUse(error))
66
+ throw error;
67
+ // connectToCoordinator already failed above, so whatever holds this port never answered as a reachable coordinator either. Name the actual mismatch rather than a generic "unavailable".
68
+ this.deps.onError?.(new Error(`MeshStore: could not join or create a mesh on port ${String(port)}. ` +
69
+ `port ${String(port)} is already in use by something that never answered as a reachable coordinator: a stale process from a previous run, or an incompatible agent-comms version. ` +
70
+ "agent-comms will reach other peers through first contact only until this is resolved. " +
71
+ `(${describe(error)})`));
72
+ }
73
+ await this.claimWhileAlone();
74
+ }
75
+ /** Claims the elected role for a store that knows of no incumbent and met nobody on the well-known port. With no first-contact presence configured, the port is the only way another store could reach this one, so it claims at once. With one, an incumbent that never held the port may still be about to announce itself over a first-contact session, so the claim waits for it rather than taking the role at an equal term and winning the tiebreak against a holder that was there first. */
76
+ async claimWhileAlone() {
77
+ if (this.deps.firstContactPort === undefined) {
78
+ await this.deps.coordinatorRole.claimIfVacant();
79
+ return;
80
+ }
81
+ this.deps.coordinatorRole.claimIfVacantAfterWait();
82
+ }
45
83
  handlePeerList(peers) {
46
84
  const peerId = this.deps.getPeerId();
47
85
  for (const peer of peers) {
@@ -105,6 +143,7 @@ export class PeerLifecycle {
105
143
  await this.deps.deliveryEngine.applyPatch(msg.patch);
106
144
  }
107
145
  }
146
+ /** Takes over the well-known port listener (a fresh bind in init, a graceful handover, or winning the crash race) and dials the peers named. Holding the port no longer carries the coordinator duties; the one link left is that a port holder which knows of no elected incumbent claims the role, since it is then the first on its machine as far as it can tell. */
108
147
  async handleBecomeCoordinator(peerList) {
109
148
  // Take over as coordinator using the data server we already have
110
149
  await this.deps
@@ -120,21 +159,21 @@ export class PeerLifecycle {
120
159
  this.deps.peerInfo.set(peer.id, peer);
121
160
  void this.deps.requireTransport().connectToPeer(peer, peerId);
122
161
  }
123
- this.deps.staleAgentChecker.start();
124
- await this.deps.onCoordinatorRoleChanged?.();
162
+ await this.claimWhileAlone();
125
163
  }
126
164
  handlePeerDisconnected(handle) {
127
165
  void this.handlePeerDeparture(handle.id);
128
166
  }
129
- /** The awaitable form of handlePeerDisconnected, which TransportEvents forces to be synchronous. A departing peer leaves the peer list; when it was this side's own coordinator, its vacated role is contested before anything else, so whoever wins is already coordinator by the time the departed peer's agent record is retired. */
167
+ /** The awaitable form of handlePeerDisconnected, which TransportEvents forces to be synchronous. A departing peer leaves the peer list. When it held the elected coordinator role, the role is recovered first (the lowest surviving device-id claims at a raised term), so the new holder is already in place by the time the departed peer's agent record is retired; when it held the well-known port this side dialled, the vacated port is contested too. */
130
168
  async handlePeerDeparture(peerId) {
131
169
  this.deps.peerInfo.delete(peerId);
170
+ await this.deps.coordinatorRole.handleDeparture(peerId, async () => this.retireDepartedAgent(peerId));
132
171
  if (peerId === this.deps.getCoordinatorPeerId()) {
133
172
  await this.contestCoordinatorRole(peerId);
134
173
  }
135
174
  await this.retireDepartedAgent(peerId);
136
175
  }
137
- /** Races every other surviving peer to rebind the coordinator port, which is what makes a coordinator CRASH recoverable at all: unlike the graceful handover, a killed coordinator names no successor, so each survivor contests independently and the operating system's own exclusive bind decides the single winner. The winner runs the ordinary takeover path (handleBecomeCoordinator) over the peers it still holds connections to; a loser -- the one case where the bind fails specifically because the port is already taken -- re-introduces itself to the winner so it is a full member of the new mesh again, with its own data port known to whoever joins next. Direct peer-to-peer data connections are untouched throughout, so traffic between survivors never depends on the outcome of this race. */
176
+ /** Races every other surviving peer to rebind the well-known port, which is what keeps the compatibility first-contact address answering after its holder CRASHES: unlike the graceful handover, a killed holder names no successor, so each survivor contests independently and the operating system's own exclusive bind decides the single winner. The winner runs the ordinary takeover path (handleBecomeCoordinator) over the peers it still holds connections to; a loser (the one case where the bind fails specifically because the port is already taken) re-introduces itself to the winner so it is a full member of the new mesh again, with its own data port known to whoever joins next. Direct peer-to-peer data connections are untouched throughout, so traffic between survivors never depends on the outcome of this race. */
138
177
  async contestCoordinatorRole(lostCoordinatorId) {
139
178
  const transport = this.deps.requireTransport();
140
179
  if (transport.isCoordinator || this.contestingCoordinatorRole)
@@ -150,7 +189,7 @@ export class PeerLifecycle {
150
189
  }
151
190
  catch (error) {
152
191
  if (!isAddrInUse(error)) {
153
- this.deps.onError?.(new Error(`PeerLifecycle: could not take over the vacated coordinator role: ${describe(error)}`));
192
+ this.deps.onError?.(new Error(`PeerLifecycle: could not take over the vacated coordinator port: ${describe(error)}`));
154
193
  return;
155
194
  }
156
195
  }
@@ -180,14 +219,16 @@ export class PeerLifecycle {
180
219
  return "failed";
181
220
  }
182
221
  }
183
- /** Marks a departed peer's own agent offline and announces it, but only from the coordinator -- the same single-authority rule StaleAgentChecker's PID probe already follows, so a departure produces one announcement rather than one per surviving peer. An agent's id is its peer's id (AgentRegistry.registerAgent), so the departed peer names its own record directly; the PID probe remains the backstop for an agent whose process dies without its session closing. */
222
+ /** Marks a departed peer's own agent offline and announces it, but only from the elected coordinator: the same single-authority rule StaleAgentChecker's PID probe already follows, so a departure produces one announcement rather than one per surviving peer. An agent's id is its peer's id (AgentRegistry.registerAgent), so the departed peer names its own record directly; the PID probe remains the backstop for an agent whose process dies without its session closing, and an already-offline record is left alone, so a successor that took over late announces nothing twice. */
184
223
  async retireDepartedAgent(peerId) {
185
- if (!this.deps.requireTransport().isCoordinator)
224
+ if (!this.deps.coordinatorRole.isHolder())
186
225
  return;
187
226
  const agent = this.deps.agents.get(peerId);
188
227
  if (agent === undefined || agent.status === "offline")
189
228
  return;
229
+ // Bumped so that a state snapshot a survivor sends from before it heard of the departure, which still shows the agent running at its old revision, cannot turn it back on.
190
230
  agent.status = "offline";
231
+ this.deps.deliveryEngine.bump(agent);
191
232
  this.deps.agents.set(peerId, agent);
192
233
  await this.deps.deliveryEngine.notifyRoomsOfStatus(peerId, "offline");
193
234
  await this.deps.deliveryEngine.broadcastPatch({
@@ -195,7 +236,7 @@ export class PeerLifecycle {
195
236
  agentId: peerId,
196
237
  });
197
238
  }
198
- /** Graceful coordinator handover (agent-comms#170): called by MeshStore.shutdown() while the transport is still up. A no-op unless this side currently holds the coordinator role and at least one other peer remains connected -- neither condition is this class's own business to log or report on, since a solo coordinator shutting down or a non-coordinator peer shutting down are both entirely ordinary. When both hold, picks the longest-running remaining peer (the one with the earliest recorded PeerInfo.startedAt, matching the README's documented policy) as the successor and sends it become_coordinator carrying every other remaining peer -- exactly the peerList shape handleBecomeCoordinator already expects (it dials each entry itself; the successor doesn't need to be told about itself). The crash-race path (each surviving peer independently racing to rebind the coordinator port) is a separate mechanism and untouched by this method. */
239
+ /** Graceful handover of the well-known port listener (agent-comms#170): called by MeshStore.shutdown() while the transport is still up. The elected coordinator role needs no handover, since survivors recover it from the departure itself. A no-op unless this side currently holds the port listener and at least one other peer remains connected. Neither condition is this class's own business to log or report on, since a solo coordinator shutting down or a non-coordinator peer shutting down are both entirely ordinary. When both hold, picks the longest-running remaining peer (the one with the earliest recorded PeerInfo.startedAt, matching the README's documented policy) as the successor and sends it become_coordinator carrying every other remaining peer, exactly the peerList shape handleBecomeCoordinator already expects (it dials each entry itself; the successor doesn't need to be told about itself). The crash-race path (each surviving peer independently racing to rebind the coordinator port) is a separate mechanism and untouched by this method. */
199
240
  async sendCoordinatorHandover() {
200
241
  const transport = this.deps.requireTransport();
201
242
  if (!transport.isCoordinator)
@@ -1 +1 @@
1
-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ACpB,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE,CACxD,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A connect_request held open awaiting a human decision, how long it may wait, and what happens when it waits too long: WireMeshTransport's pending-connection bookkeeping, split out of wire-mesh-transport.ts to keep it under the repo's max-lines cap.
3
+ */
4
+ import type { AcceptedMeshSession, IncomingManageRequest } from "wire-mesh-core/domain/mesh-session";
5
+ import type { ListenerPolicy } from "./transport.js";
6
+ export declare const DEFAULT_PENDING_CONNECTION_TIMEOUT_MS: number;
7
+ /** A human decision on a connect_request: "accept" resumes the still-blocked consumeQuarantined loop as a fully trusted session; "reject" (also used when the requester disconnects before a decision is made) unblocks it to close instead. */
8
+ export type ConnectionDecision = "accept" | "reject";
9
+ export interface PendingConnection {
10
+ respond: IncomingManageRequest["respond"];
11
+ dataPort: number;
12
+ name: string;
13
+ fingerprint: string;
14
+ policy: ListenerPolicy | undefined;
15
+ /** Held so acceptConnection can trackSession it synchronously, before firing onIntroduction -- that event's own handler (mesh-store's handleIntroduction) sends a reply on this same handle immediately, which needs peerSessions already populated. Waiting for consumeQuarantined's own suspended loop to resume and do it would race: resolve() below only wakes that loop on a later microtask tick, after onIntroduction has already fired. */
16
+ session: AcceptedMeshSession;
17
+ /** Settles the Promise consumeQuarantined is blocked on for this connect_request -- the mechanism by which acceptConnection/rejectConnection resume a loop suspended mid-iteration, without ever needing to re-obtain (and so needing to reason about the identity of) a second iterator over the same session's incomingManageRequests. */
18
+ resolve: (decision: ConnectionDecision) => void;
19
+ /** Auto-rejects this request after the configured pending-connection timeout if no human decision arrives first. Cleared by acceptConnection/rejectConnection/watchForDisconnect's own disconnect path, whichever settles the request first -- an entry is only ever removed from pendingConnections once, so this timer firing after another path already resolved it is structurally impossible, not merely guarded against. */
20
+ timeoutHandle: ReturnType<typeof setTimeout>;
21
+ }
22
+ /** Auto-rejects a connect_request that has sat unanswered past WireMeshTransport's pendingConnectionTimeoutMs: the same respond-then-resolve shape rejectConnection uses (a real error response, not a silent hang), since unlike watchForDisconnect's own cleanup path the requester's session is still very much alive and waiting to hear back. A no-op if the request was already settled by acceptConnection/rejectConnection/disconnect before this timer fired, since entries are deleted exactly once, by whichever path settles first. */
23
+ export declare function expirePendingConnection(pendingConnections: Map<string, PendingConnection>, id: string): void;
24
+ //# sourceMappingURL=pending-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-connection.d.ts","sourceRoot":"","sources":["../../src/core/pending-connection.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMrD,eAAO,MAAM,qCAAqC,QACuB,CAAC;AAE1E,gPAAgP;AAChP,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IACnC,obAAob;IACpb,OAAO,EAAE,mBAAmB,CAAC;IAC7B,4UAA4U;IAC5U,OAAO,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAChD,kaAAka;IACla,aAAa,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CAC9C;AAED,mhBAAmhB;AACnhB,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAClD,EAAE,EAAE,MAAM,GACT,IAAI,CAcN"}