openrtc 0.2.1 → 1.0.1

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 (36) hide show
  1. package/README.md +49 -0
  2. package/dist/{DelegatingRuntimeAdapter-BxOcVIx_.d.ts → DelegatingRuntimeAdapter-By7pziBs.d.ts} +15 -15
  3. package/dist/IEngineBridge-C7OT2CRv.d.ts +10 -0
  4. package/dist/{IpcRuntimeAdapter-U5AEH0jn.d.ts → IpcRuntimeAdapter-DymXAsNU.d.ts} +2 -2
  5. package/dist/auth/index.js +1 -1
  6. package/dist/auth/internal.js +1 -1
  7. package/dist/chunk-A2ENDDFR.js +2 -0
  8. package/dist/chunk-CK6WQV7J.js +1 -0
  9. package/dist/{chunk-7DN33VUQ.js → chunk-EGEA3GU2.js} +1 -1
  10. package/dist/chunk-KZ3KWQTO.js +1 -0
  11. package/dist/chunk-MA2JFAV7.js +2 -0
  12. package/dist/chunk-OCNLQID3.js +1 -0
  13. package/dist/chunk-VIPNH2BE.js +3 -0
  14. package/dist/device-status-nkXepu97.d.ts +560 -0
  15. package/dist/{framing-lxzHEuSr.d.ts → framing-BUtu0oZK.d.ts} +19 -559
  16. package/dist/index.d.ts +11 -7
  17. package/dist/index.js +2 -2
  18. package/dist/openrtc_bg.wasm +0 -0
  19. package/dist/runtime/WasmRuntimeAdapter.d.ts +3 -2
  20. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  21. package/dist/runtime/device-status.d.ts +3 -0
  22. package/dist/runtime/device-status.js +1 -0
  23. package/dist/runtime/index.d.ts +86 -83
  24. package/dist/runtime/index.js +1 -1
  25. package/dist/runtime/tauri.d.ts +4 -3
  26. package/dist/runtime/tauri.js +1 -1
  27. package/dist/transport/index.d.ts +1 -1
  28. package/dist/{types-D0fRvUbN.d.ts → types-CzIpGV9x.d.ts} +87 -5
  29. package/package.json +11 -8
  30. package/dist/chunk-FQETZQPW.js +0 -2
  31. package/dist/chunk-IUHUYHNZ.js +0 -1
  32. package/dist/chunk-UBEE42VU.js +0 -2
  33. package/dist/chunk-UPO23UMZ.js +0 -3
  34. package/dist/chunk-WNJE3MJF.js +0 -1
  35. package/env/index.d.ts +0 -64
  36. package/env/index.mjs +0 -230
package/dist/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
- import { R as RuntimeClientOptions, a as RuntimeClient, b as RuntimeManagedSessionOptions, c as RuntimeManagedSession, d as RuntimeDevice, e as RuntimeDeviceStatusSnapshot, f as RuntimeDeviceConnectOptions, g as RuntimeLocalDeviceInfo, h as RuntimeLocalDeviceProfile, i as RuntimePeerState, j as RuntimePeerConnectOptions, C as Connection, k as RuntimePeerReadinessSnapshot, l as RuntimePeerHealth, m as RuntimeChannelDescriptor, n as RuntimePeerStreamOptions, o as RuntimeIncomingStream, p as RuntimeScopedChannelOptions, q as RuntimeScopedLogicalChannel, r as RuntimeJoinRoomOptions, s as RuntimeRoomMember, t as RuntimePolicySnapshot, u as RuntimeConnectionStateSnapshot, v as RuntimeApplicationPayloadReadinessOptions, w as RuntimeConnectionEvent, P as PeerReconciliationStats, x as PlutoRuntimeAssembly, y as RuntimeRawConnection, I as ITransport } from './framing-lxzHEuSr.js';
2
- export { z as ChannelDescriptor, A as ConnectionEvent, B as ConnectionTarget, D as DeviceProfile, E as IncomingStream, O as OPENRTC_RUNTIME_POLICY, F as PeerConnectOptions, G as PeerReadiness, H as PeerStreamOptions, J as PresenceLoopOptions, K as RawConnection, L as RuntimeAuthContext, M as RuntimeAuthIdentity, N as RuntimeAutoConnectPolicy, Q as RuntimeConnectionTarget, S as RuntimeDevicePresenceStatus, T as RuntimeDeviceStatus, U as RuntimeJsonFrameHandler, V as RuntimeLogicalChannelFraming, W as RuntimeManagedSessionKind, X as RuntimeManagedSessionPlatform, Y as RuntimePeerLifecycleStatus, Z as RuntimePeerScope, _ as RuntimePeerSessionSnapshot, $ as RuntimePresenceLoopOptions, a0 as RuntimePresencePolicy, a1 as RuntimeSession, a2 as RuntimeU32BEFrameHandler, a3 as RuntimeUiConnectionStatus, a4 as ScopedChannelOptions, a5 as ScopedLogicalChannel, a6 as ScopedSession, a7 as Session, a8 as SessionOptions, a9 as createRuntimeJsonFrameDecoder, aa as createRuntimeU32BEFrameDecoder, ab as decodeRuntimeJsonPayload, ac as encodeRuntimeJsonFrame, ad as encodeRuntimeJsonPayload, ae as encodeRuntimeU32BEFrame, af as getRuntimePolicy, ag as isRuntimeDeviceActive, ah as isRuntimeDeviceConnectable, ai as isRuntimeDeviceRoutable } from './framing-lxzHEuSr.js';
3
- import { k as ConnectDeviceResult, l as ConnectDeviceHooks, m as ConnectDeviceOptions, P as PeerSessionSnapshot, c as ResolvedPeerIdentity, G as GrantScope, n as ProtocolName, o as ProtocolCapability, p as ProtocolCapabilityMap, q as ApplicationPayloadCrypto, r as ApplicationCryptoStreamTools, s as SpaceTokenProvider } from './types-D0fRvUbN.js';
4
- export { t as AppLimits, u as ApplicationCryptoBiStream, v as ApplicationPayloadReadinessOptions, w as ApplicationPayloadRouteOptions, x as ApplicationPayloadSendOptions, A as AuthMode, y as DevicePresenceStatus, D as DiscoveryMode, z as ProtocolBaseName, F as ProtocolImplementationKind, H as ProtocolLocality, S as SignalingMode, J as SpaceAuthMode } from './types-D0fRvUbN.js';
5
- import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile, A as AuthContext } from './DelegatingRuntimeAdapter-BxOcVIx_.js';
6
- export { b as RuntimeAdapterKind } from './DelegatingRuntimeAdapter-BxOcVIx_.js';
7
- import { P as PlutoIpcBridge } from './IpcRuntimeAdapter-U5AEH0jn.js';
1
+ import { R as RuntimeClient, a as RuntimePolicySnapshot, P as PeerReconciliationStats, b as PlutoRuntimeAssembly } from './framing-BUtu0oZK.js';
2
+ export { O as OPENRTC_RUNTIME_POLICY, c as RuntimeJsonFrameHandler, d as RuntimeU32BEFrameHandler, S as ScopedSession, e as Session, f as SessionOptions, g as createRuntimeJsonFrameDecoder, h as createRuntimeU32BEFrameDecoder, i as decodeRuntimeJsonPayload, j as encodeRuntimeJsonFrame, k as encodeRuntimeJsonPayload, l as encodeRuntimeU32BEFrame, m as getRuntimePolicy } from './framing-BUtu0oZK.js';
3
+ import { l as ConnectDeviceResult, m as ConnectDeviceHooks, n as ConnectDeviceOptions, P as PeerSessionSnapshot, c as ResolvedPeerIdentity, G as GrantScope, o as ProtocolName, p as ProtocolCapability, q as ProtocolCapabilityMap, r as ApplicationPayloadCrypto, s as ApplicationCryptoStreamTools, t as SpaceTokenProvider } from './types-CzIpGV9x.js';
4
+ export { u as AppLimits, v as ApplicationCryptoBiStream, w as ApplicationPayloadReadinessOptions, x as ApplicationPayloadRouteOptions, y as ApplicationPayloadSendOptions, A as AuthMode, z as DevicePresenceStatus, D as DiscoveryMode, F as ProtocolBaseName, H as ProtocolImplementationKind, J as ProtocolLocality, S as SignalingMode, K as SpaceAuthMode } from './types-CzIpGV9x.js';
5
+ import { A as AuthContext } from './IEngineBridge-C7OT2CRv.js';
6
+ import { R as RuntimeClientOptions, a as RuntimeManagedSessionOptions, b as RuntimeManagedSession, c as RuntimeDevice, d as RuntimeDeviceStatusSnapshot, e as RuntimeDeviceConnectOptions, f as RuntimeLocalDeviceInfo, g as RuntimeLocalDeviceProfile, h as RuntimePeerState, i as RuntimePeerConnectOptions, C as Connection, j as RuntimePeerReadinessSnapshot, k as RuntimePeerHealth, l as RuntimeChannelDescriptor, m as RuntimePeerStreamOptions, n as RuntimeIncomingStream, o as RuntimeScopedChannelOptions, p as RuntimeScopedLogicalChannel, q as RuntimeJoinRoomOptions, r as RuntimeRoomMember, s as RuntimeConnectionStateSnapshot, t as RuntimeApplicationPayloadReadinessOptions, u as RuntimeConnectionEvent, v as RuntimeRawConnection, I as ITransport } from './device-status-nkXepu97.js';
7
+ export { w as ChannelDescriptor, x as ConnectionEvent, y as ConnectionTarget, D as DeviceProfile, z as IncomingStream, P as PeerConnectOptions, A as PeerReadiness, B as PeerStreamOptions, E as PresenceLoopOptions, F as RawConnection, G as RuntimeAuthContext, H as RuntimeAuthIdentity, J as RuntimeAutoConnectPolicy, K as RuntimeConnectionTarget, L as RuntimeDevicePresenceStatus, M as RuntimeDeviceStatus, N as RuntimeLogicalChannelFraming, O as RuntimeManagedSessionKind, Q as RuntimeManagedSessionPlatform, S as RuntimePeerLifecycleStatus, T as RuntimePeerScope, U as RuntimePeerSessionSnapshot, V as RuntimePresenceLoopOptions, W as RuntimePresencePolicy, X as RuntimeSession, Y as RuntimeUiConnectionStatus, Z as ScopedChannelOptions, _ as ScopedLogicalChannel, $ as isRuntimeDeviceActive, a0 as isRuntimeDeviceConnectable, a1 as isRuntimeDeviceRoutable } from './device-status-nkXepu97.js';
8
+ import { P as PlutoIpcBridge } from './IpcRuntimeAdapter-DymXAsNU.js';
9
+ import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile } from './DelegatingRuntimeAdapter-By7pziBs.js';
10
+ export { b as RuntimeAdapterKind } from './DelegatingRuntimeAdapter-By7pziBs.js';
8
11
  export { TRANSPORT_LABELS, isDirectIrohTransportLabel, isIndependentTransportLabel, isIrohBaseTransportLabel, isOptionalTransportLabel, isWebRtcTransportLabel, normalizeTransportLabel } from './transport/index.js';
