agent-comms 3.13.0 → 3.14.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 +1 -1
- package/dist/core/gossip-directory.d.ts +5 -1
- package/dist/core/gossip-directory.d.ts.map +1 -1
- package/dist/core/gossip-directory.js +23 -1
- package/dist/core/gossip-directory.js.map +1 -1
- package/dist/core/hub-forwarding.d.ts +3 -1
- package/dist/core/hub-forwarding.d.ts.map +1 -1
- package/dist/core/hub-forwarding.js +7 -0
- package/dist/core/hub-forwarding.js.map +1 -1
- package/dist/core/hub-session.d.ts +3 -1
- package/dist/core/hub-session.d.ts.map +1 -1
- package/dist/core/hub-session.js +22 -3
- package/dist/core/hub-session.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 +32 -2
- package/dist/core/room-router.js.map +1 -1
- package/dist/core/wire-mesh-transport.d.ts +4 -3
- package/dist/core/wire-mesh-transport.d.ts.map +1 -1
- package/dist/core/wire-mesh-transport.js +11 -29
- package/dist/core/wire-mesh-transport.js.map +1 -1
- package/dist/test/hub-todevice-routing.integration.test.d.ts +7 -0
- package/dist/test/hub-todevice-routing.integration.test.d.ts.map +1 -0
- package/dist/test/hub-todevice-routing.integration.test.js +114 -0
- package/dist/test/hub-todevice-routing.integration.test.js.map +1 -0
- package/package.json +2 -2
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/v3.14.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.
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* gossip-directory — the mesh-wide gossip-directory aggregation WireMeshTransport's own listKnownDevices reads from, plus per-event directory lookups (a specific peer's presence advert). Split out purely to keep wire-mesh-transport.ts under the repo's max-lines cap, the same reason connection-approval.ts, room-router.ts, hub-session.ts, and peer-lifecycle.ts were each split from their own owning file.
|
|
3
3
|
*/
|
|
4
|
-
import type { DirectoryEntry } from "wire-mesh-core/domain/mesh-session";
|
|
4
|
+
import type { AcceptedMeshSession, DirectoryEntry } from "wire-mesh-core/domain/mesh-session";
|
|
5
5
|
import type { PeerAdvert } from "wire-mesh-core/generated/protocol";
|
|
6
6
|
import { AgentStatus } from "./types.js";
|
|
7
|
+
import { type AgentSelfAdvert, type HostedRoomAdvert } from "./wire-mesh-transport.js";
|
|
8
|
+
import type { HubSession } from "./hub-session.js";
|
|
7
9
|
/** Merges one session event's own directory into the mesh-wide knownDevices view (mutated in place), keeping the newer advert (by snapshot-seconds) whenever a device-id is already known from an earlier event or a different session. */
|
|
8
10
|
export declare function mergeKnownDevices(knownDevices: Map<string, PeerAdvert>, directory: readonly DirectoryEntry[]): void;
|
|
9
11
|
/** Reads a presence extension from one specific device's own gossiped self-advert, if this event's directory carries a fresh one for exactly that device-id -- never for any other device-id a multi-hop directory might mention, since only the session's own authenticated peer's advert is that session's business to report. Returns undefined for a missing presence/status key, or a value that isn't a recognised AgentStatus -- an advert simply not participating in this convention, not an error (the same verifier obligation peer-advert's own open extension tail is documented under). */
|
|
10
12
|
export declare function findPresenceAdvert(deviceIdHex: string, directory: readonly DirectoryEntry[]): AgentStatus | undefined;
|
|
13
|
+
/** Re-sends this side's own current presence status and currently-hosted rooms, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever of the two sources is wired in, 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. A no-op tick (neither source wired in, or no sessions exist yet) is expected and silent. 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 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. */
|
|
14
|
+
export declare function readvertiseGossip(allSessions: ReadonlySet<AcceptedMeshSession>, hub: Readonly<Pick<HubSession, "ownsSession">>, hasAnyTrustedGateway: () => boolean, onError: ((error: Error) => void) | undefined, getCurrentPresence: (() => AgentStatus | undefined) | undefined, getHostedRooms: (() => readonly HostedRoomAdvert[]) | undefined, getSelfAgentAdvert: (() => AgentSelfAdvert | undefined) | undefined): void;
|
|
11
15
|
//# sourceMappingURL=gossip-directory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gossip-directory.d.ts","sourceRoot":"","sources":["../../src/core/gossip-directory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"gossip-directory.d.ts","sourceRoot":"","sources":["../../src/core/gossip-directory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,2OAA2O;AAC3O,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACrC,SAAS,EAAE,SAAS,cAAc,EAAE,GACnC,IAAI,CAWN;AAED,ykBAAykB;AACzkB,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,SAAS,cAAc,EAAE,GACnC,WAAW,GAAG,SAAS,CAOzB;AAED,w+CAAw+C;AACx+C,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,CAAC,mBAAmB,CAAC,EAC7C,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,EAC9C,oBAAoB,EAAE,MAAM,OAAO,EACnC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,EAC7C,kBAAkB,EAAE,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,SAAS,EAC/D,cAAc,EAAE,CAAC,MAAM,SAAS,gBAAgB,EAAE,CAAC,GAAG,SAAS,EAC/D,kBAAkB,EAAE,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,SAAS,GAClE,IAAI,CAiBN"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { deviceIdToHex } from "wire-mesh-core/domain/device-id";
|
|
5
5
|
import { AgentStatus } from "./types.js";
|
|
6
|
-
import { PRESENCE_GOSSIP_KEY } from "./wire-mesh-transport.js";
|
|
6
|
+
import { AGENT_SELF_GOSSIP_KEY, HOSTED_ROOMS_GOSSIP_KEY, PRESENCE_GOSSIP_KEY, } from "./wire-mesh-transport.js";
|
|
7
7
|
/** Merges one session event's own directory into the mesh-wide knownDevices view (mutated in place), keeping the newer advert (by snapshot-seconds) whenever a device-id is already known from an earlier event or a different session. */
|
|
8
8
|
export function mergeKnownDevices(knownDevices, directory) {
|
|
9
9
|
for (const entry of directory) {
|
|
@@ -23,4 +23,26 @@ export function findPresenceAdvert(deviceIdHex, directory) {
|
|
|
23
23
|
const status = entry.advert[PRESENCE_GOSSIP_KEY];
|
|
24
24
|
return AgentStatus.is(status) ? status : undefined;
|
|
25
25
|
}
|
|
26
|
+
/** Re-sends this side's own current presence status and currently-hosted rooms, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever of the two sources is wired in, 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. A no-op tick (neither source wired in, or no sessions exist yet) is expected and silent. 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 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. */
|
|
27
|
+
export function readvertiseGossip(allSessions, hub, hasAnyTrustedGateway, onError, getCurrentPresence, getHostedRooms, getSelfAgentAdvert) {
|
|
28
|
+
const extensions = {};
|
|
29
|
+
const status = getCurrentPresence?.();
|
|
30
|
+
if (status !== undefined)
|
|
31
|
+
extensions[PRESENCE_GOSSIP_KEY] = status;
|
|
32
|
+
const hostedRooms = getHostedRooms?.();
|
|
33
|
+
if (hostedRooms !== undefined)
|
|
34
|
+
extensions[HOSTED_ROOMS_GOSSIP_KEY] = hostedRooms;
|
|
35
|
+
const selfAgentAdvert = getSelfAgentAdvert?.();
|
|
36
|
+
if (selfAgentAdvert !== undefined)
|
|
37
|
+
extensions[AGENT_SELF_GOSSIP_KEY] = selfAgentAdvert;
|
|
38
|
+
if (Object.keys(extensions).length === 0)
|
|
39
|
+
return;
|
|
40
|
+
for (const session of allSessions) {
|
|
41
|
+
if (hub.ownsSession(session) && !hasAnyTrustedGateway())
|
|
42
|
+
continue;
|
|
43
|
+
session.sendGossipUpdate(extensions).catch((error) => {
|
|
44
|
+
onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
26
48
|
//# sourceMappingURL=gossip-directory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gossip-directory.js","sourceRoot":"","sources":["../../src/core/gossip-directory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"gossip-directory.js","sourceRoot":"","sources":["../../src/core/gossip-directory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAMhE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GAGpB,MAAM,0BAA0B,CAAC;AAGlC,2OAA2O;AAC3O,MAAM,UAAU,iBAAiB,CAC/B,YAAqC,EACrC,SAAoC;IAEpC,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC/C,IACE,QAAQ,KAAK,SAAS;YACtB,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,EAChE,CAAC;YACD,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK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I,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAAE,SAAS;QAClE,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAC5D,OAAO,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* hub-forwarding -- agent-comms#155's gateway forwarding, split from wire-mesh-transport.ts under the repo's max-lines cap. Outbound: filters a directory of gossiped local devices down to the ones eligible for cross-machine advertisement (an agent/self-bearing entry, meaning only ever a "visible" agent -- see AGENT_SELF_GOSSIP_KEY's own doc for why no separate visibility check is needed here) and pushes them onto a connected HubSession, best-effort. Local-to-remote routing: 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
4
|
import type { CapabilityScope, CapabilityToken, ManageCommand, PeerAdvert } from "wire-mesh-core/generated/protocol";
|
|
5
|
-
import type { DirectoryEntry, ManageOutcome } from "wire-mesh-core/domain/mesh-session";
|
|
5
|
+
import type { AcceptedMeshSession, DirectoryEntry, ManageOutcome } from "wire-mesh-core/domain/mesh-session";
|
|
6
6
|
import type { HubSession } from "./hub-session.js";
|
|
7
7
|
/** 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. */
|
|
8
8
|
export declare function forwardAdvertsToHub(hub: Readonly<Pick<HubSession, "isConnected" | "advertiseDevices">>, directory: readonly DirectoryEntry[], onError: ((error: Error) => void) | undefined, hasAnyTrustedGateway: () => boolean): void;
|
|
9
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
10
|
export declare function pushHubCatchUp(hub: Readonly<Pick<HubSession, "isConnected" | "advertiseDevices">>, knownDevices: ReadonlyMap<string, Readonly<PeerAdvert>>, onError: ((error: Error) => void) | undefined, hasAnyTrustedGateway: () => boolean): void;
|
|
11
|
+
/** Sends a room-domain manage-request to a LOCAL peer session only (peerSessions), 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), wired in as WireMeshTransport's forwardToLocalPeer dependency. 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 sendToLocalPeer(peerSessions: ReadonlyMap<string, AcceptedMeshSession>, memberId: string, command: ManageCommand, scope: Readonly<CapabilityScope>, token?: CapabilityToken): Promise<ManageOutcome> | undefined;
|
|
11
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. */
|
|
12
14
|
export declare function routeRoomRequestViaHub(hub: Readonly<Pick<HubSession, "isConnected" | "sendRoomRequest">>, memberId: string, command: ManageCommand, scope: Readonly<CapabilityScope>, token?: CapabilityToken): Promise<ManageOutcome>;
|
|
13
15
|
/** 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. */
|
|
@@ -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,EACb,UAAU,EACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,64CAA64C;AAC74C,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,kBAAkB,CAAC,CAAC,EACnE,SAAS,EAAE,SAAS,cAAc,EAAE,EACpC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,EAC7C,oBAAoB,EA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AC,EAChC,KAAK,CAAC,EAAE,eAAe,GACtB,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED,2cAA2c;AAC3c,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,QAAQ,CACX,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,kBAAkB,GAAG,SAAS,CAAC,CACjE,EACD,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EACvD,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,EAC7C,oBAAoB,EAAE,MAAM,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -23,6 +23,13 @@ export function pushHubCatchUp(hub, knownDevices, onError, hasAnyTrustedGateway)
|
|
|
23
23
|
}));
|
|
24
24
|
forwardAdvertsToHub(hub, catchUp, onError, hasAnyTrustedGateway);
|
|
25
25
|
}
|
|
26
|
+
/** Sends a room-domain manage-request to a LOCAL peer session only (peerSessions), 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), wired in as WireMeshTransport's forwardToLocalPeer dependency. 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. */
|
|
27
|
+
export function sendToLocalPeer(peerSessions, memberId, command, scope, token) {
|
|
28
|
+
const session = peerSessions.get(memberId);
|
|
29
|
+
if (session === undefined)
|
|
30
|
+
return undefined;
|
|
31
|
+
return session.sendManageRequest(command, scope, undefined, token);
|
|
32
|
+
}
|
|
26
33
|
/** 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. */
|
|
27
34
|
export async function routeRoomRequestViaHub(hub, memberId, command, scope, token) {
|
|
28
35
|
if (!hub.isConnected)
|
|
@@ -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;AAcH,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,64CAA64C;AAC74C,MAAM,UAAU,mBAAmB,CACjC,GAAmE,EACnE,SAAoC,EACpC,OAA6C,EAC7C,oBAAmC;IAEnC,IAAI,CAAC,GAAG,CAAC,WAAW;QAAE,OAAO;IAC7B,IAAI,CAAC,oBAAoB,EAAE;QAAE,OAAO;IACpC,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,KAAK,SAAS,CAC7D,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAClC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACtD,OAAO,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,2qBAA2qB;AAC3qB,MAAM,UAAU,cAAc,CAC5B,GAAmE,EACnE,YAAuD,EACvD,OAA6C,EAC7C,oBAAmC;IAEnC,MAAM,OAAO,GAAG,CAAC,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25
|
handleRoomRequest: (request: IncomingManageRequest, handle: Readonly<ConnectionHandle>) => Promise<void>;
|
|
26
26
|
/** The gateway trust boundary (agent-comms#156): whether the given device-id (hex) is currently trusted. Checked against every gossiped directory entry's own device and every relayed request's own fromDevice before this side merges or dispatches it -- see consume()/connect()'s own doc comments for exactly where and why. */
|
|
27
27
|
isTrusted: (deviceHex: string) => boolean;
|
|
28
|
+
/** Forwards a room-domain manage-request on to a specific LOCAL peer session (one this gateway is directly connected to over the ordinary local mesh, keyed by device-id hex) rather than dispatching it against this gateway's own local state -- consume()'s own toDevice disambiguation (agent-comms#184, wire-mesh-core 1.48.1's IncomingManageRequest.toDevice). Returns undefined when no local session exists for that device-id, in which case consume() falls back to handleRoomRequest exactly as it always has. */
|
|
29
|
+
forwardToLocalPeer: (deviceHex: string, command: ManageCommand, scope: Readonly<CapabilityScope>, token?: CapabilityToken) => Promise<ManageOutcome> | undefined;
|
|
28
30
|
}
|
|
29
31
|
export declare class HubSession {
|
|
30
32
|
private readonly deps;
|
|
@@ -45,7 +47,7 @@ export declare class HubSession {
|
|
|
45
47
|
peers(): readonly string[];
|
|
46
48
|
/** Dials the hub and participates as a peer (see the class doc for the discovery and routing model). */
|
|
47
49
|
connect(url: string): Promise<void>;
|
|
48
|
-
/** Dispatches inbound relayed manage-requests: each is handled with a handle keyed by the SENDING device (request.fromDevice names it on relay-routed requests), so every downstream consumer sees the true origin, never the hub -- the same discipline extends to a real room-domain verb (agent-comms#155's "remote to local" leg) as it already applied to the legacy opaque-frame path. Every request is first checked against the gateway trust boundary (agent-comms#156, deps.isTrusted): a request with no fromDevice at all (senderHex falls back to the literal string "hub-peer", never a real trusted device-id) or an unrecognised fromDevice is never dispatched to either path below -- a legacy FRAME_VERB message is silently dropped (matching isStateMutatingMessage's own swallow-and-ack style, so an untrusted sender learns nothing about why), and a room-domain request gets an explicit `unauthorized` error rather than being dispatched, so its caller fails fast instead of waiting out HUB_ROOM_REQUEST_TIMEOUT_MS's local-session-side counterpart. A legacy FRAME_VERB carrying state_sync/state_update is dropped before ever reaching onMessage/applyPatch even from an otherwise-trusted sender -- see isStateMutatingMessage's own doc for why: gateway trust says "this device's traffic is worth acting on," not "this device may directly overwrite this side's mesh state," which is a strictly stronger claim the trust boundary here was never meant to grant (a security review finding on agent-comms#169). A real room-domain verb (room.send, room.join, room.notify, ...) carries no equivalent risk -- it is independently gated by its own room:member capability token, verified regardless of which transport path it arrived over
|
|
50
|
+
/** Dispatches inbound relayed manage-requests: each is handled with a handle keyed by the SENDING device (request.fromDevice names it on relay-routed requests), so every downstream consumer sees the true origin, never the hub -- the same discipline extends to a real room-domain verb (agent-comms#155's "remote to local" leg) as it already applied to the legacy opaque-frame path. Every request is first checked against the gateway trust boundary (agent-comms#156, deps.isTrusted): a request with no fromDevice at all (senderHex falls back to the literal string "hub-peer", never a real trusted device-id) or an unrecognised fromDevice is never dispatched to either path below -- a legacy FRAME_VERB message is silently dropped (matching isStateMutatingMessage's own swallow-and-ack style, so an untrusted sender learns nothing about why), and a room-domain request gets an explicit `unauthorized` error rather than being dispatched, so its caller fails fast instead of waiting out HUB_ROOM_REQUEST_TIMEOUT_MS's local-session-side counterpart. A legacy FRAME_VERB carrying state_sync/state_update is dropped before ever reaching onMessage/applyPatch even from an otherwise-trusted sender -- see isStateMutatingMessage's own doc for why: gateway trust says "this device's traffic is worth acting on," not "this device may directly overwrite this side's mesh state," which is a strictly stronger claim the trust boundary here was never meant to grant (a security review finding on agent-comms#169). A real room-domain verb (room.send, room.join, room.notify, ...) carries no equivalent risk -- it is independently gated by its own room:member capability token, verified regardless of which transport path it arrived over. Multi-device gateway routing (agent-comms#184, wire-mesh-core 1.48.1's own IncomingManageRequest.toDevice, read directly from each relay-data frame's own to-device field rather than guessed from pairing state): when the request carries a toDevice that names a different device than ownDeviceHex, the command is first re-stamped with an "on-behalf-of" params field naming senderHex (already verified trusted above) before deps.forwardToLocalPeer forwards it on to that device's own local mesh session (one this gateway is directly connected to, never merely gossiped-about) -- room-router.ts's own resolveHandle reads that field back out on the receiving end, so the forwarded request is attributed to the true remote sender there, not to this gateway, matching this same method's own "every downstream consumer sees the true origin, never the hub" discipline for the local hop too. Its outcome is relayed straight back. Only when forwardToLocalPeer finds no such local session (toDevice is absent, matches ownDeviceHex, or names a device this gateway doesn't actually front) does the request fall through to handleRoomRequest, dispatched to the same roomVerbHandlers a local peer session's own drainSession uses, against THIS side's own local mesh state -- correct for traffic genuinely addressed to this gateway's own agent, and the same fallback a sender still on a pre-#184 wire-mesh-core (never stamping toDevice at all) already relied on. */
|
|
49
51
|
private consume;
|
|
50
52
|
private watchDisconnect;
|
|
51
53
|
/** Sends one message to a hub-discovered peer through the hub's relay pairing. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hub-session.d.ts","sourceRoot":"","sources":["../../src/core/hub-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EACnB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,KAAK,EACL,aAAa,EACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAatD,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAClC,yHAAyH;IACzH,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,wEAAwE;IACxE,mBA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C;IAKrC,kOAAkO;IAClO,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,kVAAkV;IAClV,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO;IAIlD,mKAAmK;IAC7J,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAQjC,qFAAqF;IACrF,KAAK,IAAI,SAAS,MAAM,EAAE;IAI1B,wGAAwG;IAClG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCzC,+lGAA+lG;IAC/lG,OAAO,CAAC,OAAO;YA0DD,eAAe;IAU7B,kFAAkF;IAC5E,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5E,svBAAsvB;IAChvB,gBAAgB,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzE,6iBAA6iB;IACviB,eAAe,CACnB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,EAChC,KAAK,CAAC,EAAE,eAAe,GACtB,OAAO,CAAC,aAAa,CAAC;CAa1B"}
|
package/dist/core/hub-session.js
CHANGED
|
@@ -79,13 +79,13 @@ export class HubSession {
|
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
})();
|
|
82
|
-
this.consume(session);
|
|
82
|
+
this.consume(session, deviceIdToHex(identity.deviceId));
|
|
83
83
|
void (async () => {
|
|
84
84
|
await this.watchDisconnect(session);
|
|
85
85
|
})();
|
|
86
86
|
}
|
|
87
|
-
/** Dispatches inbound relayed manage-requests: each is handled with a handle keyed by the SENDING device (request.fromDevice names it on relay-routed requests), so every downstream consumer sees the true origin, never the hub -- the same discipline extends to a real room-domain verb (agent-comms#155's "remote to local" leg) as it already applied to the legacy opaque-frame path. Every request is first checked against the gateway trust boundary (agent-comms#156, deps.isTrusted): a request with no fromDevice at all (senderHex falls back to the literal string "hub-peer", never a real trusted device-id) or an unrecognised fromDevice is never dispatched to either path below -- a legacy FRAME_VERB message is silently dropped (matching isStateMutatingMessage's own swallow-and-ack style, so an untrusted sender learns nothing about why), and a room-domain request gets an explicit `unauthorized` error rather than being dispatched, so its caller fails fast instead of waiting out HUB_ROOM_REQUEST_TIMEOUT_MS's local-session-side counterpart. A legacy FRAME_VERB carrying state_sync/state_update is dropped before ever reaching onMessage/applyPatch even from an otherwise-trusted sender -- see isStateMutatingMessage's own doc for why: gateway trust says "this device's traffic is worth acting on," not "this device may directly overwrite this side's mesh state," which is a strictly stronger claim the trust boundary here was never meant to grant (a security review finding on agent-comms#169). A real room-domain verb (room.send, room.join, room.notify, ...) carries no equivalent risk -- it is independently gated by its own room:member capability token, verified regardless of which transport path it arrived over
|
|
88
|
-
consume(session) {
|
|
87
|
+
/** Dispatches inbound relayed manage-requests: each is handled with a handle keyed by the SENDING device (request.fromDevice names it on relay-routed requests), so every downstream consumer sees the true origin, never the hub -- the same discipline extends to a real room-domain verb (agent-comms#155's "remote to local" leg) as it already applied to the legacy opaque-frame path. Every request is first checked against the gateway trust boundary (agent-comms#156, deps.isTrusted): a request with no fromDevice at all (senderHex falls back to the literal string "hub-peer", never a real trusted device-id) or an unrecognised fromDevice is never dispatched to either path below -- a legacy FRAME_VERB message is silently dropped (matching isStateMutatingMessage's own swallow-and-ack style, so an untrusted sender learns nothing about why), and a room-domain request gets an explicit `unauthorized` error rather than being dispatched, so its caller fails fast instead of waiting out HUB_ROOM_REQUEST_TIMEOUT_MS's local-session-side counterpart. A legacy FRAME_VERB carrying state_sync/state_update is dropped before ever reaching onMessage/applyPatch even from an otherwise-trusted sender -- see isStateMutatingMessage's own doc for why: gateway trust says "this device's traffic is worth acting on," not "this device may directly overwrite this side's mesh state," which is a strictly stronger claim the trust boundary here was never meant to grant (a security review finding on agent-comms#169). A real room-domain verb (room.send, room.join, room.notify, ...) carries no equivalent risk -- it is independently gated by its own room:member capability token, verified regardless of which transport path it arrived over. Multi-device gateway routing (agent-comms#184, wire-mesh-core 1.48.1's own IncomingManageRequest.toDevice, read directly from each relay-data frame's own to-device field rather than guessed from pairing state): when the request carries a toDevice that names a different device than ownDeviceHex, the command is first re-stamped with an "on-behalf-of" params field naming senderHex (already verified trusted above) before deps.forwardToLocalPeer forwards it on to that device's own local mesh session (one this gateway is directly connected to, never merely gossiped-about) -- room-router.ts's own resolveHandle reads that field back out on the receiving end, so the forwarded request is attributed to the true remote sender there, not to this gateway, matching this same method's own "every downstream consumer sees the true origin, never the hub" discipline for the local hop too. Its outcome is relayed straight back. Only when forwardToLocalPeer finds no such local session (toDevice is absent, matches ownDeviceHex, or names a device this gateway doesn't actually front) does the request fall through to handleRoomRequest, dispatched to the same roomVerbHandlers a local peer session's own drainSession uses, against THIS side's own local mesh state -- correct for traffic genuinely addressed to this gateway's own agent, and the same fallback a sender still on a pre-#184 wire-mesh-core (never stamping toDevice at all) already relied on. */
|
|
88
|
+
consume(session, ownDeviceHex) {
|
|
89
89
|
void (async () => {
|
|
90
90
|
for await (const request of session.incomingManageRequests) {
|
|
91
91
|
if (this.deps.isShuttingDown())
|
|
@@ -113,6 +113,25 @@ export class HubSession {
|
|
|
113
113
|
await request.respond({ result: "ok" }).catch(() => undefined);
|
|
114
114
|
continue;
|
|
115
115
|
}
|
|
116
|
+
const toDeviceHex = request.toDevice !== undefined
|
|
117
|
+
? deviceIdToHex(request.toDevice)
|
|
118
|
+
: undefined;
|
|
119
|
+
if (toDeviceHex !== undefined && toDeviceHex !== ownDeviceHex) {
|
|
120
|
+
// Stamps the already-verified true sender (senderHex -- trusted above, never the "hub-peer" fallback, since an untrusted or fromDevice-less request already continued away) onto the forwarded command's own params, so the local peer's own resolveHandle (room-router.ts) can attribute the request to senderHex instead of this side's own device once it arrives over that peer's ordinary local-mesh session -- otherwise every downstream consumer at the local peer would see this gateway as the requester, never the real remote origin, defeating consume()'s own "true origin, never the hub" discipline for this forwarded leg specifically.
|
|
121
|
+
const forwardedCommand = {
|
|
122
|
+
...request.command,
|
|
123
|
+
params: {
|
|
124
|
+
...request.command.params,
|
|
125
|
+
"on-behalf-of": senderHex,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
const forwarded = this.deps.forwardToLocalPeer(toDeviceHex, forwardedCommand, request.scope, request.token);
|
|
129
|
+
if (forwarded !== undefined) {
|
|
130
|
+
const outcome = await forwarded;
|
|
131
|
+
await request.respond(outcome).catch(() => undefined);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
116
135
|
await this.deps.handleRoomRequest(request, handle);
|
|
117
136
|
}
|
|
118
137
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hub-session.js","sourceRoot":"","sources":["../../src/core/hub-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,GAKlB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAWhE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,MAAM,EACN,WAAW,EACX,UAAU,GACX,MAAM,0BAA0B,CAAC;AAElC,2fAA2f;AAC3f,MAAM,2BAA2B,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"hub-session.js","sourceRoot":"","sources":["../../src/core/hub-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,GAKlB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAWhE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,MAAM,EACN,WAAW,EACX,UAAU,GACX,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M,KAAK,cAAc,CAAC;AAC9E,CAAC"}
|
|
@@ -21,8 +21,8 @@ export interface RoomRouterOptions {
|
|
|
21
21
|
export interface RoomRouter {
|
|
22
22
|
/** Handles one already-received request. Exported for direct unit testing; drainSession below is the thin per-session loop wrapper real callers use. */
|
|
23
23
|
handleRequest: (request: IncomingManageRequest, handle: Readonly<ConnectionHandle>) => Promise<void>;
|
|
24
|
-
/** Consumes one session's incomingManageRequests until it ends, dispatching each request via handleRequest. Becomes the single consumer of that iterable from this point on -- the caller must not also iterate the same session's incomingManageRequests itself once this is called. */
|
|
25
|
-
drainSession: (session: AcceptedMeshSession, handle: Readonly<ConnectionHandle
|
|
24
|
+
/** Consumes one session's incomingManageRequests until it ends, dispatching each request via handleRequest. Becomes the single consumer of that iterable from this point on -- the caller must not also iterate the same session's incomingManageRequests itself once this is called. allowOnBehalfOf (default false) permits resolveHandle's own "on-behalf-of" substitution for every request on this session -- wire-mesh-transport.ts's consumeIncoming passes true only when this session's peer identity matches this side's own recorded coordinator device (see resolveHandle's own doc comment for why identity, not call site, is what's checked). */
|
|
25
|
+
drainSession: (session: AcceptedMeshSession, handle: Readonly<ConnectionHandle>, allowOnBehalfOf?: boolean) => void;
|
|
26
26
|
}
|
|
27
27
|
export declare function createRoomRouter(options: RoomRouterOptions): RoomRouter;
|
|
28
28
|
//# sourceMappingURL=room-router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-router.d.ts","sourceRoot":"","sources":["../../src/core/room-router.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACd,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"room-router.d.ts","sourceRoot":"","sources":["../../src/core/room-router.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGxE,6ZAA6Z;AAC7Z,wBAAgB,cAAc,CAC5B,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC,GACxC,WAAW,GAAG,SAAS,CAOzB;AAmFD,kTAAkT;AAClT,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAC/B,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,WAAW,iBAAiB;IAChC,4HAA4H;IAC5H,MAAM,EAAE,eAAe,CAAC;IACxB,qHAAqH;IACrH,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,UAAU;IACzB,wJAAwJ;IACxJ,aAAa,EAAE,CACb,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,goBAAgoB;IAChoB,YAAY,EAAE,CACZ,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,eAAe,CAAC,EAAE,OAAO,KACtB,IAAI,CAAC;CACX;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAuCvE"}
|
package/dist/core/room-router.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Deliberately empty of real room-verb handlers in this phase (P3.3): the router itself, and the unsupported_verb fallback, are the whole deliverable here. Each later phase (P3.4 admission, P3.5 fan-out, P3.6 state-sync, P3.7 kick) registers the handlers for the verbs it implements.
|
|
7
7
|
*/
|
|
8
|
+
import { deviceIdFromHex } from "wire-mesh-core/domain/device-id";
|
|
8
9
|
import { isMeshMessage } from "./wire-protocol.js";
|
|
9
10
|
import { FRAME_VERB } from "./wire-mesh-transport.js";
|
|
10
11
|
/** Extracts and validates the carried MeshMessage from an incoming FRAME_VERB command. Returns undefined for anything that isn't a well-formed frame -- an unrecognised or malformed payload is dropped, not thrown. Exported for WireMeshTransport's own quarantine-gate pre-approval check (introduce/connect_request detection), the one place outside this router that still needs to decode a legacy frame directly. */
|
|
@@ -67,6 +68,35 @@ function extractParamsVerb(params) {
|
|
|
67
68
|
return undefined;
|
|
68
69
|
return typeof params.verb === "string" ? params.verb : undefined;
|
|
69
70
|
}
|
|
71
|
+
/** Reads a command's own "on-behalf-of" extension field (open params tail, the same convention room.send's "streaming-behavior" already uses) -- present only when a trusted gateway forwarded this request on behalf of a different device than the one it physically arrived over (agent-comms#184's own hub-session.ts toDevice-forwarding leg, which stamps the hub-relayed request's real fromDevice here before handing it to a local peer's own session). Returns undefined for anything that isn't a well-formed device-id-hex string, so a malformed or absent value silently falls back to the connection's own authenticated identity rather than ever producing a broken handle. */
|
|
72
|
+
function onBehalfOfFromParams(params) {
|
|
73
|
+
if (typeof params !== "object" || params === null)
|
|
74
|
+
return undefined;
|
|
75
|
+
if (!("on-behalf-of" in params))
|
|
76
|
+
return undefined;
|
|
77
|
+
const claimed = params["on-behalf-of"];
|
|
78
|
+
if (typeof claimed !== "string")
|
|
79
|
+
return undefined;
|
|
80
|
+
try {
|
|
81
|
+
deviceIdFromHex(claimed);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return claimed;
|
|
87
|
+
}
|
|
88
|
+
/** Resolves the handle a request is actually dispatched with: the session's own authenticated connection identity, unless allowOnBehalfOf permits substituting a claimed "on-behalf-of" device from the request's own params. allowOnBehalfOf is true only when the session's peer identity matches this side's own recorded coordinator device (wire-mesh-transport.ts's consumeIncoming, keyed on identity rather than on which specific session connectToCoordinator itself dialled, since mesh formation's own reciprocal connectToPeer can reach this side over a second, independently-accepted connection to that identical device) -- the one relationship in this mesh where the far end already holds unconditional trust over this session (the pre-existing ungated introduce/coordinator-handoff path), the same trust boundary that lets it forward a hub-relayed request on to a different local peer at all. Safe for a capability-token-gated verb (room.send, ...) regardless: the token's own bearer is independently verified against the resolved handle, so a forged claim here would simply fail that check rather than succeed under a false identity -- this only changes outcomes for the ungated room.join first round, where the coordinator relationship is the sole trust boundary either way. */
|
|
89
|
+
function resolveHandle(request, handle, allowOnBehalfOf) {
|
|
90
|
+
if (!allowOnBehalfOf)
|
|
91
|
+
return handle;
|
|
92
|
+
const claimed = onBehalfOfFromParams(request.command.params);
|
|
93
|
+
if (claimed === undefined)
|
|
94
|
+
return handle;
|
|
95
|
+
return {
|
|
96
|
+
id: claimed,
|
|
97
|
+
...(handle.policy !== undefined ? { policy: handle.policy } : {}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
70
100
|
export function createRoomRouter(options) {
|
|
71
101
|
async function handleRequest(request, handle) {
|
|
72
102
|
if (request.command.verb === FRAME_VERB) {
|
|
@@ -90,10 +120,10 @@ export function createRoomRouter(options) {
|
|
|
90
120
|
}
|
|
91
121
|
return {
|
|
92
122
|
handleRequest,
|
|
93
|
-
drainSession(session, handle) {
|
|
123
|
+
drainSession(session, handle, allowOnBehalfOf = false) {
|
|
94
124
|
void (async () => {
|
|
95
125
|
for await (const request of session.incomingManageRequests) {
|
|
96
|
-
await handleRequest(request, handle);
|
|
126
|
+
await handleRequest(request, resolveHandle(request, handle, allowOnBehalfOf));
|
|
97
127
|
}
|
|
98
128
|
})();
|
|
99
129
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-router.js","sourceRoot":"","sources":["../../src/core/room-router.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,0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OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,KAAK;YACnD,KAAK,CAAC,KAAK,IAAI,EAAE;gBACf,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;oBAC3D,MAAM,aAAa,CACjB,OAAO,EACP,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,CAChD,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;QACP,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -19,6 +19,8 @@ import type { AgentStatus } from "./types.js";
|
|
|
19
19
|
import { type RoomVerbHandler } from "./room-router.js";
|
|
20
20
|
/** The domain-qualified gossip extension key this transport reads/writes presence under, per wire-mesh's own gossip-extension-namespacing convention (spec/CONVENTIONS.md): `<domain>/<field>`, never a bare name a second application's own extension could collide with. */
|
|
21
21
|
export declare const PRESENCE_GOSSIP_KEY = "presence/status";
|
|
22
|
+
/** The domain-qualified gossip extension key this transport writes this side's own currently-hosted public/private rooms under -- the write half of P3.8's room-discovery replacement for createRoom's own broadcastPatch (agent-comms#48). Same namespacing convention as PRESENCE_GOSSIP_KEY. */
|
|
23
|
+
export declare const HOSTED_ROOMS_GOSSIP_KEY = "room/hosted";
|
|
22
24
|
/** The lightweight, gossip-safe shape a room advertises itself under: enough for a peer to display "this device hosts a discoverable room here" without exposing anything membership- or grant-related. Deliberately excludes secret rooms (never worth advertising at all) and every CRDT membership field a real Room carries -- a gossip-discovered entry is a hint pointing at a room to join, not a substitute for the real Room object join/admission still produces. */
|
|
23
25
|
export interface HostedRoomAdvert {
|
|
24
26
|
path: string;
|
|
@@ -58,6 +60,7 @@ export declare class WireMeshTransport implements MeshTransport {
|
|
|
58
60
|
private readonly coordinatorListeners;
|
|
59
61
|
private defaultListenerId;
|
|
60
62
|
private coordinatorSession;
|
|
63
|
+
private coordinatorDeviceHex;
|
|
61
64
|
readonly hub: HubSession;
|
|
62
65
|
private readonly peerSessions;
|
|
63
66
|
private readonly allSessions;
|
|
@@ -91,15 +94,13 @@ export declare class WireMeshTransport implements MeshTransport {
|
|
|
91
94
|
sendDataFrame(peerDeviceHex: string, frame: Readonly<DataHaveFrame> | Readonly<DataRequestFrame>): Promise<void>;
|
|
92
95
|
/** Registers (or refreshes) the raw connection a frame arrived on, then answers a data-have/data-request/data-entries frame in place, sending any resulting response frame back over the same connection -- every other frame type is ignored here (applyFrame's own dispatch already owns those). Trust-gated on peerSessions already tracking this device: a connection still in quarantine (pre-approval) gets its own frames observed here too (registration is unconditional, since a later approved sendDataFrame call still needs to find it), but never acted on until trackSession has actually run for it. A response or storage failure is reported via onError and otherwise dropped -- the peer's own next data-have/retry is what recovers, the same as any other best-effort gossip-driven exchange in this file. */
|
|
93
96
|
private handleDataFrame;
|
|
94
|
-
/** Re-sends this side's own current presence status and currently-hosted rooms, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever of the two sources is wired in, rather than a separate frame per fact. 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. A no-op tick (neither source wired in, or no sessions exist yet) is expected and silent. 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 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. */
|
|
95
|
-
private readvertiseGossip;
|
|
96
97
|
get dataPort(): number;
|
|
97
98
|
get isCoordinator(): boolean;
|
|
98
99
|
get hasCoordinatorConnection(): boolean;
|
|
99
100
|
private handleAcceptedConnection;
|
|
100
101
|
/** Reads a not-yet-trusted session's requests until it's promoted (an `introduce`, handled and trusted immediately, matching the pre-existing coordinator-handoff trust boundary) or a `connect_request` arrives, at which point this same loop iteration blocks on the human decision Promise stored in pendingConnections -- resumed in place by acceptConnection/rejectConnection (or by watchForDisconnect, if the requester disconnects first) -- rather than ever stopping and later re-entering the session's incomingManageRequests from a second call, which would require assuming a fresh access yields a distinct, independently-advancing iterator rather than resuming the one already in progress. Anything else arriving before introduce/connect_request is a protocol violation from an unapproved peer and is refused and closed rather than routed. */
|
|
101
102
|
private consumeQuarantined;
|
|
102
|
-
/** Delegates the whole post-approval drain loop to roomRouter -- this transport no longer decodes or routes a MeshMessage itself, only hands the session off. Also starts this session's own independent revocationAnnouncements drain, since a gossiped revocation is not a manage-request and has no verb for roomRouter to dispatch. */
|
|
103
|
+
/** Delegates the whole post-approval drain loop to roomRouter -- this transport no longer decodes or routes a MeshMessage itself, only hands the session off. Also starts this session's own independent revocationAnnouncements drain, since a gossiped revocation is not a manage-request and has no verb for roomRouter to dispatch. Derives roomRouter's own allowOnBehalfOf gate itself, from whether this SPECIFIC handle's peer identity matches coordinatorDeviceHex -- never from which method established this particular session (mesh formation's reciprocal connectToPeer means the same coordinator device can just as easily reach this transport over an accepted connection as over the one connectToCoordinator itself dialled; see coordinatorDeviceHex's own field comment). A coordinator-less instance (coordinatorDeviceHex still undefined, e.g. this transport IS the coordinator) never allows it for anything. */
|
|
103
104
|
private consumeIncoming;
|
|
104
105
|
/** Reads every revocation-entry this session's peer announces, for as long as the session lives, handing each one to MeshStore via onRevocationAnnounce -- one call per entry, matching revocationAnnouncements' own per-entry flattening of a revocation-announce frame's entries array. */
|
|
105
106
|
private drainRevocationAnnouncements;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-mesh-transport.d.ts","sourceRoot":"","sources":["../../src/core/wire-mesh-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAgB,KAAK,kBAAkB,EAAE,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AAC,aAAa,CAAC;IAenB,eAAe,CACnB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IA+CV,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBnE,gBAAgB,CACpB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAoBV,WAAW,CACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC;IAaZ,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/C,aAAa,IAAI,YAAY,EAAE;IAI/B,6NAA6N;IAC7N,OAAO,KAAK,mBAAmB,GAE9B;IAMK,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAqC/B,KAAK,IAAI,IAAI;CAMd"}
|
|
@@ -13,8 +13,8 @@ import { connectWsUrl } from "./ws-dial.js";
|
|
|
13
13
|
import { HubSession } from "./hub-session.js";
|
|
14
14
|
import { GatewayTrust } from "./gateway-trust.js";
|
|
15
15
|
import { advertisedListenerAddresses, LISTENER_ID_LENGTH, listenerPort, listTrackedListeners, registerListener, unregisterListener, } from "./listener-registry.js";
|
|
16
|
-
import { findPresenceAdvert, mergeKnownDevices } from "./gossip-directory.js";
|
|
17
|
-
import { connectHubGateway, forwardAdvertsToHub, routeRoomRequestViaHub, } from "./hub-forwarding.js";
|
|
16
|
+
import { findPresenceAdvert, mergeKnownDevices, readvertiseGossip, } from "./gossip-directory.js";
|
|
17
|
+
import { connectHubGateway, forwardAdvertsToHub, routeRoomRequestViaHub, sendToLocalPeer, } from "./hub-forwarding.js";
|
|
18
18
|
import { acceptMeshSession, } from "wire-mesh-core/domain/mesh-session";
|
|
19
19
|
import { deviceIdToHex } from "wire-mesh-core/domain/device-id";
|
|
20
20
|
import { handleDataEntries, handleDataHave, handleDataRequest, } from "wire-mesh-core/domain/data-sync";
|
|
@@ -36,7 +36,7 @@ const PRESENCE_READVERTISE_INTERVAL_MS = PRESENCE_READVERTISE_INTERVAL_SECONDS *
|
|
|
36
36
|
/** The domain-qualified gossip extension key this transport reads/writes presence under, per wire-mesh's own gossip-extension-namespacing convention (spec/CONVENTIONS.md): `<domain>/<field>`, never a bare name a second application's own extension could collide with. */
|
|
37
37
|
export const PRESENCE_GOSSIP_KEY = "presence/status";
|
|
38
38
|
/** The domain-qualified gossip extension key this transport writes this side's own currently-hosted public/private rooms under -- the write half of P3.8's room-discovery replacement for createRoom's own broadcastPatch (agent-comms#48). Same namespacing convention as PRESENCE_GOSSIP_KEY. */
|
|
39
|
-
const HOSTED_ROOMS_GOSSIP_KEY = "room/hosted";
|
|
39
|
+
export const HOSTED_ROOMS_GOSSIP_KEY = "room/hosted";
|
|
40
40
|
/** The domain-qualified gossip extension key this transport writes this side's own agent identity facts under -- the write half of P3.8's eventual agent register/update/offline retirement (agent-comms#48). Same namespacing convention as PRESENCE_GOSSIP_KEY/HOSTED_ROOMS_GOSSIP_KEY. */
|
|
41
41
|
export const AGENT_SELF_GOSSIP_KEY = "agent/self";
|
|
42
42
|
/** Upper bound on the number of oplog entries handleDataRequest returns in a single data-entries response -- generous for the small, chat-sized messages this domain carries today, while still bounding one peer's worst-case memory/frame size when answering a request for a large catch-up gap. A requester short of this still gets everything up to its own current head; anything beyond it needs a follow-up data-request, exactly the same incremental-catch-up shape a data-have/data-request/data-entries cycle already has. */
|
|
@@ -74,8 +74,9 @@ export class WireMeshTransport {
|
|
|
74
74
|
// -- Coordinator listeners (the well-known bootstrap port, plus any additional adapters addListener creates) --
|
|
75
75
|
coordinatorListeners = new Map();
|
|
76
76
|
defaultListenerId;
|
|
77
|
-
// -- The session dialled via connectToCoordinator, when this instance is not itself the coordinator --
|
|
77
|
+
// -- The session dialled via connectToCoordinator, when this instance is not itself the coordinator -- and that same coordinator's own device-id hex, set alongside it and never cleared: consumeIncoming's own allowOnBehalfOf gate (see its doc comment) compares every session's authenticated peer identity against the hex, not merely "was this the specific session connectToCoordinator itself dialled", since mesh formation's own reciprocal connectToPeer can just as easily reach this transport over an accepted connection to the identical coordinator device.
|
|
78
78
|
coordinatorSession;
|
|
79
|
+
coordinatorDeviceHex;
|
|
79
80
|
// -- The hub relay mode (agent-comms#151), owning its own file under the max-lines cap: see hub-session.ts for the full connection model.
|
|
80
81
|
hub;
|
|
81
82
|
// -- Every live session, keyed by the peer's authenticated device-id hex (== ConnectionHandle.id) -- covers coordinator-client, coordinator-accepted, and peer data sessions alike, since send()/broadcast() must reach whichever kind of session a peer happens to be reachable through. A single-slot-per-key map by construction: mesh formation genuinely establishes TWO independent sessions to the same peer (see the dataDials comment below), and the second one registered here simply overwrites the first as far as addressing goes -- fine for send()/broadcast() (either socket reaches the same peer), but NOT fine for shutdown, which must close every live session regardless of whether it's still reachable through this map. allSessions below exists specifically so shutdown never leaks the one this map's overwrite silently stopped tracking.
|
|
@@ -143,6 +144,7 @@ export class WireMeshTransport {
|
|
|
143
144
|
},
|
|
144
145
|
handleRoomRequest: this.roomRouter.handleRequest,
|
|
145
146
|
isTrusted: (deviceHex) => this.gatewayTrust.isTrusted(deviceHex),
|
|
147
|
+
forwardToLocalPeer: sendToLocalPeer.bind(null, this.peerSessions),
|
|
146
148
|
});
|
|
147
149
|
this.pendingConnectionTimeoutMs = pendingConnectionTimeoutMs;
|
|
148
150
|
this.getCurrentPresence = getCurrentPresence;
|
|
@@ -153,7 +155,7 @@ export class WireMeshTransport {
|
|
|
153
155
|
getHostedRooms !== undefined ||
|
|
154
156
|
getSelfAgentAdvert !== undefined) {
|
|
155
157
|
this.gossipInterval = setInterval(() => {
|
|
156
|
-
this.
|
|
158
|
+
readvertiseGossip(this.allSessions, this.hub, () => this.gatewayTrust.hasAny(), this.events.onError, this.getCurrentPresence, this.getHostedRooms, this.getSelfAgentAdvert);
|
|
157
159
|
}, presenceReadvertiseIntervalMs);
|
|
158
160
|
this.gossipInterval.unref();
|
|
159
161
|
}
|
|
@@ -196,28 +198,6 @@ export class WireMeshTransport {
|
|
|
196
198
|
this.events.onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
197
199
|
}
|
|
198
200
|
}
|
|
199
|
-
/** Re-sends this side's own current presence status and currently-hosted rooms, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever of the two sources is wired in, rather than a separate frame per fact. 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. A no-op tick (neither source wired in, or no sessions exist yet) is expected and silent. 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 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. */
|
|
200
|
-
readvertiseGossip() {
|
|
201
|
-
const extensions = {};
|
|
202
|
-
const status = this.getCurrentPresence?.();
|
|
203
|
-
if (status !== undefined)
|
|
204
|
-
extensions[PRESENCE_GOSSIP_KEY] = status;
|
|
205
|
-
const hostedRooms = this.getHostedRooms?.();
|
|
206
|
-
if (hostedRooms !== undefined)
|
|
207
|
-
extensions[HOSTED_ROOMS_GOSSIP_KEY] = hostedRooms;
|
|
208
|
-
const selfAgentAdvert = this.getSelfAgentAdvert?.();
|
|
209
|
-
if (selfAgentAdvert !== undefined)
|
|
210
|
-
extensions[AGENT_SELF_GOSSIP_KEY] = selfAgentAdvert;
|
|
211
|
-
if (Object.keys(extensions).length === 0)
|
|
212
|
-
return;
|
|
213
|
-
for (const session of this.allSessions) {
|
|
214
|
-
if (this.hub.ownsSession(session) && !this.gatewayTrust.hasAny())
|
|
215
|
-
continue;
|
|
216
|
-
session.sendGossipUpdate(extensions).catch((error) => {
|
|
217
|
-
this.events.onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
201
|
// -- Public getters --
|
|
222
202
|
get dataPort() {
|
|
223
203
|
return this._dataPort;
|
|
@@ -345,9 +325,10 @@ export class WireMeshTransport {
|
|
|
345
325
|
}
|
|
346
326
|
})();
|
|
347
327
|
}
|
|
348
|
-
/** Delegates the whole post-approval drain loop to roomRouter -- this transport no longer decodes or routes a MeshMessage itself, only hands the session off. Also starts this session's own independent revocationAnnouncements drain, since a gossiped revocation is not a manage-request and has no verb for roomRouter to dispatch. */
|
|
328
|
+
/** Delegates the whole post-approval drain loop to roomRouter -- this transport no longer decodes or routes a MeshMessage itself, only hands the session off. Also starts this session's own independent revocationAnnouncements drain, since a gossiped revocation is not a manage-request and has no verb for roomRouter to dispatch. Derives roomRouter's own allowOnBehalfOf gate itself, from whether this SPECIFIC handle's peer identity matches coordinatorDeviceHex -- never from which method established this particular session (mesh formation's reciprocal connectToPeer means the same coordinator device can just as easily reach this transport over an accepted connection as over the one connectToCoordinator itself dialled; see coordinatorDeviceHex's own field comment). A coordinator-less instance (coordinatorDeviceHex still undefined, e.g. this transport IS the coordinator) never allows it for anything. */
|
|
349
329
|
consumeIncoming(session, handle) {
|
|
350
|
-
this.
|
|
330
|
+
const allowOnBehalfOf = handle.id === this.coordinatorDeviceHex;
|
|
331
|
+
this.roomRouter.drainSession(session, handle, allowOnBehalfOf);
|
|
351
332
|
this.drainRevocationAnnouncements(session);
|
|
352
333
|
}
|
|
353
334
|
/** Reads every revocation-entry this session's peer announces, for as long as the session lives, handing each one to MeshStore via onRevocationAnnounce -- one call per entry, matching revocationAnnouncements' own per-entry flattening of a revocation-announce frame's entries array. */
|
|
@@ -432,6 +413,7 @@ export class WireMeshTransport {
|
|
|
432
413
|
const handle = {
|
|
433
414
|
id: deviceIdToHex(coordinatorDeviceId),
|
|
434
415
|
};
|
|
416
|
+
this.coordinatorDeviceHex = handle.id;
|
|
435
417
|
this.trackSession(handle.id, session);
|
|
436
418
|
this.consumeIncoming(session, handle);
|
|
437
419
|
this.watchForDisconnect(session, handle, handle.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-mesh-transport.js","sourceRoot":"","sources":["../../src/core/wire-mesh-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAA2B,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,GAIlB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iB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B,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAEhC,oWAAoW;QACpW,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;QAEpC,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAChC,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC;YACzD,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC;YACzD,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for agent-comms#184: a hub-relayed manage-request explicitly addressed (relay-data's own `to-device` field, surfaced as `IncomingManageRequest.toDevice` since wire-mesh#170, wire-mesh-core 1.48.1) to a NON-gateway local peer must be routed on to that peer's own local mesh session, not dispatched against the gateway's own local state the way gateway-forwarding.integration.test.ts's "routes a DM to a remote gateway's own agent" case already covers for the gateway itself. Also proves the request's true remote origin (b1) survives the forwarding hop intact -- room-router.ts's own "on-behalf-of" mechanism, not just delivery reaching the right recipient.
|
|
3
|
+
*
|
|
4
|
+
* Same three-party shape as gateway-forwarding.integration.test.ts: machine A has a coordinator (a1, the gateway, dialled to the hub) and a second, ordinary local peer (a2) that is never itself connected to the hub. Machine B (b1) reaches a2 purely through the hub's relay pairing with a1 -- if toDevice routing didn't exist, b1's request would land at a1's own DM state instead of a2's, since a1's hub session has no way to tell the two apart.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=hub-todevice-routing.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-todevice-routing.integration.test.d.ts","sourceRoot":"","sources":["../../src/test/hub-todevice-routing.integration.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for agent-comms#184: a hub-relayed manage-request explicitly addressed (relay-data's own `to-device` field, surfaced as `IncomingManageRequest.toDevice` since wire-mesh#170, wire-mesh-core 1.48.1) to a NON-gateway local peer must be routed on to that peer's own local mesh session, not dispatched against the gateway's own local state the way gateway-forwarding.integration.test.ts's "routes a DM to a remote gateway's own agent" case already covers for the gateway itself. Also proves the request's true remote origin (b1) survives the forwarding hop intact -- room-router.ts's own "on-behalf-of" mechanism, not just delivery reaching the right recipient.
|
|
3
|
+
*
|
|
4
|
+
* Same three-party shape as gateway-forwarding.integration.test.ts: machine A has a coordinator (a1, the gateway, dialled to the hub) and a second, ordinary local peer (a2) that is never itself connected to the hub. Machine B (b1) reaches a2 purely through the hub's relay pairing with a1 -- if toDevice routing didn't exist, b1's request would land at a1's own DM state instead of a2's, since a1's hub session has no way to tell the two apart.
|
|
5
|
+
*/
|
|
6
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
7
|
+
import { MeshStore } from "../core/mesh-store.js";
|
|
8
|
+
import { dmRoomPath } from "../core/room-path.js";
|
|
9
|
+
import { realHubOverWs } from "./hub-helpers.js";
|
|
10
|
+
import { wireTestTransport } from "./test-transport.js";
|
|
11
|
+
let nextPort = 22_500;
|
|
12
|
+
function freshPort() {
|
|
13
|
+
nextPort += 1;
|
|
14
|
+
return nextPort;
|
|
15
|
+
}
|
|
16
|
+
/** Short enough that a gossip re-advertisement (which carries a1's forwarded advert of a2) fires within a test's own poll budget, matching gateway-forwarding.integration.test.ts's own choice. */
|
|
17
|
+
const FAST_GOSSIP_INTERVAL_MS = 50;
|
|
18
|
+
const POLL_ATTEMPTS = 100;
|
|
19
|
+
const POLL_INTERVAL_MS = 50;
|
|
20
|
+
const sleep = async (ms) => new Promise((resolve) => {
|
|
21
|
+
setTimeout(resolve, ms);
|
|
22
|
+
});
|
|
23
|
+
/** Polls an async predicate until it holds -- gateway-forwarding.integration.test.ts's own established pattern for this, duplicated here rather than shared, since neither file exports it. */
|
|
24
|
+
async function waitFor(what, check) {
|
|
25
|
+
for (let i = 0; i < POLL_ATTEMPTS; i++) {
|
|
26
|
+
if (await check())
|
|
27
|
+
return;
|
|
28
|
+
await sleep(POLL_INTERVAL_MS);
|
|
29
|
+
}
|
|
30
|
+
expect(false, `timed out waiting for ${what}`).toBeTruthy();
|
|
31
|
+
}
|
|
32
|
+
const cleanups = [];
|
|
33
|
+
afterEach(async () => {
|
|
34
|
+
for (const close of cleanups.splice(0)) {
|
|
35
|
+
await close();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
describe("hub toDevice routing", () => {
|
|
39
|
+
it("routes a DM addressed to a non-gateway local peer to that peer's own state, not the gateway's", async () => {
|
|
40
|
+
const hub = await realHubOverWs();
|
|
41
|
+
cleanups.push(hub.close);
|
|
42
|
+
const a1 = new MeshStore(freshPort(), hub.url);
|
|
43
|
+
await wireTestTransport(a1, undefined, undefined, FAST_GOSSIP_INTERVAL_MS);
|
|
44
|
+
await a1.init();
|
|
45
|
+
cleanups.push(async () => a1.shutdown());
|
|
46
|
+
await a1.registerAgent({
|
|
47
|
+
name: "a1-gateway",
|
|
48
|
+
harness: "test",
|
|
49
|
+
cwd: "/test/a1",
|
|
50
|
+
pid: process.pid,
|
|
51
|
+
visibility: "visible",
|
|
52
|
+
tags: [],
|
|
53
|
+
});
|
|
54
|
+
const a2 = new MeshStore(a1.coordinatorPort, hub.url);
|
|
55
|
+
await wireTestTransport(a2, undefined, undefined, FAST_GOSSIP_INTERVAL_MS);
|
|
56
|
+
await a2.init();
|
|
57
|
+
cleanups.push(async () => a2.shutdown());
|
|
58
|
+
await a2.registerAgent({
|
|
59
|
+
name: "a2-local-peer",
|
|
60
|
+
harness: "test",
|
|
61
|
+
cwd: "/test/a2",
|
|
62
|
+
pid: process.pid,
|
|
63
|
+
visibility: "visible",
|
|
64
|
+
tags: [],
|
|
65
|
+
});
|
|
66
|
+
const b1 = new MeshStore(freshPort(), hub.url);
|
|
67
|
+
await wireTestTransport(b1, undefined, undefined, FAST_GOSSIP_INTERVAL_MS);
|
|
68
|
+
await b1.init();
|
|
69
|
+
cleanups.push(async () => b1.shutdown());
|
|
70
|
+
await b1.registerAgent({
|
|
71
|
+
name: "b1-remote",
|
|
72
|
+
harness: "test",
|
|
73
|
+
cwd: "/test/b1",
|
|
74
|
+
pid: process.pid,
|
|
75
|
+
visibility: "visible",
|
|
76
|
+
tags: [],
|
|
77
|
+
});
|
|
78
|
+
// Deny-all by default (agent-comms#156): a1 needs a trusted remote gateway to forward a2's advert onto the hub at all (forwardAdvertsToHub's own hasAny gate), b1 needs a2's own device-id specifically trusted for sendRoomRequest's own outbound isTrusted gate to route to it via the hub, and a1 needs b1 trusted for consume()'s own inbound gate on the relayed request's fromDevice.
|
|
79
|
+
a1.addTrustedGateway(b1.peerId);
|
|
80
|
+
b1.addTrustedGateway(a2.peerId);
|
|
81
|
+
// Waits for b1 to actually learn of a2 via the hub's own gossip/catch-up (mirroring gateway-forwarding.integration.test.ts's own first test) before addressing a request to it -- otherwise the relay hub has no adjacency entry for a2's device yet and silently drops the relay-connect (spec/relay-hub's own documented behaviour for an unknown target-device), which would time out for a reason unrelated to toDevice routing itself.
|
|
82
|
+
await waitFor("b1 to learn of a2 via the hub", async () => {
|
|
83
|
+
const agents = await b1.listAgents(b1.peerId);
|
|
84
|
+
return agents.some((agent) => agent.id === a2.peerId);
|
|
85
|
+
});
|
|
86
|
+
const dmPath = dmRoomPath(b1.peerId, a2.peerId);
|
|
87
|
+
const requestPromise = b1.requestDmAccess(a2.peerId);
|
|
88
|
+
await waitFor("a2 (not a1) to see b1's pending DM request, routed through a1's hub session via toDevice", async () => {
|
|
89
|
+
await Promise.resolve();
|
|
90
|
+
return a2.listPendingRoomJoins().length === 1;
|
|
91
|
+
});
|
|
92
|
+
const [pending] = a2.listPendingRoomJoins();
|
|
93
|
+
expect(pending?.roomPath).toBe(dmPath);
|
|
94
|
+
expect(pending?.requesterId).toBe(b1.peerId);
|
|
95
|
+
// The gateway's own DM state must never have seen this request: proves toDevice routing actually redirected it to a2 rather than a1 additionally absorbing a copy.
|
|
96
|
+
expect(a1.listPendingRoomJoins()).toHaveLength(0);
|
|
97
|
+
a2.acceptRoomJoin(dmPath, b1.peerId);
|
|
98
|
+
await requestPromise;
|
|
99
|
+
const message = await b1.sendDm(b1.peerId, a2.peerId, "hello from b1");
|
|
100
|
+
await waitFor("a2 to receive the DM via the hub, routed through a1", async () => {
|
|
101
|
+
const a2Dms = a2.serialise().dms[dmPath] ?? [];
|
|
102
|
+
return a2Dms.some((m) => m.id === message.id);
|
|
103
|
+
});
|
|
104
|
+
const delivered = (a2.serialise().dms[dmPath] ?? []).find((m) => m.id === message.id);
|
|
105
|
+
expect(delivered).toMatchObject({
|
|
106
|
+
from: b1.peerId,
|
|
107
|
+
to: a2.peerId,
|
|
108
|
+
content: "hello from b1",
|
|
109
|
+
});
|
|
110
|
+
// Again: the gateway's own DM state must stay empty throughout -- the message belongs to a2, never a1.
|
|
111
|
+
expect(a1.serialise().dms[dmPath] ?? []).toHaveLength(0);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
//# sourceMappingURL=hub-todevice-routing.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-todevice-routing.integration.test.js","sourceRoot":"","sources":["../../src/test/hub-todevice-routing.integration.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,IAAI,QAAQ,GAAG,MAAM,CAAC;AACtB,SAAS,SAAS;IAChB,QAAQ,IAAI,CAAC,CAAC;IACd,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,mMAAmM;AACnM,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,KAAK,GAAG,KAAK,EAAE,EAAU,EAAiB,EAAE,CAChD,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;IAC5B,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEL,+LAA+L;AAC/L,KAAK,UAAU,OAAO,CACpB,IAAY,EACZ,KAA6B;IAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,MAAM,KAAK,EAAE;YAAE,OAAO;QAC1B,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAChC,CAAC;IACD,M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CAAC;QAChD,CAAC,CACF,CAAC;QAEF,MAAM,SAAS,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAC3B,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC;YAC9B,IAAI,EAAE,EAAE,CAAC,MAAM;YACf,EAAE,EAAE,EAAE,CAAC,MAAM;YACb,OAAO,EAAE,eAAe;SACzB,CAAC,CAAC;QACH,uGAAuG;QACvG,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-comms",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Cross-harness communication mesh for LLM agents — rooms, DMs, presence, and real-time push delivery over TCP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"cc-peer": "1.4.1",
|
|
104
104
|
"preact": "10.29.7",
|
|
105
105
|
"typebox": "1.3.6",
|
|
106
|
-
"wire-mesh-core": "1.
|
|
106
|
+
"wire-mesh-core": "1.48.2",
|
|
107
107
|
"ws": "8.21.1",
|
|
108
108
|
"zod": "4.4.3"
|
|
109
109
|
},
|