agent-comms 5.2.5 → 7.0.0

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 (138) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +6 -2
  4. package/dist/bridges/user/controller.d.ts +1 -1
  5. package/dist/bridges/user/controller.d.ts.map +1 -1
  6. package/dist/bridges/user/controller.js +1 -1
  7. package/dist/bridges/user/controller.js.map +1 -1
  8. package/dist/core/bridge-mesh.d.ts +2 -2
  9. package/dist/core/bridge-mesh.d.ts.map +1 -1
  10. package/dist/core/bridge-mesh.js +3 -2
  11. package/dist/core/bridge-mesh.js.map +1 -1
  12. package/dist/core/gateway-trust.d.ts +15 -9
  13. package/dist/core/gateway-trust.d.ts.map +1 -1
  14. package/dist/core/gateway-trust.js +49 -21
  15. package/dist/core/gateway-trust.js.map +1 -1
  16. package/dist/core/gossip-directory.d.ts +1 -1
  17. package/dist/core/gossip-directory.d.ts.map +1 -1
  18. package/dist/core/gossip-directory.js +4 -2
  19. package/dist/core/gossip-directory.js.map +1 -1
  20. package/dist/core/hub-forwarding.d.ts +4 -18
  21. package/dist/core/hub-forwarding.d.ts.map +1 -1
  22. package/dist/core/hub-forwarding.js +2 -41
  23. package/dist/core/hub-forwarding.js.map +1 -1
  24. package/dist/core/hub-link.d.ts +58 -0
  25. package/dist/core/hub-link.d.ts.map +1 -0
  26. package/dist/core/hub-link.js +118 -0
  27. package/dist/core/hub-link.js.map +1 -0
  28. package/dist/core/hub-session.d.ts +14 -15
  29. package/dist/core/hub-session.d.ts.map +1 -1
  30. package/dist/core/hub-session.js +30 -51
  31. package/dist/core/hub-session.js.map +1 -1
  32. package/dist/core/identity-store.d.ts +8 -4
  33. package/dist/core/identity-store.d.ts.map +1 -1
  34. package/dist/core/identity-store.js +29 -15
  35. package/dist/core/identity-store.js.map +1 -1
  36. package/dist/core/mesh-graph.d.ts +1 -1
  37. package/dist/core/mesh-graph.js +1 -1
  38. package/dist/core/mesh-store.d.ts +11 -6
  39. package/dist/core/mesh-store.d.ts.map +1 -1
  40. package/dist/core/mesh-store.js +33 -22
  41. package/dist/core/mesh-store.js.map +1 -1
  42. package/dist/core/peer-lifecycle.d.ts +2 -5
  43. package/dist/core/peer-lifecycle.d.ts.map +1 -1
  44. package/dist/core/peer-lifecycle.js +0 -1
  45. package/dist/core/peer-lifecycle.js.map +1 -1
  46. package/dist/core/room-router.d.ts +2 -2
  47. package/dist/core/room-router.d.ts.map +1 -1
  48. package/dist/core/room-router.js +2 -32
  49. package/dist/core/room-router.js.map +1 -1
  50. package/dist/core/shutdown-signals.d.ts +1 -1
  51. package/dist/core/shutdown-signals.js +1 -1
  52. package/dist/core/transport.d.ts +7 -7
  53. package/dist/core/transport.d.ts.map +1 -1
  54. package/dist/core/wire-mesh-transport.d.ts +7 -3
  55. package/dist/core/wire-mesh-transport.d.ts.map +1 -1
  56. package/dist/core/wire-mesh-transport.js +39 -22
  57. package/dist/core/wire-mesh-transport.js.map +1 -1
  58. package/dist/test/bridge-mesh.integration.test.js +15 -1
  59. package/dist/test/bridge-mesh.integration.test.js.map +1 -1
  60. package/dist/test/chat-controller-mesh-errors.integration.test.js +7 -1
  61. package/dist/test/chat-controller-mesh-errors.integration.test.js.map +1 -1
  62. package/dist/test/coordinator-failover-hub.integration.test.d.ts +5 -0
  63. package/dist/test/coordinator-failover-hub.integration.test.d.ts.map +1 -0
  64. package/dist/test/coordinator-failover-hub.integration.test.js +78 -0
  65. package/dist/test/coordinator-failover-hub.integration.test.js.map +1 -0
  66. package/dist/test/coordinator-failover.integration.test.js +3 -6
  67. package/dist/test/coordinator-failover.integration.test.js.map +1 -1
  68. package/dist/test/coordinator-failover.unit.test.js +0 -7
  69. package/dist/test/coordinator-failover.unit.test.js.map +1 -1
  70. package/dist/test/gateway-trust.integration.test.d.ts +1 -1
  71. package/dist/test/gateway-trust.integration.test.js +26 -2
  72. package/dist/test/gateway-trust.integration.test.js.map +1 -1
  73. package/dist/test/gateway-trust.unit.test.js +43 -5
  74. package/dist/test/gateway-trust.unit.test.js.map +1 -1
  75. package/dist/test/hub-exposure.integration.test.d.ts +5 -0
  76. package/dist/test/hub-exposure.integration.test.d.ts.map +1 -0
  77. package/dist/test/hub-exposure.integration.test.js +121 -0
  78. package/dist/test/hub-exposure.integration.test.js.map +1 -0
  79. package/dist/test/hub-helpers.d.ts +18 -3
  80. package/dist/test/hub-helpers.d.ts.map +1 -1
  81. package/dist/test/hub-helpers.js +24 -3
  82. package/dist/test/hub-helpers.js.map +1 -1
  83. package/dist/test/hub-link.unit.test.d.ts +2 -0
  84. package/dist/test/hub-link.unit.test.d.ts.map +1 -0
  85. package/dist/test/hub-link.unit.test.js +210 -0
  86. package/dist/test/hub-link.unit.test.js.map +1 -0
  87. package/dist/test/hub-peer-per-store.integration.test.d.ts +9 -0
  88. package/dist/test/hub-peer-per-store.integration.test.d.ts.map +1 -0
  89. package/dist/test/hub-peer-per-store.integration.test.js +211 -0
  90. package/dist/test/hub-peer-per-store.integration.test.js.map +1 -0
  91. package/dist/test/hub-room-domain-verb-trust-bypass.integration.test.js +2 -2
  92. package/dist/test/hub-room-domain-verb-trust-bypass.integration.test.js.map +1 -1
  93. package/dist/test/hub-session-close.integration.test.js +1 -1
  94. package/dist/test/hub-session-close.integration.test.js.map +1 -1
  95. package/dist/test/hub-session-dispatch.unit.test.js +1 -66
  96. package/dist/test/hub-session-dispatch.unit.test.js.map +1 -1
  97. package/dist/test/identity-store.integration.test.js +24 -32
  98. package/dist/test/identity-store.integration.test.js.map +1 -1
  99. package/dist/test/mesh-graph-trace.integration.test.js +2 -2
  100. package/dist/test/mesh-graph-trace.integration.test.js.map +1 -1
  101. package/dist/test/mesh-smoke.runner.js +1 -3
  102. package/dist/test/mesh-smoke.runner.js.map +1 -1
  103. package/dist/test/mesh-store-orchestration.unit.test.js +11 -41
  104. package/dist/test/mesh-store-orchestration.unit.test.js.map +1 -1
  105. package/dist/test/peer-lifecycle.unit.test.js +0 -8
  106. package/dist/test/peer-lifecycle.unit.test.js.map +1 -1
  107. package/dist/test/principal-membership-trust.integration.test.js +8 -1
  108. package/dist/test/principal-membership-trust.integration.test.js.map +1 -1
  109. package/dist/test/room-join-by-bare-name.integration.test.js +1 -1
  110. package/dist/test/room-join-by-bare-name.integration.test.js.map +1 -1
  111. package/dist/test/test-transport.d.ts +1 -1
  112. package/dist/test/test-transport.d.ts.map +1 -1
  113. package/dist/test/test-transport.js +1 -1
  114. package/dist/test/test-transport.js.map +1 -1
  115. package/dist/test/wire-mesh-transport-hub.integration.test.d.ts +1 -1
  116. package/dist/test/wire-mesh-transport-hub.integration.test.js +96 -9
  117. package/dist/test/wire-mesh-transport-hub.integration.test.js.map +1 -1
  118. package/package.json +1 -1
  119. package/dist/core/coordinator-gateway.d.ts +0 -25
  120. package/dist/core/coordinator-gateway.d.ts.map +0 -1
  121. package/dist/core/coordinator-gateway.js +0 -34
  122. package/dist/core/coordinator-gateway.js.map +0 -1
  123. package/dist/test/coordinator-gateway.unit.test.d.ts +0 -2
  124. package/dist/test/coordinator-gateway.unit.test.d.ts.map +0 -1
  125. package/dist/test/coordinator-gateway.unit.test.js +0 -88
  126. package/dist/test/coordinator-gateway.unit.test.js.map +0 -1
  127. package/dist/test/gateway-forwarding.integration.test.d.ts +0 -9
  128. package/dist/test/gateway-forwarding.integration.test.d.ts.map +0 -1
  129. package/dist/test/gateway-forwarding.integration.test.js +0 -226
  130. package/dist/test/gateway-forwarding.integration.test.js.map +0 -1
  131. package/dist/test/hub-forwarding.unit.test.d.ts +0 -2
  132. package/dist/test/hub-forwarding.unit.test.d.ts.map +0 -1
  133. package/dist/test/hub-forwarding.unit.test.js +0 -102
  134. package/dist/test/hub-forwarding.unit.test.js.map +0 -1
  135. package/dist/test/hub-todevice-routing.integration.test.d.ts +0 -7
  136. package/dist/test/hub-todevice-routing.integration.test.d.ts.map +0 -1
  137. package/dist/test/hub-todevice-routing.integration.test.js +0 -121
  138. package/dist/test/hub-todevice-routing.integration.test.js.map +0 -1
