openrtc 0.1.3 → 0.2.1

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 (41) hide show
  1. package/LICENSE +92 -0
  2. package/README.md +73 -9
  3. package/dist/DelegatingRuntimeAdapter-BxOcVIx_.d.ts +201 -0
  4. package/dist/{IpcRuntimeAdapter-CT-W0Mtp.d.ts → IpcRuntimeAdapter-U5AEH0jn.d.ts} +6 -2
  5. package/dist/auth/index.js +1 -1
  6. package/dist/auth/internal.js +1 -1
  7. package/dist/chunk-7DN33VUQ.js +1 -0
  8. package/dist/chunk-BLOEZIFJ.js +1 -0
  9. package/dist/chunk-FQETZQPW.js +2 -0
  10. package/dist/chunk-IUHUYHNZ.js +1 -0
  11. package/dist/chunk-UBEE42VU.js +2 -0
  12. package/dist/chunk-UPO23UMZ.js +3 -0
  13. package/dist/chunk-WNJE3MJF.js +1 -0
  14. package/dist/{factories-0TxDPMeu.d.ts → framing-lxzHEuSr.d.ts} +479 -226
  15. package/dist/index.d.ts +201 -7
  16. package/dist/index.js +2 -1
  17. package/dist/openrtc_bg.wasm +0 -0
  18. package/dist/runtime/WasmRuntimeAdapter.d.ts +2 -1
  19. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  20. package/dist/runtime/index.d.ts +213 -392
  21. package/dist/runtime/index.js +1 -1
  22. package/dist/runtime/tauri.d.ts +5 -6
  23. package/dist/runtime/tauri.js +1 -1
  24. package/dist/transport/index.d.ts +11 -0
  25. package/dist/transport/index.js +1 -0
  26. package/dist/{DelegatingRuntimeAdapter-CW8d78dZ.d.ts → types-D0fRvUbN.d.ts} +222 -171
  27. package/env/index.d.ts +64 -0
  28. package/env/index.mjs +230 -0
  29. package/package.json +29 -18
  30. package/dist/chunk-26POO5PL.js +0 -4
  31. package/dist/chunk-4MH42GUI.js +0 -2
  32. package/dist/chunk-D54VGRRH.js +0 -1
  33. package/dist/chunk-DIQYFAGL.js +0 -2
  34. package/dist/chunk-PZ25OCVG.js +0 -2
  35. package/dist/chunk-UVASANPG.js +0 -1
  36. package/wasm/README.md +0 -64
  37. package/wasm/openrtc.d.ts +0 -320
  38. package/wasm/openrtc.js +0 -2290
  39. package/wasm/openrtc_bg.wasm +0 -0
  40. package/wasm/openrtc_bg.wasm.d.ts +0 -113
  41. 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, Q as RuntimeConnectionTarget, y as RuntimeRawConnection } from '../framing-lxzHEuSr.js';
