wire-mesh-core 1.53.0 → 1.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/adapters/frame-codec.d.cts +1 -1
  2. package/dist/adapters/frame-codec.d.mts +1 -1
  3. package/dist/adapters/node-identity.d.cts +2 -2
  4. package/dist/adapters/node-identity.d.mts +2 -2
  5. package/dist/adapters/tcp-transport.d.cts +1 -1
  6. package/dist/adapters/tcp-transport.d.mts +1 -1
  7. package/dist/adapters/threshold-identity.d.cts +2 -2
  8. package/dist/adapters/threshold-identity.d.mts +2 -2
  9. package/dist/adapters/threshold-wasm.d.cts +1 -1
  10. package/dist/adapters/threshold-wasm.d.mts +1 -1
  11. package/dist/adapters/tls-transport.d.cts +1 -1
  12. package/dist/adapters/tls-transport.d.mts +1 -1
  13. package/dist/domain/bulk.d.cts +2 -2
  14. package/dist/domain/bulk.d.mts +2 -2
  15. package/dist/domain/capability-grant.d.cts +3 -3
  16. package/dist/domain/capability-grant.d.mts +3 -3
  17. package/dist/domain/capability-request.d.cts +2 -2
  18. package/dist/domain/capability-request.d.mts +2 -2
  19. package/dist/domain/data-sync.d.cts +2 -2
  20. package/dist/domain/data-sync.d.mts +2 -2
  21. package/dist/domain/device-id.d.cts +1 -1
  22. package/dist/domain/device-id.d.mts +1 -1
  23. package/dist/domain/gossip-expansion.cjs +44 -0
  24. package/dist/domain/gossip-expansion.d.cts +29 -0
  25. package/dist/domain/gossip-expansion.d.mts +29 -0
  26. package/dist/domain/gossip-expansion.mjs +43 -0
  27. package/dist/domain/grant-candidates.d.cts +1 -1
  28. package/dist/domain/grant-candidates.d.mts +1 -1
  29. package/dist/domain/handshake.d.cts +1 -1
  30. package/dist/domain/handshake.d.mts +1 -1
  31. package/dist/domain/mesh-session.cjs +74 -13
  32. package/dist/domain/mesh-session.d.cts +10 -4
  33. package/dist/domain/mesh-session.d.mts +10 -4
  34. package/dist/domain/mesh-session.mjs +74 -13
  35. package/dist/domain/notice-board.d.cts +3 -3
  36. package/dist/domain/notice-board.d.mts +3 -3
  37. package/dist/domain/relay-hub.cjs +6 -0
  38. package/dist/domain/relay-hub.d.cts +3 -3
  39. package/dist/domain/relay-hub.d.mts +3 -3
  40. package/dist/domain/relay-hub.mjs +6 -0
  41. package/dist/domain/relay-use-gate.d.cts +2 -2
  42. package/dist/domain/relay-use-gate.d.mts +2 -2
  43. package/dist/domain/revocation-view.d.cts +2 -2
  44. package/dist/domain/revocation-view.d.mts +2 -2
  45. package/dist/domain/room-rekey.d.cts +3 -3
  46. package/dist/domain/room-rekey.d.mts +3 -3
  47. package/dist/domain/room-token-verification.d.cts +1 -1
  48. package/dist/domain/room-token-verification.d.mts +1 -1
  49. package/dist/domain/room.d.cts +4 -4
  50. package/dist/domain/room.d.mts +4 -4
  51. package/dist/domain/shard-manifest.d.cts +1 -1
  52. package/dist/domain/shard-manifest.d.mts +1 -1
  53. package/dist/domain/tokens.d.cts +1 -1
  54. package/dist/domain/tokens.d.mts +1 -1
  55. package/dist/domain/webrtc-signaling.d.cts +2 -2
  56. package/dist/domain/webrtc-signaling.d.mts +2 -2
  57. package/dist/generated/protocol.cjs +12 -0
  58. package/dist/generated/protocol.d.cts +2 -2
  59. package/dist/generated/protocol.d.mts +2 -2
  60. package/dist/generated/protocol.mjs +10 -1
  61. package/dist/{identity-9TmmK7vP.d.mts → identity-BXrJ6_YM.d.mts} +1 -1
  62. package/dist/{identity-CUkDHCRK.d.cts → identity-CmD4l_Mp.d.cts} +1 -1
  63. package/dist/ports/identity.d.cts +1 -1
  64. package/dist/ports/identity.d.mts +1 -1
  65. package/dist/ports/transport.d.cts +1 -1
  66. package/dist/ports/transport.d.mts +1 -1
  67. package/dist/{protocol-CNFRVx9w.d.cts → protocol-PhUVprXA.d.cts} +34 -6
  68. package/dist/{protocol-CNFRVx9w.d.mts → protocol-PhUVprXA.d.mts} +34 -6
  69. package/dist/{room-token-verification-BdtM1rQ4.d.mts → room-token-verification-D8HndWYM.d.cts} +2 -2
  70. package/dist/{room-token-verification-DpOfZOdl.d.cts → room-token-verification-Dv1O6-FV.d.mts} +2 -2
  71. package/dist/{tokens-CVyPoJ6l.d.mts → tokens-BVrgBeqF.d.mts} +2 -2
  72. package/dist/{tokens-Cl8sQo7o.d.cts → tokens-DIPzZ9JJ.d.cts} +2 -2
  73. package/dist/{transport-C7KVkhgb.d.mts → transport-CbXX1Xd-.d.cts} +1 -1
  74. package/dist/{transport-De0zHlaA.d.cts → transport-DG9ouGe-.d.mts} +1 -1
  75. package/package.json +5 -1
