openrtc 0.1.3 → 0.2.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 (38) hide show
  1. package/README.md +26 -3
  2. package/dist/DelegatingRuntimeAdapter-CjHzBEBA.d.ts +180 -0
  3. package/dist/{IpcRuntimeAdapter-CT-W0Mtp.d.ts → IpcRuntimeAdapter-CtckyMol.d.ts} +2 -1
  4. package/dist/auth/index.js +1 -1
  5. package/dist/auth/internal.js +1 -1
  6. package/dist/chunk-3VTF5RKW.js +1 -0
  7. package/dist/chunk-JXGKO7SX.js +1 -0
  8. package/dist/chunk-MFT6SOZ6.js +3 -0
  9. package/dist/chunk-SGZWR63E.js +1 -0
  10. package/dist/chunk-VARALO7G.js +1 -0
  11. package/dist/chunk-WOHFM6DI.js +2 -0
  12. package/dist/chunk-YHJOXD46.js +2 -0
  13. package/dist/{factories-0TxDPMeu.d.ts → factories-CwZiIRg1.d.ts} +412 -226
  14. package/dist/index.d.ts +100 -6
  15. package/dist/index.js +2 -1
  16. package/dist/openrtc_bg.wasm +0 -0
  17. package/dist/runtime/WasmRuntimeAdapter.d.ts +2 -1
  18. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  19. package/dist/runtime/index.d.ts +205 -391
  20. package/dist/runtime/index.js +1 -1
  21. package/dist/runtime/tauri.d.ts +5 -6
  22. package/dist/runtime/tauri.js +1 -1
  23. package/dist/transport/index.d.ts +11 -0
  24. package/dist/transport/index.js +1 -0
  25. package/dist/{DelegatingRuntimeAdapter-CW8d78dZ.d.ts → types-DyCGvj9l.d.ts} +200 -170
  26. package/package.json +12 -10
  27. package/dist/chunk-26POO5PL.js +0 -4
  28. package/dist/chunk-4MH42GUI.js +0 -2
  29. package/dist/chunk-D54VGRRH.js +0 -1
  30. package/dist/chunk-DIQYFAGL.js +0 -2
  31. package/dist/chunk-PZ25OCVG.js +0 -2
  32. package/dist/chunk-UVASANPG.js +0 -1
  33. package/wasm/README.md +0 -64
  34. package/wasm/openrtc.d.ts +0 -320
  35. package/wasm/openrtc.js +0 -2290
  36. package/wasm/openrtc_bg.wasm +0 -0
  37. package/wasm/openrtc_bg.wasm.d.ts +0 -113
  38. package/wasm/package.json +0 -16
