openrtc 0.1.0 → 0.1.2
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.
- package/README.md +1 -2
- package/dist/{core/types.d.ts → DelegatingRuntimeAdapter-CW8d78dZ.d.ts} +275 -95
- package/dist/IpcRuntimeAdapter-CT-W0Mtp.d.ts +24 -0
- package/dist/auth/index.d.ts +75 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/internal.d.ts +3 -1
- package/dist/auth/internal.js +1 -1
- package/dist/chunk-4MH42GUI.js +2 -0
- package/dist/chunk-CQAKCS2S.js +4 -0
- package/dist/chunk-D54VGRRH.js +1 -0
- package/dist/chunk-DIQYFAGL.js +2 -0
- package/dist/chunk-PZ25OCVG.js +2 -0
- package/dist/chunk-UVASANPG.js +1 -0
- package/dist/factories-0TxDPMeu.d.ts +1041 -0
- package/dist/index.d.ts +160 -3
- package/dist/index.js +1 -3
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +5 -3
- package/dist/runtime/WasmRuntimeAdapter.js +1 -11
- package/dist/runtime/index.d.ts +796 -6
- package/dist/runtime/index.js +1 -5
- package/dist/runtime/tauri.d.ts +12 -8
- package/dist/runtime/tauri.js +1 -22
- package/package.json +11 -7
- package/wasm/openrtc.d.ts +61 -25
- package/wasm/openrtc.js +417 -259
- package/wasm/openrtc_bg.wasm +0 -0
- package/wasm/openrtc_bg.wasm.d.ts +27 -24
- package/wasm/package.json +1 -1
- package/dist/OpenRTC.d.ts +0 -71
- package/dist/OpenRTC.js +0 -130
- package/dist/api/MediaTransport.d.ts +0 -7
- package/dist/api/MediaTransport.js +0 -262
- package/dist/api/PlutoPeerConnection.d.ts +0 -50
- package/dist/api/PlutoPeerConnection.js +0 -434
- package/dist/api/PlutoWebSocket.d.ts +0 -24
- package/dist/api/PlutoWebSocket.js +0 -113
- package/dist/api/PlutoWebTransport.d.ts +0 -29
- package/dist/api/PlutoWebTransport.js +0 -105
- package/dist/auth/host.d.ts +0 -73
- package/dist/auth/host.js +0 -513
- package/dist/compat/index.d.ts +0 -20
- package/dist/compat/index.js +0 -20
- package/dist/core/Client.d.ts +0 -352
- package/dist/core/Client.js +0 -3689
- package/dist/core/Connection.d.ts +0 -67
- package/dist/core/Connection.js +0 -404
- package/dist/core/IEngineBridge.d.ts +0 -18
- package/dist/core/IEngineBridge.js +0 -1
- package/dist/core/ISignalingTransport.d.ts +0 -13
- package/dist/core/ISignalingTransport.js +0 -1
- package/dist/core/PeerLifecycleManager.d.ts +0 -43
- package/dist/core/PeerLifecycleManager.js +0 -330
- package/dist/core/PeerProjectionStore.d.ts +0 -43
- package/dist/core/PeerProjectionStore.js +0 -327
- package/dist/core/PlutoRTC.d.ts +0 -13
- package/dist/core/PlutoRTC.js +0 -26
- package/dist/core/Room.d.ts +0 -47
- package/dist/core/Room.js +0 -376
- package/dist/core/Signaling.d.ts +0 -39
- package/dist/core/Signaling.js +0 -147
- package/dist/core/bridges/BridgeCodecs.d.ts +0 -19
- package/dist/core/bridges/BridgeCodecs.js +0 -317
- package/dist/core/bridges/BrowserFirestoreRooms.d.ts +0 -36
- package/dist/core/bridges/BrowserFirestoreRooms.js +0 -169
- package/dist/core/bridges/BrowserFirestoreSignaling.d.ts +0 -111
- package/dist/core/bridges/BrowserFirestoreSignaling.js +0 -1010
- package/dist/core/bridges/NativeIpcBridge.d.ts +0 -156
- package/dist/core/bridges/NativeIpcBridge.js +0 -1472
- package/dist/core/bridges/RtdbPresence.d.ts +0 -122
- package/dist/core/bridges/RtdbPresence.js +0 -201
- package/dist/core/bridges/TauriBridge.d.ts +0 -8
- package/dist/core/bridges/TauriBridge.js +0 -7
- package/dist/core/bridges/WasmBridge.d.ts +0 -233
- package/dist/core/bridges/WasmBridge.js +0 -1811
- package/dist/core/config.d.ts +0 -31
- package/dist/core/config.js +0 -138
- package/dist/core/transports/ITransport.d.ts +0 -12
- package/dist/core/transports/ITransport.js +0 -1
- package/dist/core/transports/LocalDaemonBridge.d.ts +0 -41
- package/dist/core/transports/LocalDaemonBridge.js +0 -227
- package/dist/core/transports/TauriSignaling.d.ts +0 -28
- package/dist/core/transports/TauriSignaling.js +0 -373
- package/dist/core/transports/TransportFactory.d.ts +0 -9
- package/dist/core/transports/TransportFactory.js +0 -59
- package/dist/core/transports/WasmSignaling.d.ts +0 -78
- package/dist/core/transports/WasmSignaling.js +0 -522
- package/dist/core/transports/WebRTCTransport.d.ts +0 -23
- package/dist/core/transports/WebRTCTransport.js +0 -132
- package/dist/core/trust.d.ts +0 -23
- package/dist/core/trust.js +0 -99
- package/dist/core/types.js +0 -19
- package/dist/moq/MoQMediaTransport.d.ts +0 -6
- package/dist/moq/MoQMediaTransport.js +0 -106
- package/dist/moq/MoQPublisher.d.ts +0 -22
- package/dist/moq/MoQPublisher.js +0 -179
- package/dist/moq/MoQSession.d.ts +0 -35
- package/dist/moq/MoQSession.js +0 -166
- package/dist/moq/MoQSubscriber.d.ts +0 -19
- package/dist/moq/MoQSubscriber.js +0 -235
- package/dist/moq/common.d.ts +0 -47
- package/dist/moq/common.js +0 -304
- package/dist/moq/messages.d.ts +0 -105
- package/dist/moq/messages.js +0 -367
- package/dist/presets/plutoHosted.d.ts +0 -13
- package/dist/presets/plutoHosted.js +0 -18
- package/dist/runtime/DelegatingRuntimeAdapter.d.ts +0 -68
- package/dist/runtime/DelegatingRuntimeAdapter.js +0 -250
- package/dist/runtime/IpcRuntimeAdapter.d.ts +0 -9
- package/dist/runtime/IpcRuntimeAdapter.js +0 -13
- package/dist/runtime/RuntimeClient.d.ts +0 -257
- package/dist/runtime/RuntimeClient.js +0 -1484
- package/dist/runtime/TauriRuntimeAdapter.d.ts +0 -1
- package/dist/runtime/TauriRuntimeAdapter.js +0 -1
- package/dist/runtime/factories.d.ts +0 -24
- package/dist/runtime/factories.js +0 -66
- package/dist/runtime/ipc.d.ts +0 -8
- package/dist/runtime/ipc.js +0 -65
- package/dist/runtime/ipcContract.d.ts +0 -46
- package/dist/runtime/ipcContract.js +0 -1
- package/dist/runtime/types.d.ts +0 -110
- package/dist/runtime/types.js +0 -1
- package/dist/transports/TauriTransport.d.ts +0 -17
- package/dist/transports/TauriTransport.js +0 -49
- package/dist/transports/WebTransport.d.ts +0 -23
- package/dist/transports/WebTransport.js +0 -71
- package/dist/utils/debug.d.ts +0 -4
- package/dist/utils/debug.js +0 -33
- package/dist/utils/runtime.d.ts +0 -1
- package/dist/utils/runtime.js +0 -10
package/README.md
CHANGED
|
@@ -70,11 +70,10 @@ full ALPN plugin layer.
|
|
|
70
70
|
### Root Package
|
|
71
71
|
- `OpenRTC()`
|
|
72
72
|
- `OpenRTC.native()`
|
|
73
|
-
- `Client` (re-export alias)
|
|
74
|
-
- `RuntimeClient`
|
|
75
73
|
|
|
76
74
|
### Runtime Secondary Entrypoint
|
|
77
75
|
- `openrtc/runtime`
|
|
76
|
+
- `RuntimeClient`
|
|
78
77
|
- `createWasmClient()` and `createIpcClient(..., bridge)` (legacy compatibility)
|
|
79
78
|
- `IpcRuntimeAdapter`
|
|
80
79
|
- `WasmRuntimeAdapter`
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export interface AppLimits {
|
|
1
|
+
interface AppLimits {
|
|
3
2
|
/** Max devices per authenticated user. -1 = unlimited. */
|
|
4
3
|
devicesPerUser: number;
|
|
5
4
|
/** Max total rooms the developer app can have open at once. -1 = unlimited. */
|
|
@@ -9,40 +8,50 @@ export interface AppLimits {
|
|
|
9
8
|
/** Max active devices across all provisioned personal spaces for this app. -1 = unlimited. */
|
|
10
9
|
maxPersonalDevices: number;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
export declare const DEFAULT_MOQ_RELAY_URL = "https://relay.cloudflare.mediaoverquic.com";
|
|
14
|
-
export declare const DEFAULT_ICE_SERVERS: {
|
|
15
|
-
urls: string;
|
|
16
|
-
}[];
|
|
17
|
-
export interface PlutoRTCConfiguration extends RTCConfiguration {
|
|
11
|
+
interface PlutoRTCConfiguration extends RTCConfiguration {
|
|
18
12
|
iceServers?: RTCIceServer[];
|
|
19
13
|
privacyMode?: boolean;
|
|
20
14
|
useTurn?: boolean;
|
|
21
15
|
}
|
|
22
|
-
|
|
23
|
-
export interface PlutoMoQConfiguration {
|
|
16
|
+
interface PlutoMoQConfiguration {
|
|
24
17
|
relayUrl?: string;
|
|
25
18
|
}
|
|
26
|
-
|
|
27
|
-
export interface PlutoIrohConfiguration {
|
|
19
|
+
interface PlutoIrohConfiguration {
|
|
28
20
|
relayOnly?: boolean;
|
|
29
21
|
persistenceMode?: 'persistent' | 'ephemeral';
|
|
30
22
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
interface TurnCredentials {
|
|
24
|
+
iceServers?: RTCIceServer[];
|
|
25
|
+
}
|
|
26
|
+
type TurnCredentialsProvider = () => Promise<TurnCredentials | null | undefined>;
|
|
27
|
+
type DiscoveryMode = 'personal' | 'user-scoped';
|
|
28
|
+
type AuthMode = 'external' | 'anonymous' | 'required';
|
|
29
|
+
type SignalingMode = 'hosted' | 'ticket-only';
|
|
30
|
+
type RoomCreationMode = 'client-open' | 'client-auth' | 'server-only';
|
|
31
|
+
type EndpointKind = 'device' | 'ephemeral';
|
|
32
|
+
type PeerLifecycleStatus = 'disconnected' | 'connecting' | 'connected' | 'failed' | 'closed';
|
|
33
|
+
type PeerHealth = 'unknown' | 'healthy' | 'suspect' | 'stale';
|
|
34
|
+
/**
|
|
35
|
+
* Lifecycle label attached to a projected peer while the runtime tracks local ownership.
|
|
36
|
+
*
|
|
37
|
+
* This is not an admission grant. Use `GrantScope` for ticket/token authorization labels
|
|
38
|
+
* such as `"share"`, `"friend"`, or `"user-device"`.
|
|
39
|
+
*/
|
|
40
|
+
type PeerScope = 'persistent' | 'session' | string;
|
|
41
|
+
/**
|
|
42
|
+
* Admission-grant label embedded in restricted compound tickets and session tokens.
|
|
43
|
+
*
|
|
44
|
+
* `GrantScope` controls authorization and bulk revoke behavior in the Rust admission layer.
|
|
45
|
+
* It is distinct from `PeerScope`, which only labels local peer lifecycle ownership.
|
|
46
|
+
*/
|
|
47
|
+
type GrantScope = string;
|
|
48
|
+
type ChannelOwnership = 'shared' | 'exclusive';
|
|
49
|
+
type ChannelPeerModel = 'device-first' | 'node-first' | 'anonymous-ticket';
|
|
50
|
+
type ChannelRoutingMode = 'stream-envelope' | 'session-default';
|
|
51
|
+
type ChannelReadinessMode = 'settled-peer' | 'transport-only';
|
|
52
|
+
type ChannelPromotionPolicy = 'eligible' | 'never';
|
|
53
|
+
type ChannelSignalingPolicy = 'hosted' | 'ticket-only';
|
|
54
|
+
interface ChannelDescriptor {
|
|
46
55
|
id: string;
|
|
47
56
|
kind: 'system' | 'auth' | 'share' | 'transfer' | 'sync' | string;
|
|
48
57
|
ownership: ChannelOwnership;
|
|
@@ -53,16 +62,16 @@ export interface ChannelDescriptor {
|
|
|
53
62
|
signalingPolicy?: ChannelSignalingPolicy;
|
|
54
63
|
description?: string;
|
|
55
64
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
type ProtocolName = 'iroh' | 'iroh-quic' | 'iroh-relay' | 'webrtc' | 'moq';
|
|
66
|
+
type ProtocolMaturity = 'stable' | 'experimental' | 'unsupported';
|
|
67
|
+
interface ProtocolCapability {
|
|
59
68
|
protocol: ProtocolName;
|
|
60
69
|
maturity: ProtocolMaturity;
|
|
61
70
|
available: boolean;
|
|
62
71
|
reason?: string;
|
|
63
72
|
}
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
type ProtocolCapabilityMap = Record<ProtocolName, ProtocolCapability>;
|
|
74
|
+
interface ClientOptions {
|
|
66
75
|
/**
|
|
67
76
|
* API key issued from the Pluto developer dashboard (https://api.openrtc.app/developer).
|
|
68
77
|
* The runtime derives its app namespace from this key.
|
|
@@ -105,6 +114,15 @@ export interface ClientOptions {
|
|
|
105
114
|
nodeIdPersistence?: 'persistent' | 'ephemeral';
|
|
106
115
|
secretKey?: string;
|
|
107
116
|
strictMode?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Optional application-provided TURN credential loader.
|
|
119
|
+
*
|
|
120
|
+
* OpenRTC never needs long-lived TURN secrets in the client. When strict/privacy
|
|
121
|
+
* WebRTC needs relay candidates, provide a backend-backed loader that returns
|
|
122
|
+
* short-lived RTCIceServer entries. Leave unset for the production default of
|
|
123
|
+
* no paid TURN usage.
|
|
124
|
+
*/
|
|
125
|
+
turnCredentialsProvider?: TurnCredentialsProvider;
|
|
108
126
|
localDeviceId?: string;
|
|
109
127
|
onDevices?: (devices: Device[]) => void;
|
|
110
128
|
onAutoConnect?: (devices: Device[]) => void;
|
|
@@ -117,19 +135,11 @@ export interface ClientOptions {
|
|
|
117
135
|
transportPriority?: ProtocolName[];
|
|
118
136
|
disableIrohFallback?: boolean;
|
|
119
137
|
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @deprecated Internal namespace metadata. Public integrations should not depend on `appTag`.
|
|
123
|
-
*/
|
|
124
|
-
appTag?: string;
|
|
138
|
+
interface Device {
|
|
125
139
|
deviceId: string;
|
|
126
140
|
deviceName: string;
|
|
127
141
|
online: boolean;
|
|
128
142
|
ticket: string;
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated Legacy/internal namespace metadata. Public integrations should not depend on `tag`.
|
|
131
|
-
*/
|
|
132
|
-
tag?: string;
|
|
133
143
|
kind?: EndpointKind | string;
|
|
134
144
|
nodeId?: string;
|
|
135
145
|
platformType?: string;
|
|
@@ -148,8 +158,9 @@ export interface Device {
|
|
|
148
158
|
createdAt?: any;
|
|
149
159
|
updatedAt?: any;
|
|
150
160
|
metadata?: string;
|
|
161
|
+
excludedPeers?: string[];
|
|
151
162
|
}
|
|
152
|
-
|
|
163
|
+
interface PeerState {
|
|
153
164
|
peerId: string;
|
|
154
165
|
deviceId?: string;
|
|
155
166
|
deviceIdHint?: string;
|
|
@@ -165,12 +176,16 @@ export interface PeerState {
|
|
|
165
176
|
transportState?: string;
|
|
166
177
|
protocolState?: string;
|
|
167
178
|
routable?: boolean;
|
|
179
|
+
activeTransportStableId?: number | null;
|
|
180
|
+
transportGeneration?: number;
|
|
181
|
+
activeTransport?: ProtocolName;
|
|
182
|
+
parallelTransport?: ProtocolName | null;
|
|
168
183
|
promotionEligible?: boolean;
|
|
169
184
|
scopes: PeerScope[];
|
|
170
185
|
lastSeenAt?: number;
|
|
171
186
|
error?: string;
|
|
172
187
|
}
|
|
173
|
-
|
|
188
|
+
interface BackendConnectionState {
|
|
174
189
|
connectionId: string;
|
|
175
190
|
deviceId?: string | null;
|
|
176
191
|
deviceIdHint?: string | null;
|
|
@@ -179,6 +194,8 @@ export interface BackendConnectionState {
|
|
|
179
194
|
transportState?: string;
|
|
180
195
|
protocolState?: string;
|
|
181
196
|
routable?: boolean;
|
|
197
|
+
activeTransport?: ProtocolName;
|
|
198
|
+
parallelTransport?: ProtocolName | null;
|
|
182
199
|
readinessState?: string;
|
|
183
200
|
readinessReason?: string;
|
|
184
201
|
transportGeneration?: number;
|
|
@@ -195,32 +212,40 @@ export interface BackendConnectionState {
|
|
|
195
212
|
createdAt?: number;
|
|
196
213
|
updatedAt?: number;
|
|
197
214
|
}
|
|
198
|
-
|
|
215
|
+
interface NativeConnectResult {
|
|
199
216
|
connectionId: string;
|
|
200
217
|
deviceId?: string | null;
|
|
201
218
|
deviceIdHint?: string | null;
|
|
202
219
|
remoteNodeId?: string | null;
|
|
203
220
|
state: string;
|
|
204
221
|
}
|
|
205
|
-
|
|
222
|
+
interface BackendPeerBiStream {
|
|
206
223
|
readable: ReadableStream<Uint8Array>;
|
|
207
224
|
writable: WritableStream<Uint8Array>;
|
|
208
225
|
}
|
|
209
|
-
|
|
226
|
+
interface BackendPeerUniStream {
|
|
210
227
|
writable: WritableStream<Uint8Array>;
|
|
211
228
|
}
|
|
212
|
-
|
|
229
|
+
interface IncomingStreamChannelMetadata {
|
|
213
230
|
channelId: string;
|
|
214
231
|
metadata?: Record<string, unknown> | null;
|
|
215
232
|
}
|
|
216
|
-
|
|
233
|
+
interface LocalDeviceInfo {
|
|
217
234
|
deviceId: string;
|
|
218
235
|
deviceName: string;
|
|
219
236
|
platformType?: string;
|
|
220
237
|
capabilities?: Device['capabilities'];
|
|
221
238
|
lastSeenAt?: string;
|
|
222
239
|
}
|
|
223
|
-
|
|
240
|
+
interface NativeManagedSessionStartResult {
|
|
241
|
+
localNodeId: string | null;
|
|
242
|
+
ticket?: string | null;
|
|
243
|
+
ticketScope?: string | null;
|
|
244
|
+
presenceStarted: boolean;
|
|
245
|
+
autoConnectStarted: boolean;
|
|
246
|
+
localDevice?: LocalDeviceInfo | null;
|
|
247
|
+
}
|
|
248
|
+
interface RoomMember {
|
|
224
249
|
nodeId: string;
|
|
225
250
|
userId: string;
|
|
226
251
|
ticket: string;
|
|
@@ -228,10 +253,10 @@ export interface RoomMember {
|
|
|
228
253
|
lastSeenAt: number;
|
|
229
254
|
expiresAt?: number;
|
|
230
255
|
}
|
|
231
|
-
|
|
256
|
+
interface JoinRoomOptions {
|
|
232
257
|
bootstrapPeers?: boolean;
|
|
233
258
|
}
|
|
234
|
-
|
|
259
|
+
interface SignalingEnvelope {
|
|
235
260
|
name?: string;
|
|
236
261
|
senderId: string;
|
|
237
262
|
targetId: string;
|
|
@@ -240,7 +265,7 @@ export interface SignalingEnvelope {
|
|
|
240
265
|
replyPayload?: string;
|
|
241
266
|
timestamp?: number;
|
|
242
267
|
}
|
|
243
|
-
|
|
268
|
+
interface SignalingSession {
|
|
244
269
|
connectionId: string;
|
|
245
270
|
initiator?: string;
|
|
246
271
|
target?: string;
|
|
@@ -258,14 +283,15 @@ export interface SignalingSession {
|
|
|
258
283
|
targetEndpointAddr?: string;
|
|
259
284
|
intent?: string;
|
|
260
285
|
/**
|
|
261
|
-
|
|
286
|
+
* @deprecated Internal namespace metadata. Public integrations should not depend on `appTag`.
|
|
287
|
+
* Removal target: v0.2.0.
|
|
262
288
|
*/
|
|
263
289
|
appTag?: string;
|
|
264
290
|
createdAt?: number;
|
|
265
291
|
expiresAt?: number;
|
|
266
292
|
state: string;
|
|
267
293
|
}
|
|
268
|
-
|
|
294
|
+
interface ScanningLoopOptions {
|
|
269
295
|
localDeviceId: string;
|
|
270
296
|
autoConnect?: boolean;
|
|
271
297
|
autoConnectDebounceMs?: number;
|
|
@@ -286,10 +312,10 @@ export interface ScanningLoopOptions {
|
|
|
286
312
|
}>;
|
|
287
313
|
onIncomingSessionAccepted?: (session: SignalingSession) => Promise<void> | void;
|
|
288
314
|
}
|
|
289
|
-
|
|
315
|
+
interface ScanningLoopHandle {
|
|
290
316
|
stop: () => void;
|
|
291
317
|
}
|
|
292
|
-
|
|
318
|
+
interface ConnectDeviceHooks {
|
|
293
319
|
getConnectionState?: (deviceId: string) => Promise<string | undefined> | string | undefined;
|
|
294
320
|
forceDisconnect?: (deviceId: string) => Promise<void>;
|
|
295
321
|
refreshState?: () => Promise<void>;
|
|
@@ -306,19 +332,19 @@ export interface ConnectDeviceHooks {
|
|
|
306
332
|
onConnected?: (device: Device) => Promise<void> | void;
|
|
307
333
|
onRetry?: (device: Device, attempt: number, delayMs: number) => void;
|
|
308
334
|
}
|
|
309
|
-
|
|
335
|
+
interface ConnectDeviceOptions {
|
|
310
336
|
localDeviceId: string;
|
|
311
337
|
targetUserId?: string;
|
|
312
338
|
maxRetries?: number;
|
|
313
339
|
initialBackoffMs?: number;
|
|
314
340
|
}
|
|
315
|
-
|
|
341
|
+
interface ConnectDeviceResult {
|
|
316
342
|
success: boolean;
|
|
317
343
|
skipped?: 'already-connecting' | 'missing-local-device-id';
|
|
318
344
|
error?: string;
|
|
319
345
|
attempts: number;
|
|
320
346
|
}
|
|
321
|
-
|
|
347
|
+
interface ManagedDeviceConnectOptions {
|
|
322
348
|
localDeviceId: string;
|
|
323
349
|
targetUserId?: string;
|
|
324
350
|
maxRetries?: number;
|
|
@@ -326,7 +352,7 @@ export interface ManagedDeviceConnectOptions {
|
|
|
326
352
|
onRetry?: (device: Device, attempt: number, delayMs: number) => void;
|
|
327
353
|
onConnected?: (device: Device) => void | Promise<void>;
|
|
328
354
|
}
|
|
329
|
-
|
|
355
|
+
interface DeviceStatusSnapshot extends Device {
|
|
330
356
|
connectionStatus: PeerLifecycleStatus | 'online';
|
|
331
357
|
settledReady?: boolean;
|
|
332
358
|
readinessState?: string;
|
|
@@ -339,8 +365,10 @@ export interface DeviceStatusSnapshot extends Device {
|
|
|
339
365
|
deviceIdHint?: string;
|
|
340
366
|
activeTransportStableId?: number | null;
|
|
341
367
|
transportGeneration?: number;
|
|
368
|
+
activeTransport?: ProtocolName;
|
|
369
|
+
parallelTransport?: ProtocolName | null;
|
|
342
370
|
}
|
|
343
|
-
|
|
371
|
+
interface ManagedConnectionRecord {
|
|
344
372
|
connectionId: string;
|
|
345
373
|
nodeId?: string | null;
|
|
346
374
|
deviceId?: string | null;
|
|
@@ -361,34 +389,13 @@ export interface ManagedConnectionRecord {
|
|
|
361
389
|
createdAtMs: number;
|
|
362
390
|
updatedAtMs: number;
|
|
363
391
|
}
|
|
364
|
-
|
|
365
|
-
export interface ManagedConnectionHealthSnapshot {
|
|
366
|
-
connectionId: string;
|
|
367
|
-
deviceId?: string | null;
|
|
368
|
-
deviceIdHint?: string | null;
|
|
369
|
-
nodeId?: string | null;
|
|
370
|
-
activeTransportStableId?: number | null;
|
|
371
|
-
transportGeneration: number;
|
|
372
|
-
status: ManagedConnectionHealthStatus;
|
|
373
|
-
settledReady?: boolean;
|
|
374
|
-
readinessState?: string;
|
|
375
|
-
replacementPending?: boolean;
|
|
376
|
-
lastLifecycleTransitionAtMs?: number;
|
|
377
|
-
readinessReason?: string;
|
|
378
|
-
transitionCount?: number;
|
|
379
|
-
connectingTransitionCount?: number;
|
|
380
|
-
replacementCount?: number;
|
|
381
|
-
retireCount?: number;
|
|
382
|
-
lastDisconnectReason?: string | null;
|
|
383
|
-
lastReconnectReason?: string | null;
|
|
384
|
-
}
|
|
385
|
-
export interface ResolvedPeerIdentity {
|
|
392
|
+
interface ResolvedPeerIdentity {
|
|
386
393
|
peerId?: string | null;
|
|
387
394
|
deviceId?: string | null;
|
|
388
395
|
deviceIdHint?: string | null;
|
|
389
396
|
nodeId?: string | null;
|
|
390
397
|
}
|
|
391
|
-
|
|
398
|
+
interface PeerSessionSnapshot {
|
|
392
399
|
peerId: string;
|
|
393
400
|
deviceId?: string | null;
|
|
394
401
|
deviceIdHint?: string | null;
|
|
@@ -401,6 +408,8 @@ export interface PeerSessionSnapshot {
|
|
|
401
408
|
readinessState?: string;
|
|
402
409
|
activeTransportStableId?: number | null;
|
|
403
410
|
transportGeneration?: number;
|
|
411
|
+
activeTransport?: ProtocolName;
|
|
412
|
+
parallelTransport?: ProtocolName | null;
|
|
404
413
|
replacementPending?: boolean;
|
|
405
414
|
lastLifecycleTransitionAtMs?: number;
|
|
406
415
|
readinessReason?: string;
|
|
@@ -414,7 +423,7 @@ export interface PeerSessionSnapshot {
|
|
|
414
423
|
lastSeenAtMs: number;
|
|
415
424
|
error?: string | null;
|
|
416
425
|
}
|
|
417
|
-
|
|
426
|
+
interface RuntimeBootstrapOptions {
|
|
418
427
|
platform: 'native' | 'web';
|
|
419
428
|
initializeWeb?: () => Promise<void>;
|
|
420
429
|
isNativeReady?: () => Promise<boolean>;
|
|
@@ -427,18 +436,18 @@ export interface RuntimeBootstrapOptions {
|
|
|
427
436
|
nativeInitEventTimeoutMs?: number;
|
|
428
437
|
initializeClient?: boolean;
|
|
429
438
|
}
|
|
430
|
-
|
|
439
|
+
interface RuntimeBootstrapResult {
|
|
431
440
|
ready: boolean;
|
|
432
441
|
mode: 'native' | 'web';
|
|
433
442
|
}
|
|
434
|
-
|
|
443
|
+
interface RuntimeIdentity {
|
|
435
444
|
id: string;
|
|
436
445
|
email?: string | null;
|
|
437
446
|
displayName?: string | null;
|
|
438
447
|
isAnonymous?: boolean;
|
|
439
448
|
getToken?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
440
449
|
}
|
|
441
|
-
|
|
450
|
+
type DeviceEvent = {
|
|
442
451
|
type: 'added';
|
|
443
452
|
device: Device;
|
|
444
453
|
} | {
|
|
@@ -448,7 +457,7 @@ export type DeviceEvent = {
|
|
|
448
457
|
type: 'removed';
|
|
449
458
|
deviceId: string;
|
|
450
459
|
};
|
|
451
|
-
|
|
460
|
+
type SessionEvent = {
|
|
452
461
|
type: 'added';
|
|
453
462
|
session: SignalingSession;
|
|
454
463
|
} | {
|
|
@@ -458,7 +467,7 @@ export type SessionEvent = {
|
|
|
458
467
|
type: 'removed';
|
|
459
468
|
sessionId: string;
|
|
460
469
|
};
|
|
461
|
-
|
|
470
|
+
interface ExplicitFileDataSendParams {
|
|
462
471
|
connectionId?: string;
|
|
463
472
|
connection?: {
|
|
464
473
|
send: (message: unknown) => Promise<void>;
|
|
@@ -470,7 +479,7 @@ export interface ExplicitFileDataSendParams {
|
|
|
470
479
|
transferId: string;
|
|
471
480
|
channelId?: string;
|
|
472
481
|
}
|
|
473
|
-
|
|
482
|
+
interface ISignalingBackend {
|
|
474
483
|
currentUser: RuntimeIdentity | null;
|
|
475
484
|
signInAnonymously(): Promise<void>;
|
|
476
485
|
signInWithPluto?(): Promise<void>;
|
|
@@ -512,6 +521,17 @@ export interface ISignalingBackend {
|
|
|
512
521
|
getLocalDeviceId?(): Promise<string | null>;
|
|
513
522
|
getLocalDeviceInfo?(): Promise<LocalDeviceInfo | null>;
|
|
514
523
|
updateLocalDeviceName?(deviceName: string): Promise<LocalDeviceInfo | null>;
|
|
524
|
+
startManagedSessionNative?(options: {
|
|
525
|
+
userId: string;
|
|
526
|
+
deviceName?: string;
|
|
527
|
+
localDeviceId?: string | null;
|
|
528
|
+
metadata?: string;
|
|
529
|
+
autoConnect?: boolean;
|
|
530
|
+
presence?: boolean;
|
|
531
|
+
}): Promise<NativeManagedSessionStartResult>;
|
|
532
|
+
reconcileNativeManagedSession?(options?: {
|
|
533
|
+
reason?: string;
|
|
534
|
+
}): Promise<unknown>;
|
|
515
535
|
getManagedNodeId?(options?: {
|
|
516
536
|
initializeIfMissing?: boolean;
|
|
517
537
|
}): Promise<string | null>;
|
|
@@ -522,6 +542,14 @@ export interface ISignalingBackend {
|
|
|
522
542
|
deviceId?: string | null;
|
|
523
543
|
endpointTicket: string;
|
|
524
544
|
}): Promise<NativeConnectResult>;
|
|
545
|
+
/**
|
|
546
|
+
* Optional backchannel so a backend (e.g. WasmBridge) can access the core
|
|
547
|
+
* Client after Client.setSignalingBackend() has been called. This lets the
|
|
548
|
+
* backend trigger Client.connect() for peers it dials directly (e.g. via
|
|
549
|
+
* the WASM auto-connect path) so the TS Connection/upgrade state machine
|
|
550
|
+
* stays in lockstep with the Rust transport.
|
|
551
|
+
*/
|
|
552
|
+
setCoreClient?(client: unknown): void;
|
|
525
553
|
disconnectDevice?(deviceId: string): Promise<void>;
|
|
526
554
|
setAutoConnectExcluded?(deviceId: string, excluded: boolean): Promise<void>;
|
|
527
555
|
isConnected(nodeId: string): Promise<boolean>;
|
|
@@ -532,7 +560,7 @@ export interface ISignalingBackend {
|
|
|
532
560
|
getTransferHistory?(limit?: number): Promise<Array<[string, unknown]>>;
|
|
533
561
|
deleteTransferJob?(jobId: string): Promise<void>;
|
|
534
562
|
}
|
|
535
|
-
|
|
563
|
+
interface SignalingOptions {
|
|
536
564
|
apiKey?: string;
|
|
537
565
|
allowAnonymousHostedDefaults?: boolean;
|
|
538
566
|
authMode?: AuthMode;
|
|
@@ -540,20 +568,172 @@ export interface SignalingOptions {
|
|
|
540
568
|
storagePrefix?: string;
|
|
541
569
|
nodeIdPersistence?: 'persistent' | 'ephemeral';
|
|
542
570
|
}
|
|
543
|
-
|
|
571
|
+
interface TransportContext {
|
|
544
572
|
sendMoQ: (data: Uint8Array) => Promise<void>;
|
|
545
573
|
priorities: ProtocolName[];
|
|
546
574
|
disableIrohFallback: boolean;
|
|
547
575
|
isMoQReady: () => boolean;
|
|
576
|
+
runtimeFlow?: 'default' | 'ticket-only';
|
|
577
|
+
readerCloseStrategy?: 'cancel' | 'release-lock';
|
|
548
578
|
}
|
|
549
|
-
|
|
579
|
+
interface ConnectionOptions {
|
|
550
580
|
reliable?: boolean;
|
|
551
581
|
rtcConfig?: RTCConfiguration;
|
|
552
582
|
transportContext?: TransportContext;
|
|
583
|
+
onTransportStatusChange?: (status: {
|
|
584
|
+
activeTransport: ProtocolName;
|
|
585
|
+
parallelTransport?: ProtocolName | null;
|
|
586
|
+
}) => void;
|
|
553
587
|
}
|
|
554
|
-
|
|
588
|
+
interface JoinRequest {
|
|
555
589
|
id: string;
|
|
556
590
|
userId: string;
|
|
557
591
|
ticket: string;
|
|
558
592
|
state: 'pending' | 'accepted' | 'rejected';
|
|
559
593
|
}
|
|
594
|
+
|
|
595
|
+
type AuthContext = {
|
|
596
|
+
userId: string;
|
|
597
|
+
token?: string | null;
|
|
598
|
+
refreshToken?: string | null;
|
|
599
|
+
customToken?: string | null;
|
|
600
|
+
tokenProvider?: (forceRefresh?: boolean) => Promise<string | null>;
|
|
601
|
+
expiresAtMs?: number | null;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
type RuntimeAdapterKind = 'browser-wasm' | 'native-ipc' | 'tauri-ipc' | 'unknown';
|
|
605
|
+
interface RuntimeCapabilities {
|
|
606
|
+
adapter: RuntimeAdapterKind;
|
|
607
|
+
signaling: {
|
|
608
|
+
firestore: boolean;
|
|
609
|
+
nativeIpc: boolean;
|
|
610
|
+
rtdbPresence: boolean;
|
|
611
|
+
};
|
|
612
|
+
transport: {
|
|
613
|
+
irohQuic: boolean;
|
|
614
|
+
webRtcUpgrade: boolean;
|
|
615
|
+
nativeWebRtc: boolean;
|
|
616
|
+
wasm: boolean;
|
|
617
|
+
};
|
|
618
|
+
lifecycle: {
|
|
619
|
+
managedSession: boolean;
|
|
620
|
+
autoConnect: boolean;
|
|
621
|
+
manualDisconnect: boolean;
|
|
622
|
+
connectionStateEvents: boolean;
|
|
623
|
+
peerSessions: boolean;
|
|
624
|
+
};
|
|
625
|
+
transfers: {
|
|
626
|
+
explicitFilePath: boolean;
|
|
627
|
+
explicitFileData: boolean;
|
|
628
|
+
history: boolean;
|
|
629
|
+
};
|
|
630
|
+
fallback: {
|
|
631
|
+
wasm: boolean;
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
declare const BROWSER_WASM_RUNTIME_CAPABILITIES: RuntimeCapabilities;
|
|
635
|
+
declare const NATIVE_IPC_RUNTIME_CAPABILITIES: RuntimeCapabilities;
|
|
636
|
+
declare function cloneRuntimeCapabilities(capabilities: RuntimeCapabilities): RuntimeCapabilities;
|
|
637
|
+
|
|
638
|
+
interface WasmBridgeOptions {
|
|
639
|
+
apiKey?: string;
|
|
640
|
+
discoveryMode?: DiscoveryMode;
|
|
641
|
+
spaceKey?: string;
|
|
642
|
+
authMode?: AuthMode;
|
|
643
|
+
signalingMode?: SignalingMode;
|
|
644
|
+
projectId?: string;
|
|
645
|
+
storagePrefix?: string;
|
|
646
|
+
nodeIdPersistence?: 'persistent' | 'ephemeral';
|
|
647
|
+
deviceName?: string;
|
|
648
|
+
turnCredentialsProvider?: () => Promise<{
|
|
649
|
+
iceServers?: RTCIceServer[];
|
|
650
|
+
} | null | undefined>;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
|
|
654
|
+
protected readonly backend: ISignalingBackend;
|
|
655
|
+
protected constructor(backend: ISignalingBackend);
|
|
656
|
+
get currentUser(): RuntimeIdentity | null;
|
|
657
|
+
setAuthContext(context: AuthContext | null): Promise<void> | void;
|
|
658
|
+
signInAnonymously(): Promise<void>;
|
|
659
|
+
signInWithPluto(): Promise<void>;
|
|
660
|
+
signOut(): Promise<void>;
|
|
661
|
+
stopAuthScopedActivity(): Promise<void>;
|
|
662
|
+
getTurnCredentials(): Promise<any>;
|
|
663
|
+
updatePresence(localNodeId: string, ticketStr: string, isOnline: boolean, ttlMs: number, metadata?: string): Promise<void>;
|
|
664
|
+
setOffline(localNodeId: string): Promise<void>;
|
|
665
|
+
cleanupStaleDevices(): Promise<void>;
|
|
666
|
+
searchDevices(excludeNodeId?: string): Promise<Device[]>;
|
|
667
|
+
listDevicesWithStatus(): Promise<DeviceStatusSnapshot[]>;
|
|
668
|
+
getPeerSession(id: string): Promise<PeerSessionSnapshot | null>;
|
|
669
|
+
listPeerSessions(): Promise<PeerSessionSnapshot[]>;
|
|
670
|
+
waitForSettledPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
671
|
+
resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
|
|
672
|
+
resolvePeerConnectionRecords(id: string): Promise<ManagedConnectionRecord[]>;
|
|
673
|
+
updateDevice(deviceId: string, updates: {
|
|
674
|
+
deviceName?: string;
|
|
675
|
+
capabilities?: Device['capabilities'];
|
|
676
|
+
metadata?: string;
|
|
677
|
+
}): Promise<void>;
|
|
678
|
+
deleteDevice(deviceId: string): Promise<void>;
|
|
679
|
+
onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
|
|
680
|
+
onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
|
|
681
|
+
checkForSSOToken(): Promise<void>;
|
|
682
|
+
waitForAuth(): Promise<void>;
|
|
683
|
+
sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
|
|
684
|
+
pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
|
|
685
|
+
subscribeDevices(userId: string): Promise<ReadableStream<DeviceEvent[]>>;
|
|
686
|
+
startAutoConnect(userId: string, localDeviceId: string): void;
|
|
687
|
+
startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
|
|
688
|
+
createSession(session: SignalingSession): Promise<void>;
|
|
689
|
+
updateSession(sessionId: string, updateData: any): Promise<void>;
|
|
690
|
+
subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
|
|
691
|
+
forceReconnectSnapshot(): void;
|
|
692
|
+
getLocalDeviceId(): Promise<string | null>;
|
|
693
|
+
getLocalDeviceInfo(): Promise<LocalDeviceInfo | null>;
|
|
694
|
+
updateLocalDeviceName(deviceName: string): Promise<LocalDeviceInfo | null>;
|
|
695
|
+
startManagedSessionNative(options: {
|
|
696
|
+
userId: string;
|
|
697
|
+
deviceName?: string;
|
|
698
|
+
localDeviceId?: string | null;
|
|
699
|
+
metadata?: string;
|
|
700
|
+
autoConnect?: boolean;
|
|
701
|
+
presence?: boolean;
|
|
702
|
+
}): Promise<NativeManagedSessionStartResult>;
|
|
703
|
+
getManagedNodeId(options?: {
|
|
704
|
+
initializeIfMissing?: boolean;
|
|
705
|
+
}): Promise<string | null>;
|
|
706
|
+
startPresenceLoopOnce(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
|
|
707
|
+
startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
|
|
708
|
+
getEndpointTicket(): Promise<string>;
|
|
709
|
+
getEndpointTicketWithToken(scope: GrantScope, maxConnections: number): Promise<string | null>;
|
|
710
|
+
registerSessionToken(token: string, scope: GrantScope, maxConnections: number): Promise<void>;
|
|
711
|
+
revokeSessionTokensByScope(scope: GrantScope): Promise<string[]>;
|
|
712
|
+
openPeerBi(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
713
|
+
openPeerBiTransportOnly(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
|
|
714
|
+
openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
|
|
715
|
+
connectToDevice(params: {
|
|
716
|
+
deviceId?: string | null;
|
|
717
|
+
endpointTicket: string;
|
|
718
|
+
}): Promise<NativeConnectResult>;
|
|
719
|
+
disconnectDevice(deviceId: string): Promise<void>;
|
|
720
|
+
isConnected(nodeId: string): Promise<boolean>;
|
|
721
|
+
getConnectionStates(): Promise<BackendConnectionState[]>;
|
|
722
|
+
onConnectionStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
|
|
723
|
+
sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
|
|
724
|
+
sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
|
|
725
|
+
getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
|
|
726
|
+
deleteTransferJob(jobId: string): Promise<void>;
|
|
727
|
+
getRuntimeCapabilities(): RuntimeCapabilities;
|
|
728
|
+
onIncomingNativeMessage(callback: (connectionId: string, remoteNodeId: string | null, message: any) => void): Promise<() => void>;
|
|
729
|
+
unwrap(): ISignalingBackend;
|
|
730
|
+
/**
|
|
731
|
+
* Forward setCoreClient() to the inner backend if it implements it. This
|
|
732
|
+
* lets the core Client inject a reference into backends (e.g. WasmBridge)
|
|
733
|
+
* that need to escalate transport-level dials into full Client.connect()
|
|
734
|
+
* handshakes.
|
|
735
|
+
*/
|
|
736
|
+
setCoreClient(client: unknown): void;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export { type AuthContext as A, type BackendConnectionState as B, type ConnectDeviceResult as C, DelegatingRuntimeAdapter as D, type ExplicitFileDataSendParams as E, type RoomCreationMode as F, type GrantScope as G, type ScanningLoopOptions as H, type IncomingStreamChannelMetadata as I, type JoinRoomOptions as J, type ScanningLoopHandle as K, type LocalDeviceInfo as L, type ManagedDeviceConnectOptions as M, type NativeConnectResult as N, type RuntimeBootstrapOptions as O, type PeerSessionSnapshot as P, type RuntimeBootstrapResult as Q, type ResolvedPeerIdentity as R, type SignalingMode as S, type JoinRequest as T, BROWSER_WASM_RUNTIME_CAPABILITIES as U, NATIVE_IPC_RUNTIME_CAPABILITIES as V, type WasmBridgeOptions as W, cloneRuntimeCapabilities as X, type ConnectDeviceHooks as a, type ConnectDeviceOptions as b, type RuntimeCapabilities as c, type AppLimits as d, type AuthMode as e, type DiscoveryMode as f, type ProtocolCapability as g, type ProtocolCapabilityMap as h, type ProtocolName as i, type RuntimeAdapterKind as j, type ClientOptions as k, type ChannelDescriptor as l, type Device as m, type SignalingSession as n, type RuntimeIdentity as o, type DeviceStatusSnapshot as p, type PeerState as q, type PeerHealth as r, type RoomMember as s, type PeerScope as t, type PeerLifecycleStatus as u, type ConnectionOptions as v, type ISignalingBackend as w, type ManagedConnectionRecord as x, type SignalingOptions as y, type SignalingEnvelope as z };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { W as WasmBridgeOptions, k as ClientOptions, D as DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter-CW8d78dZ.js';
|
|
2
|
+
|
|
3
|
+
type PlutoIpcUnlisten = () => void | Promise<void>;
|
|
4
|
+
interface PlutoIpcBridge {
|
|
5
|
+
invoke<T = unknown>(command: string, args?: Record<string, unknown>): Promise<T>;
|
|
6
|
+
listen<T = unknown>(event: string, handler: (payload: T) => void): Promise<PlutoIpcUnlisten>;
|
|
7
|
+
isAvailable?(): boolean | Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface NativeIpcBridgeOptions extends WasmBridgeOptions {
|
|
11
|
+
allowWasmFallback?: boolean;
|
|
12
|
+
ipcBridge?: PlutoIpcBridge;
|
|
13
|
+
transports?: ClientOptions['transports'];
|
|
14
|
+
strictMode?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface IpcRuntimeAdapterOptions extends NativeIpcBridgeOptions {
|
|
18
|
+
bridge: PlutoIpcBridge;
|
|
19
|
+
}
|
|
20
|
+
declare class IpcRuntimeAdapter extends DelegatingRuntimeAdapter {
|
|
21
|
+
constructor(options: IpcRuntimeAdapterOptions);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { IpcRuntimeAdapter as I, type NativeIpcBridgeOptions as N, type PlutoIpcBridge as P, type IpcRuntimeAdapterOptions as a, type PlutoIpcUnlisten as b };
|