@@ -1,7 +1,7 @@
1
- import { D as DeviceId, E as DataRequestFrame, N as Frame, Q as PeerAdvert, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-CNFRVx9w.cjs";
2
- import { t as IdentityPort } from "../identity-CUkDHCRK.cjs";
1
+ import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, lt as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-PhUVprXA.cjs";
2
+ import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.cjs";
4
- import { r as Transport, t as Connection } from "../transport-De0zHlaA.cjs";
4
+ import { r as Transport, t as Connection } from "../transport-CbXX1Xd-.cjs";
5
5
  //#region src/domain/mesh-session.d.ts
6
6
  /** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
7
7
  export declare const HANDSHAKE_TIMEOUT_MS = 3000;
@@ -79,6 +79,8 @@ export interface MeshSession {
79
79
  readonly revocationAnnouncements: AsyncIterable<RevocationEntry>;
80
80
  connect: (address: string, localDomains: readonly string[]) => Promise<void>;
81
81
  sendPing: () => Promise<void>;
82
+ /** Sends a ping-frame and resolves with the round-trip time in milliseconds once the correlated pong-frame arrives -- FIFO-paired against this call's own ping, since ping-frame carries no correlation id of its own (spec/transport.cddl): the Nth call's own promise resolves against the Nth pong received after it, never matched by any other means. Rejects if the connection closes, or (when timeoutMs is given) if no pong arrives within timeoutMs, rather than resolving a sentinel value the way sendManageRequest's own timeout does -- there is no natural "no answer" value for a bare millisecond count to double as. Unlike sendPing (fire-and-forget, answered by nothing on an ordinary peer connection), this is answered only by a peer that replies to ping with pong -- today, relay-hub's own frame handling (wire-mesh#181) -- so calling this against a connection to a plain peer that never sends pong hangs until timeoutMs (if given) or forever. Exists to isolate the sender-to-hub leg of a relayed path.trace round trip: time this over the same connection a relayed manage-request travelled, then subtract it from path.trace's own end-to-end RTT to recover the hub-to-target leg. */
83
+ sendPingMeasureRtt: (timeoutMs?: number) => Promise<number>;
82
84
  /** Attaches this token to every `manage-request` sent from now on. */
83
85
  setToken: (token: CapabilityToken) => void;
84
86
  /** Announces one or more already-minted revocation-entries to the peer. Sent directly over the connection, never relay-wrapped -- revocation-announce is a gossiped broadcast, not a request addressed to a specific peer, so it has no targetDevice/token parameters the way sendManageRequest does. */
@@ -93,7 +95,9 @@ export interface MeshSession {
93
95
  }
94
96
  export declare function createMeshSession(transport: Readonly<Transport>, identity: Readonly<IdentityPort>, clock?: Readonly<Clock>, reconnect?: ReconnectPolicy | null,
95
97
  /** This node's own directly-reachable "host:port" candidates (wire-mesh#38), advertised in this session's self-advert so other peers can attempt a direct connection instead of always falling back to a relay. Omit (or pass none) for a caller with nothing to offer, e.g. a browser client. */
96
- addresses?: readonly string[]): MeshSession;
98
+ addresses?: readonly string[],
99
+ /** Fired for every peer-advert entry as it's applied to the directory, regardless of source -- the hook a gossip-expansion consumer (wire-mesh#187, gossip-expansion.ts's own createGossipExpansion) uses to observe newly-gossiped peers without becoming a second, competing consumer of this session's own single-reader events stream (each emitted SessionEvent wakes at most one waiter, so a second for-await loop over events would silently steal events from whichever consumer already reads it). Omit for a caller with no use for it, exactly today's behaviour. */
100
+ onPeerAdvert?: (advert: PeerAdvert) => void): MeshSession;
97
101
  /** A MeshSession built over a connection that already exists (a Transport's own listen() handed it to onConnection), extended with the one thing a dial-side session can't offer: the device-id of the specific peer at the other end. Unlike createMeshSession, which may end up talking to a relay gossiping about many devices at once, an accepted connection is the agent-comms case -- exactly two peers, directly connected -- so "the peer" is well-defined here in a way it structurally isn't for the dial side. */