2
+ export { z as ChannelDescriptor, A as ConnectionEvent, B as ConnectionTarget, D as DeviceProfile, E as IncomingStream, O as OPENRTC_RUNTIME_POLICY, F as PeerConnectOptions, G as PeerReadiness, H as PeerStreamOptions, x as PlutoRuntimeAssembly, J as PresenceLoopOptions, K as RawConnection, v as RuntimeApplicationPayloadReadinessOptions, L as RuntimeAuthContext, M as RuntimeAuthIdentity, N as RuntimeAutoConnectPolicy, m as RuntimeChannelDescriptor, a as RuntimeClient, R as RuntimeClientOptions, w as RuntimeConnectionEvent, u as RuntimeConnectionStateSnapshot, d as RuntimeDevice, aj as RuntimeDeviceActiveOptions, f as RuntimeDeviceConnectOptions, S as RuntimeDevicePresenceStatus, T as RuntimeDeviceStatus, e as RuntimeDeviceStatusSnapshot, ak as RuntimeFactoryOptions, o as RuntimeIncomingStream, r as RuntimeJoinRoomOptions, al as RuntimeJsonFrameDecoderOptions, U as RuntimeJsonFrameHandler, g as RuntimeLocalDeviceInfo, h as RuntimeLocalDeviceProfile, V as RuntimeLogicalChannelFraming, c as RuntimeManagedSession, W as RuntimeManagedSessionKind, b as RuntimeManagedSessionOptions, X as RuntimeManagedSessionPlatform, j as RuntimePeerConnectOptions, l as RuntimePeerHealth, Y as RuntimePeerLifecycleStatus, k as RuntimePeerReadinessSnapshot, Z as RuntimePeerScope, _ as RuntimePeerSessionSnapshot, i as RuntimePeerState, n as RuntimePeerStreamOptions, t as RuntimePolicySnapshot, $ as RuntimePresenceLoopOptions, a0 as RuntimePresencePolicy, s as RuntimeRoomMember, p as RuntimeScopedChannelOptions, q as RuntimeScopedLogicalChannel, a1 as RuntimeSession, a2 as RuntimeU32BEFrameHandler, a3 as RuntimeUiConnectionStatus, a4 as ScopedChannelOptions, am as ScopedConnectionActorError, an as ScopedConnectionActorErrorKind, ao as ScopedConnectionActorHandle, ap as ScopedConnectionActorHandleOptions, aq as ScopedConnectionActorRegistry, ar as ScopedConnectionActorState, as as ScopedConnectionClose, at as ScopedConnectionDial, au as ScopedConnectionKey, a5 as ScopedLogicalChannel, av as ScopedLogicalChannelHandle, aw as ScopedPreferredTransport, ax as Session, ay as SessionOptions, az as concatRuntimeBytes, aA as createIpcClient, a9 as createRuntimeJsonFrameDecoder, aa as createRuntimeU32BEFrameDecoder, aB as createWasmClient, ab as decodeRuntimeJsonPayload, ac as encodeRuntimeJsonFrame, ad as encodeRuntimeJsonPayload, ae as encodeRuntimeU32BEFrame, af as getRuntimePolicy, ag as isRuntimeDeviceActive, ah as isRuntimeDeviceConnectable, ai as isRuntimeDeviceRoutable, aC as readRuntimeU32BE, aD as scopedConnectionKey, aE as scopedConnectionKeyToString } from '../framing-lxzHEuSr.js';
3
+ import { K as SignalingOptions, I as ISignalingBackend, R as RuntimeIdentity, d as SignalingEnvelope, f as SignalingSession, a as Device, j as BackendConnectionState, t as AppLimits, O as JoinRoomOptions, Q as RoomMember, T as IncomingStreamChannelMetadata, r as ApplicationCryptoStreamTools, U as RoomCreationMode, C as ClientOptions, q as ApplicationPayloadCrypto, D as DiscoveryMode, p as ProtocolCapabilityMap, V as ScanningLoopOptions, W as ScanningLoopHandle, l as ConnectDeviceHooks, m as ConnectDeviceOptions, k as ConnectDeviceResult, X as RuntimeBootstrapOptions, Y as RuntimeBootstrapResult, v as ApplicationPayloadReadinessOptions, Z as PeerState, _ as PeerScope, $ as PeerHealth, G as GrantScope, a0 as ChannelDescriptor, a1 as JoinRequest, i as NativeConnectResult } from '../types-D0fRvUbN.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-BxOcVIx_.js';
6
+ export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, c as NativeRuntimeStatusSnapshot, d as NativeRuntimeTransportFeatureStatus, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile, e as cloneRuntimeCapabilities, r as runtimeCapabilitiesFromNativeStatus, f as runtimeCapabilityProfile } from '../DelegatingRuntimeAdapter-BxOcVIx_.js';
7
+ export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, b as NativeIpcFailureKind, P as PlutoIpcBridge, c as PlutoIpcUnlisten, d as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../IpcRuntimeAdapter-U5AEH0jn.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,109 @@ 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 resolveRoomUserId;
324
+ private get appTag();
325
+ private invokeRoomCallable;
326
+ private isAlreadyExistsError;
327
+ private normalizeRoomId;
328
+ private getMembersInternal;
329
+ private parseMemberDocuments;
330
+ private parseRoomMemberDocument;
331
+ /**
332
+ * Creates a new room. When `requestedRoomId` is provided, the backend will
333
+ * try to create that exact room ID instead of generating a random one.
334
+ */
335
+ createRoom(requestedRoomId?: string): Promise<string>;
336
+ /**
337
+ * Joins a room by ID.
338
+ */
339
+ joinRoom(roomId: string, options?: JoinRoomOptions): Promise<Connection[]>;
340
+ leaveRoom(roomId: string): Promise<void>;
341
+ getRoomMembers(roomId: string): Promise<RoomMember[]>;
342
+ watchRoom(roomId: string, callback: (members: RoomMember[]) => void): () => void;
343
+ /**
344
+ * Register this device as an online room member in RTDB and store a
345
+ * cleanup callback in heartbeatStops (keyed by roomId) so that
346
+ * stopHeartbeat() / leaveRoom() can trigger graceful offline marking.
347
+ */
348
+ private registerRtdbRoomMember;
349
+ private markRtdbRoomMemberOffline;
350
+ stopHeartbeat(roomId?: string): void;
351
+ }
352
+
269
353
  type IncomingProtocolHint = 'control' | 'explicit' | 'native-main' | 'unknown';
