import { P as PolicySnapshot, a as PeerReconciliationStats, R as RuntimeClient, b as PlutoRuntimeAssembly } from './assembly-BTzwQuwI.js'; import { d as PeerSessionSnapshot, e as ResolvedPeerIdentity, C as ConnectDeviceResult, f as ConnectDeviceHooks, g as ConnectDeviceOptions, G as GrantScope } from './ITransport-yaruAmx3.js'; import { R as RuntimePeerState, P as PeerConnectOptions, a as Connection, b as PeerReadiness, c as RuntimePeerHealth, C as ChannelDescriptor, d as PeerStreamOptions, I as IncomingStream, S as ScopedChannelOptions, e as RuntimeDevice, f as ScopedLogicalChannel, g as ConnectionState, h as ReadinessOptions, i as ConnectionEvent, M as ManagedOptions, j as ManagedSession, D as DeviceStatus, k as DeviceConnectOptions, L as LocalDeviceInfo, l as DeviceProfile, m as RawConnection, J as JoinRoomOptions, n as RuntimeRoomMember, A as AuthContext, o as RuntimeClientOptions } from './types-D67HlF0p.js'; import { R as RuntimeCapabilities, C as CapabilityProfile } from './capabilities-BwzPe51I.js'; type ChannelConnectOptions = Omit & { /** * Device selected from `client.devices.*`. Passing the device object lets * OpenRTC reuse its current ticket for native and ticket-gated routes. */ device?: string | RuntimeDevice; deviceId?: string | null; ticket?: string; /** * Logical channel lifecycle scope. Most app channels should use the default * `session`; pass a custom scope only when you intentionally manage peer * lifecycle separately from the channel. */ scope?: ScopedChannelOptions['scope']; }; type DeviceSessionOptions = Omit & { /** * Runtime host for the managed user-device session. Normal apps can omit * this: `OpenRTC(...)` defaults to `web`, and `OpenRTC.native(...)` defaults * to `native`. */ platform?: ManagedOptions['platform']; }; interface DeviceNamespace { startSession(options?: DeviceSessionOptions): Promise; stopSession(options?: { preserveBackendSession?: boolean; }): Promise; list(): Promise; listWithStatus(): Promise; watch(callback: (devices: RuntimeDevice[]) => void): () => void; watchWithStatus(callback: (devices: DeviceStatus[]) => void): () => void; connect(device: string | RuntimeDevice, options?: DeviceConnectOptions): Promise; /** * @deprecated Use `devices.connect()`. Retry and route recovery are owned by * OpenRTC; legacy consumer-provided connection hooks are ignored. */ connectWithRetry(device: string | RuntimeDevice, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise; disconnect(deviceId: string): Promise; update(deviceId: string, updates: { deviceName?: string; capabilities?: RuntimeDevice['capabilities']; metadata?: string; }): Promise; delete(deviceId: string): Promise; localId(): Promise; localInfo(): Promise; localProfile(options?: { deviceName?: string; localDeviceId?: string | null; platform?: 'native' | 'web'; userId?: string | null; }): Promise; updateLocalName(deviceName: string): Promise; } interface PeerNamespace { watch(callback: (peers: RuntimePeerState[]) => void): () => void; watchLifecycle(callback: (peers: RuntimePeerState[]) => void): () => void; get(id: string): RuntimePeerState | undefined; listConnected(): RuntimePeerState[]; connect(options: PeerConnectOptions): Promise; disconnect(id: string, scope?: string): Promise; forceDisconnect(id: string): Promise; session(id: string): Promise; sessions(): Promise; waitConnected(id: string, timeoutMs?: number): Promise; readiness(id: string, timeoutMs?: number): Promise; health(id: string): Promise; identity(id: string): Promise; addScope(id: string, scope?: string): RuntimePeerState | undefined; releaseScope(id: string, scope?: string): RuntimePeerState | undefined; scopes(id: string): string[]; refresh(): Promise; } interface ChannelNamespace { register(descriptor: ChannelDescriptor): void; unregister(channelId: string): void; list(): ChannelDescriptor[]; openBi(id: string, channelId: string, options?: Omit): Promise<{ connection: Connection; readable: ReadableStream; writable: WritableStream; }>; openUni(id: string, channelId: string, options?: Omit): Promise<{ connection: Connection; writable: WritableStream; }>; onIncoming(callback: (stream: IncomingStream) => boolean | void): () => void; onIncomingChannel(channelId: string, callback: (stream: IncomingStream & { channel: NonNullable; }) => boolean | void): () => void; connect(options: ChannelConnectOptions): Promise; connectScoped(options: ScopedChannelOptions): Promise; } interface RoomNamespace { create(roomId?: string): Promise; join(roomId: string, options?: JoinRoomOptions): Promise; leave(roomId: string): Promise; watch(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void; members(roomId: string): Promise; } interface TicketNamespace { raw(): Promise; share(options?: { maxConnections?: number; }): Promise; grant(scope: GrantScope, options?: { maxConnections?: number; }): Promise; revoke(scope: GrantScope): Promise; } interface DiagnosticsNamespace { status(): Promise<{ runtime: 'tauri' | 'browser' | 'unknown'; wasmLoaded: boolean; localNodeId?: string; userId?: string; }>; policy(): PolicySnapshot; capabilities(): RuntimeCapabilities; capabilityProfile(): CapabilityProfile; connectionStates(): Promise; onStateChange(callback: (state: ConnectionState) => void): Promise<() => void> | (() => void); connections(): Connection[]; applicationReadyConnections(options?: ReadinessOptions): Connection[]; onConnection(callback: (connection: Connection) => void): () => void; onDisconnection(callback: (connection: Connection) => void): () => void; onConnectionEvent(callback: (event: ConnectionEvent) => void): () => void; forceReconnect(): void; peerReconciliation(): Readonly; } interface AdvancedNamespace { readonly runtime: RuntimeClient; readonly assembly: PlutoRuntimeAssembly; nodeId(): Promise; nodeIdFromTicket(ticket: string): Promise; endpointTicket(): Promise; connectRaw(target: { ticket: string; timeoutMs?: number; }): Promise; openBi(nodeId: string): Promise<{ readable: ReadableStream; writable: WritableStream; }>; openUni(nodeId: string): Promise>; isConnected(nodeId: string): Promise; disconnectNode(nodeId: string): Promise; excludeAutoConnect(deviceId: string, excluded: boolean): Promise; notifyNetworkChange(reason?: string): Promise; } /** * Client extends RuntimeClient with auth helpers that were * previously only available on PlutoRuntimeAssembly. * * This is the unified type returned by OpenRTC() and OpenRTC.native(). */ interface Client extends RuntimeClient { readonly devices: DeviceNamespace; readonly peers: PeerNamespace; readonly channels: ChannelNamespace; readonly rooms: RoomNamespace; readonly tickets: TicketNamespace; readonly diagnostics: DiagnosticsNamespace; readonly advanced: AdvancedNamespace; /** @deprecated Use setAuth() instead */ setAuthContext(context: AuthContext | null): Promise; /** Set auth context for the runtime */ setAuth(context: AuthContext | null): Promise; /** Sync Pluto-hosted auth to the runtime */ syncPlutoAuth(options?: { userId?: string | null; forceRefresh?: boolean; }): Promise; /** Bind Pluto auth host to auto-sync on token changes */ bindPlutoAuthHost(): () => void; /** Sign in via Pluto SSO */ signIn(): Promise; /** Sign out and clear auth context */ signOut(): Promise; /** * @deprecated Use `client.devices.startSession(...)` for the public * user-device avenue lifecycle. This top-level method remains for * RuntimeClient compatibility and advanced integrations. */ startManagedSession(options: ManagedOptions): Promise; /** * @deprecated Use `client.devices.stopSession(...)` for the public * user-device avenue lifecycle. */ stopManagedSession(options?: { preserveBackendSession?: boolean; }): Promise; /** @deprecated Use `client.rooms.create(...)`. */ createRoom(roomId?: string): Promise; /** @deprecated Use `client.rooms.join(...)`. */ joinRoom(roomId: string, options?: JoinRoomOptions): Promise; /** @deprecated Use `client.rooms.leave(...)`. */ leaveRoom(roomId: string): Promise; /** @deprecated Use `client.rooms.watch(...)`. */ watchRoom(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void; /** @deprecated Use `client.rooms.members(...)`. */ getRoomMembers(roomId: string): Promise; /** @deprecated Use `client.tickets.raw(...)`. */ getInvite(): Promise; /** @deprecated Use `client.tickets.raw(...)`. */ getTicket(): Promise; /** @deprecated Use `client.tickets.share(...)` or `client.tickets.grant(...)`. */ getTicketWithToken(scope: GrantScope, maxConnections?: number): Promise; /** @deprecated Use `client.tickets.revoke(...)`. */ revokeTokensByScope(scope: GrantScope): Promise; /** @deprecated Use `client.peers.connect(...)`. */ connectPeer(options: PeerConnectOptions): Promise; /** @deprecated Use `client.peers.connect(...)`. */ connectTo(options: PeerConnectOptions): Promise; /** @deprecated Use `client.peers.waitConnected(...)`. */ waitForConnectedPeer(id: string, timeoutMs?: number): Promise; /** @deprecated Use `client.channels.connect(...)`; use `client.channels.connectScoped(...)` only for custom lifecycle scopes. */ connectScopedChannel(options: ScopedChannelOptions): Promise; /** @deprecated Use `client.channels.openBi(...)`. */ openPeerBi(id: string, options?: PeerStreamOptions): Promise<{ connection: Connection; readable: ReadableStream; writable: WritableStream; }>; /** @deprecated Use `client.channels.openUni(...)`. */ openPeerUni(id: string, options?: PeerStreamOptions): Promise<{ connection: Connection; writable: WritableStream; }>; /** * Access to the underlying PlutoRuntimeAssembly for backward compatibility. * @deprecated Access methods directly on the client instead. */ readonly runtime: RuntimeClient; } declare function resolveOptions(options: RuntimeClientOptions): RuntimeClientOptions; declare function wrapAssembly(assembly: PlutoRuntimeAssembly, defaultManagedSessionPlatform: ManagedOptions['platform']): Client; export { type AdvancedNamespace, type ChannelConnectOptions, type ChannelNamespace, type Client, type DeviceNamespace, type DeviceSessionOptions, type DiagnosticsNamespace, type PeerNamespace, type RoomNamespace, type TicketNamespace, resolveOptions, wrapAssembly };