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
@@ -1,3 +1,372 @@
1
+ type AuthContext = {
2
+ userId: string;
3
+ token?: string | null;
4
+ refreshToken?: string | null;
5
+ customToken?: string | null;
6
+ tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
7
+ /**
8
+ * Supplies the platform attestation token required by the configured
9
+ * control plane. Firebase-backed hosted deployments use App Check today;
10
+ * keeping acquisition on the auth context prevents coordination code from
11
+ * owning a second Firebase app or assuming one global project.
12
+ */
13
+ appCheckTokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
14
+ expiresAtMs?: number | null;
15
+ };
16
+
17
+ /**
18
+ * App-facing options intentionally hide transport node identifiers from callbacks.
19
+ */
20
+ type RuntimeClientOptions = Omit<ClientOptions, 'onDevices' | 'onAutoConnect' | 'onIncomingSession' | 'coordinationAvenueOverride' | 'coordinationRoomGossipFanout' | 'coordinationRoomArchitecture' | 'coordinationDevicePublicKeyX' | 'coordinationDeviceSign' | 'coordinationPlatformType'> & {
21
+ onDevices?: (devices: RuntimeDevice[]) => void;
22
+ onAutoConnect?: (devices: RuntimeDevice[]) => void;
23
+ onIncomingSession?: (session: RuntimeSession) => Promise<void>;
24
+ };
25
+ /**
26
+ * App-facing device model. Runtime transport identifiers stay internal.
27
+ */
28
+ type RuntimeDevice = Omit<Device, 'nodeId'>;
29
+ /**
30
+ * App-facing session model. Node identifiers are runtime-internal metadata.
31
+ */
32
+ type RuntimeSession = Omit<SignalingSession, 'initiatorNodeId' | 'targetNodeId' | 'appTag'>;
33
+ type RuntimeAuthIdentity = RuntimeIdentity;
34
+ type RuntimeAuthContext = AuthContext;
35
+ /**
36
+ * App-facing peer state model. Runtime transport identifiers stay internal.
37
+ */
38
+ type RuntimePeerState = Omit<PeerState, 'nodeId'>;
39
+ type RuntimePeerHealth = PeerHealth;
40
+ type PeerLifecycleStatus$1 = PeerLifecycleStatus;
41
+ type RuntimePeerScope = PeerScope;
42
+ /**
43
+ * App-facing peer session snapshot model. Runtime transport identifiers stay internal.
44
+ */
45
+ type PeerSessionSnapshot$1 = Omit<PeerSessionSnapshot, 'nodeId'>;
46
+ type LocalDeviceInfo$1 = LocalDeviceInfo;
47
+ type RuntimeRoomMember = RoomMember;
48
+ type DeviceConnectOptions = ManagedDeviceConnectOptions;
49
+ type JoinRoomOptions$1 = JoinRoomOptions;
50
+ type ChannelDescriptor$1 = ChannelDescriptor;
51
+ interface ConnectionTarget {
52
+ ticket: string;
53
+ timeoutMs?: number;
54
+ }
55
+ /**
56
+ * Durable browser storage used by the optional upstream Iroh docs, blobs, and
57
+ * gossip protocols. Implementations normally map these atomic operations to
58
+ * IndexedDB; OpenRTC deliberately does not own a second browser database.
59
+ */
60
+ interface BrowserProtocolStore {
61
+ loadIdentity(): Promise<{
62
+ defaultAuthor: Uint8Array;
63
+ } | null>;
64
+ exportSnapshot(): Promise<{
65
+ authors: unknown[];
66
+ namespaces: unknown[];
67
+ entries: unknown[];
68
+ }>;
69
+ importAuthor(authorId: string, author: Uint8Array): Promise<void>;
70
+ importNamespace(capability: unknown): Promise<void>;
71
+ deleteNamespace(namespaceId: string): Promise<void>;
72
+ applyEntry(mutation: unknown): Promise<void>;
73
+ acknowledgeOutbox(operationId: string): Promise<void>;
74
+ listBlobManifests(): Promise<unknown[]>;
75
+ getBlobResumeState(contentHash: string): Promise<unknown | null>;
76
+ readBlobRange(contentHash: string, offset: number, length: number): Promise<Uint8Array | null>;
77
+ writeBlobRange(contentHash: string, size: number, chunkBytes: number, offset: number, bytes: Uint8Array): Promise<void>;
78
+ finalizeBlob(contentHash: string): Promise<boolean>;
79
+ readBlobOutboardNode(contentHash: string, nodeId: string): Promise<Uint8Array | null>;
80
+ writeOutboard(contentHash: string, nodeId: string, pair: Uint8Array): Promise<void>;
81
+ markBlobBaoReady(contentHash: string): Promise<void>;
82
+ writeStagingChunk(sessionId: string, chunkIndex: number, bytes: Uint8Array): Promise<void>;
83
+ finalizeBlobStaging(sessionId: string, contentHash: string, size: number, chunkBytes: number): Promise<void>;
84
+ abortBlobStaging(sessionId: string): Promise<void>;
85
+ deleteBlob(contentHash: string, force: boolean): Promise<boolean>;
86
+ beginBlobImport(contentHash: string, size: number, chunkBytes: number): Promise<void>;
87
+ writeBlobChunk(contentHash: string, size: number, chunkBytes: number, chunkIndex: number, bytes: Uint8Array): Promise<void>;
88
+ finalizeBlobImport(contentHash: string, size: number, chunkBytes: number): Promise<void>;
89
+ flush(): Promise<void>;
90
+ }
91
+ interface NamespaceDescriptor {
92
+ namespaceId: string;
93
+ capabilityKind: 'read' | 'write';
94
+ capability: Uint8Array;
95
+ }
96
+ interface IrohMutationReceipt {
97
+ contentHash: string;
98
+ operationId: string;
99
+ }
100
+ interface IrohDocEntry {
101
+ namespaceId: string;
102
+ authorId: string;
103
+ key: Uint8Array;
104
+ timestamp: number;
105
+ contentHash: string;
106
+ contentLength: number;
107
+ }
108
+ interface PeerConnectOptions {
109
+ deviceId?: string;
110
+ ticket?: string;
111
+ scope?: RuntimePeerScope;
112
+ channelId?: string;
113
+ /** Total wall-clock budget for dial, admission, and peer settlement. */
114
+ timeoutMs?: number;
115
+ /**
116
+ * When true, automatic/observer dials fail fast if the peer has a sticky
117
+ * manual-disconnect projection for this app session. User-initiated manual
118
+ * reconnects should leave this unset and clear the exclusion explicitly.
119
+ */
120
+ keepManualDisconnect?: boolean;
121
+ }
122
+ interface PeerStreamOptions {
123
+ ticket?: string;
124
+ scope?: RuntimePeerScope;
125
+ channelId?: string;
126
+ /** Internal channel metadata written inside the protected stream envelope. */
127
+ channelMetadata?: Record<string, unknown> | null;
128
+ timeoutMs?: number;
129
+ }
130
+ interface PortableMediaChunk {
131
+ publicationId: string;
132
+ mediaGeneration: number;
133
+ sequence: number;
134
+ timestampUs: number;
135
+ durationUs: number;
136
+ kind: 'audio' | 'video' | 'screen' | 'data';
137
+ codec: 'opus' | 'h264' | 'vp8' | 'vp9' | 'av1' | 'pcm' | 'opaque';
138
+ keyframe: boolean;
139
+ discardable: boolean;
140
+ payload: Uint8Array;
141
+ }
142
+ interface PortableMediaPublish {
143
+ publicationId: string;
144
+ mediaGeneration: number;
145
+ kind: 'audio' | 'video';
146
+ codec: PortableMediaChunk['codec'];
147
+ clockRate: number;
148
+ codedWidth?: number;
149
+ codedHeight?: number;
150
+ channels?: number;
151
+ }
152
+ interface PortableMediaPublicationStart {
153
+ publicationId: string;
154
+ mediaGeneration: number;
155
+ control: Uint8Array;
156
+ }
157
+ interface PortableMediaSample {
158
+ publicationId: string;
159
+ timestampUs: number;
160
+ durationUs: number;
161
+ keyframe: boolean;
162
+ discardable: boolean;
163
+ payload: Uint8Array;
164
+ }
165
+ type PortableMediaControl = {
166
+ type: 'publish';
167
+ publicationId: string;
168
+ mediaGeneration: number;
169
+ kind: PortableMediaPublish['kind'];
170
+ codec: PortableMediaPublish['codec'];
171
+ clockRate: number;
172
+ codedWidth?: number;
173
+ codedHeight?: number;
174
+ channels?: number;
175
+ } | {
176
+ type: 'set-enabled' | 'request-keyframe' | 'stop';
177
+ publicationId: string;
178
+ mediaGeneration: number;
179
+ [key: string]: unknown;
180
+ };
181
+ type ChannelFraming = 'raw' | 'u32be';
182
+ interface ScopedChannelOptions {
183
+ peerId?: string;
184
+ peerNodeId?: string;
185
+ deviceId?: string | null;
186
+ ticket?: string;
187
+ scope: RuntimePeerScope;
188
+ channelId: string;
189
+ timeoutMs?: number;
190
+ keepManualDisconnect?: boolean;
191
+ /**
192
+ * Reuse an application-ready route owned by an active capability and fail
193
+ * if none exists. Protocol packages use this to open a named channel
194
+ * without gaining authority to dial, repair, or add an admission avenue.
195
+ */
196
+ existingRouteOnly?: boolean;
197
+ framing?: ChannelFraming;
198
+ }
199
+ interface ScopedLogicalChannel {
200
+ channelId: string;
201
+ peerId: string;
202
+ connection: Connection;
203
+ send(payload: Uint8Array): Promise<void>;
204
+ onMessage(callback: (payload: Uint8Array) => void): () => void;
205
+ close(): Promise<void>;
206
+ diagnostics(): {
207
+ connectionId: string | null;
208
+ remoteNodeId: string | null;
209
+ transports: string[];
210
+ hasSendOnWebRTC?: boolean;
211
+ hasWebRTCTransport?: boolean;
212
+ lastSendTransport?: ProtocolName | 'stream' | null;
213
+ framing: ChannelFraming;
214
+ delivery: 'reliable' | 'latest-state';
215
+ };
216
+ }
217
+ /**
218
+ * App-facing device status snapshot model. Runtime transport identifiers stay internal.
219
+ */
220
+ type DeviceStatus = Omit<DeviceStatusSnapshot, 'nodeId'>;
221
+ type DevicePresence = DevicePresenceStatus;
222
+ type IncomingStream = {
223
+ type: 'bi' | 'uni';
224
+ stream: any;
225
+ /** Native Rust logical connection identity used for internal demux. */
226
+ connectionId?: string;
227
+ remoteNodeId: string;
228
+ protocolHint?: 'control' | 'explicit' | 'native-main' | 'unknown';
229
+ channel?: ChannelMetadata | null;
230
+ };
231
+ type ConnectionEvent = {
232
+ type: 'connected' | 'disconnected';
233
+ connectionId: string;
234
+ localNodeId: string;
235
+ remoteNodeId: string;
236
+ transport: ProtocolName;
237
+ };
238
+ type RawConnection = {
239
+ connectionId: string;
240
+ localNodeId: string;
241
+ remoteNodeId: string;
242
+ };
243
+ type PresenceLoopOptions = {
244
+ deviceName?: string;
245
+ ticket?: string;
246
+ metadata?: string;
247
+ };
248
+ type SessionPlatform = 'native' | 'web';
249
+ type SessionKind = 'app-user-device' | 'share-anonymous' | 'drive-grant-guest' | 'scoped-guest' | (string & {});
250
+ type AutoConnectPolicy = 'enabled' | 'disabled' | 'scoped-only';
251
+ type PresencePolicy = 'online' | 'disabled';
252
+ type ConnectionState = BackendConnectionState;
253
+ type ReadinessOptions = ApplicationPayloadReadinessOptions;
254
+ type PayloadRouteOptions = ApplicationPayloadRouteOptions;
255
+ type ConnectionStatus = 'connecting' | 'connected' | 'disconnected' | 'failed';
256
+ interface PeerReadiness {
257
+ requestedId: string;
258
+ connected: boolean;
259
+ settledReady: boolean;
260
+ status: ConnectionStatus;
261
+ health: RuntimePeerHealth | 'unknown';
262
+ deviceId?: string | null;
263
+ deviceIdHint?: string | null;
264
+ activeConnectionId?: string | null;
265
+ readinessState?: string;
266
+ readinessReason?: string;
267
+ scopes: string[];
268
+ }
269
+ interface DeviceProfile {
270
+ deviceId: string | null;
271
+ deviceName: string;
272
+ platformType: string;
273
+ userId: string | null;
274
+ capabilities: NonNullable<LocalDeviceInfo$1['capabilities']>;
275
+ lastSeenAt: string;
276
+ localNodeId?: string | null;
277
+ }
278
+ interface ManagedOptions {
279
+ platform: SessionPlatform;
280
+ sessionKind?: SessionKind;
281
+ scope?: string | null;
282
+ autoConnectPolicy?: AutoConnectPolicy;
283
+ presencePolicy?: PresencePolicy;
284
+ userId?: string | null;
285
+ deviceName?: string;
286
+ localDeviceId?: string | null;
287
+ metadata?: string;
288
+ autoConnect?: boolean;
289
+ presence?: boolean;
290
+ }
291
+ interface ManagedSession {
292
+ mode: SessionPlatform;
293
+ device: DeviceProfile;
294
+ stop: () => Promise<void>;
295
+ }
296
+
297
+ /**
298
+ * Provider-neutral hot coordination contract.
299
+ *
300
+ * Implementations deliver authenticated roster, presence, and signaling facts.
301
+ * They do not decide peer identity, admission, transport dialing, retries,
302
+ * replacement, or settlement; those remain Rust/OpenRTC lifecycle concerns.
303
+ */
304
+ interface CoordinationSignalingStore {
305
+ updatePresence(localNodeId: string, ticket: string, online: boolean, ttlMs: number, metadata?: string, deviceNameOverride?: string): Promise<void>;
306
+ setOffline(localNodeId: string): Promise<void>;
307
+ updateDevice(deviceId: string, updates: {
308
+ deviceName?: string;
309
+ capabilities?: Device['capabilities'];
310
+ metadata?: string;
311
+ excludedPeers?: string[];
312
+ }): Promise<void>;
313
+ /**
314
+ * Publish the complete session-scoped peer-exclusion set for this runtime.
315
+ *
316
+ * The coordination provider owns delivery and persistence. Rust/WASM owns
317
+ * the local desired-peer decision and consumes remote exclusion snapshots.
318
+ */
319
+ setExcludedPeers?(excludedPeers: string[]): Promise<void>;
320
+ deleteDevice(deviceId: string): Promise<void>;
321
+ cleanupStaleDevices(): Promise<void>;
322
+ searchDevices(excludeNodeId?: string): Promise<Device[]>;
323
+ listDevices(excludeNodeId?: string): Promise<Device[]>;
324
+ subscribeDevices(): Promise<ReadableStream<DeviceEvent[]>>;
325
+ onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
326
+ onRoomArchitectureChange?(callback: (snapshot: RoomArchitectureSnapshot) => void): () => void;
327
+ onRoomAuthorityAssignmentChange?(callback: (assignment: RoomAuthorityAssignment | null) => void): () => void;
328
+ publishAuthorityAssignment?(input: {
329
+ assignment: {
330
+ policyVersion: 'room-authority-assignment-v1';
331
+ serviceId: string;
332
+ generation: number;
333
+ revision: number;
334
+ subjectDeviceId: string;
335
+ shardId: string;
336
+ priorityDeviceIds: string[];
337
+ relevantEntityIds: string[];
338
+ issuedAtMs: number;
339
+ expiresAtMs: number;
340
+ };
341
+ signature: string;
342
+ }): Promise<void>;
343
+ publishManagedRoomMessage?(input: {
344
+ messageId: string;
345
+ channel: string;
346
+ priority: 0 | 1 | 2 | 3;
347
+ zoneId?: string;
348
+ payload: Uint8Array;
349
+ }): Promise<void>;
350
+ onManagedRoomMessage?(callback: (message: ManagedRoomMessage) => void): () => void;
351
+ createSession(session: SignalingSession): Promise<void>;
352
+ updateSession(sessionId: string, updateData: Record<string, unknown>): Promise<void>;
353
+ subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
354
+ sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
355
+ pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
356
+ watchFriendDevices(friendUserIds: string[], callback: (devices: Map<string, Device[]>) => void): () => void;
357
+ updateFriendTicket(friendTicket: string | null): Promise<void>;
358
+ handleScopeChange(): Promise<void>;
359
+ setHostAvailability?(input: {
360
+ available: boolean;
361
+ reason: string;
362
+ }): void;
363
+ stopAuthActivity(): void;
364
+ usesCoordinationGateway?(): boolean;
365
+ joinCoordinationRoom?(roomId: string, nodeId: string, ticket: string): Promise<void>;
366
+ leaveCoordinationRoom?(roomId: string): Promise<void>;
367
+ getCoordinationRoomMembers?(roomId: string): Promise<RoomMember[]>;
368
+ watchCoordinationRoomMembers?(roomId: string, callback: (members: RoomMember[]) => void): () => void;
369
+ }
1
370
  interface CoordinationGatewayOptions {
2
371
  /**
3
372
  * Provider-neutral coordination gateway endpoint.
@@ -117,10 +486,9 @@ type EndpointKind = 'device' | 'ephemeral';
117
486
  type PeerLifecycleStatus = 'disconnected' | 'connecting' | 'connected' | 'failed' | 'closed';
118
487
  type PeerHealth = 'unknown' | 'healthy' | 'suspect' | 'stale';
119
488
  type DevicePresenceStatus = 'online' | 'idle' | 'offline';
120
- type PeerLifecycleStage = 'discovered' | 'dialing' | 'base-connected' | 'admitted' | 'protocol-ready' | 'upgrading' | 'webrtc-ready' | 'degraded' | 'reconnecting' | 'closed';
489
+ type PeerLifecycleStage = 'discovered' | 'dialing' | 'base-connected' | 'admitted' | 'protocol-ready' | 'degraded' | 'reconnecting' | 'closed';
121
490
  type PeerBaseTransportState = 'unknown' | 'connecting' | 'connected' | 'degraded' | 'closed';
122
491
  type PeerAdmissionState = 'unknown' | 'pending' | 'admitted' | 'rejected' | 'expired';
123
- type PeerWebRtcState = 'unknown' | 'disabled' | 'connecting' | 'transport-open' | 'route-probing' | 'ready' | 'failed' | 'closed';
124
492
  /**
125
493
  * Lifecycle label attached to a projected peer while the runtime tracks local ownership.
126
494
  *
@@ -154,13 +522,13 @@ interface ChannelDescriptor {
154
522
  delivery?: 'reliable' | 'latest-state';
155
523
  description?: string;
156
524
  }
157
- type ProtocolName = 'iroh' | 'iroh-quic' | 'iroh-relay' | 'iroh-lan' | 'iroh-webrtc' | 'iroh-moq' | 'ble' | 'webrtc' | 'webrtc-lan' | 'webrtc-turn' | 'moq';
525
+ type ProtocolName = 'iroh' | 'iroh-quic' | 'iroh-relay' | 'iroh-lan' | 'ble' | 'webrtc' | 'moq';
158
526
  type ProtocolMaturity = 'stable' | 'experimental' | 'unsupported';
159
527
  type TransportPrivacy = 'direct' | 'relay-only';
160
528
  type RouteOptimization = 'balanced' | 'lowest-latency';
161
529
  type ProtocolBaseName = 'iroh' | 'webrtc' | 'moq';
162
- type RouteFamily = 'iroh-path' | 'iroh-physical' | 'optional-route';
163
- type RouteKind = 'core' | 'host-installed' | 'carrier-adapter' | 'route-adapter' | 'path-label';
530
+ type RouteFamily = 'iroh-path' | 'iroh-physical';
531
+ type RouteKind = 'core' | 'host-installed' | 'carrier-adapter' | 'path-label';
164
532
  /**
165
533
  * Public compatibility type. `native` and `plugin` are legacy capability
166
534
  * labels; generated route descriptors use `RouteKind`.
@@ -177,7 +545,6 @@ interface RouteDescriptor {
177
545
  defaultRank: number;
178
546
  browser: boolean;
179
547
  native: boolean;
180
- independent: boolean;
181
548
  }
182
549
  interface ProtocolCapability {
183
550
  /** Canonical descriptor id; additive to the legacy capability shape. */
@@ -190,16 +557,14 @@ interface ProtocolCapability {
190
557
  implementation: ProtocolImplementationKind;
191
558
  locality: ProtocolLocality;
192
559
  maturity: ProtocolMaturity;
193
- /** Canonical descriptor rank; additive to the legacy capability shape. */
194
- defaultRank?: number;
560
+ /** Canonical descriptor rank and the sole public ordering metadata. */
561
+ defaultRank: number;
562
+ /** @deprecated Read-only 2.x compatibility alias; removed in 3.0.0. */
563
+ preferredRank: number;
195
564
  /** Canonical implementation taxonomy; `implementation` retains legacy values. */
196
565
  routeImplementation?: RouteKind;
197
- /** Compatibility alias for `defaultRank`. */
198
- preferredRank: number;
199
566
  browser: boolean;
200
567
  native: boolean;
201
- /** Canonical descriptor flag; additive to the legacy capability shape. */
202
- independent?: boolean;
203
568
  configured?: boolean;
204
569
  available: boolean;
205
570
  reason?: string;
@@ -293,15 +658,6 @@ interface ClientOptions {
293
658
  nodeIdPersistence?: 'persistent' | 'ephemeral';
294
659
  secretKey?: string;
295
660
  strictMode?: boolean;
296
- /**
297
- * Selects the sole consumer of admitted native application streams.
298
- *
299
- * `runtime` (default) routes named OpenRTC channels through the TypeScript
300
- * runtime. `host` is for native products that install one process-level
301
- * Rust protocol dispatcher. A native host must never enable both consumers:
302
- * the underlying stream queue is ordered and each raw stream has one owner.
303
- */
304
- nativeStreamConsumer?: 'runtime' | 'host';
305
661
  /**
306
662
  * Optional application-provided TURN credential loader.
307
663
  *
@@ -316,7 +672,10 @@ interface ClientOptions {
316
672
  onAutoConnect?: (devices: Device[]) => void;
317
673
  onIncomingSession?: (session: SignalingSession) => Promise<void>;
318
674
  transports?: {
319
- /** Allow Iroh, TURN, and MoQ relay routes. Defaults to true. */
675
+ /**
676
+ * Consumer relay intent. Authenticated Iroh-relay and managed-TURN
677
+ * availability are separate runtime facts.
678
+ */
320
679
  relay?: boolean;
321
680
  iroh?: boolean | PlutoIrohConfiguration;
322
681
  webrtc?: boolean | PlutoRTCConfiguration;
@@ -358,6 +717,8 @@ interface Device {
358
717
  connectable?: boolean;
359
718
  kind?: EndpointKind | string;
360
719
  nodeId?: string;
720
+ /** Gateway-verified public half of the non-exportable device signing key. */
721
+ devicePublicKeyJwk?: JsonWebKey;
361
722
  platformType?: string;
362
723
  capabilities?: {
363
724
  canHost?: boolean;
@@ -379,6 +740,8 @@ interface Device {
379
740
  transports?: ProtocolName[];
380
741
  }
381
742
  interface PeerState {
743
+ /** Rust's current-record terminal verdict; absent on older runtimes. */
744
+ logicalSessionTerminal?: boolean;
382
745
  peerId: string;
383
746
  deviceId?: string;
384
747
  deviceIdHint?: string;
@@ -401,7 +764,6 @@ interface PeerState {
401
764
  settledReady?: boolean;
402
765
  readinessState?: string;
403
766
  readinessReason?: string;
404
- webrtcState?: PeerWebRtcState;
405
767
  routable?: boolean;
406
768
  transportStableId?: number | null;
407
769
  transportGeneration?: number;
@@ -424,6 +786,7 @@ interface PeerState {
424
786
  errorPlane?: string;
425
787
  }
426
788
  interface BackendConnectionState {
789
+ logicalSessionTerminal?: boolean;
427
790
  connectionId: string;
428
791
  deviceId?: string | null;
429
792
  deviceIdHint?: string | null;
@@ -454,6 +817,16 @@ interface BackendConnectionState {
454
817
  createdAt?: number;
455
818
  updatedAt?: number;
456
819
  }
820
+ /** Generation-fenced application message emitted by the native Rust owner. */
821
+ interface NativePeerDataEvent {
822
+ connectionId: string;
823
+ remoteNodeId?: string | null;
824
+ transport: ProtocolName;
825
+ transportStableId: number;
826
+ transportGeneration: number;
827
+ routeGeneration: number;
828
+ payload: number[];
829
+ }
457
830
  interface NativeConnectResult {
458
831
  connectionId: string;
459
832
  deviceId?: string | null;
@@ -646,13 +1019,9 @@ interface DeviceStatusSnapshot extends Device {
646
1019
  }
647
1020
  interface LatencySnapshot {
648
1021
  webrtc?: number | null;
649
- webrtcLan?: number | null;
650
- webrtcTurn?: number | null;
651
1022
  iroh?: number | null;
652
1023
  irohLan?: number | null;
653
1024
  irohRelay?: number | null;
654
- irohWebrtc?: number | null;
655
- irohMoq?: number | null;
656
1025
  ble?: number | null;
657
1026
  moq?: number | null;
658
1027
  }
@@ -686,6 +1055,7 @@ interface ResolvedPeerIdentity {
686
1055
  nodeId?: string | null;
687
1056
  }
688
1057
  interface PeerSessionSnapshot {
1058
+ logicalSessionTerminal?: boolean;
689
1059
  peerId: string;
690
1060
  deviceId?: string | null;
691
1061
  deviceIdHint?: string | null;
@@ -768,13 +1138,6 @@ interface ExplicitFileDataSendParams {
768
1138
  deviceId?: string;
769
1139
  remoteNodeId?: string;
770
1140
  requireApplicationCrypto?: boolean;
771
- getUpgradeState?: () => string;
772
- isWebRtcApplicationRouteReady?: () => boolean;
773
- sendOnWebRTC?: (data: Uint8Array) => Promise<void>;
774
- getWebRTCTransport?: () => {
775
- getBufferedAmount?: () => number;
776
- waitForDrain?: (lowWaterMark: number) => Promise<void>;
777
- } | null;
778
1141
  };
779
1142
  remoteNodeId?: string;
780
1143
  file: File;
@@ -798,9 +1161,63 @@ interface DesiredPeerProjection {
798
1161
  online?: boolean;
799
1162
  sessionId?: string | null;
800
1163
  excludedPeers?: string[];
1164
+ devicePublicKeyJwk?: JsonWebKey;
1165
+ topologyRole?: 'active' | 'backup';
1166
+ topologyRevision?: number;
1167
+ }
1168
+ /**
1169
+ * Room-wide routing intent. Physical Iroh carrier selection remains private.
1170
+ * `managed` is reserved but unavailable in 2.5; selecting it fails explicitly.
1171
+ */
1172
+ type RoomArchitectureMode = 'auto' | 'mesh' | 'sparse' | 'managed' | 'authority';
1173
+ type EffectiveRoomArchitecture = Exclude<RoomArchitectureMode, 'auto'>;
1174
+ type RoomArchitectureReason = 'size' | 'traffic' | 'latency' | 'cost' | 'capacity' | 'manual' | 'recovery';
1175
+ /**
1176
+ * Customer-safe room policy projection delivered by the authenticated gateway.
1177
+ * Provider rates, margins, reserves, and invoice allocation stay server-side.
1178
+ */
1179
+ interface RoomArchitectureSnapshot {
1180
+ requested: RoomArchitectureMode;
1181
+ effective: EffectiveRoomArchitecture;
1182
+ epoch: number;
1183
+ phase: 'settled' | 'preparing';
1184
+ reason: RoomArchitectureReason;
1185
+ heldCreditsUsd: number;
1186
+ quoteExpiresAtMs: number;
1187
+ }
1188
+ /**
1189
+ * Read-only application-interest projection signed by the room's registered
1190
+ * authority and admitted by the gateway. It suggests what the application
1191
+ * should render or simulate; it never grants transport or room permissions.
1192
+ */
1193
+ interface RoomAuthorityAssignment {
1194
+ serviceId: string;
1195
+ generation: number;
1196
+ revision: number;
1197
+ shardId: string;
1198
+ priorityDeviceIds: readonly string[];
1199
+ relevantEntityIds: readonly string[];
1200
+ issuedAtMs: number;
1201
+ expiresAtMs: number;
1202
+ }
1203
+ /** Internal decrypted delivery from the Rust-owned managed-room group. */
1204
+ interface ManagedRoomMessage {
1205
+ senderId: string;
1206
+ messageId: string;
1207
+ channel: string;
1208
+ priority: 0 | 1 | 2 | 3;
1209
+ zoneId?: string;
1210
+ payload: Uint8Array;
1211
+ }
1212
+ /** Browser-only Rust/WASM module supplied by the browser signaling adapter. */
1213
+ interface BrowserWasmRuntimeModule {
1214
+ initWasm(moduleOrPath?: unknown): Promise<unknown>;
1215
+ WasmClient: new (apiKey: string) => any;
1216
+ start(): void;
801
1217
  }
802
1218
  interface ISignalingBackend {
803
1219
  currentUser: RuntimeIdentity | null;
1220
+ loadBrowserWasmRuntime?(): Promise<BrowserWasmRuntimeModule>;
804
1221
  signInAnonymously(): Promise<void>;
805
1222
  signInWithPluto?(): Promise<void>;
806
1223
  signOut(): Promise<void>;
@@ -833,6 +1250,31 @@ interface ISignalingBackend {
833
1250
  }): Promise<void>;
834
1251
  deleteDevice(deviceId: string): Promise<void>;
835
1252
  onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
1253
+ onRoomArchitectureChange?(callback: (snapshot: RoomArchitectureSnapshot) => void): () => void;
1254
+ onRoomAuthorityAssignmentChange?(callback: (assignment: RoomAuthorityAssignment | null) => void): () => void;
1255
+ publishAuthorityAssignment?(input: {
1256
+ assignment: {
1257
+ policyVersion: 'room-authority-assignment-v1';
1258
+ serviceId: string;
1259
+ generation: number;
1260
+ revision: number;
1261
+ subjectDeviceId: string;
1262
+ shardId: string;
1263
+ priorityDeviceIds: string[];
1264
+ relevantEntityIds: string[];
1265
+ issuedAtMs: number;
1266
+ expiresAtMs: number;
1267
+ };
1268
+ signature: string;
1269
+ }): Promise<void>;
1270
+ publishManagedRoomMessage?(input: {
1271
+ messageId: string;
1272
+ channel: string;
1273
+ priority: 0 | 1 | 2 | 3;
1274
+ zoneId?: string;
1275
+ payload: Uint8Array;
1276
+ }): Promise<void>;
1277
+ onManagedRoomMessage?(callback: (message: ManagedRoomMessage) => void): () => void;
836
1278
  onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
837
1279
  checkForSSOToken(): Promise<void>;
838
1280
  waitForAuth(): Promise<void>;
@@ -844,7 +1286,7 @@ interface ISignalingBackend {
844
1286
  submitDesiredPeerProjection?(revision: number, peers: DesiredPeerProjection[]): Promise<void>;
845
1287
  notifyDisconnectRequested?(remoteNodeId: string): void;
846
1288
  startPresence?(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
847
- startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
1289
+ startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
848
1290
  createSession(session: SignalingSession): Promise<void>;
849
1291
  updateSession(sessionId: string, updateData: any): Promise<void>;
850
1292
  subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
@@ -866,13 +1308,20 @@ interface ISignalingBackend {
866
1308
  notifyNetworkChange?(options?: {
867
1309
  reason?: string;
868
1310
  }): Promise<unknown>;
1311
+ setTransportPriority?(priority: ProtocolName[]): Promise<void>;
869
1312
  getManagedNodeId?(options?: {
870
1313
  initializeIfMissing?: boolean;
871
1314
  }): Promise<string | null>;
872
1315
  getEndpointTicket?(): Promise<string>;
873
1316
  openPeerBi?(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
874
- openPeerNativeBi?(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
875
1317
  openPeerUni?(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
1318
+ beginOpenRtcMediaPublication?(input: Omit<PortableMediaPublish, 'mediaGeneration'>): PortableMediaPublicationStart | Promise<PortableMediaPublicationStart>;
1319
+ encodeOpenRtcMediaSample?(input: PortableMediaSample): Uint8Array | Promise<Uint8Array>;
1320
+ pauseOpenRtcMediaPublication?(publicationId: string): void | Promise<void>;
1321
+ retireOpenRtcMediaPublication?(publicationId: string): void | Promise<void>;
1322
+ retireOpenRtcMediaReceiver?(publicationId: string, mediaGeneration: number): void | Promise<void>;
1323
+ decodeOpenRtcMediaChunk?(encoded: Uint8Array): PortableMediaChunk | Promise<PortableMediaChunk>;
1324
+ decodeOpenRtcMediaControl?(encoded: Uint8Array): PortableMediaControl | Promise<PortableMediaControl>;
876
1325
  connectToDevice?(params: {
877
1326
  deviceId?: string | null;
878
1327
  endpointTicket: string;
@@ -888,6 +1337,23 @@ interface ISignalingBackend {
888
1337
  isConnected(nodeId: string): Promise<boolean>;
889
1338
  getConnectionStates?(): Promise<BackendConnectionState[]>;
890
1339
  onStateChange?(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
1340
+ /** Native-only protected logical message surface; browser uses its WASM connection. */
1341
+ sendPeerMessage?(id: string, payload: Uint8Array): Promise<void>;
1342
+ encodeSparseFanoutMessage?(capability: string, payload: Uint8Array): Promise<Uint8Array>;
1343
+ acceptSparseFanoutMessage?(capability: string, sourcePeerId: string, payload: Uint8Array): Promise<{
1344
+ payload: Uint8Array;
1345
+ authorDeviceId: string;
1346
+ authorPeerId: string;
1347
+ topologyRevision: number;
1348
+ hop: number;
1349
+ forwardPeerIds: string[];
1350
+ forwardPeerLimit: number;
1351
+ forwardQueueCapacity: number;
1352
+ forward?: Uint8Array;
1353
+ }>;
1354
+ recordSparseFanoutForwardQueueDrop?(capability: string, count: number): Promise<void>;
1355
+ /** Native-only generation-fenced logical message projection. */
1356
+ onPeerMessage?(callback: (event: NativePeerDataEvent) => void): Promise<() => void> | (() => void);
891
1357
  /** @deprecated Implement file protocols over named channels, or use `openrtc-file-transfer`. */
892
1358
  sendExplicitFilePath?(connectionId: string, filePath: string, transferId?: string): Promise<string>;
893
1359
  /** @deprecated Implement file protocols over named channels, or use `openrtc-file-transfer`. */
@@ -898,15 +1364,7 @@ interface ISignalingBackend {
898
1364
  deleteTransferJob?(jobId: string): Promise<void>;
899
1365
  }
900
1366
  interface CoreClientBridgeHost {
901
- connect(ticket: string, timeoutMs?: number, expectedDeviceId?: string | null, channelId?: string, options?: {
902
- admissionAlreadyPresented?: boolean;
903
- approvedScope?: string | null;
904
- }): Promise<{
905
- id?: string | null;
906
- remoteNodeId?: string | null;
907
- deviceId?: string | null;
908
- } | unknown>;
909
- ensureManagedApplicationRoute?(options: ManagedApplicationRouteOptions): Promise<{
1367
+ ensureManagedApplicationRoute(options: ManagedApplicationRouteOptions): Promise<{
910
1368
  id?: string | null;
911
1369
  remoteNodeId?: string | null;
912
1370
  deviceId?: string | null;
@@ -932,9 +1390,6 @@ interface SignalingOptions {
932
1390
  nodeIdPersistence?: 'persistent' | 'ephemeral';
933
1391
  }
934
1392
  interface TransportContext {
935
- sendMoQ: (data: Uint8Array, options?: {
936
- alreadyProtected?: boolean;
937
- }) => Promise<void>;
938
1393
  /**
939
1394
  * Send one plaintext typed frame over a fresh runtime-owned Iroh application
940
1395
  * stream. The runtime applies the negotiated application-crypto stream
@@ -949,11 +1404,6 @@ interface TransportContext {
949
1404
  */
950
1405
  rankRoutes?: (candidates: ProtocolName[]) => ProtocolName[];
951
1406
  disableIrohFallback: boolean;
952
- isMoQReady: () => boolean;
953
- isMoQDataReady?: () => boolean;
954
- isMoQApplicationRouteProven?: () => boolean;
955
- requestMoQApplicationRouteProof?: () => void;
956
- clearMoQApplicationRouteProof?: () => void;
957
1407
  requestIrohCarrier?: () => void;
958
1408
  runtimeFlow?: 'default' | 'ticket-only';
959
1409
  readerCloseStrategy?: 'cancel' | 'release-lock';
@@ -1004,19 +1454,8 @@ interface ApplicationPayloadRouteOptions extends ApplicationPayloadReadinessOpti
1004
1454
  }
1005
1455
  interface ApplicationPayloadSendOptions extends ApplicationPayloadRouteOptions {
1006
1456
  }
1007
- interface ApplicationRouteReadyObservation {
1008
- connectionId: string;
1009
- remoteNodeId: string;
1010
- activeTransport: ProtocolName;
1011
- parallelTransport?: ProtocolName | null;
1012
- reason: 'webrtc-route-ready' | 'webrtc-heartbeat-healthy' | 'webrtc-application-send' | 'base-transport-loss-preserved';
1013
- transportStableId?: number;
1014
- transportGeneration?: number;
1015
- routeGeneration?: number;
1016
- }
1017
1457
  interface ConnectionOptions {
1018
1458
  reliable?: boolean;
1019
- rtcConfig?: PlutoRTCConfiguration;
1020
1459
  transportContext?: TransportContext;
1021
1460
  applicationCrypto?: PayloadCrypto;
1022
1461
  /**
@@ -1042,23 +1481,6 @@ interface ConnectionOptions {
1042
1481
  transportGeneration?: number;
1043
1482
  routeGeneration?: number;
1044
1483
  }) => boolean | void | Promise<boolean | void>;
1045
- /**
1046
- * Fired when a connection-owned application route has proven it can carry
1047
- * app traffic. Consumers should use this as a lifecycle signal for the same
1048
- * connection record, not as an independent projection source.
1049
- */
1050
- onApplicationRouteReady?: (event: ApplicationRouteReadyObservation) => void;
1051
- /**
1052
- * Fired when the WebRTC data plane has proven a ping/pong round trip but the
1053
- * mandatory application crypto route is not installed yet. Connection owns
1054
- * transport proof; Client owns the application-route handshake recovery.
1055
- */
1056
- onApplicationRouteMissing?: (event: {
1057
- connectionId: string;
1058
- remoteNodeId: string;
1059
- reason: 'webrtc-heartbeat-before-crypto';
1060
- negotiationId?: string | null;
1061
- }) => void;
1062
1484
  }
1063
1485
  interface JoinRequest {
1064
1486
  id: string;
@@ -1067,19 +1489,112 @@ interface JoinRequest {
1067
1489
  state: 'pending' | 'accepted' | 'rejected';
1068
1490
  }
1069
1491
 
1070
- interface ITransport {
1071
- readonly name: string;
1072
- readonly isReady: boolean;
1073
- init(localNodeId: string, remoteNodeId: string, options: any): Promise<void>;
1074
- send(data: Uint8Array): Promise<void>;
1075
- close(): void;
1076
- onMessage(callback: (data: Uint8Array) => void): void;
1077
- onStateChange(callback: (state: 'connecting' | 'connected' | 'failed' | 'disconnected') => void): void;
1078
- handleSignalingMessage?(msg: any): void;
1079
- getSignalingHandler?(): (msg: any) => Promise<void>;
1080
- getNativeTransport?(): any;
1081
- getNegotiationId?(): string | null;
1082
- getDataChannelReadyState?(): string | null;
1492
+ type ConnectionHealth = 'unknown' | 'healthy' | 'suspect' | 'stale';
1493
+
1494
+ type Message = string | object | ArrayBuffer | Uint8Array;
1495
+ /**
1496
+ * One logical admitted peer connection.
1497
+ *
1498
+ * This class owns application framing and callbacks on the logical Iroh stream
1499
+ * supplied by Rust. WebRTC and MoQ are packet carriers below that stream; this
1500
+ * class never constructs, negotiates, retries, or retains either carrier.
1501
+ * Authority inventory: `canonical-iroh-carriers` and
1502
+ * `logical-peer-streams-and-datagrams`.
1503
+ */
1504
+ declare class Connection {
1505
+ private static readonly decoder;
1506
+ private static readonly encoder;
1507
+ private static readonly MAX_PENDING_MESSAGES;
1508
+ private static readonly MAX_PENDING_ENCRYPTED_PAYLOADS;
1509
+ private static readonly DEFAULT_APPLICATION_CRYPTO_WAIT_MS;
1510
+ private writer;
1511
+ private reader;
1512
+ private options;
1513
+ private receiveBuffer;
1514
+ private writeMutex;
1515
+ private closed;
1516
+ private nativeSignalSender;
1517
+ private applicationKeyAgreementObservationEpoch;
1518
+ private lastApplicationPayloadTransport;
1519
+ private lastTransportStatusFingerprint;
1520
+ private lastBaseTransportGeneration;
1521
+ private lastBaseTransportStableId;
1522
+ private remoteDedicatedCarrierControl;
1523
+ private remoteDedicatedCarrierControlReady;
1524
+ private readonly listeners;
1525
+ private readonly closeListeners;
1526
+ private readonly irohHealthListeners;
1527
+ private readonly pendingMessages;
1528
+ private pendingEncryptedApplicationPayloads;
1529
+ private readonly applicationCryptoWaiters;
1530
+ readonly id: string;
1531
+ readonly remoteNodeId: string;
1532
+ /** @deprecated Use the admitted peer/device projection for device identity. */
1533
+ readonly deviceId: string;
1534
+ readonly localNodeId: string;
1535
+ constructor(id: string, localNodeId: string, remoteNodeId: string, writer: WritableStreamDefaultWriter<Uint8Array>, reader: ReadableStreamDefaultReader<Uint8Array>, options?: ConnectionOptions);
1536
+ get isClosed(): boolean;
1537
+ get transportType(): ProtocolName;
1538
+ setApplicationCrypto(applicationCrypto: PayloadCrypto | undefined): void;
1539
+ getKeyAgreementEpoch(): number;
1540
+ requireApplicationCrypto(): void;
1541
+ isApplicationCryptoRequired(): boolean;
1542
+ isPayloadReady(options?: ApplicationPayloadReadinessOptions): boolean;
1543
+ payloadTransports(options?: ApplicationPayloadRouteOptions): ProtocolName[];
1544
+ requestTransportRecovery(_reason: string): void;
1545
+ handleAppForeground(): void;
1546
+ handleBaseTransportAvailable(_source: string, proof: {
1547
+ transportState?: string | null;
1548
+ transportGeneration?: number | null;
1549
+ transportStableId?: number | null;
1550
+ }): boolean;
1551
+ getTransportDiagnostics(): Promise<any>;
1552
+ send(message: Message, options?: ApplicationPayloadSendOptions): Promise<void>;
1553
+ lastPayloadTransport(): ProtocolName | null;
1554
+ sendControl(message: Message): Promise<void>;
1555
+ sendRawIrohFrame(frame: Uint8Array): Promise<void>;
1556
+ getAvailableTransports(): ProtocolName[];
1557
+ disconnect(): Promise<void>;
1558
+ handleSessionAdmissionRejected(reason: string): void;
1559
+ onMessage(callback: (message: any) => void): void;
1560
+ onDisconnect(callback: () => void): void;
1561
+ injectData(chunk: Uint8Array): void;
1562
+ receiveFrameBody(body: Uint8Array): void;
1563
+ receiveMessage(message: unknown): void;
1564
+ receiveDataPayload(messageData: Uint8Array): void;
1565
+ onWebRtcHeartbeatHealth(_callback: (health: ConnectionHealth) => void): void;
1566
+ onIrohHeartbeatHealth(callback: (health: ConnectionHealth) => void): void;
1567
+ reportTransportStatusIfChanged(): void;
1568
+ getTransportStatus(): {
1569
+ activeTransport: ProtocolName;
1570
+ parallelTransport: ProtocolName | null;
1571
+ };
1572
+ getLatencySnapshot(): LatencySnapshot;
1573
+ setNativeSignalSender(sender: (envelope: any) => Promise<void>): void;
1574
+ getControlFrameMode(): NonNullable<ConnectionOptions['controlFrameMode']>;
1575
+ sendNativeControlEnvelope(envelope: unknown): Promise<boolean>;
1576
+ /** @deprecated Direct WebRTC/MoQ signal sessions were removed. */
1577
+ receiveInternalSignal(_content: unknown): void;
1578
+ private hasRequiredApplicationCrypto;
1579
+ private hasBaseApplicationRoute;
1580
+ private waitForRequiredApplicationCrypto;
1581
+ private resolveApplicationCryptoWaiters;
1582
+ private rejectApplicationCryptoWaiters;
1583
+ private encodePayload;
1584
+ private buildFrame;
1585
+ private sendTyped;
1586
+ private writeFrame;
1587
+ private openApplicationPayload;
1588
+ private openUntypedApplicationPayload;
1589
+ private isPlaintextBootstrapPayload;
1590
+ private queueEncryptedApplicationPayload;
1591
+ private flushPendingEncryptedApplicationPayloads;
1592
+ private readLoop;
1593
+ private handleData;
1594
+ private static isUntypedDataFrame;
1595
+ private processDataPayload;
1596
+ private emitMessage;
1597
+ private close;
1083
1598
  }
1084
1599
 
1085
- export type { RouteDescriptor as $, AuthMode as A, BackendPeerBiStream as B, ConnectDeviceResult as C, Device as D, ExplicitFileDataSendParams as E, ApplicationPayloadReadinessOptions as F, GrantScope as G, ApplicationPayloadRouteOptions as H, ISignalingBackend as I, ApplicationPayloadSendOptions as J, ITransport as K, LocalDeviceInfo as L, ManagedConnectionRecord as M, NativeConnectParams as N, LatencySnapshot as O, PlutoIrohConfiguration as P, PeerState as Q, RouteOptimization as R, SignalingMode as S, PeerScope as T, PeerHealth as U, ChannelDescriptor as V, ChannelMetadata as W, ManagedDeviceConnectOptions as X, JoinRoomOptions as Y, DevicePresenceStatus as Z, PeerLifecycleStatus as _, PlutoRTCConfiguration as a, ProtocolCapability as a0, ProtocolCapabilityMap as a1, CryptoStreams as a2, CryptoBiStream as a3, RouteFamily as a4, RouteKind as a5, AppLimits as a6, SignalingOptions as a7, RoomCreationMode as a8, ScanningLoopOptions as a9, ScanningLoopHandle as aa, RuntimeBootstrapOptions as ab, RuntimeBootstrapResult as ac, ManagedApplicationRouteOptions as ad, JoinRequest as ae, PlutoMoQConfiguration as b, ProtocolName as c, PeerSessionSnapshot as d, ResolvedPeerIdentity as e, ConnectDeviceHooks as f, ConnectDeviceOptions as g, ClientOptions as h, CoordinationGatewayGrantRequest as i, CoordinationGatewayGrant as j, DiscoveryMode as k, RoomMember as l, RuntimeIdentity as m, SignalingEnvelope as n, DeviceStatusSnapshot as o, BackendPeerUniStream as p, DeviceEvent as q, DesiredPeerProjection as r, CoreClientBridgeHost as s, NativeConnectResult as t, SignalingSession as u, SessionEvent as v, BackendConnectionState as w, NativeManagedSessionStartResult as x, ConnectionOptions as y, PayloadCrypto as z };
1600
+ export { type DeviceEvent as $, type RawConnection as A, type RuntimeRoomMember as B, type ChannelDescriptor$1 as C, type DeviceStatus as D, type EffectiveRoomArchitecture as E, type AuthContext as F, type GrantScope as G, type RuntimeClientOptions as H, type IncomingStream as I, type JoinRoomOptions$1 as J, type DiscoveryMode as K, type LocalDeviceInfo$1 as L, type ManagedOptions as M, type AuthMode as N, type SignalingMode as O, type PlutoIrohConfiguration as P, type ClientOptions as Q, type RoomArchitectureMode as R, type ScopedChannelOptions as S, type ExplicitFileDataSendParams as T, type ISignalingBackend as U, type RuntimeIdentity as V, type RoomMember as W, type Device as X, type DeviceStatusSnapshot as Y, type ManagedConnectionRecord as Z, type SignalingEnvelope as _, type RoomArchitectureReason as a, type SessionKind as a$, type DesiredPeerProjection as a0, type SignalingSession as a1, type SessionEvent as a2, type LocalDeviceInfo as a3, type NativeManagedSessionStartResult as a4, type BackendPeerBiStream as a5, type BackendPeerUniStream as a6, type PortableMediaPublish as a7, type PortableMediaPublicationStart as a8, type PortableMediaSample as a9, type PresenceLoopOptions as aA, type SignalingOptions as aB, type JoinRoomOptions as aC, type ChannelMetadata as aD, type RoomCreationMode as aE, type ProtocolCapabilityMap as aF, type ScanningLoopOptions as aG, type ScanningLoopHandle as aH, type RuntimeBootstrapOptions as aI, type RuntimeBootstrapResult as aJ, type ApplicationPayloadReadinessOptions as aK, type ManagedApplicationRouteOptions as aL, type PeerState as aM, type PeerScope as aN, type PeerHealth as aO, type ChannelDescriptor as aP, type JoinRequest as aQ, type AutoConnectPolicy as aR, type ChannelFraming as aS, type ConnectionStatus as aT, type DevicePresence as aU, type PayloadRouteOptions as aV, type PeerLifecycleStatus$1 as aW, type PeerSessionSnapshot$1 as aX, type PresencePolicy as aY, type RuntimeAuthContext as aZ, type RuntimePeerScope as a_, type PortableMediaChunk as aa, type PortableMediaControl as ab, type NativeConnectParams as ac, type NativeConnectResult as ad, type BackendConnectionState as ae, type NativePeerDataEvent as af, type CoordinationGatewayGrantRequest as ag, type CoordinationGatewayGrant as ah, type BrowserWasmRuntimeModule as ai, type BrowserProtocolStore as aj, type NamespaceDescriptor as ak, type IrohMutationReceipt as al, type IrohDocEntry as am, type CoordinationSignalingStore as an, type ManagedRoomMessage as ao, type CoreClientBridgeHost as ap, type RouteDescriptor as aq, type PayloadCrypto as ar, type CryptoStreams as as, type CryptoBiStream as at, type RouteFamily as au, type RouteKind as av, type RuntimeAuthIdentity as aw, type RuntimeSession as ax, type AppLimits as ay, type ConnectionTarget as az, type RoomArchitectureSnapshot as b, type SessionPlatform as b0, type RoomAuthorityAssignment as c, type PlutoRTCConfiguration as d, type PlutoMoQConfiguration as e, type RouteOptimization as f, type ProtocolName as g, type RuntimePeerState as h, type PeerConnectOptions as i, Connection as j, type PeerSessionSnapshot as k, type PeerReadiness as l, type RuntimePeerHealth as m, type ResolvedPeerIdentity as n, type PeerStreamOptions as o, type RuntimeDevice as p, type ScopedLogicalChannel as q, type ConnectionState as r, type ReadinessOptions as s, type ConnectionEvent as t, type ManagedSession as u, type DeviceConnectOptions as v, type ConnectDeviceResult as w, type ConnectDeviceHooks as x, type ConnectDeviceOptions as y, type DeviceProfile as z };