openrtc 2.0.0-rc.9 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +12 -8
  2. package/dist/DelegatingRuntimeAdapter-BFZDC604.d.ts +397 -0
  3. package/dist/{types-BHePJWbM.d.ts → ITransport-WV6gGMnX.d.ts} +42 -3
  4. package/dist/IpcRuntimeAdapter-CJq3dRBF.d.ts +19 -0
  5. package/dist/OpenRTCShared.d.ts +250 -0
  6. package/dist/OpenRTCShared.js +1 -0
  7. package/dist/WasmBridge-5GYKXPXK.js +1 -0
  8. package/dist/{OpenRTCShared-BswnbjpG.d.ts → assembly-q0jRRpsc.d.ts} +51 -250
  9. package/dist/{capabilities-YSskrE8H.d.ts → capabilities-BfZi4Cd7.d.ts} +4 -0
  10. package/dist/chunk-45WBH7E3.js +1 -0
  11. package/dist/chunk-7FPG3MFF.js +2 -0
  12. package/dist/chunk-AG2F6MOB.js +1 -0
  13. package/dist/chunk-CWGKLGJZ.js +1 -0
  14. package/dist/{chunk-C6PAXO3N.js → chunk-D2OJN5S5.js} +1 -1
  15. package/dist/chunk-DUY34MGT.js +1 -0
  16. package/dist/chunk-H5R5ZXXN.js +3 -0
  17. package/dist/chunk-KJTJLLJE.js +2 -0
  18. package/dist/{chunk-7Z6N46RB.js → chunk-LRT5GEGH.js} +2 -2
  19. package/dist/chunk-NRXEG5GQ.js +1 -0
  20. package/dist/chunk-OEVPKC3W.js +1 -0
  21. package/dist/chunk-VBUDERMM.js +2 -0
  22. package/dist/chunk-VOCOZ57Q.js +2 -0
  23. package/dist/chunk-XPL7PUBW.js +2 -0
  24. package/dist/chunk-Z2WVSXPW.js +1 -0
  25. package/dist/chunk-Z6TZLF4B.js +1 -0
  26. package/dist/controlPlane-P66ZTVNW.js +2 -0
  27. package/dist/deviceEnrollment-GL4JPVGG.js +2 -0
  28. package/dist/deviceKey-SBNKLVYF.js +1 -0
  29. package/dist/deviceManagement-PHY5TIOS.js +1 -0
  30. package/dist/deviceProfile-3BEQZLJF.js +2 -0
  31. package/dist/deviceRoster-VZA3TQOR.js +1 -0
  32. package/dist/dist-FIVA6EPA.js +277 -0
  33. package/dist/index.d.ts +10 -8
  34. package/dist/index.js +1 -1
  35. package/dist/ipcFactory-B6HBECSU.js +1 -0
  36. package/dist/native.d.ts +7 -8
  37. package/dist/native.js +1 -1
  38. package/dist/openrtc-BFF336RG.js +2 -0
  39. package/dist/openrtc_bg.wasm +0 -0
  40. package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -4
  41. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  42. package/dist/runtime/device-status.d.ts +2 -4
  43. package/dist/runtime/factories.d.ts +21 -0
  44. package/dist/runtime/factories.js +1 -0
  45. package/dist/runtime/index.d.ts +29 -62
  46. package/dist/runtime/index.js +1 -2
  47. package/dist/testing.d.ts +9 -18
  48. package/dist/testing.js +1 -1
  49. package/dist/transport/index.d.ts +2 -3
  50. package/dist/transport/index.js +1 -1
  51. package/dist/{types-D0pqNSOf.d.ts → types-DVNSd5B9.d.ts} +71 -4
  52. package/dist/{types-byWIP-WI.d.ts → types-Di034GVQ.d.ts} +72 -15
  53. package/package.json +3 -27
  54. package/dist/DelegatingRuntimeAdapter-BLNigcS4.d.ts +0 -134
  55. package/dist/IEngineBridge-BbsT8hof.d.ts +0 -17
  56. package/dist/ITransport-BsPcaov7.d.ts +0 -16
  57. package/dist/OpenRTCShared-TKAQLONA.js +0 -1
  58. package/dist/WasmBridge-B7NTRYN5.js +0 -1
  59. package/dist/auth/index.d.ts +0 -78
  60. package/dist/auth/index.js +0 -1
  61. package/dist/auth/internal.d.ts +0 -4
  62. package/dist/auth/internal.js +0 -1
  63. package/dist/chunk-23XC6TGK.js +0 -2
  64. package/dist/chunk-2QHDEGVX.js +0 -1
  65. package/dist/chunk-A7AMB23L.js +0 -2
  66. package/dist/chunk-BXFXPIXO.js +0 -1
  67. package/dist/chunk-C7YN5MSV.js +0 -1
  68. package/dist/chunk-D45U2NXV.js +0 -1
  69. package/dist/chunk-DZCZLRM5.js +0 -1
  70. package/dist/chunk-EUNCYGJD.js +0 -1
  71. package/dist/chunk-IAIGT5G3.js +0 -1
  72. package/dist/chunk-JIVVHBCB.js +0 -2
  73. package/dist/chunk-K37WVIZL.js +0 -1
  74. package/dist/chunk-KWXAZUAZ.js +0 -2
  75. package/dist/chunk-N26S7V4N.js +0 -1
  76. package/dist/chunk-N4SX7C3W.js +0 -2
  77. package/dist/chunk-NB4H5TP3.js +0 -1
  78. package/dist/chunk-NCL672QJ.js +0 -3
  79. package/dist/chunk-NT5YHZQH.js +0 -1
  80. package/dist/chunk-O3D7S5MD.js +0 -1
  81. package/dist/chunk-RD3JEGGF.js +0 -2
  82. package/dist/chunk-VK6KX433.js +0 -1
  83. package/dist/factories-TLUZAXUG.js +0 -1
  84. package/dist/ipcFactory-QOAZVE56.js +0 -1
  85. package/dist/openrtc-C53CKZUM.js +0 -2
  86. package/dist/runtime/legacy.d.ts +0 -18
  87. package/dist/runtime/legacy.js +0 -1
  88. package/dist/runtime/tauri.d.ts +0 -6
  89. package/dist/runtime/tauri.js +0 -1
  90. package/dist/tauri-BgLgJoQA.d.ts +0 -33
