openrtc 2.0.0-rc.28 → 2.0.0-rc.29
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 -7
- package/dist/DelegatingRuntimeAdapter-BFZDC604.d.ts +397 -0
- package/dist/{types-BwmoJU2O.d.ts → ITransport-WV6gGMnX.d.ts} +40 -3
- package/dist/IpcRuntimeAdapter-CJq3dRBF.d.ts +19 -0
- package/dist/OpenRTCShared.d.ts +250 -0
- package/dist/OpenRTCShared.js +1 -0
- package/dist/WasmBridge-5GYKXPXK.js +1 -0
- package/dist/{types-DF9pz2CH.d.ts → assembly-q0jRRpsc.d.ts} +38 -505
- package/dist/{capabilities-YSskrE8H.d.ts → capabilities-BfZi4Cd7.d.ts} +4 -0
- package/dist/chunk-45WBH7E3.js +1 -0
- package/dist/chunk-AG2F6MOB.js +1 -0
- package/dist/{chunk-HVYXEY7F.js → chunk-D2OJN5S5.js} +1 -1
- package/dist/chunk-DUY34MGT.js +1 -0
- package/dist/chunk-H5R5ZXXN.js +3 -0
- package/dist/chunk-KJTJLLJE.js +2 -0
- package/dist/{chunk-RRMBD5OL.js → chunk-LRT5GEGH.js} +2 -2
- package/dist/chunk-NRXEG5GQ.js +1 -0
- package/dist/chunk-OEVPKC3W.js +1 -0
- package/dist/chunk-VOCOZ57Q.js +2 -0
- package/dist/{chunk-VQQOB6TG.js → chunk-Z6TZLF4B.js} +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1 -1
- package/dist/ipc-CflAVodw.d.ts +11 -0
- package/dist/ipcFactory-B6HBECSU.js +1 -0
- package/dist/native.d.ts +9 -7
- package/dist/native.js +1 -1
- package/dist/openrtc-WUVUMBQY.js +2 -0
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -4
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/device-status.d.ts +2 -4
- package/dist/runtime/factories.d.ts +21 -0
- package/dist/runtime/factories.js +1 -0
- package/dist/runtime/index.d.ts +29 -25
- package/dist/runtime/index.js +1 -1
- package/dist/testing.d.ts +7 -6
- package/dist/testing.js +1 -1
- package/dist/transport/index.d.ts +2 -3
- package/dist/transport/index.js +1 -1
- package/dist/{types-oGGnaSW2.d.ts → types-DVNSd5B9.d.ts} +71 -4
- package/dist/types-Di034GVQ.d.ts +291 -0
- package/package.json +3 -3
- package/dist/DelegatingRuntimeAdapter-7Y3gss5D.d.ts +0 -134
- package/dist/IEngineBridge-BbsT8hof.d.ts +0 -17
- package/dist/ITransport-BsPcaov7.d.ts +0 -16
- package/dist/OpenRTCShared-LDKG5RPN.js +0 -1
- package/dist/WasmBridge-RQ6AZQTW.js +0 -1
- package/dist/chunk-655QSPCO.js +0 -1
- package/dist/chunk-C7YN5MSV.js +0 -1
- package/dist/chunk-JWWXL6EG.js +0 -3
- package/dist/chunk-PQK5SJ47.js +0 -1
- package/dist/chunk-QHSM5NFZ.js +0 -2
- package/dist/chunk-VXMQ3AWK.js +0 -2
- package/dist/factories-4M5GFWQG.js +0 -1
- package/dist/ipcFactory-BR2DJZCR.js +0 -1
- package/dist/openrtc-Y2CJR6DS.js +0 -2
- /package/dist/{controlPlane-HW224SPX.js → controlPlane-P66ZTVNW.js} +0 -0
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
|
|
|
@@ -85,11 +83,7 @@ grant issuance and refresh, revocation, budgets, metering, and abuse controls.
|
|
|
85
83
|
Rooms default to ephemeral membership:
|
|
86
84
|
|
|
87
85
|
```ts
|
|
88
|
-
const room = await rtc.rooms.join('match-123'
|
|
89
|
-
access: 'capability',
|
|
90
|
-
membership: 'ephemeral',
|
|
91
|
-
maxPeers: 8,
|
|
92
|
-
});
|
|
86
|
+
const room = await rtc.rooms.join('match-123');
|
|
93
87
|
```
|
|
94
88
|
|
|
95
89
|
Durable membership is an advanced capability and must be enabled in the
|
|
@@ -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`.
|
|
@@ -341,6 +347,12 @@ interface ClientOptions {
|
|
|
341
347
|
webrtc?: boolean | PlutoRTCConfiguration;
|
|
342
348
|
ble?: boolean | PlutoBleConfiguration;
|
|
343
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[];
|
|
344
356
|
};
|
|
345
357
|
transportPriority?: ProtocolName[];
|
|
346
358
|
/** Subscribe to native LAN peer discovery events. */
|
|
@@ -423,6 +435,10 @@ interface PeerState {
|
|
|
423
435
|
admissionState?: PeerAdmissionState;
|
|
424
436
|
transportState?: string;
|
|
425
437
|
protocolState?: string;
|
|
438
|
+
/** Compatibility projection of the canonical `routable` readiness facet. */
|
|
439
|
+
settledReady?: boolean;
|
|
440
|
+
readinessState?: string;
|
|
441
|
+
readinessReason?: string;
|
|
426
442
|
webrtcState?: PeerWebRtcState;
|
|
427
443
|
routable?: boolean;
|
|
428
444
|
activeTransportStableId?: number | null;
|
|
@@ -673,6 +689,8 @@ interface TransportLatencySnapshot {
|
|
|
673
689
|
iroh?: number | null;
|
|
674
690
|
irohLan?: number | null;
|
|
675
691
|
irohRelay?: number | null;
|
|
692
|
+
irohWebrtc?: number | null;
|
|
693
|
+
irohMoq?: number | null;
|
|
676
694
|
ble?: number | null;
|
|
677
695
|
moq?: number | null;
|
|
678
696
|
}
|
|
@@ -825,6 +843,10 @@ interface ISignalingBackend {
|
|
|
825
843
|
signInWithPluto?(): Promise<void>;
|
|
826
844
|
signOut(): Promise<void>;
|
|
827
845
|
stopAuthScopedActivity?(): Promise<void>;
|
|
846
|
+
setCoordinationHostAvailability?(input: {
|
|
847
|
+
available: boolean;
|
|
848
|
+
reason: string;
|
|
849
|
+
}): void;
|
|
828
850
|
usesCoordinationGateway?(): boolean;
|
|
829
851
|
joinCoordinationRoom?(roomId: string, nodeId: string, ticket: string): Promise<void>;
|
|
830
852
|
leaveCoordinationRoom?(roomId: string): Promise<void>;
|
|
@@ -1082,4 +1104,19 @@ interface JoinRequest {
|
|
|
1082
1104
|
state: 'pending' | 'accepted' | 'rejected';
|
|
1083
1105
|
}
|
|
1084
1106
|
|
|
1085
|
-
|
|
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 };
|