openrtc 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +1 -2
  2. package/dist/{core/types.d.ts → DelegatingRuntimeAdapter-CW8d78dZ.d.ts} +275 -95
  3. package/dist/IpcRuntimeAdapter-CT-W0Mtp.d.ts +24 -0
  4. package/dist/auth/index.d.ts +75 -1
  5. package/dist/auth/index.js +1 -1
  6. package/dist/auth/internal.d.ts +3 -1
  7. package/dist/auth/internal.js +1 -1
  8. package/dist/chunk-4MH42GUI.js +2 -0
  9. package/dist/chunk-CQAKCS2S.js +4 -0
  10. package/dist/chunk-D54VGRRH.js +1 -0
  11. package/dist/chunk-DIQYFAGL.js +2 -0
  12. package/dist/chunk-PZ25OCVG.js +2 -0
  13. package/dist/chunk-UVASANPG.js +1 -0
  14. package/dist/factories-0TxDPMeu.d.ts +1041 -0
  15. package/dist/index.d.ts +160 -3
  16. package/dist/index.js +1 -3
  17. package/dist/openrtc_bg.wasm +0 -0
  18. package/dist/runtime/WasmRuntimeAdapter.d.ts +5 -3
  19. package/dist/runtime/WasmRuntimeAdapter.js +1 -11
  20. package/dist/runtime/index.d.ts +796 -6
  21. package/dist/runtime/index.js +1 -5
  22. package/dist/runtime/tauri.d.ts +12 -8
  23. package/dist/runtime/tauri.js +1 -22
  24. package/package.json +11 -7
  25. package/wasm/openrtc.d.ts +61 -25
  26. package/wasm/openrtc.js +417 -259
  27. package/wasm/openrtc_bg.wasm +0 -0
  28. package/wasm/openrtc_bg.wasm.d.ts +27 -24
  29. package/wasm/package.json +1 -1
  30. package/dist/OpenRTC.d.ts +0 -71
  31. package/dist/OpenRTC.js +0 -130
  32. package/dist/api/MediaTransport.d.ts +0 -7
  33. package/dist/api/MediaTransport.js +0 -262
  34. package/dist/api/PlutoPeerConnection.d.ts +0 -50
  35. package/dist/api/PlutoPeerConnection.js +0 -434
  36. package/dist/api/PlutoWebSocket.d.ts +0 -24
  37. package/dist/api/PlutoWebSocket.js +0 -113
  38. package/dist/api/PlutoWebTransport.d.ts +0 -29
  39. package/dist/api/PlutoWebTransport.js +0 -105
  40. package/dist/auth/host.d.ts +0 -73
  41. package/dist/auth/host.js +0 -513
  42. package/dist/compat/index.d.ts +0 -20
  43. package/dist/compat/index.js +0 -20
  44. package/dist/core/Client.d.ts +0 -352
  45. package/dist/core/Client.js +0 -3689
  46. package/dist/core/Connection.d.ts +0 -67
  47. package/dist/core/Connection.js +0 -404
  48. package/dist/core/IEngineBridge.d.ts +0 -18
  49. package/dist/core/IEngineBridge.js +0 -1
  50. package/dist/core/ISignalingTransport.d.ts +0 -13
  51. package/dist/core/ISignalingTransport.js +0 -1
  52. package/dist/core/PeerLifecycleManager.d.ts +0 -43
  53. package/dist/core/PeerLifecycleManager.js +0 -330
  54. package/dist/core/PeerProjectionStore.d.ts +0 -43
  55. package/dist/core/PeerProjectionStore.js +0 -327
  56. package/dist/core/PlutoRTC.d.ts +0 -13
  57. package/dist/core/PlutoRTC.js +0 -26
  58. package/dist/core/Room.d.ts +0 -47
  59. package/dist/core/Room.js +0 -376
  60. package/dist/core/Signaling.d.ts +0 -39
  61. package/dist/core/Signaling.js +0 -147
  62. package/dist/core/bridges/BridgeCodecs.d.ts +0 -19
  63. package/dist/core/bridges/BridgeCodecs.js +0 -317
  64. package/dist/core/bridges/BrowserFirestoreRooms.d.ts +0 -36
  65. package/dist/core/bridges/BrowserFirestoreRooms.js +0 -169
  66. package/dist/core/bridges/BrowserFirestoreSignaling.d.ts +0 -111
  67. package/dist/core/bridges/BrowserFirestoreSignaling.js +0 -1010
  68. package/dist/core/bridges/NativeIpcBridge.d.ts +0 -156
  69. package/dist/core/bridges/NativeIpcBridge.js +0 -1472
  70. package/dist/core/bridges/RtdbPresence.d.ts +0 -122
  71. package/dist/core/bridges/RtdbPresence.js +0 -201
  72. package/dist/core/bridges/TauriBridge.d.ts +0 -8
  73. package/dist/core/bridges/TauriBridge.js +0 -7
  74. package/dist/core/bridges/WasmBridge.d.ts +0 -233
  75. package/dist/core/bridges/WasmBridge.js +0 -1811
  76. package/dist/core/config.d.ts +0 -31
  77. package/dist/core/config.js +0 -138
  78. package/dist/core/transports/ITransport.d.ts +0 -12
  79. package/dist/core/transports/ITransport.js +0 -1
  80. package/dist/core/transports/LocalDaemonBridge.d.ts +0 -41
  81. package/dist/core/transports/LocalDaemonBridge.js +0 -227
  82. package/dist/core/transports/TauriSignaling.d.ts +0 -28
  83. package/dist/core/transports/TauriSignaling.js +0 -373
  84. package/dist/core/transports/TransportFactory.d.ts +0 -9
  85. package/dist/core/transports/TransportFactory.js +0 -59
  86. package/dist/core/transports/WasmSignaling.d.ts +0 -78
  87. package/dist/core/transports/WasmSignaling.js +0 -522
  88. package/dist/core/transports/WebRTCTransport.d.ts +0 -23
  89. package/dist/core/transports/WebRTCTransport.js +0 -132
  90. package/dist/core/trust.d.ts +0 -23
  91. package/dist/core/trust.js +0 -99
  92. package/dist/core/types.js +0 -19
  93. package/dist/moq/MoQMediaTransport.d.ts +0 -6
  94. package/dist/moq/MoQMediaTransport.js +0 -106
  95. package/dist/moq/MoQPublisher.d.ts +0 -22
  96. package/dist/moq/MoQPublisher.js +0 -179
  97. package/dist/moq/MoQSession.d.ts +0 -35
  98. package/dist/moq/MoQSession.js +0 -166
  99. package/dist/moq/MoQSubscriber.d.ts +0 -19
  100. package/dist/moq/MoQSubscriber.js +0 -235
  101. package/dist/moq/common.d.ts +0 -47
  102. package/dist/moq/common.js +0 -304
  103. package/dist/moq/messages.d.ts +0 -105
  104. package/dist/moq/messages.js +0 -367
  105. package/dist/presets/plutoHosted.d.ts +0 -13
  106. package/dist/presets/plutoHosted.js +0 -18
  107. package/dist/runtime/DelegatingRuntimeAdapter.d.ts +0 -68
  108. package/dist/runtime/DelegatingRuntimeAdapter.js +0 -250
  109. package/dist/runtime/IpcRuntimeAdapter.d.ts +0 -9
  110. package/dist/runtime/IpcRuntimeAdapter.js +0 -13
  111. package/dist/runtime/RuntimeClient.d.ts +0 -257
  112. package/dist/runtime/RuntimeClient.js +0 -1484
  113. package/dist/runtime/TauriRuntimeAdapter.d.ts +0 -1
  114. package/dist/runtime/TauriRuntimeAdapter.js +0 -1
  115. package/dist/runtime/factories.d.ts +0 -24
  116. package/dist/runtime/factories.js +0 -66
  117. package/dist/runtime/ipc.d.ts +0 -8
  118. package/dist/runtime/ipc.js +0 -65
  119. package/dist/runtime/ipcContract.d.ts +0 -46
  120. package/dist/runtime/ipcContract.js +0 -1
  121. package/dist/runtime/types.d.ts +0 -110
  122. package/dist/runtime/types.js +0 -1
  123. package/dist/transports/TauriTransport.d.ts +0 -17
  124. package/dist/transports/TauriTransport.js +0 -49
  125. package/dist/transports/WebTransport.d.ts +0 -23
  126. package/dist/transports/WebTransport.js +0 -71
  127. package/dist/utils/debug.d.ts +0 -4
  128. package/dist/utils/debug.js +0 -33
  129. package/dist/utils/runtime.d.ts +0 -1
  130. package/dist/utils/runtime.js +0 -10
