openrtc 2.0.0-rc.3 → 2.0.0-rc.30

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 (89) hide show
  1. package/README.md +12 -8
  2. package/dist/{DelegatingRuntimeAdapter-DqfHkjLy.d.ts → DelegatingRuntimeAdapter-BFZDC604.d.ts} +32 -8
  3. package/dist/{types-BVJr065k.d.ts → ITransport-WV6gGMnX.d.ts} +42 -3
  4. package/dist/IpcRuntimeAdapter-CJq3dRBF.d.ts +19 -0
  5. package/dist/OpenRTCShared.d.ts +250 -0
  6. package/dist/OpenRTCShared.js +1 -0
  7. package/dist/WasmBridge-5GYKXPXK.js +1 -0
  8. package/dist/{OpenRTCShared-ZQPu5LqL.d.ts → assembly-q0jRRpsc.d.ts} +50 -250
  9. package/dist/{capabilities-YSskrE8H.d.ts → capabilities-BfZi4Cd7.d.ts} +4 -0
  10. package/dist/chunk-45WBH7E3.js +1 -0
  11. package/dist/chunk-7FPG3MFF.js +2 -0
  12. package/dist/chunk-AG2F6MOB.js +1 -0
  13. package/dist/chunk-CWGKLGJZ.js +1 -0
  14. package/dist/{chunk-A3IAG6EL.js → chunk-D2OJN5S5.js} +1 -1
  15. package/dist/chunk-DUY34MGT.js +1 -0
  16. package/dist/chunk-H5R5ZXXN.js +3 -0
  17. package/dist/chunk-KJTJLLJE.js +2 -0
  18. package/dist/{chunk-7Z6N46RB.js → chunk-LRT5GEGH.js} +2 -2
  19. package/dist/chunk-NRXEG5GQ.js +1 -0
  20. package/dist/chunk-OEVPKC3W.js +1 -0
  21. package/dist/chunk-VBUDERMM.js +2 -0
  22. package/dist/chunk-VOCOZ57Q.js +2 -0
  23. package/dist/chunk-XPL7PUBW.js +2 -0
  24. package/dist/chunk-Z2WVSXPW.js +1 -0
  25. package/dist/chunk-Z6TZLF4B.js +1 -0
  26. package/dist/controlPlane-P66ZTVNW.js +2 -0
  27. package/dist/deviceEnrollment-GL4JPVGG.js +2 -0
  28. package/dist/deviceKey-SBNKLVYF.js +1 -0
  29. package/dist/deviceManagement-PHY5TIOS.js +1 -0
  30. package/dist/deviceProfile-3BEQZLJF.js +2 -0
  31. package/dist/deviceRoster-VZA3TQOR.js +1 -0
  32. package/dist/dist-FIVA6EPA.js +277 -0
  33. package/dist/index.d.ts +10 -8
  34. package/dist/index.js +1 -1
  35. package/dist/ipcFactory-B6HBECSU.js +1 -0
  36. package/dist/native.d.ts +7 -8
  37. package/dist/native.js +1 -1
  38. package/dist/openrtc-WUVUMBQY.js +2 -0
  39. package/dist/openrtc_bg.wasm +0 -0
  40. package/dist/runtime/WasmRuntimeAdapter.d.ts +4 -4
  41. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  42. package/dist/runtime/device-status.d.ts +2 -4
  43. package/dist/runtime/factories.d.ts +21 -0
  44. package/dist/runtime/factories.js +1 -0
  45. package/dist/runtime/index.d.ts +30 -78
  46. package/dist/runtime/index.js +1 -2
  47. package/dist/testing.d.ts +9 -18
  48. package/dist/testing.js +1 -1
  49. package/dist/transport/index.d.ts +2 -3
  50. package/dist/transport/index.js +1 -1
  51. package/dist/{types-DkgaCyqS.d.ts → types-DVNSd5B9.d.ts} +71 -4
  52. package/dist/{types-DNl4KHHY.d.ts → types-Di034GVQ.d.ts} +112 -16
  53. package/package.json +3 -27
  54. package/dist/IEngineBridge-BbsT8hof.d.ts +0 -17
  55. package/dist/ITransport-BsPcaov7.d.ts +0 -16
  56. package/dist/OpenRTCShared-TKAQLONA.js +0 -1
  57. package/dist/WasmBridge-2A22U7RU.js +0 -1
  58. package/dist/auth/index.d.ts +0 -78
  59. package/dist/auth/index.js +0 -1
  60. package/dist/auth/internal.d.ts +0 -4
  61. package/dist/auth/internal.js +0 -1
  62. package/dist/chunk-2QHDEGVX.js +0 -1
  63. package/dist/chunk-3USHQ7QW.js +0 -3
  64. package/dist/chunk-5LRLWIT5.js +0 -1
  65. package/dist/chunk-6TAVJ46R.js +0 -1
  66. package/dist/chunk-7H2JPCBN.js +0 -1
  67. package/dist/chunk-BXFXPIXO.js +0 -1
  68. package/dist/chunk-C7YN5MSV.js +0 -1
  69. package/dist/chunk-F2XGNLXL.js +0 -2
  70. package/dist/chunk-GW7P3D54.js +0 -1
  71. package/dist/chunk-K37WVIZL.js +0 -1
  72. package/dist/chunk-N26S7V4N.js +0 -1
  73. package/dist/chunk-N4SX7C3W.js +0 -2
  74. package/dist/chunk-NB4H5TP3.js +0 -1
  75. package/dist/chunk-NT5YHZQH.js +0 -1
  76. package/dist/chunk-PODAMIL6.js +0 -2
  77. package/dist/chunk-PRVFZI2T.js +0 -1
  78. package/dist/chunk-RD3JEGGF.js +0 -2
  79. package/dist/chunk-UEYM6WTT.js +0 -2
  80. package/dist/chunk-VK6KX433.js +0 -1
  81. package/dist/chunk-YBXGNKM7.js +0 -2
  82. package/dist/factories-LI53SFLH.js +0 -1
  83. package/dist/ipcFactory-QY44OIKA.js +0 -1
  84. package/dist/openrtc-UU4BBJLG.js +0 -2
  85. package/dist/runtime/legacy.d.ts +0 -18
  86. package/dist/runtime/legacy.js +0 -1
  87. package/dist/runtime/tauri.d.ts +0 -6
  88. package/dist/runtime/tauri.js +0 -1
  89. package/dist/tauri-Cz9n17g8.d.ts +0 -33
@@ -1,7 +1,6 @@
1
- import { H as GrantScope, q as ISignalingBackend, Y as ConnectDeviceHooks, Z as ConnectDeviceOptions, _ as ConnectDeviceResult, u as ManagedConnectionRecord, m as PeerSessionSnapshot, v as ResolvedPeerIdentity, $ as AppLimits, N as NativeConnectParams, z as NativeConnectResult, E as ExplicitFileDataSendParams } from './types-BVJr065k.js';
2
- import { A as AuthContext } from './IEngineBridge-BbsT8hof.js';
3
- import { b as RuntimePeerState, c as RuntimeConnectionStateSnapshot, d as RuntimePeerReadinessSnapshot, e as RuntimePeerConnectOptions, C as Connection, f as RuntimeIncomingStream, a as RuntimeClientOptions, g as RuntimeAuthIdentity, h as RuntimeLocalDeviceInfo, i as RuntimeLocalDeviceProfile, j as RuntimeDevice, k as RuntimeManagedSessionOptions, l as RuntimeManagedSession, m as RuntimeDeviceStatusSnapshot, n as RuntimeDeviceConnectOptions, o as RuntimeSession, p as RuntimeJoinRoomOptions, q as RuntimeRoomMember, r as RuntimeConnectionTarget, s as RuntimeScopedChannelOptions, t as RuntimeScopedLogicalChannel, u as RuntimePeerStreamOptions, v as RuntimeRawConnection, R as RuntimeChannelDescriptor, w as RuntimePresenceLoopOptions, x as RuntimePeerHealth, y as RuntimeApplicationPayloadReadinessOptions, z as RuntimeConnectionEvent } from './types-DkgaCyqS.js';
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;
@@ -700,246 +742,4 @@ interface PlutoRuntimeAssembly<TBackend extends RuntimeAdapterWithAuth = Runtime
700
742
  setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