package/README.md CHANGED
@@ -24,8 +24,6 @@ import { OpenRTC } from 'openrtc';
24
24
 
25
25
  const rtc = OpenRTC({ apiKey: import.meta.env.VITE_OPENRTC_API_KEY });
26
26
  const cursors = await rtc.spaces.join('portfolio-cursors', {
27
- access: 'capability',
28
- identity: 'ephemeral',
29
27
  payload: 'latest-state',
30
28
  });
31
29
 
@@ -63,9 +61,19 @@ const rtc = OpenRTC({
63
61
  const devices = await rtc.devices.start({
64
62
  auth,
65
63
  autoConnect: 'online',
64
+ // Optional. Browser clients infer labels such as "Chrome on Android";
65
+ // native clients should pass the host-reported OS and user-visible name.
66
+ profile: { name: "Bryant's iPhone", platform: 'ios' },
66
67
  });
67
68
  ```
68
69
 
70
+ `profile` is presentation metadata, not device identity. OpenRTC continues to
71
+ bind enrollment and limits to its stable installation ID and device key. A
72
+ changed profile updates the existing enrollment once; it does not enroll or
73
+ bill a second device. User-assigned hardware names are not exposed by every
74
+ browser or mobile OS, so privacy-safe defaults identify the available
75
+ environment (for example `iPhone`, `Chrome on iPhone`, or `Chrome on Android`).
76
+
69
77
  Consumer apps own login UX, product authorization, IdP registration, and
70
78
  platform-attestation setup. OpenRTC owns assertion validation, device binding,
71
79
  grant issuance and refresh, revocation, budgets, metering, and abuse controls.
@@ -75,11 +83,7 @@ grant issuance and refresh, revocation, budgets, metering, and abuse controls.
75
83
  Rooms default to ephemeral membership:
76
84
 
77
85
  ```ts
78
- const room = await rtc.rooms.join('match-123', {
79
- access: 'capability',
80
- membership: 'ephemeral',
81
- maxPeers: 8,
82
- });
86
+ const room = await rtc.rooms.join('match-123');
83
87
  ```
84
88
 
85
89
  Durable membership is an advanced capability and must be enabled in the
@@ -102,7 +106,7 @@ Attestation is evaluated at device enrollment, key rotation, recovery, or risk
102
106
  escalation—not as a connection heartbeat.
103
107
 
104
108
  ```ts
105
- import { FirebaseAppCheckAttestationProvider } from '@openrtc/trust-firebase-app-check';
109
+ import { FirebaseAppCheckAttestationProvider } from 'openrtc-trust-firebase-app-check';
106
110
 
107
111
  const rtc = OpenRTC({
108
112
  apiKey,
@@ -0,0 +1,397 @@
1
+ import { D as Device, h as DiscoveryMode, A as AuthMode, S as SignalingMode, g as ClientOptions, E as ExplicitFileDataSendParams, I as ISignalingBackend, L as LocalDeviceInfo, i as RoomMember, j as RuntimeIdentity, k as SignalingEnvelope, l as DeviceStatusSnapshot, d as PeerSessionSnapshot, B as BackendPeerBiStream, m as BackendPeerUniStream, M as ManagedConnectionRecord, R as ResolvedPeerIdentity, n as DeviceEvent, o as DesiredPeerProjection, p as CoreClientBridgeHost, N as NativeConnectParams, q as NativeConnectResult, r as SignalingSession, s as SessionEvent, t as BackendConnectionState, u as NativeManagedSessionStartResult, G as GrantScope } from './ITransport-WV6gGMnX.js';
2
+ import { I as IrohBrowserProtocolStore, w as IrohNamespaceDescriptor, x as IrohMutationReceipt, y as IrohDocEntry, A as AuthContext } from './types-DVNSd5B9.js';
3
+ import { R as RuntimeCapabilities } from './capabilities-BfZi4Cd7.js';
4
+
5
+ interface NativeTrustToken {
6
+ token: string;
7
+ expiresAtMs: number;
8
+ }
9
+
10
+ /** Internal-only gateway record before normalization; includes namespace fields omitted from the public Device type. */
11
+ type RawDeviceDoc = Device & {
12
+ appTag?: string;
13
+ tag?: string;
14
+ };
15
+
16
+ interface WasmBridgeOptions {
17
+ apiKey?: string;
18
+ discoveryMode?: DiscoveryMode;
19
+ space?: string;
20
+ spaceKey?: string;
21
+ authMode?: AuthMode;
22
+ signalingMode?: SignalingMode;
23
+ projectId?: string;
24
+ coordinationGateway?: ClientOptions['coordinationGateway'];
25
+ coordinationAvenueOverride?: ClientOptions['coordinationAvenueOverride'];
26
+ platformAttestationTokenProvider?: ClientOptions['platformAttestationTokenProvider'];
27
+ /** Internal host hint used by the provider-neutral gateway projection. */
28
+ coordinationPlatformType?: string;
29
+ storagePrefix?: string;
30
+ deviceIdPersistence?: 'persistent' | 'ephemeral';
31
+ endpointIdPersistence?: 'persistent' | 'ephemeral';
32
+ nodeIdPersistence?: 'persistent' | 'ephemeral';
33
+ localDeviceId?: string;
34
+ deviceName?: string;
35
+ turnCredentialsProvider?: () => Promise<{
36
+ iceServers?: RTCIceServer[];
37
+ } | null | undefined>;
38
+ applicationCrypto?: ExplicitFileDataSendParams['applicationCrypto'];
39
+ spaceAuth?: 'scoped-token';
40
+ }
41
+ /**
42
+ * WasmBridge is the browser host wrapper over the Rust/WASM runtime.
43
+ *
44
+ * Allowed:
45
+ * - normalize JS/WASM binding shapes
46
+ * - forward auth, discovery, signaling, and lifecycle calls into Rust
47
+ * - expose typed browser-facing results
48
+ *
49
+ * Not allowed:
50
+ * - become a second lifecycle engine
51
+ * - invent peer identity or connect policy that is not backed by Rust
52
+ * - normalize app-specific payload protocols into runtime behavior
53
+ *
54
+ * Source of truth:
55
+ * - Rust/WASM owns transport/runtime connection state and lifecycle primitives
56
+ * - The selected coordination provider owns browser delivery projections
57
+ * - RuntimeClient owns app-facing orchestration across those surfaces
58
+ */
59
+ declare class WasmBridge implements ISignalingBackend {
60
+ private static readonly EXPLICIT_FILE_PROTOCOL_TYPE;
61
+ private static readonly EXPLICIT_FILE_CHUNK_SIZE_BYTES;
62
+ private static readonly MAX_EXPLICIT_TRANSFER_HEADER_BYTES;
63
+ private static readonly FALLBACK_EXPLICIT_FILE_NAME;
64
+ private static readonly MAX_EXPLICIT_FILE_NAME_CHARS;
65
+ private static readonly FALLBACK_EXPLICIT_MIME_TYPE;
66
+ private static readonly MAX_EXPLICIT_MIME_TYPE_CHARS;
67
+ app: any | null;
68
+ auth: any | null;
69
+ private readonly appTag;
70
+ protected options: {
71
+ appTag: string;
72
+ apiKey?: string;
73
+ discoveryMode?: DiscoveryMode;
74
+ space?: string;
75
+ spaceKey?: string;
76
+ authMode: AuthMode;
77
+ signalingMode?: SignalingMode;
78
+ projectId: string;
79
+ coordinationGateway?: ClientOptions['coordinationGateway'];
80
+ coordinationAvenueOverride?: ClientOptions['coordinationAvenueOverride'];
81
+ platformAttestationTokenProvider?: ClientOptions['platformAttestationTokenProvider'];
82
+ coordinationPlatformType?: string;
83
+ storagePrefix?: string;
84
+ deviceIdPersistence?: 'persistent' | 'ephemeral';
85
+ endpointIdPersistence?: 'persistent' | 'ephemeral';
86
+ nodeIdPersistence?: 'persistent' | 'ephemeral';
87
+ localDeviceId?: string;
88
+ deviceName?: string;
89
+ strictMode?: boolean;
90
+ turnCredentialsProvider?: () => Promise<{
91
+ iceServers?: RTCIceServer[];
92
+ } | null | undefined>;
93
+ applicationCrypto?: ExplicitFileDataSendParams['applicationCrypto'];
94
+ spaceTokenProvider?: ClientOptions['spaceTokenProvider'];
95
+ spaceAuth?: 'scoped-token';
96
+ };
97
+ private spaceNamespaceIdPromise;
98
+ private cachedSpaceNamespaceId;
99
+ private coordinationHostAvailability;
100
+ private authListeners;
101
+ private persistenceReady;
102
+ wasmClient: any;
103
+ private readonly createdAtMs;
104
+ private missingWasmWarnings;
105
+ private readonly wasmReadyWarningDelayMs;
106
+ private browserCoordinationSignaling;
107
+ private readonly nativeTrustTokens;
108
+ private lastObservedFirebaseUserId;
109
+ private sessionReaders;
110
+ protected authContext: {
111
+ userId: string;
112
+ token?: string | null;
113
+ refreshToken?: string | null;
114
+ customToken?: string | null;
115
+ tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
116
+ appCheckTokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
117
+ expiresAtMs?: number | null;
118
+ } | null;
119
+ private injectedBrowserAuthSessionActive;
120
+ private readonly presenceManager;
121
+ private hasSyncedAuthToWasmClient;
122
+ private lastWasmAuthUserId;
123
+ private lastWasmAuthToken;
124
+ private lastDeliveredConnectionStates;
125
+ private authScopedRuntimeGeneration;
126
+ private coreClient;
127
+ private readonly applicationRouteEscalations;
128
+ private applicationRouteEscalationAttemptKeys;
129
+ private applicationRouteEscalationUnsubscribe;
130
+ private applicationRouteEscalationSubscriptionGeneration;
131
+ private applicationRouteEscalationSubscriptionEpoch;
132
+ constructor(options: WasmBridgeOptions);
133
+ get tag(): string;
134
+ getRuntimeCapabilities(): RuntimeCapabilities;
135
+ private static readonly WEB_DEVICE_ID_STORAGE_PREFIX;
136
+ private static readonly EPHEMERAL_DEVICE_ID_TTL_MS;
137
+ private getDeviceIdentityStorageKey;
138
+ private getDeviceIdPersistenceMode;
139
+ private isTicketOnlyMode;
140
+ private usesProviderNeutralGrant;
141
+ private createRandomDeviceId;
142
+ protected resolveWebLogicalDeviceId(): string;
143
+ private getDefaultBrowserDeviceName;
144
+ getLocalDeviceInfo(): Promise<LocalDeviceInfo>;
145
+ private getCoordinationSignaling;
146
+ usesCoordinationGateway(): boolean;
147
+ setCoordinationHostAvailability(input: {
148
+ available: boolean;
149
+ reason: string;
150
+ }): void;
151
+ /** Restore the existing gateway delivery subscription after a native host resumes. */
152
+ reconnectCoordinationAfterHostResume(): Promise<void>;
153
+ getCoordinationNativeTrustToken(forceRefresh?: boolean): Promise<NativeTrustToken>;
154
+ invalidateCoordinationNativeTrustToken(): void;
155
+ subscribeCoordinationNativeTrustToken(listener: (token: NativeTrustToken | null) => void, options?: {
156
+ emitCurrent?: boolean;
157
+ }): () => void;
158
+ setCoordinationLocalDeviceId(deviceId: string): void;
159
+ /** Internal native-host hint for provider-neutral roster presentation. */
160
+ setCoordinationPlatformType(platformType: string): void;
161
+ setCoordinationExcludedPeers(excludedPeers: string[]): Promise<void>;
162
+ joinCoordinationRoom(roomId: string, nodeId: string, ticket: string): Promise<void>;
163
+ leaveCoordinationRoom(roomId: string): Promise<void>;
164
+ getCoordinationRoomMembers(roomId: string): Promise<RoomMember[]>;
165
+ watchCoordinationRoomMembers(roomId: string, callback: (members: RoomMember[]) => void): () => void;
166
+ private withWebPresenceMetadata;
167
+ setAuthContext(context: {
168
+ userId: string;
169
+ token?: string | null;
170
+ refreshToken?: string | null;
171
+ customToken?: string | null;
172
+ tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
173
+ appCheckTokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
174
+ expiresAtMs?: number | null;
175
+ } | null): Promise<void>;
176
+ private ensureBrowserPlatformAuth;
177
+ private syncWasmAuthToken;
178
+ private toRuntimeIdentity;
179
+ protected getCurrentUserId(): string | null;
180
+ getCurrentUserIdForScope(): string | null;
181
+ getAuthContext(): Readonly<typeof this.authContext> | null;
182
+ protected isSpaceMode(): boolean;
183
+ getResolvedOptions(): Readonly<typeof this.options>;
184
+ protected getDiscoveryScopeId(): string | null;
185
+ protected matchesTag(device: Pick<RawDeviceDoc, 'tag' | 'appTag'>): boolean;
186
+ matchesLegacyOrCurrentTag(device: Pick<RawDeviceDoc, 'tag' | 'appTag'>): boolean;
187
+ private stopSessionSubscriptions;
188
+ private stopRuntimeAuthScopedLoops;
189
+ stopAuthScopedActivity(options?: {
190
+ userId?: string | null;
191
+ }): Promise<void>;
192
+ setWasmClient(client: any): void;
193
+ initializePersistentIrohProtocols(store: IrohBrowserProtocolStore): Promise<void>;
194
+ createPersistentIrohNamespace(generation: number, shareRevision: number): Promise<IrohNamespaceDescriptor>;
195
+ importPersistentIrohTicket(ticket: string, generation: number, shareRevision: number): Promise<string>;
196
+ sharePersistentIrohNamespace(namespaceId: string, writable: boolean): Promise<string>;
197
+ removePersistentIrohNamespace(namespaceId: string, generation: number, shareRevision: number): Promise<void>;
198
+ putPersistentIrohBytes(namespaceId: string, key: Uint8Array, value: Uint8Array): Promise<IrohMutationReceipt>;
199
+ setPersistentIrohHash(namespaceId: string, key: Uint8Array, contentHash: string, contentLength: number): Promise<string>;
200
+ deletePersistentIrohPrefix(namespaceId: string, prefix: Uint8Array): Promise<{
201
+ removed: number;
202
+ operationId: string;
203
+ }>;
204
+ queryPersistentIrohNamespace(namespaceId: string, keyPrefix: Uint8Array): Promise<IrohDocEntry[]>;
205
+ hydratePersistentIrohBlob(contentHash: string): Promise<void>;
206
+ acknowledgePersistentIrohOutbox(operationId: string): Promise<void>;
207
+ flushPersistentIrohProtocols(): Promise<void>;
208
+ shutdownPersistentIrohProtocols(): Promise<void>;
209
+ private requirePersistentProtocolHost;
210
+ private warnMissingWasmOnce;
211
+ private waitForWasmClient;
212
+ protected normalizeDevice(raw: Record<string, any>, fallbackId?: string): Device;
213
+ normalizeDeviceRecord(raw: Record<string, any>, fallbackId?: string): Device;
214
+ getResolvedWebLogicalDeviceId(): string;
215
+ private normalizeDeviceStatusSnapshot;
216
+ private normalizePeerSessionSnapshot;
217
+ private toBackendConnectionStateFromPeerSession;
218
+ private normalizeConnectionStateSnapshot;
219
+ private stabilizeConnectionState;
220
+ private sameConnectionState;
221
+ private deliverConnectionState;
222
+ private get browserPresenceLoopState();
223
+ private set browserPresenceLoopState(value);
224
+ get currentUser(): RuntimeIdentity | null;
225
+ onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
226
+ checkForSSOToken(): Promise<void>;
227
+ waitForAuth(): Promise<void>;
228
+ signInAnonymously(): Promise<void>;
229
+ signInWithPluto(): Promise<void>;
230
+ signOut(): Promise<void>;
231
+ getTurnCredentials(): Promise<any>;
232
+ updatePresence(localNodeId: string, ticketStr: string, isOnline?: boolean, ttlMs?: number, metadata?: string, deviceNameOverride?: string): Promise<void>;
233
+ refreshLivePresence(localNodeId: string, ticketStr: string, metadata?: string, deviceNameOverride?: string): Promise<void>;
234
+ setOffline(localNodeId: string): Promise<void>;
235
+ updateDevice(deviceId: string, updates: {
236
+ deviceName?: string;
237
+ capabilities?: Device['capabilities'];
238
+ metadata?: string;
239
+ excludedPeers?: string[];
240
+ }): Promise<void>;
241
+ deleteDevice(deviceId: string): Promise<void>;
242
+ cleanupStaleDevices(): Promise<void>;
243
+ sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
244
+ pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
245
+ searchDevices(excludeNodeId?: string): Promise<Device[]>;
246
+ listDevicesWithStatus(): Promise<DeviceStatusSnapshot[]>;
247
+ getPeerSession(id: string): Promise<PeerSessionSnapshot | null>;
248
+ listPeerSessions(): Promise<PeerSessionSnapshot[]>;
249
+ waitForSettledPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
250
+ openPeerBi(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
251
+ openPeerNativeBi(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
252
+ openPeerBiTransportOnly(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
253
+ openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
254
+ resolvePeerConnectionRecords(id: string): Promise<ManagedConnectionRecord[]>;
255
+ resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
256
+ onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
257
+ subscribeDevices(userId: string): Promise<ReadableStream<DeviceEvent[]>>;
258
+ startAutoConnect(userId: string, localDeviceId: string): Promise<void>;
259
+ startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
260
+ notifyDisconnectRequested(remoteNodeId: string): void;
261
+ setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
262
+ disconnectDevice(deviceId: string): Promise<void>;
263
+ submitDesiredPeerProjection(revision: number, peers: DesiredPeerProjection[]): Promise<void>;
264
+ setCoreClient(client: CoreClientBridgeHost | null): void;
265
+ private startApplicationRouteEscalationSubscription;
266
+ private stopApplicationRouteEscalationSubscription;
267
+ private retryManagedApplicationRouteEscalations;
268
+ private escalateManagedApplicationRoute;
269
+ connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
270
+ forceReconnectSnapshot(): void;
271
+ startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
272
+ private ensureSpaceNamespaceIdPromise;
273
+ createSession(session: SignalingSession): Promise<void>;
274
+ updateSession(sessionId: string, updateData: any): Promise<void>;
275
+ subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
276
+ getLocalDeviceId(): Promise<string | null>;
277
+ isConnected(node_id: string): Promise<boolean>;
278
+ private hasConnectedIndependentPeerRoute;
279
+ getConnectionStates(): Promise<BackendConnectionState[]>;
280
+ onConnectionStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
281
+ sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
282
+ private sanitizeExplicitFileName;
283
+ private sanitizeExplicitMimeType;
284
+ private assertExplicitTransferHeaderSize;
285
+ private createWebRTCExplicitTransferId;
286
+ private createWebRTCExplicitTransferFrame;
287
+ sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
288
+ getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
289
+ deleteTransferJob(jobId: string): Promise<void>;
290
+ watchFriendDevices(friendUserIds: string[], callback: (friendDevices: Map<string, any[]>) => void): () => void;
291
+ updateFriendTicket(friendTicket: string | null): Promise<void>;
292
+ }
293
+
294
+ declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
295
+ protected readonly backend: ISignalingBackend;
296
+ protected constructor(backend: ISignalingBackend);
297
+ get currentUser(): RuntimeIdentity | null;
298
+ setAuthContext(context: AuthContext | null): Promise<void> | void;
299
+ signInAnonymously(): Promise<void>;
300
+ signInWithPluto(): Promise<void>;
301
+ signOut(): Promise<void>;
302
+ stopAuthScopedActivity(): Promise<void>;
303
+ usesCoordinationGateway(): boolean;
304
+ joinCoordinationRoom(roomId: string, nodeId: string, ticket: string): Promise<void>;
305
+ leaveCoordinationRoom(roomId: string): Promise<void>;
306
+ getCoordinationRoomMembers(roomId: string): Promise<RoomMember[]>;
307
+ watchCoordinationRoomMembers(roomId: string, callback: (members: RoomMember[]) => void): () => void;
308
+ getTurnCredentials(): Promise<any>;
309
+ updatePresence(localNodeId: string, ticketStr: string, isOnline: boolean, ttlMs: number, metadata?: string): Promise<void>;
310
+ refreshLivePresence(localNodeId: string, ticketStr: string, metadata?: string): Promise<void>;
311
+ setOffline(localNodeId: string): Promise<void>;
312
+ cleanupStaleDevices(): Promise<void>;
313
+ searchDevices(excludeNodeId?: string): Promise<Device[]>;
314
+ listDevicesWithStatus(): Promise<DeviceStatusSnapshot[]>;
315
+ getPeerSession(id: string): Promise<PeerSessionSnapshot | null>;
316
+ listPeerSessions(): Promise<PeerSessionSnapshot[]>;
317
+ waitForSettledPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
318
+ resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
319
+ resolvePeerConnectionRecords(id: string): Promise<ManagedConnectionRecord[]>;
320
+ updateDevice(deviceId: string, updates: {
321
+ deviceName?: string;
322
+ capabilities?: Device['capabilities'];
323
+ metadata?: string;
324
+ }): Promise<void>;
325
+ deleteDevice(deviceId: string): Promise<void>;
326
+ onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
327
+ onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
328
+ checkForSSOToken(): Promise<void>;
329
+ waitForAuth(): Promise<void>;
330
+ sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
331
+ pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
332
+ watchFriendDevices(friendUserIds: string[], callback: (friendDevices: Map<string, Device[]>) => void): () => void;
333
+ updateFriendTicket(friendTicket: string | null): Promise<void>;
334
+ subscribeDevices(userId: string): Promise<ReadableStream<DeviceEvent[]>>;
335
+ startAutoConnect(userId: string, localDeviceId: string): void;
336
+ submitDesiredPeerProjection(revision: number, peers: DesiredPeerProjection[]): Promise<void>;
337
+ startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
338
+ createSession(session: SignalingSession): Promise<void>;
339
+ updateSession(sessionId: string, updateData: any): Promise<void>;
340
+ subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
341
+ forceReconnectSnapshot(): void;
342
+ getLocalDeviceId(): Promise<string | null>;
343
+ getLocalDeviceInfo(): Promise<LocalDeviceInfo | null>;
344
+ updateLocalDeviceName(deviceName: string): Promise<LocalDeviceInfo | null>;
345
+ startManagedSessionNative(options: {
346
+ userId: string;
347
+ deviceName?: string;
348
+ localDeviceId?: string | null;
349
+ metadata?: string;
350
+ autoConnect?: boolean;
351
+ presence?: boolean;
352
+ }): Promise<NativeManagedSessionStartResult>;
353
+ notifyNetworkChange(options?: {
354
+ reason?: string;
355
+ }): Promise<unknown>;
356
+ getManagedNodeId(options?: {
357
+ initializeIfMissing?: boolean;
358
+ }): Promise<string | null>;
359
+ startPresenceLoopOnce(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
360
+ startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
361
+ getEndpointTicket(): Promise<string>;
362
+ getEndpointTicketWithToken(scope: GrantScope, maxConnections: number): Promise<string | null>;
363
+ registerSessionToken(token: string, scope: GrantScope, maxConnections: number, expiresAtMs?: number): Promise<void>;
364
+ revokeSessionTokensByScope(scope: GrantScope): Promise<string[]>;
365
+ openPeerBi(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
366
+ incoming_streams(): Promise<ReadableStream<unknown>>;
367
+ is_current_transport_stable_id(endpointId: string, transportStableId: bigint): Promise<boolean>;
368
+ openPeerNativeBi(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
369
+ openPeerBiTransportOnly(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
370
+ openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
371
+ connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
372
+ disconnectDevice(deviceId: string): Promise<void>;
373
+ setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
374
+ isConnected(nodeId: string): Promise<boolean>;
375
+ getConnectionStates(): Promise<BackendConnectionState[]>;
376
+ onConnectionStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
377
+ /** @deprecated Use named channels or `openrtc-file-transfer`. */
378
+ sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
379
+ /** @deprecated Use named channels or `openrtc-file-transfer`. */
380
+ sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
381
+ /** @deprecated Transfer history belongs to the consumer application. */
382
+ getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
383
+ /** @deprecated Transfer history belongs to the consumer application. */
384
+ deleteTransferJob(jobId: string): Promise<void>;
385
+ getRuntimeCapabilities(): RuntimeCapabilities;
386
+ onIncomingNativeMessage(callback: (connectionId: string, remoteNodeId: string | null, message: any) => void): Promise<() => void>;
387
+ unwrap(): ISignalingBackend;
388
+ /**
389
+ * Forward setCoreClient() to the inner backend if it implements it. This
390
+ * lets the core Client inject a reference into backends (e.g. WasmBridge)
391
+ * that need to escalate transport-level dials into full Client.connect()
392
+ * handshakes.
393
+ */
394
+ setCoreClient(client: unknown): void;
395
+ }
396
+
397
+ export { DelegatingRuntimeAdapter as D, WasmBridge as W, type WasmBridgeOptions as a };
@@ -77,6 +77,8 @@ interface AppLimits {
77
77
  maxPersonalDevices: number;
78
78
  }
79
79
  interface PlutoRTCConfiguration extends RTCConfiguration {
80
+ /** Keep the legacy route, carry Iroh packets, or try the carrier before fallback. */
81
+ implementation?: TransportImplementation;
80
82
  iceServers?: RTCIceServer[];
81
83
  /**
82
84
  * Populate public STUN defaults when no ICE servers are configured.
@@ -98,6 +100,7 @@ interface PlutoMoQServerCertificateHash {
98
100
  value: ArrayBuffer;
99
101
  }
100
102
  interface PlutoMoQConfiguration {
103
+ implementation?: TransportImplementation;
101
104
  relayUrl?: string;
102
105
  /** Relay JWT appended only at WebTransport connection time. Never include it in relayUrl. */
103
106
  accessToken?: string;
@@ -170,11 +173,14 @@ interface ChannelDescriptor {
170
173
  delivery?: 'reliable' | 'latest-state';
171
174
  description?: string;
172
175
  }
173
- type ProtocolName = 'iroh' | 'iroh-quic' | 'iroh-relay' | 'iroh-lan' | 'ble' | 'webrtc' | 'webrtc-lan' | 'webrtc-turn' | 'moq';
176
+ type ProtocolName = 'iroh' | 'iroh-quic' | 'iroh-relay' | 'iroh-lan' | 'iroh-webrtc' | 'iroh-moq' | 'ble' | 'webrtc' | 'webrtc-lan' | 'webrtc-turn' | 'moq';
174
177
  type ProtocolMaturity = 'stable' | 'experimental' | 'unsupported';
178
+ type TransportImplementation = 'external' | 'iroh-carrier' | 'auto';
179
+ type TransportPrivacy = 'direct' | 'relay-only';
180
+ type TransportOptimization = 'balanced' | 'lowest-latency';
175
181
  type ProtocolBaseName = 'iroh' | 'webrtc' | 'moq';
176
182
  type RouteFamily = 'iroh-path' | 'iroh-physical' | 'optional-route';
177
- type RouteImplementationKind = 'core' | 'host-installed' | 'route-adapter' | 'path-label';
183
+ type RouteImplementationKind = 'core' | 'host-installed' | 'carrier-adapter' | 'route-adapter' | 'path-label';
178
184
  /**
179
185
  * Public compatibility type. `native` and `plugin` are legacy capability
180
186
  * labels; generated route descriptors use `RouteImplementationKind`.
@@ -282,6 +288,8 @@ interface ClientOptions {
282
288
  kind: 'user' | 'space' | 'room' | 'session';
283
289
  id: string;
284
290
  };
291
+ /** @internal Raw host platform metadata used only for roster presentation. */
292
+ coordinationPlatformType?: string;
285
293
  /**
286
294
  * Supplies the provider-neutral platform-attestation token used by the
287
295
  * configured coordination control plane.
@@ -339,6 +347,12 @@ interface ClientOptions {
339
347
  webrtc?: boolean | PlutoRTCConfiguration;
340
348
  ble?: boolean | PlutoBleConfiguration;
341
349
  moq?: boolean | PlutoMoQConfiguration;
350
+ /** Hard route-eligibility policy. Relay-only fails closed. */
351
+ privacy?: TransportPrivacy;
352
+ /** Route objective applied after privacy and capability filtering. */
353
+ optimizeFor?: TransportOptimization;
354
+ /** Exact-route fallback and tie-break order. Unsupported routes are skipped. */
355
+ priority?: ProtocolName[];
342
356
  };
343
357
  transportPriority?: ProtocolName[];
344
358
  /** Subscribe to native LAN peer discovery events. */
@@ -421,6 +435,10 @@ interface PeerState {
421
435
  admissionState?: PeerAdmissionState;
422
436
  transportState?: string;
423
437
  protocolState?: string;
438
+ /** Compatibility projection of the canonical `routable` readiness facet. */
439
+ settledReady?: boolean;
440
+ readinessState?: string;
441
+ readinessReason?: string;
424
442
  webrtcState?: PeerWebRtcState;
425
443
  routable?: boolean;
426
444
  activeTransportStableId?: number | null;
@@ -671,6 +689,8 @@ interface TransportLatencySnapshot {
671
689
  iroh?: number | null;
672
690
  irohLan?: number | null;
673
691
  irohRelay?: number | null;
692
+ irohWebrtc?: number | null;
693
+ irohMoq?: number | null;
674
694
  ble?: number | null;
675
695
  moq?: number | null;
676
696
  }
@@ -823,6 +843,10 @@ interface ISignalingBackend {
823
843
  signInWithPluto?(): Promise<void>;
824
844
  signOut(): Promise<void>;
825
845
  stopAuthScopedActivity?(): Promise<void>;
846
+ setCoordinationHostAvailability?(input: {
847
+ available: boolean;
848
+ reason: string;
849
+ }): void;
826
850
  usesCoordinationGateway?(): boolean;
827
851
  joinCoordinationRoom?(roomId: string, nodeId: string, ticket: string): Promise<void>;
828
852
  leaveCoordinationRoom?(roomId: string): Promise<void>;
@@ -1080,4 +1104,19 @@ interface JoinRequest {
1080
1104
  state: 'pending' | 'accepted' | 'rejected';
1081
1105
  }
1082
1106
 
1083
- export type { SignalingOptions as $, AuthMode as A, BackendPeerBiStream as B, ClientOptions as C, DiscoveryMode as D, ExplicitFileDataSendParams as E, PeerLifecycleStatus as F, GrantScope as G, RouteDescriptor as H, ISignalingBackend as I, JoinRoomOptions as J, ProtocolCapability as K, LocalDeviceInfo as L, ManagedConnectionRecord as M, NativeManagedSessionStartResult as N, ProtocolCapabilityMap as O, PeerSessionSnapshot as P, ApplicationCryptoStreamTools as Q, RuntimeIdentity as R, SignalingMode as S, TransportLatencySnapshot as T, ApplicationCryptoBiStream as U, RouteFamily as V, RouteImplementationKind as W, ConnectDeviceHooks as X, ConnectDeviceOptions as Y, ConnectDeviceResult as Z, AppLimits as _, RoomMember as a, RoomCreationMode as a0, ScanningLoopOptions as a1, ScanningLoopHandle as a2, RuntimeBootstrapOptions as a3, RuntimeBootstrapResult as a4, ManagedApplicationRouteOptions as a5, JoinRequest as a6, SpaceTokenProvider as a7, Device as b, DeviceStatusSnapshot as c, ResolvedPeerIdentity as d, SignalingEnvelope as e, DeviceEvent as f, DesiredPeerProjection as g, SignalingSession as h, SessionEvent as i, BackendPeerUniStream as j, NativeConnectParams as k, NativeConnectResult as l, BackendConnectionState as m, ConnectionOptions as n, ApplicationPayloadCrypto as o, ApplicationPayloadReadinessOptions as p, ApplicationPayloadRouteOptions as q, ProtocolName as r, ApplicationPayloadSendOptions as s, PeerState as t, PeerScope as u, PeerHealth as v, ChannelDescriptor as w, IncomingStreamChannelMetadata as x, ManagedDeviceConnectOptions as y, DevicePresenceStatus as z };
1107
+ interface ITransport {
1108
+ readonly name: string;
1109
+ readonly isReady: boolean;
1110
+ init(localNodeId: string, remoteNodeId: string, options: any): Promise<void>;
1111
+ send(data: Uint8Array): Promise<void>;
1112
+ close(): void;
1113
+ onMessage(callback: (data: Uint8Array) => void): void;
1114
+ onStateChange(callback: (state: 'connecting' | 'connected' | 'failed' | 'disconnected') => void): void;
1115
+ handleSignalingMessage?(msg: any): void;
1116
+ getSignalingHandler?(): (msg: any) => Promise<void>;
1117
+ getNativeTransport?(): any;
1118
+ getNegotiationId?(): string | null;
1119
+ getDataChannelReadyState?(): string | null;
1120
+ }
1121
+
1122
+ export type { ProtocolCapabilityMap as $, AuthMode as A, BackendPeerBiStream as B, ConnectDeviceResult as C, Device as D, ExplicitFileDataSendParams as E, ITransport as F, GrantScope as G, TransportLatencySnapshot as H, ISignalingBackend as I, PeerState as J, PeerScope as K, LocalDeviceInfo as L, ManagedConnectionRecord as M, NativeConnectParams as N, PeerHealth as O, PlutoIrohConfiguration as P, ChannelDescriptor as Q, ResolvedPeerIdentity as R, SignalingMode as S, TransportOptimization as T, IncomingStreamChannelMetadata as U, ManagedDeviceConnectOptions as V, JoinRoomOptions as W, DevicePresenceStatus as X, PeerLifecycleStatus as Y, RouteDescriptor as Z, ProtocolCapability as _, PlutoRTCConfiguration as a, ApplicationCryptoStreamTools as a0, ApplicationCryptoBiStream as a1, RouteFamily as a2, RouteImplementationKind as a3, AppLimits as a4, SignalingOptions as a5, RoomCreationMode as a6, ScanningLoopOptions as a7, ScanningLoopHandle as a8, RuntimeBootstrapOptions as a9, RuntimeBootstrapResult as aa, ManagedApplicationRouteOptions as ab, JoinRequest as ac, PlutoMoQConfiguration as b, ProtocolName as c, PeerSessionSnapshot as d, ConnectDeviceHooks as e, ConnectDeviceOptions as f, ClientOptions as g, DiscoveryMode as h, RoomMember as i, RuntimeIdentity as j, SignalingEnvelope as k, DeviceStatusSnapshot as l, BackendPeerUniStream as m, DeviceEvent as n, DesiredPeerProjection as o, CoreClientBridgeHost as p, NativeConnectResult as q, SignalingSession as r, SessionEvent as s, BackendConnectionState as t, NativeManagedSessionStartResult as u, ConnectionOptions as v, ApplicationPayloadCrypto as w, ApplicationPayloadReadinessOptions as x, ApplicationPayloadRouteOptions as y, ApplicationPayloadSendOptions as z };
@@ -0,0 +1,19 @@
1
+ import { g as ClientOptions } from './ITransport-WV6gGMnX.js';
2
+ import { a as WasmBridgeOptions, D as DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter-BFZDC604.js';
3
+ import { P as PlutoIpcBridge } from './ipc-CflAVodw.js';
4
+
5
+ interface NativeIpcBridgeOptions extends WasmBridgeOptions {
6
+ allowWasmFallback?: boolean;
7
+ ipcBridge?: PlutoIpcBridge;
8
+ transports?: ClientOptions['transports'];
9
+ strictMode?: boolean;
10
+ }
11
+
12
+ interface IpcRuntimeAdapterOptions extends NativeIpcBridgeOptions {
13
+ bridge: PlutoIpcBridge;
14
+ }
15
+ declare class IpcRuntimeAdapter extends DelegatingRuntimeAdapter {
16
+ constructor(options: IpcRuntimeAdapterOptions);
17
+ }
18
+
19
+ export { IpcRuntimeAdapter as I, type IpcRuntimeAdapterOptions as a };