agent-comms 6.0.0 → 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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +4 -2
- package/dist/bridges/user/controller.d.ts +1 -1
- package/dist/bridges/user/controller.d.ts.map +1 -1
- package/dist/bridges/user/controller.js +1 -1
- package/dist/bridges/user/controller.js.map +1 -1
- package/dist/core/bridge-mesh.d.ts +1 -1
- package/dist/core/bridge-mesh.d.ts.map +1 -1
- package/dist/core/bridge-mesh.js +2 -1
- package/dist/core/bridge-mesh.js.map +1 -1
- package/dist/core/gateway-trust.d.ts +5 -5
- package/dist/core/gateway-trust.d.ts.map +1 -1
- package/dist/core/gateway-trust.js +5 -5
- package/dist/core/gateway-trust.js.map +1 -1
- package/dist/core/gossip-directory.d.ts +1 -1
- package/dist/core/gossip-directory.d.ts.map +1 -1
- package/dist/core/gossip-directory.js +4 -2
- package/dist/core/gossip-directory.js.map +1 -1
- package/dist/core/hub-forwarding.d.ts +4 -18
- package/dist/core/hub-forwarding.d.ts.map +1 -1
- package/dist/core/hub-forwarding.js +2 -41
- package/dist/core/hub-forwarding.js.map +1 -1
- package/dist/core/hub-link.d.ts +58 -0
- package/dist/core/hub-link.d.ts.map +1 -0
- package/dist/core/hub-link.js +118 -0
- package/dist/core/hub-link.js.map +1 -0
- package/dist/core/hub-session.d.ts +14 -15
- package/dist/core/hub-session.d.ts.map +1 -1
- package/dist/core/hub-session.js +30 -51
- package/dist/core/hub-session.js.map +1 -1
- package/dist/core/mesh-graph.d.ts +1 -1
- package/dist/core/mesh-graph.js +1 -1
- package/dist/core/mesh-store.d.ts +10 -5
- package/dist/core/mesh-store.d.ts.map +1 -1
- package/dist/core/mesh-store.js +33 -22
- package/dist/core/mesh-store.js.map +1 -1
- package/dist/core/peer-lifecycle.d.ts +2 -5
- package/dist/core/peer-lifecycle.d.ts.map +1 -1
- package/dist/core/peer-lifecycle.js +0 -1
- package/dist/core/peer-lifecycle.js.map +1 -1
- package/dist/core/room-router.d.ts +2 -2
- package/dist/core/room-router.d.ts.map +1 -1
- package/dist/core/room-router.js +2 -32
- package/dist/core/room-router.js.map +1 -1
- package/dist/core/shutdown-signals.d.ts +1 -1
- package/dist/core/shutdown-signals.js +1 -1
- package/dist/core/transport.d.ts +7 -7
- package/dist/core/transport.d.ts.map +1 -1
- package/dist/core/wire-mesh-transport.d.ts +7 -3
- package/dist/core/wire-mesh-transport.d.ts.map +1 -1
- package/dist/core/wire-mesh-transport.js +39 -22
- package/dist/core/wire-mesh-transport.js.map +1 -1
- package/dist/test/bridge-mesh.integration.test.js +15 -1
- package/dist/test/bridge-mesh.integration.test.js.map +1 -1
- package/dist/test/chat-controller-mesh-errors.integration.test.js +7 -1
- package/dist/test/chat-controller-mesh-errors.integration.test.js.map +1 -1
- package/dist/test/coordinator-failover-hub.integration.test.d.ts +5 -0
- package/dist/test/coordinator-failover-hub.integration.test.d.ts.map +1 -0
- package/dist/test/coordinator-failover-hub.integration.test.js +78 -0
- package/dist/test/coordinator-failover-hub.integration.test.js.map +1 -0
- package/dist/test/coordinator-failover.integration.test.js +3 -6
- package/dist/test/coordinator-failover.integration.test.js.map +1 -1
- package/dist/test/coordinator-failover.unit.test.js +0 -7
- package/dist/test/coordinator-failover.unit.test.js.map +1 -1
- package/dist/test/gateway-trust.integration.test.d.ts +1 -1
- package/dist/test/gateway-trust.integration.test.js +26 -2
- package/dist/test/gateway-trust.integration.test.js.map +1 -1
- package/dist/test/gateway-trust.unit.test.js +1 -1
- package/dist/test/hub-exposure.integration.test.d.ts +5 -0
- package/dist/test/hub-exposure.integration.test.d.ts.map +1 -0
- package/dist/test/hub-exposure.integration.test.js +121 -0
- package/dist/test/hub-exposure.integration.test.js.map +1 -0
- package/dist/test/hub-helpers.d.ts +18 -3
- package/dist/test/hub-helpers.d.ts.map +1 -1
- package/dist/test/hub-helpers.js +24 -3
- package/dist/test/hub-helpers.js.map +1 -1
- package/dist/test/hub-link.unit.test.d.ts +2 -0
- package/dist/test/hub-link.unit.test.d.ts.map +1 -0
- package/dist/test/hub-link.unit.test.js +210 -0
- package/dist/test/hub-link.unit.test.js.map +1 -0
- package/dist/test/hub-peer-per-store.integration.test.d.ts +9 -0
- package/dist/test/hub-peer-per-store.integration.test.d.ts.map +1 -0
- package/dist/test/hub-peer-per-store.integration.test.js +211 -0
- package/dist/test/hub-peer-per-store.integration.test.js.map +1 -0
- package/dist/test/hub-room-domain-verb-trust-bypass.integration.test.js +2 -2
- package/dist/test/hub-room-domain-verb-trust-bypass.integration.test.js.map +1 -1
- package/dist/test/hub-session-close.integration.test.js +1 -1
- package/dist/test/hub-session-close.integration.test.js.map +1 -1
- package/dist/test/hub-session-dispatch.unit.test.js +1 -66
- package/dist/test/hub-session-dispatch.unit.test.js.map +1 -1
- package/dist/test/mesh-graph-trace.integration.test.js +2 -2
- package/dist/test/mesh-graph-trace.integration.test.js.map +1 -1
- package/dist/test/mesh-smoke.runner.js +1 -3
- package/dist/test/mesh-smoke.runner.js.map +1 -1
- package/dist/test/mesh-store-orchestration.unit.test.js +11 -41
- package/dist/test/mesh-store-orchestration.unit.test.js.map +1 -1
- package/dist/test/peer-lifecycle.unit.test.js +0 -8
- package/dist/test/peer-lifecycle.unit.test.js.map +1 -1
- package/dist/test/principal-membership-trust.integration.test.js +8 -1
- package/dist/test/principal-membership-trust.integration.test.js.map +1 -1
- package/dist/test/room-join-by-bare-name.integration.test.js +1 -1
- package/dist/test/room-join-by-bare-name.integration.test.js.map +1 -1
- package/dist/test/test-transport.d.ts +1 -1
- package/dist/test/test-transport.d.ts.map +1 -1
- package/dist/test/test-transport.js +1 -1
- package/dist/test/test-transport.js.map +1 -1
- package/dist/test/wire-mesh-transport-hub.integration.test.d.ts +1 -1
- package/dist/test/wire-mesh-transport-hub.integration.test.js +96 -9
- package/dist/test/wire-mesh-transport-hub.integration.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/core/coordinator-gateway.d.ts +0 -25
- package/dist/core/coordinator-gateway.d.ts.map +0 -1
- package/dist/core/coordinator-gateway.js +0 -34
- package/dist/core/coordinator-gateway.js.map +0 -1
- package/dist/test/coordinator-gateway.unit.test.d.ts +0 -2
- package/dist/test/coordinator-gateway.unit.test.d.ts.map +0 -1
- package/dist/test/coordinator-gateway.unit.test.js +0 -88
- package/dist/test/coordinator-gateway.unit.test.js.map +0 -1
- package/dist/test/gateway-forwarding.integration.test.d.ts +0 -9
- package/dist/test/gateway-forwarding.integration.test.d.ts.map +0 -1
- package/dist/test/gateway-forwarding.integration.test.js +0 -226
- package/dist/test/gateway-forwarding.integration.test.js.map +0 -1
- package/dist/test/hub-forwarding.unit.test.d.ts +0 -2
- package/dist/test/hub-forwarding.unit.test.d.ts.map +0 -1
- package/dist/test/hub-forwarding.unit.test.js +0 -102
- package/dist/test/hub-forwarding.unit.test.js.map +0 -1
- package/dist/test/hub-todevice-routing.integration.test.d.ts +0 -7
- package/dist/test/hub-todevice-routing.integration.test.d.ts.map +0 -1
- package/dist/test/hub-todevice-routing.integration.test.js +0 -121
- package/dist/test/hub-todevice-routing.integration.test.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/ExaDev/agent-comms)
|
|
4
4
|
[](https://www.npmjs.com/package/agent-comms)
|
|
5
|
-
[](https://github.com/ExaDev/agent-comms/releases/tag/v7.0.0)
|
|
6
6
|
[](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,
|
|
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,6 +393,8 @@ 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
|
|
|
398
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.
|
|
@@ -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
|
|
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,
|
|
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,OA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K,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
|
|
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,
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/bridges/user/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AI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,MAAc,EACd,KAAc;QAEd,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,WAAW,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"}
|
|
@@ -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;
|
|
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;AAE5C,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,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"}
|
package/dist/core/bridge-mesh.js
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"bridge-mesh.js","sourceRoot":"","sources":["../../src/core/bridge-mesh.ts"],"names":[],"mapp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,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"}
|
|
@@ -24,11 +24,11 @@ export declare class GatewayTrust {
|
|
|
24
24
|
private load;
|
|
25
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
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
|
|
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. */
|
|
28
28
|
add(deviceHex: string): void;
|
|
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
|
|
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. */
|
|
30
30
|
remove(deviceHex: string): void;
|
|
31
|
-
/** Writes the complete current trusted device and principal sets back to
|
|
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. */
|
|
32
32
|
private persist;
|
|
33
33
|
/** Every currently trusted device-id, lowercase hex, in insertion order. */
|
|
34
34
|
list(): string[];
|
|
@@ -44,9 +44,9 @@ export declare class GatewayTrust {
|
|
|
44
44
|
principal: string;
|
|
45
45
|
}[];
|
|
46
46
|
private isVerifiedMember;
|
|
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
|
|
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. */
|
|
48
48
|
addPrincipal(deviceHex: string): void;
|
|
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
|
|
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. */
|
|
50
50
|
removePrincipal(deviceHex: string): void;
|
|
51
51
|
/** Every currently trusted principal device-id, lowercase hex, in insertion order. */
|
|
52
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;AAOxD,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,QAAQ,CAAkD;IAC3E,iJAAiJ;IACjJ,OAAO,CAAC,KAAK,CAAqB;IAElC,kXAAkX;gBACtW,QAAQ,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAK1D,kQAAkQ;IAClQ,OAAO,CAAC,IAAI;IAcZ,wMAAwM;IACxM,OAAO,CAAC,OAAO;IAK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I;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"}
|
|
@@ -34,19 +34,19 @@ export class GatewayTrust {
|
|
|
34
34
|
if (gatewayTrustStamp(this.location) !== this.stamp)
|
|
35
35
|
this.load();
|
|
36
36
|
}
|
|
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
|
|
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. */
|
|
38
38
|
add(deviceHex) {
|
|
39
39
|
this.refresh();
|
|
40
40
|
this.trusted.add(deviceHex.toLowerCase());
|
|
41
41
|
this.persist();
|
|
42
42
|
}
|
|
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
|
|
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. */
|
|
44
44
|
remove(deviceHex) {
|
|
45
45
|
this.refresh();
|
|
46
46
|
this.trusted.delete(deviceHex.toLowerCase());
|
|
47
47
|
this.persist();
|
|
48
48
|
}
|
|
49
|
-
/** Writes the complete current trusted device and principal sets back to
|
|
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. */
|
|
50
50
|
persist() {
|
|
51
51
|
if (this.location === undefined)
|
|
52
52
|
return;
|
|
@@ -96,13 +96,13 @@ export class GatewayTrust {
|
|
|
96
96
|
member.expiresAt > Date.now() &&
|
|
97
97
|
this.trustedPrincipals.has(member.principal));
|
|
98
98
|
}
|
|
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
|
|
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. */
|
|
100
100
|
addPrincipal(deviceHex) {
|
|
101
101
|
this.refresh();
|
|
102
102
|
this.trustedPrincipals.add(deviceHex.toLowerCase());
|
|
103
103
|
this.persist();
|
|
104
104
|
}
|
|
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
|
|
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. */
|
|
106
106
|
removePrincipal(deviceHex) {
|
|
107
107
|
this.refresh();
|
|
108
108
|
const key = deviceHex.toLowerCase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-trust.js","sourceRoot":"","sources":["../../src/core/gateway-trust.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAc7B,MAAM,OAAO,YAAY;IACN,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5B,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IACvD,yPAAyP;IACxO,eAAe,GAAG,IAAI,GAAG,EAGvC,CAAC;IACa,QAAQ,CAAkD;IAC3E,iJAAiJ;IACzI,KAAK,CAAqB;IAElC,kXAAkX;IAClX,YAAY,QAA8C;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,kQAAkQ;IAC1P,IAAI;QACV,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS;YAAE,OAAO;QACxC,IAAI,CAAC,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;QACD,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC;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AAoG;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 --
|
|
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":["../../src/core/gossip-directory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAE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AS,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 --
|
|
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) &&
|
|
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":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAMhE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO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AAE,UAAU,CAAC,CAAC;IACf,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* hub-forwarding --
|
|
2
|
+
* hub-forwarding -- local-to-remote routing, split from wire-mesh-transport.ts under the repo's max-lines cap: falls a room-domain request back through the hub's own relay-connect/relay-data pairing when its target isn't a local peer session.
|
|
3
3
|
*/
|
|
4
|
-
import type { CapabilityScope, CapabilityToken, ManageCommand
|
|
5
|
-
import type {
|
|
4
|
+
import type { CapabilityScope, CapabilityToken, ManageCommand } from "wire-mesh-core/generated/protocol";
|
|
5
|
+
import type { ManageOutcome } from "wire-mesh-core/domain/mesh-session";
|
|
6
6
|
import type { HubSession } from "./hub-session.js";
|
|
7
|
-
/**
|
|
8
|
-
export declare function forwardAdvertsToHub(hub: Readonly<Pick<HubSession, "isConnected" | "advertiseDevices">>, directory: readonly DirectoryEntry[], onError: ((error: Error) => void) | undefined, hasAnyTrustedGateway: () => boolean): void;
|
|
9
|
-
/** Catches the hub up with every local device already known at the moment this side becomes the gateway (connectHub's own trailing call, right after hub.connect resolves) -- without this, a device whose own last gossip arrived before this coordinator took over the gateway role would never be (re-)advertised until its own next periodic gossip tick (hub-side state is rebuilt from scratch on every takeover, per coordinator-gateway.ts's own class doc). Reuses forwardAdvertsToHub's own eligibility filter and trust gate, so only ever a visible, agent/self-bearing device is pushed, and only once a remote gateway is trusted, exactly as an ordinary directory-change forward would. */
|
|
10
|
-
export declare function pushHubCatchUp(hub: Readonly<Pick<HubSession, "isConnected" | "advertiseDevices" | "peers">>, knownDevices: ReadonlyMap<string, Readonly<PeerAdvert>>, onError: ((error: Error) => void) | undefined, hasAnyTrustedGateway: () => boolean): void;
|
|
11
|
-
/** Builds a forwardToLocalPeer callback closing over peerSessions -- a factory rather than a plain function taking peerSessions as its own first parameter, so the returned callback's shape matches HubSessionDeps.forwardToLocalPeer's own fixed external contract exactly (deviceHex, command, scope, token?) with no positional-binding tricks needed at the call site. Sends a room-domain manage-request to a LOCAL peer session only, never falling back to hub routing -- HubSession's own toDevice-forwarding leg (agent-comms#184: a hub-relayed request explicitly addressed to a non-gateway local peer this gateway also fronts). Returns undefined when no local session exists for that device-id, in which case HubSession falls back to dispatching the request against this gateway's own local state instead. */
|
|
12
|
-
export declare function makeSendToLocalPeer(peerSessions: ReadonlyMap<string, Readonly<Pick<AcceptedMeshSession, "sendManageRequest">>>): (memberId: string, command: ManageCommand, scope: Readonly<CapabilityScope>, token?: CapabilityToken) => Promise<ManageOutcome> | undefined;
|
|
13
|
-
/** Routes a room-domain request through the hub's relay-connect/relay-data pairing when memberId isn't a local peer session -- WireMeshTransport.sendRoomRequest's own fallback, since the member may be a remote agent reachable only via this machine's gateway connection (agent-comms#155's local-to-remote leg). WireMeshTransport.sendRoomRequest itself gates memberId against the gateway trust boundary (agent-comms#156) before ever calling this, so by the time this runs memberId is already known-trusted -- this function stays focused on the hub-connectivity outcome alone. Resolves the same not_connected outcome sendRoomRequest already returned before the hub existed at all when this side isn't currently the gateway. */
|
|
7
|
+
/** Routes a room-domain request through the hub's relay-connect/relay-data pairing when memberId isn't a local peer session -- WireMeshTransport.sendRoomRequest's own fallback, since the member may be a remote agent reachable only through the hub this store is connected to (agent-comms#155's local-to-remote leg). WireMeshTransport.sendRoomRequest itself gates memberId against the gateway trust boundary (agent-comms#156) before ever calling this, so by the time this runs memberId is already known-trusted -- this function stays focused on the hub-connectivity outcome alone. Resolves the same not_connected outcome sendRoomRequest already returned before the hub existed at all when this side holds no hub session, which is a store that has no agent yet, has a ghost agent, or whose machine trusts nobody. */
|
|
14
8
|
export declare function routeRoomRequestViaHub(options: {
|
|
15
9
|
hub: Readonly<Pick<HubSession, "isConnected" | "sendRoomRequest">>;
|
|
16
10
|
memberId: string;
|
|
@@ -18,12 +12,4 @@ export declare function routeRoomRequestViaHub(options: {
|
|
|
18
12
|
scope: Readonly<CapabilityScope>;
|
|
19
13
|
token?: CapabilityToken | undefined;
|
|
20
14
|
}): Promise<ManageOutcome>;
|
|
21
|
-
/** Dials the hub and immediately pushes a catch-up of every already-known local device onto it (agent-comms#154's own hub-connection-establishment sequence, kept together here rather than split across two call-site statements in WireMeshTransport.connectHub) -- without the trailing catch-up, a device whose own last gossip arrived before this coordinator took over the gateway role would stay invisible on the hub until its own next periodic gossip tick. */
|
|
22
|
-
export declare function connectHubGateway(options: {
|
|
23
|
-
hub: Readonly<Pick<HubSession, "isConnected" | "advertiseDevices" | "connect" | "peers">>;
|
|
24
|
-
url: string;
|
|
25
|
-
knownDevices: ReadonlyMap<string, Readonly<PeerAdvert>>;
|
|
26
|
-
onError: ((error: Error) => void) | undefined;
|
|
27
|
-
hasAnyTrustedGateway: () => boolean;
|
|
28
|
-
}): Promise<void>;
|
|
29
15
|
//# sourceMappingURL=hub-forwarding.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hub-forwarding.d.ts","sourceRoot":"","sources":["../../src/core/hub-forwarding.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,aAAa,
|
|
1
|
+
{"version":3,"file":"hub-forwarding.d.ts","sourceRoot":"","sources":["../../src/core/hub-forwarding.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,aAAa,EACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,6yBAA6yB;AAC7yB,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,iBAAiB,CAAC,CAAC,CAAC;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACrC,GAAG,OAAO,CAAC,aAAa,CAAC,CAIzB"}
|
|
@@ -1,50 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* hub-forwarding --
|
|
2
|
+
* hub-forwarding -- local-to-remote routing, split from wire-mesh-transport.ts under the repo's max-lines cap: falls a room-domain request back through the hub's own relay-connect/relay-data pairing when its target isn't a local peer session.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
/** Forwards every directory entry carrying an agent/self extension onto hub, if hub currently holds a live connection AND at least one remote gateway is currently trusted -- a no-op otherwise. The trust gate (agent-comms#156, GatewayTrust.hasAny's own doc) is coarse by necessity: wire-mesh-core's relay-hub broadcasts a gossip frame to every connected peer with no per-recipient targeting, so "advertise only to allowlisted remote gateways" can only be approximated as "advertise nothing at all until the operator has trusted someone" -- it is not a per-recipient filter. Called both from WireMeshTransport's own watchForDisconnect (as each local peer session's directory changes) and from connectHub's own initial catch-up push, so this side's already-known local devices reach the hub immediately on taking over the gateway role rather than waiting for their own next periodic gossip tick. Forwards unconditionally on every call once past the gates above (no caching or dedup against a previous call), mirroring relay-hub.ts's own "forward every gossip frame, as received" philosophy: an advert's own snapshot-seconds/addresses are meant to keep propagating as a liveness heartbeat, so suppressing a "duplicate" would silently stop legitimate freshness updates from reaching remote gateways. A forward that fails is reported via onError and swallowed, matching every other best-effort gossip send in this codebase. */
|
|
6
|
-
export function forwardAdvertsToHub(hub, directory, onError, hasAnyTrustedGateway) {
|
|
7
|
-
if (!hub.isConnected)
|
|
8
|
-
return;
|
|
9
|
-
if (!hasAnyTrustedGateway())
|
|
10
|
-
return;
|
|
11
|
-
const eligible = directory.filter((entry) => entry.advert[AGENT_SELF_GOSSIP_KEY] !== undefined);
|
|
12
|
-
if (eligible.length === 0)
|
|
13
|
-
return;
|
|
14
|
-
hub.advertiseDevices(eligible).catch((error) => {
|
|
15
|
-
onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
/** Catches the hub up with every local device already known at the moment this side becomes the gateway (connectHub's own trailing call, right after hub.connect resolves) -- without this, a device whose own last gossip arrived before this coordinator took over the gateway role would never be (re-)advertised until its own next periodic gossip tick (hub-side state is rebuilt from scratch on every takeover, per coordinator-gateway.ts's own class doc). Reuses forwardAdvertsToHub's own eligibility filter and trust gate, so only ever a visible, agent/self-bearing device is pushed, and only once a remote gateway is trusted, exactly as an ordinary directory-change forward would. */
|
|
19
|
-
export function pushHubCatchUp(hub, knownDevices, onError, hasAnyTrustedGateway) {
|
|
20
|
-
// knownDevices also holds every remote device learned from this same hub, and the hub already has those adverts from their own senders. Handing one back would register it against this gateway's connection if it were ever fresher than the hub's copy, and is otherwise dropped by the hub's freshness rule, so only the devices this side fronts are advertised.
|
|
21
|
-
const learnedFromHub = new Set(hub.peers());
|
|
22
|
-
const catchUp = [...knownDevices.entries()]
|
|
23
|
-
.filter(([deviceHex]) => !learnedFromHub.has(deviceHex))
|
|
24
|
-
.map(([, advert]) => ({ device: advert.device, advert }));
|
|
25
|
-
forwardAdvertsToHub(hub, catchUp, onError, hasAnyTrustedGateway);
|
|
26
|
-
}
|
|
27
|
-
/** Builds a forwardToLocalPeer callback closing over peerSessions -- a factory rather than a plain function taking peerSessions as its own first parameter, so the returned callback's shape matches HubSessionDeps.forwardToLocalPeer's own fixed external contract exactly (deviceHex, command, scope, token?) with no positional-binding tricks needed at the call site. Sends a room-domain manage-request to a LOCAL peer session only, never falling back to hub routing -- HubSession's own toDevice-forwarding leg (agent-comms#184: a hub-relayed request explicitly addressed to a non-gateway local peer this gateway also fronts). Returns undefined when no local session exists for that device-id, in which case HubSession falls back to dispatching the request against this gateway's own local state instead. */
|
|
28
|
-
export function makeSendToLocalPeer(peerSessions) {
|
|
29
|
-
// Deliberately not `async`: the "no local session" signal is a synchronous `undefined` (HubSession branches on `forwarded !== undefined` to decide whether to fall back to local dispatch), and an async wrapper would turn it into a Promise that is always defined.
|
|
30
|
-
return (memberId, command, scope, token) => {
|
|
31
|
-
const session = peerSessions.get(memberId);
|
|
32
|
-
if (session === undefined)
|
|
33
|
-
return undefined;
|
|
34
|
-
return session.sendManageRequest(command, scope, undefined, token);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/** Routes a room-domain request through the hub's relay-connect/relay-data pairing when memberId isn't a local peer session -- WireMeshTransport.sendRoomRequest's own fallback, since the member may be a remote agent reachable only via this machine's gateway connection (agent-comms#155's local-to-remote leg). WireMeshTransport.sendRoomRequest itself gates memberId against the gateway trust boundary (agent-comms#156) before ever calling this, so by the time this runs memberId is already known-trusted -- this function stays focused on the hub-connectivity outcome alone. Resolves the same not_connected outcome sendRoomRequest already returned before the hub existed at all when this side isn't currently the gateway. */
|
|
4
|
+
/** Routes a room-domain request through the hub's relay-connect/relay-data pairing when memberId isn't a local peer session -- WireMeshTransport.sendRoomRequest's own fallback, since the member may be a remote agent reachable only through the hub this store is connected to (agent-comms#155's local-to-remote leg). WireMeshTransport.sendRoomRequest itself gates memberId against the gateway trust boundary (agent-comms#156) before ever calling this, so by the time this runs memberId is already known-trusted -- this function stays focused on the hub-connectivity outcome alone. Resolves the same not_connected outcome sendRoomRequest already returned before the hub existed at all when this side holds no hub session, which is a store that has no agent yet, has a ghost agent, or whose machine trusts nobody. */
|
|
38
5
|
export async function routeRoomRequestViaHub(options) {
|
|
39
6
|
const { hub, memberId, command, scope, token } = options;
|
|
40
7
|
if (!hub.isConnected)
|
|
41
8
|
return { result: "error", code: "not_connected" };
|
|
42
9
|
return hub.sendRoomRequest(memberId, command, scope, token);
|
|
43
10
|
}
|
|
44
|
-
/** Dials the hub and immediately pushes a catch-up of every already-known local device onto it (agent-comms#154's own hub-connection-establishment sequence, kept together here rather than split across two call-site statements in WireMeshTransport.connectHub) -- without the trailing catch-up, a device whose own last gossip arrived before this coordinator took over the gateway role would stay invisible on the hub until its own next periodic gossip tick. */
|
|
45
|
-
export async function connectHubGateway(options) {
|
|
46
|
-
const { hub, url, knownDevices, onError, hasAnyTrustedGateway } = options;
|
|
47
|
-
await hub.connect(url);
|
|
48
|
-
pushHubCatchUp(hub, knownDevices, onError, hasAnyTrustedGateway);
|
|
49
|
-
}
|
|
50
11
|
//# sourceMappingURL=hub-forwarding.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hub-forwarding.js","sourceRoot":"","sources":["../../src/core/hub-forwarding.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"hub-forwarding.js","sourceRoot":"","sources":["../../src/core/hub-forwarding.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,6yBAA6yB;AAC7yB,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,OAM5C;IACC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IACzD,IAAI,CAAC,GAAG,CAAC,WAAW;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IACxE,OAAO,GAAG,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HubLink keeps one store's own session on the relay hub alive while the store should have one: it dials in the background, waits for the session to end, and dials again after a delay that doubles up to a ceiling while the hub stays unreachable. Every store owns one (agent-comms#293), because reachability from another machine has to belong to the device itself and not to whichever store on the machine happens to hold the local coordinator role.
|
|
3
|
+
*
|
|
4
|
+
* The store decides through shouldConnect whether it wants a session at all, and a change of mind, made in this process or by another one editing the shared trust file, is picked up within a poll interval, or at once through reconsider(). A store with nothing to say to another machine (nothing trusted, no agent, or a ghost agent) holds no session, so it puts nothing on the hub, not even its device id.
|
|
5
|
+
*
|
|
6
|
+
* The dial never blocks the caller: a bridge starting up offline must not wait out a connect timeout before it can serve its tools, and a hub that is down or restarting is an ordinary, recoverable state. Failures reach onError and the loop carries on.
|
|
7
|
+
*/
|
|
8
|
+
import type { HubSession } from "./hub-session.js";
|
|
9
|
+
/** Delay before the first redial after a failed dial or a lost session. */
|
|
10
|
+
export declare const HUB_RECONNECT_INITIAL_DELAY_MS = 1000;
|
|
11
|
+
/** Ceiling the redial delay doubles up to while the hub stays unreachable, so an outage is retried about once a minute rather than backing off without bound. */
|
|
12
|
+
export declare const HUB_RECONNECT_MAX_DELAY_MS = 60000;
|
|
13
|
+
/** How often a link re-evaluates shouldConnect while it has nothing to react to: a store that wants no session notices it now wants one, and a store holding one notices it no longer should, without anyone calling reconsider(). Bounds how long a trust change made by another process on the machine takes to show. */
|
|
14
|
+
export declare const HUB_LINK_POLL_INTERVAL_MS = 5000;
|
|
15
|
+
/** The parts of a HubSession a HubLink drives. */
|
|
16
|
+
export type HubLinkSession = Pick<HubSession, "connect" | "disconnect" | "isConnected" | "whenDisconnected">;
|
|
17
|
+
export interface HubLinkOptions {
|
|
18
|
+
hub: Readonly<HubLinkSession>;
|
|
19
|
+
/** The hub to hold a session on. */
|
|
20
|
+
url: string;
|
|
21
|
+
/** Whether the store wants a hub session right now. Read every poll interval and on reconsider(); a session held when this turns false is dropped, and none is dialled while it is false. */
|
|
22
|
+
shouldConnect: () => boolean;
|
|
23
|
+
/** Called each time a session is established, after the dial resolves. WireMeshTransport uses it to advertise this store's presence at once instead of waiting for the next presence tick. */
|
|
24
|
+
onConnected: () => void;
|
|
25
|
+
/** Reports a failed dial. Never called for anything else. */
|
|
26
|
+
onError: (error: Error) => void;
|
|
27
|
+
/** Overrides HUB_RECONNECT_INITIAL_DELAY_MS, for a test that must not wait a second per redial. */
|
|
28
|
+
initialDelayMs?: number;
|
|
29
|
+
/** Overrides HUB_RECONNECT_MAX_DELAY_MS. */
|
|
30
|
+
maxDelayMs?: number;
|
|
31
|
+
/** Overrides HUB_LINK_POLL_INTERVAL_MS. */
|
|
32
|
+
pollIntervalMs?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare class HubLink {
|
|
35
|
+
private readonly options;
|
|
36
|
+
private readonly initialDelayMs;
|
|
37
|
+
private readonly maxDelayMs;
|
|
38
|
+
private readonly pollIntervalMs;
|
|
39
|
+
private stopped;
|
|
40
|
+
private running;
|
|
41
|
+
/** Cancels the wait between dials, so stop() does not sit out a delay. */
|
|
42
|
+
private wake;
|
|
43
|
+
constructor(options: Readonly<HubLinkOptions>);
|
|
44
|
+
/** Begins running in the background and returns at once. A second call while running does nothing. */
|
|
45
|
+
start(): void;
|
|
46
|
+
/** Re-evaluates shouldConnect now instead of at the next poll, and cuts short any wait, including the delay before a redial. Call it when something shouldConnect reads has changed. */
|
|
47
|
+
reconsider(): void;
|
|
48
|
+
/** Stops, drops the live session, and resolves once the loop has ended. */
|
|
49
|
+
stop(): Promise<void>;
|
|
50
|
+
/** A method call rather than a direct property read, so TypeScript's control-flow narrowing does not treat the flag as staying false across the awaits in run(), during which stop() can set it. */
|
|
51
|
+
private isStopped;
|
|
52
|
+
private run;
|
|
53
|
+
/** Holds the live session until the hub ends it, resolving true, or until the store stops wanting it, when it drops the session itself and resolves false. */
|
|
54
|
+
private holdWhileWanted;
|
|
55
|
+
/** Waits ms, or until reconsider() or stop() cuts it short. Each wait clears the wake handle only if it is still its own, since holdWhileWanted leaves a losing wait pending and its late end must not wipe the handle of the wait that replaced it. */
|
|
56
|
+
private sleep;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=hub-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-link.d.ts","sourceRoot":"","sources":["../../src/core/hub-link.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,2EAA2E;AAC3E,eAAO,MAAM,8B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