@@ -1,250 +0,0 @@
1
- export class DelegatingRuntimeAdapter {
2
- constructor(backend) {
3
- this.backend = backend;
4
- }
5
- get currentUser() {
6
- return this.backend.currentUser;
7
- }
8
- setAuthContext(context) {
9
- const backend = this.backend;
10
- return backend.setAuthContext?.(context);
11
- }
12
- async signInAnonymously() {
13
- return this.backend.signInAnonymously();
14
- }
15
- async signInWithPluto() {
16
- if (typeof this.backend.signInWithPluto !== 'function') {
17
- throw new Error('Selected runtime adapter does not support Pluto SSO.');
18
- }
19
- return this.backend.signInWithPluto();
20
- }
21
- async signOut() {
22
- return this.backend.signOut();
23
- }
24
- async stopAuthScopedActivity() {
25
- if (typeof this.backend.stopAuthScopedActivity === 'function') {
26
- await this.backend.stopAuthScopedActivity();
27
- }
28
- }
29
- async getTurnCredentials() {
30
- return this.backend.getTurnCredentials();
31
- }
32
- async updatePresence(localNodeId, ticketStr, isOnline, ttlMs, metadata) {
33
- return this.backend.updatePresence(localNodeId, ticketStr, isOnline, ttlMs, metadata);
34
- }
35
- async setOffline(localNodeId) {
36
- return this.backend.setOffline(localNodeId);
37
- }
38
- async cleanupStaleDevices() {
39
- return this.backend.cleanupStaleDevices();
40
- }
41
- async searchDevices(excludeNodeId) {
42
- return this.backend.searchDevices(excludeNodeId);
43
- }
44
- async listDevicesWithStatus() {
45
- if (typeof this.backend.listDevicesWithStatus !== 'function') {
46
- throw new Error('Selected runtime adapter does not support listDevicesWithStatus().');
47
- }
48
- return this.backend.listDevicesWithStatus();
49
- }
50
- async getPeerSession(id) {
51
- if (typeof this.backend.getPeerSession !== 'function') {
52
- return null;
53
- }
54
- return this.backend.getPeerSession(id);
55
- }
56
- async listPeerSessions() {
57
- if (typeof this.backend.listPeerSessions !== 'function') {
58
- return [];
59
- }
60
- return this.backend.listPeerSessions();
61
- }
62
- async waitForSettledPeer(id, timeoutMs) {
63
- if (typeof this.backend.waitForSettledPeer !== 'function') {
64
- return null;
65
- }
66
- return this.backend.waitForSettledPeer(id, timeoutMs);
67
- }
68
- async resolvePeerIdentity(id) {
69
- if (typeof this.backend.resolvePeerIdentity !== 'function') {
70
- return {
71
- peerId: null,
72
- deviceId: null,
73
- deviceIdHint: null,
74
- nodeId: null,
75
- };
76
- }
77
- return this.backend.resolvePeerIdentity(id);
78
- }
79
- async resolvePeerConnectionRecords(id) {
80
- if (typeof this.backend.resolvePeerConnectionRecords !== 'function') {
81
- return [];
82
- }
83
- return this.backend.resolvePeerConnectionRecords(id);
84
- }
85
- async updateDevice(deviceId, updates) {
86
- return this.backend.updateDevice(deviceId, updates);
87
- }
88
- async deleteDevice(deviceId) {
89
- return this.backend.deleteDevice(deviceId);
90
- }
91
- onDevicesChange(callback, excludeNodeId) {
92
- return this.backend.onDevicesChange(callback, excludeNodeId);
93
- }
94
- onAuthChange(callback) {
95
- return this.backend.onAuthChange(callback);
96
- }
97
- async checkForSSOToken() {
98
- return this.backend.checkForSSOToken();
99
- }
100
- async waitForAuth() {
101
- return this.backend.waitForAuth();
102
- }
103
- async sendMessage(targetId, payload, state, replyPayload) {
104
- return this.backend.sendMessage(targetId, payload, state, replyPayload);
105
- }
106
- async pollMessages(targetId) {
107
- return this.backend.pollMessages(targetId);
108
- }
109
- async subscribeDevices(userId) {
110
- return this.backend.subscribeDevices(userId);
111
- }
112
- startAutoConnect(userId, localDeviceId) {
113
- this.backend.startAutoConnect(userId, localDeviceId);
114
- }
115
- startPresenceLoop(userId, localNodeId, deviceName, ticket, metadata) {
116
- this.backend.startPresenceLoop(userId, localNodeId, deviceName, ticket, metadata);
117
- }
118
- async createSession(session) {
119
- return this.backend.createSession(session);
120
- }
121
- async updateSession(sessionId, updateData) {
122
- return this.backend.updateSession(sessionId, updateData);
123
- }
124
- async subscribeSessions(localDeviceId) {
125
- return this.backend.subscribeSessions(localDeviceId);
126
- }
127
- forceReconnectSnapshot() {
128
- this.backend.forceReconnectSnapshot();
129
- }
130
- async getLocalDeviceId() {
131
- if (typeof this.backend.getLocalDeviceId !== 'function') {
132
- return null;
133
- }
134
- return this.backend.getLocalDeviceId();
135
- }
136
- async getLocalDeviceInfo() {
137
- if (typeof this.backend.getLocalDeviceInfo !== 'function') {
138
- return null;
139
- }
140
- return this.backend.getLocalDeviceInfo();
141
- }
142
- async updateLocalDeviceName(deviceName) {
143
- if (typeof this.backend.updateLocalDeviceName !== 'function') {
144
- return null;
145
- }
146
- return this.backend.updateLocalDeviceName(deviceName);
147
- }
148
- async getManagedNodeId(options) {
149
- if (typeof this.backend.getManagedNodeId !== 'function') {
150
- return null;
151
- }
152
- return this.backend.getManagedNodeId(options);
153
- }
154
- async getEndpointTicket() {
155
- if (typeof this.backend.getEndpointTicket !== 'function') {
156
- throw new Error('Selected runtime adapter does not support getEndpointTicket().');
157
- }
158
- return this.backend.getEndpointTicket();
159
- }
160
- async getEndpointTicketWithToken(scope, maxConnections) {
161
- const b = this.backend;
162
- if (typeof b.getEndpointTicketWithToken !== 'function')
163
- return null;
164
- return b.getEndpointTicketWithToken(scope, maxConnections);
165
- }
166
- async registerSessionToken(token, scope, maxConnections) {
167
- const b = this.backend;
168
- if (typeof b.registerSessionToken === 'function') {
169
- await b.registerSessionToken(token, scope, maxConnections);
170
- }
171
- }
172
- async revokeSessionTokensByScope(scope) {
173
- const b = this.backend;
174
- if (typeof b.revokeSessionTokensByScope !== 'function')
175
- return [];
176
- return b.revokeSessionTokensByScope(scope);
177
- }
178
- async openPeerBi(id, timeoutMs) {
179
- if (typeof this.backend.openPeerBi !== 'function') {
180
- throw new Error('Selected runtime adapter does not support openPeerBi().');
181
- }
182
- return this.backend.openPeerBi(id, timeoutMs);
183
- }
184
- async openPeerUni(id, timeoutMs) {
185
- if (typeof this.backend.openPeerUni !== 'function') {
186
- throw new Error('Selected runtime adapter does not support openPeerUni().');
187
- }
188
- return this.backend.openPeerUni(id, timeoutMs);
189
- }
190
- async connectToDevice(params) {
191
- if (typeof this.backend.connectToDevice !== 'function') {
192
- throw new Error('Selected runtime adapter does not support connectToDevice().');
193
- }
194
- return this.backend.connectToDevice(params);
195
- }
196
- async disconnectDevice(deviceId) {
197
- if (typeof this.backend.disconnectDevice !== 'function') {
198
- throw new Error('Selected runtime adapter does not support disconnectDevice().');
199
- }
200
- return this.backend.disconnectDevice(deviceId);
201
- }
202
- async isConnected(nodeId) {
203
- return this.backend.isConnected(nodeId);
204
- }
205
- async getConnectionStates() {
206
- if (typeof this.backend.getConnectionStates !== 'function') {
207
- return [];
208
- }
209
- return this.backend.getConnectionStates();
210
- }
211
- onConnectionStateChange(callback) {
212
- if (typeof this.backend.onConnectionStateChange !== 'function') {
213
- return () => { };
214
- }
215
- return this.backend.onConnectionStateChange(callback);
216
- }
217
- async sendExplicitFilePath(connectionId, filePath, transferId) {
218
- if (typeof this.backend.sendExplicitFilePath !== 'function') {
219
- throw new Error('Selected runtime adapter does not support sendExplicitFilePath().');
220
- }
221
- return this.backend.sendExplicitFilePath(connectionId, filePath, transferId);
222
- }
223
- async sendExplicitFileData(params) {
224
- if (typeof this.backend.sendExplicitFileData !== 'function') {
225
- throw new Error('Selected runtime adapter does not support sendExplicitFileData().');
226
- }
227
- return this.backend.sendExplicitFileData(params);
228
- }
229
- async getTransferHistory(limit) {
230
- if (typeof this.backend.getTransferHistory !== 'function') {
231
- return [];
232
- }
233
- return this.backend.getTransferHistory(limit);
234
- }
235
- async deleteTransferJob(jobId) {
236
- if (typeof this.backend.deleteTransferJob !== 'function') {
237
- return;
238
- }
239
- return this.backend.deleteTransferJob(jobId);
240
- }
241
- async onIncomingNativeMessage(callback) {
242
- const b = this.backend;
243
- if (typeof b.onIncomingNativeMessage !== 'function')
244
- return () => { };
245
- return b.onIncomingNativeMessage(callback);
246
- }
247
- unwrap() {
248
- return this.backend;
249
- }
250
- }
@@ -1,9 +0,0 @@
1
- import { type NativeIpcBridgeOptions } from '../core/bridges/NativeIpcBridge';
2
- import { DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter';
3
- import { type PlutoIpcBridge } from './ipc';
4
- export interface IpcRuntimeAdapterOptions extends NativeIpcBridgeOptions {
5
- bridge: PlutoIpcBridge;
6
- }
7
- export declare class IpcRuntimeAdapter extends DelegatingRuntimeAdapter {
8
- constructor(options: IpcRuntimeAdapterOptions);
9
- }
@@ -1,13 +0,0 @@
1
- import { NativeIpcBridge } from '../core/bridges/NativeIpcBridge';
2
- import { DelegatingRuntimeAdapter } from './DelegatingRuntimeAdapter';
3
- import { assertValidIpcBridge } from './ipc';
4
- export class IpcRuntimeAdapter extends DelegatingRuntimeAdapter {
5
- constructor(options) {
6
- const bridge = assertValidIpcBridge(options.bridge, 'IpcRuntimeAdapter');
7
- super(new NativeIpcBridge({
8
- ...options,
9
- ipcBridge: bridge,
10
- allowWasmFallback: options.allowWasmFallback ?? false,
11
- }));
12
- }
13
- }
@@ -1,257 +0,0 @@
1
- import { Connection } from '../core/Connection';
2
- import type { AuthContext } from '../core/IEngineBridge';
3
- import type { AppLimits, ISignalingBackend, NativeConnectResult, ResolvedPeerIdentity } from '../core/types';
4
- import type { RuntimeAuthIdentity, RuntimeClientOptions, RuntimeConnectionEvent, RuntimeConnectionTarget, RuntimeDeviceConnectOptions, RuntimeDevice, RuntimeDeviceStatusSnapshot, RuntimeIncomingStream, RuntimeLocalDeviceProfile, RuntimeLocalDeviceInfo, RuntimeManagedSession, RuntimeManagedSessionOptions, RuntimePeerReadinessSnapshot, RuntimePeerConnectOptions, RuntimePeerStreamOptions, RuntimePeerHealth, RuntimePeerState, RuntimePresenceLoopOptions, RuntimeRawConnection, RuntimeSession } from './types';
5
- /**
6
- * RuntimeClient is the primary application-facing API.
7
- * It owns host/runtime orchestration on top of the Rust core and should be the
8
- * only high-level surface consumed by product code. App code should not rebuild
9
- * lifecycle, discovery, or transfer-readiness policy above this layer.
10
- *
11
- * Allowed:
12
- * - app-facing session startup/shutdown
13
- * - typed device, peer, room, and transfer APIs
14
- * - thin host/runtime coordination
15
- *
16
- * Not allowed:
17
- * - teaching app code to depend on `advanced.unwrap*()`
18
- * - treating `nodeId` as high-level peer identity
19
- * - reimplementing Rust-owned lifecycle policy in product code
20
- *
21
- * Source of truth:
22
- * - Rust core owns discovery, peer identity, presence, and transport lifecycle
23
- * - RuntimeClient should converge toward thin wrappers over those core surfaces
24
- */
25
- export declare class RuntimeClient {
26
- private static readonly NATIVE_START_RETRY_WINDOW_MS;
27
- private static readonly NATIVE_START_RETRY_MIN_DELAY_MS;
28
- private static readonly NATIVE_START_RETRY_MAX_DELAY_MS;
29
- private static readonly MANAGED_RECONCILIATION_INTERVAL_MS;
30
- private static readonly DEVICE_STATUS_REFRESH_DEBOUNCE_MS;
31
- private static readonly MANAGED_USER_DEVICE_SCOPE;
32
- private static readonly MANAGED_USER_DEVICE_STORAGE_KEY_PREFIX;
33
- private readonly client;
34
- private readonly backend;
35
- private managedSessionKey;
36
- private managedSessionUserId;
37
- private managedSessionOptions;
38
- private readonly apiKey;
39
- private readonly storageNamespace;
40
- constructor(options: RuntimeClientOptions, backend?: ISignalingBackend | null);
41
- get identity(): RuntimeAuthIdentity | null;
42
- private sleep;
43
- private fetchAndApplyAppLimits;
44
- private normalizeUiConnectionStatus;
45
- private managedUserDeviceStorageKey;
46
- private static encodeManagedCompoundTicket;
47
- private decodeManagedUserDeviceGrantFromTicket;
48
- private loadPersistedManagedUserDeviceGrant;
49
- private persistManagedUserDeviceGrant;
50
- private persistManagedUserDeviceGrantFromTicket;
51
- private clearPersistedManagedUserDeviceGrant;
52
- private resolvePeerStreamTarget;
53
- private compatPeerConnectionFromTarget;
54
- private deviceStatusSnapshotKey;
55
- private buildDeviceStatusLookup;
56
- private overlayPeerSessionsOnDeviceSnapshots;
57
- private overlayPeerStateOnDeviceSnapshots;
58
- private runtimeDeviceToStatusSnapshot;
59
- private uniqueLookupIds;
60
- private matchSessionByLookupId;
61
- private resolvePeerLookupIds;
62
- private mergeWatchedDevicesIntoStatusSnapshots;
63
- private nextNativeStartRetryDelayMs;
64
- private hasManagedSession;
65
- private startManagedReconciliation;
66
- private connectionStateSnapshotKey;
67
- private runNativeStartLoop;
68
- onIdentityChange(callback: (identity: RuntimeAuthIdentity | null) => void): () => void;
69
- signInAnonymously(): Promise<void>;
70
- signInWithPluto(): Promise<void>;
71
- setAuthContext(context: AuthContext | null): Promise<void>;
72
- signOut(): Promise<void>;
73
- initialize(): Promise<void>;
74
- getRuntimeStatus(): Promise<{
75
- runtime: 'tauri' | 'browser' | 'unknown';
76
- wasmLoaded: boolean;
77
- localNodeId?: string;
78
- userId?: string;
79
- }>;
80
- start(options?: {
81
- clearSessionTokens?: boolean;
82
- }): Promise<void>;
83
- stop(): void;
84
- getNodeId(): Promise<string>;
85
- getNodeIdFromTicket(ticket: string): Promise<string | null>;
86
- getLocalDeviceId(): Promise<string | null>;
87
- getLocalDeviceInfo(): Promise<RuntimeLocalDeviceInfo | null>;
88
- getLocalDeviceProfile(options?: {
89
- deviceName?: string;
90
- localDeviceId?: string | null;
91
- platform?: 'native' | 'web';
92
- userId?: string | null;
93
- }): Promise<RuntimeLocalDeviceProfile>;
94
- updateLocalDeviceName(deviceName: string): Promise<RuntimeLocalDeviceInfo | null>;
95
- getManagedNodeId(options?: {
96
- initializeIfMissing?: boolean;
97
- }): Promise<string | null>;
98
- getTicket(): Promise<string>;
99
- /**
100
- * Generate a session-scoped endpoint ticket with an embedded random token.
101
- * The token gates incoming connections: only clients that present the token
102
- * in their handshake are accepted while the registry is non-empty.
103
- *
104
- * @param scope Logical label for bulk-revoke (e.g. "share").
105
- * @param maxConnections 0 = unlimited.
106
- */
107
- getTicketWithToken(grantScope: string, maxConnections?: number): Promise<string>;
108
- /** Revoke all session tokens that match the given scope. */
109
- revokeTokensByScope(grantScope: string): Promise<string[]>;
110
- private revokeTokensByScopeInternal;
111
- /** Revoke a single session token by its raw value. */
112
- revokeSessionToken(token: string): void;
113
- getEndpointTicket(): Promise<string>;
114
- startManagedSession(options: RuntimeManagedSessionOptions): Promise<RuntimeManagedSession>;
115
- stopManagedSession(options?: {
116
- preserveBackendSession?: boolean;
117
- }): Promise<void>;
118
- private rotateManagedUserDeviceGrant;
119
- listDevices(): Promise<RuntimeDevice[]>;
120
- listDevicesWithStatus(): Promise<RuntimeDeviceStatusSnapshot[]>;
121
- updateDevice(deviceId: string, updates: {
122
- deviceName?: string;
123
- capabilities?: RuntimeDevice['capabilities'];
124
- metadata?: string;
125
- }): Promise<void>;
126
- deleteDevice(deviceId: string): Promise<void>;
127
- watchDevices(callback: (devices: RuntimeDevice[]) => void): () => void;
128
- watchDevicesWithStatus(callback: (devices: RuntimeDeviceStatusSnapshot[]) => void): () => void;
129
- connectDeviceWithRetry(device: RuntimeDevice, hooks: import('../core/types').ConnectDeviceHooks, options: import('../core/types').ConnectDeviceOptions): Promise<import('../core/types').ConnectDeviceResult>;
130
- /**
131
- * Runtime-owned device connect flow used by product code.
132
- * Rust owns the actual managed dial policy. This wrapper only:
133
- * - validates the app-facing device/ticket input
134
- * - forwards the request to the active runtime adapter
135
- * - refreshes peer state and invokes optional app callbacks
136
- */
137
- connectDevice(device: RuntimeDevice, options: RuntimeDeviceConnectOptions): Promise<import('../core/types').ConnectDeviceResult>;
138
- watchPeerStates(callback: (peers: RuntimePeerState[]) => void): () => void;
139
- getPeerState(id: string): RuntimePeerState | undefined;
140
- resolvePeerConnectionRecords(id: string): Promise<import('../core/types').ManagedConnectionRecord[]>;
141
- getPeerSession(id: string): Promise<import('../core/types').PeerSessionSnapshot | null>;
142
- listPeerSessions(): Promise<import('../core/types').PeerSessionSnapshot[]>;
143
- waitForConnectedPeer(id: string, timeoutMs?: number): Promise<import('../core/types').PeerSessionSnapshot | null>;
144
- getPeerReadiness(id: string, timeoutMs?: number): Promise<RuntimePeerReadinessSnapshot>;
145
- resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
146
- resolveIncomingStreamPeer(remoteNodeId: string): Promise<ResolvedPeerIdentity>;
147
- listConnectedPeers(): RuntimePeerState[];
148
- addPeerScope(id: string, scope?: string): RuntimePeerState | undefined;
149
- releasePeerScope(id: string, scope?: string): RuntimePeerState | undefined;
150
- getPeerScopes(id: string): string[];
151
- isSamePeer(a: string, b: string): boolean;
152
- refreshPeerSnapshot(): Promise<RuntimePeerState[]>;
153
- subscribeSessions(localDeviceId: string, callback: (session: RuntimeSession) => void): Promise<() => void>;
154
- getAppLimits(): AppLimits;
155
- createRoom(): Promise<string>;
156
- joinRoom(roomId: string, options?: import('./types').RuntimeJoinRoomOptions): Promise<Connection[]>;
157
- leaveRoom(roomId: string): Promise<void>;
158
- getRoomMembers(roomId: string): Promise<import('./types').RuntimeRoomMember[]>;
159
- watchRoom(roomId: string, callback: (members: import('./types').RuntimeRoomMember[]) => void): () => void;
160
- /** @deprecated Use connect() (no-arg) for lifecycle, or connectTo() for peer connections */
161
- connectByTicket(target: RuntimeConnectionTarget): Promise<Connection>;
162
- connectPeer(options: RuntimePeerConnectOptions): Promise<Connection>;
163
- openPeerBi(id: string, options?: RuntimePeerStreamOptions): Promise<{
164
- connection: Connection;
165
- readable: ReadableStream<Uint8Array>;
166
- writable: WritableStream<Uint8Array>;
167
- }>;
168
- openPeerUni(id: string, options?: RuntimePeerStreamOptions): Promise<{
169
- connection: Connection;
170
- writable: WritableStream<Uint8Array>;
171
- }>;
172
- connectToDevice(params: {
173
- deviceId?: string | null;
174
- endpointTicket: string;
175
- }): Promise<NativeConnectResult>;
176
- connectRaw(target: RuntimeConnectionTarget): Promise<RuntimeRawConnection>;
177
- openBi(nodeId: string): Promise<{
178
- readable: ReadableStream<Uint8Array>;
179
- writable: WritableStream<Uint8Array>;
180
- }>;
181
- openUni(nodeId: string): Promise<WritableStream<Uint8Array>>;
182
- onIncomingStream(callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
183
- registerChannel(descriptor: import('./types').RuntimeChannelDescriptor): void;
184
- unregisterChannel(channelId: string): void;
185
- listChannels(): import('./types').RuntimeChannelDescriptor[];
186
- onIncomingChannelStream(channelId: string, callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
187
- sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
188
- sendExplicitFileData(params: import('../core/types').ExplicitFileDataSendParams): Promise<void>;
189
- getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
190
- deleteTransferJob(jobId: string): Promise<void>;
191
- startPresenceLoop(options?: RuntimePresenceLoopOptions): Promise<void>;
192
- updatePresence(options?: {
193
- isOnline?: boolean;
194
- ttlMs?: number;
195
- metadata?: string;
196
- ticket?: string;
197
- }): Promise<void>;
198
- setOffline(): Promise<void>;
199
- startAutoConnect(localDeviceId?: string): Promise<void>;
200
- isConnected(nodeId: string): Promise<boolean>;
201
- disconnectNode(nodeId: string): Promise<void>;
202
- disconnectDevice(deviceId: string): Promise<void>;
203
- setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
204
- disconnectPeer(id: string, scope?: string): Promise<void>;
205
- forceDisconnectPeer(id: string): Promise<void>;
206
- getPeerHealth(id: string): Promise<RuntimePeerHealth>;
207
- getConnectionStates(): Promise<import('./types').RuntimeConnectionStateSnapshot[]>;
208
- onConnectionStateChange(callback: (state: import('./types').RuntimeConnectionStateSnapshot) => void): Promise<() => void> | (() => void);
209
- getConnections(): Connection[];
210
- onConnection(callback: (connection: Connection) => void): () => void;
211
- onDisconnection(callback: (connection: Connection) => void): () => void;
212
- onConnectionEvent(callback: (event: RuntimeConnectionEvent) => void): () => void;
213
- forceReconnectSnapshot(): void;
214
- /** Single-call lifecycle: combines initialize() + start() */
215
- connect(): Promise<void>;
216
- /** Disconnect from the runtime (alias for stop()) */
217
- disconnect(): void;
218
- /** Alias for onIdentityChange */
219
- onAuthChange(callback: (identity: RuntimeAuthIdentity | null) => void): () => void;
220
- /** Alias for setAuthContext */
221
- setAuth(context: AuthContext | null): Promise<void>;
222
- /** Alias for signInWithPluto */
223
- signIn(): Promise<void>;
224
- /** Alias for listDevices */
225
- getDevices(): Promise<RuntimeDevice[]>;
226
- /** Device subscription with optional status enrichment */
227
- onDevices(callback: (devices: RuntimeDevice[]) => void): () => void;
228
- onDevices(callback: (devices: RuntimeDeviceStatusSnapshot[]) => void, options: {
229
- status: true;
230
- }): () => void;
231
- /** Alias for getTicket — returns an invite/ticket string */
232
- getInvite(): Promise<string>;
233
- /** Connect to a peer by device ID or options */
234
- connectTo(options: RuntimePeerConnectOptions): Promise<Connection>;
235
- /** Alias for waitForConnectedPeer */
236
- waitFor(id: string, timeoutMs?: number): Promise<import('../core/types').PeerSessionSnapshot | null>;
237
- /** Open a stream to a peer (default: bidirectional) */
238
- openStream(id: string, options?: RuntimePeerStreamOptions & {
239
- direction?: 'bi' | 'send';
240
- }): Promise<{
241
- connection: Connection;
242
- readable?: ReadableStream<Uint8Array>;
243
- writable: WritableStream<Uint8Array>;
244
- }>;
245
- openChannelStream(channelId: string, id: string, options?: RuntimePeerStreamOptions & {
246
- direction?: 'bi' | 'send';
247
- }): Promise<{
248
- connection: Connection;
249
- readable?: ReadableStream<Uint8Array>;
250
- writable: WritableStream<Uint8Array>;
251
- }>;
252
- /** Alias for onIncomingStream */
253
- onStream(callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
254
- onChannelStream(channelId: string, callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
255
- /** Alias for watchRoom */
256
- onRoomChange(roomId: string, callback: (members: import('./types').RuntimeRoomMember[]) => void): () => void;
257
- }