openrtc 2.3.1 → 2.5.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 (92) hide show
  1. package/README.md +77 -5
  2. package/dist/BrowserManagedBroadcastHost-ARCP5MGJ.js +1 -0
  3. package/dist/{ITransport-CjxCQ6q7.d.ts → Connection-CTpuImO-.d.ts} +610 -95
  4. package/dist/DelegatingRuntimeAdapter-D67Ozqo3.d.ts +154 -0
  5. package/dist/IpcRuntimeAdapter-Ddx0MtSI.d.ts +86 -0
  6. package/dist/WasmBridge-ZXBCXBBM.js +1 -0
  7. package/dist/{assembly-Bmi65-tK.d.ts → assembly-DvfsYFCL.d.ts} +41 -19
  8. package/dist/{capabilities-BPuynml5.d.ts → capabilities-CmzzxSvW.d.ts} +14 -7
  9. package/dist/chunk-2GX6GB6L.js +1 -0
  10. package/dist/chunk-2K47N3QP.js +2 -0
  11. package/dist/chunk-72NEEJQG.js +1 -0
  12. package/dist/chunk-AYHD4X2R.js +1 -0
  13. package/dist/chunk-BFN3AVHA.js +2 -0
  14. package/dist/chunk-BGWJHPBC.js +2 -0
  15. package/dist/chunk-CCCYE3XN.js +1 -0
  16. package/dist/chunk-EIJNERKZ.js +1 -0
  17. package/dist/chunk-FEF3DPPB.js +1 -0
  18. package/dist/chunk-GHAJW6SZ.js +2 -0
  19. package/dist/chunk-GTHSRQ7Y.js +2 -0
  20. package/dist/chunk-JPBW67B3.js +1 -0
  21. package/dist/chunk-LLZT3MR6.js +118 -0
  22. package/dist/chunk-N6LGTNUI.js +1 -0
  23. package/dist/{chunk-4MLJXEVV.js → chunk-NDR2ANQB.js} +1 -1
  24. package/dist/chunk-OT7IPLZE.js +1 -0
  25. package/dist/chunk-OWKAJPOI.js +1 -0
  26. package/dist/chunk-TYZS5LXQ.js +2 -0
  27. package/dist/chunk-VFDCIEP6.js +2 -0
  28. package/dist/chunk-VTYVIKTM.js +1 -0
  29. package/dist/chunk-XTYALGJN.js +2 -0
  30. package/dist/{chunk-KRJECX7X.js → chunk-Z4KJHIV5.js} +1 -1
  31. package/dist/chunk-Z54XUIKZ.js +1 -0
  32. package/dist/{controlPlane-KVFZ7BR5.js → controlPlane-IIPEJ77Q.js} +1 -1
  33. package/dist/coreClient.d.ts +3 -4
  34. package/dist/coreClient.js +1 -1
  35. package/dist/{deviceEnrollment-VACC64CQ.js → deviceEnrollment-ZQZ2WP5H.js} +2 -2
  36. package/dist/{deviceKey-Y35WSEQQ.js → deviceKey-EIMDBAQS.js} +1 -1
  37. package/dist/{dist-FIVA6EPA.js → dist-XO466BRG.js} +18 -0
  38. package/dist/index.d.ts +7 -7
  39. package/dist/index.js +1 -1
  40. package/dist/{ipc-CPnNwv6f.d.ts → ipc-DgzKqHH3.d.ts} +3 -0
  41. package/dist/ipcFactory-PRAJ7JP7.js +1 -0
  42. package/dist/native.d.ts +21 -0
  43. package/dist/native.js +1 -0
  44. package/dist/node-browser.d.ts +8 -0
  45. package/dist/node-browser.js +1 -0
  46. package/dist/node.d.ts +87 -0
  47. package/dist/node.js +2 -0
  48. package/dist/openrtc-VCS6V3AN.js +2 -0
  49. package/dist/openrtc_bg.wasm +0 -0
  50. package/dist/protocol-BSBjMb7p.d.ts +6 -0
  51. package/dist/room-ULZ2FGWV.js +1 -0
  52. package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -5
  53. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  54. package/dist/runtime/device-status.d.ts +1 -2
  55. package/dist/runtime/factories.d.ts +352 -8
  56. package/dist/runtime/factories.js +1 -1
  57. package/dist/runtime/index.d.ts +15 -161
  58. package/dist/runtime/index.js +1 -1
  59. package/dist/server-browser.d.ts +14 -0
  60. package/dist/server-browser.js +1 -0
  61. package/dist/server.d.ts +44 -0
  62. package/dist/server.js +2 -0
  63. package/dist/service-node.d.ts +155 -0
  64. package/dist/service-node.js +1 -0
  65. package/dist/testing/native.d.ts +11 -0
  66. package/dist/testing/native.js +1 -0
  67. package/dist/testing.d.ts +47 -20
  68. package/dist/testing.js +1 -1
  69. package/dist/transport/index.d.ts +7 -18
  70. package/dist/transport/index.js +1 -1
  71. package/dist/types-Cyc-mPjk.d.ts +650 -0
  72. package/package.json +35 -3
  73. package/dist/DelegatingRuntimeAdapter-DE4LTGAJ.d.ts +0 -399
  74. package/dist/IpcRuntimeAdapter-CE0va9Tr.d.ts +0 -19
  75. package/dist/WasmBridge-75F6GKHG.js +0 -1
  76. package/dist/chunk-2L6ULC32.js +0 -1
  77. package/dist/chunk-2SUSPEC4.js +0 -1
  78. package/dist/chunk-7BJKDBLP.js +0 -2
  79. package/dist/chunk-AJQVMVYW.js +0 -1
  80. package/dist/chunk-BOS554IK.js +0 -2
  81. package/dist/chunk-HEAJ7ZUR.js +0 -1
  82. package/dist/chunk-HUG5AX7R.js +0 -1
  83. package/dist/chunk-Q6KXVTSH.js +0 -2
  84. package/dist/chunk-R35AWMNY.js +0 -1
  85. package/dist/chunk-UILOGUOU.js +0 -1
  86. package/dist/chunk-WA434EWD.js +0 -2
  87. package/dist/chunk-XAL4T6TB.js +0 -3
  88. package/dist/chunk-Z2IS6NH2.js +0 -2
  89. package/dist/ipcFactory-32R47AVK.js +0 -1
  90. package/dist/openrtc-MWLNTJI7.js +0 -2
  91. package/dist/types--jQzenZR.d.ts +0 -295
  92. package/dist/types-DDhMQkK8.d.ts +0 -621