9
12
  import './runtime/WasmRuntimeAdapter.js';
10
13
 
@@ -153,6 +156,7 @@ interface OpenRTCAdvancedNamespace {
153
156
  isConnected(nodeId: string): Promise<boolean>;
154
157
  disconnectNode(nodeId: string): Promise<void>;
155
158
  setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
159
+ notifyNetworkChange(reason?: string): Promise<void>;
156
160
  }
157
161
  /**
158
162
  * OpenRTCClient extends RuntimeClient with auth helpers that were
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import {z,A}from'./chunk-UPO23UMZ.js';export{c as KEY_AGREEMENT_ALGORITHM,b as KEY_AGREEMENT_PUBLIC_KEY_BYTES,g as ScopedSession,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,t as decodeRuntimeJsonPayload,e as deriveApplicationCryptoKey,f as encodeApplicationKeyAgreementPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,d as generateEphemeralKeyAgreement,a as getPreferredProtocolOrder,B as isRuntimeDeviceActive,D as isRuntimeDeviceConnectable,C as isRuntimeDeviceRoutable}from'./chunk-UPO23UMZ.js';import'./chunk-IUHUYHNZ.js';import {g}from'./chunk-UBEE42VU.js';export{q as OPENRTC_RUNTIME_POLICY,h as createApplicationCryptoStreamTools,g as createSharedSecretApplicationCrypto,r as getRuntimePolicy,f as isApplicationEncryptedPayload}from'./chunk-WNJE3MJF.js';import {m}from'./chunk-FQETZQPW.js';export{a as TRANSPORT_LABELS,d as isDirectIrohTransportLabel,g as isIndependentTransportLabel,c as isIrohBaseTransportLabel,e as isOptionalTransportLabel,f as isWebRtcTransportLabel,b as normalizeTransportLabel}from'./chunk-BLOEZIFJ.js';function O(t){let i=m({...t});if("auth"in t&&!t.authMode){let n=t.auth;i.authMode=n==="none"?"anonymous":n;}if("identity"in t&&!t.nodeIdPersistence){let n=t.identity;i.nodeIdPersistence=n==="temporary"?"ephemeral":n;}return "namespace"in t&&!t.storagePrefix&&(i.storagePrefix=t.namespace),"privacy"in t&&t.strictMode===void 0&&(i.strictMode=!!t.privacy),i}function T(t,i){let n=t.runtime,r=Object.create(n),s=async e=>{if(typeof e!="string")return e;let a=(await n.listDevices()).find(d=>d.deviceId===e);if(!a)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return a},c=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),p=async e=>{let{device:o,scope:a,...d}=e,g=d.deviceId??(typeof o=="string"?o:o?.deviceId)??null,y=d.ticket??(typeof o=="string"?void 0:o?.ticket);g&&!y&&(y=(await s(g).catch(()=>null))?.ticket);let P={...d,scope:a??"session"};return g&&(P.deviceId=g),y&&(P.ticket=y),P},l={list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??i}),stopSession:e=>n.stopManagedSession(e),listWithStatus:()=>n.listDevicesWithStatus(),watch:e=>n.watchDevices(e),watchWithStatus:e=>n.watchDevicesWithStatus(e),connect:async(e,o)=>n.connectDevice(await s(e),await c(o)),connectWithRetry:async(e,o,a)=>n.connectDeviceWithRetry(await s(e),o,a),disconnect:e=>n.disconnectDevice(e),update:(e,o)=>n.updateDevice(e,o),delete:e=>n.deleteDevice(e),localId:()=>n.getLocalDeviceId(),localInfo:()=>n.getLocalDeviceInfo(),localProfile:e=>n.getLocalDeviceProfile(e),updateLocalName:e=>n.updateLocalDeviceName(e)},u={watch:e=>n.watchPeerStates(e),watchLifecycle:e=>n.watchPeerLifecycle(e),get:e=>n.getPeerState(e),listConnected:()=>n.listConnectedPeers(),connect:e=>n.connectPeer(e),disconnect:(e,o)=>n.disconnectPeer(e,o),forceDisconnect:e=>n.forceDisconnectPeer(e),session:e=>n.getPeerSession(e),sessions:()=>n.listPeerSessions(),waitConnected:(e,o)=>n.waitForConnectedPeer(e,o),readiness:(e,o)=>n.getPeerReadiness(e,o),health:e=>n.getPeerHealth(e),identity:e=>n.resolvePeerIdentity(e),addScope:(e,o)=>n.addPeerScope(e,o),releaseScope:(e,o)=>n.releasePeerScope(e,o),scopes:e=>n.getPeerScopes(e),refresh:()=>n.refreshPeerSnapshot()},m={register:e=>n.registerChannel(e),unregister:e=>n.unregisterChannel(e),list:()=>n.listChannels(),openBi:(e,o,a)=>n.openPeerBi(e,{...a,channelId:o}),openUni:(e,o,a)=>n.openPeerUni(e,{...a,channelId:o}),onIncoming:e=>n.onIncomingStream(e),onIncomingChannel:(e,o)=>n.onIncomingChannelStream(e,a=>{if(a.channel)return o(a)}),connect:async e=>n.connectScopedChannel(await p(e)),connectScoped:e=>n.connectScopedChannel(e)},R={create:e=>n.createRoom(e),join:(e,o)=>n.joinRoom(e,o),leave:e=>n.leaveRoom(e),watch:(e,o)=>n.watchRoom(e,o),members:e=>n.getRoomMembers(e)},C={raw:()=>n.getInvite(),share:e=>n.getTicketWithToken("share",e?.maxConnections??1),grant:(e,o)=>n.getTicketWithToken(e,o?.maxConnections??0),revoke:e=>n.revokeTokensByScope(e)},A={status:()=>n.getRuntimeStatus(),policy:()=>n.getRuntimePolicy(),capabilities:()=>n.getRuntimeCapabilities(),capabilityProfile:()=>n.getCapabilityProfile(),connectionStates:()=>n.getConnectionStates(),onConnectionStateChange:e=>n.onConnectionStateChange(e),connections:()=>n.getConnections(),applicationReadyConnections:e=>n.getApplicationReadyConnections(e),onConnection:e=>n.onConnection(e),onDisconnection:e=>n.onDisconnection(e),onConnectionEvent:e=>n.onConnectionEvent(e),forceReconnectSnapshot:()=>n.forceReconnectSnapshot(),peerReconciliation:()=>n.getPeerReconciliationStats()},x={runtime:n,assembly:t,nodeId:()=>n.getNodeId(),nodeIdFromTicket:e=>n.getNodeIdFromTicket(e),endpointTicket:()=>n.getEndpointTicket(),connectRaw:e=>n.connectRaw(e),openBi:e=>n.openBi(e),openUni:e=>n.openUni(e),isConnected:e=>n.isConnected(e),disconnectNode:e=>n.disconnectNode(e),setAutoConnectExcluded:(e,o)=>n.setAutoConnectExcluded(e,o)};return Object.defineProperties(r,{devices:{get:()=>l,enumerable:true},peers:{get:()=>u,enumerable:true},channels:{get:()=>m,enumerable:true},rooms:{get:()=>R,enumerable:true},tickets:{get:()=>C,enumerable:true},diagnostics:{get:()=>A,enumerable:true},advanced:{get:()=>x,enumerable:true},setAuth:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},setAuthContext:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},syncPlutoAuth:{value:e=>t.syncPlutoAuth(e),enumerable:true,writable:true,configurable:true},bindPlutoAuthHost:{value:()=>t.bindPlutoAuthHost(),enumerable:true,writable:true,configurable:true},signIn:{value:()=>t.signInWithPluto(),enumerable:true,writable:true,configurable:true},signOut:{value:()=>t.signOut(),enumerable:true,writable:true,configurable:true},runtime:{get:()=>n,enumerable:false},_assembly:{get:()=>t,enumerable:false}}),r}function I(t){let i=O(t),n=z(i);return T(n,"web")}I.native=function(t,i){let n=O(t),r=i??g(),s=A(n,r);return T(s,"native")};var ie="https://api.openrtc.app";async function re(t,i,n){let r=t.replace(/\/$/,""),s=await fetch(`${r}/v1/spaces/${encodeURIComponent(n)}/scoped-auth`,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:"{}"}),c=await s.json().catch(()=>({}));if(!s.ok){let p=typeof c?.error=="string"?c.error:`enableSpaceAuth failed (${s.status})`;throw new Error(p)}return c}async function se(t,i,n){let r=await fetch(t,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>({}));if(!r.ok){let c=typeof s?.error=="string"?s.error:`mintSpaceToken failed (${r.status})`;throw new Error(c)}if(typeof s?.token!="string"||!s.token.trim())throw new Error("mintSpaceToken response missing token");return s}function S(t){let i=t.apiKey.trim(),n=(t.spaceKey??t.space??"").trim(),r=k(t.sandboxAppId),s=(t.endpointUrl??ie).replace(/\/$/,""),c=t.memberIdStorageKey??`openrtc:space-member:${n}${r?`:sandbox:${r}`:""}`;return async()=>{if(!i||!n)throw new Error("spaceToken requires apiKey and space");let p=null;typeof sessionStorage<"u"?(p=sessionStorage.getItem(c),p||(p=globalThis.crypto?.randomUUID?.()??`member-${Date.now()}`,sessionStorage.setItem(c,p))):p=`member-${Date.now()}`;let l=await fetch(`${s}/v1SpacePublicTokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:i,spaceKey:n,memberId:p,...r?{sandboxAppId:r}:{}})}),{text:u,payload:m}=await ce(l);if(!l.ok){let C=typeof m?.error=="string"?m.error:u.trim()?u.trim().slice(0,240):`public space token mint failed (${l.status})`;throw new Error(C)}let R=typeof m?.token=="string"?m.token.trim():"";if(!R)throw new Error("public space token response missing token");return {customToken:R}}}function ae(t){if(!t.trim())return {};try{let i=JSON.parse(t);return i&&typeof i=="object"?i:{}}catch{return {}}}async function ce(t){let i=t.text;if(typeof i=="function"){let r=await i.call(t).catch(()=>"");return {text:r,payload:ae(r)}}let n=await t.json().catch(()=>({}));return {text:JSON.stringify(n),payload:n&&typeof n=="object"?n:{}}}function k(t){let i=t?.trim().toLowerCase()??"";if(!i)return "";if(!/^[a-z0-9][a-z0-9-]{0,47}$/.test(i))throw new Error("sandboxAppId must be 1-48 lowercase letters, numbers, or dashes.");return i}function pe(t,i){let n=t.trim(),r=k(i);return r?`${n}::sandbox::${r}`:n}var me=S,le=S;
2
- export{I as OpenRTC,S as createPublicSpaceTokenProvider,le as createSpaceTokenProvider,re as enableSpaceAuth,se as mintSpaceToken,pe as sandboxSpaceKey,me as spaceToken};
1
+ import {z,A}from'./chunk-VIPNH2BE.js';export{c as KEY_AGREEMENT_ALGORITHM,b as KEY_AGREEMENT_PUBLIC_KEY_BYTES,g as ScopedSession,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,t as decodeRuntimeJsonPayload,e as deriveApplicationCryptoKey,f as encodeApplicationKeyAgreementPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,d as generateEphemeralKeyAgreement,a as getPreferredProtocolOrder}from'./chunk-VIPNH2BE.js';export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'./chunk-CK6WQV7J.js';import'./chunk-OCNLQID3.js';import {g}from'./chunk-MA2JFAV7.js';export{w as OPENRTC_RUNTIME_POLICY,n as createApplicationCryptoStreamTools,m as createSharedSecretApplicationCrypto,x as getRuntimePolicy,l as isApplicationEncryptedPayload}from'./chunk-KZ3KWQTO.js';import {p}from'./chunk-A2ENDDFR.js';export{a as TRANSPORT_LABELS,d as isDirectIrohTransportLabel,g as isIndependentTransportLabel,c as isIrohBaseTransportLabel,e as isOptionalTransportLabel,f as isWebRtcTransportLabel,b as normalizeTransportLabel}from'./chunk-BLOEZIFJ.js';function O(t){let i=p({...t});if("auth"in t&&!t.authMode){let n=t.auth;i.authMode=n==="none"?"anonymous":n;}if("identity"in t){let n=t.identity,r=n==="temporary"?"ephemeral":n;!t.deviceIdPersistence&&!t.nodeIdPersistence&&(i.deviceIdPersistence=r),!t.endpointIdPersistence&&!t.nodeIdPersistence&&(i.endpointIdPersistence=r);}return "namespace"in t&&!t.storagePrefix&&(i.storagePrefix=t.namespace),"privacy"in t&&t.strictMode===void 0&&(i.strictMode=!!t.privacy),i}function I(t,i){let n=t.runtime,r=Object.create(n),s=async e=>{if(typeof e!="string")return e;let a=(await n.listDevices()).find(d=>d.deviceId===e);if(!a)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return a},c=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),p=async e=>{let{device:o,scope:a,...d}=e,R=d.deviceId??(typeof o=="string"?o:o?.deviceId)??null,P=d.ticket??(typeof o=="string"?void 0:o?.ticket);R&&!P&&(P=(await s(R).catch(()=>null))?.ticket);let C={...d,scope:a??"session"};return R&&(C.deviceId=R),P&&(C.ticket=P),C},l={list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??i}),stopSession:e=>n.stopManagedSession(e),listWithStatus:()=>n.listDevicesWithStatus(),watch:e=>n.watchDevices(e),watchWithStatus:e=>n.watchDevicesWithStatus(e),connect:async(e,o)=>n.connectDevice(await s(e),await c(o)),connectWithRetry:async(e,o,a)=>n.connectDeviceWithRetry(await s(e),o,a),disconnect:e=>n.disconnectDevice(e),update:(e,o)=>n.updateDevice(e,o),delete:e=>n.deleteDevice(e),localId:()=>n.getLocalDeviceId(),localInfo:()=>n.getLocalDeviceInfo(),localProfile:e=>n.getLocalDeviceProfile(e),updateLocalName:e=>n.updateLocalDeviceName(e)},u={watch:e=>n.watchPeerStates(e),watchLifecycle:e=>n.watchPeerLifecycle(e),get:e=>n.getPeerState(e),listConnected:()=>n.listConnectedPeers(),connect:e=>n.connectPeer(e),disconnect:(e,o)=>n.disconnectPeer(e,o),forceDisconnect:e=>n.forceDisconnectPeer(e),session:e=>n.getPeerSession(e),sessions:()=>n.listPeerSessions(),waitConnected:(e,o)=>n.waitForConnectedPeer(e,o),readiness:(e,o)=>n.getPeerReadiness(e,o),health:e=>n.getPeerHealth(e),identity:e=>n.resolvePeerIdentity(e),addScope:(e,o)=>n.addPeerScope(e,o),releaseScope:(e,o)=>n.releasePeerScope(e,o),scopes:e=>n.getPeerScopes(e),refresh:()=>n.refreshPeerSnapshot()},m={register:e=>n.registerChannel(e),unregister:e=>n.unregisterChannel(e),list:()=>n.listChannels(),openBi:(e,o,a)=>n.openPeerBi(e,{...a,channelId:o}),openUni:(e,o,a)=>n.openPeerUni(e,{...a,channelId:o}),onIncoming:e=>n.onIncomingStream(e),onIncomingChannel:(e,o)=>n.onIncomingChannelStream(e,a=>{if(a.channel)return o(a)}),connect:async e=>n.connectScopedChannel(await p(e)),connectScoped:e=>n.connectScopedChannel(e)},g={create:e=>n.createRoom(e),join:(e,o)=>n.joinRoom(e,o),leave:e=>n.leaveRoom(e),watch:(e,o)=>n.watchRoom(e,o),members:e=>n.getRoomMembers(e)},y={raw:()=>n.getInvite(),share:e=>n.getTicketWithToken("share",e?.maxConnections??1),grant:(e,o)=>n.getTicketWithToken(e,o?.maxConnections??0),revoke:e=>n.revokeTokensByScope(e)},A={status:()=>n.getRuntimeStatus(),policy:()=>n.getRuntimePolicy(),capabilities:()=>n.getRuntimeCapabilities(),capabilityProfile:()=>n.getCapabilityProfile(),connectionStates:()=>n.getConnectionStates(),onConnectionStateChange:e=>n.onConnectionStateChange(e),connections:()=>n.getConnections(),applicationReadyConnections:e=>n.getApplicationReadyConnections(e),onConnection:e=>n.onConnection(e),onDisconnection:e=>n.onDisconnection(e),onConnectionEvent:e=>n.onConnectionEvent(e),forceReconnectSnapshot:()=>n.forceReconnectSnapshot(),peerReconciliation:()=>n.getPeerReconciliationStats()},w={runtime:n,assembly:t,nodeId:()=>n.getNodeId(),nodeIdFromTicket:e=>n.getNodeIdFromTicket(e),endpointTicket:()=>n.getEndpointTicket(),connectRaw:e=>n.connectRaw(e),openBi:e=>n.openBi(e),openUni:e=>n.openUni(e),isConnected:e=>n.isConnected(e),disconnectNode:e=>n.disconnectNode(e),setAutoConnectExcluded:(e,o)=>n.setAutoConnectExcluded(e,o),notifyNetworkChange:e=>n.notifyNetworkChange(e)};return Object.defineProperties(r,{devices:{get:()=>l,enumerable:true},peers:{get:()=>u,enumerable:true},channels:{get:()=>m,enumerable:true},rooms:{get:()=>g,enumerable:true},tickets:{get:()=>y,enumerable:true},diagnostics:{get:()=>A,enumerable:true},advanced:{get:()=>w,enumerable:true},setAuth:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},setAuthContext:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},syncPlutoAuth:{value:e=>t.syncPlutoAuth(e),enumerable:true,writable:true,configurable:true},bindPlutoAuthHost:{value:()=>t.bindPlutoAuthHost(),enumerable:true,writable:true,configurable:true},signIn:{value:()=>t.signInWithPluto(),enumerable:true,writable:true,configurable:true},signOut:{value:()=>t.signOut(),enumerable:true,writable:true,configurable:true},runtime:{get:()=>n,enumerable:false},_assembly:{get:()=>t,enumerable:false}}),r}function T(t){let i=O(t),n=z(i);return I(n,"web")}T.native=function(t,i){let n=O(t),r=i??g(),s=A(n,r);return I(s,"native")};var ie="https://api.openrtc.app";async function re(t,i,n){let r=t.replace(/\/$/,""),s=await fetch(`${r}/v1/spaces/${encodeURIComponent(n)}/scoped-auth`,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:"{}"}),c=await s.json().catch(()=>({}));if(!s.ok){let p=typeof c?.error=="string"?c.error:`enableSpaceAuth failed (${s.status})`;throw new Error(p)}return c}async function se(t,i,n){let r=await fetch(t,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>({}));if(!r.ok){let c=typeof s?.error=="string"?s.error:`mintSpaceToken failed (${r.status})`;throw new Error(c)}if(typeof s?.token!="string"||!s.token.trim())throw new Error("mintSpaceToken response missing token");return s}function v(t){let i=t.apiKey.trim(),n=(t.spaceKey??t.space??"").trim(),r=k(t.sandboxAppId),s=(t.endpointUrl??ie).replace(/\/$/,""),c=t.memberIdStorageKey??`openrtc:space-member:${n}${r?`:sandbox:${r}`:""}`;return async()=>{if(!i||!n)throw new Error("spaceToken requires apiKey and space");let p=null;typeof sessionStorage<"u"?(p=sessionStorage.getItem(c),p||(p=globalThis.crypto?.randomUUID?.()??`member-${Date.now()}`,sessionStorage.setItem(c,p))):p=`member-${Date.now()}`;let l=await fetch(`${s}/v1SpacePublicTokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:i,spaceKey:n,memberId:p,...r?{sandboxAppId:r}:{}})}),{text:u,payload:m}=await ce(l);if(!l.ok){let y=typeof m?.error=="string"?m.error:u.trim()?u.trim().slice(0,240):`public space token mint failed (${l.status})`;throw new Error(y)}let g=typeof m?.token=="string"?m.token.trim():"";if(!g)throw new Error("public space token response missing token");return {customToken:g}}}function ae(t){if(!t.trim())return {};try{let i=JSON.parse(t);return i&&typeof i=="object"?i:{}}catch{return {}}}async function ce(t){let i=t.text;if(typeof i=="function"){let r=await i.call(t).catch(()=>"");return {text:r,payload:ae(r)}}let n=await t.json().catch(()=>({}));return {text:JSON.stringify(n),payload:n&&typeof n=="object"?n:{}}}function k(t){let i=t?.trim().toLowerCase()??"";if(!i)return "";if(!/^[a-z0-9][a-z0-9-]{0,47}$/.test(i))throw new Error("sandboxAppId must be 1-48 lowercase letters, numbers, or dashes.");return i}function pe(t,i){let n=t.trim(),r=k(i);return r?`${n}::sandbox::${r}`:n}var me=v,le=v;
2
+ export{T as OpenRTC,v as createPublicSpaceTokenProvider,le as createSpaceTokenProvider,re as enableSpaceAuth,se as mintSpaceToken,pe as sandboxSpaceKey,me as spaceToken};
Binary file
@@ -1,5 +1,6 @@
1
- import { D as DelegatingRuntimeAdapter, W as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-BxOcVIx_.js';
2
- import '../types-D0fRvUbN.js';
1
+ import { D as DelegatingRuntimeAdapter, W as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-By7pziBs.js';
2
+ import '../types-CzIpGV9x.js';
3
+ import '../IEngineBridge-C7OT2CRv.js';
3
4
 
4
5
  declare class WasmRuntimeAdapter extends DelegatingRuntimeAdapter {
5
6
  constructor(options: WasmBridgeOptions);
@@ -1 +1 @@
1
- export{a as WasmRuntimeAdapter}from'../chunk-IUHUYHNZ.js';import'../chunk-WNJE3MJF.js';import'../chunk-FQETZQPW.js';import'../chunk-BLOEZIFJ.js';
1
+ export{a as WasmRuntimeAdapter}from'../chunk-OCNLQID3.js';import'../chunk-KZ3KWQTO.js';import'../chunk-A2ENDDFR.js';import'../chunk-BLOEZIFJ.js';
@@ -0,0 +1,3 @@
1
+ export { a2 as RuntimeDeviceActiveOptions, $ as isRuntimeDeviceActive, a0 as isRuntimeDeviceConnectable, a1 as isRuntimeDeviceRoutable } from '../device-status-nkXepu97.js';
2
+ import '../IEngineBridge-C7OT2CRv.js';
3
+ import '../types-CzIpGV9x.js';
@@ -0,0 +1 @@
1
+ export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'../chunk-CK6WQV7J.js';
@@ -1,12 +1,16 @@
1
- import { C as Connection, P as PeerReconciliationStats, Q as RuntimeConnectionTarget, y as RuntimeRawConnection } from '../framing-lxzHEuSr.js';
2
- export { z as ChannelDescriptor, A as ConnectionEvent, B as ConnectionTarget, D as DeviceProfile, E as IncomingStream, O as OPENRTC_RUNTIME_POLICY, F as PeerConnectOptions, G as PeerReadiness, H as PeerStreamOptions, x as PlutoRuntimeAssembly, J as PresenceLoopOptions, K as RawConnection, v as RuntimeApplicationPayloadReadinessOptions, L as RuntimeAuthContext, M as RuntimeAuthIdentity, N as RuntimeAutoConnectPolicy, m as RuntimeChannelDescriptor, a as RuntimeClient, R as RuntimeClientOptions, w as RuntimeConnectionEvent, u as RuntimeConnectionStateSnapshot, d as RuntimeDevice, aj as RuntimeDeviceActiveOptions, f as RuntimeDeviceConnectOptions, S as RuntimeDevicePresenceStatus, T as RuntimeDeviceStatus, e as RuntimeDeviceStatusSnapshot, ak as RuntimeFactoryOptions, o as RuntimeIncomingStream, r as RuntimeJoinRoomOptions, al as RuntimeJsonFrameDecoderOptions, U as RuntimeJsonFrameHandler, g as RuntimeLocalDeviceInfo, h as RuntimeLocalDeviceProfile, V as RuntimeLogicalChannelFraming, c as RuntimeManagedSession, W as RuntimeManagedSessionKind, b as RuntimeManagedSessionOptions, X as RuntimeManagedSessionPlatform, j as RuntimePeerConnectOptions, l as RuntimePeerHealth, Y as RuntimePeerLifecycleStatus, k as RuntimePeerReadinessSnapshot, Z as RuntimePeerScope, _ as RuntimePeerSessionSnapshot, i as RuntimePeerState, n as RuntimePeerStreamOptions, t as RuntimePolicySnapshot, $ as RuntimePresenceLoopOptions, a0 as RuntimePresencePolicy, s as RuntimeRoomMember, p as RuntimeScopedChannelOptions, q as RuntimeScopedLogicalChannel, a1 as RuntimeSession, a2 as RuntimeU32BEFrameHandler, a3 as RuntimeUiConnectionStatus, a4 as ScopedChannelOptions, am as ScopedConnectionActorError, an as ScopedConnectionActorErrorKind, ao as ScopedConnectionActorHandle, ap as ScopedConnectionActorHandleOptions, aq as ScopedConnectionActorRegistry, ar as ScopedConnectionActorState, as as ScopedConnectionClose, at as ScopedConnectionDial, au as ScopedConnectionKey, a5 as ScopedLogicalChannel, av as ScopedLogicalChannelHandle, aw as ScopedPreferredTransport, ax as Session, ay as SessionOptions, az as concatRuntimeBytes, aA as createIpcClient, a9 as createRuntimeJsonFrameDecoder, aa as createRuntimeU32BEFrameDecoder, aB as createWasmClient, ab as decodeRuntimeJsonPayload, ac as encodeRuntimeJsonFrame, ad as encodeRuntimeJsonPayload, ae as encodeRuntimeU32BEFrame, af as getRuntimePolicy, ag as isRuntimeDeviceActive, ah as isRuntimeDeviceConnectable, ai as isRuntimeDeviceRoutable, aC as readRuntimeU32BE, aD as scopedConnectionKey, aE as scopedConnectionKeyToString } from '../framing-lxzHEuSr.js';
3
- import { K as SignalingOptions, I as ISignalingBackend, R as RuntimeIdentity, d as SignalingEnvelope, f as SignalingSession, a as Device, j as BackendConnectionState, t as AppLimits, O as JoinRoomOptions, Q as RoomMember, T as IncomingStreamChannelMetadata, r as ApplicationCryptoStreamTools, U as RoomCreationMode, C as ClientOptions, q as ApplicationPayloadCrypto, D as DiscoveryMode, p as ProtocolCapabilityMap, V as ScanningLoopOptions, W as ScanningLoopHandle, l as ConnectDeviceHooks, m as ConnectDeviceOptions, k as ConnectDeviceResult, X as RuntimeBootstrapOptions, Y as RuntimeBootstrapResult, v as ApplicationPayloadReadinessOptions, Z as PeerState, _ as PeerScope, $ as PeerHealth, G as GrantScope, a0 as ChannelDescriptor, a1 as JoinRequest, i as NativeConnectResult } from '../types-D0fRvUbN.js';
1
+ import { P as PeerReconciliationStats } from '../framing-BUtu0oZK.js';
2
+ export { O as OPENRTC_RUNTIME_POLICY, b as PlutoRuntimeAssembly, R as RuntimeClient, n as RuntimeFactoryOptions, o as RuntimeJsonFrameDecoderOptions, c as RuntimeJsonFrameHandler, a as RuntimePolicySnapshot, d as RuntimeU32BEFrameHandler, D as ScopedConnectionActorError, p as ScopedConnectionActorErrorKind, q as ScopedConnectionActorHandle, r as ScopedConnectionActorHandleOptions, s as ScopedConnectionActorRegistry, t as ScopedConnectionActorState, u as ScopedConnectionClose, v as ScopedConnectionDial, w as ScopedConnectionKey, x as ScopedLogicalChannelHandle, y as ScopedPreferredTransport, z as concatRuntimeBytes, A as createIpcClient, g as createRuntimeJsonFrameDecoder, h as createRuntimeU32BEFrameDecoder, B as createWasmClient, i as decodeRuntimeJsonPayload, j as encodeRuntimeJsonFrame, k as encodeRuntimeJsonPayload, l as encodeRuntimeU32BEFrame, m as getRuntimePolicy, C as readRuntimeU32BE, E as scopedConnectionKey, F as scopedConnectionKeyToString } from '../framing-BUtu0oZK.js';
3
+ import * as Draft14 from '@moq/net';
4
+ import { O as SignalingOptions, I as ISignalingBackend, R as RuntimeIdentity, d as SignalingEnvelope, f as SignalingSession, a as Device, k as BackendConnectionState, u as AppLimits, G as GrantScope, Q as JoinRoomOptions, T as RoomMember, U as IncomingStreamChannelMetadata, s as ApplicationCryptoStreamTools, V as RoomCreationMode, C as ClientOptions, r as ApplicationPayloadCrypto, D as DiscoveryMode, q as ProtocolCapabilityMap, W as ScanningLoopOptions, X as ScanningLoopHandle, m as ConnectDeviceHooks, n as ConnectDeviceOptions, l as ConnectDeviceResult, Y as RuntimeBootstrapOptions, Z as RuntimeBootstrapResult, w as ApplicationPayloadReadinessOptions, _ as ManagedApplicationRouteOptions, $ as PeerState, a0 as PeerScope, a1 as PeerHealth, a2 as ChannelDescriptor, a3 as JoinRequest, i as NativeConnectParams, j as NativeConnectResult } from '../types-CzIpGV9x.js';
5
+ import { C as Connection, K as RuntimeConnectionTarget, v as RuntimeRawConnection } from '../device-status-nkXepu97.js';
6
+ export { w as ChannelDescriptor, x as ConnectionEvent, y as ConnectionTarget, D as DeviceProfile, z as IncomingStream, P as PeerConnectOptions, A as PeerReadiness, B as PeerStreamOptions, E as PresenceLoopOptions, F as RawConnection, t as RuntimeApplicationPayloadReadinessOptions, G as RuntimeAuthContext, H as RuntimeAuthIdentity, J as RuntimeAutoConnectPolicy, l as RuntimeChannelDescriptor, R as RuntimeClientOptions, u as RuntimeConnectionEvent, s as RuntimeConnectionStateSnapshot, c as RuntimeDevice, a2 as RuntimeDeviceActiveOptions, e as RuntimeDeviceConnectOptions, L as RuntimeDevicePresenceStatus, M as RuntimeDeviceStatus, d as RuntimeDeviceStatusSnapshot, n as RuntimeIncomingStream, q as RuntimeJoinRoomOptions, f as RuntimeLocalDeviceInfo, g as RuntimeLocalDeviceProfile, N as RuntimeLogicalChannelFraming, b as RuntimeManagedSession, O as RuntimeManagedSessionKind, a as RuntimeManagedSessionOptions, Q as RuntimeManagedSessionPlatform, i as RuntimePeerConnectOptions, k as RuntimePeerHealth, S as RuntimePeerLifecycleStatus, j as RuntimePeerReadinessSnapshot, T as RuntimePeerScope, U as RuntimePeerSessionSnapshot, h as RuntimePeerState, m as RuntimePeerStreamOptions, V as RuntimePresenceLoopOptions, W as RuntimePresencePolicy, r as RuntimeRoomMember, o as RuntimeScopedChannelOptions, p as RuntimeScopedLogicalChannel, X as RuntimeSession, Y as RuntimeUiConnectionStatus, Z as ScopedChannelOptions, _ as ScopedLogicalChannel, a3 as Session, a4 as SessionOptions, $ as isRuntimeDeviceActive, a0 as isRuntimeDeviceConnectable, a1 as isRuntimeDeviceRoutable } from '../device-status-nkXepu97.js';
4
7
  import { FirebaseApp } from 'firebase/app';
5
- import { R as RuntimeCapabilities } from '../DelegatingRuntimeAdapter-BxOcVIx_.js';
6
- export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, c as NativeRuntimeStatusSnapshot, d as NativeRuntimeTransportFeatureStatus, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile, e as cloneRuntimeCapabilities, r as runtimeCapabilitiesFromNativeStatus, f as runtimeCapabilityProfile } from '../DelegatingRuntimeAdapter-BxOcVIx_.js';
7
- export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, b as NativeIpcFailureKind, P as PlutoIpcBridge, c as PlutoIpcUnlisten, d as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../IpcRuntimeAdapter-U5AEH0jn.js';
8
+ import { R as RuntimeCapabilities } from '../DelegatingRuntimeAdapter-By7pziBs.js';
9
+ export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, c as NativeRuntimeStatusSnapshot, d as NativeRuntimeTransportFeatureStatus, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile, e as cloneRuntimeCapabilities, r as runtimeCapabilitiesFromNativeStatus, f as runtimeCapabilityProfile } from '../DelegatingRuntimeAdapter-By7pziBs.js';
10
+ export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, b as NativeIpcFailureKind, P as PlutoIpcBridge, c as PlutoIpcUnlisten, d as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../IpcRuntimeAdapter-DymXAsNU.js';
8
11
  export { WasmRuntimeAdapter } from './WasmRuntimeAdapter.js';
9
12
  export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge } from './tauri.js';
13
+ import '../IEngineBridge-C7OT2CRv.js';
10
14
 
11
15
  /**
12
16
  * RtdbPresence — Phase 1 RTDB-backed device presence.
@@ -19,30 +23,33 @@ export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge }
19
23
  *
20
24
  * RTDB paths mirror the Firestore device collection paths:
21
25
  *
22
- * space/spaceKey → presence/spaces/{namespaceId}/devices/{deviceId}
23
- * user-scoped → presence/{appTag}/users/{userId}/devices/{deviceId}
26
+ * space/spaceKey → presence/spaces/{namespaceId}/devices/{deviceId}/instances/{runtimeInstanceId}
27
+ * user-scoped → presence/{appTag}/users/{userId}/devices/{deviceId}/instances/{runtimeInstanceId}
24
28
  *
25
29
  * Space RTDB paths require scoped Firebase auth
26
- * (`namespaceId` or `space::{namespaceId}` appTag claim). The browser bridge
27
- * skips space RTDB until such auth is available and uses Firestore as the
28
- * compatibility fallback.
30
+ * (`namespaceId` or `space::{namespaceId}` appTag claim). If that scope is not
31
+ * available, Firestore may still hold the durable ticket record, but it must
32
+ * not become a recurring liveness heartbeat.
29
33
  *
30
34
  * Ticket version invalidation:
31
35
  * Each presence node stores a `ticketVersion` integer. WasmBridge bumps it
32
- * whenever it writes a new Firestore ticket (network change, reconnect).
33
- * Subscribers compare the received ticketVersion against their cached value;
34
- * if it differs they re-fetch the full device doc from Firestore. This means
35
- * other clients never hold a stale connection ticket for more than one RTDB
36
- * heartbeat interval (~1 s), eliminating the P2P-failure→Firestore fallback.
36
+ * whenever it publishes a new endpoint ticket. Subscribers compare the
37
+ * received ticketVersion against their cached value; if it differs they
38
+ * re-fetch the full device doc from Firestore when needed. Presence nodes may
39
+ * also carry the current ticket directly so native clients can refresh
40
+ * connection data without using Firestore as a heartbeat bus.
37
41
  */