701
743
  }
702
744
 
703
- type OpenRTCChannelConnectOptions = Omit<RuntimeScopedChannelOptions, 'scope' | 'deviceId' | 'ticket'> & {
704
- /**
705
- * Device selected from `client.devices.*`. Passing the device object lets
706
- * OpenRTC reuse its current ticket for native and ticket-gated routes.
707
- */
708
- device?: string | RuntimeDevice;
709
- deviceId?: string | null;
710
- ticket?: string;
711
- /**
712
- * Logical channel lifecycle scope. Most app channels should use the default
713
- * `session`; pass a custom scope only when you intentionally manage peer
714
- * lifecycle separately from the channel.
715
- */
716
- scope?: RuntimeScopedChannelOptions['scope'];
717
- };
718
- type OpenRTCDeviceSessionOptions = Omit<RuntimeManagedSessionOptions, 'platform'> & {
719
- /**
720
- * Runtime host for the managed user-device session. Normal apps can omit
721
- * this: `OpenRTC(...)` defaults to `web`, and `OpenRTC.native(...)` defaults
722
- * to `native`.
723
- */
724
- platform?: RuntimeManagedSessionOptions['platform'];
725
- };
726
- interface OpenRTCDeviceNamespace {
727
- startSession(options?: OpenRTCDeviceSessionOptions): Promise<RuntimeManagedSession>;
728
- stopSession(options?: {
729
- preserveBackendSession?: boolean;
730
- }): Promise<void>;
731
- list(): Promise<RuntimeDevice[]>;
732
- listWithStatus(): Promise<RuntimeDeviceStatusSnapshot[]>;
733
- watch(callback: (devices: RuntimeDevice[]) => void): () => void;
734
- watchWithStatus(callback: (devices: RuntimeDeviceStatusSnapshot[]) => void): () => void;
735
- connect(device: string | RuntimeDevice, options?: RuntimeDeviceConnectOptions): Promise<ConnectDeviceResult>;
736
- /**
737
- * @deprecated Use `devices.connect()`. Retry and route recovery are owned by
738
- * OpenRTC; legacy consumer-provided connection hooks are ignored.
739
- */
740
- connectWithRetry(device: string | RuntimeDevice, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise<ConnectDeviceResult>;
741
- disconnect(deviceId: string): Promise<void>;
742
- update(deviceId: string, updates: {
743
- deviceName?: string;
744
- capabilities?: RuntimeDevice['capabilities'];
745
- metadata?: string;
746
- }): Promise<void>;
747
- delete(deviceId: string): Promise<void>;
748
- localId(): Promise<string | null>;
749
- localInfo(): Promise<RuntimeLocalDeviceInfo | null>;
750
- localProfile(options?: {
751
- deviceName?: string;
752
- localDeviceId?: string | null;
753
- platform?: 'native' | 'web';
754
- userId?: string | null;
755
- }): Promise<RuntimeLocalDeviceProfile>;
756
- updateLocalName(deviceName: string): Promise<RuntimeLocalDeviceInfo | null>;
757
- }
758
- interface OpenRTCPeerNamespace {
759
- watch(callback: (peers: RuntimePeerState[]) => void): () => void;
760
- watchLifecycle(callback: (peers: RuntimePeerState[]) => void): () => void;
761
- get(id: string): RuntimePeerState | undefined;
762
- listConnected(): RuntimePeerState[];
763
- connect(options: RuntimePeerConnectOptions): Promise<Connection>;
764
- disconnect(id: string, scope?: string): Promise<void>;
765
- forceDisconnect(id: string): Promise<void>;
766
- session(id: string): Promise<PeerSessionSnapshot | null>;
767
- sessions(): Promise<PeerSessionSnapshot[]>;
768
- waitConnected(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
769
- readiness(id: string, timeoutMs?: number): Promise<RuntimePeerReadinessSnapshot>;
770
- health(id: string): Promise<RuntimePeerHealth>;
771
- identity(id: string): Promise<ResolvedPeerIdentity>;
772
- addScope(id: string, scope?: string): RuntimePeerState | undefined;
773
- releaseScope(id: string, scope?: string): RuntimePeerState | undefined;
774
- scopes(id: string): string[];
775
- refresh(): Promise<RuntimePeerState[]>;
776
- }
777
- interface OpenRTCChannelNamespace {
778
- register(descriptor: RuntimeChannelDescriptor): void;
779
- unregister(channelId: string): void;
780
- list(): RuntimeChannelDescriptor[];
781
- openBi(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
782
- connection: Connection;
783
- readable: ReadableStream<Uint8Array>;
784
- writable: WritableStream<Uint8Array>;
785
- }>;
786
- openUni(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
787
- connection: Connection;
788
- writable: WritableStream<Uint8Array>;
789
- }>;
790
- onIncoming(callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
791
- onIncomingChannel(channelId: string, callback: (stream: RuntimeIncomingStream & {
792
- channel: NonNullable<RuntimeIncomingStream['channel']>;
793
- }) => boolean | void): () => void;
794
- connect(options: OpenRTCChannelConnectOptions): Promise<RuntimeScopedLogicalChannel>;
795
- connectScoped(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
796
- }
797
- interface OpenRTCRoomNamespace {
798
- create(roomId?: string): Promise<string>;
799
- join(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
800
- leave(roomId: string): Promise<void>;
801
- watch(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
802
- members(roomId: string): Promise<RuntimeRoomMember[]>;
803
- }
804
- interface OpenRTCTicketNamespace {
805
- raw(): Promise<string>;
806
- share(options?: {
807
- maxConnections?: number;
808
- }): Promise<string>;
809
- grant(scope: GrantScope, options?: {
810
- maxConnections?: number;
811
- }): Promise<string>;
812
- revoke(scope: GrantScope): Promise<string[]>;
813
- }
814
- interface OpenRTCDiagnosticsNamespace {
815
- status(): Promise<{
816
- runtime: 'tauri' | 'browser' | 'unknown';
817
- wasmLoaded: boolean;
818
- localNodeId?: string;
819
- userId?: string;
820
- }>;
821
- policy(): RuntimePolicySnapshot;
822
- capabilities(): RuntimeCapabilities;
823
- capabilityProfile(): RuntimeCapabilityProfile;
824
- connectionStates(): Promise<RuntimeConnectionStateSnapshot[]>;
825
- onConnectionStateChange(callback: (state: RuntimeConnectionStateSnapshot) => void): Promise<() => void> | (() => void);
826
- connections(): Connection[];
827
- applicationReadyConnections(options?: RuntimeApplicationPayloadReadinessOptions): Connection[];
828
- onConnection(callback: (connection: Connection) => void): () => void;
829
- onDisconnection(callback: (connection: Connection) => void): () => void;
830
- onConnectionEvent(callback: (event: RuntimeConnectionEvent) => void): () => void;
831
- forceReconnectSnapshot(): void;
832
- peerReconciliation(): Readonly<PeerReconciliationStats>;
833
- }
834
- interface OpenRTCAdvancedNamespace {
835
- readonly runtime: RuntimeClient;
836
- readonly assembly: PlutoRuntimeAssembly;
837
- nodeId(): Promise<string>;
838
- nodeIdFromTicket(ticket: string): Promise<string | null>;
839
- endpointTicket(): Promise<string>;
840
- connectRaw(target: {
841
- ticket: string;
842
- timeoutMs?: number;
843
- }): Promise<RuntimeRawConnection>;
844
- openBi(nodeId: string): Promise<{
845
- readable: ReadableStream<Uint8Array>;
846
- writable: WritableStream<Uint8Array>;
847
- }>;
848
- openUni(nodeId: string): Promise<WritableStream<Uint8Array>>;
849
- isConnected(nodeId: string): Promise<boolean>;
850
- disconnectNode(nodeId: string): Promise<void>;
851
- setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
852
- notifyNetworkChange(reason?: string): Promise<void>;
853
- }
854
- /**
855
- * OpenRTCClient extends RuntimeClient with auth helpers that were
856
- * previously only available on PlutoRuntimeAssembly.
857
- *
858
- * This is the unified type returned by OpenRTC() and OpenRTC.native().
859
- */
860
- interface OpenRTCClient extends RuntimeClient {
861
- readonly devices: OpenRTCDeviceNamespace;
862
- readonly peers: OpenRTCPeerNamespace;
863
- readonly channels: OpenRTCChannelNamespace;
864
- readonly rooms: OpenRTCRoomNamespace;
865
- readonly tickets: OpenRTCTicketNamespace;
866
- readonly diagnostics: OpenRTCDiagnosticsNamespace;
867
- readonly advanced: OpenRTCAdvancedNamespace;
868
- /** @deprecated Use setAuth() instead */
869
- setAuthContext(context: AuthContext | null): Promise<void>;
870
- /** Set auth context for the runtime */
871
- setAuth(context: AuthContext | null): Promise<void>;
872
- /** Sync Pluto-hosted auth to the runtime */
873
- syncPlutoAuth(options?: {
874
- userId?: string | null;
875
- forceRefresh?: boolean;
876
- }): Promise<void>;
877
- /** Bind Pluto auth host to auto-sync on token changes */
878
- bindPlutoAuthHost(): () => void;
879
- /** Sign in via Pluto SSO */
880
- signIn(): Promise<void>;
881
- /** Sign out and clear auth context */
882
- signOut(): Promise<void>;
883
- /**
884
- * @deprecated Use `client.devices.startSession(...)` for the public
885
- * user-device avenue lifecycle. This top-level method remains for
886
- * RuntimeClient compatibility and advanced integrations.
887
- */
888
- startManagedSession(options: RuntimeManagedSessionOptions): Promise<RuntimeManagedSession>;
889
- /**
890
- * @deprecated Use `client.devices.stopSession(...)` for the public
891
- * user-device avenue lifecycle.
892
- */
893
- stopManagedSession(options?: {
894
- preserveBackendSession?: boolean;
895
- }): Promise<void>;
896
- /** @deprecated Use `client.rooms.create(...)`. */
897
- createRoom(roomId?: string): Promise<string>;
898
- /** @deprecated Use `client.rooms.join(...)`. */
899
- joinRoom(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
900
- /** @deprecated Use `client.rooms.leave(...)`. */
901
- leaveRoom(roomId: string): Promise<void>;
902
- /** @deprecated Use `client.rooms.watch(...)`. */
903
- watchRoom(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
904
- /** @deprecated Use `client.rooms.members(...)`. */
905
- getRoomMembers(roomId: string): Promise<RuntimeRoomMember[]>;
906
- /** @deprecated Use `client.tickets.raw(...)`. */
907
- getInvite(): Promise<string>;
908
- /** @deprecated Use `client.tickets.raw(...)`. */
909
- getTicket(): Promise<string>;
910
- /** @deprecated Use `client.tickets.share(...)` or `client.tickets.grant(...)`. */
911
- getTicketWithToken(scope: GrantScope, maxConnections?: number): Promise<string>;
912
- /** @deprecated Use `client.tickets.revoke(...)`. */
913
- revokeTokensByScope(scope: GrantScope): Promise<string[]>;
914
- /** @deprecated Use `client.peers.connect(...)`. */
915
- connectPeer(options: RuntimePeerConnectOptions): Promise<Connection>;
916
- /** @deprecated Use `client.peers.connect(...)`. */
917
- connectTo(options: RuntimePeerConnectOptions): Promise<Connection>;
918
- /** @deprecated Use `client.peers.waitConnected(...)`. */
919
- waitForConnectedPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
920
- /** @deprecated Use `client.channels.connect(...)`; use `client.channels.connectScoped(...)` only for custom lifecycle scopes. */
921
- connectScopedChannel(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
922
- /** @deprecated Use `client.channels.openBi(...)`. */
923
- openPeerBi(id: string, options?: RuntimePeerStreamOptions): Promise<{
924
- connection: Connection;
925
- readable: ReadableStream<Uint8Array>;
926
- writable: WritableStream<Uint8Array>;
927
- }>;
928
- /** @deprecated Use `client.channels.openUni(...)`. */
929
- openPeerUni(id: string, options?: RuntimePeerStreamOptions): Promise<{
930
- connection: Connection;
931
- writable: WritableStream<Uint8Array>;
932
- }>;
933
- /**
934
- * Access to the underlying PlutoRuntimeAssembly for backward compatibility.
935
- * @deprecated Access methods directly on the client instead.
936
- */
937
- readonly runtime: RuntimeClient;
938
- /**
939
- * Access to the underlying PlutoRuntimeAssembly for backward compatibility.
940
- * @internal
941
- */
942
- readonly _assembly: PlutoRuntimeAssembly;
943
- }
944
-
945
- export { DriveGrantActorError as D, type OpenRTCPeerNamespace as O, type PlutoRuntimeAssembly as P, type RuntimeFactoryOptions as R, type OpenRTCChannelNamespace as a, type OpenRTCDiagnosticsNamespace as b, type OpenRTCDeviceNamespace as c, type OpenRTCClient as d, type PeerReconciliationStats as e, OPENRTC_RUNTIME_POLICY as f, RuntimeClient as g, type RuntimePolicySnapshot as h, type DriveGrantActorErrorKind as i, DriveGrantActorHandle as j, type DriveGrantActorHandleOptions as k, DriveGrantActorRegistry as l, type DriveGrantActorState as m, type DriveGrantClose as n, type DriveGrantDial as o, type DriveGrantConnectionKey as p, type DriveGrantLogicalChannelHandle as q, type DriveGrantPreferredTransport as r, getRuntimePolicy as s, driveGrantConnectionKey as t, driveGrantConnectionKeyToString as u };
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};
@@ -0,0 +1 @@
1
+ import {b,e}from'./chunk-45WBH7E3.js';import {xchacha20poly1305}from'@noble/ciphers/chacha.js';function I(){if(typeof globalThis<"u"&&globalThis.__OPENRTC_DEBUG__===true)return true;if(typeof localStorage<"u")try{return localStorage.getItem("openrtc:debug")==="1"}catch{return false}return false}function L(t,e,r){if(I()){if(typeof r>"u"){console[t](e);return}console[t](e,r);}}function Y(t,e){L("debug",t,e);}function $(t,e){L("info",t,e);}function G(t,e){L("log",t,e);}function H(t){return new Promise(e=>setTimeout(e,t))}function K(t){let e=new Uint8Array(t.byteLength);return e.set(t),e}function B(t){let e=t.reduce((s,c)=>s+c.byteLength,0),r=new Uint8Array(e),a=0;for(let s of t)r.set(s,a),a+=s.byteLength;return r}function Q(t,e,r){let a=e*Math.pow(2,Math.max(0,t-1));return Math.min(r,a)}function j(t){try{let e=t;return !!e&&!!e.send&&typeof e.send.getWriter=="function"&&!!e.recv&&typeof e.recv.getReader=="function"}catch{return false}}function J(t,e,r){let a=t;if(!a)return null;try{let s=a.send,c=a.recv;if(!s||typeof s.getWriter!="function"||!c||typeof c.getReader!="function")return null;let f=typeof a.endpoint_id=="string"&&a.endpoint_id.trim().length>0?a.endpoint_id:e,i=Number.isSafeInteger(a.transport_stable_id)&&Number(a.transport_stable_id)>0?Number(a.transport_stable_id):void 0,y=Number.isSafeInteger(r)&&Number(r)>0?Number(r):void 0;if(i!==void 0&&y!==void 0&&i!==y)return null;let o=i??y;return {send:s,recv:c,endpoint_id:f,...o?{transport_stable_id:o}:{}}}catch{return null}}function Z(t,e){let r={send:t.send,recv:e,endpoint_id:typeof t.endpoint_id=="string"?t.endpoint_id:"",...Number.isSafeInteger(t.transport_stable_id)&&Number(t.transport_stable_id)>0?{transport_stable_id:Number(t.transport_stable_id)}:{}};return t?.applicationCryptoWrapped===true&&(r.applicationCryptoWrapped=true),r}async function ee(t,e){if(!t)return false;try{let r=t.send?.getWriter?.();if(r)try{await r.close();}catch{}finally{try{r.releaseLock();}catch{}}}catch{}try{let r=t.recv?.getReader?.();if(r)try{await r.cancel(e);}catch{}finally{try{r.releaseLock();}catch{}}}catch{}return true}function te(t,e,r={}){let a=r.context??"prependBytesToReader",s=r.traceId,c=e.byteLength===0,f=r.pendingRead??null,i=o=>r.release?.(o),y=(o,n)=>r.log?.(o,n);return new ReadableStream({async pull(o){if(!c){c=true,o.enqueue(e);return}if(f){let l=f;f=null;let d;try{d=await l;}catch(u){o.error(u),i("pending-read-error"),y("prepend-bytes:pending-read-error",{context:a,traceId:s||null,error:u?.message||String(u)});return}if(d.done){o.close(),i("pending-done");return}d.value&&o.enqueue(d.value);return}let n;try{n=await t.read();}catch(l){o.error(l),i("read-error"),y("prepend-bytes:read-error",{context:a,traceId:s||null,error:l?.message||String(l)});return}let{done:p,value:b}=n;if(p){o.close(),i("done");return}b&&o.enqueue(b);},async cancel(o){i("cancel");}})}async function re(t,e){let r=t.read(),a=e-Date.now();if(a<=0)return {status:"timeout",pendingRead:r};let s=Symbol("probe-timeout"),c,f=new Promise(i=>{c=setTimeout(()=>i(s),a);});try{let i=await Promise.race([r,f]);if(i===s)return {status:"timeout",pendingRead:r};let{done:y,value:o}=i;return y?{status:"done"}:{status:"data",value:o&&o.byteLength>0?new Uint8Array(o):new Uint8Array(0)}}finally{c&&clearTimeout(c);}}var N=b,k=new Set(N);function A(t){if(typeof t!="string")return;let e=t.trim().toLowerCase();return k.has(e)?e:void 0}function oe(t){let e$1=A(t);return e$1?e(e$1).baseProtocol==="iroh":false}function ie(t){let e$1=A(t);if(!e$1)return false;let r=e(e$1);return r.baseProtocol==="iroh"&&(r.locality==="nearby"||r.locality==="direct-internet")}function se(t){let e$1=A(t);return e$1?e(e$1).family==="optional-route":false}function ue(t){let e$1=A(t);return e$1?e(e$1).baseProtocol==="webrtc":false}function ce(t){let e$1=A(t);if(!e$1)return false;let r=e(e$1);return r.baseProtocol==="iroh"&&r.implementation==="carrier-adapter"}function le(t,e,r=false){return t==="relay"||e==="relay"?"webrtc-turn":t==="host"&&e==="host"||r&&t&&e?"webrtc-lan":"webrtc"}function de(t){let e$1=A(t);return e$1?e(e$1).independentlyInstantiable:false}var g=new Uint8Array([79,82,84,67,69,49]),T=2,w=8,h=24,_=32,C=3,D=16*1024*1024,q=4096;function F(t,e){if(t.byteLength<e.byteLength)return false;let r=0;for(let a=0;a<e.byteLength;a+=1)r|=t[a]^e[a];return r===0}function W(t){let e=new Uint8Array(t),r=globalThis.crypto;if(!r||typeof r.getRandomValues!="function")throw new Error("[OpenRTC] application payload crypto requires crypto.getRandomValues");return r.getRandomValues(e),e}function V(t,e){let r="";for(let a of e)r+=a.toString(16).padStart(2,"0");return `${t}:${r}`}function v(t){if(!F(t,g))return null;let e=t[g.byteLength];return e===T?e:null}function M(t){return v(t)===T&&t.byteLength>g.byteLength+1+w+h}function be(t,e={}){if(!(t instanceof Uint8Array)||t.byteLength!==_)throw new Error(`[OpenRTC] application payload crypto key must be ${_} bytes`);let r=new Uint8Array(t),a=e.requireEncrypted??true,s=e.randomBytes??W,c=e.replayProtection??true,f=0,i=new Set,y=[];return {requireEncrypted:a,protectPayload(o,n){let p=s(h);if(!(p instanceof Uint8Array)||p.byteLength!==h)throw new Error(`[OpenRTC] application payload crypto nonce must be ${h} bytes`);let b=new Uint8Array(1+n.byteLength);b[0]=o,b.set(n,1);let l=xchacha20poly1305(r,p).encrypt(b);if(!c)throw new Error("[OpenRTC] ORTCE1 v1 envelopes are not supported; replay protection is required");let d=new Uint8Array(g.byteLength+1+w+p.byteLength+l.byteLength),u=0;d.set(g,u),u+=g.byteLength,d[u]=T,u+=1;let S=f;return f+=1,new DataView(d.buffer,d.byteOffset+u,w).setBigUint64(0,BigInt(S),false),u+=w,d.set(p,u),u+=p.byteLength,d.set(l,u),d},openPayload(o,n){if(!M(n))return a?null:n;if(v(n)!==T)return null;let b=g.byteLength+1,l=Number(new DataView(n.buffer,n.byteOffset+b,w).getBigUint64(0,false));if(!Number.isFinite(l))return null;let d=b+w,u=d+h,S=n.slice(d,u),R=c?V(l,S):null;if(R&&i.has(R))return null;let O=n.slice(u),U;try{U=xchacha20poly1305(r,S).decrypt(O);}catch{return null}if(U.byteLength<1||U[0]!==o)return null;if(R)for(i.add(R),y.push(R);y.length>q;){let x=y.shift();x&&i.delete(x);}return U.slice(1)}}}function z(t){let e=new Uint8Array(4+t.byteLength);return new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,t.byteLength,false),e.set(t,4),e}function me(t,e={}){let r=e.typeId??C,a=e.maxFrameBytes??D;if(!Number.isInteger(r)||r<0||r>255)throw new Error("[OpenRTC] raw application crypto stream typeId must be an integer from 0 to 255");if(!Number.isInteger(a)||a<=0)throw new Error("[OpenRTC] raw application crypto maxFrameBytes must be a positive integer");let s=n=>t.protectPayload(r,n),c=n=>t.openPayload(r,n),f=()=>new TransformStream({transform(n,p){p.enqueue(z(s(new Uint8Array(n))));}}),i=()=>{let n=new Uint8Array(0);return new TransformStream({transform(p,b){for(n=B([n,new Uint8Array(p)]);n.byteLength>=4;){let l=new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,false);if(l===0||l>a)throw new Error("[OpenRTC] invalid encrypted raw stream frame length");if(n.byteLength<4+l)return;let d=n.slice(4,4+l);n=n.slice(4+l);let u=c(d);if(!u)throw new Error("[OpenRTC] encrypted raw stream frame failed authentication");b.enqueue(u);}},flush(){if(n.byteLength!==0)throw new Error("[OpenRTC] encrypted raw stream ended mid-frame")}})},y=n=>n.pipeThrough(i()),o=n=>{let p=f();return p.readable.pipeTo(n).catch(()=>{}),p.writable};return {typeId:r,protectFrame:s,openFrame:c,createOutboundTransform:f,createInboundTransform:i,wrapReadable:y,wrapWritable:o,wrapBiStream(n){return {...n,send:o(n.send),recv:y(n.recv)}}}}export{I as a,Y as b,$ as c,G as d,H as e,K as f,B as g,Q as h,j as i,J as j,Z as k,ee as l,te as m,re as n,N as o,A as p,oe as q,ie as r,se as s,ue as t,ce as u,le as v,de as w,M as x,be as y,me as z};
@@ -0,0 +1 @@
1
+ var r={AUTH_NOT_READY:"auth/not-ready",AUTH_DENIED:"auth/denied",AUTH_EXPIRED:"auth/expired",AUTH_DEVICE_REENROLLMENT_REQUIRED:"auth/device-reenrollment-required",ADMISSION_DENIED:"admission/denied",ADMISSION_SCOPE_MISMATCH:"admission/scope-mismatch",BUDGET_EXCEEDED:"budget/exceeded",BUDGET_STALE:"budget/stale",BUDGET_RENEWAL_REQUIRED:"budget/renewal-required",COORDINATION_DISCONNECTED:"coordination/disconnected",COORDINATION_PROTOCOL:"coordination/protocol",COORDINATION_RATE_LIMITED:"coordination/rate-limited",COORDINATION_SERVICE_UNAVAILABLE:"coordination/service-unavailable",TRANSPORT_DIAL_EXHAUSTED:"transport/dial-exhausted",TRANSPORT_UNAVAILABLE:"transport/unavailable",TRANSPORT_TICKET_MISSING:"transport/ticket-missing",DELIVERY_NOT_READY:"delivery/not-ready",INTERNAL:"internal/error"},i=class e extends Error{constructor(n){super(n.message);this.name="OpenRtcError";n.cause!==void 0&&(this.cause=n.cause),this.code=n.code,this.retryable=n.retryable,this.plane=n.plane,this.generation=n.generation,this.transportGeneration=n.transportGeneration,this.routeGeneration=n.routeGeneration,this.revision=n.revision;}static isOpenRtcError(n){return n instanceof e||typeof n=="object"&&n!==null&&n.name==="OpenRtcError"&&typeof n.code=="string"&&typeof n.retryable=="boolean"&&typeof n.plane=="string"}static shouldAppRetry(n){let t=c(n);return t.retryable?t.plane==="coordination"||t.plane==="transport"||t.plane==="auth":false}toJSON(){return {name:this.name,code:this.code,message:this.message,retryable:this.retryable,plane:this.plane,generation:this.generation??null,transportGeneration:this.transportGeneration??null,routeGeneration:this.routeGeneration??null,revision:this.revision??null}}};function R(e){let a=c(e);return {errorCode:a.code,retryable:a.retryable,errorPlane:a.plane}}function o(e,a,n){let t=d(e);return new i({code:e,message:a,retryable:n.retryable??t.retryable,plane:n.plane??t.plane,cause:n.cause,generation:n.generation,transportGeneration:n.transportGeneration,routeGeneration:n.routeGeneration,revision:n.revision})}function d(e){switch(e){case r.AUTH_NOT_READY:case r.AUTH_EXPIRED:case r.AUTH_DEVICE_REENROLLMENT_REQUIRED:return {retryable:true,plane:"auth"};case r.AUTH_DENIED:return {retryable:false,plane:"auth"};case r.ADMISSION_DENIED:case r.ADMISSION_SCOPE_MISMATCH:return {retryable:false,plane:"admission"};case r.BUDGET_EXCEEDED:return {retryable:false,plane:"budget"};case r.BUDGET_STALE:case r.BUDGET_RENEWAL_REQUIRED:return {retryable:true,plane:"budget"};case r.COORDINATION_DISCONNECTED:case r.COORDINATION_RATE_LIMITED:case r.COORDINATION_SERVICE_UNAVAILABLE:return {retryable:true,plane:"coordination"};case r.COORDINATION_PROTOCOL:return {retryable:false,plane:"coordination"};case r.TRANSPORT_DIAL_EXHAUSTED:case r.TRANSPORT_UNAVAILABLE:case r.TRANSPORT_TICKET_MISSING:return {retryable:true,plane:"transport"};case r.DELIVERY_NOT_READY:return {retryable:true,plane:"delivery"};case r.INTERNAL:default:return {retryable:false,plane:"internal"}}}function c(e){if(i.isOpenRtcError(e))return e instanceof i?e:new i({code:e.code,message:e.message||String(e),retryable:e.retryable,plane:e.plane,cause:e,generation:e.generation,transportGeneration:e.transportGeneration,routeGeneration:e.routeGeneration,revision:e.revision});if(typeof e=="object"&&e!==null){let n=e,t=typeof n.code=="string"?n.code:"",l=typeof n.message=="string"?n.message:e instanceof Error?e.message:String(e),s=typeof n.retryable=="boolean"?n.retryable:void 0;if(t){let u=p(t,l,s);if(u)return u}if(typeof n.name=="string"&&n.name==="CoordinationConnectError")return o(r.COORDINATION_DISCONNECTED,l,{retryable:s??true,plane:"coordination",cause:e});if(typeof n.name=="string"&&n.name==="CoordinationGatewayProtocolError")return o(t||r.COORDINATION_PROTOCOL,l,{retryable:s??false,plane:E(t),cause:e})}let a=e instanceof Error?e.message:String(e??"unknown error");return O(a,e)}function p(e,a,n){let t=e.trim().toLowerCase();return t==="unauthenticated"||t==="functions/unauthenticated"||t==="auth/unauthorized"||t.includes("permission-denied")?o(r.AUTH_DENIED,a,{retryable:false,plane:"auth"}):t==="budget-renewal-required"||t==="budget/renewal-required"?o(r.BUDGET_RENEWAL_REQUIRED,a,{retryable:n??true,plane:"budget"}):t.includes("resource-exhausted")||t.includes("budget")||t==="budget-exceeded"||t==="insufficient-budget"?t.includes("stale")||/stale-budget/i.test(a)?o(r.BUDGET_STALE,a,{retryable:n??true,plane:"budget"}):o(r.BUDGET_EXCEEDED,a,{retryable:false,plane:"budget"}):t.includes("rate-limit")||t==="rate_limited"||t==="too-many-requests"?o(r.COORDINATION_RATE_LIMITED,a,{retryable:n??true,plane:"coordination"}):t.includes("admission")||t==="permission-denied"||t==="session-token-denied"?o(r.ADMISSION_DENIED,a,{retryable:false,plane:"admission"}):t.includes("scope")?o(r.ADMISSION_SCOPE_MISMATCH,a,{retryable:false,plane:"admission"}):t.includes("disconnect")||t.includes("unavailable")||t==="aborted"?o(r.COORDINATION_DISCONNECTED,a,{retryable:n??true,plane:"coordination"}):t.startsWith("coordination/")||t.includes("protocol")?o(e,a,{retryable:n??false,plane:E(e)}):null}function E(e){let a=e.trim().toLowerCase();return a.includes("budget")?"budget":a.includes("auth")?"auth":a.includes("admission")||a.includes("scope")?"admission":(a.includes("rate"),"coordination")}function O(e,a){return /auth(?:entication)?\s*(?:not ready|pending|missing)/i.test(e)||/token\s*(?:not ready|pending|missing)/i.test(e)||/awaiting[- ]auth/i.test(e)?o(r.AUTH_NOT_READY,e,{retryable:true,plane:"auth",cause:a}):/missing endpoint ticket|ticket missing/i.test(e)?o(r.TRANSPORT_TICKET_MISSING,e,{retryable:true,plane:"transport",cause:a}):/dial.*(exhaust|budget)|retry budget|connection.*did not become application-routable/i.test(e)?o(r.TRANSPORT_DIAL_EXHAUSTED,e,{retryable:true,plane:"transport",cause:a}):/stale[- ]budget/i.test(e)?o(r.BUDGET_STALE,e,{retryable:true,plane:"budget",cause:a}):/budget|credit|quota|limit\s*exceeded/i.test(e)?o(r.BUDGET_EXCEEDED,e,{retryable:false,plane:"budget",cause:a}):/admission|session[- ]token.*(deny|reject)|permission[- ]denied/i.test(e)?o(r.ADMISSION_DENIED,e,{retryable:false,plane:"admission",cause:a}):/not\s+application-routable|not[- ]ready|settledReady/i.test(e)?o(r.DELIVERY_NOT_READY,e,{retryable:true,plane:"delivery",cause:a}):/gateway|coordination|websocket|signaling/i.test(e)?o(r.COORDINATION_DISCONNECTED,e,{retryable:true,plane:"coordination",cause:a}):o(r.INTERNAL,e,{retryable:false,plane:"internal",cause:a})}export{r as a,i as b,R as c,o as d,c as e};
@@ -1 +1 @@
1
- import {t}from'./chunk-YBXGNKM7.js';var a=class{constructor(e){this.backend=e;}get currentUser(){return this.backend.currentUser}setAuthContext(e){return this.backend.setAuthContext?.(e)}async signInAnonymously(){return this.backend.signInAnonymously()}async signInWithPluto(){if(typeof this.backend.signInWithPluto!="function")throw new Error("Selected runtime adapter does not support Pluto SSO.");return this.backend.signInWithPluto()}async signOut(){return this.backend.signOut()}async stopAuthScopedActivity(){typeof this.backend.stopAuthScopedActivity=="function"&&await this.backend.stopAuthScopedActivity();}usesCoordinationGateway(){return this.backend.usesCoordinationGateway?.()===true}async joinCoordinationRoom(e,n,t){if(!this.backend.joinCoordinationRoom)throw new Error("Selected runtime adapter does not support coordination rooms.");await this.backend.joinCoordinationRoom(e,n,t);}async leaveCoordinationRoom(e){if(!this.backend.leaveCoordinationRoom)throw new Error("Selected runtime adapter does not support coordination rooms.");await this.backend.leaveCoordinationRoom(e);}async getCoordinationRoomMembers(e){if(!this.backend.getCoordinationRoomMembers)throw new Error("Selected runtime adapter does not support coordination rooms.");return this.backend.getCoordinationRoomMembers(e)}watchCoordinationRoomMembers(e,n){if(!this.backend.watchCoordinationRoomMembers)throw new Error("Selected runtime adapter does not support coordination rooms.");return this.backend.watchCoordinationRoomMembers(e,n)}async getTurnCredentials(){return this.backend.getTurnCredentials()}async updatePresence(e,n,t,i,r){return this.backend.updatePresence(e,n,t,i,r)}async refreshLivePresence(e,n,t){if(typeof this.backend.refreshLivePresence!="function")throw new Error("Selected runtime adapter does not support refreshLivePresence().");return this.backend.refreshLivePresence(e,n,t)}async setOffline(e){return this.backend.setOffline(e)}async cleanupStaleDevices(){return this.backend.cleanupStaleDevices()}async searchDevices(e){return this.backend.searchDevices(e)}async listDevicesWithStatus(){if(typeof this.backend.listDevicesWithStatus!="function")throw new Error("Selected runtime adapter does not support listDevicesWithStatus().");return this.backend.listDevicesWithStatus()}async getPeerSession(e){return typeof this.backend.getPeerSession!="function"?null:this.backend.getPeerSession(e)}async listPeerSessions(){return typeof this.backend.listPeerSessions!="function"?[]:this.backend.listPeerSessions()}async waitForSettledPeer(e,n){return typeof this.backend.waitForSettledPeer!="function"?null:this.backend.waitForSettledPeer(e,n)}async resolvePeerIdentity(e){return typeof this.backend.resolvePeerIdentity!="function"?{peerId:null,deviceId:null,deviceIdHint:null,nodeId:null}:this.backend.resolvePeerIdentity(e)}async resolvePeerConnectionRecords(e){return typeof this.backend.resolvePeerConnectionRecords!="function"?[]:this.backend.resolvePeerConnectionRecords(e)}async updateDevice(e,n){return this.backend.updateDevice(e,n)}async deleteDevice(e){return this.backend.deleteDevice(e)}onDevicesChange(e,n){return this.backend.onDevicesChange(e,n)}onAuthChange(e){return this.backend.onAuthChange(e)}async checkForSSOToken(){return this.backend.checkForSSOToken()}async waitForAuth(){return this.backend.waitForAuth()}async sendMessage(e,n,t,i){return this.backend.sendMessage(e,n,t,i)}async pollMessages(e){return this.backend.pollMessages(e)}watchFriendDevices(e,n){let t=this.backend;return t.watchFriendDevices?t.watchFriendDevices(e,n):()=>{}}async updateFriendTicket(e){let n=this.backend;n.updateFriendTicket&&await n.updateFriendTicket(e);}async subscribeDevices(e){return this.backend.subscribeDevices(e)}startAutoConnect(e,n){this.backend.startAutoConnect(e,n);}async submitDesiredPeerProjection(e,n){if(typeof this.backend.submitDesiredPeerProjection!="function")throw new Error("Selected runtime adapter does not support desired-peer projections.");await this.backend.submitDesiredPeerProjection(e,n);}startPresenceLoop(e,n,t,i,r){this.backend.startPresenceLoop(e,n,t,i,r);}async createSession(e){return this.backend.createSession(e)}async updateSession(e,n){return this.backend.updateSession(e,n)}async subscribeSessions(e){return this.backend.subscribeSessions(e)}forceReconnectSnapshot(){this.backend.forceReconnectSnapshot();}async getLocalDeviceId(){return typeof this.backend.getLocalDeviceId!="function"?null:this.backend.getLocalDeviceId()}async getLocalDeviceInfo(){return typeof this.backend.getLocalDeviceInfo!="function"?null:this.backend.getLocalDeviceInfo()}async updateLocalDeviceName(e){return typeof this.backend.updateLocalDeviceName!="function"?null:this.backend.updateLocalDeviceName(e)}async startManagedSessionNative(e){let n=this.backend;if(typeof n.startManagedSessionNative!="function")throw new Error("Selected runtime adapter does not support startManagedSessionNative().");return n.startManagedSessionNative(e)}async notifyNetworkChange(e){return typeof this.backend.notifyNetworkChange!="function"?null:this.backend.notifyNetworkChange(e)}async getManagedNodeId(e){if(console.info("[DelegatingRuntimeAdapter][getManagedNodeId] enter",{hasMethod:typeof this.backend.getManagedNodeId=="function",backendCtor:this.backend.constructor?.name??null}),typeof this.backend.getManagedNodeId!="function")return null;let n=await this.backend.getManagedNodeId(e);return console.info("[DelegatingRuntimeAdapter][getManagedNodeId] resolved",{result:n}),n}async startPresenceLoopOnce(e,n,t,i,r){let o=this.backend;if(typeof o.startPresenceLoopOnce!="function")throw new Error("Selected runtime adapter does not support startPresenceLoopOnce().");return o.startPresenceLoopOnce(e,n,t,i,r)}async startAutoConnectOnce(e,n){let t=this.backend;if(typeof t.startAutoConnectOnce!="function")throw new Error("Selected runtime adapter does not support startAutoConnectOnce().");return t.startAutoConnectOnce(e,n)}async getEndpointTicket(){if(typeof this.backend.getEndpointTicket!="function")throw new Error("Selected runtime adapter does not support getEndpointTicket().");return this.backend.getEndpointTicket()}async getEndpointTicketWithToken(e,n){let t=this.backend;return typeof t.getEndpointTicketWithToken!="function"?null:t.getEndpointTicketWithToken(e,n)}async registerSessionToken(e,n,t){let i=this.backend;typeof i.registerSessionToken=="function"&&await i.registerSessionToken(e,n,t);}async revokeSessionTokensByScope(e){let n=this.backend;return typeof n.revokeSessionTokensByScope!="function"?[]:n.revokeSessionTokensByScope(e)}async openPeerBi(e,n){if(typeof this.backend.openPeerBi!="function")throw new Error("Selected runtime adapter does not support openPeerBi().");return this.backend.openPeerBi(e,n)}async incoming_streams(){let e=this.backend;if(typeof e.incoming_streams!="function")throw new Error("Selected runtime adapter does not support incoming_streams().");return e.incoming_streams()}async is_current_transport_stable_id(e,n){let t=this.backend;return typeof t.is_current_transport_stable_id!="function"?false:t.is_current_transport_stable_id(e,n)}async openPeerNativeBi(e,n,t){let i=this.backend;if(typeof i.openPeerNativeBi!="function")throw new Error("Selected runtime adapter does not support openPeerNativeBi().");return i.openPeerNativeBi(e,n,t)}async openPeerBiTransportOnly(e,n){let t=this.backend;return typeof t.openPeerBiTransportOnly=="function"?t.openPeerBiTransportOnly(e,n):this.openPeerBi(e,n)}async openPeerUni(e,n){if(typeof this.backend.openPeerUni!="function")throw new Error("Selected runtime adapter does not support openPeerUni().");return this.backend.openPeerUni(e,n)}async connectToDevice(e){if(typeof this.backend.connectToDevice!="function")throw new Error("Selected runtime adapter does not support connectToDevice().");return this.backend.connectToDevice(e)}async disconnectDevice(e){if(typeof this.backend.disconnectDevice!="function")throw new Error("Selected runtime adapter does not support disconnectDevice().");return this.backend.disconnectDevice(e)}async setAutoConnectExcluded(e,n){if(typeof this.backend.setAutoConnectExcluded!="function")throw new Error("Selected runtime adapter does not support setAutoConnectExcluded().");return this.backend.setAutoConnectExcluded(e,n)}async isConnected(e){return this.backend.isConnected(e)}async getConnectionStates(){return typeof this.backend.getConnectionStates!="function"?[]:this.backend.getConnectionStates()}onConnectionStateChange(e){return typeof this.backend.onConnectionStateChange!="function"?()=>{}:this.backend.onConnectionStateChange(e)}async sendExplicitFilePath(e,n,t){if(typeof this.backend.sendExplicitFilePath!="function")throw new Error("Selected runtime adapter does not support sendExplicitFilePath().");return this.backend.sendExplicitFilePath(e,n,t)}async sendExplicitFileData(e){if(typeof this.backend.sendExplicitFileData!="function")throw new Error("Selected runtime adapter does not support sendExplicitFileData().");return this.backend.sendExplicitFileData(e)}async getTransferHistory(e){return typeof this.backend.getTransferHistory!="function"?[]:this.backend.getTransferHistory(e)}async deleteTransferJob(e){if(typeof this.backend.deleteTransferJob=="function")return this.backend.deleteTransferJob(e)}getRuntimeCapabilities(){let e=this.backend;return typeof e.getRuntimeCapabilities=="function"?e.getRuntimeCapabilities():t()}async onIncomingNativeMessage(e){let n=this.backend;return typeof n.onIncomingNativeMessage!="function"?()=>{}:n.onIncomingNativeMessage(e)}unwrap(){return this.backend}setCoreClient(e){let n=this.backend;typeof n.setCoreClient=="function"&&n.setCoreClient(e);}};export{a};
1
+ import {v}from'./chunk-VOCOZ57Q.js';var a=class{constructor(e){this.backend=e;}get currentUser(){return this.backend.currentUser}setAuthContext(e){return this.backend.setAuthContext?.(e)}async signInAnonymously(){return this.backend.signInAnonymously()}async signInWithPluto(){if(typeof this.backend.signInWithPluto!="function")throw new Error("Selected runtime adapter does not support Pluto SSO.");return this.backend.signInWithPluto()}async signOut(){return this.backend.signOut()}async stopAuthScopedActivity(){typeof this.backend.stopAuthScopedActivity=="function"&&await this.backend.stopAuthScopedActivity();}usesCoordinationGateway(){return this.backend.usesCoordinationGateway?.()===true}async joinCoordinationRoom(e,n,t){if(!this.backend.joinCoordinationRoom)throw new Error("Selected runtime adapter does not support coordination rooms.");await this.backend.joinCoordinationRoom(e,n,t);}async leaveCoordinationRoom(e){if(!this.backend.leaveCoordinationRoom)throw new Error("Selected runtime adapter does not support coordination rooms.");await this.backend.leaveCoordinationRoom(e);}async getCoordinationRoomMembers(e){if(!this.backend.getCoordinationRoomMembers)throw new Error("Selected runtime adapter does not support coordination rooms.");return this.backend.getCoordinationRoomMembers(e)}watchCoordinationRoomMembers(e,n){if(!this.backend.watchCoordinationRoomMembers)throw new Error("Selected runtime adapter does not support coordination rooms.");return this.backend.watchCoordinationRoomMembers(e,n)}async getTurnCredentials(){return this.backend.getTurnCredentials()}async updatePresence(e,n,t,i,r){return this.backend.updatePresence(e,n,t,i,r)}async refreshLivePresence(e,n,t){if(typeof this.backend.refreshLivePresence!="function")throw new Error("Selected runtime adapter does not support refreshLivePresence().");return this.backend.refreshLivePresence(e,n,t)}async setOffline(e){return this.backend.setOffline(e)}async cleanupStaleDevices(){return this.backend.cleanupStaleDevices()}async searchDevices(e){return this.backend.searchDevices(e)}async listDevicesWithStatus(){if(typeof this.backend.listDevicesWithStatus!="function")throw new Error("Selected runtime adapter does not support listDevicesWithStatus().");return this.backend.listDevicesWithStatus()}async getPeerSession(e){return typeof this.backend.getPeerSession!="function"?null:this.backend.getPeerSession(e)}async listPeerSessions(){return typeof this.backend.listPeerSessions!="function"?[]:this.backend.listPeerSessions()}async waitForSettledPeer(e,n){return typeof this.backend.waitForSettledPeer!="function"?null:this.backend.waitForSettledPeer(e,n)}async resolvePeerIdentity(e){return typeof this.backend.resolvePeerIdentity!="function"?{peerId:null,deviceId:null,deviceIdHint:null,nodeId:null}:this.backend.resolvePeerIdentity(e)}async resolvePeerConnectionRecords(e){return typeof this.backend.resolvePeerConnectionRecords!="function"?[]:this.backend.resolvePeerConnectionRecords(e)}async updateDevice(e,n){return this.backend.updateDevice(e,n)}async deleteDevice(e){return this.backend.deleteDevice(e)}onDevicesChange(e,n){return this.backend.onDevicesChange(e,n)}onAuthChange(e){return this.backend.onAuthChange(e)}async checkForSSOToken(){return this.backend.checkForSSOToken()}async waitForAuth(){return this.backend.waitForAuth()}async sendMessage(e,n,t,i){return this.backend.sendMessage(e,n,t,i)}async pollMessages(e){return this.backend.pollMessages(e)}watchFriendDevices(e,n){let t=this.backend;return t.watchFriendDevices?t.watchFriendDevices(e,n):()=>{}}async updateFriendTicket(e){let n=this.backend;n.updateFriendTicket&&await n.updateFriendTicket(e);}async subscribeDevices(e){return this.backend.subscribeDevices(e)}startAutoConnect(e,n){this.backend.startAutoConnect(e,n);}async submitDesiredPeerProjection(e,n){if(typeof this.backend.submitDesiredPeerProjection!="function")throw new Error("Selected runtime adapter does not support desired-peer projections.");await this.backend.submitDesiredPeerProjection(e,n);}startPresenceLoop(e,n,t,i,r){this.backend.startPresenceLoop(e,n,t,i,r);}async createSession(e){return this.backend.createSession(e)}async updateSession(e,n){return this.backend.updateSession(e,n)}async subscribeSessions(e){return this.backend.subscribeSessions(e)}forceReconnectSnapshot(){this.backend.forceReconnectSnapshot();}async getLocalDeviceId(){return typeof this.backend.getLocalDeviceId!="function"?null:this.backend.getLocalDeviceId()}async getLocalDeviceInfo(){return typeof this.backend.getLocalDeviceInfo!="function"?null:this.backend.getLocalDeviceInfo()}async updateLocalDeviceName(e){return typeof this.backend.updateLocalDeviceName!="function"?null:this.backend.updateLocalDeviceName(e)}async startManagedSessionNative(e){let n=this.backend;if(typeof n.startManagedSessionNative!="function")throw new Error("Selected runtime adapter does not support startManagedSessionNative().");return n.startManagedSessionNative(e)}async notifyNetworkChange(e){return typeof this.backend.notifyNetworkChange!="function"?null:this.backend.notifyNetworkChange(e)}async getManagedNodeId(e){if(console.info("[DelegatingRuntimeAdapter][getManagedNodeId] enter",{hasMethod:typeof this.backend.getManagedNodeId=="function",backendCtor:this.backend.constructor?.name??null}),typeof this.backend.getManagedNodeId!="function")return null;let n=await this.backend.getManagedNodeId(e);return console.info("[DelegatingRuntimeAdapter][getManagedNodeId] resolved",{result:n}),n}async startPresenceLoopOnce(e,n,t,i,r){let o=this.backend;if(typeof o.startPresenceLoopOnce!="function")throw new Error("Selected runtime adapter does not support startPresenceLoopOnce().");return o.startPresenceLoopOnce(e,n,t,i,r)}async startAutoConnectOnce(e,n){let t=this.backend;if(typeof t.startAutoConnectOnce!="function")throw new Error("Selected runtime adapter does not support startAutoConnectOnce().");return t.startAutoConnectOnce(e,n)}async getEndpointTicket(){if(typeof this.backend.getEndpointTicket!="function")throw new Error("Selected runtime adapter does not support getEndpointTicket().");return this.backend.getEndpointTicket()}async getEndpointTicketWithToken(e,n){let t=this.backend;return typeof t.getEndpointTicketWithToken!="function"?null:t.getEndpointTicketWithToken(e,n)}async registerSessionToken(e,n,t,i){let r=this.backend;typeof r.registerSessionToken=="function"&&await r.registerSessionToken(e,n,t,i);}async revokeSessionTokensByScope(e){let n=this.backend;return typeof n.revokeSessionTokensByScope!="function"?[]:n.revokeSessionTokensByScope(e)}async openPeerBi(e,n){if(typeof this.backend.openPeerBi!="function")throw new Error("Selected runtime adapter does not support openPeerBi().");return this.backend.openPeerBi(e,n)}async incoming_streams(){let e=this.backend;if(typeof e.incoming_streams!="function")throw new Error("Selected runtime adapter does not support incoming_streams().");return e.incoming_streams()}async is_current_transport_stable_id(e,n){let t=this.backend;return typeof t.is_current_transport_stable_id!="function"?false:t.is_current_transport_stable_id(e,n)}async openPeerNativeBi(e,n,t){let i=this.backend;if(typeof i.openPeerNativeBi!="function")throw new Error("Selected runtime adapter does not support openPeerNativeBi().");return i.openPeerNativeBi(e,n,t)}async openPeerBiTransportOnly(e,n){let t=this.backend;return typeof t.openPeerBiTransportOnly=="function"?t.openPeerBiTransportOnly(e,n):this.openPeerBi(e,n)}async openPeerUni(e,n){if(typeof this.backend.openPeerUni!="function")throw new Error("Selected runtime adapter does not support openPeerUni().");return this.backend.openPeerUni(e,n)}async connectToDevice(e){if(typeof this.backend.connectToDevice!="function")throw new Error("Selected runtime adapter does not support connectToDevice().");return this.backend.connectToDevice(e)}async disconnectDevice(e){if(typeof this.backend.disconnectDevice!="function")throw new Error("Selected runtime adapter does not support disconnectDevice().");return this.backend.disconnectDevice(e)}async setAutoConnectExcluded(e,n){if(typeof this.backend.setAutoConnectExcluded!="function")throw new Error("Selected runtime adapter does not support setAutoConnectExcluded().");return this.backend.setAutoConnectExcluded(e,n)}async isConnected(e){return this.backend.isConnected(e)}async getConnectionStates(){return typeof this.backend.getConnectionStates!="function"?[]:this.backend.getConnectionStates()}onConnectionStateChange(e){return typeof this.backend.onConnectionStateChange!="function"?()=>{}:this.backend.onConnectionStateChange(e)}async sendExplicitFilePath(e,n,t){if(typeof this.backend.sendExplicitFilePath!="function")throw new Error("Selected runtime adapter does not support sendExplicitFilePath().");return this.backend.sendExplicitFilePath(e,n,t)}async sendExplicitFileData(e){if(typeof this.backend.sendExplicitFileData!="function")throw new Error("Selected runtime adapter does not support sendExplicitFileData().");return this.backend.sendExplicitFileData(e)}async getTransferHistory(e){return typeof this.backend.getTransferHistory!="function"?[]:this.backend.getTransferHistory(e)}async deleteTransferJob(e){if(typeof this.backend.deleteTransferJob=="function")return this.backend.deleteTransferJob(e)}getRuntimeCapabilities(){let e=this.backend;return typeof e.getRuntimeCapabilities=="function"?e.getRuntimeCapabilities():v()}async onIncomingNativeMessage(e){let n=this.backend;return typeof n.onIncomingNativeMessage!="function"?()=>{}:n.onIncomingNativeMessage(e)}unwrap(){return this.backend}setCoreClient(e){let n=this.backend;typeof n.setCoreClient=="function"&&n.setCoreClient(e);}};export{a};
@@ -0,0 +1 @@
1
+ var n=class{constructor(r){this.transmit=r;this.pending=null;this.running=false;this.closedError=null;}send(r){return this.closedError?Promise.reject(this.closedError):new Promise((i,e)=>{this.pending&&this.pending.resolve(),this.pending={payload:r.slice(),resolve:i,reject:e},this.pump();})}close(r=new Error("Latest-state channel is closed.")){this.closedError=r;let i=this.pending;this.pending=null,i?.reject(r);}pump(){this.running||this.closedError||(this.running=true,(async()=>{for(;this.pending&&!this.closedError;){let r=this.pending;this.pending=null;try{await this.transmit(r.payload),r.resolve();}catch(i){r.reject(i);}}})().finally(()=>{this.running=false,this.pending&&!this.closedError&&this.pump();}));}};export{n as a};