@@ -0,0 +1,650 @@
1
+ import { PeerNamespace, ChannelNamespace, DiagnosticsNamespace, DeviceNamespace } from './coreClient.js';
2
+ import { R as RoomArchitectureMode, b as RoomArchitectureSnapshot, c as RoomAuthorityAssignment, C as ChannelDescriptor, P as PlutoIrohConfiguration, d as PlutoRTCConfiguration, e as PlutoMoQConfiguration, f as RouteOptimization, g as ProtocolName } from './Connection-CTpuImO-.js';
3
+
4
+ interface AuthProvider {
5
+ /** Registered provider ID from the developer app capability manifest. */
6
+ readonly providerId?: string;
7
+ /**
8
+ * Stable, non-secret, local-only identifier for the currently signed-in
9
+ * principal. It changes on login, logout, or account switch, but never for
10
+ * an ordinary access-token refresh. OpenRTC hashes this value together
11
+ * with the app and installation-key thumbprint before persisting a lookup.
12
+ *
13
+ * Optional because assertion-only providers remain valid, though they
14
+ * cannot skip the assertion exchange on a cold process start.
15
+ */
16
+ getSessionKey?(): Promise<string | null>;
17
+ getAssertion(input: {
18
+ audience: 'https://api.openrtc.app/v2/assertions/exchange';
19
+ forceRefresh: boolean;
20
+ /**
21
+ * Stable OpenRTC installation ID being enrolled. Consumer backends
22
+ * may bind product admission (for example a paid device allowance) to
23
+ * this value in the signed assertion. It is supplied only for an
24
+ * enrollment/renewal assertion, never for hourly gateway refreshes.
25
+ */
26
+ deviceId: string;
27
+ /**
28
+ * Present only after OpenRTC receives the exact structured response
29
+ * indicating that this installation ID is enrolled with another
30
+ * public key. Consumer backends should require recent interactive
31
+ * authentication before authorizing the replacement.
32
+ */
33
+ recoveryReason?: 'device-key-rotation';
34
+ }): Promise<string | null>;
35
+ /**
36
+ * Optional identity-epoch observer. Notify only when the signed-in
37
+ * principal/session changes (login, logout, account switch, or explicit
38
+ * revocation). Do not notify for ordinary OAuth/Firebase access-token
39
+ * refreshes: OpenRTC refreshes its own avenue grant in place.
40
+ */
41
+ subscribe?(listener: (event: {
42
+ type: 'principal-changed';
43
+ sessionKey: string | null;
44
+ }) => void): () => void;
45
+ }
46
+ interface EnrolledDevice {
47
+ deviceId: string;
48
+ name?: string;
49
+ platform?: string;
50
+ enrolledAtMs: number | null;
51
+ lastGrantAtMs: number | null;
52
+ current: boolean;
53
+ }
54
+ /**
55
+ * Public, non-secret presentation metadata for one enrolled installation.
56
+ * OpenRTC derives a useful browser default when these fields are omitted;
57
+ * native hosts should pass the OS/device information reported by their host.
58
+ */
59
+ interface DeviceProfile {
60
+ /** Human-readable label such as `Bryant's iPhone` or `Chrome on Android`. */
61
+ name?: string;
62
+ /** Raw OS/runtime label such as `ios`, `android`, `macos`, or `web`. */
63
+ platform?: string;
64
+ /** Optional application-owned public presence metadata, bounded to 4 KiB. */
65
+ metadata?: string;
66
+ }
67
+ interface AttestationProvider {
68
+ readonly kind: 'firebase-app-check' | 'apple-app-attest' | 'play-integrity' | `custom:${string}`;
69
+ /**
70
+ * Describes what the provider actually signs. Reusable app-integrity
71
+ * tokens (for example Firebase App Check) do not become request-bound just
72
+ * because OpenRTC supplies an enrollment challenge. The server derives and
73
+ * enforces the authoritative binding from the registered provider kind;
74
+ * this field keeps host integrations and diagnostics honest.
75
+ */
76
+ readonly evidenceBinding: 'app-session' | 'request-challenge';
77
+ getEvidence(input: {
78
+ challenge: string;
79
+ apiKey: string;
80
+ }): Promise<{
81
+ token: string;
82
+ }>;
83
+ }
84
+ /**
85
+ * Optional consumer-owned bot challenge. Core OpenRTC does not render a UI or
86
+ * load a CAPTCHA dependency; the host supplies a fresh token only when its
87
+ * developer manifest requires anonymous capability verification.
88
+ */
89
+ interface BotVerificationProvider {
90
+ getToken(input: {
91
+ action: 'openrtc_capability';
92
+ apiKey: string;
93
+ }): Promise<string>;
94
+ }
95
+ interface UsageUpdate {
96
+ sessionCreditsUsd: number;
97
+ operation: string;
98
+ estimated: boolean;
99
+ }
100
+ interface UsageWarning extends UsageUpdate {
101
+ thresholdCreditsUsd: number;
102
+ kind: 'warning' | 'session-limit';
103
+ }
104
+ interface Transports {
105
+ iroh?: boolean | PlutoIrohConfiguration;
106
+ webrtc?: boolean | PlutoRTCConfiguration;
107
+ /**
108
+ * Allow relay mechanisms. Defaults to true; set false for direct-only P2P.
109
+ * The authenticated runtime tracks Iroh relay and managed TURN readiness
110
+ * independently; this option is intent, not proof that either is deployed.
111
+ */
112
+ relay?: boolean;
113
+ moq?: boolean | PlutoMoQConfiguration;
114
+ ble?: boolean;
115
+ /**
116
+ * Advanced privacy mode. `relay-only` suppresses direct Iroh addresses,
117
+ * local discovery, and host/srflx WebRTC candidates. It also requires the
118
+ * developer manifest's relay opt-in.
119
+ */
120
+ privacy?: 'direct' | 'relay-only';
121
+ /** Optimize eligible routes for stability/cost or measured latency. */
122
+ optimizeFor?: RouteOptimization;
123
+ /** Exact route order. Unsupported routes are skipped, never treated as failures. */
124
+ priority?: readonly ProtocolName[];
125
+ }
126
+ interface Options {
127
+ apiKey: string;
128
+ auth?: AuthProvider;
129
+ trust?: {
130
+ attestation?: AttestationProvider;
131
+ botVerification?: BotVerificationProvider;
132
+ };
133
+ usage?: {
134
+ warnAtSessionCreditsUsd?: number;
135
+ maxSessionCreditsUsd?: number;
136
+ onUsage?: (event: UsageUpdate) => void;
137
+ onWarning?: (warning: UsageWarning) => void;
138
+ };
139
+ transports?: Transports;
140
+ }
141
+ type AccessMode = 'capability' | 'authenticated';
142
+ type Delivery = 'reliable' | 'latest-state';
143
+ interface PeerStreamOptions {
144
+ /** Registered application protocol used by the single incoming classifier. */
145
+ protocol: string;
146
+ timeoutMs?: number;
147
+ }
148
+ interface PeerBidirectionalStream {
149
+ readonly protocol: string;
150
+ readonly readable: ReadableStream<Uint8Array>;
151
+ readonly writable: WritableStream<Uint8Array>;
152
+ }
153
+ interface IncomingPeerBidirectionalStream extends PeerBidirectionalStream {
154
+ readonly peerId: string;
155
+ }
156
+ interface IncomingPeerUnidirectionalStream {
157
+ readonly peerId: string;
158
+ readonly protocol: string;
159
+ readonly readable: ReadableStream<Uint8Array>;
160
+ }
161
+ interface PeerDatagramDuplexStream {
162
+ readonly maxDatagramSize: number;
163
+ /** Drop received datagrams older than this many milliseconds; `null` disables expiry. */
164
+ incomingMaxAge: number | null;
165
+ /** Drop queued outgoing datagrams older than this many milliseconds; `null` disables expiry. */
166
+ outgoingMaxAge: number | null;
167
+ /** Bounded application receive queue. */
168
+ incomingMaxBufferedDatagrams: number;
169
+ /** Bounded application send queue. */
170
+ outgoingMaxBufferedDatagrams: number;
171
+ readonly readable: ReadableStream<Uint8Array>;
172
+ readonly writable: WritableStream<Uint8Array>;
173
+ getStats(): PeerDatagramStats;
174
+ }
175
+ interface PeerDatagramStats {
176
+ received: number;
177
+ sent: number;
178
+ bytesReceived: number;
179
+ bytesSent: number;
180
+ droppedIncoming: number;
181
+ droppedOutgoing: number;
182
+ expiredIncoming: number;
183
+ expiredOutgoing: number;
184
+ sendFailures: number;
185
+ incomingBufferedDatagrams: number;
186
+ outgoingBufferedDatagrams: number;
187
+ }
188
+ interface PeerStreamTransport {
189
+ createBidirectionalStream(options: PeerStreamOptions): Promise<PeerBidirectionalStream>;
190
+ createUnidirectionalStream(options: PeerStreamOptions): Promise<WritableStream<Uint8Array>>;
191
+ readonly incomingBidirectionalStreams: ReadableStream<IncomingPeerBidirectionalStream>;
192
+ readonly incomingUnidirectionalStreams: ReadableStream<IncomingPeerUnidirectionalStream>;
193
+ readonly datagrams: PeerDatagramDuplexStream;
194
+ }
195
+ type MediaKind = 'audio' | 'video';
196
+ interface MediaTrackOptions {
197
+ streams?: readonly MediaStream[];
198
+ /** Browser codec preference. Web Audio edges default to PCM; other browser audio defaults to Opus. */
199
+ codec?: string;
200
+ bitrate?: number;
201
+ }
202
+ /** Bounded local monotonic-clock samples; this is not cross-peer latency. */
203
+ interface MediaLatencySummary {
204
+ samples: number;
205
+ p50Ms: number;
206
+ p95Ms: number;
207
+ p99Ms: number;
208
+ maxMs: number;
209
+ }
210
+ interface MediaSenderStats {
211
+ publicationId: string;
212
+ mediaGeneration: number;
213
+ accepted: number;
214
+ /** Encoded chunks currently waiting on the protected logical stream. */
215
+ queued: number;
216
+ /** Encoded payload bytes currently waiting on the protected logical stream. */
217
+ queuedBytes: number;
218
+ /** Age of the oldest currently queued encoded payload. */
219
+ queuedAgeMs: number;
220
+ transmitted: number;
221
+ dropped: number;
222
+ bytes: number;
223
+ maxQueued: number;
224
+ maxQueuedBytes: number;
225
+ maxQueuedAgeMs: number;
226
+ /** Most recent asynchronous encoder or protected-stream failure, if any. */
227
+ lastError?: string;
228
+ encodeLatency: MediaLatencySummary;
229
+ protectedWriteLatency: MediaLatencySummary;
230
+ }
231
+ interface MediaReceiverStats {
232
+ publicationId: string;
233
+ mediaGeneration: number;
234
+ received: number;
235
+ decoded: number;
236
+ rendered: number;
237
+ dropped: number;
238
+ integrityFailures: number;
239
+ malformedFrames: number;
240
+ replayDrops: number;
241
+ /** Successful resumptions on a video keyframe after corruption or loss. */
242
+ videoRecoveries: number;
243
+ /** Whether dependent video is currently being discarded until a keyframe. */
244
+ awaitingKeyframe: boolean;
245
+ /** Longest local receive-side wait for a recovery keyframe. */
246
+ maxVideoRecoveryMs: number;
247
+ bytes: number;
248
+ decoderQueued: number;
249
+ maxDecoderQueued: number;
250
+ renderQueued: number;
251
+ maxRenderQueued: number;
252
+ receiveToDecodeLatency: MediaLatencySummary;
253
+ renderWriteLatency: MediaLatencySummary;
254
+ }
255
+ interface MediaIncomingDemuxStats {
256
+ /** Whether this connection's protected peer-stream channel listener is installed. */
257
+ registered: boolean;
258
+ /** Existing public peers known to this capability router. */
259
+ peers: number;
260
+ /** Rust logical connection identities bound to those peers. */
261
+ boundConnections: number;
262
+ /** Protected streams offered to this capability router. */
263
+ observed: number;
264
+ /** Streams claimed by an existing public peer and protocol handler. */
265
+ accepted: number;
266
+ /** Streams this capability correctly left for another capability router. */
267
+ declined: number;
268
+ /** Most recent identifier-free ownership decision. */
269
+ lastResolution: 'none' | 'connection' | 'remote-peer' | 'peer-alias' | 'unbound-connection';
270
+ }
271
+ interface MediaStats {
272
+ senders: readonly MediaSenderStats[];
273
+ receivers: readonly MediaReceiverStats[];
274
+ /** Bounded receiver setup/runtime failures for streams that never produced a receiver. */
275
+ incomingFailures: readonly string[];
276
+ /** Number of protected publication streams delivered by protocol dispatch. */
277
+ incomingProtocolStreams: number;
278
+ /** Transport-agnostic protected-stream ownership diagnostics. */
279
+ incomingDemux: MediaIncomingDemuxStats;
280
+ }
281
+ interface MediaSender {
282
+ readonly id: string;
283
+ readonly track: MediaStreamTrack | null;
284
+ replaceTrack(track: MediaStreamTrack | null): Promise<void>;
285
+ setEnabled(enabled: boolean): Promise<void>;
286
+ stop(): Promise<void>;
287
+ getStats(): Promise<MediaSenderStats>;
288
+ }
289
+ interface MediaReceiver {
290
+ readonly id: string;
291
+ readonly track: MediaStreamTrack;
292
+ getStats(): Promise<MediaReceiverStats>;
293
+ }
294
+ interface MediaTrackEvent {
295
+ readonly track: MediaStreamTrack;
296
+ readonly receiver: MediaReceiver;
297
+ readonly streams: readonly MediaStream[];
298
+ }
299
+ interface MediaConnection {
300
+ addTrack(track: MediaStreamTrack, options?: MediaTrackOptions): Promise<MediaSender>;
301
+ removeTrack(sender: MediaSender): Promise<void>;
302
+ onTrack(callback: (event: MediaTrackEvent) => void): () => void;
303
+ senders(): readonly MediaSender[];
304
+ receivers(): readonly MediaReceiver[];
305
+ getStats(): Promise<MediaStats>;
306
+ }
307
+ interface Connection {
308
+ /** Stable logical peer identity. It does not change when Rust replaces a physical connection or carrier. */
309
+ readonly id: string;
310
+ readonly peerId: string;
311
+ readonly streams: PeerStreamTransport;
312
+ readonly media: MediaConnection;
313
+ send(message: unknown): Promise<void>;
314
+ onMessage<T = unknown>(callback: (message: T) => void): () => void;
315
+ onClose(callback: () => void): () => void;
316
+ }
317
+ interface Channel<T> {
318
+ send(message: T): Promise<void>;
319
+ sendTo(peerId: string, message: T): Promise<void>;
320
+ /**
321
+ * The event peerId is the authenticated device ID for sparse broadcasts;
322
+ * direct channels retain the connection peer ID.
323
+ */
324
+ onMessage(callback: (event: {
325
+ peerId: string;
326
+ message: T;
327
+ }) => void): () => void;
328
+ }
329
+ interface State<T> {
330
+ /** Replace the locally published value. Delivery is best-effort and coalesced. */
331
+ set(value: T): void;
332
+ /** A null value means the peer disconnected. */
333
+ watch(callback: (event: {
334
+ peerId: string;
335
+ value: T | null;
336
+ }) => void): () => void;
337
+ }
338
+ interface Avenue {
339
+ readonly kind: 'devices' | 'space' | 'room' | 'ticket';
340
+ readonly id: string;
341
+ readonly peers: PeerNamespace;
342
+ readonly channels: ChannelNamespace;
343
+ readonly diagnostics: DiagnosticsNamespace;
344
+ readonly closed: boolean;
345
+ state<T>(name: string): State<T>;
346
+ channel<T>(name: string): Channel<T>;
347
+ /** Observe current and future connections without taking lifecycle ownership. */
348
+ onConnection(callback: (connection: Connection) => void): () => void;
349
+ close(): Promise<void>;
350
+ }
351
+ interface Devices extends Avenue {
352
+ readonly kind: 'devices';
353
+ localId(): ReturnType<DeviceNamespace['localId']>;
354
+ localInfo(): ReturnType<DeviceNamespace['localInfo']>;
355
+ list(): ReturnType<DeviceNamespace['list']>;
356
+ listWithStatus(): ReturnType<DeviceNamespace['listWithStatus']>;
357
+ watch: DeviceNamespace['watch'];
358
+ connect: DeviceNamespace['connect'];
359
+ disconnect: DeviceNamespace['disconnect'];
360
+ }
361
+ interface Space extends Avenue {
362
+ readonly kind: 'space';
363
+ readonly delivery: Delivery;
364
+ leave(): Promise<void>;
365
+ }
366
+ interface Room extends Avenue {
367
+ readonly kind: 'room';
368
+ readonly membership: 'ephemeral' | 'durable';
369
+ /** Current room-wide architecture chosen by the gateway policy owner. */
370
+ architecture(): RoomArchitectureSnapshot;
371
+ /** Emits the current snapshot immediately, then later committed changes. */
372
+ onArchitectureChanged(callback: (snapshot: RoomArchitectureSnapshot) => void): () => void;
373
+ /** Current signed application-interest assignment, if authority mode has assigned this client. */
374
+ authorityAssignment(): RoomAuthorityAssignment | null;
375
+ /** Emits the current assignment immediately, then later admitted revisions. */
376
+ onAuthorityAssignmentChanged(callback: (assignment: RoomAuthorityAssignment | null) => void): () => void;
377
+ leave(): Promise<void>;
378
+ }
379
+ interface Ticket extends Avenue {
380
+ readonly kind: 'ticket';
381
+ /**
382
+ * Opaque, install-bound OpenRTC capability credential. This is not a
383
+ * transferable invitation or recipient redemption token. Do not display,
384
+ * log, persist, or send it to another installation.
385
+ * @deprecated This credential exposure is retained only for RC source
386
+ * compatibility and will not be part of the stable invitation workflow.
387
+ */
388
+ readonly token: string;
389
+ }
390
+ interface DeviceOptions {
391
+ auth?: AuthProvider;
392
+ autoConnect?: 'none' | 'online';
393
+ /**
394
+ * Durable device IDs that automatic discovery must not connect to.
395
+ * Load persisted exclusions before calling `devices.start()` so the Rust
396
+ * owner and the first coordination presence share one atomic policy.
397
+ */
398
+ autoConnectExcludedDeviceIds?: readonly string[];
399
+ /** Optional local profile; it does not alter the durable device identity. */
400
+ profile?: DeviceProfile;
401
+ maxPeers?: number;
402
+ /** Requires the app manifest's advanced-fanout opt-in. */
403
+ advancedFanout?: boolean;
404
+ }
405
+ interface SpaceOptions {
406
+ access?: 'capability';
407
+ /** Use a new memory-only identity for this OpenRTC client run. */
408
+ identity?: 'session';
409
+ payload?: Delivery;
410
+ maxPeers?: number;
411
+ /** Requires the app manifest's advanced-fanout opt-in. */
412
+ advancedFanout?: boolean;
413
+ }
414
+ interface RoomOptions {
415
+ access?: AccessMode;
416
+ membership?: 'ephemeral' | 'durable';
417
+ /** Use a new memory-only identity for this anonymous room client run. */
418
+ identity?: 'session';
419
+ auth?: AuthProvider;
420
+ maxPeers?: number;
421
+ /**
422
+ * Declares the room's delivery semantics for architecture selection.
423
+ * Reliable is the safe default. Sparse rooms require latest-state data.
424
+ */
425
+ payload?: Delivery;
426
+ /**
427
+ * Defaults to auto. A fixed mode is room-wide and may still fail safety or
428
+ * budget gates. Managed is reserved but unavailable in 2.5.
429
+ */
430
+ architecture?: RoomArchitectureMode;
431
+ /**
432
+ * Requires the app manifest's reviewed advanced-fanout opt-in. Rooms then
433
+ * use a four-neighbor sparse overlay with bounded named-channel gossip.
434
+ * @deprecated Use `architecture: 'sparse'`. Removed in the next major.
435
+ */
436
+ advancedFanout?: boolean;
437
+ }
438
+ interface TicketOptions {
439
+ /** Use a new memory-only identity for this ticket client run. */
440
+ identity?: 'session';
441
+ maxPeers?: number;
442
+ /** Requires the app manifest's advanced-fanout opt-in. */
443
+ advancedFanout?: boolean;
444
+ }
445
+ interface Channels {
446
+ register(descriptor: ChannelDescriptor): () => void;
447
+ list(): readonly ChannelDescriptor[];
448
+ }
449
+ interface Usage {
450
+ estimate(input: {
451
+ operation: string;
452
+ units?: number;
453
+ }): {
454
+ creditsUsd: number;
455
+ estimated: true;
456
+ };
457
+ estimateRoom(input: RoomUsageEstimateInput): RoomUsageEstimate;
458
+ readonly sessionCreditsUsd: number;
459
+ }
460
+ interface RoomUsageEstimateInput {
461
+ /** Managed quotes are unavailable in 2.5 and fail with `room-architecture-unavailable`. */
462
+ architecture?: RoomArchitectureMode;
463
+ maxMembers: number;
464
+ durationSeconds: number;
465
+ delivery: Delivery;
466
+ maxPayloadBytes: number;
467
+ maxMessagesPerSecond: number;
468
+ }
469
+ interface RoomUsageEstimate {
470
+ architecture: RoomArchitectureMode;
471
+ effectiveArchitecture: Exclude<RoomArchitectureMode, 'auto'>;
472
+ creditsUsd: number;
473
+ estimated: true;
474
+ expiresAtMs: number;
475
+ assumptions: readonly string[];
476
+ }
477
+ type OfflineAssurance = 'software' | 'hardware-backed' | 'manufacturer' | 'gateway';
478
+ interface OfflineRuntimeSupport {
479
+ provisioning: boolean;
480
+ localMesh: boolean;
481
+ cloudRequired: false;
482
+ reason?: string;
483
+ }
484
+ interface OfflineEnrollmentRequest {
485
+ body: {
486
+ protocol: 'openrtc-offline-device/1';
487
+ trustDomain: string;
488
+ deviceId: string;
489
+ endpointId: string;
490
+ proofPublicKey: string;
491
+ enrollmentNonce: string;
492
+ requestedRoles: string[];
493
+ /** Informational request metadata; the fleet issuer certifies the credential assurance. */
494
+ requestedAssurance: OfflineAssurance;
495
+ createdAtMs: number;
496
+ };
497
+ proofSignature: string;
498
+ }
499
+ interface Offline {
500
+ support(): Promise<OfflineRuntimeSupport>;
501
+ /** Native Rust signs this request; private key bytes never enter JavaScript. */
502
+ createEnrollmentRequest(options: {
503
+ trustDomain: string;
504
+ requestedRoles: string[];
505
+ }): Promise<OfflineEnrollmentRequest>;
506
+ }
507
+ /** Opaque, short-lived, installation-bound broadcast authority. */
508
+ type BroadcastGrant = string & {
509
+ readonly __openrtcBroadcastGrant: unique symbol;
510
+ };
511
+ /** Single-use bearer invitation. Send it only to the intended recipient. */
512
+ type BroadcastInvite = string & {
513
+ readonly __openrtcBroadcastInvite: unique symbol;
514
+ };
515
+ type BroadcastRole = 'owner' | 'publisher' | 'subscriber' | 'processor';
516
+ type BroadcastState = 'opening' | 'live' | 'retrying' | 'closed' | 'failed';
517
+ interface BroadcastSource {
518
+ /** Anonymous slot such as `host-a`; never a device, endpoint, or provider ID. */
519
+ readonly id: string;
520
+ readonly alias?: string;
521
+ }
522
+ interface BroadcastTrackEvent extends MediaTrackEvent {
523
+ readonly source: BroadcastSource;
524
+ }
525
+ interface BroadcastMedia {
526
+ addTrack(track: MediaStreamTrack, options?: MediaTrackOptions): Promise<MediaSender>;
527
+ removeTrack(sender: MediaSender): Promise<void>;
528
+ onTrack(callback: (event: BroadcastTrackEvent) => void): () => void;
529
+ senders(): readonly MediaSender[];
530
+ receivers(): readonly MediaReceiver[];
531
+ }
532
+ interface BroadcastStats {
533
+ queuedMediaBytes: number;
534
+ droppedMediaObjects: number;
535
+ publishedBytes: number;
536
+ deliveredBytes: number;
537
+ retries: number;
538
+ }
539
+ /** Non-peer relay publication/subscription. It never exposes a carrier or provider handle. */
540
+ interface BroadcastSession {
541
+ readonly id: string;
542
+ readonly role: BroadcastRole;
543
+ readonly state: BroadcastState;
544
+ readonly media: BroadcastMedia;
545
+ getStats(): Promise<BroadcastStats>;
546
+ close(): Promise<void>;
547
+ }
548
+ /**
549
+ * Runtime-owned publisher identity. Only its public verification key is
550
+ * exportable; the sign-only private key remains inside native Rust or WASM.
551
+ */
552
+ interface BroadcastPublisher {
553
+ readonly verificationKey: Uint8Array;
554
+ open(grant: BroadcastGrant): Promise<BroadcastSession>;
555
+ close(): Promise<void>;
556
+ }
557
+ interface BroadcastCreateOptions {
558
+ /** Rust/WASM/native signer whose public key is bound into the owner grant. */
559
+ publisher: BroadcastPublisher;
560
+ auth?: AuthProvider;
561
+ sourceSlot?: string;
562
+ maxPublishers: number;
563
+ maxSubscribers: number;
564
+ maxBitrateBps: number;
565
+ maxDurationSeconds: number;
566
+ maxEgressBytes: number;
567
+ /** Actual initial owner publication reservation, not the broadcast ceiling. */
568
+ publisherBitrateBps: number;
569
+ /** Actual initial owner/viewer egress reservation, not the broadcast ceiling. */
570
+ reservedEgressBytes: number;
571
+ }
572
+ interface BroadcastInviteOptions {
573
+ role: 'publisher' | 'subscriber';
574
+ /** Required for publishers; obtained from that co-host's prepared signer. */
575
+ publicationVerificationKey?: Uint8Array;
576
+ /** Required and unique for publishers; omitted for subscribers. */
577
+ sourceSlot?: string;
578
+ bitrateBps: number;
579
+ durationSeconds: number;
580
+ reservedEgressBytes: number;
581
+ }
582
+ interface Client {
583
+ readonly offline: Offline;
584
+ readonly devices: {
585
+ /**
586
+ * Returns this installation's durable, app-scoped device ID without
587
+ * starting a capability or performing network work.
588
+ */
589
+ localId(): Promise<string>;
590
+ start(options?: DeviceOptions): Promise<Devices>;
591
+ listEnrolled(options?: {
592
+ auth?: AuthProvider;
593
+ }): Promise<EnrolledDevice[]>;
594
+ revoke(deviceId: string, options?: {
595
+ auth?: AuthProvider;
596
+ }): Promise<void>;
597
+ revokeAll(options?: {
598
+ auth?: AuthProvider;
599
+ exceptCurrent?: boolean;
600
+ }): Promise<void>;
601
+ };
602
+ readonly spaces: {
603
+ join(id: string, options?: SpaceOptions): Promise<Space>;
604
+ };
605
+ readonly rooms: {
606
+ join(id: string, options?: RoomOptions): Promise<Room>;
607
+ };
608
+ readonly tickets: {
609
+ issue(id: string, options?: TicketOptions): Promise<Ticket>;
610
+ };
611
+ readonly broadcasts: {
612
+ /** Reserve hard limits and mint a device/key-bound owner grant. */
613
+ create(options: BroadcastCreateOptions): Promise<BroadcastGrant>;
614
+ /** The signed grant decides the role; options cannot promote the caller. */
615
+ open(grant: BroadcastGrant): Promise<BroadcastSession>;
616
+ /** Familiar viewer alias for `open`; the grant still decides the role. */
617
+ subscribe(grant: BroadcastGrant): Promise<BroadcastSession>;
618
+ /** Prepare a runtime-owned signer before requesting a publisher grant. */
619
+ preparePublisher(): Promise<BroadcastPublisher>;
620
+ /** Renewal advances the grant generation; it never mutates in place. */
621
+ renew(grant: BroadcastGrant, options?: {
622
+ auth?: AuthProvider;
623
+ }): Promise<BroadcastGrant>;
624
+ /** Create a single-use role invitation; capacity is reserved on accept. */
625
+ invite(ownerGrant: BroadcastGrant, options: BroadcastInviteOptions & {
626
+ auth?: AuthProvider;
627
+ }): Promise<BroadcastInvite>;
628
+ /** Bind an invitation to this installation and mint its role grant. */
629
+ accept(invite: BroadcastInvite, options?: {
630
+ auth?: AuthProvider;
631
+ }): Promise<BroadcastGrant>;
632
+ /** Owner-only targeted revoke; the accepted invitation identifies one role/source. */
633
+ revoke(ownerGrant: BroadcastGrant, options: {
634
+ invite: BroadcastInvite;
635
+ auth?: AuthProvider;
636
+ }): Promise<void>;
637
+ /** Retire this installation's own role grant. */
638
+ leave(grant: BroadcastGrant, options?: {
639
+ auth?: AuthProvider;
640
+ }): Promise<void>;
641
+ close(grant: BroadcastGrant, options?: {
642
+ auth?: AuthProvider;
643
+ }): Promise<void>;
644
+ };
645
+ readonly channels: Channels;
646
+ readonly usage: Usage;
647
+ close(): Promise<void>;
648
+ }
649
+
650
+ export type { Space as $, AccessMode as A, BotVerificationProvider as B, Client as C, Delivery as D, EnrolledDevice as E, MediaReceiverStats as F, MediaSender as G, MediaSenderStats as H, IncomingPeerBidirectionalStream as I, MediaStats as J, MediaTrackEvent as K, MediaTrackOptions as L, MediaConnection as M, Offline as N, Options as O, OfflineAssurance as P, OfflineEnrollmentRequest as Q, OfflineRuntimeSupport as R, PeerBidirectionalStream as S, PeerDatagramDuplexStream as T, PeerDatagramStats as U, PeerStreamOptions as V, PeerStreamTransport as W, Room as X, RoomOptions as Y, RoomUsageEstimate as Z, RoomUsageEstimateInput as _, AttestationProvider as a, SpaceOptions as a0, State as a1, Ticket as a2, TicketOptions as a3, Transports as a4, Usage as a5, UsageUpdate as a6, UsageWarning as a7, AuthProvider as b, Avenue as c, BroadcastCreateOptions as d, BroadcastGrant as e, BroadcastInvite as f, BroadcastInviteOptions as g, BroadcastMedia as h, BroadcastPublisher as i, BroadcastRole as j, BroadcastSession as k, BroadcastSource as l, BroadcastState as m, BroadcastStats as n, BroadcastTrackEvent as o, Channel as p, Channels as q, Connection as r, DeviceOptions as s, DeviceProfile as t, Devices as u, IncomingPeerUnidirectionalStream as v, MediaIncomingDemuxStats as w, MediaKind as x, MediaLatencySummary as y, MediaReceiver as z };