270
354
  type IncomingStreamListenerEvent = {
271
355
  type: 'bi' | 'uni';
@@ -274,131 +358,49 @@ type IncomingStreamListenerEvent = {
274
358
  traceId?: string;
275
359
  protocolHint?: IncomingProtocolHint;
276
360
  channel?: IncomingStreamChannelMetadata | null;
361
+ applicationCrypto?: ApplicationCryptoStreamTools;
277
362
  invalid?: boolean;
278
363
  };
279
364
 
280
365
  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
366
  signaling: Signaling;
299
367
  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;
368
+ private _services?;
345
369
  private options;
346
370
  private readonly runtimeSafetyProfile;
347
371
  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
372
  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
373
  roomCreationMode: RoomCreationMode;
381
374
  constructor(options: ClientOptions);
382
- private sleep;
383
- private installAppLifecycleListeners;
384
- private handleAppBackgroundState;
385
- private reconcileConnectionsAfterForeground;
375
+ private get services();
376
+ private createServiceGraph;
377
+ get wasmClient(): any;
378
+ set wasmClient(client: any);
379
+ get node(): any;
380
+ set node(node: any);
381
+ attachIncomingStreamSource(source: unknown, localNodeId: string): void;
382
+ getApplicationCrypto(connection?: Connection): ApplicationPayloadCrypto | undefined;
383
+ resolveApplicationCryptoForPeer(peerId?: string, connection?: Connection): ApplicationPayloadCrypto | undefined;
384
+ waitForApplicationCryptoForPeer(peerId?: string, timeoutMs?: number): Promise<ApplicationPayloadCrypto | undefined>;
385
+ destroy(): void;
386
+ dispose(): void;
386
387
  get apiKey(): string | undefined;
387
388
  get discoveryMode(): DiscoveryMode;
388
- private usesTicketOnlySignalingMode;
389
389
  usesDirectRoomBackend(): boolean;
390
390
  getRoomBackendTag(): string;
391
391
  refreshHostedAppSettings(force?: boolean): Promise<void>;
392
392
  setSignalingBackend(backend: ISignalingBackend): void;
393
- get currentUser(): RuntimeIdentity | null;
393
+ get currentUser(): any;
394
394
  onAuthChange(callback: (user: any) => void): () => void;
395
- signInAnonymously(): Promise<void>;
396
- signInWithPluto(): Promise<void>;
397
- signOut(): Promise<void>;
395
+ signInAnonymously(): Promise<unknown>;
396
+ signInWithPluto(): Promise<unknown>;
397
+ signOut(): Promise<unknown>;
398
398
  getSignalingTelemetry(): {
399
399
  transport: string;
400
400
  wasmLoaded: boolean;
401
+ peerReconciliation: Readonly<PeerReconciliationStats>;
401
402
  };
403
+ getPeerReconciliationStats(): Readonly<PeerReconciliationStats>;
402
404
  getProtocolCapabilities(): ProtocolCapabilityMap;
403
405
  getRuntimeStatus(): Promise<{
404
406
  runtime: 'tauri' | 'browser' | 'unknown';
@@ -406,36 +408,6 @@ declare class Client {
406
408
  localNodeId?: string;
407
409
  userId?: string;
408
410
  }>;
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
411
  searchDevices(): Promise<Device[]>;
440
412
  updateDevice(deviceId: string, updates: {
441
413
  deviceName?: string;
@@ -444,53 +416,31 @@ declare class Client {
444
416
  }): Promise<void>;
445
417
  deleteDevice(deviceId: string): Promise<void>;
446
418
  cleanupStaleDevices(): Promise<void>;
447
- onDevicesChange(callback: any): () => void;
448
- subscribeSessions(localDeviceId: string, callback: (session: SignalingSession) => void): Promise<() => void>;
419
+ onDevicesChange(callback: (devices: Device[]) => void): () => void;
420
+ subscribeSessions(localDeviceId: string, callback: (session: SignalingSession) => void | Promise<void>): Promise<() => void>;
449
421
  startScanningLoop(options: ScanningLoopOptions): Promise<ScanningLoopHandle>;
450
422
  connectDeviceWithRetry(device: Device, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise<ConnectDeviceResult>;
451
423
  bootstrapRuntime(options: RuntimeBootstrapOptions): Promise<RuntimeBootstrapResult>;
452
424
  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
425
  init(): Promise<void>;
459
426
  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
- */
427
+ refreshRuntimeAuthToken(reason?: 'runtime-start' | 'managed-session'): Promise<void>;
428
+ get moqState(): string;
429
+ get moq(): MoQBundle | null;
430
+ onMoQReady(cb: () => void): () => void;
431
+ onMoQFailed(cb: () => void): () => void;
432
+ onMoQObject(callback: (ns: string, name: string, obj: Uint8Array, meta: any) => void): () => void;
433
+ subscribeMoQPeer(connection: Connection): void;
434
+ subscribeMoQPeerNode(peerId: string, subscriptionKey?: string): void;
435
+ connect(ticket: string, timeoutMs?: number, expectedDeviceId?: string | null, channelId?: string, options?: {
436
+ admissionAlreadyPresented?: boolean;
437
+ approvedScope?: string | null;
438
+ }): Promise<Connection>;
484
439
  connectRaw(ticket: string, timeoutMs?: number): Promise<{
485
440
  connectionId: string;
486
441
  localNodeId: string;
487
442
  remoteNodeId: string;
488
443
  }>;
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
444
  startAutoConnect(localDeviceId?: string): Promise<void>;
495
445
  openBi(peerId: string): Promise<{
496
446
  readable: ReadableStream<Uint8Array>;
@@ -498,7 +448,9 @@ declare class Client {
498
448
  }>;
499
449
  openUni(peerId: string): Promise<WritableStream<Uint8Array>>;
500
450
  getConnections(): Connection[];
451
+ getApplicationReadyConnections(options?: ApplicationPayloadReadinessOptions): Connection[];
501
452
  getConnectionForPeer(connectionId?: string, remoteNodeId?: string): Connection | null;
453
+ hasApplicationRouteForPeer(connectionId?: string, remoteNodeId?: string): boolean;
502
454
  watchPeerStates(callback: (peers: PeerState[]) => void): () => void;
503
455
  getPeerState(id: string): PeerState | undefined;
504
456
  listConnectedPeers(): PeerState[];
@@ -518,169 +470,39 @@ declare class Client {
518
470
  ticket?: string;
519
471
  scope?: PeerScope;
520
472
  channelId?: string;
473
+ respectManualDisconnect?: boolean;
521
474
  }): Promise<Connection>;
522
475
  clearManualDisconnectProjection(id: string): void;
523
476
  disconnectPeer(id: string, scope?: PeerScope): Promise<void>;
524
477
  forceDisconnectPeer(id: string): Promise<void>;
525
478
  getPeerHealth(id: string): Promise<PeerHealth>;
526
- private mapRustPeerStatus;
527
- private mapRustPeerHealth;
528
479
  getTicket(): Promise<string>;
529
480
  getNodeId(): Promise<string>;
530
481
  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
482
  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
483
  buildCompoundTicketWithToken(irohTicket: string, grantScope: GrantScope, maxConnections?: number): string;
551
484
  setManagedPresenceTicket(ticket: string | null): void;
552
485
  clearManagedPresenceTicket(): void;
553
- /** Register an externally-generated session token with the Rust wasm client. */
554
486
  registerSessionToken(token: string, grantScope: GrantScope, maxConnections: number): void;
555
- /** Revoke a specific session token. */
556
487
  revokeSessionToken(token: string): void;
557
- /** Revoke all tokens that match the given scope. */
558
488
  revokeTokensByScope(grantScope: GrantScope): Promise<string[]>;
559
- private static generateSessionToken;
560
- private static encodeSessionTokenPayload;
561
- private static buildCompoundTicketWithPayload;
562
489
  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
490
  startPresenceLoop(options?: {
572
491
  deviceName?: string;
573
492
  ticket?: string;
574
493
  metadata?: string;
575
494
  }): Promise<void>;
576
- /**
577
- * Mark local presence offline in the signaling backend.
578
- */
579
495
  setOffline(): Promise<void>;
580
- /**
581
- * Check raw connectivity against a remote node id.
582
- */
583
496
  isConnected(nodeId: string): Promise<boolean>;
584
- /**
585
- * Disconnect a remote node from the local connection manager.
586
- */
587
497
  disconnectNode(nodeId: string): Promise<void>;
588
498
  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
499
  acceptNativeMessage(connectionId: string | null, remoteNodeId: string | null, msg: any): Promise<boolean>;
602
- startListening(): Promise<void>;
500
+ startListening(options?: {
501
+ startPresence?: boolean;
502
+ }): Promise<void>;
603
503
  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
504
  forceReconnectSnapshot(): void;
623
- private updatePresenceInternal;
624
- private listenLoop;
625
- private prependChunkToReadable;
626
- private cancelUnhandledIncomingUniStream;
627
- private prependBytesToReader;
628
- private concatBytes;
629
- private encodeChannelEnvelope;
630
505
  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
506
  updatePresence(isOnline?: boolean, ttlMs?: number, metadata?: string, ticketOverride?: string): Promise<void>;
685
507
  onConnection(callback: (conn: Connection) => void): () => void;
686
508
  onDisconnection(callback: (conn: Connection) => void): () => void;
@@ -691,16 +513,10 @@ declare class Client {
691
513
  listChannels(): ChannelDescriptor[];
692
514
  onIncomingChannelStream(channelId: string, callback: (stream: IncomingStreamListenerEvent) => boolean | void): () => void;
693
515
  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;
516
+ isMoQDataReady(peerId: string | null): boolean;
517
+ sendMoQData(peerId: string | null, data: Uint8Array, options?: {
518
+ alreadyProtected?: boolean;
519
+ }): Promise<void>;
704
520
  }
705
521
 
706
522
  /**
@@ -793,4 +609,9 @@ declare function clog(tag: string, fields: CorrelationFields, message?: string,
793
609
  */
794
610
  declare function logOpenRtcTeardownTrace(kind: string, details?: Record<string, unknown>): void;
795
611
 
796
- export { type CorrelationFields, RuntimeConnectionController, RuntimeConnectionTarget, RuntimeRawConnection, clog, correlationForDriveGrantScope, logOpenRtcTeardownTrace, renderCorrelationFields };
612
+ declare function openRtcDebugEnabled(): boolean;
613
+ declare function openRtcDebug(message: string, data?: unknown): void;
614
+ declare function openRtcDebugInfo(message: string, data?: unknown): void;
615
+ declare function openRtcDebugLog(message: string, data?: unknown): void;
616
+
617
+ export { type CorrelationFields, RuntimeCapabilities, RuntimeConnectionController, RuntimeConnectionTarget, RuntimeRawConnection, clog, correlationForDriveGrantScope, logOpenRtcTeardownTrace, openRtcDebug, openRtcDebugEnabled, openRtcDebugInfo, openRtcDebugLog, renderCorrelationFields };