@@ -1,9 +1,10 @@
1
- import { C as Connection, E as RuntimeConnectionTarget, q as RuntimeRawConnection } from '../factories-0TxDPMeu.js';
2
- export { r as ChannelDescriptor, s as ConnectionEvent, t as ConnectionTarget, D as DeviceProfile, $ as DriveGrantActorError, a0 as DriveGrantActorErrorKind, a1 as DriveGrantActorHandle, a2 as DriveGrantActorHandleOptions, a3 as DriveGrantActorRegistry, a4 as DriveGrantClose, a5 as DriveGrantConnectionKey, a6 as DriveGrantDial, a7 as DriveGrantLogicalChannelHandle, a8 as DriveGrantWebRtcState, I as IncomingStream, O as OPENRTC_RUNTIME_POLICY, u as PeerConnectOptions, v as PeerReadiness, w as PeerStreamOptions, P as PlutoRuntimeAssembly, x as PresenceLoopOptions, y as RawConnection, z as RuntimeAuthContext, A as RuntimeAuthIdentity, B as RuntimeAutoConnectPolicy, k as RuntimeChannelDescriptor, a as RuntimeClient, R as RuntimeClientOptions, p as RuntimeConnectionEvent, o as RuntimeConnectionStateSnapshot, b as RuntimeDevice, d as RuntimeDeviceConnectOptions, F as RuntimeDeviceStatus, c as RuntimeDeviceStatusSnapshot, a9 as RuntimeFactoryOptions, m as RuntimeIncomingStream, G as RuntimeJoinRoomOptions, e as RuntimeLocalDeviceInfo, f as RuntimeLocalDeviceProfile, H as RuntimeManagedSession, J as RuntimeManagedSessionKind, K as RuntimeManagedSessionOptions, L as RuntimeManagedSessionPlatform, h as RuntimePeerConnectOptions, j as RuntimePeerHealth, M as RuntimePeerLifecycleStatus, i as RuntimePeerReadinessSnapshot, N as RuntimePeerScope, Q as RuntimePeerSessionSnapshot, g as RuntimePeerState, l as RuntimePeerStreamOptions, n as RuntimePolicySnapshot, S as RuntimePresenceLoopOptions, T as RuntimePresencePolicy, U as RuntimeRoomMember, V as RuntimeSession, W as RuntimeUiConnectionStatus, $ as ScopedConnectionActorError, a0 as ScopedConnectionActorErrorKind, a1 as ScopedConnectionActorHandle, a2 as ScopedConnectionActorHandleOptions, a3 as ScopedConnectionActorRegistry, a4 as ScopedConnectionClose, a6 as ScopedConnectionDial, a5 as ScopedConnectionKey, a7 as ScopedLogicalChannelHandle, a8 as ScopedWebRtcState, aa as Session, ab as SessionOptions, ac as createIpcClient, ad as createWasmClient, ae as driveGrantConnectionKey, af as driveGrantConnectionKeyToString, _ as getRuntimePolicy, ae as scopedConnectionKey, af as scopedConnectionKeyToString } from '../factories-0TxDPMeu.js';
3
- import { y as SignalingOptions, w as ISignalingBackend, o as RuntimeIdentity, z as SignalingEnvelope, n as SignalingSession, m as Device, B as BackendConnectionState, J as JoinRoomOptions, s as RoomMember, d as AppLimits, F as RoomCreationMode, k as ClientOptions, f as DiscoveryMode, h as ProtocolCapabilityMap, H as ScanningLoopOptions, K as ScanningLoopHandle, a as ConnectDeviceHooks, b as ConnectDeviceOptions, C as ConnectDeviceResult, O as RuntimeBootstrapOptions, Q as RuntimeBootstrapResult, q as PeerState, t as PeerScope, r as PeerHealth, G as GrantScope, I as IncomingStreamChannelMetadata, l as ChannelDescriptor, T as JoinRequest, N as NativeConnectResult } from '../DelegatingRuntimeAdapter-CW8d78dZ.js';
4
- export { U as BROWSER_WASM_RUNTIME_CAPABILITIES, V as NATIVE_IPC_RUNTIME_CAPABILITIES, j as RuntimeAdapterKind, c as RuntimeCapabilities, X as cloneRuntimeCapabilities } from '../DelegatingRuntimeAdapter-CW8d78dZ.js';
1
+ import { C as Connection, P as PeerReconciliationStats, K as RuntimeConnectionTarget, u as RuntimeRawConnection } from '../factories-CwZiIRg1.js';
2
+ export { v as ChannelDescriptor, w as ConnectionEvent, x as ConnectionTarget, D as DeviceProfile, y as IncomingStream, O as OPENRTC_RUNTIME_POLICY, z as PeerConnectOptions, A as PeerReadiness, B as PeerStreamOptions, t as PlutoRuntimeAssembly, E as PresenceLoopOptions, F as RawConnection, r as RuntimeApplicationPayloadReadinessOptions, G as RuntimeAuthContext, H as RuntimeAuthIdentity, J as RuntimeAutoConnectPolicy, k as RuntimeChannelDescriptor, a as RuntimeClient, R as RuntimeClientOptions, s as RuntimeConnectionEvent, q as RuntimeConnectionStateSnapshot, b as RuntimeDevice, d as RuntimeDeviceConnectOptions, L as RuntimeDeviceStatus, c as RuntimeDeviceStatusSnapshot, a7 as RuntimeFactoryOptions, m as RuntimeIncomingStream, M as RuntimeJoinRoomOptions, e as RuntimeLocalDeviceInfo, f as RuntimeLocalDeviceProfile, N as RuntimeLogicalChannelFraming, Q as RuntimeManagedSession, S as RuntimeManagedSessionKind, T as RuntimeManagedSessionOptions, U as RuntimeManagedSessionPlatform, h as RuntimePeerConnectOptions, j as RuntimePeerHealth, V as RuntimePeerLifecycleStatus, i as RuntimePeerReadinessSnapshot, W as RuntimePeerScope, X as RuntimePeerSessionSnapshot, g as RuntimePeerState, l as RuntimePeerStreamOptions, p as RuntimePolicySnapshot, Y as RuntimePresenceLoopOptions, Z as RuntimePresencePolicy, _ as RuntimeRoomMember, n as RuntimeScopedChannelOptions, o as RuntimeScopedLogicalChannel, $ as RuntimeSession, a0 as RuntimeUiConnectionStatus, a1 as ScopedChannelOptions, a8 as ScopedConnectionActorError, a9 as ScopedConnectionActorErrorKind, aa as ScopedConnectionActorHandle, ab as ScopedConnectionActorHandleOptions, ac as ScopedConnectionActorRegistry, ad as ScopedConnectionActorState, ae as ScopedConnectionClose, af as ScopedConnectionDial, ag as ScopedConnectionKey, a2 as ScopedLogicalChannel, ah as ScopedLogicalChannelHandle, ai as ScopedPreferredTransport, aj as Session, ak as SessionOptions, al as createIpcClient, am as createWasmClient, a6 as getRuntimePolicy, an as scopedConnectionKey, ao as scopedConnectionKeyToString } from '../factories-CwZiIRg1.js';
3
+ import { Z as SignalingOptions, I as ISignalingBackend, R as RuntimeIdentity, d as SignalingEnvelope, f as SignalingSession, a as Device, j as BackendConnectionState, t as AppLimits, V as JoinRoomOptions, W as RoomMember, O as IncomingStreamChannelMetadata, r as ApplicationCryptoStreamTools, _ as RoomCreationMode, C as ClientOptions, q as ApplicationPayloadCrypto, D as DiscoveryMode, p as ProtocolCapabilityMap, $ as ScanningLoopOptions, a0 as ScanningLoopHandle, l as ConnectDeviceHooks, m as ConnectDeviceOptions, k as ConnectDeviceResult, a1 as RuntimeBootstrapOptions, a2 as RuntimeBootstrapResult, v as ApplicationPayloadReadinessOptions, T as PeerState, X as PeerScope, U as PeerHealth, G as GrantScope, K as ChannelDescriptor, a3 as JoinRequest, i as NativeConnectResult } from '../types-DyCGvj9l.js';
5
4
  import { FirebaseApp } from 'firebase/app';
6
- export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, P as PlutoIpcBridge, b as PlutoIpcUnlisten } from '../IpcRuntimeAdapter-CT-W0Mtp.js';
5
+ import { R as RuntimeCapabilities } from '../DelegatingRuntimeAdapter-CjHzBEBA.js';
6
+ export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile, c as cloneRuntimeCapabilities, r as runtimeCapabilityProfile } from '../DelegatingRuntimeAdapter-CjHzBEBA.js';
7
+ export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, P as PlutoIpcBridge, b as PlutoIpcUnlisten } from '../IpcRuntimeAdapter-CtckyMol.js';
7
8
  export { WasmRuntimeAdapter } from './WasmRuntimeAdapter.js';
8
9
  export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge } from './tauri.js';
9
10
 
@@ -13,13 +14,19 @@ export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge }
13
14
  * Replaces the 60-second Firestore heartbeat loop with Firebase Realtime
14
15
  * Database `onDisconnect` hooks. When a client disconnects (tab close,
15
16
  * crash, network loss), the RTDB server automatically writes the offline
16
- * state no cleanup polling needed.
17
+ * state. A shared `.info/connected` listener republishes desired online state
18
+ * after WebSocket reconnects, and server cleanup compacts old offline nodes.
17
19
  *
18
20
  * RTDB paths mirror the Firestore device collection paths:
19
21
  *
20
- * personal/spaceKey → presence/spaces/{namespaceId}/devices/{deviceId}
22
+ * space/spaceKey → presence/spaces/{namespaceId}/devices/{deviceId}
21
23
  * user-scoped → presence/{appTag}/users/{userId}/devices/{deviceId}
22
24
  *
25
+ * Space RTDB paths require scoped Firebase auth
26
+ * (`namespaceId` or `space::{namespaceId}` appTag claim). The browser bridge
27
+ * skips space RTDB until such auth is available and uses Firestore as the
28
+ * compatibility fallback.
29
+ *
23
30
  * Ticket version invalidation:
24
31
  * Each presence node stores a `ticketVersion` integer. WasmBridge bumps it
25
32
  * whenever it writes a new Firestore ticket (network change, reconnect).
@@ -32,6 +39,10 @@ export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge }
32
39
  interface RtdbDevicePresence {
33
40
  online: boolean;
34
41
  ticketVersion: number;
42
+ ticket?: string;
43
+ nodeId?: string;
44
+ deviceName?: string;
45
+ metadata?: string;
35
46
  }
