openrtc 2.0.0-rc.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/dist/DelegatingRuntimeAdapter-BFZDC604.d.ts +397 -0
- package/dist/{types-BHePJWbM.d.ts → ITransport-WV6gGMnX.d.ts} +42 -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/{OpenRTCShared-BswnbjpG.d.ts → assembly-q0jRRpsc.d.ts} +51 -250
- package/dist/{capabilities-YSskrE8H.d.ts → capabilities-BfZi4Cd7.d.ts} +4 -0
- package/dist/chunk-45WBH7E3.js +1 -0
- package/dist/chunk-7FPG3MFF.js +2 -0
- package/dist/chunk-AG2F6MOB.js +1 -0
- package/dist/chunk-CWGKLGJZ.js +1 -0
- package/dist/{chunk-C6PAXO3N.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-7Z6N46RB.js → chunk-LRT5GEGH.js} +2 -2
- package/dist/chunk-NRXEG5GQ.js +1 -0
- package/dist/chunk-OEVPKC3W.js +1 -0
- package/dist/chunk-VBUDERMM.js +2 -0
- package/dist/chunk-VOCOZ57Q.js +2 -0
- package/dist/chunk-XPL7PUBW.js +2 -0
- package/dist/chunk-Z2WVSXPW.js +1 -0
- package/dist/chunk-Z6TZLF4B.js +1 -0
- package/dist/controlPlane-P66ZTVNW.js +2 -0
- package/dist/deviceEnrollment-GL4JPVGG.js +2 -0
- package/dist/deviceKey-SBNKLVYF.js +1 -0
- package/dist/deviceManagement-PHY5TIOS.js +1 -0
- package/dist/deviceProfile-3BEQZLJF.js +2 -0
- package/dist/deviceRoster-VZA3TQOR.js +1 -0
- package/dist/dist-FIVA6EPA.js +277 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.js +1 -1
- package/dist/ipcFactory-B6HBECSU.js +1 -0
- package/dist/native.d.ts +7 -8
- package/dist/native.js +1 -1
- package/dist/openrtc-BFF336RG.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 -62
- package/dist/runtime/index.js +1 -2
- package/dist/testing.d.ts +9 -18
- package/dist/testing.js +1 -1
- package/dist/transport/index.d.ts +2 -3
- package/dist/transport/index.js +1 -1
- package/dist/{types-D0pqNSOf.d.ts → types-DVNSd5B9.d.ts} +71 -4
- package/dist/{types-byWIP-WI.d.ts → types-Di034GVQ.d.ts} +72 -15
- package/package.json +3 -27
- package/dist/DelegatingRuntimeAdapter-BLNigcS4.d.ts +0 -134
- package/dist/IEngineBridge-BbsT8hof.d.ts +0 -17
- package/dist/ITransport-BsPcaov7.d.ts +0 -16
- package/dist/OpenRTCShared-TKAQLONA.js +0 -1
- package/dist/WasmBridge-B7NTRYN5.js +0 -1
- package/dist/auth/index.d.ts +0 -78
- package/dist/auth/index.js +0 -1
- package/dist/auth/internal.d.ts +0 -4
- package/dist/auth/internal.js +0 -1
- package/dist/chunk-23XC6TGK.js +0 -2
- package/dist/chunk-2QHDEGVX.js +0 -1
- package/dist/chunk-A7AMB23L.js +0 -2
- package/dist/chunk-BXFXPIXO.js +0 -1
- package/dist/chunk-C7YN5MSV.js +0 -1
- package/dist/chunk-D45U2NXV.js +0 -1
- package/dist/chunk-DZCZLRM5.js +0 -1
- package/dist/chunk-EUNCYGJD.js +0 -1
- package/dist/chunk-IAIGT5G3.js +0 -1
- package/dist/chunk-JIVVHBCB.js +0 -2
- package/dist/chunk-K37WVIZL.js +0 -1
- package/dist/chunk-KWXAZUAZ.js +0 -2
- package/dist/chunk-N26S7V4N.js +0 -1
- package/dist/chunk-N4SX7C3W.js +0 -2
- package/dist/chunk-NB4H5TP3.js +0 -1
- package/dist/chunk-NCL672QJ.js +0 -3
- package/dist/chunk-NT5YHZQH.js +0 -1
- package/dist/chunk-O3D7S5MD.js +0 -1
- package/dist/chunk-RD3JEGGF.js +0 -2
- package/dist/chunk-VK6KX433.js +0 -1
- package/dist/factories-TLUZAXUG.js +0 -1
- package/dist/ipcFactory-QOAZVE56.js +0 -1
- package/dist/openrtc-C53CKZUM.js +0 -2
- package/dist/runtime/legacy.d.ts +0 -18
- package/dist/runtime/legacy.js +0 -1
- package/dist/runtime/tauri.d.ts +0 -6
- package/dist/runtime/tauri.js +0 -1
- package/dist/tauri-BgLgJoQA.d.ts +0 -33
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { R as RuntimePolicySnapshot, P as PeerReconciliationStats, a as RuntimeClient, b as PlutoRuntimeAssembly } from './assembly-q0jRRpsc.js';
|
|
2
|
+
import { d as PeerSessionSnapshot, R as ResolvedPeerIdentity, C as ConnectDeviceResult, e as ConnectDeviceHooks, f as ConnectDeviceOptions, G as GrantScope } from './ITransport-WV6gGMnX.js';
|
|
3
|
+
import { a as RuntimePeerState, b as RuntimePeerConnectOptions, C as Connection, c as RuntimePeerReadinessSnapshot, d as RuntimePeerHealth, R as RuntimeChannelDescriptor, e as RuntimePeerStreamOptions, f as RuntimeIncomingStream, g as RuntimeScopedChannelOptions, h as RuntimeDevice, i as RuntimeScopedLogicalChannel, j as RuntimeConnectionStateSnapshot, k as RuntimeApplicationPayloadReadinessOptions, l as RuntimeConnectionEvent, m as RuntimeManagedSessionOptions, n as RuntimeManagedSession, o as RuntimeDeviceStatusSnapshot, p as RuntimeDeviceConnectOptions, q as RuntimeLocalDeviceInfo, r as RuntimeLocalDeviceProfile, s as RuntimeRawConnection, t as RuntimeJoinRoomOptions, u as RuntimeRoomMember, A as AuthContext, v as RuntimeClientOptions } from './types-DVNSd5B9.js';
|
|
4
|
+
import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile } from './capabilities-BfZi4Cd7.js';
|
|
5
|
+
|
|
6
|
+
type OpenRTCChannelConnectOptions = Omit<RuntimeScopedChannelOptions, 'scope' | 'deviceId' | 'ticket'> & {
|
|
7
|
+
/**
|
|
8
|
+
* Device selected from `client.devices.*`. Passing the device object lets
|
|
9
|
+
* OpenRTC reuse its current ticket for native and ticket-gated routes.
|
|
10
|
+
*/
|
|
11
|
+
device?: string | RuntimeDevice;
|
|
12
|
+
deviceId?: string | null;
|
|
13
|
+
ticket?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Logical channel lifecycle scope. Most app channels should use the default
|
|
16
|
+
* `session`; pass a custom scope only when you intentionally manage peer
|
|
17
|
+
* lifecycle separately from the channel.
|
|
18
|
+
*/
|
|
19
|
+
scope?: RuntimeScopedChannelOptions['scope'];
|
|
20
|
+
};
|
|
21
|
+
type OpenRTCDeviceSessionOptions = Omit<RuntimeManagedSessionOptions, 'platform'> & {
|
|
22
|
+
/**
|
|
23
|
+
* Runtime host for the managed user-device session. Normal apps can omit
|
|
24
|
+
* this: `OpenRTC(...)` defaults to `web`, and `OpenRTC.native(...)` defaults
|
|
25
|
+
* to `native`.
|
|
26
|
+
*/
|
|
27
|
+
platform?: RuntimeManagedSessionOptions['platform'];
|
|
28
|
+
};
|
|
29
|
+
interface OpenRTCDeviceNamespace {
|
|
30
|
+
startSession(options?: OpenRTCDeviceSessionOptions): Promise<RuntimeManagedSession>;
|
|
31
|
+
stopSession(options?: {
|
|
32
|
+
preserveBackendSession?: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
list(): Promise<RuntimeDevice[]>;
|
|
35
|
+
listWithStatus(): Promise<RuntimeDeviceStatusSnapshot[]>;
|
|
36
|
+
watch(callback: (devices: RuntimeDevice[]) => void): () => void;
|
|
37
|
+
watchWithStatus(callback: (devices: RuntimeDeviceStatusSnapshot[]) => void): () => void;
|
|
38
|
+
connect(device: string | RuntimeDevice, options?: RuntimeDeviceConnectOptions): Promise<ConnectDeviceResult>;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Use `devices.connect()`. Retry and route recovery are owned by
|
|
41
|
+
* OpenRTC; legacy consumer-provided connection hooks are ignored.
|
|
42
|
+
*/
|
|
43
|
+
connectWithRetry(device: string | RuntimeDevice, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise<ConnectDeviceResult>;
|
|
44
|
+
disconnect(deviceId: string): Promise<void>;
|
|
45
|
+
update(deviceId: string, updates: {
|
|
46
|
+
deviceName?: string;
|
|
47
|
+
capabilities?: RuntimeDevice['capabilities'];
|
|
48
|
+
metadata?: string;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
delete(deviceId: string): Promise<void>;
|
|
51
|
+
localId(): Promise<string | null>;
|
|
52
|
+
localInfo(): Promise<RuntimeLocalDeviceInfo | null>;
|
|
53
|
+
localProfile(options?: {
|
|
54
|
+
deviceName?: string;
|
|
55
|
+
localDeviceId?: string | null;
|
|
56
|
+
platform?: 'native' | 'web';
|
|
57
|
+
userId?: string | null;
|
|
58
|
+
}): Promise<RuntimeLocalDeviceProfile>;
|
|
59
|
+
updateLocalName(deviceName: string): Promise<RuntimeLocalDeviceInfo | null>;
|
|
60
|
+
}
|
|
61
|
+
interface OpenRTCPeerNamespace {
|
|
62
|
+
watch(callback: (peers: RuntimePeerState[]) => void): () => void;
|
|
63
|
+
watchLifecycle(callback: (peers: RuntimePeerState[]) => void): () => void;
|
|
64
|
+
get(id: string): RuntimePeerState | undefined;
|
|
65
|
+
listConnected(): RuntimePeerState[];
|
|
66
|
+
connect(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
67
|
+
disconnect(id: string, scope?: string): Promise<void>;
|
|
68
|
+
forceDisconnect(id: string): Promise<void>;
|
|
69
|
+
session(id: string): Promise<PeerSessionSnapshot | null>;
|
|
70
|
+
sessions(): Promise<PeerSessionSnapshot[]>;
|
|
71
|
+
waitConnected(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
72
|
+
readiness(id: string, timeoutMs?: number): Promise<RuntimePeerReadinessSnapshot>;
|
|
73
|
+
health(id: string): Promise<RuntimePeerHealth>;
|
|
74
|
+
identity(id: string): Promise<ResolvedPeerIdentity>;
|
|
75
|
+
addScope(id: string, scope?: string): RuntimePeerState | undefined;
|
|
76
|
+
releaseScope(id: string, scope?: string): RuntimePeerState | undefined;
|
|
77
|
+
scopes(id: string): string[];
|
|
78
|
+
refresh(): Promise<RuntimePeerState[]>;
|
|
79
|
+
}
|
|
80
|
+
interface OpenRTCChannelNamespace {
|
|
81
|
+
register(descriptor: RuntimeChannelDescriptor): void;
|
|
82
|
+
unregister(channelId: string): void;
|
|
83
|
+
list(): RuntimeChannelDescriptor[];
|
|
84
|
+
openBi(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
|
|
85
|
+
connection: Connection;
|
|
86
|
+
readable: ReadableStream<Uint8Array>;
|
|
87
|
+
writable: WritableStream<Uint8Array>;
|
|
88
|
+
}>;
|
|
89
|
+
openUni(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
|
|
90
|
+
connection: Connection;
|
|
91
|
+
writable: WritableStream<Uint8Array>;
|
|
92
|
+
}>;
|
|
93
|
+
onIncoming(callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
|
|
94
|
+
onIncomingChannel(channelId: string, callback: (stream: RuntimeIncomingStream & {
|
|
95
|
+
channel: NonNullable<RuntimeIncomingStream['channel']>;
|
|
96
|
+
}) => boolean | void): () => void;
|
|
97
|
+
connect(options: OpenRTCChannelConnectOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
98
|
+
connectScoped(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
99
|
+
}
|
|
100
|
+
interface OpenRTCRoomNamespace {
|
|
101
|
+
create(roomId?: string): Promise<string>;
|
|
102
|
+
join(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
103
|
+
leave(roomId: string): Promise<void>;
|
|
104
|
+
watch(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
105
|
+
members(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
106
|
+
}
|
|
107
|
+
interface OpenRTCTicketNamespace {
|
|
108
|
+
raw(): Promise<string>;
|
|
109
|
+
share(options?: {
|
|
110
|
+
maxConnections?: number;
|
|
111
|
+
}): Promise<string>;
|
|
112
|
+
grant(scope: GrantScope, options?: {
|
|
113
|
+
maxConnections?: number;
|
|
114
|
+
}): Promise<string>;
|
|
115
|
+
revoke(scope: GrantScope): Promise<string[]>;
|
|
116
|
+
}
|
|
117
|
+
interface OpenRTCDiagnosticsNamespace {
|
|
118
|
+
status(): Promise<{
|
|
119
|
+
runtime: 'tauri' | 'browser' | 'unknown';
|
|
120
|
+
wasmLoaded: boolean;
|
|
121
|
+
localNodeId?: string;
|
|
122
|
+
userId?: string;
|
|
123
|
+
}>;
|
|
124
|
+
policy(): RuntimePolicySnapshot;
|
|
125
|
+
capabilities(): RuntimeCapabilities;
|
|
126
|
+
capabilityProfile(): RuntimeCapabilityProfile;
|
|
127
|
+
connectionStates(): Promise<RuntimeConnectionStateSnapshot[]>;
|
|
128
|
+
onConnectionStateChange(callback: (state: RuntimeConnectionStateSnapshot) => void): Promise<() => void> | (() => void);
|
|
129
|
+
connections(): Connection[];
|
|
130
|
+
applicationReadyConnections(options?: RuntimeApplicationPayloadReadinessOptions): Connection[];
|
|
131
|
+
onConnection(callback: (connection: Connection) => void): () => void;
|
|
132
|
+
onDisconnection(callback: (connection: Connection) => void): () => void;
|
|
133
|
+
onConnectionEvent(callback: (event: RuntimeConnectionEvent) => void): () => void;
|
|
134
|
+
forceReconnectSnapshot(): void;
|
|
135
|
+
peerReconciliation(): Readonly<PeerReconciliationStats>;
|
|
136
|
+
}
|
|
137
|
+
interface OpenRTCAdvancedNamespace {
|
|
138
|
+
readonly runtime: RuntimeClient;
|
|
139
|
+
readonly assembly: PlutoRuntimeAssembly;
|
|
140
|
+
nodeId(): Promise<string>;
|
|
141
|
+
nodeIdFromTicket(ticket: string): Promise<string | null>;
|
|
142
|
+
endpointTicket(): Promise<string>;
|
|
143
|
+
connectRaw(target: {
|
|
144
|
+
ticket: string;
|
|
145
|
+
timeoutMs?: number;
|
|
146
|
+
}): Promise<RuntimeRawConnection>;
|
|
147
|
+
openBi(nodeId: string): Promise<{
|
|
148
|
+
readable: ReadableStream<Uint8Array>;
|
|
149
|
+
writable: WritableStream<Uint8Array>;
|
|
150
|
+
}>;
|
|
151
|
+
openUni(nodeId: string): Promise<WritableStream<Uint8Array>>;
|
|
152
|
+
isConnected(nodeId: string): Promise<boolean>;
|
|
153
|
+
disconnectNode(nodeId: string): Promise<void>;
|
|
154
|
+
setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
|
|
155
|
+
notifyNetworkChange(reason?: string): Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* OpenRTCClient extends RuntimeClient with auth helpers that were
|
|
159
|
+
* previously only available on PlutoRuntimeAssembly.
|
|
160
|
+
*
|
|
161
|
+
* This is the unified type returned by OpenRTC() and OpenRTC.native().
|
|
162
|
+
*/
|
|
163
|
+
interface OpenRTCClient extends RuntimeClient {
|
|
164
|
+
readonly devices: OpenRTCDeviceNamespace;
|
|
165
|
+
readonly peers: OpenRTCPeerNamespace;
|
|
166
|
+
readonly channels: OpenRTCChannelNamespace;
|
|
167
|
+
readonly rooms: OpenRTCRoomNamespace;
|
|
168
|
+
readonly tickets: OpenRTCTicketNamespace;
|
|
169
|
+
readonly diagnostics: OpenRTCDiagnosticsNamespace;
|
|
170
|
+
readonly advanced: OpenRTCAdvancedNamespace;
|
|
171
|
+
/** @deprecated Use setAuth() instead */
|
|
172
|
+
setAuthContext(context: AuthContext | null): Promise<void>;
|
|
173
|
+
/** Set auth context for the runtime */
|
|
174
|
+
setAuth(context: AuthContext | null): Promise<void>;
|
|
175
|
+
/** Sync Pluto-hosted auth to the runtime */
|
|
176
|
+
syncPlutoAuth(options?: {
|
|
177
|
+
userId?: string | null;
|
|
178
|
+
forceRefresh?: boolean;
|
|
179
|
+
}): Promise<void>;
|
|
180
|
+
/** Bind Pluto auth host to auto-sync on token changes */
|
|
181
|
+
bindPlutoAuthHost(): () => void;
|
|
182
|
+
/** Sign in via Pluto SSO */
|
|
183
|
+
signIn(): Promise<void>;
|
|
184
|
+
/** Sign out and clear auth context */
|
|
185
|
+
signOut(): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Use `client.devices.startSession(...)` for the public
|
|
188
|
+
* user-device avenue lifecycle. This top-level method remains for
|
|
189
|
+
* RuntimeClient compatibility and advanced integrations.
|
|
190
|
+
*/
|
|
191
|
+
startManagedSession(options: RuntimeManagedSessionOptions): Promise<RuntimeManagedSession>;
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated Use `client.devices.stopSession(...)` for the public
|
|
194
|
+
* user-device avenue lifecycle.
|
|
195
|
+
*/
|
|
196
|
+
stopManagedSession(options?: {
|
|
197
|
+
preserveBackendSession?: boolean;
|
|
198
|
+
}): Promise<void>;
|
|
199
|
+
/** @deprecated Use `client.rooms.create(...)`. */
|
|
200
|
+
createRoom(roomId?: string): Promise<string>;
|
|
201
|
+
/** @deprecated Use `client.rooms.join(...)`. */
|
|
202
|
+
joinRoom(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
203
|
+
/** @deprecated Use `client.rooms.leave(...)`. */
|
|
204
|
+
leaveRoom(roomId: string): Promise<void>;
|
|
205
|
+
/** @deprecated Use `client.rooms.watch(...)`. */
|
|
206
|
+
watchRoom(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
207
|
+
/** @deprecated Use `client.rooms.members(...)`. */
|
|
208
|
+
getRoomMembers(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
209
|
+
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
210
|
+
getInvite(): Promise<string>;
|
|
211
|
+
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
212
|
+
getTicket(): Promise<string>;
|
|
213
|
+
/** @deprecated Use `client.tickets.share(...)` or `client.tickets.grant(...)`. */
|
|
214
|
+
getTicketWithToken(scope: GrantScope, maxConnections?: number): Promise<string>;
|
|
215
|
+
/** @deprecated Use `client.tickets.revoke(...)`. */
|
|
216
|
+
revokeTokensByScope(scope: GrantScope): Promise<string[]>;
|
|
217
|
+
/** @deprecated Use `client.peers.connect(...)`. */
|
|
218
|
+
connectPeer(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
219
|
+
/** @deprecated Use `client.peers.connect(...)`. */
|
|
220
|
+
connectTo(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
221
|
+
/** @deprecated Use `client.peers.waitConnected(...)`. */
|
|
222
|
+
waitForConnectedPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
223
|
+
/** @deprecated Use `client.channels.connect(...)`; use `client.channels.connectScoped(...)` only for custom lifecycle scopes. */
|
|
224
|
+
connectScopedChannel(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
225
|
+
/** @deprecated Use `client.channels.openBi(...)`. */
|
|
226
|
+
openPeerBi(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
227
|
+
connection: Connection;
|
|
228
|
+
readable: ReadableStream<Uint8Array>;
|
|
229
|
+
writable: WritableStream<Uint8Array>;
|
|
230
|
+
}>;
|
|
231
|
+
/** @deprecated Use `client.channels.openUni(...)`. */
|
|
232
|
+
openPeerUni(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
233
|
+
connection: Connection;
|
|
234
|
+
writable: WritableStream<Uint8Array>;
|
|
235
|
+
}>;
|
|
236
|
+
/**
|
|
237
|
+
* Access to the underlying PlutoRuntimeAssembly for backward compatibility.
|
|
238
|
+
* @deprecated Access methods directly on the client instead.
|
|
239
|
+
*/
|
|
240
|
+
readonly runtime: RuntimeClient;
|
|
241
|
+
/**
|
|
242
|
+
* Access to the underlying PlutoRuntimeAssembly for backward compatibility.
|
|
243
|
+
* @internal
|
|
244
|
+
*/
|
|
245
|
+
readonly _assembly: PlutoRuntimeAssembly;
|
|
246
|
+
}
|
|
247
|
+
declare function resolveOptions(options: RuntimeClientOptions): RuntimeClientOptions;
|
|
248
|
+
declare function wrapAssembly(assembly: PlutoRuntimeAssembly, defaultManagedSessionPlatform: RuntimeManagedSessionOptions['platform']): OpenRTCClient;
|
|
249
|
+
|
|
250
|
+
export { type OpenRTCAdvancedNamespace, type OpenRTCChannelConnectOptions, type OpenRTCChannelNamespace, type OpenRTCClient, type OpenRTCDeviceNamespace, type OpenRTCDeviceSessionOptions, type OpenRTCDiagnosticsNamespace, type OpenRTCPeerNamespace, type OpenRTCRoomNamespace, type OpenRTCTicketNamespace, resolveOptions, wrapAssembly };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {n}from'./chunk-KJTJLLJE.js';import'./chunk-45WBH7E3.js';import'./chunk-NRXEG5GQ.js';function O(i){let s=n({...i});if("auth"in i&&!i.authMode){let n=i.auth;s.authMode=n==="none"?"anonymous":n;}if("identity"in i){let n=i.identity,r=n==="temporary"?"ephemeral":n;!i.deviceIdPersistence&&!i.nodeIdPersistence&&(s.deviceIdPersistence=r),!i.endpointIdPersistence&&!i.nodeIdPersistence&&(s.endpointIdPersistence=r);}return "namespace"in i&&!i.storagePrefix&&(s.storagePrefix=i.namespace),"privacy"in i&&i.strictMode===void 0&&(s.strictMode=!!i.privacy),s}function I(i,s){let n=i.runtime,r=Object.create(n),l=async e=>{if(typeof e!="string")return e;let o=(await n.listDevices()).find(c=>c.deviceId===e);if(!o)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return o},u=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),R=async e=>{let{device:t,scope:o,...c}=e,a=c.deviceId??(typeof t=="string"?t:t?.deviceId)??null,m=c.ticket??(typeof t=="string"?void 0:t?.ticket);a&&!m&&(m=(await l(a).catch(()=>null))?.ticket);let d={...c,scope:o??"session"};return a&&(d.deviceId=a),m&&(d.ticket=m),d},g={list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??s}),stopSession:e=>n.stopManagedSession(e),listWithStatus:()=>n.listDevicesWithStatus(),watch:e=>n.watchDevices(e),watchWithStatus:e=>n.watchDevicesWithStatus(e),connect:async(e,t)=>n.connectDevice(await l(e),await u(t)),connectWithRetry:async(e,t,o)=>n.connectDeviceWithRetry(await l(e),t,o),disconnect:e=>n.disconnectDevice(e),update:(e,t)=>n.updateDevice(e,t),delete:e=>n.deleteDevice(e),localId:()=>n.getLocalDeviceId(),localInfo:()=>n.getLocalDeviceInfo(),localProfile:e=>n.getLocalDeviceProfile(e),updateLocalName:e=>n.updateLocalDeviceName(e)},v={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,t)=>n.disconnectPeer(e,t),forceDisconnect:e=>n.forceDisconnectPeer(e),session:e=>n.getPeerSession(e),sessions:()=>n.listPeerSessions(),waitConnected:(e,t)=>n.waitForConnectedPeer(e,t),readiness:(e,t)=>n.getPeerReadiness(e,t),health:e=>n.getPeerHealth(e),identity:e=>n.resolvePeerIdentity(e),addScope:(e,t)=>n.addPeerScope(e,t),releaseScope:(e,t)=>n.releasePeerScope(e,t),scopes:e=>n.getPeerScopes(e),refresh:()=>n.refreshPeerSnapshot()},C={register:e=>n.registerChannel(e),unregister:e=>n.unregisterChannel(e),list:()=>n.listChannels(),openBi:(e,t,o)=>n.openPeerBi(e,{...o,channelId:t}),openUni:(e,t,o)=>n.openPeerUni(e,{...o,channelId:t}),onIncoming:e=>n.onIncomingStream(e),onIncomingChannel:(e,t)=>n.onIncomingChannelStream(e,o=>{if(o.channel)return t(o)}),connect:async e=>n.connectScopedChannel(await R(e)),connectScoped:e=>n.connectScopedChannel(e)},P={create:e=>n.createRoom(e),join:(e,t)=>n.joinRoom(e,t),leave:e=>n.leaveRoom(e),watch:(e,t)=>n.watchRoom(e,t),members:e=>n.getRoomMembers(e)},h={raw:()=>n.getInvite(),share:e=>n.getTicketWithToken("share",e?.maxConnections??1),grant:(e,t)=>n.getTicketWithToken(e,t?.maxConnections??0),revoke:e=>n.revokeTokensByScope(e)},S={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()},b={runtime:n,assembly:i,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,t)=>n.setAutoConnectExcluded(e,t),notifyNetworkChange:e=>n.notifyNetworkChange(e)};return Object.defineProperties(r,{devices:{get:()=>g,enumerable:true},peers:{get:()=>v,enumerable:true},channels:{get:()=>C,enumerable:true},rooms:{get:()=>P,enumerable:true},tickets:{get:()=>h,enumerable:true},diagnostics:{get:()=>S,enumerable:true},advanced:{get:()=>b,enumerable:true},setAuth:{value:e=>i.setAuthContext(e),enumerable:true,writable:true,configurable:true},setAuthContext:{value:e=>i.setAuthContext(e),enumerable:true,writable:true,configurable:true},syncPlutoAuth:{value:e=>i.syncPlutoAuth(e),enumerable:true,writable:true,configurable:true},bindPlutoAuthHost:{value:()=>i.bindPlutoAuthHost(),enumerable:true,writable:true,configurable:true},signIn:{value:()=>i.signInWithPluto(),enumerable:true,writable:true,configurable:true},signOut:{value:()=>i.signOut(),enumerable:true,writable:true,configurable:true},runtime:{get:()=>n,enumerable:false},_assembly:{get:()=>i,enumerable:false}}),r}export{O as resolveOptions,I as wrapAssembly};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{y as WasmBridge}from'./chunk-VOCOZ57Q.js';import'./chunk-AG2F6MOB.js';import'./chunk-CWGKLGJZ.js';import'./chunk-KJTJLLJE.js';import'./chunk-45WBH7E3.js';import'./chunk-NRXEG5GQ.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile } from './capabilities-YSskrE8H.js';
|
|
1
|
+
import { a as RuntimePeerState, j as RuntimeConnectionStateSnapshot, c as RuntimePeerReadinessSnapshot, b as RuntimePeerConnectOptions, C as Connection, f as RuntimeIncomingStream, v as RuntimeClientOptions, z as RuntimeAuthIdentity, A as AuthContext, q as RuntimeLocalDeviceInfo, r as RuntimeLocalDeviceProfile, I as IrohBrowserProtocolStore, w as IrohNamespaceDescriptor, x as IrohMutationReceipt, y as IrohDocEntry, h as RuntimeDevice, m as RuntimeManagedSessionOptions, n as RuntimeManagedSession, o as RuntimeDeviceStatusSnapshot, p as RuntimeDeviceConnectOptions, B as RuntimeSession, t as RuntimeJoinRoomOptions, u as RuntimeRoomMember, D as RuntimeConnectionTarget, g as RuntimeScopedChannelOptions, i as RuntimeScopedLogicalChannel, e as RuntimePeerStreamOptions, s as RuntimeRawConnection, R as RuntimeChannelDescriptor, E as RuntimePresenceLoopOptions, d as RuntimePeerHealth, k as RuntimeApplicationPayloadReadinessOptions, l as RuntimeConnectionEvent } from './types-DVNSd5B9.js';
|
|
2
|
+
import { G as GrantScope, I as ISignalingBackend, e as ConnectDeviceHooks, f as ConnectDeviceOptions, C as ConnectDeviceResult, M as ManagedConnectionRecord, d as PeerSessionSnapshot, R as ResolvedPeerIdentity, a4 as AppLimits, N as NativeConnectParams, q as NativeConnectResult, E as ExplicitFileDataSendParams } from './ITransport-WV6gGMnX.js';
|
|
3
|
+
import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile } from './capabilities-BfZi4Cd7.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Coalesced peer reconciliation scheduler and full reconcile orchestration.
|
|
@@ -230,7 +229,6 @@ interface RuntimePolicySnapshot {
|
|
|
230
229
|
nativeStartRetryWindowMs: number;
|
|
231
230
|
nativeStartRetryMinDelayMs: number;
|
|
232
231
|
nativeStartRetryMaxDelayMs: number;
|
|
233
|
-
reconciliationIntervalMs: number;
|
|
234
232
|
deviceStatusRefreshDebounceMs: number;
|
|
235
233
|
};
|
|
236
234
|
browserAutoConnect: {
|
|
@@ -281,7 +279,6 @@ declare class RuntimeClient {
|
|
|
281
279
|
private static readonly NATIVE_START_RETRY_WINDOW_MS;
|
|
282
280
|
private static readonly NATIVE_START_RETRY_MIN_DELAY_MS;
|
|
283
281
|
private static readonly NATIVE_START_RETRY_MAX_DELAY_MS;
|
|
284
|
-
private static readonly MANAGED_RECONCILIATION_INTERVAL_MS;
|
|
285
282
|
private static readonly DEVICE_STATUS_REFRESH_DEBOUNCE_MS;
|
|
286
283
|
private static readonly MANAGED_USER_DEVICE_SCOPE;
|
|
287
284
|
static readonly MANAGED_FRIEND_SCOPE: GrantScope;
|
|
@@ -298,7 +295,6 @@ declare class RuntimeClient {
|
|
|
298
295
|
private managedSessionStartInFlight;
|
|
299
296
|
private terminalShutdown;
|
|
300
297
|
private readonly managedReconciliationTasks;
|
|
301
|
-
private managedReconciliationTimer;
|
|
302
298
|
private readonly managedReconciliationFollowupTimers;
|
|
303
299
|
/**
|
|
304
300
|
* The one per-`{scope, peerNodeId}` observer-side dial coalescer. It is
|
|
@@ -367,6 +363,39 @@ declare class RuntimeClient {
|
|
|
367
363
|
getManagedNodeId(options?: {
|
|
368
364
|
initializeIfMissing?: boolean;
|
|
369
365
|
}): Promise<string | null>;
|
|
366
|
+
/**
|
|
367
|
+
* Enable upstream Iroh docs, blobs, and gossip on this runtime's existing
|
|
368
|
+
* browser endpoint. The host store supplies durable IndexedDB operations;
|
|
369
|
+
* no second endpoint, router, presence loop, or reconnect owner is created.
|
|
370
|
+
*/
|
|
371
|
+
initializeIrohProtocols(store: IrohBrowserProtocolStore): Promise<void>;
|
|
372
|
+
createIrohNamespace(options?: {
|
|
373
|
+
generation?: number;
|
|
374
|
+
shareRevision?: number;
|
|
375
|
+
}): Promise<IrohNamespaceDescriptor>;
|
|
376
|
+
importIrohTicket(ticket: string, options?: {
|
|
377
|
+
generation?: number;
|
|
378
|
+
shareRevision?: number;
|
|
379
|
+
}): Promise<string>;
|
|
380
|
+
shareIrohNamespace(namespaceId: string, options?: {
|
|
381
|
+
writable?: boolean;
|
|
382
|
+
}): Promise<string>;
|
|
383
|
+
removeIrohNamespace(namespaceId: string, options?: {
|
|
384
|
+
generation?: number;
|
|
385
|
+
shareRevision?: number;
|
|
386
|
+
}): Promise<void>;
|
|
387
|
+
putIrohBytes(namespaceId: string, key: Uint8Array, value: Uint8Array): Promise<IrohMutationReceipt>;
|
|
388
|
+
setIrohHash(namespaceId: string, key: Uint8Array, contentHash: string, contentLength: number): Promise<string>;
|
|
389
|
+
deleteIrohPrefix(namespaceId: string, prefix: Uint8Array): Promise<{
|
|
390
|
+
removed: number;
|
|
391
|
+
operationId: string;
|
|
392
|
+
}>;
|
|
393
|
+
queryIrohNamespace(namespaceId: string, keyPrefix?: Uint8Array<ArrayBuffer>): Promise<IrohDocEntry[]>;
|
|
394
|
+
hydrateIrohBlob(contentHash: string): Promise<void>;
|
|
395
|
+
acknowledgeIrohOutbox(operationId: string): Promise<void>;
|
|
396
|
+
flushIrohProtocols(): Promise<void>;
|
|
397
|
+
private persistentIrohProtocolBackend;
|
|
398
|
+
private assertProtocolCounter;
|
|
370
399
|
getTicket(): Promise<string>;
|
|
371
400
|
/**
|
|
372
401
|
* Generate a session-scoped endpoint ticket with an embedded random token.
|
|
@@ -378,6 +407,19 @@ declare class RuntimeClient {
|
|
|
378
407
|
* @param maxConnections 0 = unlimited.
|
|
379
408
|
*/
|
|
380
409
|
getTicketWithToken(grantScope: GrantScope, maxConnections?: number): Promise<string>;
|
|
410
|
+
/**
|
|
411
|
+
* Register a product-issued admission token with the active runtime.
|
|
412
|
+
*
|
|
413
|
+
* Product code supplies the durable authorization decision, while OpenRTC
|
|
414
|
+
* remains the sole owner of the native/WASM admission registry. Restricted
|
|
415
|
+
* grants should always include their server-issued expiry.
|
|
416
|
+
*/
|
|
417
|
+
registerAdmissionToken(input: {
|
|
418
|
+
token: string;
|
|
419
|
+
scope: GrantScope;
|
|
420
|
+
maxConnections?: number;
|
|
421
|
+
expiresAtMs?: number;
|
|
422
|
+
}): Promise<void>;
|
|
381
423
|
/** Revoke all session tokens that match the given scope. */
|
|
382
424
|
revokeTokensByScope(grantScope: GrantScope): Promise<string[]>;
|
|
383
425
|
private revokeTokensByScopeInternal;
|
|
@@ -675,6 +717,7 @@ declare class RuntimeClient {
|
|
|
675
717
|
type RuntimeAdapterWithAuth = ISignalingBackend & {
|
|
676
718
|
setAuthContext?: (context: AuthContext | null) => Promise<void> | void;
|
|
677
719
|
};
|
|
720
|
+
type RuntimeFactoryOptions = RuntimeClientOptions;
|
|
678
721
|
interface PlutoRuntimeAssembly<TBackend extends RuntimeAdapterWithAuth = RuntimeAdapterWithAuth> {
|
|
679
722
|
runtime: RuntimeClient;
|
|
680
723
|
identity: any;
|
|
@@ -699,246 +742,4 @@ interface PlutoRuntimeAssembly<TBackend extends RuntimeAdapterWithAuth = Runtime
|
|
|
699
742
|
setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
|
|
700
743
|
}
|
|
701
744
|
|
|
702
|
-
type
|
|
703
|
-
/**
|
|
704
|
-
* Device selected from `client.devices.*`. Passing the device object lets
|
|
705
|
-
* OpenRTC reuse its current ticket for native and ticket-gated routes.
|
|
706
|
-
*/
|
|
707
|
-
device?: string | RuntimeDevice;
|
|
708
|
-
deviceId?: string | null;
|
|
709
|
-
ticket?: string;
|
|
710
|
-
/**
|
|
711
|
-
* Logical channel lifecycle scope. Most app channels should use the default
|
|
712
|
-
* `session`; pass a custom scope only when you intentionally manage peer
|
|
713
|
-
* lifecycle separately from the channel.
|
|
714
|
-
*/
|
|
715
|
-
scope?: RuntimeScopedChannelOptions['scope'];
|
|
716
|
-
};
|
|
717
|
-
type OpenRTCDeviceSessionOptions = Omit<RuntimeManagedSessionOptions, 'platform'> & {
|
|
718
|
-
/**
|
|
719
|
-
* Runtime host for the managed user-device session. Normal apps can omit
|
|
720
|
-
* this: `OpenRTC(...)` defaults to `web`, and `OpenRTC.native(...)` defaults
|
|
721
|
-
* to `native`.
|
|
722
|
-
*/
|
|
723
|
-
platform?: RuntimeManagedSessionOptions['platform'];
|
|
724
|
-
};
|
|
725
|
-
interface OpenRTCDeviceNamespace {
|
|
726
|
-
startSession(options?: OpenRTCDeviceSessionOptions): Promise<RuntimeManagedSession>;
|
|
727
|
-
stopSession(options?: {
|
|
728
|
-
preserveBackendSession?: boolean;
|
|
729
|
-
}): Promise<void>;
|
|
730
|
-
list(): Promise<RuntimeDevice[]>;
|
|
731
|
-
listWithStatus(): Promise<RuntimeDeviceStatusSnapshot[]>;
|
|
732
|
-
watch(callback: (devices: RuntimeDevice[]) => void): () => void;
|
|
733
|
-
watchWithStatus(callback: (devices: RuntimeDeviceStatusSnapshot[]) => void): () => void;
|
|
734
|
-
connect(device: string | RuntimeDevice, options?: RuntimeDeviceConnectOptions): Promise<ConnectDeviceResult>;
|
|
735
|
-
/**
|
|
736
|
-
* @deprecated Use `devices.connect()`. Retry and route recovery are owned by
|
|
737
|
-
* OpenRTC; legacy consumer-provided connection hooks are ignored.
|
|
738
|
-
*/
|
|
739
|
-
connectWithRetry(device: string | RuntimeDevice, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise<ConnectDeviceResult>;
|
|
740
|
-
disconnect(deviceId: string): Promise<void>;
|
|
741
|
-
update(deviceId: string, updates: {
|
|
742
|
-
deviceName?: string;
|
|
743
|
-
capabilities?: RuntimeDevice['capabilities'];
|
|
744
|
-
metadata?: string;
|
|
745
|
-
}): Promise<void>;
|
|
746
|
-
delete(deviceId: string): Promise<void>;
|
|
747
|
-
localId(): Promise<string | null>;
|
|
748
|
-
localInfo(): Promise<RuntimeLocalDeviceInfo | null>;
|
|
749
|
-
localProfile(options?: {
|
|
750
|
-
deviceName?: string;
|
|
751
|
-
localDeviceId?: string | null;
|
|
752
|
-
platform?: 'native' | 'web';
|
|
753
|
-
userId?: string | null;
|
|
754
|
-
}): Promise<RuntimeLocalDeviceProfile>;
|
|
755
|
-
updateLocalName(deviceName: string): Promise<RuntimeLocalDeviceInfo | null>;
|
|
756
|
-
}
|
|
757
|
-
interface OpenRTCPeerNamespace {
|
|
758
|
-
watch(callback: (peers: RuntimePeerState[]) => void): () => void;
|
|
759
|
-
watchLifecycle(callback: (peers: RuntimePeerState[]) => void): () => void;
|
|
760
|
-
get(id: string): RuntimePeerState | undefined;
|
|
761
|
-
listConnected(): RuntimePeerState[];
|
|
762
|
-
connect(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
763
|
-
disconnect(id: string, scope?: string): Promise<void>;
|
|
764
|
-
forceDisconnect(id: string): Promise<void>;
|
|
765
|
-
session(id: string): Promise<PeerSessionSnapshot | null>;
|
|
766
|
-
sessions(): Promise<PeerSessionSnapshot[]>;
|
|
767
|
-
waitConnected(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
768
|
-
readiness(id: string, timeoutMs?: number): Promise<RuntimePeerReadinessSnapshot>;
|
|
769
|
-
health(id: string): Promise<RuntimePeerHealth>;
|
|
770
|
-
identity(id: string): Promise<ResolvedPeerIdentity>;
|
|
771
|
-
addScope(id: string, scope?: string): RuntimePeerState | undefined;
|
|
772
|
-
releaseScope(id: string, scope?: string): RuntimePeerState | undefined;
|
|
773
|
-
scopes(id: string): string[];
|
|
774
|
-
refresh(): Promise<RuntimePeerState[]>;
|
|
775
|
-
}
|
|
776
|
-
interface OpenRTCChannelNamespace {
|
|
777
|
-
register(descriptor: RuntimeChannelDescriptor): void;
|
|
778
|
-
unregister(channelId: string): void;
|
|
779
|
-
list(): RuntimeChannelDescriptor[];
|
|
780
|
-
openBi(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
|
|
781
|
-
connection: Connection;
|
|
782
|
-
readable: ReadableStream<Uint8Array>;
|
|
783
|
-
writable: WritableStream<Uint8Array>;
|
|
784
|
-
}>;
|
|
785
|
-
openUni(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
|
|
786
|
-
connection: Connection;
|
|
787
|
-
writable: WritableStream<Uint8Array>;
|
|
788
|
-
}>;
|
|
789
|
-
onIncoming(callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
|
|
790
|
-
onIncomingChannel(channelId: string, callback: (stream: RuntimeIncomingStream & {
|
|
791
|
-
channel: NonNullable<RuntimeIncomingStream['channel']>;
|
|
792
|
-
}) => boolean | void): () => void;
|
|
793
|
-
connect(options: OpenRTCChannelConnectOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
794
|
-
connectScoped(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
795
|
-
}
|
|
796
|
-
interface OpenRTCRoomNamespace {
|
|
797
|
-
create(roomId?: string): Promise<string>;
|
|
798
|
-
join(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
799
|
-
leave(roomId: string): Promise<void>;
|
|
800
|
-
watch(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
801
|
-
members(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
802
|
-
}
|
|
803
|
-
interface OpenRTCTicketNamespace {
|
|
804
|
-
raw(): Promise<string>;
|
|
805
|
-
share(options?: {
|
|
806
|
-
maxConnections?: number;
|
|
807
|
-
}): Promise<string>;
|
|
808
|
-
grant(scope: GrantScope, options?: {
|
|
809
|
-
maxConnections?: number;
|
|
810
|
-
}): Promise<string>;
|
|
811
|
-
revoke(scope: GrantScope): Promise<string[]>;
|
|
812
|
-
}
|
|
813
|
-
interface OpenRTCDiagnosticsNamespace {
|
|
814
|
-
status(): Promise<{
|
|
815
|
-
runtime: 'tauri' | 'browser' | 'unknown';
|
|
816
|
-
wasmLoaded: boolean;
|
|
817
|
-
localNodeId?: string;
|
|
818
|
-
userId?: string;
|
|
819
|
-
}>;
|
|
820
|
-
policy(): RuntimePolicySnapshot;
|
|
821
|
-
capabilities(): RuntimeCapabilities;
|
|
822
|
-
capabilityProfile(): RuntimeCapabilityProfile;
|
|
823
|
-
connectionStates(): Promise<RuntimeConnectionStateSnapshot[]>;
|
|
824
|
-
onConnectionStateChange(callback: (state: RuntimeConnectionStateSnapshot) => void): Promise<() => void> | (() => void);
|
|
825
|
-
connections(): Connection[];
|
|
826
|
-
applicationReadyConnections(options?: RuntimeApplicationPayloadReadinessOptions): Connection[];
|
|
827
|
-
onConnection(callback: (connection: Connection) => void): () => void;
|
|
828
|
-
onDisconnection(callback: (connection: Connection) => void): () => void;
|
|
829
|
-
onConnectionEvent(callback: (event: RuntimeConnectionEvent) => void): () => void;
|
|
830
|
-
forceReconnectSnapshot(): void;
|
|
831
|
-
peerReconciliation(): Readonly<PeerReconciliationStats>;
|
|
832
|
-
}
|
|
833
|
-
interface OpenRTCAdvancedNamespace {
|
|
834
|
-
readonly runtime: RuntimeClient;
|
|
835
|
-
readonly assembly: PlutoRuntimeAssembly;
|
|
836
|
-
nodeId(): Promise<string>;
|
|
837
|
-
nodeIdFromTicket(ticket: string): Promise<string | null>;
|
|
838
|
-
endpointTicket(): Promise<string>;
|
|
839
|
-
connectRaw(target: {
|
|
840
|
-
ticket: string;
|
|
841
|
-
timeoutMs?: number;
|
|
842
|
-
}): Promise<RuntimeRawConnection>;
|
|
843
|
-
openBi(nodeId: string): Promise<{
|
|
844
|
-
readable: ReadableStream<Uint8Array>;
|
|
845
|
-
writable: WritableStream<Uint8Array>;
|
|
846
|
-
}>;
|
|
847
|
-
openUni(nodeId: string): Promise<WritableStream<Uint8Array>>;
|
|
848
|
-
isConnected(nodeId: string): Promise<boolean>;
|
|
849
|
-
disconnectNode(nodeId: string): Promise<void>;
|
|
850
|
-
setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
|
|
851
|
-
notifyNetworkChange(reason?: string): Promise<void>;
|
|
852
|
-
}
|
|
853
|
-
/**
|
|
854
|
-
* OpenRTCClient extends RuntimeClient with auth helpers that were
|
|
855
|
-
* previously only available on PlutoRuntimeAssembly.
|
|
856
|
-
*
|
|
857
|
-
* This is the unified type returned by OpenRTC() and OpenRTC.native().
|
|
858
|
-
*/
|
|
859
|
-
interface OpenRTCClient extends RuntimeClient {
|
|
860
|
-
readonly devices: OpenRTCDeviceNamespace;
|
|
861
|
-
readonly peers: OpenRTCPeerNamespace;
|
|
862
|
-
readonly channels: OpenRTCChannelNamespace;
|
|
863
|
-
readonly rooms: OpenRTCRoomNamespace;
|
|
864
|
-
readonly tickets: OpenRTCTicketNamespace;
|
|
865
|
-
readonly diagnostics: OpenRTCDiagnosticsNamespace;
|
|
866
|
-
readonly advanced: OpenRTCAdvancedNamespace;
|
|
867
|
-
/** @deprecated Use setAuth() instead */
|
|
868
|
-
setAuthContext(context: AuthContext | null): Promise<void>;
|
|
869
|
-
/** Set auth context for the runtime */
|
|
870
|
-
setAuth(context: AuthContext | null): Promise<void>;
|
|
871
|
-
/** Sync Pluto-hosted auth to the runtime */
|
|
872
|
-
syncPlutoAuth(options?: {
|
|
873
|
-
userId?: string | null;
|
|
874
|
-
forceRefresh?: boolean;
|
|
875
|
-
}): Promise<void>;
|
|
876
|
-
/** Bind Pluto auth host to auto-sync on token changes */
|
|
877
|
-
bindPlutoAuthHost(): () => void;
|
|
878
|
-
/** Sign in via Pluto SSO */
|
|
879
|
-
signIn(): Promise<void>;
|
|
880
|
-
/** Sign out and clear auth context */
|
|
881
|
-
signOut(): Promise<void>;
|
|
882
|
-
/**
|
|
883
|
-
* @deprecated Use `client.devices.startSession(...)` for the public
|
|
884
|
-
* user-device avenue lifecycle. This top-level method remains for
|
|
885
|
-
* RuntimeClient compatibility and advanced integrations.
|
|
886
|
-
*/
|
|
887
|
-
startManagedSession(options: RuntimeManagedSessionOptions): Promise<RuntimeManagedSession>;
|
|
888
|
-
/**
|
|
889
|
-
* @deprecated Use `client.devices.stopSession(...)` for the public
|
|
890
|
-
* user-device avenue lifecycle.
|
|
891
|
-
*/
|
|
892
|
-
stopManagedSession(options?: {
|
|
893
|
-
preserveBackendSession?: boolean;
|
|
894
|
-
}): Promise<void>;
|
|
895
|
-
/** @deprecated Use `client.rooms.create(...)`. */
|
|
896
|
-
createRoom(roomId?: string): Promise<string>;
|
|
897
|
-
/** @deprecated Use `client.rooms.join(...)`. */
|
|
898
|
-
joinRoom(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
899
|
-
/** @deprecated Use `client.rooms.leave(...)`. */
|
|
900
|
-
leaveRoom(roomId: string): Promise<void>;
|
|
901
|
-
/** @deprecated Use `client.rooms.watch(...)`. */
|
|
902
|
-
watchRoom(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
903
|
-
/** @deprecated Use `client.rooms.members(...)`. */
|
|
904
|
-
getRoomMembers(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
905
|
-
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
906
|
-
getInvite(): Promise<string>;
|
|
907
|
-
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
908
|
-
getTicket(): Promise<string>;
|
|
909
|
-
/** @deprecated Use `client.tickets.share(...)` or `client.tickets.grant(...)`. */
|
|
910
|
-
getTicketWithToken(scope: GrantScope, maxConnections?: number): Promise<string>;
|
|
911
|
-
/** @deprecated Use `client.tickets.revoke(...)`. */
|
|
912
|
-
revokeTokensByScope(scope: GrantScope): Promise<string[]>;
|
|
913
|
-
/** @deprecated Use `client.peers.connect(...)`. */
|
|
914
|
-
connectPeer(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
915
|
-
/** @deprecated Use `client.peers.connect(...)`. */
|
|
916
|
-
connectTo(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
917
|
-
/** @deprecated Use `client.peers.waitConnected(...)`. */
|
|
918
|
-
waitForConnectedPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
919
|
-
/** @deprecated Use `client.channels.connect(...)`; use `client.channels.connectScoped(...)` only for custom lifecycle scopes. */
|
|
920
|
-
connectScopedChannel(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
921
|
-
/** @deprecated Use `client.channels.openBi(...)`. */
|
|
922
|
-
openPeerBi(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
923
|
-
connection: Connection;
|
|
924
|
-
readable: ReadableStream<Uint8Array>;
|
|
925
|
-
writable: WritableStream<Uint8Array>;
|
|
926
|
-
}>;
|
|
927
|
-
/** @deprecated Use `client.channels.openUni(...)`. */
|
|
928
|
-
openPeerUni(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
929
|
-
connection: Connection;
|
|
930
|
-
writable: WritableStream<Uint8Array>;
|
|
931
|
-
}>;
|
|
932
|
-
/**
|
|
933
|
-
* Access to the underlying PlutoRuntimeAssembly for backward compatibility.
|
|
934
|
-
* @deprecated Access methods directly on the client instead.
|
|
935
|
-
*/
|
|
936
|
-
readonly runtime: RuntimeClient;
|
|
937
|
-
/**
|
|
938
|
-
* Access to the underlying PlutoRuntimeAssembly for backward compatibility.
|
|
939
|
-
* @internal
|
|
940
|
-
*/
|
|
941
|
-
readonly _assembly: PlutoRuntimeAssembly;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
export { DriveGrantActorError as D, type OpenRTCPeerNamespace as O, type PeerReconciliationStats as P, RuntimeClient as R, type OpenRTCChannelNamespace as a, type OpenRTCDiagnosticsNamespace as b, type OpenRTCDeviceNamespace as c, type OpenRTCClient as d, OPENRTC_RUNTIME_POLICY as e, type RuntimePolicySnapshot as f, type DriveGrantActorErrorKind as g, DriveGrantActorHandle as h, type DriveGrantActorHandleOptions as i, DriveGrantActorRegistry as j, type DriveGrantActorState as k, type DriveGrantClose as l, type DriveGrantDial as m, type DriveGrantConnectionKey as n, type DriveGrantLogicalChannelHandle as o, type DriveGrantPreferredTransport as p, getRuntimePolicy as q, driveGrantConnectionKey as r, driveGrantConnectionKeyToString as s };
|
|
745
|
+
export { DriveGrantActorError as D, OPENRTC_RUNTIME_POLICY as O, type PeerReconciliationStats as P, type RuntimePolicySnapshot as R, RuntimeClient as a, type PlutoRuntimeAssembly as b, type RuntimeFactoryOptions as c, type DriveGrantActorErrorKind as d, DriveGrantActorHandle as e, type DriveGrantActorHandleOptions as f, DriveGrantActorRegistry as g, type DriveGrantActorState as h, type DriveGrantClose as i, type DriveGrantDial as j, type DriveGrantConnectionKey as k, type DriveGrantLogicalChannelHandle as l, type DriveGrantPreferredTransport as m, getRuntimePolicy as n, driveGrantConnectionKey as o, driveGrantConnectionKeyToString as p };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { c as ProtocolName, T as TransportOptimization } from './ITransport-WV6gGMnX.js';
|
|
2
|
+
|
|
1
3
|
type RuntimeAdapterKind = 'browser-wasm' | 'native-ipc' | 'tauri-ipc' | 'unknown';
|
|
2
4
|
interface RuntimeCapabilities {
|
|
3
5
|
adapter: RuntimeAdapterKind;
|
|
@@ -73,6 +75,8 @@ interface NativeRuntimeStatusSnapshot {
|
|
|
73
75
|
ble?: NativeRuntimeTransportFeatureStatus;
|
|
74
76
|
irohRelayOnly?: boolean;
|
|
75
77
|
irohRelayTransportPolicy?: string | null;
|
|
78
|
+
routePriority?: ProtocolName[];
|
|
79
|
+
optimizeFor?: TransportOptimization;
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
declare const BROWSER_WASM_RUNTIME_CAPABILITIES: RuntimeCapabilities;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.freeze([Object.freeze({id:"iroh-lan",baseProtocol:"iroh",family:"iroh-path",implementation:"path-label",locality:"nearby",maturity:"stable",defaultRank:0,browser:false,native:true,independentlyInstantiable:false}),Object.freeze({id:"webrtc-lan",baseProtocol:"webrtc",family:"optional-route",implementation:"path-label",locality:"nearby",maturity:"stable",defaultRank:1,browser:true,native:true,independentlyInstantiable:false}),Object.freeze({id:"ble",baseProtocol:"iroh",family:"iroh-physical",implementation:"host-installed",locality:"nearby",maturity:"experimental",defaultRank:2,browser:false,native:true,independentlyInstantiable:false}),Object.freeze({id:"iroh-webrtc",baseProtocol:"iroh",family:"iroh-physical",implementation:"carrier-adapter",locality:"mixed",maturity:"stable",defaultRank:3,browser:true,native:true,independentlyInstantiable:false}),Object.freeze({id:"webrtc",baseProtocol:"webrtc",family:"optional-route",implementation:"route-adapter",locality:"mixed",maturity:"stable",defaultRank:4,browser:true,native:true,independentlyInstantiable:true}),Object.freeze({id:"iroh-moq",baseProtocol:"iroh",family:"iroh-physical",implementation:"carrier-adapter",locality:"relay",maturity:"experimental",defaultRank:5,browser:true,native:true,independentlyInstantiable:false}),Object.freeze({id:"moq",baseProtocol:"moq",family:"optional-route",implementation:"route-adapter",locality:"relay",maturity:"experimental",defaultRank:6,browser:true,native:true,independentlyInstantiable:true}),Object.freeze({id:"iroh",baseProtocol:"iroh",family:"iroh-path",implementation:"core",locality:"mixed",maturity:"stable",defaultRank:7,browser:true,native:true,independentlyInstantiable:false}),Object.freeze({id:"iroh-quic",baseProtocol:"iroh",family:"iroh-path",implementation:"path-label",locality:"direct-internet",maturity:"stable",defaultRank:8,browser:false,native:true,independentlyInstantiable:false}),Object.freeze({id:"iroh-relay",baseProtocol:"iroh",family:"iroh-path",implementation:"path-label",locality:"relay",maturity:"stable",defaultRank:9,browser:true,native:true,independentlyInstantiable:false}),Object.freeze({id:"webrtc-turn",baseProtocol:"webrtc",family:"optional-route",implementation:"path-label",locality:"relay",maturity:"stable",defaultRank:10,browser:true,native:true,independentlyInstantiable:false})]),r=Object.freeze(Object.fromEntries(t.map(e=>[e.id,e]))),o=Object.freeze(["iroh-lan","webrtc-lan","ble","iroh-webrtc","webrtc","iroh-moq","moq","iroh","iroh-quic","iroh-relay","webrtc-turn"]),a=Object.freeze(["iroh-lan","webrtc-lan","ble","iroh-webrtc","webrtc","iroh-moq","moq","iroh"]),i=Object.freeze({iroh:80,"iroh-quic":30,"iroh-relay":70,"iroh-lan":10,ble:25,"iroh-webrtc":27,webrtc:40,"webrtc-lan":20,"webrtc-turn":60,"iroh-moq":55,moq:50});var l=t,n=r,R=o,s=a,m=i;function p(e){return n[e]}function u(){return l}export{l as a,R as b,s as c,m as d,p as e,u as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-VBUDERMM.js';function p(){let r=crypto.getRandomValues(new Uint8Array(24)),e="";for(let t of r)e+=String.fromCharCode(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function u(r){if(!r||typeof r!="object")throw new Error("[OpenRTC] Native host returned no device public key.");let e=r;if(e.kty!=="OKP"||e.crv!=="Ed25519"||typeof e.x!="string"||!/^[A-Za-z0-9_-]{43}$/.test(e.x)||e.d!==void 0)throw new Error("[OpenRTC] Native host returned an invalid Ed25519 public key.");return {kty:"OKP",crv:"Ed25519",x:e.x}}function v(r){return {async readSecureRecord(e,t){return r.invoke("openrtc_v2_read_secure_record",{appTag:e,key:t})},async writeSecureRecord(e,t,n){await r.invoke("openrtc_v2_write_secure_record",{appTag:e,key:t,value:n});},async deleteSecureRecord(e,t){await r.invoke("openrtc_v2_delete_secure_record",{appTag:e,key:t});},async delete(e){await r.invoke("openrtc_v2_delete_device_key",{appTag:e});},async getOrCreate(e){let t=u(await r.invoke("openrtc_v2_device_public_key",{appTag:e})),n=await a(t);return {publicKeyJwk:t,thumbprint:n,async proof(s){let o=p(),c=Math.floor(Date.now()/1e3),i=await r.invoke("openrtc_v2_sign_device_proof",{appTag:e,challenge:s(o,c)});if(!/^[A-Za-z0-9_-]{80,128}$/.test(i))throw new Error("[OpenRTC] Native host returned an invalid device proof.");return {publicKeyJwk:t,signature:i,nonce:o,issuedAt:c}}}}}}
|
|
2
|
+
export{v as a};
|