38
42
 
39
43
  interface RtdbDevicePresence {
40
44
  online: boolean;
41
45
  ticketVersion: number;
46
+ leaseExpiresAt?: number;
42
47
  ticket?: string;
43
48
  nodeId?: string;
44
49
  deviceName?: string;
50
+ platformType?: string;
45
51
  metadata?: string;
52
+ excludedPeers?: string[];
46
53
  }
47
54
  type RtdbPresenceMap = Record<string, RtdbDevicePresence>;
48
55
  type DiscoveryPresenceScope = {
@@ -57,20 +64,27 @@ interface RtdbPresenceRosterFields {
57
64
  ticket?: string;
58
65
  nodeId?: string;
59
66
  deviceName?: string;
67
+ platformType?: string;
60
68
  metadata?: string;
69
+ excludedPeers?: string[];
61
70
  }
62
71
  interface RtdbMemberPresence {
63
72
  online: boolean;
73
+ leaseExpiresAt?: number;
64
74
  }
65
75
  type RtdbRoomPresenceMap = Record<string, RtdbMemberPresence>;
66
76
  declare class RtdbPresence {
67
77
  private readonly db;
78
+ private readonly runtimeInstanceId;
68
79
  private readonly desiredOnlineNodes;
69
80
  private connected;
70
81
  private connectedUnsubscribe;
71
- constructor(app: FirebaseApp);
82
+ private leaseRefreshTimer;
83
+ constructor(app: FirebaseApp, runtimeInstanceId?: string);
72
84
  private ensureReconnectWatch;
73
85
  private publishDesiredOnline;
86
+ private ensureLeaseRefresh;
87
+ private stopLeaseRefreshIfIdle;
74
88
  private registerOnlineNode;
75
89
  private markNodeOffline;
76
90
  private subscribeIncremental;
@@ -78,15 +92,15 @@ declare class RtdbPresence {
78
92
  * Register this device as online in RTDB and set an onDisconnect handler
79
93
  * so the server marks it offline automatically on connection loss.
80
94
  *
81
- * Should be called once per session, after a Firestore ticket has been
82
- * written. Does not replace the Firestore device doc — that remains the
83
- * source of truth for the connection ticket and metadata.
95
+ * Should be called once per session, after the durable Firestore device
96
+ * record exists. Does not replace the Firestore device doc — that remains
97
+ * the durable registry while RTDB owns hot liveness.
84
98
  */
85
99
  registerDevice(scope: DiscoveryPresenceScope, deviceId: string, ticketVersion?: number, fields?: RtdbPresenceRosterFields): Promise<void>;
86
100
  /**
87
- * Bump the ticketVersion for a device. Call this whenever a new Firestore
88
- * ticket is written (e.g. on network change / node restart). Subscribers
89
- * will see the version change and re-fetch the Firestore doc.
101
+ * Bump the ticketVersion for a device. Call this whenever a new endpoint
102
+ * ticket is published (e.g. on network change / node restart). Subscribers
103
+ * will see the version change and re-fetch or use the RTDB-carried ticket.
90
104
  */
91
105
  bumpTicketVersion(scope: DiscoveryPresenceScope, deviceId: string, newVersion: number, fields?: RtdbPresenceRosterFields): Promise<void>;
92
106
  /**
@@ -178,30 +192,20 @@ interface MoQSubscriberOptions {
178
192
  maxBufferedBytesPerTrack?: number;
179
193
  maxObjectPayloadBytes?: number;
180
194
  }
195
+ /** Draft-14 subscriber facade; session reconnect remains owned by MoQController. */
181
196
  declare class MoQSubscriber {
182
- private session;
183
- private readonly maxPendingSubscriptions;
197
+ private readonly session;
198
+ private readonly onObject;
199
+ private readonly subscriptions;
200
+ private readonly maxSubscriptions;
184
201
  private readonly maxSubscribeRetries;
185
202
  private readonly subscribeRetryDelayMs;
186
- private readonly maxBufferedGroupsPerTrack;
187
- private readonly maxBufferedFramesPerGroup;
188
- private readonly maxBufferedBytesPerTrack;
189
203
  private readonly maxObjectPayloadBytes;
190
- private onObject;
191
- constructor(session: MoQSession, onObject: (ns: string, name: string, obj: Uint8Array, meta: any) => void, options?: MoQSubscriberOptions);
192
- private aliasMap;
193
- private nextAlias;
194
- private nextSubscribeId;
195
- private pendingSubscriptions;
196
- private deliveryState;
197
- private activeSubscriptions;
204
+ private closed;
205
+ constructor(session: MoQSession, onObject: (trackNamespace: string, trackName: string, object: Uint8Array, metadata: unknown) => void, options?: MoQSubscriberOptions);
198
206
  subscribe(namespace: string, name: string): Promise<void>;
199
- onSubscribeOk(subscribeId: number): void;
200
- onSubscribeError(subscribeId: number, code: number): Promise<void>;
201
- onSubscribeDone(subscribeId: number, code: number, reason: string): void;
202
- private wakeDelivery;
203
- private runDeliveryLoop;
204
- handleIncomingUniStream(stream: ReadableStream<Uint8Array>): Promise<void>;
207
+ close(): void;
208
+ private consume;
205
209
  }
206
210
 
207
211
  interface TransportInterface {
@@ -210,41 +214,34 @@ interface TransportInterface {
210
214
  writable: WritableStream<Uint8Array>;
211
215
  }>;
212
216
  createUnidirectionalStream(): Promise<WritableStream<Uint8Array>>;
213
- incomingBidirectionalStreams: ReadableStream<any>;
217
+ incomingBidirectionalStreams: ReadableStream<unknown>;
214
218
  incomingUnidirectionalStreams: ReadableStream<ReadableStream<Uint8Array>>;
215
219
  close(): void;
216
220
  ready: Promise<void>;
217
221
  }
222
+ /**
223
+ * Draft-14 MoQT adapter. The OpenRTC controller owns reconnect and lifecycle;
224
+ * this class owns only one negotiated relay session and its protocol handles.
225
+ */
218
226
  declare class MoQSession {
219
- transport: TransportInterface;
220
- private controlStreamWriter;
221
- private controlStreamReader;
222
- private uniStreamReader;
227
+ readonly transport: TransportInterface;
228
+ private readonly relayUrl;
229
+ readonly publisher: MoQPublisher;
230
+ readonly subscriber: MoQSubscriber;
231
+ setupComplete: boolean;
232
+ private connection;
223
233
  private closeListeners;
224
234
  private closed;
225
235
  private closeEmitted;
226
- private resourcesClosed;
227
- private role;
228
- setupComplete: boolean;
229
236
  private setupResolve;
230
- private setupPromise;
231
- maxSubscribeId: number;
232
- private streamBuffer;
233
- publisher: MoQPublisher;
234
- subscriber: MoQSubscriber;
235
- constructor(transport: TransportInterface, onObject?: (ns: string, name: string, obj: Uint8Array, meta: any) => void, role?: number);
236
- /** Wait for handshake to complete before sending ANNOUNCE/SUBSCRIBE */
237
- waitForSetup(): Promise<void>;
237
+ private readonly setupPromise;
238
+ constructor(transport: TransportInterface, onObject?: (ns: string, name: string, obj: Uint8Array, meta: unknown) => void, role?: number, relayUrl?: URL);
239
+ requireConnection(): Draft14.Connection.Established;
238
240
  init(): Promise<void>;
241
+ waitForSetup(): Promise<void>;
239
242
  onClose(callback: (reason?: unknown) => void): () => void;
240
243
  close(): void;
241
- private cleanupResources;
242
244
  private emitClose;
243
- private readUniStreams;
244
- sendControlMessage(msg: any): Promise<void>;
245
- private readLoop;
246
- private processBuffer;
247
- private handleControlMessage;
248
245
  }
249
246
 
250
247
  interface MoQPublisherOptions {
@@ -254,26 +251,31 @@ interface MoQPublisherOptions {
254
251
  maxActivePublishers?: number;
255
252
  maxTrackIdChars?: number;
256
253
  }
254
+ interface TrackPublisher {
255
+ close(): void;
256
+ push(data: Uint8Array, init: {
257
+ isKey: boolean;
258
+ timestamp: number;
259
+ closeAfterPush?: boolean;
260
+ }): Promise<void>;
261
+ }
262
+ /** Draft-14 publisher facade preserving OpenRTC's existing data-track API. */
257
263
  declare class MoQPublisher {
258
- private session;
259
- private tracks;
260
- private activePublishers;
261
- private readonly maxPendingAnnounces;
262
- private readonly announceTimeoutMs;
264
+ private readonly session;
265
+ private readonly namespaces;
266
+ private readonly activePublishers;
267
+ private readonly maxNamespaces;
263
268
  private readonly maxSubscribedTracks;
264
269
  private readonly maxActivePublishers;
265
270
  private readonly maxTrackIdChars;
271
+ private closed;
266
272
  constructor(session: MoQSession, options?: MoQPublisherOptions);
267
- private pendingAnnounces;
268
273
  announce(namespace: string): Promise<void>;
269
- onAnnounceResult(namespace: string, error?: {
270
- code: number;
271
- reason: string;
272
- }): void;
273
- onSubscribe(msg: any): void;
274
- onUnsubscribe(subscribeId: number): void;
275
274
  hasTrackSubscriber(namespace: string, name: string): boolean;
276
- createTrack(namespace: string, name: string): Promise<any>;
275
+ createTrack(namespace: string, name: string): Promise<TrackPublisher>;
276
+ close(): void;
277
+ private acceptTrackRequests;
278
+ private totalSubscriberCount;
277
279
  private resolveTrackId;
278
280
  }
279
281
 
@@ -297,7 +299,7 @@ interface RoomClientHost {
297
299
  roomCreationMode: 'client-open' | 'client-auth' | 'server-only';
298
300
  appLimits: AppLimits;
299
301
  ensureAuthenticated(reason: 'room-op'): Promise<void>;
300
- getTicket(): Promise<string>;
302
+ getTicketWithToken(grantScope: GrantScope, maxConnections?: number): Promise<string>;
301
303
  getNodeId(): Promise<string>;
302
304
  connect(ticket: string, timeoutMs?: number): Promise<Connection>;
303
305
  refreshHostedAppSettings(force?: boolean): Promise<void>;
@@ -381,6 +383,7 @@ declare class Client {
381
383
  attachIncomingStreamSource(source: unknown, localNodeId: string): void;
382
384
  getApplicationCrypto(connection?: Connection): ApplicationPayloadCrypto | undefined;
383
385
  resolveApplicationCryptoForPeer(peerId?: string, connection?: Connection): ApplicationPayloadCrypto | undefined;
386
+ releaseApplicationKeyAgreementReply(connectionId: string, action: 'response' | 'ack', claimId: string): void;
384
387
  waitForApplicationCryptoForPeer(peerId?: string, timeoutMs?: number): Promise<ApplicationPayloadCrypto | undefined>;
385
388
  destroy(): void;
386
389
  dispose(): void;
@@ -451,6 +454,7 @@ declare class Client {
451
454
  getApplicationReadyConnections(options?: ApplicationPayloadReadinessOptions): Connection[];
452
455
  getConnectionForPeer(connectionId?: string, remoteNodeId?: string): Connection | null;
453
456
  hasApplicationRouteForPeer(connectionId?: string, remoteNodeId?: string): boolean;
457
+ ensureManagedApplicationRoute(options: ManagedApplicationRouteOptions): Promise<Connection>;
454
458
  watchPeerStates(callback: (peers: PeerState[]) => void): () => void;
455
459
  getPeerState(id: string): PeerState | undefined;
456
460
  listConnectedPeers(): PeerState[];
@@ -470,6 +474,7 @@ declare class Client {
470
474
  ticket?: string;
471
475
  scope?: PeerScope;
472
476
  channelId?: string;
477
+ timeoutMs?: number;
473
478
  respectManualDisconnect?: boolean;
474
479
  }): Promise<Connection>;
475
480
  clearManualDisconnectProjection(id: string): void;
@@ -529,11 +534,9 @@ declare class Client {
529
534
  declare class RuntimeConnectionController {
530
535
  private readonly client;
531
536
  private readonly backend;
532
- constructor(client: Client, backend: ISignalingBackend | null);
533
- connectToDevice(params: {
534
- deviceId?: string | null;
535
- endpointTicket: string;
536
- }): Promise<NativeConnectResult>;
537
+ private readonly onLifecycleMutation;
538
+ constructor(client: Client, backend: ISignalingBackend | null, onLifecycleMutation?: () => void);
539
+ connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
537
540
  connectRaw(target: RuntimeConnectionTarget): Promise<RuntimeRawConnection>;
538
541
  openBi(nodeId: string): Promise<{
539
542
  readable: ReadableStream<Uint8Array>;
@@ -1 +1 @@
1
- export{y as RuntimeClient,h as RuntimeConnectionController,l as ScopedConnectionActorError,o as ScopedConnectionActorHandle,p as ScopedConnectionActorRegistry,k as clog,w as concatRuntimeBytes,j as correlationForDriveGrantScope,A as createIpcClient,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,z as createWasmClient,t as decodeRuntimeJsonPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,B as isRuntimeDeviceActive,D as isRuntimeDeviceConnectable,C as isRuntimeDeviceRoutable,x as readRuntimeU32BE,i as renderCorrelationFields,m as scopedConnectionKey,n as scopedConnectionKeyToString}from'../chunk-UPO23UMZ.js';export{a as WasmRuntimeAdapter}from'../chunk-IUHUYHNZ.js';export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-7DN33VUQ.js';export{h as IpcRuntimeAdapter,e as classifyNativeIpcFailure,f as isNativeIpcCommandUnavailable}from'../chunk-UBEE42VU.js';export{s as BROWSER_WASM_RUNTIME_CAPABILITIES,t as NATIVE_IPC_RUNTIME_CAPABILITIES,q as OPENRTC_RUNTIME_POLICY,u as cloneRuntimeCapabilities,r as getRuntimePolicy,i as logOpenRtcTeardownTrace,c as openRtcDebug,b as openRtcDebugEnabled,d as openRtcDebugInfo,e as openRtcDebugLog,v as runtimeCapabilitiesFromNativeStatus,w as runtimeCapabilityProfile}from'../chunk-WNJE3MJF.js';import'../chunk-FQETZQPW.js';import'../chunk-BLOEZIFJ.js';
1
+ export{y as RuntimeClient,h as RuntimeConnectionController,l as ScopedConnectionActorError,o as ScopedConnectionActorHandle,p as ScopedConnectionActorRegistry,k as clog,w as concatRuntimeBytes,j as correlationForDriveGrantScope,A as createIpcClient,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,z as createWasmClient,t as decodeRuntimeJsonPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,x as readRuntimeU32BE,i as renderCorrelationFields,m as scopedConnectionKey,n as scopedConnectionKeyToString}from'../chunk-VIPNH2BE.js';export{a as isRuntimeDeviceActive,c as isRuntimeDeviceConnectable,b as isRuntimeDeviceRoutable}from'../chunk-CK6WQV7J.js';export{a as WasmRuntimeAdapter}from'../chunk-OCNLQID3.js';export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-EGEA3GU2.js';export{h as IpcRuntimeAdapter,e as classifyNativeIpcFailure,f as isNativeIpcCommandUnavailable}from'../chunk-MA2JFAV7.js';export{y as BROWSER_WASM_RUNTIME_CAPABILITIES,z as NATIVE_IPC_RUNTIME_CAPABILITIES,w as OPENRTC_RUNTIME_POLICY,A as cloneRuntimeCapabilities,x as getRuntimePolicy,o as logOpenRtcTeardownTrace,b as openRtcDebug,a as openRtcDebugEnabled,c as openRtcDebugInfo,d as openRtcDebugLog,B as runtimeCapabilitiesFromNativeStatus,C as runtimeCapabilityProfile}from'../chunk-KZ3KWQTO.js';import'../chunk-A2ENDDFR.js';import'../chunk-BLOEZIFJ.js';
@@ -1,6 +1,7 @@
1
- import { I as IpcRuntimeAdapter, N as NativeIpcBridgeOptions, P as PlutoIpcBridge } from '../IpcRuntimeAdapter-U5AEH0jn.js';
2
- import '../types-D0fRvUbN.js';
3
- import '../DelegatingRuntimeAdapter-BxOcVIx_.js';
1
+ import { I as IpcRuntimeAdapter, N as NativeIpcBridgeOptions, P as PlutoIpcBridge } from '../IpcRuntimeAdapter-DymXAsNU.js';
2
+ import '../types-CzIpGV9x.js';
3
+ import '../DelegatingRuntimeAdapter-By7pziBs.js';
4
+ import '../IEngineBridge-C7OT2CRv.js';
4
5
 
5
6
  /**
6
7
  * @deprecated Native Tauri support now lives in the first-party `openrtc-tauri` package.
@@ -1 +1 @@
1
- export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-7DN33VUQ.js';import'../chunk-UBEE42VU.js';import'../chunk-WNJE3MJF.js';import'../chunk-FQETZQPW.js';import'../chunk-BLOEZIFJ.js';
1
+ export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-EGEA3GU2.js';import'../chunk-MA2JFAV7.js';import'../chunk-KZ3KWQTO.js';import'../chunk-A2ENDDFR.js';import'../chunk-BLOEZIFJ.js';
@@ -1,4 +1,4 @@
1
- import { n as ProtocolName } from '../types-D0fRvUbN.js';
1
+ import { o as ProtocolName } from '../types-CzIpGV9x.js';
2
2
 
3
3
  declare const TRANSPORT_LABELS: readonly ProtocolName[];
4
4
  declare function normalizeTransportLabel(value: unknown): ProtocolName | undefined;