openrtc 0.2.0 → 1.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.
- package/LICENSE +92 -0
- package/README.md +100 -10
- package/dist/{DelegatingRuntimeAdapter-CjHzBEBA.d.ts → DelegatingRuntimeAdapter-By7pziBs.d.ts} +36 -15
- package/dist/IEngineBridge-C7OT2CRv.d.ts +10 -0
- package/dist/{IpcRuntimeAdapter-CtckyMol.d.ts → IpcRuntimeAdapter-DymXAsNU.d.ts} +6 -3
- package/dist/auth/index.js +1 -1
- package/dist/auth/internal.js +1 -1
- package/dist/chunk-3KDNLXT6.js +3 -0
- package/dist/chunk-5RXNKNPH.js +2 -0
- package/dist/chunk-6TIOSMVJ.js +1 -0
- package/dist/chunk-BLOEZIFJ.js +1 -0
- package/dist/chunk-CK6WQV7J.js +1 -0
- package/dist/chunk-KH227SE4.js +1 -0
- package/dist/chunk-KYDLXXNM.js +1 -0
- package/dist/chunk-W5JHUOK5.js +2 -0
- package/dist/device-status-nkXepu97.d.ts +560 -0
- package/dist/{factories-CwZiIRg1.d.ts → framing-BUtu0oZK.d.ts} +47 -520
- package/dist/index.d.ts +113 -9
- package/dist/index.js +2 -2
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +3 -2
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/device-status.d.ts +3 -0
- package/dist/runtime/device-status.js +1 -0
- package/dist/runtime/index.d.ts +94 -84
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/tauri.d.ts +4 -3
- package/dist/runtime/tauri.js +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/{types-DyCGvj9l.d.ts → types-CzIpGV9x.d.ts} +117 -14
- package/package.json +22 -10
- package/dist/chunk-3VTF5RKW.js +0 -1
- package/dist/chunk-JXGKO7SX.js +0 -1
- package/dist/chunk-MFT6SOZ6.js +0 -3
- package/dist/chunk-SGZWR63E.js +0 -1
- package/dist/chunk-VARALO7G.js +0 -1
- package/dist/chunk-WOHFM6DI.js +0 -2
- package/dist/chunk-YHJOXD46.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,44 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { R as RuntimeClient, a as RuntimePolicySnapshot, P as PeerReconciliationStats, b as PlutoRuntimeAssembly } from './framing-BUtu0oZK.js';
|
|
2
|
+
export { O as OPENRTC_RUNTIME_POLICY, c as RuntimeJsonFrameHandler, d as RuntimeU32BEFrameHandler, S as ScopedSession, e as Session, f as SessionOptions, g as createRuntimeJsonFrameDecoder, h as createRuntimeU32BEFrameDecoder, i as decodeRuntimeJsonPayload, j as encodeRuntimeJsonFrame, k as encodeRuntimeJsonPayload, l as encodeRuntimeU32BEFrame, m as getRuntimePolicy } from './framing-BUtu0oZK.js';
|
|
3
|
+
import { l as ConnectDeviceResult, m as ConnectDeviceHooks, n as ConnectDeviceOptions, P as PeerSessionSnapshot, c as ResolvedPeerIdentity, G as GrantScope, o as ProtocolName, p as ProtocolCapability, q as ProtocolCapabilityMap, r as ApplicationPayloadCrypto, s as ApplicationCryptoStreamTools, t as SpaceTokenProvider } from './types-CzIpGV9x.js';
|
|
4
|
+
export { u as AppLimits, v as ApplicationCryptoBiStream, w as ApplicationPayloadReadinessOptions, x as ApplicationPayloadRouteOptions, y as ApplicationPayloadSendOptions, A as AuthMode, z as DevicePresenceStatus, D as DiscoveryMode, F as ProtocolBaseName, H as ProtocolImplementationKind, J as ProtocolLocality, S as SignalingMode, K as SpaceAuthMode } from './types-CzIpGV9x.js';
|
|
5
|
+
import { A as AuthContext } from './IEngineBridge-C7OT2CRv.js';
|
|
6
|
+
import { R as RuntimeClientOptions, a as RuntimeManagedSessionOptions, b as RuntimeManagedSession, c as RuntimeDevice, d as RuntimeDeviceStatusSnapshot, e as RuntimeDeviceConnectOptions, f as RuntimeLocalDeviceInfo, g as RuntimeLocalDeviceProfile, h as RuntimePeerState, i as RuntimePeerConnectOptions, C as Connection, j as RuntimePeerReadinessSnapshot, k as RuntimePeerHealth, l as RuntimeChannelDescriptor, m as RuntimePeerStreamOptions, n as RuntimeIncomingStream, o as RuntimeScopedChannelOptions, p as RuntimeScopedLogicalChannel, q as RuntimeJoinRoomOptions, r as RuntimeRoomMember, s as RuntimeConnectionStateSnapshot, t as RuntimeApplicationPayloadReadinessOptions, u as RuntimeConnectionEvent, v as RuntimeRawConnection, I as ITransport } from './device-status-nkXepu97.js';
|
|
7
|
+
export { w as ChannelDescriptor, x as ConnectionEvent, y as ConnectionTarget, D as DeviceProfile, z as IncomingStream, P as PeerConnectOptions, A as PeerReadiness, B as PeerStreamOptions, E as PresenceLoopOptions, F as RawConnection, G as RuntimeAuthContext, H as RuntimeAuthIdentity, J as RuntimeAutoConnectPolicy, K as RuntimeConnectionTarget, L as RuntimeDevicePresenceStatus, M as RuntimeDeviceStatus, N as RuntimeLogicalChannelFraming, O as RuntimeManagedSessionKind, Q as RuntimeManagedSessionPlatform, S as RuntimePeerLifecycleStatus, T as RuntimePeerScope, U as RuntimePeerSessionSnapshot, V as RuntimePresenceLoopOptions, W as RuntimePresencePolicy, X as RuntimeSession, Y as RuntimeUiConnectionStatus, Z as ScopedChannelOptions, _ as ScopedLogicalChannel, $ as isRuntimeDeviceActive, a0 as isRuntimeDeviceConnectable, a1 as isRuntimeDeviceRoutable } from './device-status-nkXepu97.js';
|
|
8
|
+
import { P as PlutoIpcBridge } from './IpcRuntimeAdapter-DymXAsNU.js';
|
|
9
|
+
import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile } from './DelegatingRuntimeAdapter-By7pziBs.js';
|
|
10
|
+
export { b as RuntimeAdapterKind } from './DelegatingRuntimeAdapter-By7pziBs.js';
|
|
8
11
|
export { TRANSPORT_LABELS, isDirectIrohTransportLabel, isIndependentTransportLabel, isIrohBaseTransportLabel, isOptionalTransportLabel, isWebRtcTransportLabel, normalizeTransportLabel } from './transport/index.js';
|
|
9
12
|
import './runtime/WasmRuntimeAdapter.js';
|
|
10
13
|
|
|
14
|
+
type OpenRTCChannelConnectOptions = Omit<RuntimeScopedChannelOptions, 'scope' | 'deviceId' | 'ticket'> & {
|
|
15
|
+
/**
|
|
16
|
+
* Device selected from `client.devices.*`. Passing the device object lets
|
|
17
|
+
* OpenRTC reuse its current ticket for native and ticket-gated routes.
|
|
18
|
+
*/
|
|
19
|
+
device?: string | RuntimeDevice;
|
|
20
|
+
deviceId?: string | null;
|
|
21
|
+
ticket?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Logical channel lifecycle scope. Most app channels should use the default
|
|
24
|
+
* `session`; pass a custom scope only when you intentionally manage peer
|
|
25
|
+
* lifecycle separately from the channel.
|
|
26
|
+
*/
|
|
27
|
+
scope?: RuntimeScopedChannelOptions['scope'];
|
|
28
|
+
};
|
|
29
|
+
type OpenRTCDeviceSessionOptions = Omit<RuntimeManagedSessionOptions, 'platform'> & {
|
|
30
|
+
/**
|
|
31
|
+
* Runtime host for the managed user-device session. Normal apps can omit
|
|
32
|
+
* this: `OpenRTC(...)` defaults to `web`, and `OpenRTC.native(...)` defaults
|
|
33
|
+
* to `native`.
|
|
34
|
+
*/
|
|
35
|
+
platform?: RuntimeManagedSessionOptions['platform'];
|
|
36
|
+
};
|
|
11
37
|
interface OpenRTCDeviceNamespace {
|
|
38
|
+
startSession(options?: OpenRTCDeviceSessionOptions): Promise<RuntimeManagedSession>;
|
|
39
|
+
stopSession(options?: {
|
|
40
|
+
preserveBackendSession?: boolean;
|
|
41
|
+
}): Promise<void>;
|
|
12
42
|
list(): Promise<RuntimeDevice[]>;
|
|
13
43
|
listWithStatus(): Promise<RuntimeDeviceStatusSnapshot[]>;
|
|
14
44
|
watch(callback: (devices: RuntimeDevice[]) => void): () => void;
|
|
@@ -68,8 +98,26 @@ interface OpenRTCChannelNamespace {
|
|
|
68
98
|
onIncomingChannel(channelId: string, callback: (stream: RuntimeIncomingStream & {
|
|
69
99
|
channel: NonNullable<RuntimeIncomingStream['channel']>;
|
|
70
100
|
}) => boolean | void): () => void;
|
|
101
|
+
connect(options: OpenRTCChannelConnectOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
71
102
|
connectScoped(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
72
103
|
}
|
|
104
|
+
interface OpenRTCRoomNamespace {
|
|
105
|
+
create(roomId?: string): Promise<string>;
|
|
106
|
+
join(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
107
|
+
leave(roomId: string): Promise<void>;
|
|
108
|
+
watch(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
109
|
+
members(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
110
|
+
}
|
|
111
|
+
interface OpenRTCTicketNamespace {
|
|
112
|
+
raw(): Promise<string>;
|
|
113
|
+
share(options?: {
|
|
114
|
+
maxConnections?: number;
|
|
115
|
+
}): Promise<string>;
|
|
116
|
+
grant(scope: GrantScope, options?: {
|
|
117
|
+
maxConnections?: number;
|
|
118
|
+
}): Promise<string>;
|
|
119
|
+
revoke(scope: GrantScope): Promise<string[]>;
|
|
120
|
+
}
|
|
73
121
|
interface OpenRTCDiagnosticsNamespace {
|
|
74
122
|
status(): Promise<{
|
|
75
123
|
runtime: 'tauri' | 'browser' | 'unknown';
|
|
@@ -108,6 +156,7 @@ interface OpenRTCAdvancedNamespace {
|
|
|
108
156
|
isConnected(nodeId: string): Promise<boolean>;
|
|
109
157
|
disconnectNode(nodeId: string): Promise<void>;
|
|
110
158
|
setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
|
|
159
|
+
notifyNetworkChange(reason?: string): Promise<void>;
|
|
111
160
|
}
|
|
112
161
|
/**
|
|
113
162
|
* OpenRTCClient extends RuntimeClient with auth helpers that were
|
|
@@ -119,6 +168,8 @@ interface OpenRTCClient extends RuntimeClient {
|
|
|
119
168
|
readonly devices: OpenRTCDeviceNamespace;
|
|
120
169
|
readonly peers: OpenRTCPeerNamespace;
|
|
121
170
|
readonly channels: OpenRTCChannelNamespace;
|
|
171
|
+
readonly rooms: OpenRTCRoomNamespace;
|
|
172
|
+
readonly tickets: OpenRTCTicketNamespace;
|
|
122
173
|
readonly diagnostics: OpenRTCDiagnosticsNamespace;
|
|
123
174
|
readonly advanced: OpenRTCAdvancedNamespace;
|
|
124
175
|
/** @deprecated Use setAuth() instead */
|
|
@@ -136,6 +187,56 @@ interface OpenRTCClient extends RuntimeClient {
|
|
|
136
187
|
signIn(): Promise<void>;
|
|
137
188
|
/** Sign out and clear auth context */
|
|
138
189
|
signOut(): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* @deprecated Use `client.devices.startSession(...)` for the public
|
|
192
|
+
* user-device avenue lifecycle. This top-level method remains for
|
|
193
|
+
* RuntimeClient compatibility and advanced integrations.
|
|
194
|
+
*/
|
|
195
|
+
startManagedSession(options: RuntimeManagedSessionOptions): Promise<RuntimeManagedSession>;
|
|
196
|
+
/**
|
|
197
|
+
* @deprecated Use `client.devices.stopSession(...)` for the public
|
|
198
|
+
* user-device avenue lifecycle.
|
|
199
|
+
*/
|
|
200
|
+
stopManagedSession(options?: {
|
|
201
|
+
preserveBackendSession?: boolean;
|
|
202
|
+
}): Promise<void>;
|
|
203
|
+
/** @deprecated Use `client.rooms.create(...)`. */
|
|
204
|
+
createRoom(roomId?: string): Promise<string>;
|
|
205
|
+
/** @deprecated Use `client.rooms.join(...)`. */
|
|
206
|
+
joinRoom(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
207
|
+
/** @deprecated Use `client.rooms.leave(...)`. */
|
|
208
|
+
leaveRoom(roomId: string): Promise<void>;
|
|
209
|
+
/** @deprecated Use `client.rooms.watch(...)`. */
|
|
210
|
+
watchRoom(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
211
|
+
/** @deprecated Use `client.rooms.members(...)`. */
|
|
212
|
+
getRoomMembers(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
213
|
+
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
214
|
+
getInvite(): Promise<string>;
|
|
215
|
+
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
216
|
+
getTicket(): Promise<string>;
|
|
217
|
+
/** @deprecated Use `client.tickets.share(...)` or `client.tickets.grant(...)`. */
|
|
218
|
+
getTicketWithToken(scope: GrantScope, maxConnections?: number): Promise<string>;
|
|
219
|
+
/** @deprecated Use `client.tickets.revoke(...)`. */
|
|
220
|
+
revokeTokensByScope(scope: GrantScope): Promise<string[]>;
|
|
221
|
+
/** @deprecated Use `client.peers.connect(...)`. */
|
|
222
|
+
connectPeer(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
223
|
+
/** @deprecated Use `client.peers.connect(...)`. */
|
|
224
|
+
connectTo(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
225
|
+
/** @deprecated Use `client.peers.waitConnected(...)`. */
|
|
226
|
+
waitForConnectedPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
227
|
+
/** @deprecated Use `client.channels.connect(...)`; use `client.channels.connectScoped(...)` only for custom lifecycle scopes. */
|
|
228
|
+
connectScopedChannel(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
229
|
+
/** @deprecated Use `client.channels.openBi(...)`. */
|
|
230
|
+
openPeerBi(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
231
|
+
connection: Connection;
|
|
232
|
+
readable: ReadableStream<Uint8Array>;
|
|
233
|
+
writable: WritableStream<Uint8Array>;
|
|
234
|
+
}>;
|
|
235
|
+
/** @deprecated Use `client.channels.openUni(...)`. */
|
|
236
|
+
openPeerUni(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
237
|
+
connection: Connection;
|
|
238
|
+
writable: WritableStream<Uint8Array>;
|
|
239
|
+
}>;
|
|
139
240
|
/**
|
|
140
241
|
* Access to the underlying PlutoRuntimeAssembly for backward compatibility.
|
|
141
242
|
* @deprecated Access methods directly on the client instead.
|
|
@@ -153,7 +254,10 @@ interface OpenRTCClient extends RuntimeClient {
|
|
|
153
254
|
* @example
|
|
154
255
|
* ```typescript
|
|
155
256
|
* import { OpenRTC } from 'openrtc';
|
|
156
|
-
* const client = OpenRTC({
|
|
257
|
+
* const client = OpenRTC({
|
|
258
|
+
* apiKey: 'pk_live_...',
|
|
259
|
+
* authMode: 'anonymous',
|
|
260
|
+
* });
|
|
157
261
|
* await client.connect();
|
|
158
262
|
* ```
|
|
159
263
|
*/
|
|
@@ -251,4 +355,4 @@ declare const createSpaceTokenProvider: typeof createPublicSpaceTokenProvider;
|
|
|
251
355
|
type UpgradeState = 'none' | 'upgrading' | 'upgraded' | 'failed';
|
|
252
356
|
type OutboundMessage = string | object | ArrayBuffer | Uint8Array;
|
|
253
357
|
|
|
254
|
-
export { ApplicationCryptoStreamTools, type ApplicationKeyAgreementPayload, ApplicationPayloadCrypto, type EnableSpaceAuthResponse, KEY_AGREEMENT_ALGORITHM, KEY_AGREEMENT_PUBLIC_KEY_BYTES, type MintSpaceTokenRequest, type MintSpaceTokenResponse, OpenRTC, type OpenRTCClient, RuntimeClientOptions as OpenRTCOptions, type OutboundMessage, ProtocolCapability, ProtocolCapabilityMap, ProtocolName, RuntimeApplicationPayloadReadinessOptions, RuntimeCapabilities, RuntimeChannelDescriptor, RuntimeClientOptions, RuntimeConnectionEvent, RuntimeConnectionStateSnapshot, RuntimeDevice, RuntimeDeviceConnectOptions, RuntimeDeviceStatusSnapshot, RuntimeIncomingStream, RuntimeLocalDeviceInfo, RuntimeLocalDeviceProfile, RuntimePeerConnectOptions, RuntimePeerHealth, RuntimePeerReadinessSnapshot, RuntimePeerState, RuntimePeerStreamOptions, RuntimePolicySnapshot, RuntimeRawConnection, RuntimeScopedChannelOptions, RuntimeScopedLogicalChannel, SpaceTokenProvider, type UpgradeState, createApplicationCryptoStreamTools, createPublicSpaceTokenProvider, createSharedSecretApplicationCrypto, createSpaceTokenProvider, deriveApplicationCryptoKey, enableSpaceAuth, encodeApplicationKeyAgreementPayload, generateEphemeralKeyAgreement, getPreferredProtocolOrder, isApplicationEncryptedPayload, mintSpaceToken, sandboxSpaceKey, spaceToken };
|
|
358
|
+
export { ApplicationCryptoStreamTools, type ApplicationKeyAgreementPayload, ApplicationPayloadCrypto, type EnableSpaceAuthResponse, GrantScope, KEY_AGREEMENT_ALGORITHM, KEY_AGREEMENT_PUBLIC_KEY_BYTES, type MintSpaceTokenRequest, type MintSpaceTokenResponse, OpenRTC, type OpenRTCChannelConnectOptions, type OpenRTCClient, type OpenRTCDeviceNamespace, type OpenRTCDeviceSessionOptions, RuntimeClientOptions as OpenRTCOptions, type OpenRTCRoomNamespace, type OpenRTCTicketNamespace, type OutboundMessage, ProtocolCapability, ProtocolCapabilityMap, ProtocolName, RuntimeApplicationPayloadReadinessOptions, RuntimeCapabilities, RuntimeChannelDescriptor, RuntimeClientOptions, RuntimeConnectionEvent, RuntimeConnectionStateSnapshot, RuntimeDevice, RuntimeDeviceConnectOptions, RuntimeDeviceStatusSnapshot, RuntimeIncomingStream, RuntimeJoinRoomOptions, RuntimeLocalDeviceInfo, RuntimeLocalDeviceProfile, RuntimeManagedSession, RuntimeManagedSessionOptions, RuntimePeerConnectOptions, RuntimePeerHealth, RuntimePeerReadinessSnapshot, RuntimePeerState, RuntimePeerStreamOptions, RuntimePolicySnapshot, RuntimeRawConnection, RuntimeRoomMember, RuntimeScopedChannelOptions, RuntimeScopedLogicalChannel, SpaceTokenProvider, type UpgradeState, createApplicationCryptoStreamTools, createPublicSpaceTokenProvider, createSharedSecretApplicationCrypto, createSpaceTokenProvider, deriveApplicationCryptoKey, enableSpaceAuth, encodeApplicationKeyAgreementPayload, generateEphemeralKeyAgreement, getPreferredProtocolOrder, isApplicationEncryptedPayload, mintSpaceToken, sandboxSpaceKey, spaceToken };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export{
|
|
1
|
+
import {z,A}from'./chunk-3KDNLXT6.js';export{c as KEY_AGREEMENT_ALGORITHM,b as KEY_AGREEMENT_PUBLIC_KEY_BYTES,g as ScopedSession,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,t as decodeRuntimeJsonPayload,e as deriveApplicationCryptoKey,f as encodeApplicationKeyAgreementPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,d as generateEphemeralKeyAgreement,a as getPreferredProtocolOrder}from'./chunk-3KDNLXT6.js';export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'./chunk-CK6WQV7J.js';import'./chunk-6TIOSMVJ.js';import {g}from'./chunk-5RXNKNPH.js';export{w as OPENRTC_RUNTIME_POLICY,n as createApplicationCryptoStreamTools,m as createSharedSecretApplicationCrypto,x as getRuntimePolicy,l as isApplicationEncryptedPayload}from'./chunk-KYDLXXNM.js';import {p}from'./chunk-W5JHUOK5.js';export{a as TRANSPORT_LABELS,d as isDirectIrohTransportLabel,g as isIndependentTransportLabel,c as isIrohBaseTransportLabel,e as isOptionalTransportLabel,f as isWebRtcTransportLabel,b as normalizeTransportLabel}from'./chunk-BLOEZIFJ.js';function O(t){let i=p({...t});if("auth"in t&&!t.authMode){let n=t.auth;i.authMode=n==="none"?"anonymous":n;}if("identity"in t){let n=t.identity,r=n==="temporary"?"ephemeral":n;!t.deviceIdPersistence&&!t.nodeIdPersistence&&(i.deviceIdPersistence=r),!t.endpointIdPersistence&&!t.nodeIdPersistence&&(i.endpointIdPersistence=r);}return "namespace"in t&&!t.storagePrefix&&(i.storagePrefix=t.namespace),"privacy"in t&&t.strictMode===void 0&&(i.strictMode=!!t.privacy),i}function I(t,i){let n=t.runtime,r=Object.create(n),s=async e=>{if(typeof e!="string")return e;let a=(await n.listDevices()).find(d=>d.deviceId===e);if(!a)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return a},c=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),p=async e=>{let{device:o,scope:a,...d}=e,R=d.deviceId??(typeof o=="string"?o:o?.deviceId)??null,P=d.ticket??(typeof o=="string"?void 0:o?.ticket);R&&!P&&(P=(await s(R).catch(()=>null))?.ticket);let C={...d,scope:a??"session"};return R&&(C.deviceId=R),P&&(C.ticket=P),C},l={list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??i}),stopSession:e=>n.stopManagedSession(e),listWithStatus:()=>n.listDevicesWithStatus(),watch:e=>n.watchDevices(e),watchWithStatus:e=>n.watchDevicesWithStatus(e),connect:async(e,o)=>n.connectDevice(await s(e),await c(o)),connectWithRetry:async(e,o,a)=>n.connectDeviceWithRetry(await s(e),o,a),disconnect:e=>n.disconnectDevice(e),update:(e,o)=>n.updateDevice(e,o),delete:e=>n.deleteDevice(e),localId:()=>n.getLocalDeviceId(),localInfo:()=>n.getLocalDeviceInfo(),localProfile:e=>n.getLocalDeviceProfile(e),updateLocalName:e=>n.updateLocalDeviceName(e)},u={watch:e=>n.watchPeerStates(e),watchLifecycle:e=>n.watchPeerLifecycle(e),get:e=>n.getPeerState(e),listConnected:()=>n.listConnectedPeers(),connect:e=>n.connectPeer(e),disconnect:(e,o)=>n.disconnectPeer(e,o),forceDisconnect:e=>n.forceDisconnectPeer(e),session:e=>n.getPeerSession(e),sessions:()=>n.listPeerSessions(),waitConnected:(e,o)=>n.waitForConnectedPeer(e,o),readiness:(e,o)=>n.getPeerReadiness(e,o),health:e=>n.getPeerHealth(e),identity:e=>n.resolvePeerIdentity(e),addScope:(e,o)=>n.addPeerScope(e,o),releaseScope:(e,o)=>n.releasePeerScope(e,o),scopes:e=>n.getPeerScopes(e),refresh:()=>n.refreshPeerSnapshot()},m={register:e=>n.registerChannel(e),unregister:e=>n.unregisterChannel(e),list:()=>n.listChannels(),openBi:(e,o,a)=>n.openPeerBi(e,{...a,channelId:o}),openUni:(e,o,a)=>n.openPeerUni(e,{...a,channelId:o}),onIncoming:e=>n.onIncomingStream(e),onIncomingChannel:(e,o)=>n.onIncomingChannelStream(e,a=>{if(a.channel)return o(a)}),connect:async e=>n.connectScopedChannel(await p(e)),connectScoped:e=>n.connectScopedChannel(e)},g={create:e=>n.createRoom(e),join:(e,o)=>n.joinRoom(e,o),leave:e=>n.leaveRoom(e),watch:(e,o)=>n.watchRoom(e,o),members:e=>n.getRoomMembers(e)},y={raw:()=>n.getInvite(),share:e=>n.getTicketWithToken("share",e?.maxConnections??1),grant:(e,o)=>n.getTicketWithToken(e,o?.maxConnections??0),revoke:e=>n.revokeTokensByScope(e)},A={status:()=>n.getRuntimeStatus(),policy:()=>n.getRuntimePolicy(),capabilities:()=>n.getRuntimeCapabilities(),capabilityProfile:()=>n.getCapabilityProfile(),connectionStates:()=>n.getConnectionStates(),onConnectionStateChange:e=>n.onConnectionStateChange(e),connections:()=>n.getConnections(),applicationReadyConnections:e=>n.getApplicationReadyConnections(e),onConnection:e=>n.onConnection(e),onDisconnection:e=>n.onDisconnection(e),onConnectionEvent:e=>n.onConnectionEvent(e),forceReconnectSnapshot:()=>n.forceReconnectSnapshot(),peerReconciliation:()=>n.getPeerReconciliationStats()},w={runtime:n,assembly:t,nodeId:()=>n.getNodeId(),nodeIdFromTicket:e=>n.getNodeIdFromTicket(e),endpointTicket:()=>n.getEndpointTicket(),connectRaw:e=>n.connectRaw(e),openBi:e=>n.openBi(e),openUni:e=>n.openUni(e),isConnected:e=>n.isConnected(e),disconnectNode:e=>n.disconnectNode(e),setAutoConnectExcluded:(e,o)=>n.setAutoConnectExcluded(e,o),notifyNetworkChange:e=>n.notifyNetworkChange(e)};return Object.defineProperties(r,{devices:{get:()=>l,enumerable:true},peers:{get:()=>u,enumerable:true},channels:{get:()=>m,enumerable:true},rooms:{get:()=>g,enumerable:true},tickets:{get:()=>y,enumerable:true},diagnostics:{get:()=>A,enumerable:true},advanced:{get:()=>w,enumerable:true},setAuth:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},setAuthContext:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},syncPlutoAuth:{value:e=>t.syncPlutoAuth(e),enumerable:true,writable:true,configurable:true},bindPlutoAuthHost:{value:()=>t.bindPlutoAuthHost(),enumerable:true,writable:true,configurable:true},signIn:{value:()=>t.signInWithPluto(),enumerable:true,writable:true,configurable:true},signOut:{value:()=>t.signOut(),enumerable:true,writable:true,configurable:true},runtime:{get:()=>n,enumerable:false},_assembly:{get:()=>t,enumerable:false}}),r}function T(t){let i=O(t),n=z(i);return I(n,"web")}T.native=function(t,i){let n=O(t),r=i??g(),s=A(n,r);return I(s,"native")};var ie="https://api.openrtc.app";async function re(t,i,n){let r=t.replace(/\/$/,""),s=await fetch(`${r}/v1/spaces/${encodeURIComponent(n)}/scoped-auth`,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:"{}"}),c=await s.json().catch(()=>({}));if(!s.ok){let p=typeof c?.error=="string"?c.error:`enableSpaceAuth failed (${s.status})`;throw new Error(p)}return c}async function se(t,i,n){let r=await fetch(t,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>({}));if(!r.ok){let c=typeof s?.error=="string"?s.error:`mintSpaceToken failed (${r.status})`;throw new Error(c)}if(typeof s?.token!="string"||!s.token.trim())throw new Error("mintSpaceToken response missing token");return s}function v(t){let i=t.apiKey.trim(),n=(t.spaceKey??t.space??"").trim(),r=k(t.sandboxAppId),s=(t.endpointUrl??ie).replace(/\/$/,""),c=t.memberIdStorageKey??`openrtc:space-member:${n}${r?`:sandbox:${r}`:""}`;return async()=>{if(!i||!n)throw new Error("spaceToken requires apiKey and space");let p=null;typeof sessionStorage<"u"?(p=sessionStorage.getItem(c),p||(p=globalThis.crypto?.randomUUID?.()??`member-${Date.now()}`,sessionStorage.setItem(c,p))):p=`member-${Date.now()}`;let l=await fetch(`${s}/v1SpacePublicTokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:i,spaceKey:n,memberId:p,...r?{sandboxAppId:r}:{}})}),{text:u,payload:m}=await ce(l);if(!l.ok){let y=typeof m?.error=="string"?m.error:u.trim()?u.trim().slice(0,240):`public space token mint failed (${l.status})`;throw new Error(y)}let g=typeof m?.token=="string"?m.token.trim():"";if(!g)throw new Error("public space token response missing token");return {customToken:g}}}function ae(t){if(!t.trim())return {};try{let i=JSON.parse(t);return i&&typeof i=="object"?i:{}}catch{return {}}}async function ce(t){let i=t.text;if(typeof i=="function"){let r=await i.call(t).catch(()=>"");return {text:r,payload:ae(r)}}let n=await t.json().catch(()=>({}));return {text:JSON.stringify(n),payload:n&&typeof n=="object"?n:{}}}function k(t){let i=t?.trim().toLowerCase()??"";if(!i)return "";if(!/^[a-z0-9][a-z0-9-]{0,47}$/.test(i))throw new Error("sandboxAppId must be 1-48 lowercase letters, numbers, or dashes.");return i}function pe(t,i){let n=t.trim(),r=k(i);return r?`${n}::sandbox::${r}`:n}var me=v,le=v;
|
|
2
|
+
export{T as OpenRTC,v as createPublicSpaceTokenProvider,le as createSpaceTokenProvider,re as enableSpaceAuth,se as mintSpaceToken,pe as sandboxSpaceKey,me as spaceToken};
|
package/dist/openrtc_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { D as DelegatingRuntimeAdapter, W as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { D as DelegatingRuntimeAdapter, W as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-By7pziBs.js';
|
|
2
|
+
import '../types-CzIpGV9x.js';
|
|
3
|
+
import '../IEngineBridge-C7OT2CRv.js';
|
|
3
4
|
|
|
4
5
|
declare class WasmRuntimeAdapter extends DelegatingRuntimeAdapter {
|
|
5
6
|
constructor(options: WasmBridgeOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as WasmRuntimeAdapter}from'../chunk-
|
|
1
|
+
export{a as WasmRuntimeAdapter}from'../chunk-6TIOSMVJ.js';import'../chunk-KYDLXXNM.js';import'../chunk-W5JHUOK5.js';import'../chunk-BLOEZIFJ.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'../chunk-CK6WQV7J.js';
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
1
|
+
import { P as PeerReconciliationStats } from '../framing-BUtu0oZK.js';
|
|
2
|
+
export { O as OPENRTC_RUNTIME_POLICY, b as PlutoRuntimeAssembly, R as RuntimeClient, n as RuntimeFactoryOptions, o as RuntimeJsonFrameDecoderOptions, c as RuntimeJsonFrameHandler, a as RuntimePolicySnapshot, d as RuntimeU32BEFrameHandler, D as ScopedConnectionActorError, p as ScopedConnectionActorErrorKind, q as ScopedConnectionActorHandle, r as ScopedConnectionActorHandleOptions, s as ScopedConnectionActorRegistry, t as ScopedConnectionActorState, u as ScopedConnectionClose, v as ScopedConnectionDial, w as ScopedConnectionKey, x as ScopedLogicalChannelHandle, y as ScopedPreferredTransport, z as concatRuntimeBytes, A as createIpcClient, g as createRuntimeJsonFrameDecoder, h as createRuntimeU32BEFrameDecoder, B as createWasmClient, i as decodeRuntimeJsonPayload, j as encodeRuntimeJsonFrame, k as encodeRuntimeJsonPayload, l as encodeRuntimeU32BEFrame, m as getRuntimePolicy, C as readRuntimeU32BE, E as scopedConnectionKey, F as scopedConnectionKeyToString } from '../framing-BUtu0oZK.js';
|
|
3
|
+
import * as Draft14 from '@moq/net';
|
|
4
|
+
import { O as SignalingOptions, I as ISignalingBackend, R as RuntimeIdentity, d as SignalingEnvelope, f as SignalingSession, a as Device, k as BackendConnectionState, u as AppLimits, G as GrantScope, Q as JoinRoomOptions, T as RoomMember, U as IncomingStreamChannelMetadata, s as ApplicationCryptoStreamTools, V as RoomCreationMode, C as ClientOptions, r as ApplicationPayloadCrypto, D as DiscoveryMode, q as ProtocolCapabilityMap, W as ScanningLoopOptions, X as ScanningLoopHandle, m as ConnectDeviceHooks, n as ConnectDeviceOptions, l as ConnectDeviceResult, Y as RuntimeBootstrapOptions, Z as RuntimeBootstrapResult, w as ApplicationPayloadReadinessOptions, _ as ManagedApplicationRouteOptions, $ as PeerState, a0 as PeerScope, a1 as PeerHealth, a2 as ChannelDescriptor, a3 as JoinRequest, i as NativeConnectParams, j as NativeConnectResult } from '../types-CzIpGV9x.js';
|
|
5
|
+
import { C as Connection, K as RuntimeConnectionTarget, v as RuntimeRawConnection } from '../device-status-nkXepu97.js';
|
|
6
|
+
export { w as ChannelDescriptor, x as ConnectionEvent, y as ConnectionTarget, D as DeviceProfile, z as IncomingStream, P as PeerConnectOptions, A as PeerReadiness, B as PeerStreamOptions, E as PresenceLoopOptions, F as RawConnection, t as RuntimeApplicationPayloadReadinessOptions, G as RuntimeAuthContext, H as RuntimeAuthIdentity, J as RuntimeAutoConnectPolicy, l as RuntimeChannelDescriptor, R as RuntimeClientOptions, u as RuntimeConnectionEvent, s as RuntimeConnectionStateSnapshot, c as RuntimeDevice, a2 as RuntimeDeviceActiveOptions, e as RuntimeDeviceConnectOptions, L as RuntimeDevicePresenceStatus, M as RuntimeDeviceStatus, d as RuntimeDeviceStatusSnapshot, n as RuntimeIncomingStream, q as RuntimeJoinRoomOptions, f as RuntimeLocalDeviceInfo, g as RuntimeLocalDeviceProfile, N as RuntimeLogicalChannelFraming, b as RuntimeManagedSession, O as RuntimeManagedSessionKind, a as RuntimeManagedSessionOptions, Q as RuntimeManagedSessionPlatform, i as RuntimePeerConnectOptions, k as RuntimePeerHealth, S as RuntimePeerLifecycleStatus, j as RuntimePeerReadinessSnapshot, T as RuntimePeerScope, U as RuntimePeerSessionSnapshot, h as RuntimePeerState, m as RuntimePeerStreamOptions, V as RuntimePresenceLoopOptions, W as RuntimePresencePolicy, r as RuntimeRoomMember, o as RuntimeScopedChannelOptions, p as RuntimeScopedLogicalChannel, X as RuntimeSession, Y as RuntimeUiConnectionStatus, Z as ScopedChannelOptions, _ as ScopedLogicalChannel, a3 as Session, a4 as SessionOptions, $ as isRuntimeDeviceActive, a0 as isRuntimeDeviceConnectable, a1 as isRuntimeDeviceRoutable } from '../device-status-nkXepu97.js';
|
|
4
7
|
import { FirebaseApp } from 'firebase/app';
|
|
5
|
-
import { R as RuntimeCapabilities } from '../DelegatingRuntimeAdapter-
|
|
6
|
-
export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile,
|
|
7
|
-
export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, P as PlutoIpcBridge,
|
|
8
|
+
import { R as RuntimeCapabilities } from '../DelegatingRuntimeAdapter-By7pziBs.js';
|
|
9
|
+
export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, c as NativeRuntimeStatusSnapshot, d as NativeRuntimeTransportFeatureStatus, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile, e as cloneRuntimeCapabilities, r as runtimeCapabilitiesFromNativeStatus, f as runtimeCapabilityProfile } from '../DelegatingRuntimeAdapter-By7pziBs.js';
|
|
10
|
+
export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, b as NativeIpcFailureKind, P as PlutoIpcBridge, c as PlutoIpcUnlisten, d as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../IpcRuntimeAdapter-DymXAsNU.js';
|
|
8
11
|
export { WasmRuntimeAdapter } from './WasmRuntimeAdapter.js';
|
|
9
12
|
export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge } from './tauri.js';
|
|
13
|
+
import '../IEngineBridge-C7OT2CRv.js';
|
|
10
14
|
|
|
11
15
|
/**
|
|
12
16
|
* RtdbPresence — Phase 1 RTDB-backed device presence.
|
|
@@ -19,30 +23,33 @@ export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge }
|
|
|
19
23
|
*
|
|
20
24
|
* RTDB paths mirror the Firestore device collection paths:
|
|
21
25
|
*
|
|
22
|
-
* space/spaceKey → presence/spaces/{namespaceId}/devices/{deviceId}
|
|
23
|
-
* user-scoped → presence/{appTag}/users/{userId}/devices/{deviceId}
|
|
26
|
+
* space/spaceKey → presence/spaces/{namespaceId}/devices/{deviceId}/instances/{runtimeInstanceId}
|
|
27
|
+
* user-scoped → presence/{appTag}/users/{userId}/devices/{deviceId}/instances/{runtimeInstanceId}
|
|
24
28
|
*
|
|
25
29
|
* Space RTDB paths require scoped Firebase auth
|
|
26
|
-
* (`namespaceId` or `space::{namespaceId}` appTag claim).
|
|
27
|
-
*
|
|
28
|
-
*
|
|
30
|
+
* (`namespaceId` or `space::{namespaceId}` appTag claim). If that scope is not
|
|
31
|
+
* available, Firestore may still hold the durable ticket record, but it must
|
|
32
|
+
* not become a recurring liveness heartbeat.
|
|
29
33
|
*
|
|
30
34
|
* Ticket version invalidation:
|
|
31
35
|
* Each presence node stores a `ticketVersion` integer. WasmBridge bumps it
|
|
32
|
-
* whenever it
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* whenever it publishes a new endpoint ticket. Subscribers compare the
|
|
37
|
+
* received ticketVersion against their cached value; if it differs they
|
|
38
|
+
* re-fetch the full device doc from Firestore when needed. Presence nodes may
|
|
39
|
+
* also carry the current ticket directly so native clients can refresh
|
|
40
|
+
* connection data without using Firestore as a heartbeat bus.
|
|
37
41
|
*/
|
|
38
42
|
|
|
39
43
|
interface RtdbDevicePresence {
|
|
40
44
|
online: boolean;
|
|
41
45
|
ticketVersion: number;
|
|
46
|
+
leaseExpiresAt?: number;
|
|
42
47
|
ticket?: string;
|
|
43
48
|
nodeId?: string;
|
|
44
49
|
deviceName?: string;
|
|
50
|
+
platformType?: string;
|
|
45
51
|
metadata?: string;
|
|
52
|
+
excludedPeers?: string[];
|
|
46
53
|
}
|
|
47
54
|
type RtdbPresenceMap = Record<string, RtdbDevicePresence>;
|
|
48
55
|
type DiscoveryPresenceScope = {
|
|
@@ -57,20 +64,27 @@ interface RtdbPresenceRosterFields {
|
|
|
57
64
|
ticket?: string;
|
|
58
65
|
nodeId?: string;
|
|
59
66
|
deviceName?: string;
|
|
67
|
+
platformType?: string;
|
|
60
68
|
metadata?: string;
|
|
69
|
+
excludedPeers?: string[];
|
|
61
70
|
}
|
|
62
71
|
interface RtdbMemberPresence {
|
|
63
72
|
online: boolean;
|
|
73
|
+
leaseExpiresAt?: number;
|
|
64
74
|
}
|
|
65
75
|
type RtdbRoomPresenceMap = Record<string, RtdbMemberPresence>;
|
|
66
76
|
declare class RtdbPresence {
|
|
67
77
|
private readonly db;
|
|
78
|
+
private readonly runtimeInstanceId;
|
|
68
79
|
private readonly desiredOnlineNodes;
|
|
69
80
|
private connected;
|
|
70
81
|
private connectedUnsubscribe;
|
|
71
|
-
|
|
82
|
+
private leaseRefreshTimer;
|
|
83
|
+
constructor(app: FirebaseApp, runtimeInstanceId?: string);
|
|
72
84
|
private ensureReconnectWatch;
|
|
73
85
|
private publishDesiredOnline;
|
|
86
|
+
private ensureLeaseRefresh;
|
|
87
|
+
private stopLeaseRefreshIfIdle;
|
|
74
88
|
private registerOnlineNode;
|
|
75
89
|
private markNodeOffline;
|
|
76
90
|
private subscribeIncremental;
|
|
@@ -78,15 +92,15 @@ declare class RtdbPresence {
|
|
|
78
92
|
* Register this device as online in RTDB and set an onDisconnect handler
|
|
79
93
|
* so the server marks it offline automatically on connection loss.
|
|
80
94
|
*
|
|
81
|
-
* Should be called once per session, after
|
|
82
|
-
*
|
|
83
|
-
*
|
|
95
|
+
* Should be called once per session, after the durable Firestore device
|
|
96
|
+
* record exists. Does not replace the Firestore device doc — that remains
|
|
97
|
+
* the durable registry while RTDB owns hot liveness.
|
|
84
98
|
*/
|
|
85
99
|
registerDevice(scope: DiscoveryPresenceScope, deviceId: string, ticketVersion?: number, fields?: RtdbPresenceRosterFields): Promise<void>;
|
|
86
100
|
/**
|
|
87
|
-
* Bump the ticketVersion for a device. Call this whenever a new
|
|
88
|
-
* ticket is
|
|
89
|
-
* will see the version change and re-fetch the
|
|
101
|
+
* Bump the ticketVersion for a device. Call this whenever a new endpoint
|
|
102
|
+
* ticket is published (e.g. on network change / node restart). Subscribers
|
|
103
|
+
* will see the version change and re-fetch or use the RTDB-carried ticket.
|
|
90
104
|
*/
|
|
91
105
|
bumpTicketVersion(scope: DiscoveryPresenceScope, deviceId: string, newVersion: number, fields?: RtdbPresenceRosterFields): Promise<void>;
|
|
92
106
|
/**
|
|
@@ -178,30 +192,20 @@ interface MoQSubscriberOptions {
|
|
|
178
192
|
maxBufferedBytesPerTrack?: number;
|
|
179
193
|
maxObjectPayloadBytes?: number;
|
|
180
194
|
}
|
|
195
|
+
/** Draft-14 subscriber facade; session reconnect remains owned by MoQController. */
|
|
181
196
|
declare class MoQSubscriber {
|
|
182
|
-
private session;
|
|
183
|
-
private readonly
|
|
197
|
+
private readonly session;
|
|
198
|
+
private readonly onObject;
|
|
199
|
+
private readonly subscriptions;
|
|
200
|
+
private readonly maxSubscriptions;
|
|
184
201
|
private readonly maxSubscribeRetries;
|
|
185
202
|
private readonly subscribeRetryDelayMs;
|
|
186
|
-
private readonly maxBufferedGroupsPerTrack;
|
|
187
|
-
private readonly maxBufferedFramesPerGroup;
|
|
188
|
-
private readonly maxBufferedBytesPerTrack;
|
|
189
203
|
private readonly maxObjectPayloadBytes;
|
|
190
|
-
private
|
|
191
|
-
constructor(session: MoQSession, onObject: (
|
|
192
|
-
private aliasMap;
|
|
193
|
-
private nextAlias;
|
|
194
|
-
private nextSubscribeId;
|
|
195
|
-
private pendingSubscriptions;
|
|
196
|
-
private deliveryState;
|
|
197
|
-
private activeSubscriptions;
|
|
204
|
+
private closed;
|
|
205
|
+
constructor(session: MoQSession, onObject: (trackNamespace: string, trackName: string, object: Uint8Array, metadata: unknown) => void, options?: MoQSubscriberOptions);
|
|
198
206
|
subscribe(namespace: string, name: string): Promise<void>;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
onSubscribeDone(subscribeId: number, code: number, reason: string): void;
|
|
202
|
-
private wakeDelivery;
|
|
203
|
-
private runDeliveryLoop;
|
|
204
|
-
handleIncomingUniStream(stream: ReadableStream<Uint8Array>): Promise<void>;
|
|
207
|
+
close(): void;
|
|
208
|
+
private consume;
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
interface TransportInterface {
|
|
@@ -210,41 +214,34 @@ interface TransportInterface {
|
|
|
210
214
|
writable: WritableStream<Uint8Array>;
|
|
211
215
|
}>;
|
|
212
216
|
createUnidirectionalStream(): Promise<WritableStream<Uint8Array>>;
|
|
213
|
-
incomingBidirectionalStreams: ReadableStream<
|
|
217
|
+
incomingBidirectionalStreams: ReadableStream<unknown>;
|
|
214
218
|
incomingUnidirectionalStreams: ReadableStream<ReadableStream<Uint8Array>>;
|
|
215
219
|
close(): void;
|
|
216
220
|
ready: Promise<void>;
|
|
217
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Draft-14 MoQT adapter. The OpenRTC controller owns reconnect and lifecycle;
|
|
224
|
+
* this class owns only one negotiated relay session and its protocol handles.
|
|
225
|
+
*/
|
|
218
226
|
declare class MoQSession {
|
|
219
|
-
transport: TransportInterface;
|
|
220
|
-
private
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
readonly transport: TransportInterface;
|
|
228
|
+
private readonly relayUrl;
|
|
229
|
+
readonly publisher: MoQPublisher;
|
|
230
|
+
readonly subscriber: MoQSubscriber;
|
|
231
|
+
setupComplete: boolean;
|
|
232
|
+
private connection;
|
|
223
233
|
private closeListeners;
|
|
224
234
|
private closed;
|
|
225
235
|
private closeEmitted;
|
|
226
|
-
private resourcesClosed;
|
|
227
|
-
private role;
|
|
228
|
-
setupComplete: boolean;
|
|
229
236
|
private setupResolve;
|
|
230
|
-
private setupPromise;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
publisher: MoQPublisher;
|
|
234
|
-
subscriber: MoQSubscriber;
|
|
235
|
-
constructor(transport: TransportInterface, onObject?: (ns: string, name: string, obj: Uint8Array, meta: any) => void, role?: number);
|
|
236
|
-
/** Wait for handshake to complete before sending ANNOUNCE/SUBSCRIBE */
|
|
237
|
-
waitForSetup(): Promise<void>;
|
|
237
|
+
private readonly setupPromise;
|
|
238
|
+
constructor(transport: TransportInterface, onObject?: (ns: string, name: string, obj: Uint8Array, meta: unknown) => void, role?: number, relayUrl?: URL);
|
|
239
|
+
requireConnection(): Draft14.Connection.Established;
|
|
238
240
|
init(): Promise<void>;
|
|
241
|
+
waitForSetup(): Promise<void>;
|
|
239
242
|
onClose(callback: (reason?: unknown) => void): () => void;
|
|
240
243
|
close(): void;
|
|
241
|
-
private cleanupResources;
|
|
242
244
|
private emitClose;
|
|
243
|
-
private readUniStreams;
|
|
244
|
-
sendControlMessage(msg: any): Promise<void>;
|
|
245
|
-
private readLoop;
|
|
246
|
-
private processBuffer;
|
|
247
|
-
private handleControlMessage;
|
|
248
245
|
}
|
|
249
246
|
|
|
250
247
|
interface MoQPublisherOptions {
|
|
@@ -254,26 +251,31 @@ interface MoQPublisherOptions {
|
|
|
254
251
|
maxActivePublishers?: number;
|
|
255
252
|
maxTrackIdChars?: number;
|
|
256
253
|
}
|
|
254
|
+
interface TrackPublisher {
|
|
255
|
+
close(): void;
|
|
256
|
+
push(data: Uint8Array, init: {
|
|
257
|
+
isKey: boolean;
|
|
258
|
+
timestamp: number;
|
|
259
|
+
closeAfterPush?: boolean;
|
|
260
|
+
}): Promise<void>;
|
|
261
|
+
}
|
|
262
|
+
/** Draft-14 publisher facade preserving OpenRTC's existing data-track API. */
|
|
257
263
|
declare class MoQPublisher {
|
|
258
|
-
private session;
|
|
259
|
-
private
|
|
260
|
-
private activePublishers;
|
|
261
|
-
private readonly
|
|
262
|
-
private readonly announceTimeoutMs;
|
|
264
|
+
private readonly session;
|
|
265
|
+
private readonly namespaces;
|
|
266
|
+
private readonly activePublishers;
|
|
267
|
+
private readonly maxNamespaces;
|
|
263
268
|
private readonly maxSubscribedTracks;
|
|
264
269
|
private readonly maxActivePublishers;
|
|
265
270
|
private readonly maxTrackIdChars;
|
|
271
|
+
private closed;
|
|
266
272
|
constructor(session: MoQSession, options?: MoQPublisherOptions);
|
|
267
|
-
private pendingAnnounces;
|
|
268
273
|
announce(namespace: string): Promise<void>;
|
|
269
|
-
onAnnounceResult(namespace: string, error?: {
|
|
270
|
-
code: number;
|
|
271
|
-
reason: string;
|
|
272
|
-
}): void;
|
|
273
|
-
onSubscribe(msg: any): void;
|
|
274
|
-
onUnsubscribe(subscribeId: number): void;
|
|
275
274
|
hasTrackSubscriber(namespace: string, name: string): boolean;
|
|
276
|
-
createTrack(namespace: string, name: string): Promise<
|
|
275
|
+
createTrack(namespace: string, name: string): Promise<TrackPublisher>;
|
|
276
|
+
close(): void;
|
|
277
|
+
private acceptTrackRequests;
|
|
278
|
+
private totalSubscriberCount;
|
|
277
279
|
private resolveTrackId;
|
|
278
280
|
}
|
|
279
281
|
|
|
@@ -297,7 +299,7 @@ interface RoomClientHost {
|
|
|
297
299
|
roomCreationMode: 'client-open' | 'client-auth' | 'server-only';
|
|
298
300
|
appLimits: AppLimits;
|
|
299
301
|
ensureAuthenticated(reason: 'room-op'): Promise<void>;
|
|
300
|
-
|
|
302
|
+
getTicketWithToken(grantScope: GrantScope, maxConnections?: number): Promise<string>;
|
|
301
303
|
getNodeId(): Promise<string>;
|
|
302
304
|
connect(ticket: string, timeoutMs?: number): Promise<Connection>;
|
|
303
305
|
refreshHostedAppSettings(force?: boolean): Promise<void>;
|
|
@@ -320,9 +322,11 @@ declare class RoomManager {
|
|
|
320
322
|
private syncRtdbPresenceFromSignaling;
|
|
321
323
|
private usesDirectRoomBackend;
|
|
322
324
|
private get roomBackendTag();
|
|
325
|
+
private resolveRoomUserId;
|
|
323
326
|
private get appTag();
|
|
324
327
|
private invokeRoomCallable;
|
|
325
328
|
private isAlreadyExistsError;
|
|
329
|
+
private normalizeRoomId;
|
|
326
330
|
private getMembersInternal;
|
|
327
331
|
private parseMemberDocuments;
|
|
328
332
|
private parseRoomMemberDocument;
|
|
@@ -376,8 +380,10 @@ declare class Client {
|
|
|
376
380
|
set wasmClient(client: any);
|
|
377
381
|
get node(): any;
|
|
378
382
|
set node(node: any);
|
|
383
|
+
attachIncomingStreamSource(source: unknown, localNodeId: string): void;
|
|
379
384
|
getApplicationCrypto(connection?: Connection): ApplicationPayloadCrypto | undefined;
|
|
380
385
|
resolveApplicationCryptoForPeer(peerId?: string, connection?: Connection): ApplicationPayloadCrypto | undefined;
|
|
386
|
+
releaseApplicationKeyAgreementReply(connectionId: string, action: 'response' | 'ack', claimId: string): void;
|
|
381
387
|
waitForApplicationCryptoForPeer(peerId?: string, timeoutMs?: number): Promise<ApplicationPayloadCrypto | undefined>;
|
|
382
388
|
destroy(): void;
|
|
383
389
|
dispose(): void;
|
|
@@ -427,6 +433,8 @@ declare class Client {
|
|
|
427
433
|
onMoQReady(cb: () => void): () => void;
|
|
428
434
|
onMoQFailed(cb: () => void): () => void;
|
|
429
435
|
onMoQObject(callback: (ns: string, name: string, obj: Uint8Array, meta: any) => void): () => void;
|
|
436
|
+
subscribeMoQPeer(connection: Connection): void;
|
|
437
|
+
subscribeMoQPeerNode(peerId: string, subscriptionKey?: string): void;
|
|
430
438
|
connect(ticket: string, timeoutMs?: number, expectedDeviceId?: string | null, channelId?: string, options?: {
|
|
431
439
|
admissionAlreadyPresented?: boolean;
|
|
432
440
|
approvedScope?: string | null;
|
|
@@ -446,6 +454,7 @@ declare class Client {
|
|
|
446
454
|
getApplicationReadyConnections(options?: ApplicationPayloadReadinessOptions): Connection[];
|
|
447
455
|
getConnectionForPeer(connectionId?: string, remoteNodeId?: string): Connection | null;
|
|
448
456
|
hasApplicationRouteForPeer(connectionId?: string, remoteNodeId?: string): boolean;
|
|
457
|
+
ensureManagedApplicationRoute(options: ManagedApplicationRouteOptions): Promise<Connection>;
|
|
449
458
|
watchPeerStates(callback: (peers: PeerState[]) => void): () => void;
|
|
450
459
|
getPeerState(id: string): PeerState | undefined;
|
|
451
460
|
listConnectedPeers(): PeerState[];
|
|
@@ -465,6 +474,7 @@ declare class Client {
|
|
|
465
474
|
ticket?: string;
|
|
466
475
|
scope?: PeerScope;
|
|
467
476
|
channelId?: string;
|
|
477
|
+
timeoutMs?: number;
|
|
468
478
|
respectManualDisconnect?: boolean;
|
|
469
479
|
}): Promise<Connection>;
|
|
470
480
|
clearManualDisconnectProjection(id: string): void;
|
|
@@ -492,7 +502,9 @@ declare class Client {
|
|
|
492
502
|
disconnectNode(nodeId: string): Promise<void>;
|
|
493
503
|
getLocalDeviceId(): Promise<string | null>;
|
|
494
504
|
acceptNativeMessage(connectionId: string | null, remoteNodeId: string | null, msg: any): Promise<boolean>;
|
|
495
|
-
startListening(
|
|
505
|
+
startListening(options?: {
|
|
506
|
+
startPresence?: boolean;
|
|
507
|
+
}): Promise<void>;
|
|
496
508
|
stopListening(): void;
|
|
497
509
|
forceReconnectSnapshot(): void;
|
|
498
510
|
wrapChannelWritable(writable: WritableStream<Uint8Array>, channelId: string, metadata?: Record<string, unknown> | null): WritableStream<Uint8Array>;
|
|
@@ -522,11 +534,9 @@ declare class Client {
|
|
|
522
534
|
declare class RuntimeConnectionController {
|
|
523
535
|
private readonly client;
|
|
524
536
|
private readonly backend;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
endpointTicket: string;
|
|
529
|
-
}): Promise<NativeConnectResult>;
|
|
537
|
+
private readonly onLifecycleMutation;
|
|
538
|
+
constructor(client: Client, backend: ISignalingBackend | null, onLifecycleMutation?: () => void);
|
|
539
|
+
connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
|
|
530
540
|
connectRaw(target: RuntimeConnectionTarget): Promise<RuntimeRawConnection>;
|
|
531
541
|
openBi(nodeId: string): Promise<{
|
|
532
542
|
readable: ReadableStream<Uint8Array>;
|
package/dist/runtime/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{y as RuntimeClient,h as RuntimeConnectionController,l as ScopedConnectionActorError,o as ScopedConnectionActorHandle,p as ScopedConnectionActorRegistry,k as clog,w as concatRuntimeBytes,j as correlationForDriveGrantScope,A as createIpcClient,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,z as createWasmClient,t as decodeRuntimeJsonPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,x as readRuntimeU32BE,i as renderCorrelationFields,m as scopedConnectionKey,n as scopedConnectionKeyToString}from'../chunk-3KDNLXT6.js';export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'../chunk-CK6WQV7J.js';export{a as WasmRuntimeAdapter}from'../chunk-6TIOSMVJ.js';export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-KH227SE4.js';export{h as IpcRuntimeAdapter,e as classifyNativeIpcFailure,f as isNativeIpcCommandUnavailable}from'../chunk-5RXNKNPH.js';export{y as BROWSER_WASM_RUNTIME_CAPABILITIES,z as NATIVE_IPC_RUNTIME_CAPABILITIES,w as OPENRTC_RUNTIME_POLICY,A as cloneRuntimeCapabilities,x as getRuntimePolicy,o as logOpenRtcTeardownTrace,b as openRtcDebug,a as openRtcDebugEnabled,c as openRtcDebugInfo,d as openRtcDebugLog,B as runtimeCapabilitiesFromNativeStatus,C as runtimeCapabilityProfile}from'../chunk-KYDLXXNM.js';import'../chunk-W5JHUOK5.js';import'../chunk-BLOEZIFJ.js';
|