36
47
  type RtdbPresenceMap = Record<string, RtdbDevicePresence>;
37
48
  type DiscoveryPresenceScope = {
@@ -39,16 +50,30 @@ type DiscoveryPresenceScope = {
39
50
  appTag: string;
40
51
  userId: string;
41
52
  } | {
42
- kind: 'personal';
53
+ kind: 'space';
43
54
  namespaceId: string;
44
55
  };
56
+ interface RtdbPresenceRosterFields {
57
+ ticket?: string;
58
+ nodeId?: string;
59
+ deviceName?: string;
60
+ metadata?: string;
61
+ }
45
62
  interface RtdbMemberPresence {
46
63
  online: boolean;
47
64
  }
48
65
  type RtdbRoomPresenceMap = Record<string, RtdbMemberPresence>;
49
66
  declare class RtdbPresence {
50
67
  private readonly db;
68
+ private readonly desiredOnlineNodes;
69
+ private connected;
70
+ private connectedUnsubscribe;
51
71
  constructor(app: FirebaseApp);
72
+ private ensureReconnectWatch;
73
+ private publishDesiredOnline;
74
+ private registerOnlineNode;
75
+ private markNodeOffline;
76
+ private subscribeIncremental;
52
77
  /**
53
78
  * Register this device as online in RTDB and set an onDisconnect handler
54
79
  * so the server marks it offline automatically on connection loss.
@@ -57,13 +82,13 @@ declare class RtdbPresence {
57
82
  * written. Does not replace the Firestore device doc — that remains the
58
83
  * source of truth for the connection ticket and metadata.
59
84
  */
60
- registerDevice(scope: DiscoveryPresenceScope, deviceId: string, ticketVersion?: number): Promise<void>;
85
+ registerDevice(scope: DiscoveryPresenceScope, deviceId: string, ticketVersion?: number, fields?: RtdbPresenceRosterFields): Promise<void>;
61
86
  /**
62
87
  * Bump the ticketVersion for a device. Call this whenever a new Firestore
63
88
  * ticket is written (e.g. on network change / node restart). Subscribers
64
89
  * will see the version change and re-fetch the Firestore doc.
65
90
  */
66
- bumpTicketVersion(scope: DiscoveryPresenceScope, deviceId: string, newVersion: number): Promise<void>;
91
+ bumpTicketVersion(scope: DiscoveryPresenceScope, deviceId: string, newVersion: number, fields?: RtdbPresenceRosterFields): Promise<void>;
67
92
  /**
68
93
  * Explicitly mark a device offline (graceful disconnect / sign-out).
69
94
  * The onDisconnect handler would eventually fire anyway, but calling this
@@ -72,7 +97,7 @@ declare class RtdbPresence {
72
97
  markOffline(scope: DiscoveryPresenceScope, deviceId: string, ticketVersion?: number): Promise<void>;
73
98
  /**
74
99
  * Register a room member as online and set an onDisconnect handler.
75
- * Called immediately after the Firestore member doc is written (join).
100
+ * Managed/user-scoped room writes require roomPresenceAcl writer grants.
76
101
  */
77
102
  registerRoomMember(appTag: string, roomId: string, memberId: string): Promise<void>;
78
103
  /**
@@ -94,15 +119,13 @@ declare class RtdbPresence {
94
119
  * Subscribe to all device presence states in a discovery scope.
95
120
  *
96
121
  * Returns an unsubscribe function. The callback receives the full map of
97
- * deviceId { online, ticketVersion } whenever any device's presence
98
- * changes. This replaces the `onSnapshot` on the Firestore device
99
- * collection for the online/offline boolean overlay.
100
- *
101
- * The Firestore device collection remains as the source of truth for
102
- * connection tickets and metadata; RTDB is only used for the live
103
- * online boolean and ticket invalidation signal.
122
+ * deviceId -> { online, ticketVersion, ...roster fields } whenever any
123
+ * device's presence changes. Firestore remains the durable roster; RTDB
124
+ * carries enough fields to keep discovery usable during short Firestore
125
+ * offline windows.
104
126
  */
105
127
  onPresenceChange(scope: DiscoveryPresenceScope, callback: (presenceMap: RtdbPresenceMap) => void): () => void;
128
+ readPresenceMap(scope: DiscoveryPresenceScope): Promise<RtdbPresenceMap>;
106
129
  }
107
130
 
108
131
  declare class Signaling {
@@ -112,18 +135,20 @@ declare class Signaling {
112
135
  get tag(): string;
113
136
  waitForAuth(): Promise<void>;
114
137
  get currentUser(): RuntimeIdentity | null;
138
+ getRtdbPresence(): RtdbPresence | null;
115
139
  onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
116
140
  signInAnonymously(): Promise<void>;
117
141
  signInWithPluto(): Promise<void>;
118
142
  signOut(): Promise<void>;
119
143
  stopAuthScopedActivity(): Promise<void>;
144
+ getRuntimeCapabilities(): RuntimeCapabilities | undefined;
120
145
  getTurnCredentials(): Promise<any>;
121
146
  updatePresence(localNodeId: string, ticketStr: string, isOnline?: boolean, ttlMs?: number, metadata?: string): Promise<void>;
122
147
  setOffline(localNodeId: string): Promise<void>;
123
148
  cleanupStaleDevices(): Promise<void>;
124
149
  sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
125
150
  pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
126
- subscribeSessions(localDeviceId: string, callback: (session: SignalingSession) => void): Promise<() => void>;
151
+ subscribeSessions(localDeviceId: string, callback: (session: SignalingSession) => void | Promise<void>): Promise<() => void>;
127
152
  getLocalDeviceId(): Promise<string | null>;
128
153
  searchDevices(excludeNodeId?: string): Promise<Device[]>;
129
154
  updateDevice(deviceId: string, updates: {
@@ -144,70 +169,26 @@ declare class Signaling {
144
169
  setWasmClient(client: any): void;
145
170
  }
146
171
 
147
- declare class RoomManager {
148
- private signaling;
149
- private client;
150
- private readonly heartbeatStops;
151
- private browserRooms;
152
- private rtdbPresence;
153
- constructor(client: Client, signaling: Signaling);
154
- private getBrowserRooms;
155
- /**
156
- * Phase 2: called by the runtime after RTDB presence is initialised
157
- * (same RtdbPresence instance used for device presence in Phase 1).
158
- */
159
- setRtdbPresence(rtdbPresence: RtdbPresence): void;
160
- private usesDirectRoomBackend;
161
- private get roomBackendTag();
162
- private get appTag();
163
- private invokeRoomCallable;
164
- private isAlreadyExistsError;
165
- private getMembersInternal;
166
- private parseMemberDocuments;
167
- private parseRoomMemberDocument;
168
- /**
169
- * Creates a new room. When `requestedRoomId` is provided, the backend will
170
- * try to create that exact room ID instead of generating a random one.
171
- */
172
- createRoom(requestedRoomId?: string): Promise<string>;
173
- /**
174
- * Joins a room by ID.
175
- */
176
- joinRoom(roomId: string, options?: JoinRoomOptions): Promise<Connection[]>;
177
- leaveRoom(roomId: string): Promise<void>;
178
- getRoomMembers(roomId: string): Promise<RoomMember[]>;
179
- watchRoom(roomId: string, callback: (members: RoomMember[]) => void): () => void;
180
- /**
181
- * Register this device as an online room member in RTDB and store a
182
- * cleanup callback in heartbeatStops (keyed by roomId) so that
183
- * stopHeartbeat() / leaveRoom() can trigger graceful offline marking.
184
- */
185
- private registerRtdbRoomMember;
186
- private markRtdbRoomMemberOffline;
187
- private startLegacyHeartbeat;
188
- stopHeartbeat(roomId?: string): void;
172
+ interface MoQSubscriberOptions {
173
+ maxPendingSubscriptions?: number;
174
+ maxSubscribeRetries?: number;
175
+ subscribeRetryDelayMs?: number;
176
+ maxBufferedGroupsPerTrack?: number;
177
+ maxBufferedFramesPerGroup?: number;
178
+ maxBufferedBytesPerTrack?: number;
179
+ maxObjectPayloadBytes?: number;
189
180
  }
190
-
191
- declare class MoQPublisher {
192
- private session;
193
- private tracks;
194
- private activePublishers;
195
- constructor(session: MoQSession);
196
- private pendingAnnounces;
197
- announce(namespace: string): Promise<void>;
198
- onAnnounceResult(namespace: string, error?: {
199
- code: number;
200
- reason: string;
201
- }): void;
202
- onSubscribe(msg: any): void;
203
- onUnsubscribe(subscribeId: number): void;
204
- createTrack(namespace: string, name: string): Promise<any>;
205
- }
206
-
207
181
  declare class MoQSubscriber {
208
182
  private session;
183
+ private readonly maxPendingSubscriptions;
184
+ private readonly maxSubscribeRetries;
185
+ private readonly subscribeRetryDelayMs;
186
+ private readonly maxBufferedGroupsPerTrack;
187
+ private readonly maxBufferedFramesPerGroup;
188
+ private readonly maxBufferedBytesPerTrack;
189
+ private readonly maxObjectPayloadBytes;
209
190
  private onObject;
210
- constructor(session: MoQSession, onObject: (ns: string, name: string, obj: Uint8Array, meta: any) => void);
191
+ constructor(session: MoQSession, onObject: (ns: string, name: string, obj: Uint8Array, meta: any) => void, options?: MoQSubscriberOptions);
211
192
  private aliasMap;
212
193
  private nextAlias;
213
194
  private nextSubscribeId;
@@ -266,6 +247,107 @@ declare class MoQSession {
266
247
  private handleControlMessage;
267
248
  }
268
249
 
250
+ interface MoQPublisherOptions {
251
+ maxPendingAnnounces?: number;
252
+ announceTimeoutMs?: number;
253
+ maxSubscribedTracks?: number;
254
+ maxActivePublishers?: number;
255
+ maxTrackIdChars?: number;
256
+ }
257
+ declare class MoQPublisher {
258
+ private session;
259
+ private tracks;
260
+ private activePublishers;
261
+ private readonly maxPendingAnnounces;
262
+ private readonly announceTimeoutMs;
263
+ private readonly maxSubscribedTracks;
264
+ private readonly maxActivePublishers;
265
+ private readonly maxTrackIdChars;
266
+ constructor(session: MoQSession, options?: MoQPublisherOptions);
267
+ private pendingAnnounces;
268
+ announce(namespace: string): Promise<void>;
269
+ onAnnounceResult(namespace: string, error?: {
270
+ code: number;
271
+ reason: string;
272
+ }): void;
273
+ onSubscribe(msg: any): void;
274
+ onUnsubscribe(subscribeId: number): void;
275
+ hasTrackSubscriber(namespace: string, name: string): boolean;
276
+ createTrack(namespace: string, name: string): Promise<any>;
277
+ private resolveTrackId;
278
+ }
279
+
280
+ /**
281
+ * Browser MoQ session controller.
282
+ *
283
+ * Owns the WebTransport-backed MoQ relay session, reconnect state, peer
284
+ * subscriptions, and direct MoQ data helpers. `Client` remains the facade so
285
+ * existing SDK calls and test spies keep working while MoQ stops contributing
286
+ * more lifecycle state to the god object.
287
+ */
288
+
289
+ type MoQBundle = {
290
+ session: MoQSession;
291
+ publisher: MoQPublisher;
292
+ subscriber: MoQSubscriber;
293
+ };
294
+
295
+ interface RoomClientHost {
296
+ wasmClient: any;
297
+ roomCreationMode: 'client-open' | 'client-auth' | 'server-only';
298
+ appLimits: AppLimits;
299
+ ensureAuthenticated(reason: 'room-op'): Promise<void>;
300
+ getTicket(): Promise<string>;
301
+ getNodeId(): Promise<string>;
302
+ connect(ticket: string, timeoutMs?: number): Promise<Connection>;
303
+ refreshHostedAppSettings(force?: boolean): Promise<void>;
304
+ usesDirectRoomBackend(): boolean;
305
+ getRoomBackendTag(): string;
306
+ }
307
+ declare class RoomManager {
308
+ private signaling;
309
+ private client;
310
+ private readonly heartbeatStops;
311
+ private browserRooms;
312
+ private rtdbPresence;
313
+ constructor(client: RoomClientHost, signaling: Signaling);
314
+ private getBrowserRooms;
315
+ /**
316
+ * Phase 2: called by the runtime after RTDB presence is initialised
317
+ * (same RtdbPresence instance used for device presence in Phase 1).
318
+ */
319
+ setRtdbPresence(rtdbPresence: RtdbPresence): void;
320
+ private syncRtdbPresenceFromSignaling;
321
+ private usesDirectRoomBackend;
322
+ private get roomBackendTag();
323
+ private get appTag();
324
+ private invokeRoomCallable;
325
+ private isAlreadyExistsError;
326
+ private getMembersInternal;
327
+ private parseMemberDocuments;
328
+ private parseRoomMemberDocument;
329
+ /**
330
+ * Creates a new room. When `requestedRoomId` is provided, the backend will
331
+ * try to create that exact room ID instead of generating a random one.
332
+ */
333
+ createRoom(requestedRoomId?: string): Promise<string>;
334
+ /**
335
+ * Joins a room by ID.
336
+ */
337
+ joinRoom(roomId: string, options?: JoinRoomOptions): Promise<Connection[]>;
338
+ leaveRoom(roomId: string): Promise<void>;
339
+ getRoomMembers(roomId: string): Promise<RoomMember[]>;
340
+ watchRoom(roomId: string, callback: (members: RoomMember[]) => void): () => void;
341
+ /**
342
+ * Register this device as an online room member in RTDB and store a
343
+ * cleanup callback in heartbeatStops (keyed by roomId) so that
344
+ * stopHeartbeat() / leaveRoom() can trigger graceful offline marking.
345
+ */
346
+ private registerRtdbRoomMember;
347
+ private markRtdbRoomMemberOffline;
348
+ stopHeartbeat(roomId?: string): void;
349
+ }
350
+
269
351
  type IncomingProtocolHint = 'control' | 'explicit' | 'native-main' | 'unknown';
270
352
  type IncomingStreamListenerEvent = {
271
353
  type: 'bi' | 'uni';
@@ -274,131 +356,48 @@ type IncomingStreamListenerEvent = {
274
356
  traceId?: string;
275
357
  protocolHint?: IncomingProtocolHint;
276
358
  channel?: IncomingStreamChannelMetadata | null;
359
+ applicationCrypto?: ApplicationCryptoStreamTools;
277
360
  invalid?: boolean;
278
361
  };
279
362
 
280
363
  declare class Client {
281
- private static readonly CHANNEL_ENVELOPE_MAGIC;
282
- private static readonly CHANNEL_ENVELOPE_VERSION;
283
- private static readonly CHANNEL_ENVELOPE_HEADER_BYTES;
284
- private static readonly EXPLICIT_PROTOCOL_BYTE;
285
- private static readonly NATIVE_MAIN_PROTOCOL_BYTE;
286
- private static readonly NATIVE_MAIN_LABEL;
287
- private static readonly NATIVE_MAIN_MAX_LABEL_BYTES;
288
- private static readonly NATIVE_MAIN_MAX_FRAME_BYTES;
289
- private static readonly NATIVE_MAIN_PROTOCOL_VERSION;
290
- private static readonly CONNECTION_STATE_CHANGED_EVENT;
291
- private static readonly NATIVE_MAIN_MESSAGE_EVENT;
292
- private static readonly INCOMING_STREAM_RETRY_MIN_DELAY_MS;
293
- private static readonly INCOMING_STREAM_RETRY_MAX_DELAY_MS;
294
- private static readonly DEFAULT_PEER_CHANNEL_ID;
295
- private static readonly SHARE_FILE_CHANNEL_ID;
296
- private static readonly SHARE_CONTROL_CHANNEL_ID;
297
- private static readonly incomingStreamHubs;
298
364
  signaling: Signaling;
299
365
  rooms: RoomManager;
300
- private wasmLoaded;
301
- wasmClient: any;
302
- private initPromise;
303
- node: any;
304
- private connections;
305
- private connectionListeners;
306
- private disconnectionListeners;
307
- private messageListeners;
308
- private roomRequestListeners;
309
- private streamListeners;
310
- private readonly channelStreamListeners;
311
- private readonly registeredChannels;
312
- private announcedConnections;
313
- private readonly peerLifecycle;
314
- private readonly peerLifecycleClient;
315
- private readonly knownDevicesById;
316
- private readonly knownDeviceIdsByNodeId;
317
- private readonly connectionTrustStates;
318
- private readonly connectionChannelIds;
319
- private readonly pendingSessionTokenTrustApprovals;
320
- /** Tracks the last rejection timestamp per remote node to debounce repeated stale-token retries. */
321
- private readonly sessionTokenRejectionCooldowns;
322
- /** Tracks the last trust-failure timestamp per remote node to suppress rapid connection-rebuild storms. */
323
- private readonly trustFailureCooldowns;
324
- /** Nodes that have passed at least one session-token approval — exempt from trust-failure cooldown. */
325
- private readonly sessionTokenApprovedNodes;
326
- /** Connection IDs that have been explicitly approved via session-token admission. */
327
- private readonly sessionTokenApprovedConnectionIds;
328
- /** Most recent inbound native-main BiStream writer per remote node (desktop -> web). */
329
- private readonly inboundNativeMainWriters;
330
- /** Per-node write mutex for inbound native-main writers. */
331
- private readonly inboundNativeMainWriteMutex;
332
- /** Lifecycle metadata for inbound native-main writers to debug stale-writer routing. */
333
- private readonly inboundNativeMainWriterMeta;
334
- /** Per-node cooldown to bypass missing/stale inbound writer probes. */
335
- private readonly inboundNativeMainBypassUntilMs;
336
- private inboundNativeMainWriterSeq;
337
- private managedPresenceGrant;
338
- /** Token extracted from a compound ticket during connect(), keyed by remote node ID. */
339
- private readonly pendingTokenByNodeId;
340
- private readonly pendingNativeMainConnections;
341
- private readonly webrtcIncomingExplicitTransfers;
342
- private localNodeId;
343
- private listening;
344
- private listenLoopTask;
366
+ private _services?;
345
367
  private options;
346
368
  private readonly runtimeSafetyProfile;
347
369
  appLimits: AppLimits;
348
- private pendingConnection;
349
- private incomingTraceSequence;
350
- private browserBackgrounded;
351
- private authSyncUnsubscribe;
352
- private backendConnectionStateUnsubscribe;
353
- private authRefreshInterval;
354
- private deviceId;
355
- private lastWasmAuthSyncUserId;
356
- private lastWasmAuthSyncToken;
357
- private loggedNativeDiscoveryWasmSkip;
358
- private static readonly CONNECTION_STABLE_WINDOW_MS;
359
- private static readonly CONNECTION_STABLE_TIMEOUT_MS;
360
- private static readonly CONNECTION_STABLE_POLL_MS;
361
- private static readonly SESSION_TOKEN_TRUST_APPROVAL_TTL_MS;
362
- private static readonly SESSION_TOKEN_UNKNOWN_RETRY_ATTEMPTS;
363
- private static readonly SESSION_TOKEN_UNKNOWN_RETRY_DELAY_MS;
364
- /** How long to suppress new Connection objects for a node after a trust failure (ms). */
365
- private static readonly TRUST_FAILURE_COOLDOWN_MS;
366
- private static readonly INBOUND_WRITER_RETRY_COOLDOWN_MS;
367
- private static readonly MOQ_RECONNECT_INITIAL_DELAY_MS;
368
- private static readonly MOQ_RECONNECT_MAX_DELAY_MS;
369
- private presenceInterval;
370
- private hostedAppSettingsLoaded;
371
370
  private effectiveRoomBackendTag;
372
- private _moqSession;
373
- private _moqState;
374
- private moqReadyListeners;
375
- private moqFailedListeners;
376
- private moqObjectListeners;
377
- private moqReconnectTimer;
378
- private moqReconnectAttempts;
379
- private readonly moqPeerSubscriptions;
380
371
  roomCreationMode: RoomCreationMode;
381
372
  constructor(options: ClientOptions);
382
- private sleep;
383
- private installAppLifecycleListeners;
384
- private handleAppBackgroundState;
385
- private reconcileConnectionsAfterForeground;
373
+ private get services();
374
+ private createServiceGraph;
375
+ get wasmClient(): any;
376
+ set wasmClient(client: any);
377
+ get node(): any;
378
+ set node(node: any);
379
+ getApplicationCrypto(connection?: Connection): ApplicationPayloadCrypto | undefined;
380
+ resolveApplicationCryptoForPeer(peerId?: string, connection?: Connection): ApplicationPayloadCrypto | undefined;
381
+ waitForApplicationCryptoForPeer(peerId?: string, timeoutMs?: number): Promise<ApplicationPayloadCrypto | undefined>;
382
+ destroy(): void;
383
+ dispose(): void;
386
384
  get apiKey(): string | undefined;
387
385
  get discoveryMode(): DiscoveryMode;
388
- private usesTicketOnlySignalingMode;
389
386
  usesDirectRoomBackend(): boolean;
390
387
  getRoomBackendTag(): string;
391
388
  refreshHostedAppSettings(force?: boolean): Promise<void>;
392
389
  setSignalingBackend(backend: ISignalingBackend): void;
393
- get currentUser(): RuntimeIdentity | null;
390
+ get currentUser(): any;
394
391
  onAuthChange(callback: (user: any) => void): () => void;
395
- signInAnonymously(): Promise<void>;
396
- signInWithPluto(): Promise<void>;
397
- signOut(): Promise<void>;
392
+ signInAnonymously(): Promise<unknown>;
393
+ signInWithPluto(): Promise<unknown>;
394
+ signOut(): Promise<unknown>;
398
395
  getSignalingTelemetry(): {
399
396
  transport: string;
400
397
  wasmLoaded: boolean;
398
+ peerReconciliation: Readonly<PeerReconciliationStats>;
401
399
  };
400
+ getPeerReconciliationStats(): Readonly<PeerReconciliationStats>;
402
401
  getProtocolCapabilities(): ProtocolCapabilityMap;
403
402
  getRuntimeStatus(): Promise<{
404
403
  runtime: 'tauri' | 'browser' | 'unknown';
@@ -406,36 +405,6 @@ declare class Client {
406
405
  localNodeId?: string;
407
406
  userId?: string;
408
407
  }>;
409
- private ensureWasmRuntimeForP2P;
410
- private usesNativeIpcRuntimeWithoutWasmFallback;
411
- private nativeWasmInitForbiddenError;
412
- private ensureSignalingReadyForDiscovery;
413
- private requiresManagedTransportTrust;
414
- private getRegisteredChannel;
415
- private isChannelPromotionEligible;
416
- private isTransportOnlyChannel;
417
- private getConnectionChannelId;
418
- private isTransportOnlyConnectionId;
419
- private resolvePromotionEligibility;
420
- private assignConnectionChannel;
421
- private rememberKnownDevice;
422
- private getKnownDevice;
423
- private refreshKnownDeviceCache;
424
- private initializeConnectionTrust;
425
- private consumePendingSessionTokenTrustApproval;
426
- private applySessionTokenTrustApproval;
427
- private getConnectionTrustState;
428
- private getConnectionTrustProjection;
429
- private applyConnectionTrustProjection;
430
- private getConnectionTransportProjectionState;
431
- private buildLocalTransportTrustPayload;
432
- private sendTransportHandshake;
433
- private broadcastTransportCapabilityUpdate;
434
- private verifyRemoteTransportTrust;
435
- private enforceConnectionTrustFailure;
436
- private markConnectionTrustVerified;
437
- private bindConnectionDeviceIdInRust;
438
- private retireSupersededConnections;
439
408
  searchDevices(): Promise<Device[]>;
440
409
  updateDevice(deviceId: string, updates: {
441
410
  deviceName?: string;
@@ -444,53 +413,29 @@ declare class Client {
444
413
  }): Promise<void>;
445
414
  deleteDevice(deviceId: string): Promise<void>;
446
415
  cleanupStaleDevices(): Promise<void>;
447
- onDevicesChange(callback: any): () => void;
448
- subscribeSessions(localDeviceId: string, callback: (session: SignalingSession) => void): Promise<() => void>;
416
+ onDevicesChange(callback: (devices: Device[]) => void): () => void;
417
+ subscribeSessions(localDeviceId: string, callback: (session: SignalingSession) => void | Promise<void>): Promise<() => void>;
449
418
  startScanningLoop(options: ScanningLoopOptions): Promise<ScanningLoopHandle>;
450
419
  connectDeviceWithRetry(device: Device, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise<ConnectDeviceResult>;
451
420
  bootstrapRuntime(options: RuntimeBootstrapOptions): Promise<RuntimeBootstrapResult>;
452
421
  updateTransportConfig(transports: ClientOptions['transports']): void;
453
- private getTurnCredentialsForTransportConfig;
454
- /**
455
- * Bootstraps the WASM module and Rust signaling.
456
- * Must be called before connect or createRoom.
457
- */
458
422
  init(): Promise<void>;
459
423
  ensureAuthenticated(reason: 'init' | 'room-op' | 'discovery'): Promise<void>;
460
- private installAuthTokenSync;
461
- private syncAuthTokenToWasm;
462
- get moqState(): "none" | "failed" | "connecting" | "ready";
463
- get moq(): {
464
- session: MoQSession;
465
- publisher: MoQPublisher;
466
- subscriber: MoQSubscriber;
467
- } | null;
468
- onMoQReady(cb: () => void): void;
469
- onMoQFailed(cb: () => void): void;
470
- onMoQObject(callback: (ns: string, name: string, obj: Uint8Array, meta: any) => void): void;
471
- private clearMoQReconnectTimer;
472
- private closeMoQSession;
473
- private handleMoQSessionClosed;
474
- private scheduleMoQReconnect;
475
- private enableMoQForConnection;
476
- private subscribeMoQPeer;
477
- private resubscribeMoQPeers;
478
- private initMoQ;
479
- connect(ticket: string, timeoutMs?: number, expectedDeviceId?: string | null, channelId?: string): Promise<Connection>;
480
- /**
481
- * Low-level dial helper.
482
- * Ensures the ticket is connected and returns only connection identity metadata.
483
- */
424
+ refreshRuntimeAuthToken(reason?: 'runtime-start' | 'managed-session'): Promise<void>;
425
+ get moqState(): string;
426
+ get moq(): MoQBundle | null;
427
+ onMoQReady(cb: () => void): () => void;
428
+ onMoQFailed(cb: () => void): () => void;
429
+ onMoQObject(callback: (ns: string, name: string, obj: Uint8Array, meta: any) => void): () => void;
430
+ connect(ticket: string, timeoutMs?: number, expectedDeviceId?: string | null, channelId?: string, options?: {
431
+ admissionAlreadyPresented?: boolean;
432
+ approvedScope?: string | null;
433
+ }): Promise<Connection>;
484
434
  connectRaw(ticket: string, timeoutMs?: number): Promise<{
485
435
  connectionId: string;
486
436
  localNodeId: string;
487
437
  remoteNodeId: string;
488
438
  }>;
489
- /**
490
- * Start core-managed auto-connect for the authenticated user.
491
- * This is intentionally low-level: callers decide when to start/stop and
492
- * what higher-level protocol to run on top of the resulting connection.
493
- */
494
439
  startAutoConnect(localDeviceId?: string): Promise<void>;
495
440
  openBi(peerId: string): Promise<{
496
441
  readable: ReadableStream<Uint8Array>;
@@ -498,7 +443,9 @@ declare class Client {
498
443
  }>;
499
444
  openUni(peerId: string): Promise<WritableStream<Uint8Array>>;
500
445
  getConnections(): Connection[];
446
+ getApplicationReadyConnections(options?: ApplicationPayloadReadinessOptions): Connection[];
501
447
  getConnectionForPeer(connectionId?: string, remoteNodeId?: string): Connection | null;
448
+ hasApplicationRouteForPeer(connectionId?: string, remoteNodeId?: string): boolean;
502
449
  watchPeerStates(callback: (peers: PeerState[]) => void): () => void;
503
450
  getPeerState(id: string): PeerState | undefined;
504
451
  listConnectedPeers(): PeerState[];
@@ -518,169 +465,37 @@ declare class Client {
518
465
  ticket?: string;
519
466
  scope?: PeerScope;
520
467
  channelId?: string;
468
+ respectManualDisconnect?: boolean;
521
469
  }): Promise<Connection>;
522
470
  clearManualDisconnectProjection(id: string): void;
523
471
  disconnectPeer(id: string, scope?: PeerScope): Promise<void>;
524
472
  forceDisconnectPeer(id: string): Promise<void>;
525
473
  getPeerHealth(id: string): Promise<PeerHealth>;
526
- private mapRustPeerStatus;
527
- private mapRustPeerHealth;
528
474
  getTicket(): Promise<string>;
529
475
  getNodeId(): Promise<string>;
530
476
  getNodeIdFromTicket(ticket: string): Promise<string | null>;
531
- /**
532
- * Generate a random session token, register it, and return a compound
533
- * ticket string with the token suffix appended.
534
- *
535
- * @param grantScope Admission-grant label (e.g. "share"). Used for bulk revoke in Rust.
536
- * This is distinct from `PeerScope`, which only tracks local peer lifecycle.
537
- * @param maxConnections 0 = unlimited.
538
- */
539
477
  getEndpointTicketWithToken(grantScope: GrantScope, maxConnections?: number): Promise<string>;
540
- /**
541
- * Build a compound ticket from an externally-provided iroh ticket string.
542
- * Generates a session token, registers it with the Rust wasm client when available,
543
- * and appends the token
544
- * payload as a base64url suffix separated by `.`.
545
- *
546
- * Used by RuntimeClient.getTicketWithToken() on native desktop where the
547
- * iroh ticket comes from the Rust backend (via Tauri IPC) rather than the
548
- * WASM node running in the webview.
549
- */
550
478
  buildCompoundTicketWithToken(irohTicket: string, grantScope: GrantScope, maxConnections?: number): string;
551
479
  setManagedPresenceTicket(ticket: string | null): void;
552
480
  clearManagedPresenceTicket(): void;
553
- /** Register an externally-generated session token with the Rust wasm client. */
554
481
  registerSessionToken(token: string, grantScope: GrantScope, maxConnections: number): void;
555
- /** Revoke a specific session token. */
556
482
  revokeSessionToken(token: string): void;
557
- /** Revoke all tokens that match the given scope. */
558
483
  revokeTokensByScope(grantScope: GrantScope): Promise<string[]>;
559
- private static generateSessionToken;
560
- private static encodeSessionTokenPayload;
561
- private static buildCompoundTicketWithPayload;
562
484
  clearSessionTokens(): Promise<void>;
563
- private resolvePresenceTicket;
564
- private refreshManagedPresenceTicketIfNeeded;
565
- private validateIncomingSessionToken;
566
- private validateIncomingSessionTokenWithRetry;
567
- /**
568
- * Start the signaling-backed presence loop owned by the Rust core.
569
- * A ticket can be provided explicitly, otherwise the current endpoint ticket is used.
570
- */
571
485
  startPresenceLoop(options?: {
572
486
  deviceName?: string;
573
487
  ticket?: string;
574
488
  metadata?: string;
575
489
  }): Promise<void>;
576
- /**
577
- * Mark local presence offline in the signaling backend.
578
- */
579
490
  setOffline(): Promise<void>;
580
- /**
581
- * Check raw connectivity against a remote node id.
582
- */
583
491
  isConnected(nodeId: string): Promise<boolean>;
584
- /**
585
- * Disconnect a remote node from the local connection manager.
586
- */
587
492
  disconnectNode(nodeId: string): Promise<void>;
588
493
  getLocalDeviceId(): Promise<string | null>;
589
- /**
590
- * Route a raw message received on a native iroh connection through token
591
- * validation. Called by RuntimeClient when NativeIpcBridge fires an
592
- * `iroh://message` event for an incoming native connection.
593
- *
594
- * If we have a TS Connection object for this peer (e.g. the client also
595
- * called connect()), route through handleMessage. Otherwise, for connections
596
- * that were accepted purely by the Rust protocol handler, perform token
597
- * validation directly.
598
- *
599
- * @returns true if the connection should be rejected (caller should disconnect)
600
- */
601
494
  acceptNativeMessage(connectionId: string | null, remoteNodeId: string | null, msg: any): Promise<boolean>;
602
495
  startListening(): Promise<void>;
603
496
  stopListening(): void;
604
- private getSharedIncomingStreamHub;
605
- private nextIncomingStreamRetryDelayMs;
606
- private getRuntimeSafetyProfile;
607
- private shouldVerboseIncomingDiagnostics;
608
- private shouldUseTransportOnlyChannelConnection;
609
- private createTransportOnlyChannelConnection;
610
- private shouldInspectIncomingChannelEnvelope;
611
- private createTransportContext;
612
- private hasTransportOnlyConnectionForRemoteNode;
613
- private shouldSkipIncomingBiProbeForRemoteNode;
614
- private disconnectNodeTransport;
615
- private nextIncomingTraceId;
616
- private logIncomingDiagnostic;
617
- private awaitConnectEventReady;
618
- private safeReleaseReaderLock;
619
- /**
620
- * Force an immediate presence update and reconnect snapshot.
621
- */
622
497
  forceReconnectSnapshot(): void;
623
- private updatePresenceInternal;
624
- private listenLoop;
625
- private prependChunkToReadable;
626
- private cancelUnhandledIncomingUniStream;
627
- private prependBytesToReader;
628
- private concatBytes;
629
- private encodeChannelEnvelope;
630
498
  wrapChannelWritable(writable: WritableStream<Uint8Array>, channelId: string, metadata?: Record<string, unknown> | null): WritableStream<Uint8Array>;
631
- private extractIncomingChannelEnvelope;
632
- private isBiStreamLike;
633
- private materializeIncomingBiStream;
634
- private rebuildBiIncomingStream;
635
- private classifyBiIncomingStream;
636
- private detectNativeMainStream;
637
- private resolveLocalHandshakePayload;
638
- private getDeterministicConnectionId;
639
- private getNativeMainConnectionId;
640
- private findManualDisconnectProjectionForNativeNode;
641
- private hasKnownConnectionForRemoteNode;
642
- private inferTicketFlowBiProtocolHint;
643
- private hasRustPeerLifecycleProjection;
644
- private shouldProjectNativeMainLifecycle;
645
- private emitNativeMainConnectionState;
646
- private applyBackendConnectionState;
647
- private encodeNativeMainFrame;
648
- private dispatchNativeMainMessage;
649
- private writeNativeMainMessage;
650
- private handleNativeHandshakeRequest;
651
- private handleNativeSessionTokenRequest;
652
- private isNativeSignalEnvelope;
653
- private buildNativeMainPayload;
654
- private buildFramedMessage;
655
- private buildNativeMainLabelHeader;
656
- private writeNativeMainLabelHeaderOnBiStream;
657
- private registerInboundNativeMainWriter;
658
- private clearInboundNativeMainWriter;
659
- private sendNativeSignalViaInboundControlStream;
660
- private sendNativeSignalViaDedicatedStream;
661
- private sendNativeSignalEnvelope;
662
- private ensureIncomingConnectionForRemoteNode;
663
- private handleNativeMainStream;
664
- private tryExtractNativeMainPayload;
665
- private isCoreConnectionHealthy;
666
- private waitForStableConnection;
667
- private announceConnectionWhenStable;
668
- private normalizeIncomingStreamEvent;
669
- private hasIncomingChannelListener;
670
- private hasAnyIncomingChannelListeners;
671
- private dispatchIncomingChannelListeners;
672
- private dispatchIncomingGenericListeners;
673
- private shouldTreatIncomingStreamAsTransportOnly;
674
- private handleUnhandledIncomingStreamEvent;
675
- private isHandshakeMessage;
676
- private handleIncomingStream;
677
- private maybeHandleWebRTCExplicitFileEnvelope;
678
- private reassembleWebRTCExplicitPayload;
679
- private dispatchSyntheticExplicitIncomingStream;
680
- private registerConnection;
681
- private reportConnectionTransportStatus;
682
- private syncConnectionPeerLifecycle;
683
- private getPeerCandidates;
684
499
  updatePresence(isOnline?: boolean, ttlMs?: number, metadata?: string, ticketOverride?: string): Promise<void>;
685
500
  onConnection(callback: (conn: Connection) => void): () => void;
686
501
  onDisconnection(callback: (conn: Connection) => void): () => void;
@@ -691,16 +506,10 @@ declare class Client {
691
506
  listChannels(): ChannelDescriptor[];
692
507
  onIncomingChannelStream(channelId: string, callback: (stream: IncomingStreamListenerEvent) => boolean | void): () => void;
693
508
  onRoomJoinRequest(callback: (request: JoinRequest) => void): () => void;
694
- private createMoQDataTracks;
695
- /**
696
- * Send data via MoQ.
697
- * @param peerId Target Node ID (for 1:1) or null (for Broadcast)
698
- * @param data Payload
699
- */
700
- sendMoQData(peerId: string | null, data: Uint8Array): Promise<void>;
701
- private handleMessage;
702
- private isWebRTCTransportEnabled;
703
- private getRTCConfig;
509
+ isMoQDataReady(peerId: string | null): boolean;
510
+ sendMoQData(peerId: string | null, data: Uint8Array, options?: {
511
+ alreadyProtected?: boolean;
512
+ }): Promise<void>;
704
513
  }
705
514
 
706
515
  /**
@@ -793,4 +602,9 @@ declare function clog(tag: string, fields: CorrelationFields, message?: string,
793
602
  */
794
603
  declare function logOpenRtcTeardownTrace(kind: string, details?: Record<string, unknown>): void;
795
604
 
796
- export { type CorrelationFields, RuntimeConnectionController, RuntimeConnectionTarget, RuntimeRawConnection, clog, correlationForDriveGrantScope, logOpenRtcTeardownTrace, renderCorrelationFields };
605
+ declare function openRtcDebugEnabled(): boolean;
606
+ declare function openRtcDebug(message: string, data?: unknown): void;
607
+ declare function openRtcDebugInfo(message: string, data?: unknown): void;
608
+ declare function openRtcDebugLog(message: string, data?: unknown): void;
609
+
610
+ export { type CorrelationFields, RuntimeCapabilities, RuntimeConnectionController, RuntimeConnectionTarget, RuntimeRawConnection, clog, correlationForDriveGrantScope, logOpenRtcTeardownTrace, openRtcDebug, openRtcDebugEnabled, openRtcDebugInfo, openRtcDebugLog, renderCorrelationFields };