@@ -15,7 +15,7 @@
15
15
  "source": "url",
16
16
  "url": "https://github.com/ExaDev/agent-comms.git"
17
17
  },
18
- "version": "5.2.5"
18
+ "version": "7.0.0"
19
19
  }
20
20
  ]
21
21
  }
@@ -18,5 +18,5 @@
18
18
  },
19
19
  "name": "agent-comms",
20
20
  "repository": "https://github.com/ExaDev/agent-comms",
21
- "version": "5.2.5"
21
+ "version": "7.0.0"
22
22
  }
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white)](https://github.com/ExaDev/agent-comms)
4
4
  [![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/agent-comms)
5
- [![version](https://img.shields.io/badge/version-5.2.5-blue)](https://github.com/ExaDev/agent-comms/releases/tag/v5.2.5)
5
+ [![version](https://img.shields.io/badge/version-7.0.0-blue)](https://github.com/ExaDev/agent-comms/releases/tag/v7.0.0)
6
6
  [![CI](https://img.shields.io/github/actions/workflow/status/ExaDev/agent-comms/ci.yml?branch=main)](https://github.com/ExaDev/agent-comms/actions)
7
7
 
8
8
  Cross-harness communication mesh for LLM agents: rooms, DMs, presence, and visibility over TCP with zero filesystem dependencies.
@@ -67,7 +67,7 @@ sequenceDiagram
67
67
  - On graceful shutdown, the coordinator names its longest-running peer as successor and hands the role over before closing
68
68
  - On a crash, every surviving peer independently races to rebind the port; the operating system's exclusive bind picks the single winner, and the losers re-introduce themselves to it
69
69
 
70
- Either way, direct peer-to-peer data connections are untouched, so messages between survivors keep flowing throughout. What is lost is what only the coordinator does: while no coordinator exists, no new peer can join (nothing answers the well-known port), no stale-agent probe runs, this machine has no gateway connection to the relay hub, and no cc-peer front is serving local Claude Code sessions that have no bridge of their own. The winner restarts all of that as it takes the role, and rebuilds hub-side state from scratch, so anything in flight across the gap is lost.
70
+ Either way, direct peer-to-peer data connections are untouched, so messages between survivors keep flowing throughout. What is lost is what only the coordinator does: while no coordinator exists, no new peer can join (nothing answers the well-known port), no stale-agent probe runs, and no cc-peer front is serving local Claude Code sessions that have no bridge of their own. The winner restarts all of that as it takes the role. Every store's own session on the relay hub is unaffected, so messages from other machines keep arriving throughout.
71
71
 
72
72
  ### Identity
73
73
 
@@ -393,8 +393,12 @@ Every bridge answers SIGTERM, SIGINT and SIGHUP by marking its own agent offline
393
393
 
394
394
  ## Gateway trust and connection codes
395
395
 
396
+ Every store holds its own session on the relay hub (`wss://mesh.exadev.io/` by default), each Claude Code session the default cc-peer front handles included, and dials it again with a growing delay whenever the hub drops it. Being reachable from another machine therefore does not depend on which store holds the local coordinator role, and a coordinator handover leaves every other store's hub session alone. A store holds a session only while it has an agent that is not a ghost and its machine trusts at least one remote device or principal, so before that nothing of it reaches the hub, not even its device id. A visible agent advertises itself, its presence and its hosted rooms; a hidden agent advertises only its device id, which is what lets it be reached by that id.
397
+
396
398
  Two devices on different machines can only relay traffic through each other's hub once each side explicitly trusts the other's device-id — a deny-by-default, pin-the-key model with no directory lookup, deliberately mirroring how an ordinary peer connection is already pinned.
397
399
 
400
+ The trusted set is one file, `~/.agent-comms/gateway-trust.json`, shared by every bridge on the machine and by each session the default cc-peer front handles, so trusting a device once in any of them applies to all of them.
401
+
398
402
  ```
399
403
  # Trust a remote device you already know the device-id for
400
404
  agent_comms({ action: "gateway_trust", device: "1a2b3c..." })
@@ -19,7 +19,7 @@ export declare class ChatController extends EventEmitter {
19
19
  private currentRoom;
20
20
  private readonly userName;
21
21
  private readonly coordinatorPort;
22
- /** Overrides the hub this controller's own coordinator role dials on takeover (createBridgeMesh's own hubUrl, defaulting to DEFAULT_HUB_URL) -- every real bridge entry point wants the real public hub, but a test constructing a controller of its own wants a hermetic, deterministically-unreachable one instead of silently depending on live production infrastructure whenever its own fresh coordinator port makes it the mesh's coordinator (see hub-helpers.ts's own unreachableHubUrl). */
22
+ /** Overrides the hub this controller's own store dials (createBridgeMesh's own hubUrl, defaulting to DEFAULT_HUB_URL) -- every real bridge entry point wants the real public hub, but a test constructing a controller of its own wants a hermetic, deterministically-unreachable one instead of silently depending on live production infrastructure (see hub-helpers.ts's own unreachableHubUrl). */
23
23
  private readonly hubUrl;
24
24
  constructor(userName: string, options?: {
25
25
  coordinatorPort?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/bridges/user/controller.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAarD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,IAAI,EACJ,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAM7B,qBAAa,cAAe,SAAQ,YAAY;IAE9C,OAAO,CAAC,KAAK,CAAa;IAC1B,mFAAmF;IACnF,OAAO,CAAC,iBAAiB,CAA2B;IAEpD,0DAA0D;IAC1D,IAAI,SAAS,IAAI,SAAS,CAEzB;IACD,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IACrD,seAAse;IACte,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;gBAG1C,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QACR,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B;IAQH;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,QAAQ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vB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC5B,GAAG,OAAO,CAAC,WAAW,CAAC;IAalB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ7D,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQnE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ3D,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAanE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAWjD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAwBhD,SAAS,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAIrC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAI3B,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,EAAE,CAAC;IAIzB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM;IAQnC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAOhC"}
@@ -25,7 +25,7 @@ export class ChatController extends EventEmitter {
25
25
  currentRoom;
26
26
  userName;
27
27
  coordinatorPort;
28
- /** Overrides the hub this controller's own coordinator role dials on takeover (createBridgeMesh's own hubUrl, defaulting to DEFAULT_HUB_URL) -- every real bridge entry point wants the real public hub, but a test constructing a controller of its own wants a hermetic, deterministically-unreachable one instead of silently depending on live production infrastructure whenever its own fresh coordinator port makes it the mesh's coordinator (see hub-helpers.ts's own unreachableHubUrl). */
28
+ /** Overrides the hub this controller's own store dials (createBridgeMesh's own hubUrl, defaulting to DEFAULT_HUB_URL) -- every real bridge entry point wants the real public hub, but a test constructing a controller of its own wants a hermetic, deterministically-unreachable one instead of silently depending on live production infrastructure (see hub-helpers.ts's own unreachableHubUrl). */
29
29
  hubUrl;
30
30
  constructor(userName, options) {
31
31
  super();
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/bridges/user/controller.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,GAEpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AASrE,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,MAAM,OAAO,cAAe,SAAQ,YAAY;IAC9C,+PAA+P;IACvP,KAAK,CAAa;IAC1B,mFAAmF;IAC3E,iBAAiB,CAA2B;IAEpD,0DAA0D;IAC1D,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACO,IAAI,CAAa;IACjB,GAAG,CAAgB;IACnB,WAAW,CAAqB;IACvB,QAAQ,CAAS;IACjB,eAAe,CAAqB;IACrD,seAAse;IACrd,MAAM,CAAqB;IAE5C,YACE,QAAgB,EAChB,OAGC;QAED,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,eAAe,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAgB,EAChB,GAA2B;QAE3B,M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CAAC,KAAoB;QAC9B,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,0EAA0E;IAC1E,YAAY;IACZ,0EAA0E;IAE1E,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACzC,mBAAmB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF"}
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * createBridgeMeshSync/createBridgeMesh own loadOrCreateIdentity's slot lock on the caller's behalf; createBridgeMeshSyncFromIdentity/createBridgeMeshFromIdentity take an already-loaded identity instead and never touch the lock at all -- the cc-peer front (agent-comms#157) uses these directly, via loadIdentityForFront's lock-free load, to build a mesh identity for a not-yet-live session's slot while leaving that slot's own lock free for its real bridge to acquire normally later.
11
11
  *
12
- * Passes slot through to MeshStore's own constructor (agent-comms#186) so the gatewayTrust allowlist it builds loads whatever remote device-ids were trusted before the last restart, and persists every subsequent addTrustedGateway/removeTrustedGateway back to that same slot's storage. The same slot also backs MeshStore's connectionCodes ledger (agent-comms#188), for the same reason.
12
+ * Passes slot through to MeshStore's own constructor (agent-comms#186) so the gatewayTrust allowlist it builds loads whatever remote device-ids were trusted before the last restart, and persists every subsequent addTrustedGateway/removeTrustedGateway back to the identity directory's one shared trust file, which every other store on the machine reads as well (agent-comms#293). The same slot backs MeshStore's connectionCodes ledger (agent-comms#188), which stays per slot.
13
13
  *
14
14
  * The returned store's own getCcPeerVersion field starts undefined and is read live (never snapshotted) by both WireMeshTransport's gossip tick and CommsTool's whoami/update/list_agents -- front-runtime.ts and bridges/cc-peer/run.ts set it once, right after this factory returns, rather than this factory taking it as a parameter: only those two call sites ever have a value for it, so threading it through every createBridgeMesh* signature here would be dead weight on every other caller (agent-comms#198).
15
15
  */
@@ -25,7 +25,7 @@ export interface BridgeMeshSync extends BridgeMesh {
25
25
  /** Derives and wires this store's IdentityPort (the collaborator createRoom and every other identity-using method require). Must be awaited before any such method runs; safe to call from the bridge's own first async lifecycle hook rather than its (necessarily synchronous) entry point. */
26
26
  attachIdentity: () => Promise<void>;
27
27
  }
28
- /** coordinatorPort/hubUrl thread straight into MeshStore's own constructor; fetchLatestVersion is exposed purely for tests -- every real caller omits it and gets VersionDriftChecker's own default (a real npm registry lookup). */
28
+ /** coordinatorPort/hubUrl thread straight into MeshStore's own constructor, hubUrl defaulting to the production hub here and nowhere below; fetchLatestVersion is exposed purely for tests -- every real caller omits it and gets VersionDriftChecker's own default (a real npm registry lookup). */
29
29
  export interface BridgeMeshOptions {
30
30
  coordinatorPort?: number | undefined;
31
31
  hubUrl?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-mesh.d.ts","sourceRoot":"","sources":["../../src/core/bridge-mesh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAKlD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,iSAAiS;IACjS,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,qOAAqO;AACrO,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG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AI,CAAC,CAAC;CACrC;AAED,qSAAqS;AACrS,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC;CACtE;AAED,sSAAsS;AACtS,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CAMhB;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CAkDhB;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED,6JAA6J;AAC7J,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAQrB"}
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * createBridgeMeshSync/createBridgeMesh own loadOrCreateIdentity's slot lock on the caller's behalf; createBridgeMeshSyncFromIdentity/createBridgeMeshFromIdentity take an already-loaded identity instead and never touch the lock at all -- the cc-peer front (agent-comms#157) uses these directly, via loadIdentityForFront's lock-free load, to build a mesh identity for a not-yet-live session's slot while leaving that slot's own lock free for its real bridge to acquire normally later.
11
11
  *
12
- * Passes slot through to MeshStore's own constructor (agent-comms#186) so the gatewayTrust allowlist it builds loads whatever remote device-ids were trusted before the last restart, and persists every subsequent addTrustedGateway/removeTrustedGateway back to that same slot's storage. The same slot also backs MeshStore's connectionCodes ledger (agent-comms#188), for the same reason.
12
+ * Passes slot through to MeshStore's own constructor (agent-comms#186) so the gatewayTrust allowlist it builds loads whatever remote device-ids were trusted before the last restart, and persists every subsequent addTrustedGateway/removeTrustedGateway back to the identity directory's one shared trust file, which every other store on the machine reads as well (agent-comms#293). The same slot backs MeshStore's connectionCodes ledger (agent-comms#188), which stays per slot.
13
13
  *
14
14
  * The returned store's own getCcPeerVersion field starts undefined and is read live (never snapshotted) by both WireMeshTransport's gossip tick and CommsTool's whoami/update/list_agents -- front-runtime.ts and bridges/cc-peer/run.ts set it once, right after this factory returns, rather than this factory taking it as a parameter: only those two call sites ever have a value for it, so threading it through every createBridgeMesh* signature here would be dead weight on every other caller (agent-comms#198).
15
15
  */
@@ -18,6 +18,7 @@ import { createSystemClock } from "wire-mesh-core/adapters/system-clock";
18
18
  import { createRevocationView } from "wire-mesh-core/domain/revocation-view";
19
19
  import { createNodeFsStorage } from "wire-mesh-core/adapters/node-fs-storage";
20
20
  import { MeshStore } from "./mesh-store.js";
21
+ import { DEFAULT_HUB_URL } from "./mesh-store-shared.js";
21
22
  import { CommsTool } from "./tool.js";
22
23
  import { WireMeshTransport } from "./wire-mesh-transport.js";
23
24
  import { loadOrCreateIdentity, oplogDirFor } from "./identity-store.js";
@@ -33,7 +34,7 @@ export function createBridgeMeshSync(slot, options) {
33
34
  * The same synchronous construction as createBridgeMeshSync, but taking an already-loaded identity rather than calling loadOrCreateIdentity itself -- see this file's own header comment for who this is for. Every other caller should go through createBridgeMeshSync/createBridgeMesh above, which own the lock on the caller's behalf.
34
35
  */
35
36
  export function createBridgeMeshSyncFromIdentity(identity, slot, options) {
36
- const { coordinatorPort, hubUrl, fetchLatestVersion } = options ?? {};
37
+ const { coordinatorPort, hubUrl = DEFAULT_HUB_URL, fetchLatestVersion, } = options ?? {};
37
38
  // The user-principal identity (agent-comms#160) is shared by every bridge on this machine account -- deliberately not scoped to slot, unlike identity above. userIdentityOptions is empty (the default ~/.agent-comms location); every real bridge shares it, and only tests need an override.
38
39
  const userIdentityOptions = {};
39
40
  const userIdentity = loadOrCreateUserIdentity(userIdentityOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-mesh.js","sourceRoot":"","sources":["../../src/core/bridge-mesh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAmB9D,sSAAsS;AACtS,MAAM,UAAU,oBAAoB,CAClC,IAA4B,EAC5B,OAA2B;IAE3B,OAAO,gCAAgC,CACrC,oBAAoB,CAAC,IAAI,CAAC,EAC1B,IAAI,EACJ,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,QAAsB,EACtB,IAA4B,EAC5B,OAA2B;IAE3B,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,IAAI,EAAE,CAA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I,SAAS,CAAC,KAAK,EAAE;QAChC,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,oBAAoB,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,oBAAoB,EAAE;KAClE,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAC1C,OAAO;QACL,KAAK;QACL,IAAI;QACJ,cAAc,EAAE,KAAK,IAAI,EAAE;YACzB,KAAK,CAAC,WAAW,CAAC;gBAChB,QAAQ,EAAE,MAAM,cAAc,CAAC,QAAQ,CAAC;gBACxC,KAAK,EAAE,iBAAiB,EAAE;gBAC1B,IAAI;gBACJ,UAAU;gBACV,WAAW;gBACX,YAAY,EAAE,MAAM,cAAc,CAAC,YAAY,CAAC;gBAChD,mBAAmB;aACpB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAA4B,EAC5B,OAA2B;IAE3B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5E,MAAM,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,6JAA6J;AAC7J,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,QAAsB,EACtB,IAA4B,EAC5B,OAA2B;IAE3B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,gCAAgC,CACtE,QAAQ,EACR,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * GatewayTrust -- the cross-machine trust boundary (agent-comms#156, agent-comms#153's third leg): an allowlist of remote device-ids this machine's gateway will advertise its local agents to, accept forwarded hub traffic from, and route outbound hub requests to. Deny-all by default: empty until an operator explicitly trusts at least one remote device, the same no-CA pin-the-key model ordinary peer connections already use.
3
3
  *
4
- * Persisted per bridge slot when constructed with one (agent-comms#186), mirroring identity-store.ts's own per-slot room-token/issued-grant persistence: the trusted set is loaded from that slot's own sibling JSON file (identity-store.ts's loadGatewayTrust) on construction, and written back in full (saveGatewayTrust) after every add/remove, so trust survives a gateway restart instead of needing to be re-established every run. The in-memory Set below remains the live source of truth for isTrusted/hasAny at all times; persistence is purely load-on-construct and save-on-mutate. Constructed with no slot, this class keeps the original v1 FederationManager.trustedFingerprints precedent (retired with federation.ts, commit 4232b08): in-memory only, never touching disk. Every pre-#186 construction site (most tests, and any caller with no bridge identity slot to hand) falls into this no-slot case unchanged.
4
+ * Shared by every store on the machine when constructed with an identity location (agent-comms#186, made machine-wide by agent-comms#293): the trusted set lives in one JSON file per identity directory (identity-store.ts's loadGatewayTrust), because who may see and reach this user's agents from another machine is an operator decision about the machine, and every store on it advertises itself under that decision, including each Claude Code session the default cc-peer front handles, which has no operator of its own to run gateway_trust. Every process on the machine reads and writes that one file, so each read below first checks whether another process has replaced it (gatewayTrustStamp) and reloads if so, and each change reloads, applies itself, and writes back in full, so an add made in one bridge is seen by the others on their next check. Two processes changing the file within the same instant can still lose one of the two changes, since there is no cross-process lock; changes are rare operator actions, so that window is accepted. Constructed with no location, this class keeps the original v1 FederationManager.trustedFingerprints precedent (retired with federation.ts, commit 4232b08): in-memory only, never touching disk, which is what most tests use.
5
5
  *
6
6
  * Keyed by individual device-id, not by "one entry per remote machine": wire-mesh-core's relay-hub protocol (relay-hub.ts, gossip-frame, relay-data-frame) carries no field identifying which remote gateway connection a given directory entry or relayed request actually originated from -- only the entry/request's own device-id, which may be an ordinary local peer forwarded on a remote machine's behalf rather than that machine's own coordinator. Gating per individual device-id is therefore the finest-grained, and only wire-protocol-honest, trust boundary actually implementable without a wire-mesh-core protocol change (deliberately out of scope here, matching agent-comms#156's own "gating the hub itself is out of scope" framing) -- confirmed as the intended granularity by hub-session.ts's own pre-existing isStateMutatingMessage doc comment, which already named this exact gap as "agent-comms#156's own future deliverable" of "per-peer" admission control. An operator who wants every local peer on a remote machine reachable trusts each of that machine's device-ids individually, not just its coordinator's.
7
7
  *
@@ -15,14 +15,20 @@ export declare class GatewayTrust {
15
15
  private readonly trustedPrincipals;
16
16
  /** Devices whose gossiped membership proof was verified against a trusted principal, with that principal and when the proof lapses. In memory only: a proof is short-lived and re-verified from the next advert, so nothing here is worth persisting. */
17
17
  private readonly verifiedMembers;
18
- private readonly slot;
19
- /** Constructs the trust boundary, optionally bound to a bridge identity slot for persistence (agent-comms#186); see this class's own doc comment for what a slot does and doesn't change. Given a slot, immediately loads whatever devices and principals were trusted before the last restart into the initial in-memory sets. */
20
- constructor(slot?: Readonly<IdentitySlot>);
21
- /** Marks a remote device-id (hex, case-insensitive) as trusted: this side will merge its gossiped directory entries, dispatch its relayed requests, and route outbound hub requests to it. Idempotent. Persists the updated set when this instance was constructed with a slot. */
18
+ private readonly location;
19
+ /** gatewayTrustStamp as of the last load or write this instance made, so refresh() can tell when another process has replaced the file since. */
20
+ private stamp;
21
+ /** Constructs the trust boundary, optionally bound to an identity location for persistence (agent-comms#186); any IdentitySlot serves as one, since only its directory matters. See this class's own doc comment for what a location does and doesn't change. Given a location, immediately loads whatever devices and principals are already trusted into the in-memory sets. */
22
+ constructor(location?: Readonly<Pick<IdentitySlot, "dir">>);
23
+ /** Replaces the in-memory sets with whatever the file currently holds, recording the file's stamp. A no-op without a location. Verified members are left alone: they are in memory only and are dropped on their own when their principal stops being trusted. */
24
+ private load;
25
+ /** Reloads from disk when another process has replaced the file since this instance last looked. Called first by every method that reads the sets, so a trust decision is never older than the file. */
26
+ private refresh;
27
+ /** Marks a remote device-id (hex, case-insensitive) as trusted: this side will merge its gossiped directory entries, dispatch its relayed requests, and route outbound hub requests to it. Idempotent. Persists the updated set when this instance was constructed with a location. */
22
28
  add(deviceHex: string): void;
23
- /** Withdraws a previously trusted device-id (hex, case-insensitive). A no-op if it was never trusted. Mirrors FederationManager.removeTrustedFingerprint's own precedent: already-merged directory entries and in-flight requests are unaffected -- this governs future traffic only. Persists the updated set when this instance was constructed with a slot. */
29
+ /** Withdraws a previously trusted device-id (hex, case-insensitive). A no-op if it was never trusted. Mirrors FederationManager.removeTrustedFingerprint's own precedent: already-merged directory entries and in-flight requests are unaffected -- this governs future traffic only. Persists the updated set when this instance was constructed with a location. */
24
30
  remove(deviceHex: string): void;
25
- /** Writes the complete current trusted device and principal sets back to this instance's own slot, if it was constructed with one. A no-op for the in-memory-only (no slot) case. */
31
+ /** Writes the complete current trusted device and principal sets back to the shared trust file, if this instance was constructed with a location. A no-op for the in-memory-only case. */
26
32
  private persist;
27
33
  /** Every currently trusted device-id, lowercase hex, in insertion order. */
28
34
  list(): string[];
@@ -38,9 +44,9 @@ export declare class GatewayTrust {
38
44
  principal: string;
39
45
  }[];
40
46
  private isVerifiedMember;
41
- /** Marks a remote user-principal device-id (hex, case-insensitive; user-identity.ts) as trusted (agent-comms#187): a peer presenting a token whose delegation chain roots at this principal is trusted via `isTrustedFor` below, without that peer's own bare device-id ever needing individual trust. Idempotent, and entirely independent of the bare-device allowlist `add` manages. Persists the updated set when this instance was constructed with a slot. */
47
+ /** Marks a remote user-principal device-id (hex, case-insensitive; user-identity.ts) as trusted (agent-comms#187): a peer presenting a token whose delegation chain roots at this principal is trusted via `isTrustedFor` below, without that peer's own bare device-id ever needing individual trust. Idempotent, and entirely independent of the bare-device allowlist `add` manages. Persists the updated set when this instance was constructed with a location. */
42
48
  addPrincipal(deviceHex: string): void;
43
- /** Withdraws a previously trusted principal (hex, case-insensitive). A no-op if it was never trusted. Governs future chain checks only, mirroring `remove`'s own already-merged-traffic-is-unaffected posture. Persists the updated set when this instance was constructed with a slot. */
49
+ /** Withdraws a previously trusted principal (hex, case-insensitive). A no-op if it was never trusted. Governs future chain checks only, mirroring `remove`'s own already-merged-traffic-is-unaffected posture. Persists the updated set when this instance was constructed with a location. */
44
50
  removePrincipal(deviceHex: string): void;
45
51
  /** Every currently trusted principal device-id, lowercase hex, in insertion order. */
46
52
  listPrincipals(): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-trust.d.ts","sourceRoot":"","sources":["../../src/core/gateway-trust.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,2XAA2X;AAC3X,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,YAAY,EACV,WAAW,GACX,aAAa,GACb,QAAQ,GACR,oBAAoB,GACpB,cAAc,GACd,gBAAgB,GAChB,oBAAoB,CACvB,CAAC;AAEF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAqB;IACvD,yPAAyP;IACzP,OAAO,CAAC,QAAQ,CAAC,eAAe,CAG5B;IACJ,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqC;IAE1D,mUAAmU;gBACvT,IAAI,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IAazC,mRAAmR;IACnR,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAK5B,kWAAkW;IAClW,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAK/B,qLAAqL;IACrL,OAAO,CAAC,OAAO;IAMf,4EAA4E;IAC5E,IAAI,IAAI,MAAM,EAAE;IAIhB,6UAA6U;IAC7U,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIrC,4VAA4V;IAC5V,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKvC,mYAAmY;IACnY,kBAAkB,CAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,IAAI;IAaP,gMAAgM;IAChM,mBAAmB,IAAI;QAAE,MAAM,EAAE,MAAM,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,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAM5B,sWAAsW;IACtW,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAM/B,0LAA0L;IAC1L,OAAO,CAAC,OAAO;IAUf,4EAA4E;IAC5E,IAAI,IAAI,MAAM,EAAE;IAKhB,6UAA6U;IAC7U,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKrC,4VAA4V;IAC5V,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAMvC,mYAAmY;IACnY,kBAAkB,CAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,IAAI;IAaP,gMAAgM;IAChM,mBAAmB,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE;IAO9D,OAAO,CAAC,gBAAgB;IASxB,wcAAwc;IACxc,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAMrC,+RAA+R;IAC/R,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAUxC,sFAAsF;IACtF,cAAc,IAAI,MAAM,EAAE;IAK1B,oGAAoG;IACpG,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAK9C;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO;IAI/D;;OAEG;IACH,MAAM,IAAI,OAAO;CAIlB"}
@@ -1,49 +1,71 @@
1
- import { loadGatewayTrust, saveGatewayTrust } from "./identity-store.js";
1
+ import { gatewayTrustStamp, loadGatewayTrust, saveGatewayTrust, } from "./identity-store.js";
2
2
  export class GatewayTrust {
3
3
  trusted = new Set();
4
4
  trustedPrincipals = new Set();
5
5
  /** Devices whose gossiped membership proof was verified against a trusted principal, with that principal and when the proof lapses. In memory only: a proof is short-lived and re-verified from the next advert, so nothing here is worth persisting. */
6
6
  verifiedMembers = new Map();
7
- slot;
8
- /** Constructs the trust boundary, optionally bound to a bridge identity slot for persistence (agent-comms#186); see this class's own doc comment for what a slot does and doesn't change. Given a slot, immediately loads whatever devices and principals were trusted before the last restart into the initial in-memory sets. */
9
- constructor(slot) {
10
- this.slot = slot;
11
- if (slot !== undefined) {
12
- const loaded = loadGatewayTrust(slot);
13
- for (const deviceHex of loaded.devices) {
14
- this.trusted.add(deviceHex);
15
- }
16
- for (const principalHex of loaded.principals) {
17
- this.trustedPrincipals.add(principalHex);
18
- }
7
+ location;
8
+ /** gatewayTrustStamp as of the last load or write this instance made, so refresh() can tell when another process has replaced the file since. */
9
+ stamp;
10
+ /** Constructs the trust boundary, optionally bound to an identity location for persistence (agent-comms#186); any IdentitySlot serves as one, since only its directory matters. See this class's own doc comment for what a location does and doesn't change. Given a location, immediately loads whatever devices and principals are already trusted into the in-memory sets. */
11
+ constructor(location) {
12
+ this.location = location;
13
+ this.load();
14
+ }
15
+ /** Replaces the in-memory sets with whatever the file currently holds, recording the file's stamp. A no-op without a location. Verified members are left alone: they are in memory only and are dropped on their own when their principal stops being trusted. */
16
+ load() {
17
+ if (this.location === undefined)
18
+ return;
19
+ this.stamp = gatewayTrustStamp(this.location);
20
+ const loaded = loadGatewayTrust(this.location);
21
+ this.trusted.clear();
22
+ this.trustedPrincipals.clear();
23
+ for (const deviceHex of loaded.devices) {
24
+ this.trusted.add(deviceHex);
19
25
  }
26
+ for (const principalHex of loaded.principals) {
27
+ this.trustedPrincipals.add(principalHex);
28
+ }
29
+ }
30
+ /** Reloads from disk when another process has replaced the file since this instance last looked. Called first by every method that reads the sets, so a trust decision is never older than the file. */
31
+ refresh() {
32
+ if (this.location === undefined)
33
+ return;
34
+ if (gatewayTrustStamp(this.location) !== this.stamp)
35
+ this.load();
20
36
  }
21
- /** Marks a remote device-id (hex, case-insensitive) as trusted: this side will merge its gossiped directory entries, dispatch its relayed requests, and route outbound hub requests to it. Idempotent. Persists the updated set when this instance was constructed with a slot. */
37
+ /** Marks a remote device-id (hex, case-insensitive) as trusted: this side will merge its gossiped directory entries, dispatch its relayed requests, and route outbound hub requests to it. Idempotent. Persists the updated set when this instance was constructed with a location. */
22
38
  add(deviceHex) {
39
+ this.refresh();
23
40
  this.trusted.add(deviceHex.toLowerCase());
24
41
  this.persist();
25
42
  }
26
- /** Withdraws a previously trusted device-id (hex, case-insensitive). A no-op if it was never trusted. Mirrors FederationManager.removeTrustedFingerprint's own precedent: already-merged directory entries and in-flight requests are unaffected -- this governs future traffic only. Persists the updated set when this instance was constructed with a slot. */
43
+ /** Withdraws a previously trusted device-id (hex, case-insensitive). A no-op if it was never trusted. Mirrors FederationManager.removeTrustedFingerprint's own precedent: already-merged directory entries and in-flight requests are unaffected -- this governs future traffic only. Persists the updated set when this instance was constructed with a location. */
27
44
  remove(deviceHex) {
45
+ this.refresh();
28
46
  this.trusted.delete(deviceHex.toLowerCase());
29
47
  this.persist();
30
48
  }
31
- /** Writes the complete current trusted device and principal sets back to this instance's own slot, if it was constructed with one. A no-op for the in-memory-only (no slot) case. */
49
+ /** Writes the complete current trusted device and principal sets back to the shared trust file, if this instance was constructed with a location. A no-op for the in-memory-only case. */
32
50
  persist() {
33
- if (this.slot !== undefined) {
34
- saveGatewayTrust(this.slot, this.list(), this.listPrincipals());
35
- }
51
+ if (this.location === undefined)
52
+ return;
53
+ saveGatewayTrust(this.location, [...this.trusted], [...this.trustedPrincipals]);
54
+ this.stamp = gatewayTrustStamp(this.location);
36
55
  }
37
56
  /** Every currently trusted device-id, lowercase hex, in insertion order. */
38
57
  list() {
58
+ this.refresh();
39
59
  return [...this.trusted];
40
60
  }
41
61
  /** Whether the given device-id (hex, case-insensitive) is trusted by id: on the bare-device allowlist. A device trusted only because a principal vouches for it (noteVerifiedMember) is not, on purpose: its proof is a claim that anyone who has read the device's gossiped advert can repeat, so it earns only what isReachable grants. */
42
62
  isTrusted(deviceHex) {
63
+ this.refresh();
43
64
  return this.trusted.has(deviceHex.toLowerCase());
44
65
  }
45
66
  /** Whether this side may merge the device's gossiped directory entry and route requests to it: trusted by id, or a verified member of a trusted principal. Requests routed to a device are still authenticated end to end by the session inside the relay, so a false claim can misroute one (which then fails its handshake) but not read or forge one. */
46
67
  isReachable(deviceHex) {
68
+ this.refresh();
47
69
  const key = deviceHex.toLowerCase();
48
70
  return this.trusted.has(key) || this.isVerifiedMember(key);
49
71
  }
@@ -63,6 +85,7 @@ export class GatewayTrust {
63
85
  }
64
86
  /** Every device currently reachable only because a trusted principal vouches for it, with that principal. Excludes proofs that have lapsed and members whose principal is no longer trusted. */
65
87
  listVerifiedMembers() {
88
+ this.refresh();
66
89
  return [...this.verifiedMembers]
67
90
  .filter(([device]) => this.isVerifiedMember(device))
68
91
  .map(([device, member]) => ({ device, principal: member.principal }));
@@ -73,13 +96,15 @@ export class GatewayTrust {
73
96
  member.expiresAt > Date.now() &&
74
97
  this.trustedPrincipals.has(member.principal));
75
98
  }
76
- /** Marks a remote user-principal device-id (hex, case-insensitive; user-identity.ts) as trusted (agent-comms#187): a peer presenting a token whose delegation chain roots at this principal is trusted via `isTrustedFor` below, without that peer's own bare device-id ever needing individual trust. Idempotent, and entirely independent of the bare-device allowlist `add` manages. Persists the updated set when this instance was constructed with a slot. */
99
+ /** Marks a remote user-principal device-id (hex, case-insensitive; user-identity.ts) as trusted (agent-comms#187): a peer presenting a token whose delegation chain roots at this principal is trusted via `isTrustedFor` below, without that peer's own bare device-id ever needing individual trust. Idempotent, and entirely independent of the bare-device allowlist `add` manages. Persists the updated set when this instance was constructed with a location. */
77
100
  addPrincipal(deviceHex) {
101
+ this.refresh();
78
102
  this.trustedPrincipals.add(deviceHex.toLowerCase());
79
103
  this.persist();
80
104
  }
81
- /** Withdraws a previously trusted principal (hex, case-insensitive). A no-op if it was never trusted. Governs future chain checks only, mirroring `remove`'s own already-merged-traffic-is-unaffected posture. Persists the updated set when this instance was constructed with a slot. */
105
+ /** Withdraws a previously trusted principal (hex, case-insensitive). A no-op if it was never trusted. Governs future chain checks only, mirroring `remove`'s own already-merged-traffic-is-unaffected posture. Persists the updated set when this instance was constructed with a location. */
82
106
  removePrincipal(deviceHex) {
107
+ this.refresh();
83
108
  const key = deviceHex.toLowerCase();
84
109
  this.trustedPrincipals.delete(key);
85
110
  for (const [device, member] of this.verifiedMembers) {
@@ -90,10 +115,12 @@ export class GatewayTrust {
90
115
  }
91
116
  /** Every currently trusted principal device-id, lowercase hex, in insertion order. */
92
117
  listPrincipals() {
118
+ this.refresh();
93
119
  return [...this.trustedPrincipals];
94
120
  }
95
121
  /** Whether the given device-id (hex, case-insensitive) is currently trusted as a user principal. */
96
122
  isTrustedPrincipal(deviceHex) {
123
+ this.refresh();
97
124
  return this.trustedPrincipals.has(deviceHex.toLowerCase());
98
125
  }
99
126
  /**
@@ -106,6 +133,7 @@ export class GatewayTrust {
106
133
  * Whether at least one remote device or principal is currently trusted -- the outbound gossip gate. wire-mesh-core's relay-hub broadcasts a gossiped advert to every connected hub peer with no per-recipient targeting (RelayHub.handleConnection's own "re-broadcasts each gossip frame to every other connected client"), so "advertise local agents only to allowlisted remote gateways" can only be approximated at the coarse granularity this side actually controls: don't advertise anything at all until the operator has opted in by trusting at least one remote device or principal. Once true, an advertisement still reaches every hub-connected peer, trusted or not -- the per-device isTrusted()/isTrustedFor() checks above are what keep this side from ACTING on anything an untrusted peer sends back, which is the boundary that actually matters.
107
134
  */
108
135
  hasAny() {
136
+ this.refresh();
109
137
  return this.trusted.size > 0 || this.trustedPrincipals.size > 0;
110
138
  }
111
139
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-trust.js","sourceRoot":"","sources":["../../src/core/gateway-trust.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAczE,MAAM,OAAO,YAAY;IACN,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5B,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IACvD,yPAAyP;IAC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AC,CAAC;IACrC,CAAC;IAED,oGAAoG;IACpG,kBAAkB,CAAC,SAAiB;QAClC,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,SAAiB,EAAE,aAAqB;QACnD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,GAAG,CAAC,CAAC;IAClE,CAAC;CACF"}
@@ -20,7 +20,7 @@ export declare function listKnownDevicesEntries(knownDevices: ReadonlyMap<string
20
20
  export declare function findPresenceAdvert(deviceIdHex: string, directory: readonly DirectoryEntry[]): AgentStatus | undefined;
21
21
  /** The membership proof a peer gossiped in its agent/self advert, or undefined when it carries none. The advert is self-asserted by whichever peer sent it, so this only reads it; nothing about the proof is believed until it is verified. */
22
22
  export declare function readMembershipProof(advert: Readonly<PeerAdvert>): string | undefined;
23
- /** Re-sends this side's own current presence status, currently-hosted rooms, self-agent identity, and package versions, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever facts are actually known, rather than a separate frame per fact. Split out of wire-mesh-transport.ts's own WireMeshTransport class purely to keep that file under the repo's max-lines cap, the same reason mergeKnownDevices/findPresenceAdvert above already live here rather than there. A session that fails to send (mid-disconnect, most likely -- watchForDisconnect will independently notice and clean it up) is reported via onError and skipped, not allowed to stop the tick from reaching the rest of allSessions: a periodic broadcast to N peers is N independent operations, not one atomic unit. Unlike presence/hostedRooms/selfAgentAdvert, the versions extension is never actually absent (this side's own agent-comms package version is always known), so every tick this function is called for sends at least that one fact -- there is no "nothing to report" case left to short-circuit on. The hub's own session (agent-comms#156) is gated separately from every ordinary local-peer session in allSessions: local mesh trust is a different layer (connect_request/introduce approval already gated it before it ever joined allSessions), but the hub session is a broadcast to every connected hub peer, trusted or not, and would otherwise leak this side's own presence/hosted-rooms/self-agent/versions advert onto the hub regardless of GatewayTrust -- forwardAdvertsToHub/pushHubCatchUp's own hasAny gate exists to prevent exactly this for OTHER local peers' adverts, and this side's own self-advert deserves the identical gate, not a bypass. */
23
+ /** Re-sends this side's own current presence status, currently-hosted rooms, self-agent identity, and package versions, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever facts are actually known, rather than a separate frame per fact. Split out of wire-mesh-transport.ts's own WireMeshTransport class purely to keep that file under the repo's max-lines cap, the same reason mergeKnownDevices/findPresenceAdvert above already live here rather than there. A session that fails to send (mid-disconnect, most likely -- watchForDisconnect will independently notice and clean it up) is reported via onError and skipped, not allowed to stop the tick from reaching the rest of allSessions: a periodic broadcast to N peers is N independent operations, not one atomic unit. Unlike presence/hostedRooms/selfAgentAdvert, the versions extension is never actually absent (this side's own agent-comms package version is always known), so every tick this function is called for sends at least that one fact -- there is no "nothing to report" case left to short-circuit on. The hub's own session (agent-comms#156) is gated separately from every ordinary local-peer session in allSessions: local mesh trust is a different layer (connect_request/introduce approval already gated it before it ever joined allSessions), but the hub session is a broadcast to every connected hub peer, trusted or not, and would otherwise leak this side's own presence/hosted-rooms/self-agent/versions advert onto the hub regardless of GatewayTrust -- so this side's own advert waits on the same hasAny gate. It also waits for a visible agent (selfAgentAdvert is only ever defined for one): presence, hosted rooms and versions describe the agent and its process, so a hidden or unregistered store puts none of them on the hub, and a hidden agent is left with only the device advert every session opens with, which is what lets it be reached by device id. */
24
24
  export declare function readvertiseGossip(options: {
25
25
  allSessions: ReadonlySet<AcceptedMeshSession>;
26
26
  hub: Readonly<Pick<HubSession, "ownsSession">>;
@@ -1 +1 @@
1
- {"version":3,"file":"gossip-directory.d.ts","sourceRoot":"","sources":["../../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G,SAAS,CAAC,GAAG,SAAS,CAAC;IAChE,cAAc,EAAE,CAAC,MAAM,SAAS,gBAAgB,EAAE,CAAC,GAAG,SAAS,CAAC;IAChE,kBAAkB,EAAE,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IACpE,gBAAgB,EAAE,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,SAAS,CAiC7C"}
@@ -48,7 +48,7 @@ export function readMembershipProof(advert) {
48
48
  return undefined;
49
49
  return typeof self.membership === "string" ? self.membership : undefined;
50
50
  }
51
- /** Re-sends this side's own current presence status, currently-hosted rooms, self-agent identity, and package versions, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever facts are actually known, rather than a separate frame per fact. Split out of wire-mesh-transport.ts's own WireMeshTransport class purely to keep that file under the repo's max-lines cap, the same reason mergeKnownDevices/findPresenceAdvert above already live here rather than there. A session that fails to send (mid-disconnect, most likely -- watchForDisconnect will independently notice and clean it up) is reported via onError and skipped, not allowed to stop the tick from reaching the rest of allSessions: a periodic broadcast to N peers is N independent operations, not one atomic unit. Unlike presence/hostedRooms/selfAgentAdvert, the versions extension is never actually absent (this side's own agent-comms package version is always known), so every tick this function is called for sends at least that one fact -- there is no "nothing to report" case left to short-circuit on. The hub's own session (agent-comms#156) is gated separately from every ordinary local-peer session in allSessions: local mesh trust is a different layer (connect_request/introduce approval already gated it before it ever joined allSessions), but the hub session is a broadcast to every connected hub peer, trusted or not, and would otherwise leak this side's own presence/hosted-rooms/self-agent/versions advert onto the hub regardless of GatewayTrust -- forwardAdvertsToHub/pushHubCatchUp's own hasAny gate exists to prevent exactly this for OTHER local peers' adverts, and this side's own self-advert deserves the identical gate, not a bypass. */
51
+ /** Re-sends this side's own current presence status, currently-hosted rooms, self-agent identity, and package versions, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever facts are actually known, rather than a separate frame per fact. Split out of wire-mesh-transport.ts's own WireMeshTransport class purely to keep that file under the repo's max-lines cap, the same reason mergeKnownDevices/findPresenceAdvert above already live here rather than there. A session that fails to send (mid-disconnect, most likely -- watchForDisconnect will independently notice and clean it up) is reported via onError and skipped, not allowed to stop the tick from reaching the rest of allSessions: a periodic broadcast to N peers is N independent operations, not one atomic unit. Unlike presence/hostedRooms/selfAgentAdvert, the versions extension is never actually absent (this side's own agent-comms package version is always known), so every tick this function is called for sends at least that one fact -- there is no "nothing to report" case left to short-circuit on. The hub's own session (agent-comms#156) is gated separately from every ordinary local-peer session in allSessions: local mesh trust is a different layer (connect_request/introduce approval already gated it before it ever joined allSessions), but the hub session is a broadcast to every connected hub peer, trusted or not, and would otherwise leak this side's own presence/hosted-rooms/self-agent/versions advert onto the hub regardless of GatewayTrust -- so this side's own advert waits on the same hasAny gate. It also waits for a visible agent (selfAgentAdvert is only ever defined for one): presence, hosted rooms and versions describe the agent and its process, so a hidden or unregistered store puts none of them on the hub, and a hidden agent is left with only the device advert every session opens with, which is what lets it be reached by device id. */
52
52
  export function readvertiseGossip(options) {
53
53
  const { allSessions, hub, hasAnyTrustedGateway, onError, getCurrentPresence, getHostedRooms, getSelfAgentAdvert, getCcPeerVersion, } = options;
54
54
  const extensions = {};
@@ -68,8 +68,10 @@ export function readvertiseGossip(options) {
68
68
  };
69
69
  extensions[AGENT_COMMS_VERSION_GOSSIP_KEY] = versionsAdvert;
70
70
  for (const session of allSessions) {
71
- if (hub.ownsSession(session) && !hasAnyTrustedGateway())
71
+ if (hub.ownsSession(session) &&
72
+ (!hasAnyTrustedGateway() || selfAgentAdvert === undefined)) {
72
73
  continue;
74
+ }
73
75
  session.sendGossipUpdate(extensions).catch((error) => {
74
76
  onError?.(error instanceof Error ? error : new Error(String(error)));
75
77
  });
@@ -1 +1 @@
1
- {"version":3,"file":"gossip-directory.js","sourceRoot":"","sources":["../../src/core/gossip-directory.ts"],"names":[],"mapp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