98
102
  export interface AcceptedMeshSession extends MeshSession {
99
103
  /** Resolves with the device-id carried by the first peer-advert this connection's remote sends -- the same self-advertisement mechanism createMeshSession's own directory already relies on for every peer, just narrowed to "the one peer this specific connection is with" rather than accumulated into a directory of possibly many. There is no transport-level authentication behind this yet (see wire-mesh#45's own createTlsTransport item): it is only as trustworthy as the remote's own gossip, exactly the same trust level the dial-side directory already has for every entry in it. */
@@ -109,6 +113,8 @@ export interface AcceptedMeshSessionOptions {
109
113
  onFrame?: (connection: Readonly<Connection>, frame: Frame) => void | Promise<void>;
110
114
  /** Fired once this session's own connection.receive() stream ends -- the counterpart a RelayHub's own forgetConnection needs, since its registry is keyed by this exact Connection and must be cleaned up when it specifically ends. */
111
115
  onSessionEnd?: (connection: Readonly<Connection>) => void;
116
+ /** Fired for every peer-advert entry as it's applied to the directory, regardless of source -- alongside (never instead of) this session's own internal peerDeviceId resolution, which uses this identical hook internally and keeps working unchanged. See createMeshSession's own onPeerAdvert doc comment for why this exists: a gossip-expansion consumer (wire-mesh#187) needs to observe every advert without becoming a second, competing consumer of this session's own single-reader events stream. */
117
+ onPeerAdvert?: (advert: PeerAdvert) => void;
112
118
  }
113
119
  /** Wires an already-accepted Connection up as a full MeshSession, mirroring exactly what createMeshSession's own dial path does once a connection exists (send handshake, send self-advert, negotiate, consume frames) -- the wire-mesh#45 prerequisite agent-comms needs, since its peers both listen and dial rather than only ever dialing the way web-console's own console UI does. Reconnect does not apply here: if this connection drops, only the remote redialing and being accepted again produces a new connection, and therefore a new session -- there is nothing on this side to retry. */
114
120
  export declare function acceptMeshSession(connection: Readonly<Connection>, identity: Readonly<IdentityPort>, localDomains: readonly string[], options?: Readonly<AcceptedMeshSessionOptions>): Promise<AcceptedMeshSession>;
@@ -1,7 +1,7 @@
1
- import { D as DeviceId, E as DataRequestFrame, N as Frame, Q as PeerAdvert, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-CNFRVx9w.mjs";
2
- import { t as IdentityPort } from "../identity-9TmmK7vP.mjs";
1
+ import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, lt as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-PhUVprXA.mjs";
2
+ import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.mjs";
4
- import { r as Transport, t as Connection } from "../transport-C7KVkhgb.mjs";
4
+ import { r as Transport, t as Connection } from "../transport-DG9ouGe-.mjs";
5
5
  //#region src/domain/mesh-session.d.ts
6
6
  /** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
7
7
  export declare const HANDSHAKE_TIMEOUT_MS = 3000;
@@ -79,6 +79,8 @@ export interface MeshSession {
79
79
  readonly revocationAnnouncements: AsyncIterable<RevocationEntry>;
80
80
  connect: (address: string, localDomains: readonly string[]) => Promise<void>;
81
81
  sendPing: () => Promise<void>;
82
+ /** Sends a ping-frame and resolves with the round-trip time in milliseconds once the correlated pong-frame arrives -- FIFO-paired against this call's own ping, since ping-frame carries no correlation id of its own (spec/transport.cddl): the Nth call's own promise resolves against the Nth pong received after it, never matched by any other means. Rejects if the connection closes, or (when timeoutMs is given) if no pong arrives within timeoutMs, rather than resolving a sentinel value the way sendManageRequest's own timeout does -- there is no natural "no answer" value for a bare millisecond count to double as. Unlike sendPing (fire-and-forget, answered by nothing on an ordinary peer connection), this is answered only by a peer that replies to ping with pong -- today, relay-hub's own frame handling (wire-mesh#181) -- so calling this against a connection to a plain peer that never sends pong hangs until timeoutMs (if given) or forever. Exists to isolate the sender-to-hub leg of a relayed path.trace round trip: time this over the same connection a relayed manage-request travelled, then subtract it from path.trace's own end-to-end RTT to recover the hub-to-target leg. */
83
+ sendPingMeasureRtt: (timeoutMs?: number) => Promise<number>;
82
84
  /** Attaches this token to every `manage-request` sent from now on. */
83
85
  setToken: (token: CapabilityToken) => void;
84
86
  /** Announces one or more already-minted revocation-entries to the peer. Sent directly over the connection, never relay-wrapped -- revocation-announce is a gossiped broadcast, not a request addressed to a specific peer, so it has no targetDevice/token parameters the way sendManageRequest does. */
@@ -93,7 +95,9 @@ export interface MeshSession {
93
95
  }
94
96
  export declare function createMeshSession(transport: Readonly<Transport>, identity: Readonly<IdentityPort>, clock?: Readonly<Clock>, reconnect?: ReconnectPolicy | null,
95
97
  /** This node's own directly-reachable "host:port" candidates (wire-mesh#38), advertised in this session's self-advert so other peers can attempt a direct connection instead of always falling back to a relay. Omit (or pass none) for a caller with nothing to offer, e.g. a browser client. */
96
- addresses?: readonly string[]): MeshSession;
98
+ addresses?: readonly string[],
99
+ /** Fired for every peer-advert entry as it's applied to the directory, regardless of source -- the hook a gossip-expansion consumer (wire-mesh#187, gossip-expansion.ts's own createGossipExpansion) uses to observe newly-gossiped peers without becoming a second, competing consumer of this session's own single-reader events stream (each emitted SessionEvent wakes at most one waiter, so a second for-await loop over events would silently steal events from whichever consumer already reads it). Omit for a caller with no use for it, exactly today's behaviour. */
100
+ onPeerAdvert?: (advert: PeerAdvert) => void): MeshSession;
97
101
  /** A MeshSession built over a connection that already exists (a Transport's own listen() handed it to onConnection), extended with the one thing a dial-side session can't offer: the device-id of the specific peer at the other end. Unlike createMeshSession, which may end up talking to a relay gossiping about many devices at once, an accepted connection is the agent-comms case -- exactly two peers, directly connected -- so "the peer" is well-defined here in a way it structurally isn't for the dial side. */
98
102
  export interface AcceptedMeshSession extends MeshSession {
99
103
  /** Resolves with the device-id carried by the first peer-advert this connection's remote sends -- the same self-advertisement mechanism createMeshSession's own directory already relies on for every peer, just narrowed to "the one peer this specific connection is with" rather than accumulated into a directory of possibly many. There is no transport-level authentication behind this yet (see wire-mesh#45's own createTlsTransport item): it is only as trustworthy as the remote's own gossip, exactly the same trust level the dial-side directory already has for every entry in it. */
@@ -109,6 +113,8 @@ export interface AcceptedMeshSessionOptions {
109
113
  onFrame?: (connection: Readonly<Connection>, frame: Frame) => void | Promise<void>;
110
114
  /** Fired once this session's own connection.receive() stream ends -- the counterpart a RelayHub's own forgetConnection needs, since its registry is keyed by this exact Connection and must be cleaned up when it specifically ends. */
111
115
  onSessionEnd?: (connection: Readonly<Connection>) => void;
116
+ /** Fired for every peer-advert entry as it's applied to the directory, regardless of source -- alongside (never instead of) this session's own internal peerDeviceId resolution, which uses this identical hook internally and keeps working unchanged. See createMeshSession's own onPeerAdvert doc comment for why this exists: a gossip-expansion consumer (wire-mesh#187) needs to observe every advert without becoming a second, competing consumer of this session's own single-reader events stream. */
117
+ onPeerAdvert?: (advert: PeerAdvert) => void;
112
118
  }
113
119
  /** Wires an already-accepted Connection up as a full MeshSession, mirroring exactly what createMeshSession's own dial path does once a connection exists (send handshake, send self-advert, negotiate, consume frames) -- the wire-mesh#45 prerequisite agent-comms needs, since its peers both listen and dial rather than only ever dialing the way web-console's own console UI does. Reconnect does not apply here: if this connection drops, only the remote redialing and being accepted again produces a new connection, and therefore a new session -- there is nothing on this side to retry. */
114
120
  export declare function acceptMeshSession(connection: Readonly<Connection>, identity: Readonly<IdentityPort>, localDomains: readonly string[], options?: Readonly<AcceptedMeshSessionOptions>): Promise<AcceptedMeshSession>;
@@ -12,8 +12,43 @@ function createRelayPairings() {
12
12
  };
13
13
  }
14
14
  //#endregion
15
- //#region src/domain/mesh-session.ts
16
- const MS_PER_SECOND = 1e3;
15
+ //#region src/domain/ping-round-trips.ts
16
+ function createPingRoundTrips() {
17
+ const pending = [];
18
+ function cancel(sentAt) {
19
+ const index = pending.findIndex((entry) => entry.sentAt === sentAt);
20
+ if (index === -1) return false;
21
+ pending.splice(index, 1);
22
+ return true;
23
+ }
24
+ return {
25
+ resolveOldest(nowMs) {
26
+ const entry = pending.shift();
27
+ if (entry !== void 0) entry.resolve(nowMs - entry.sentAt);
28
+ },
29
+ rejectAll(reason) {
30
+ for (const entry of pending.splice(0)) entry.reject(new Error(reason));
31
+ },
32
+ async sendAndAwait(sentAt, sendPing, timeoutMs) {
33
+ const rtt = new Promise((resolve, reject) => {
34
+ pending.push({
35
+ sentAt,
36
+ resolve,
37
+ reject
38
+ });
39
+ });
40
+ await sendPing();
41
+ if (timeoutMs === void 0) return rtt;
42
+ return Promise.race([rtt, new Promise((_resolve, reject) => {
43
+ setTimeout(() => {
44
+ if (cancel(sentAt)) reject(/* @__PURE__ */ new Error("timed out waiting for pong"));
45
+ }, timeoutMs);
46
+ })]);
47
+ }
48
+ };
49
+ }
50
+ //#endregion
51
+ //#region src/domain/gossip-extensions.ts
17
52
  /** peer-advert's own three typed fields -- reserved so a `sendGossipUpdate` caller can never override the session's own device-id, address list, or freshness timestamp by supplying an extension of the same name. */
18
53
  const RESERVED_PEER_ADVERT_KEYS = /* @__PURE__ */ new Set([
19
54
  "device",
@@ -29,6 +64,9 @@ function validateGossipExtensions(extensions) {
29
64
  if (!GOSSIP_EXTENSION_KEY_PATTERN.test(key)) throw new Error(`sendGossipUpdate extension key "${key}" must be domain-qualified as "<domain>/<field>" (e.g. "presence/status")`);
30
65
  }
31
66
  }
67
+ //#endregion
68
+ //#region src/domain/mesh-session.ts
69
+ const MS_PER_SECOND = 1e3;
32
70
  /** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
33
71
  const HANDSHAKE_TIMEOUT_MS = 3e3;
34
72
  function localHandshake(domains) {
@@ -61,6 +99,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
61
99
  const incomingBacklog = [];
62
100
  const revocationWaiters = [];
63
101
  const revocationBacklog = [];
102
+ const pingRoundTrips = createPingRoundTrips();
64
103
  function snapshot() {
65
104
  return {
66
105
  state,
@@ -100,6 +139,11 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
100
139
  ...token !== null ? { token } : {}
101
140
  };
102
141
  }
142
+ /** The "not connected" guard every send* method on the public session needs, deduplicated into one place rather than repeated inline at each call site: throws unless there is a live connection AND the session's own state machine agrees it is "connected" (transmit's own connection===null check alone doesn't cover the latter). Returns the connection itself, narrowed non-null, for a caller that needs to send directly on it (sendPing/sendPingMeasureRtt); a caller that only needs the throwing side effect (sendManageRequest and friends, which go through transmit instead) calls this and discards the result. */
143
+ function requireConnectedLink() {
144
+ if (connection === null || state.status !== "connected") throw new Error("not connected");
145
+ return connection;
146
+ }
103
147
  /** Sends a frame, wrapping it as relay-data first when viaRelay is set -- the single choke point every outbound manage-request/manage-response passes through, so a consumer of sendManageRequest/respond never needs its own relay-wrapping logic. When relaying, toDevice is stamped onto the outer relay-data-frame's own `to-device` field so the hub addresses it to the correct pairing directly (wire-mesh#30) rather than falling back to whichever pairing it last saw -- the one case this is omitted is a response to a request that itself arrived with no from-device to echo back, which is left to that same hub fallback exactly as an unaddressed relay-data always has been. */
104
148
  async function transmit(frame, viaRelay, toDevice) {
105
149
  if (connection === null) throw new Error("not connected");
@@ -177,6 +221,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
177
221
  else if (frame.type === "relay-inbound") relayPairings.add(frame["source-device"]);
178
222
  else if (frame.type === "manage-response") applyManageResponse(frame);
179
223
  else if (frame.type === "manage-request") applyManageRequest(frame);
224
+ else if (frame.type === "pong") pingRoundTrips.resolveOldest(clock.now());
180
225
  else if (frame.type === "revocation-announce") for (const entry of frame.entries) emitRevocationEntry(entry);
181
226
  }
182
227
  /** Establishes a relay-connect pairing to targetDevice if this session isn't already paired with it -- a no-op when it already is, whether that pairing was established by this session's own prior relay-connect (initiator role) or learned from an incoming relay-inbound (target role, replying back to whoever dialed it). Pairing with a new target never tears down an existing pairing with a different one: this connection can hold several simultaneously (wire-mesh#30's own multiplexed adjacency map), so a later request back to an already-paired target must not re-send relay-connect for it. relay-connect has no ack frame: the initiator proceeds to relay-data right after sending it. */
@@ -219,6 +264,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
219
264
  function handleDisconnect(reason, address, localDomains) {
220
265
  if (feedCancelled) return;
221
266
  rejectPendingManageRequests("disconnected before a response arrived");
267
+ pingRoundTrips.rejectAll("disconnected before a pong arrived");
222
268
  if (reconnect !== null && attempt < reconnect.maxAttempts) {
223
269
  attempt += 1;
224
270
  const currentAttempt = attempt;
@@ -377,20 +423,32 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
377
423
  await doConnect(address, localDomains);
378
424
  },
379
425
  async sendPing() {
380
- if (connection === null || state.status !== "connected") throw new Error("not connected");
426
+ const link = requireConnectedLink();
381
427
  const ping = { type: "ping" };
382
428
  frameLog.push({
383
429
  direction: "sent",
384
430
  frame: ping
385
431
  });
386
- await connection.send(ping);
432
+ await link.send(ping);
387
433
  emit();
388
434
  },
435
+ async sendPingMeasureRtt(timeoutMs) {
436
+ const link = requireConnectedLink();
437
+ return pingRoundTrips.sendAndAwait(clock.now(), async () => {
438
+ const ping = { type: "ping" };
439
+ frameLog.push({
440
+ direction: "sent",
441
+ frame: ping
442
+ });
443
+ await link.send(ping);
444
+ emit();
445
+ }, timeoutMs);
446
+ },
389
447
  setToken(token) {
390
448
  currentToken = token;
391
449
  },
392
450
  async sendManageRequest(command, scope, targetDevice, token, timeoutMs) {
393
- if (connection === null || state.status !== "connected") throw new Error("not connected");
451
+ requireConnectedLink();
394
452
  if (targetDevice !== void 0) await ensureRelayPairing(targetDevice);
395
453
  const frame = buildManageRequest(command, scope, token);
396
454
  const requestId = frame["request-id"];
@@ -417,7 +475,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
417
475
  })]);
418
476
  },
419
477
  async sendRevocationAnnounce(entries) {
420
- if (connection === null || state.status !== "connected") throw new Error("not connected");
478
+ requireConnectedLink();
421
479
  const frame = {
422
480
  type: "revocation-announce",
423
481
  entries: [...entries]
@@ -430,7 +488,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
430
488
  emit();
431
489
  },
432
490
  async sendGossipUpdate(extensions) {
433
- if (connection === null || state.status !== "connected") throw new Error("not connected");
491
+ requireConnectedLink();
434
492
  const frame = buildSelfAdvert(extensions);
435
493
  frameLog.push({
436
494
  direction: "sent",
@@ -440,7 +498,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
440
498
  emit();
441
499
  },
442
500
  async sendDataFrame(frame) {
443
- if (connection === null || state.status !== "connected") throw new Error("not connected");
501
+ requireConnectedLink();
444
502
  frameLog.push({
445
503
  direction: "sent",
446
504
  frame
@@ -459,6 +517,7 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
459
517
  reconnectTimer = null;
460
518
  }
461
519
  rejectPendingManageRequests("connection closed before a response arrived");
520
+ pingRoundTrips.rejectAll("connection closed before a pong arrived");
462
521
  if (connection !== null) await connection.close();
463
522
  if (state.status === "connected" || state.status === "connecting" || state.status === "reconnecting") state = {
464
523
  status: "closed",
@@ -470,8 +529,8 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
470
529
  }
471
530
  };
472
531
  }
473
- function createMeshSession(transport, identity, clock = { now: () => Date.now() }, reconnect = null, addresses = []) {
474
- const { session } = createSessionCore(identity, clock, reconnect, async (address) => transport.connect(address), void 0, addresses);
532
+ function createMeshSession(transport, identity, clock = { now: () => Date.now() }, reconnect = null, addresses = [], onPeerAdvert) {
533
+ const { session } = createSessionCore(identity, clock, reconnect, async (address) => transport.connect(address), onPeerAdvert, addresses);
475
534
  return session;
476
535
  }
477
536
  /** Wires an already-accepted Connection up as a full MeshSession, mirroring exactly what createMeshSession's own dial path does once a connection exists (send handshake, send self-advert, negotiate, consume frames) -- the wire-mesh#45 prerequisite agent-comms needs, since its peers both listen and dial rather than only ever dialing the way web-console's own console UI does. Reconnect does not apply here: if this connection drops, only the remote redialing and being accepted again produces a new connection, and therefore a new session -- there is nothing on this side to retry. */
@@ -483,9 +542,11 @@ async function acceptMeshSession(connection, identity, localDomains, options = {
483
542
  });
484
543
  let peerDeviceIdResolved = false;
485
544
  const { session, wireUpConnection } = createSessionCore(identity, clock, null, null, (advert) => {
486
- if (peerDeviceIdResolved) return;
487
- peerDeviceIdResolved = true;
488
- resolvePeerDeviceId?.(advert.device);
545
+ if (!peerDeviceIdResolved) {
546
+ peerDeviceIdResolved = true;
547
+ resolvePeerDeviceId?.(advert.device);
548
+ }
549
+ options.onPeerAdvert?.(advert);
489
550
  }, options.addresses, options.onFrame, options.onSessionEnd);
490
551
  await wireUpConnection(connection, options.label ?? "accepted", localDomains);
491
552
  return {
@@ -1,8 +1,8 @@
1
- import { D as DeviceId, Et as RoomNoticeClaims, T as DataHaveFrame, Tt as RoomNotice, p as CapabilityToken } from "../protocol-CNFRVx9w.cjs";
1
+ import { D as DeviceId, Ot as RoomNotice, T as DataHaveFrame, kt as RoomNoticeClaims, p as CapabilityToken } from "../protocol-PhUVprXA.cjs";
2
2
  import { KeyValueStorage } from "../ports/storage.cjs";
3
- import { t as IdentityPort } from "../identity-CUkDHCRK.cjs";
3
+ import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
4
4
  import { t as Clock } from "../clock-DiSx-WKM.cjs";
5
- import { a as RevocationCheck } from "../tokens-Cl8sQo7o.cjs";
5
+ import { a as RevocationCheck } from "../tokens-DIPzZ9JJ.cjs";
6
6
  import { RoomNoticeVerdictReason } from "./room.cjs";
7
7
  //#region src/domain/notice-board.d.ts
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { D as DeviceId, Et as RoomNoticeClaims, T as DataHaveFrame, Tt as RoomNotice, p as CapabilityToken } from "../protocol-CNFRVx9w.mjs";
1
+ import { D as DeviceId, Ot as RoomNotice, T as DataHaveFrame, kt as RoomNoticeClaims, p as CapabilityToken } from "../protocol-PhUVprXA.mjs";
2
2
  import { KeyValueStorage } from "../ports/storage.mjs";
3
- import { t as IdentityPort } from "../identity-9TmmK7vP.mjs";
3
+ import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
4
4
  import { t as Clock } from "../clock-DiSx-WKM.mjs";
5
- import { a as RevocationCheck } from "../tokens-CVyPoJ6l.mjs";
5
+ import { a as RevocationCheck } from "../tokens-BVrgBeqF.mjs";
6
6
  import { RoomNoticeVerdictReason } from "./room.mjs";
7
7
  //#region src/domain/notice-board.d.ts
8
8
  /**
@@ -95,6 +95,12 @@ function createRelayHub() {
95
95
  });
96
96
  return;
97
97
  }
98
+ if (frame.type === "ping") {
99
+ try {
100
+ await connection.send({ type: "pong" });
101
+ } catch {}
102
+ return;
103
+ }
98
104
  }
99
105
  return {
100
106
  async handleConnection(connection) {
@@ -1,8 +1,8 @@
1
- import { N as Frame } from "../protocol-CNFRVx9w.cjs";
2
- import { t as Connection } from "../transport-De0zHlaA.cjs";
1
+ import { N as Frame } from "../protocol-PhUVprXA.cjs";
2
+ import { t as Connection } from "../transport-CbXX1Xd-.cjs";
3
3
  //#region src/domain/relay-hub.d.ts
4
4
  export interface RelayHub {
5
- /** Drives one accepted connection until it closes: registers gossip-advertised devices, re-broadcasts each gossip frame to every other connected client and replies to the gossiping connection with a catch-up frame of every other already-known device, answers relay-connect by pairing and notifying the target, and forwards relay-data within established pairings. Resolves when the connection's frame stream ends. Internally just registerConnection followed by a loop of onFrame calls and a final onDisconnect -- kept as its own method since a dedicated hub deployment (wire-mesh-node/cloudflare-hub) has nothing else driving the connection and wants the whole lifecycle in one call. */
5
+ /** Drives one accepted connection until it closes: registers gossip-advertised devices, re-broadcasts each gossip frame to every other connected client and replies to the gossiping connection with a catch-up frame of every other already-known device, answers relay-connect by pairing and notifying the target, forwards relay-data within established pairings, and replies to a bare ping with a bare pong (wire-mesh#181) so a client can time its own sender-to-hub leg independent of anything being relayed. Resolves when the connection's frame stream ends. Internally just registerConnection followed by a loop of onFrame calls and a final onDisconnect -- kept as its own method since a dedicated hub deployment (wire-mesh-node/cloudflare-hub) has nothing else driving the connection and wants the whole lifecycle in one call. */
6
6
  handleConnection: (connection: Readonly<Connection>) => Promise<void>;
7
7
  /** Registers a connection with this hub without taking over its own frame-consumption loop (wire-mesh#102) -- the entry point an "ordinary opted-in node relays for peers it's already talking to" uses, alongside onFrame/onDisconnect below, to let a MeshSession's own single connection.receive() loop drive this hub rather than running a second, competing one. Must be called once, before the first onFrame call for this connection, so gossip fan-out (which forwards to every OTHER registered connection) already sees it. */
8
8
  registerConnection: (connection: Readonly<Connection>) => void;
@@ -1,8 +1,8 @@
1
- import { N as Frame } from "../protocol-CNFRVx9w.mjs";
2
- import { t as Connection } from "../transport-C7KVkhgb.mjs";
1
+ import { N as Frame } from "../protocol-PhUVprXA.mjs";
2
+ import { t as Connection } from "../transport-DG9ouGe-.mjs";
3
3
  //#region src/domain/relay-hub.d.ts
4
4
  export interface RelayHub {
5
- /** Drives one accepted connection until it closes: registers gossip-advertised devices, re-broadcasts each gossip frame to every other connected client and replies to the gossiping connection with a catch-up frame of every other already-known device, answers relay-connect by pairing and notifying the target, and forwards relay-data within established pairings. Resolves when the connection's frame stream ends. Internally just registerConnection followed by a loop of onFrame calls and a final onDisconnect -- kept as its own method since a dedicated hub deployment (wire-mesh-node/cloudflare-hub) has nothing else driving the connection and wants the whole lifecycle in one call. */
5
+ /** Drives one accepted connection until it closes: registers gossip-advertised devices, re-broadcasts each gossip frame to every other connected client and replies to the gossiping connection with a catch-up frame of every other already-known device, answers relay-connect by pairing and notifying the target, forwards relay-data within established pairings, and replies to a bare ping with a bare pong (wire-mesh#181) so a client can time its own sender-to-hub leg independent of anything being relayed. Resolves when the connection's frame stream ends. Internally just registerConnection followed by a loop of onFrame calls and a final onDisconnect -- kept as its own method since a dedicated hub deployment (wire-mesh-node/cloudflare-hub) has nothing else driving the connection and wants the whole lifecycle in one call. */
6
6
  handleConnection: (connection: Readonly<Connection>) => Promise<void>;
7
7
  /** Registers a connection with this hub without taking over its own frame-consumption loop (wire-mesh#102) -- the entry point an "ordinary opted-in node relays for peers it's already talking to" uses, alongside onFrame/onDisconnect below, to let a MeshSession's own single connection.receive() loop drive this hub rather than running a second, competing one. Must be called once, before the first onFrame call for this connection, so gossip fan-out (which forwards to every OTHER registered connection) already sees it. */
8
8
  registerConnection: (connection: Readonly<Connection>) => void;
@@ -94,6 +94,12 @@ function createRelayHub() {
94
94
  });
95
95
  return;
96
96
  }
97
+ if (frame.type === "ping") {
98
+ try {
99
+ await connection.send({ type: "pong" });
100
+ } catch {}
101
+ return;
102
+ }
97
103
  }
98
104
  return {
99
105
  async handleConnection(connection) {
@@ -1,5 +1,5 @@
1
- import { N as Frame } from "../protocol-CNFRVx9w.cjs";
2
- import { t as Connection } from "../transport-De0zHlaA.cjs";
1
+ import { N as Frame } from "../protocol-PhUVprXA.cjs";
2
+ import { t as Connection } from "../transport-CbXX1Xd-.cjs";
3
3
  //#region src/domain/relay-use-gate.d.ts
4
4
  export interface RelayUseAuthorizationTracker {
5
5
  /** True once authorize() has been called for this exact connection and revoke() has not been called since. */
@@ -1,5 +1,5 @@
1
- import { N as Frame } from "../protocol-CNFRVx9w.mjs";
2
- import { t as Connection } from "../transport-C7KVkhgb.mjs";
1
+ import { N as Frame } from "../protocol-PhUVprXA.mjs";
2
+ import { t as Connection } from "../transport-DG9ouGe-.mjs";
3
3
  //#region src/domain/relay-use-gate.d.ts
4
4
  export interface RelayUseAuthorizationTracker {
5
5
  /** True once authorize() has been called for this exact connection and revoke() has not been called since. */
@@ -1,5 +1,5 @@
1
- import { _t as RevocationEntry } from "../protocol-CNFRVx9w.cjs";
2
- import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-Cl8sQo7o.cjs";
1
+ import { bt as RevocationEntry } from "../protocol-PhUVprXA.cjs";
2
+ import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-DIPzZ9JJ.cjs";
3
3
  //#region src/domain/revocation-view.d.ts
4
4
  /**
5
5
  * An in-memory RevocationCheck fed by ingested revocation-announce frames. Keyed by token-id alone, per management.cddl's contract: a token-id can legitimately carry multiple recorded entries from different issuers (the token's own issuer, and/or any number of parties holding a delegated manage:revoke authorization over it) -- entriesFor returns every one of them unfiltered, since checking which actually apply (issuer-match, or a verified authorization) is verifyTokenChain's own obligation, not this store's.
@@ -1,5 +1,5 @@
1
- import { _t as RevocationEntry } from "../protocol-CNFRVx9w.mjs";
2
- import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-CVyPoJ6l.mjs";
1
+ import { bt as RevocationEntry } from "../protocol-PhUVprXA.mjs";
2
+ import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-BVrgBeqF.mjs";
3
3
  //#region src/domain/revocation-view.d.ts
4
4
  /**
5
5
  * An in-memory RevocationCheck fed by ingested revocation-announce frames. Keyed by token-id alone, per management.cddl's contract: a token-id can legitimately carry multiple recorded entries from different issuers (the token's own issuer, and/or any number of parties holding a delegated manage:revoke authorization over it) -- entriesFor returns every one of them unfiltered, since checking which actually apply (issuer-match, or a verified authorization) is verifyTokenChain's own obligation, not this store's.
@@ -1,8 +1,8 @@
1
- import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-CNFRVx9w.cjs";
2
- import { t as IdentityPort } from "../identity-CUkDHCRK.cjs";
1
+ import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-PhUVprXA.cjs";
2
+ import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.cjs";
4
4
  import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.cjs";
5
- import { a as RevocationCheck } from "../tokens-Cl8sQo7o.cjs";
5
+ import { a as RevocationCheck } from "../tokens-DIPzZ9JJ.cjs";
6
6
  //#region src/domain/room-rekey.d.ts
7
7
  /**
8
8
  * Builds a room.rekey command per room.cddl. The outer verb is room:member, the same "one resource, several inner verbs" pattern room.send/room.leave/room.members already establish -- not a new capability of its own.
@@ -1,8 +1,8 @@
1
- import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-CNFRVx9w.mjs";
2
- import { t as IdentityPort } from "../identity-9TmmK7vP.mjs";
1
+ import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-PhUVprXA.mjs";
2
+ import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.mjs";
4
4
  import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.mjs";
5
- import { a as RevocationCheck } from "../tokens-CVyPoJ6l.mjs";
5
+ import { a as RevocationCheck } from "../tokens-BVrgBeqF.mjs";
6
6
  //#region src/domain/room-rekey.d.ts
7
7
  /**
8
8
  * Builds a room.rekey command per room.cddl. The outer verb is room:member, the same "one resource, several inner verbs" pattern room.send/room.leave/room.members already establish -- not a new capability of its own.
@@ -1,2 +1,2 @@
1
- import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-DpOfZOdl.cjs";
1
+ import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-D8HndWYM.cjs";
2
2
  export { ROOM_MEMBER_CAPABILITY, RoomTokenVerdict, RoomTokenVerdictReason, VerifyRoomTokenOptions, verifyRoomToken };
@@ -1,2 +1,2 @@
1
- import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-BdtM1rQ4.mjs";
1
+ import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-Dv1O6-FV.mjs";
2
2
  export { ROOM_MEMBER_CAPABILITY, RoomTokenVerdict, RoomTokenVerdictReason, VerifyRoomTokenOptions, verifyRoomToken };
@@ -1,8 +1,8 @@
1
- import { Dt as RoomPath, Et as RoomNoticeClaims, Tt as RoomNotice, p as CapabilityToken, q as MessageRef } from "../protocol-CNFRVx9w.cjs";
2
- import { t as IdentityPort } from "../identity-CUkDHCRK.cjs";
1
+ import { At as RoomPath, Ot as RoomNotice, kt as RoomNoticeClaims, p as CapabilityToken, q as MessageRef } from "../protocol-PhUVprXA.cjs";
2
+ import { t as IdentityPort } from "../identity-CmD4l_Mp.cjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.cjs";
4
- import { a as RevocationCheck } from "../tokens-Cl8sQo7o.cjs";
5
- import { r as RoomTokenVerdictReason } from "../room-token-verification-DpOfZOdl.cjs";
4
+ import { a as RevocationCheck } from "../tokens-DIPzZ9JJ.cjs";
5
+ import { r as RoomTokenVerdictReason } from "../room-token-verification-D8HndWYM.cjs";
6
6
  //#region src/domain/room.d.ts
7
7
  export type RoomNoticeVerdictReason = "malformed" | "wrong_room" | "bad_signature" | "wrong_poster" | "content_expired" | "key_epoch_mismatch" | RoomTokenVerdictReason;
8
8
  export type RoomNoticeVerdict = {
@@ -1,8 +1,8 @@
1
- import { Dt as RoomPath, Et as RoomNoticeClaims, Tt as RoomNotice, p as CapabilityToken, q as MessageRef } from "../protocol-CNFRVx9w.mjs";
2
- import { t as IdentityPort } from "../identity-9TmmK7vP.mjs";
1
+ import { At as RoomPath, Ot as RoomNotice, kt as RoomNoticeClaims, p as CapabilityToken, q as MessageRef } from "../protocol-PhUVprXA.mjs";
2
+ import { t as IdentityPort } from "../identity-BXrJ6_YM.mjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.mjs";
4
- import { a as RevocationCheck } from "../tokens-CVyPoJ6l.mjs";
5
- import { r as RoomTokenVerdictReason } from "../room-token-verification-BdtM1rQ4.mjs";
4
+ import { a as RevocationCheck } from "../tokens-BVrgBeqF.mjs";
5
+ import { r as RoomTokenVerdictReason } from "../room-token-verification-Dv1O6-FV.mjs";
6
6
  //#region src/domain/room.d.ts
7
7
  export type RoomNoticeVerdictReason = "malformed" | "wrong_room" | "bad_signature" | "wrong_poster" | "content_expired" | "key_epoch_mismatch" | RoomTokenVerdictReason;
8
8
  export type RoomNoticeVerdict = {
@@ -1,4 +1,4 @@
1
- import { D as DeviceId } from "../protocol-CNFRVx9w.cjs";
1
+ import { D as DeviceId } from "../protocol-PhUVprXA.cjs";
2
2
  import { PresentedShard, ShardConfig } from "./erasure-coding.cjs";
3
3
  //#region src/domain/shard-manifest.d.ts
4
4
  /** The content-type a core/data entry carrying a shard manifest declares. */
@@ -1,4 +1,4 @@
1
- import { D as DeviceId } from "../protocol-CNFRVx9w.mjs";
1
+ import { D as DeviceId } from "../protocol-PhUVprXA.mjs";
2
2
  import { PresentedShard, ShardConfig } from "./erasure-coding.mjs";
3
3
  //#region src/domain/shard-manifest.d.ts
4
4
  /** The content-type a core/data entry carrying a shard manifest declares. */
@@ -1,2 +1,2 @@
1
- import { _ as verifyRevocationEntry, a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyCapabilityToken, h as sig1ToBeSigned, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-Cl8sQo7o.cjs";
1
+ import { _ as verifyRevocationEntry, a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyCapabilityToken, h as sig1ToBeSigned, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-DIPzZ9JJ.cjs";
2
2
  export { MintCapabilityTokenOptions, MintRefusalReason, MintRevocationEntryOptions, MintVerdict, RevocationCheck, RevocationEntryVerdict, RevocationEntryVerdictReason, TokenVerdict, TokenVerdictReason, VerifyCapabilityTokenOptions, VerifyRevocationEntryOptions, canGrant, mintCapabilityToken, mintRevocationEntry, sig1ToBeSigned, verifyCapabilityToken, verifyRevocationEntry };
@@ -1,2 +1,2 @@
1
- import { _ as verifyRevocationEntry, a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyCapabilityToken, h as sig1ToBeSigned, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-CVyPoJ6l.mjs";
1
+ import { _ as verifyRevocationEntry, a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyCapabilityToken, h as sig1ToBeSigned, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-BVrgBeqF.mjs";
2
2
  export { MintCapabilityTokenOptions, MintRefusalReason, MintRevocationEntryOptions, MintVerdict, RevocationCheck, RevocationEntryVerdict, RevocationEntryVerdictReason, TokenVerdict, TokenVerdictReason, VerifyCapabilityTokenOptions, VerifyRevocationEntryOptions, canGrant, mintCapabilityToken, mintRevocationEntry, sig1ToBeSigned, verifyCapabilityToken, verifyRevocationEntry };
@@ -1,6 +1,6 @@
1
- import { $t as WebrtcOffer, H as ManageCommandParams, Mt as SfuTrackEntry, Nt as SfuTrackMap, Qt as WebrtcIceCandidate, V as ManageCommand, Zt as WebrtcAnswer, f as CapabilityScope, z as IceCandidateInit } from "../protocol-CNFRVx9w.cjs";
1
+ import { Ft as SfuTrackEntry, H as ManageCommandParams, It as SfuTrackMap, V as ManageCommand, en as WebrtcAnswer, f as CapabilityScope, nn as WebrtcOffer, tn as WebrtcIceCandidate, z as IceCandidateInit } from "../protocol-PhUVprXA.cjs";
2
2
  import { IncomingManageRequest } from "./mesh-session.cjs";
3
- import { u as VerifyCapabilityTokenOptions } from "../tokens-Cl8sQo7o.cjs";
3
+ import { u as VerifyCapabilityTokenOptions } from "../tokens-DIPzZ9JJ.cjs";
4
4
  //#region src/domain/webrtc-signaling.d.ts
5
5
  /** The one capability verb gating every core/webrtc message shape: an authority over this node's own signaling as a whole, not three separate resources, mirroring how core/exec's exec:pty gates all of its own inner verbs. webrtc.sfu-track-map is gated by this same verb (see spec/webrtc.cddl's own comment): an SFU able to shape a negotiation can already misreport whose media is on which mid, so a separate capability over the track-map itself would guard nothing a client doesn't already have to trust the SFU for. */
6
6
  export declare const WEBRTC_SIGNAL_VERB = "webrtc:signal";
@@ -1,6 +1,6 @@
1
- import { $t as WebrtcOffer, H as ManageCommandParams, Mt as SfuTrackEntry, Nt as SfuTrackMap, Qt as WebrtcIceCandidate, V as ManageCommand, Zt as WebrtcAnswer, f as CapabilityScope, z as IceCandidateInit } from "../protocol-CNFRVx9w.mjs";
1
+ import { Ft as SfuTrackEntry, H as ManageCommandParams, It as SfuTrackMap, V as ManageCommand, en as WebrtcAnswer, f as CapabilityScope, nn as WebrtcOffer, tn as WebrtcIceCandidate, z as IceCandidateInit } from "../protocol-PhUVprXA.mjs";
2
2
  import { IncomingManageRequest } from "./mesh-session.mjs";
3
- import { u as VerifyCapabilityTokenOptions } from "../tokens-CVyPoJ6l.mjs";
3
+ import { u as VerifyCapabilityTokenOptions } from "../tokens-BVrgBeqF.mjs";
4
4
  //#region src/domain/webrtc-signaling.d.ts
5
5
  /** The one capability verb gating every core/webrtc message shape: an authority over this node's own signaling as a whole, not three separate resources, mirroring how core/exec's exec:pty gates all of its own inner verbs. webrtc.sfu-track-map is gated by this same verb (see spec/webrtc.cddl's own comment): an SFU able to shape a negotiation can already misreport whose media is on which mid, so a separate capability over the track-map itself would guard nothing a client doesn't already have to trust the SFU for. */
6
6
  export declare const WEBRTC_SIGNAL_VERB = "webrtc:signal";
@@ -37,6 +37,7 @@ const manageCommandParamsSchema = zod.z.lazy(() => zod.z.union([
37
37
  zod.z.object({}).catchall(zod.z.unknown()),
38
38
  zod.z.lazy(() => capabilityRequestSchema),
39
39
  zod.z.lazy(() => capabilityGrantSchema),
40
+ zod.z.lazy(() => pathTraceSchema),
40
41
  zod.z.union([
41
42
  zod.z.lazy(() => roomSendSchema),
42
43
  zod.z.lazy(() => roomReadSchema),
@@ -155,6 +156,7 @@ const execSessionInfoSchema = zod.z.lazy(() => zod.z.object({
155
156
  const frameVariantSchema = zod.z.lazy(() => zod.z.union([
156
157
  zod.z.lazy(() => handshakeFrameSchema),
157
158
  zod.z.lazy(() => pingFrameSchema),
159
+ zod.z.lazy(() => pongFrameSchema),
158
160
  zod.z.lazy(() => closeFrameSchema),
159
161
  zod.z.lazy(() => gossipFrameSchema),
160
162
  zod.z.lazy(() => candidatesFrameSchema),
@@ -259,6 +261,12 @@ const revocationAnnounceFrameSchema = zod.z.lazy(() => zod.z.object({
259
261
  "type": zod.z.literal("revocation-announce"),
260
262
  "entries": zod.z.array(zod.z.lazy(() => revocationEntrySchema))
261
263
  }));
264
+ const pathTraceSchema = zod.z.lazy(() => zod.z.object({ "verb": zod.z.literal("path.trace") }));
265
+ const pathTraceOkSchema = zod.z.lazy(() => zod.z.object({
266
+ "result": zod.z.literal("ok"),
267
+ "relayed": zod.z.boolean(),
268
+ "hub-address": zod.z.string().optional()
269
+ }).catchall(zod.z.unknown()));
262
270
  const roomPathSchema = zod.z.lazy(() => zod.z.union([zod.z.lazy(() => ownerNamedRoomPathSchema), zod.z.lazy(() => dmRoomPathSchema)]));
263
271
  const deviceIdHexSchema = zod.z.lazy(() => zod.z.string().regex(/* @__PURE__ */ new RegExp("[0-9a-f]{64}")));
264
272
  const ownerNamedRoomPathSchema = zod.z.lazy(() => zod.z.string().regex(/* @__PURE__ */ new RegExp("[0-9a-f]{64}/[A-Za-z0-9_-]+")));
@@ -440,6 +448,7 @@ const tokenClaimsSchema = zod.z.lazy(() => zod.z.object({
440
448
  "conditions": zod.z.instanceof(Uint8Array).optional()
441
449
  }).catchall(zod.z.unknown()));
442
450
  const pingFrameSchema = zod.z.lazy(() => zod.z.object({ "type": zod.z.literal("ping") }));
451
+ const pongFrameSchema = zod.z.lazy(() => zod.z.object({ "type": zod.z.literal("pong") }));
443
452
  const closeFrameSchema = zod.z.lazy(() => zod.z.object({
444
453
  "type": zod.z.literal("close"),
445
454
  "reason": zod.z.string().optional()
@@ -583,9 +592,12 @@ exports.namespacedCapabilitySchema = namespacedCapabilitySchema;
583
592
  exports.namespacedDomainIdSchema = namespacedDomainIdSchema;
584
593
  exports.observedAddressFrameSchema = observedAddressFrameSchema;
585
594
  exports.ownerNamedRoomPathSchema = ownerNamedRoomPathSchema;
595
+ exports.pathTraceOkSchema = pathTraceOkSchema;
596
+ exports.pathTraceSchema = pathTraceSchema;
586
597
  exports.peerAdvertSchema = peerAdvertSchema;
587
598
  exports.peerIdentitySchema = peerIdentitySchema;
588
599
  exports.pingFrameSchema = pingFrameSchema;
600
+ exports.pongFrameSchema = pongFrameSchema;
589
601
  exports.privateUseCapabilitySchema = privateUseCapabilitySchema;
590
602
  exports.privateUseDomainIdSchema = privateUseDomainIdSchema;
591
603
  exports.procKillSchema = procKillSchema;