@lavitre/apps 1.56.2 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"Frame.js","sourceRoot":"","sources":["../../Frame/Frame.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AACpF,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,2BAA2B,EAC3B,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,6BAA6B,CAAA;AA6DpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,uBAAuB,GAExB,MAAM,uBAAuB,CAAA;AAmC9B,MAAM,OAAO,KAAK;IA2VhB;8DAC0D;IAC1D,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;IACtB,CAAC;IACD,IAAI,MAAM,CAAC,GAAU;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAQD;;;;;;;OAOG;IACI,sBAAsB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;oBAC3B,MAAK;YACT,CAAC;QACH,CAAC,CAAA;QAEH,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,cAAc,CACtC,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YAC1D,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAA;QACpD,CAAC,CACF,CAAA;QAED,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;YACE,IAAI,EAAE,gCAAgC;YACtC,OAAO,EAAE,UAAU;SACpB,EACD,GAAG,EACH,CAAC,OAAO,CAAC,KAAK,CAAC,CAChB,CAAA;QAED,MAAM,CAAC,gBAAgB,CACrB,SAAS,EACT,cAAc,CACZ,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YACzD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACtD,CAAC,CACF,EACD,KAAK,CACN,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/// <reference path=\"../Connector/insertable-streams.d.ts\" />\nimport { randomUuid } from '../Common/Uuid.js'\nimport type * as Y from 'yjs'\nimport { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js'\nimport { BlobStore } from '../Common/BlobStore.js'\nimport { AiChannel, MIN_AI_HOST_VERSION } from '../Common/AiChannel.js'\nimport { isMinVersion } from '../Common/index.js'\nimport { AppSettingsError, APP_SETTINGS_TIMEOUT_MS } from '../Common/AppSettings.js'\nimport {\n PublicStorageError,\n PUBLIC_STORAGE_TIMEOUT_MS,\n PUBLIC_STORAGE_PUT_TIMEOUT_MS,\n MAX_PUBLIC_FILE_SIZE_BYTES,\n validateExpiresIn,\n putPublicFileExpiryField,\n withDownloadUrlFallback,\n} from '../Common/PublicStorage.js'\nimport type { PublicStorageApi } from '../Common/PublicStorage.js'\nimport {\n PrivateStorageError,\n PRIVATE_STORAGE_TIMEOUT_MS,\n PRIVATE_STORAGE_PUT_TIMEOUT_MS,\n PRIVATE_STORAGE_GET_TIMEOUT_MS,\n MAX_PRIVATE_FILE_SIZE_BYTES,\n validatePrivatePath,\n validatePrivateExpiresIn,\n validateLinkExpiresIn,\n privateFileExpiryField,\n} from '../Common/PrivateStorage.js'\nimport type { PrivateStorageApi } from '../Common/PrivateStorage.js'\nimport type {\n AppId,\n AppSettingsLevel,\n AppSettingsValue,\n BluetoothFromApp,\n BluetoothToApp,\n BorderOptions,\n CompanionInformation,\n ConnectedMediaDevice,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceMessageReceived,\n DeviceScalingUpdated,\n Field,\n FileData,\n FramePeer,\n HostInformation,\n KnockKnock,\n LayoutPosition,\n LoadedFrame,\n MessageTarget,\n NotificationButtonClicked,\n NotificationInfo,\n PositionUpdated,\n SafeAreaInsets,\n SafeAreaInsetsUpdated,\n Privacy,\n PrivateFile,\n PrivateFileLink,\n PrivateStorageListResult,\n PublicFile,\n PublicStorageListResult,\n Rect,\n ReplacedBy,\n RequestSerialPortAccess,\n RequestStreamSizeUpdate,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToSerialPort,\n StateReplaced,\n StatsResponse,\n StreamCapture,\n UpdatedStateEntry,\n UpdateStateEntry,\n Visibility,\n VisibilityChanged,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type {\n Connector,\n ShareStreamOptions,\n ShareStreamTrack,\n} from '../Connector/index.js'\nimport type { MediaTrackInfo } from '../Connector/Connector.Model.js'\nimport { apiVersion } from '../Version.js'\nimport {\n acceptSharedStreamOffer,\n type SharedStreamPeer,\n} from './SharedStreamPeer.js'\nimport type {\n ApplyStreamAdvancedConstraints,\n AvailableExportSource,\n ExportData,\n ExportRequest,\n FrameApiMessagesIn,\n FrameApiMessagesOut,\n FrameMenuEntry,\n IceServerConfig,\n InitFrameOptions,\n InitializeFrame,\n SharedStreamPlayState,\n ViewOptions,\n} from './Frame.Model.js'\n\ninterface RequestResolver {\n isHandled: (msg: FrameApiMessagesIn) => boolean\n}\n\nexport type SharedStreamState = {\n position: number\n duration: number\n volume: number\n state: SharedStreamPlayState\n}\n\nexport type SharedStream = {\n lastState: SharedStreamState\n play: () => void\n pause: () => void\n seek: (position: number, isRelative?: boolean) => void\n setVolume: (volume: number) => void\n}\n\nexport class Frame {\n public onDeviceJoined?: (device: Device) => void\n public onDeviceLeft?: (deviceId: string) => void\n public onDeviceMessageReceived?: (message: DeviceMessageReceived) => void\n public onLocalConnectorMessageReceived?: (\n message: any,\n from?: string,\n fileData?: FileData,\n ) => void\n public onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void\n public onFieldUpdated?: (field: Field) => void\n public onInteractingChanged?: (isInteracting: boolean) => void\n public onPrivacyChanged?: (privacy: Privacy) => void\n public onFileProgress?: (bytes: number, totalBytes: number) => void\n public onFileLoaded?: (file: ArrayBufferLike) => void\n public onExportRequest?: (\n request: ExportRequest,\n resolve: (data: ExportData) => void,\n reject: (error: string) => void,\n ) => void\n public onKnockKnock?: (knockKnock: KnockKnock) => void\n public onSettingsUpdated?: (settings: any) => void\n /**\n * Pushed whenever the AppSettings value at a given level changes — see\n * {@link getSettings} / {@link setSettings}. Fires for changes made by\n * this app itself as well as by another vitre/app instance sharing the\n * same team/space. Added 1.52.\n */\n public onSettingsChanged?: (change: AppSettingsValue) => void\n public onVitreSettingsUpdated?: (settings: VitreSettings) => void\n public onConnectionCodeUpdated?: (companionCode?: string) => void\n public onNotificationDismissed?: (notificationId: string) => void\n public onNotificationButtonClicked?: (\n notificationButton: NotificationButtonClicked,\n ) => void\n public onDevicePrivacyChanged?: (device: Device) => void\n public onDeviceFrameLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameConnectorLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameUnloaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onMessageReceived?: (msg: FrameApiMessagesIn) => void\n public onPendingDevicesConnectionRequested?: (\n pendingClients: Device[],\n ) => void\n /**\n * Peer-presence events for the companion frame. `onCompanionFramePeersUpdated`\n * is the AUTHORITATIVE full snapshot — it fires on every change with the\n * complete current peer set. `onCompanionFramePeerJoined` /\n * `onCompanionFramePeerLeft` are convenience incremental events derived\n * from the same underlying stream.\n *\n * Subscribe to ONE model, not both: either consume the snapshot and\n * recompute, or consume the incremental pair — wiring up both will\n * double-count every transition.\n */\n public onCompanionFramePeerJoined?: (peer: FramePeer) => void\n public onCompanionFramePeerLeft?: (peerId: string) => void\n public onCompanionFramePeersUpdated?: (peers: FramePeer[]) => void\n /**\n * @deprecated Use onBorderOptionsUpdated\n */\n public onBorderlessChanged?: (isBorderless: boolean) => void\n public onFullscreenChanged?: (isFullscreen: boolean) => void\n public onBorderOptionsUpdated?: (borderOptions: BorderOptions) => void\n public onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void\n public onStateReplaced?: (\n newState: Record<string, any>,\n oldState: Record<string, any>,\n replacedBy: ReplacedBy,\n delta: UpdatedStateEntry[],\n ) => void\n public onPositionUpdated?: (positionUpdate: PositionUpdated) => void\n /**\n * The host moved a system bar over an edge-to-edge frame (device rotated,\n * navigation mode switched). `safeAreaInsets` and the\n * `--lavitre-safe-area-inset-*` CSS variables are already updated when\n * this fires. Added 1.51.\n */\n public onSafeAreaInsetsUpdated?: (msg: SafeAreaInsetsUpdated) => void\n public onDeviceFullscreenUpdated?: (\n deviceFullscreenUpdated: DeviceFullscreenUpdated,\n ) => void\n public onVisibilityChanged?: (msg: VisibilityChanged) => void\n public onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void\n public onUpdateFrameName?: (name: string) => void\n public onSharedStreamUpdate?: (msg: SharedStreamState) => void\n /**\n * Reverse breakout box: fires when the Vitre host exposes a live\n * `MediaStream` it owns INTO this frame (e.g. a received shared camera, or a\n * companion stream routed to this frame for transformation). The stream is\n * rebuilt locally via `MediaStreamTrackGenerator` from transferred readables\n * — zero re-encode, same-site + Chromium only. Elsewhere (a web guest whose\n * page is on another site than the app, Safari, Firefox) the host sends it\n * over a local RTCPeerConnection instead; the callback is the same.\n * `streamId` matches a later `onSharedStreamRemoved`. Inverse of\n * {@link shareStream}.\n */\n public onSharedStream?: (streamId: string, stream: MediaStream) => void\n public onSharedStreamRemoved?: (streamId: string) => void\n public onMediaDevicesChanged?: (devices: ConnectedMediaDevice[]) => void\n public onBluetoothMessage?: (msg: BluetoothToApp) => void\n /** @deprecated Use `crdt.onSynced` */\n public onYjsSynced?: () => void\n /** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */\n public onYjsUpdate?: (update: Uint8Array) => void\n public hostInformation: HostInformation\n /**\n * Distances from the frame's edges to the area free of system UI, in CSS\n * px. Non-zero only for a companion frame declared\n * `CompanionFrameOption.edgeToEdge`, on a host drawing under the system\n * bars (Android). Also exposed as `--lavitre-safe-area-inset-top|right|\n * bottom|left` on `document.documentElement`, so plain CSS can use them:\n * `padding-bottom: var(--lavitre-safe-area-inset-bottom, 0px)`. Updated in\n * place before `onSafeAreaInsetsUpdated` fires. Added 1.51.\n */\n public safeAreaInsets: SafeAreaInsets = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }\n /**\n * The companion's own identity/runtime context, present only when this\n * frame is loaded by a la Vitre **companion** (`hostInformation.isCompanion`\n * is then true). Undefined on Vitre-side frames. Mirrors\n * `CompanionConnector.companionInformation`. Added 1.19.\n */\n public companionInformation?: CompanionInformation\n public initiator: Device\n public id: string\n public appId: string\n public initOptions: InitFrameOptions\n /**\n * @deprecated Use initOptions.border.modeinitOptions\n */\n public isBorderless: boolean\n public isFullscreen: boolean\n public state: Record<string, any> = {}\n\n /**\n * CRDT channel — Yjs doc + Awareness piped over the la Vitre transport.\n * Libraries (Carbone, …) can call `crdt.attach(doc, awareness)` to bring\n * their own; simple apps use `crdt.doc` / `crdt.awareness` directly.\n */\n public readonly crdt: CrdtChannel\n\n /**\n * CRDT-backed blob store built on `crdt.attachSubdoc` — see Connector.blobs.\n */\n public readonly blobs: BlobStore\n\n /**\n * Public, unauthenticated file storage scoped to the vitre's TEAM — see\n * the README \"Public storage\" section for the full semantics (scopes,\n * allowed file types, size cap, path rules). Files are readable by\n * ANYONE at the returned URL — never put private data here. Only a\n * Vitre-hosted frame has this — a companion frame cannot write.\n */\n public readonly publicStorage: PublicStorageApi = {\n put: async (path, data, contentType, scope = 'app', options) => {\n validateExpiresIn(options?.expiresIn)\n const buffer = await this.toPublicFileBuffer(data)\n if (buffer.byteLength > MAX_PUBLIC_FILE_SIZE_BYTES) {\n throw new PublicStorageError('tooLarge')\n }\n const requestId = randomUuid()\n return await this.postRequest<PublicFile>(\n {\n type: 'putPublicFile',\n requestId,\n scope,\n path,\n contentType,\n data: buffer,\n ...putPublicFileExpiryField(options?.expiresIn),\n },\n (msg, resolve, reject) => {\n if (msg.type === 'publicStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve(\n withDownloadUrlFallback(\n msg.file ?? { path, url: msg.url ?? '', size: buffer.byteLength },\n ),\n )\n } else {\n reject(new PublicStorageError(msg.error ?? 'failed'))\n }\n }\n },\n [buffer],\n { ms: PUBLIC_STORAGE_PUT_TIMEOUT_MS, onTimeout: () => new PublicStorageError('unsupported') },\n )\n },\n delete: async (path, scope = 'app') => {\n const requestId = randomUuid()\n await this.postRequest<void>(\n { type: 'deletePublicFile', requestId, scope, path },\n (msg, resolve, reject) => {\n if (msg.type === 'publicStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) resolve(undefined)\n else reject(new PublicStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PUBLIC_STORAGE_TIMEOUT_MS, onTimeout: () => new PublicStorageError('unsupported') },\n )\n },\n list: async (prefix, scope = 'app') => {\n const requestId = randomUuid()\n return await this.postRequest<PublicStorageListResult>(\n { type: 'listPublicFiles', requestId, scope, prefix },\n (msg, resolve, reject) => {\n if (msg.type === 'publicStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve({\n baseUrl: msg.baseUrl ?? '',\n files: (msg.files ?? []).map(withDownloadUrlFallback),\n })\n } else reject(new PublicStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PUBLIC_STORAGE_TIMEOUT_MS, onTimeout: () => new PublicStorageError('unsupported') },\n )\n },\n }\n\n /**\n * Private file storage scoped to the vitre's TEAM — see the README\n * \"Private storage\" section for the full semantics. Unlike\n * `publicStorage`, files here have no public link: readable by any\n * vitre or companion of the team via `get` or a temporary `getLink`\n * signed link, never by an anonymous visitor. Full (put/delete/list/\n * get/getLink) on a Vitre-hosted frame; a companion frame only has\n * `list`/`get`/`getLink` (see the `CompanionFrame` exported type).\n */\n public readonly privateStorage: PrivateStorageApi = {\n put: async (path, data, contentType, scope = 'app', options) => {\n validatePrivatePath(path)\n validatePrivateExpiresIn(options?.expiresIn)\n const buffer = await this.toPrivateFileBuffer(data)\n if (buffer.byteLength > MAX_PRIVATE_FILE_SIZE_BYTES) {\n throw new PrivateStorageError('tooLarge')\n }\n const requestId = randomUuid()\n return await this.postRequest<PrivateFile>(\n {\n type: 'putPrivateFile',\n requestId,\n scope,\n path,\n contentType,\n data: buffer,\n ...privateFileExpiryField(options?.expiresIn),\n },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve(msg.file ?? { path, size: buffer.byteLength, contentType })\n } else {\n reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n }\n },\n [buffer],\n { ms: PRIVATE_STORAGE_PUT_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n delete: async (path, scope = 'app') => {\n const requestId = randomUuid()\n await this.postRequest<void>(\n { type: 'deletePrivateFile', requestId, scope, path },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) resolve(undefined)\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n list: async (prefix, scope = 'app') => {\n const requestId = randomUuid()\n return await this.postRequest<PrivateStorageListResult>(\n { type: 'listPrivateFiles', requestId, scope, prefix },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) resolve({ scope, files: msg.files ?? [] })\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n get: async (path, scope = 'app') => {\n const requestId = randomUuid()\n return await this.postRequest<{ data: ArrayBuffer; contentType: string }>(\n { type: 'getPrivateFile', requestId, scope, path },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok && msg.data) resolve({ data: msg.data, contentType: msg.contentType ?? '' })\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_GET_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n getLink: async (path, options) => {\n validateLinkExpiresIn(options?.expiresIn)\n const scope = options?.scope ?? 'app'\n const requestId = randomUuid()\n return await this.postRequest<PrivateFileLink>(\n {\n type: 'getPrivateFileLink',\n requestId,\n scope,\n path,\n ...privateFileExpiryField(options?.expiresIn),\n },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok && msg.link) resolve(msg.link)\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n }\n\n /**\n * AI tool channel — publish a catalog of tools the on-prem agent's LLM can call\n * on this frame: `ai.registerTools([{ name, description, parameters, sensitive }],\n * (name, args) => …)`. Register SIMPLE local names; the host namespaces them as\n * `<appId>__<name>`. Invocations run against the handler and reply automatically.\n */\n public readonly ai: AiChannel\n\n /** @deprecated Use `crdt.doc`. See Connector.yjsDoc for the setter\n * rationale (legacy field-assignment backward-compat). */\n get yjsDoc() {\n return this.crdt.doc\n }\n set yjsDoc(doc: Y.Doc) {\n this.crdt.attach(doc)\n }\n\n public position: Rect\n public zIndex: number\n\n private deviceStateListeners = new Set<() => void>()\n private sharedStreamPeers = new Map<string, SharedStreamPeer>()\n\n /**\n * Called after any change of `hostInformation.device`,\n * `hostInformation.devicesInSpace` or the available media devices (device\n * joined or left, privacy, fullscreen, scaling, media devices, Vitre\n * settings), once the matching `on…` callback has run. Unlike those callbacks, several\n * listeners can coexist: SDK helpers use this so they never replace a\n * handler the app assigned. Returns the unsubscribe function. Added 1.52.\n */\n public addDeviceStateListener(listener: () => void): () => void {\n this.deviceStateListeners.add(listener)\n return () => this.deviceStateListeners.delete(listener)\n }\n\n private notifyDeviceState() {\n for (const listener of this.deviceStateListeners) {\n try {\n listener()\n } catch (error) {\n console.error('[Frame] device state listener failed', error)\n }\n }\n }\n\n constructor(\n // `protected` (not `private`) so the companion-only subclass\n // `CompanionFrameImpl` (CompanionFrame.ts) can post its companion-frame\n // messages while keeping those methods off the Vitre `Frame` surface.\n protected readonly postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n public options: ViewOptions,\n initState?: Record<string, any>,\n ) {\n this.hostInformation = initMessage.hostInfo\n this.companionInformation = initMessage.companionInfo\n this.initiator = initMessage.initiator\n this.id = initMessage.id\n this.appId = initMessage.appId ?? ''\n this.initOptions = initMessage.options\n this.isBorderless = initMessage.isBorderless\n this.isFullscreen = initMessage.isFullscreen\n this.position = initMessage.position\n this.zIndex = 0\n if (initMessage.safeAreaInsets)\n this.applySafeAreaInsets(initMessage.safeAreaInsets)\n this.isFullscreen = initMessage.isFullscreen\n\n this.postMessage({\n type: 'frameInitialized',\n options,\n })\n\n const w = window as any\n w.frameConnector = this\n w.connector = this\n this.state = initState ?? {}\n\n // Mirror of the Connector guard — both connectors must behave\n // identically. See MIN_CRDT_HOST_VERSION for the rationale.\n //\n // Exception: a companion frame (`hostInformation.isCompanion`) is never\n // gated. Its host is the la-Vitre companion, which is deployed centrally\n // and always runs HEAD, so it always carries the CRDT relay. Gating it is\n // also actively harmful: the version it advertises is the companion's OWN\n // build version, and a misconfigured deploy can ship a stale placeholder\n // (a preview build shipped `1.2.0.0`), which silently disables Yjs sync\n // for every companion frame. The real sync peer is the Vitre, whose own\n // gate still applies on its side.\n const crdtSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_CRDT_HOST_VERSION)\n this.crdt = new CrdtChannel((message, transfer) => {\n // Same as Connector: `FrameApiMessagesOut` already includes the four\n // `crdt*` arms (Frame.Model.ts), so no cast is needed.\n if (!crdtSupported) return\n this.postMessage(message, transfer)\n })\n this.crdt.onSynced(() => this.onYjsSynced?.())\n this.crdt.onUpdate((update) => this.onYjsUpdate?.(update))\n this.blobs = new BlobStore(this.crdt)\n\n // AI tool channel — same companion-exception + version gate as CRDT (a host\n // that predates the ai bridge ignores the unknown arms and never invokes).\n const aiSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_AI_HOST_VERSION)\n this.ai = new AiChannel((message) => {\n if (!aiSupported) return\n this.postMessage(message)\n })\n\n if (this.state['@sharedStreamState.state']) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: this.state['@sharedStreamState.state'] as SharedStreamPlayState,\n }\n }\n if (typeof this.state['@sharedStreamState.duration'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: this.state['@sharedStreamState.duration'] as number,\n }\n }\n if (typeof this.state['@sharedStreamState.position'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: this.state['@sharedStreamState.position'] as number,\n }\n }\n }\n\n private resolveRequest(msg: FrameApiMessagesIn) {\n this.requestResolvers = this.requestResolvers.filter(\n (rr) => !rr.isHandled(msg),\n )\n }\n\n raiseMessage(msg: FrameApiMessagesIn) {\n this.resolveRequest(msg)\n\n switch (msg.type) {\n case 'privacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n device: { ...this.hostInformation.device, privacy: msg.privacy },\n }\n this.onPrivacyChanged?.(msg.privacy)\n break\n case 'deviceJoined':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDeviceJoined?.(msg.device)\n this.notifyDeviceState()\n break\n case 'deviceLeft':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.deviceId,\n ),\n }\n this.onDeviceLeft?.(msg.deviceId)\n this.notifyDeviceState()\n break\n case 'deviceMessageReceived':\n this.onDeviceMessageReceived?.(msg)\n break\n case 'localConnectorMessageReceived':\n this.onLocalConnectorMessageReceived?.(msg.data, msg.from, msg.fileData)\n break\n case 'menuClicked':\n this.onMenuClicked?.(msg.menuId, msg.tag, msg.isChecked)\n break\n case 'fieldUpdated':\n this.onFieldUpdated?.(msg.field)\n break\n case 'isInteractingChanged':\n this.onInteractingChanged?.(msg.isInteracting)\n break\n case 'borderlessUpdated':\n this.isBorderless = msg.isBorderless\n this.onBorderlessChanged?.(msg.isBorderless)\n break\n case 'fullscreenUpdated':\n this.isFullscreen = msg.isFullscreen\n this.onFullscreenChanged?.(msg.isFullscreen)\n break\n case 'fileLoaded':\n this.onFileLoaded?.(msg.file)\n break\n case 'fileProgress':\n this.onFileProgress?.(msg.bytes, msg.totalBytes)\n break\n case 'exportRequest':\n {\n const resolve = (data: ExportData) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n data,\n })\n }\n\n const reject = (error: string) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n error,\n })\n }\n this.onExportRequest?.(msg, resolve, reject)\n }\n break\n case 'knockKnockReceived':\n this.onKnockKnock?.(msg)\n break\n case 'settingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n settings: msg.settings,\n }\n this.onSettingsUpdated?.(msg.settings)\n break\n case 'appSettingsResponse':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'appSettingsChanged':\n this.onSettingsChanged?.(msg)\n break\n case 'publicStorageResponse':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'privateStorageResponse':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'vitreSettingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n space: msg.currentSpace,\n vitreSettings: msg,\n device: {\n ...this.hostInformation.device,\n name: msg.name ?? this.hostInformation.device.name,\n color: msg.color,\n },\n }\n this.onVitreSettingsUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'connectionCodeUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n companionCode: msg.companionCode,\n }\n this.onConnectionCodeUpdated?.(msg.companionCode)\n break\n case 'notificationButtonClicked':\n this.onNotificationButtonClicked?.(msg)\n break\n case 'notificationDismissed':\n this.onNotificationDismissed?.(msg.id)\n break\n case 'devicePrivacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDevicePrivacyChanged?.(msg.device)\n this.notifyDeviceState()\n break\n case 'deviceFrameLoaded':\n this.onDeviceFrameLoaded?.(msg)\n break\n case 'deviceFrameUnloaded':\n this.onDeviceFrameUnloaded?.(msg)\n break\n case 'deviceFrameConnectorLoaded':\n this.onDeviceFrameConnectorLoaded?.(msg)\n break\n case 'pendingDevicesConnectionRequested':\n this.onPendingDevicesConnectionRequested?.(msg.pendingDevices)\n break\n case 'borderOptionsUpdated':\n this.onBorderOptionsUpdated?.(msg)\n break\n case 'voiceActionDetected':\n this.onVoiceActionDetected?.(msg)\n break\n case 'stateReplaced':\n this._onStateReplaced(msg)\n break\n case 'positionUpdated':\n this.position = msg.position\n this.zIndex = msg.zIndex\n this.isFullscreen = msg.isFullscreen\n this.onPositionUpdated?.(msg)\n break\n case 'safeAreaInsetsUpdated':\n this.applySafeAreaInsets(msg.safeAreaInsets)\n this.onSafeAreaInsetsUpdated?.(msg)\n break\n case 'deviceFullscreenUpdated':\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId ? { ...d, fullscreen: msg.fullscreen } : d,\n )\n this.onDeviceFullscreenUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'visibilityChanged':\n this.onVisibilityChanged?.(msg)\n break\n case 'deviceScalingUpdated':\n if (msg.deviceId === this.hostInformation.device.id) {\n this.hostInformation.device.sendingScaling = msg.sendingScaling\n this.hostInformation.device.orientation = msg.orientation\n this.hostInformation.device.orientationBy = msg.orientationBy\n }\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId\n ? {\n ...d,\n sendingScaling: msg.sendingScaling,\n orientation: msg.orientation,\n orientationBy: msg.orientationBy,\n }\n : d,\n )\n this.onDeviceScalingUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'updateFrameName':\n this.options.name = msg.name\n this.onUpdateFrameName?.(msg.name)\n break\n case 'localSharedStreamUpdate':\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n volume: msg.volume,\n }\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n break\n case 'sharedStreamAvailable': {\n // Reverse breakout box — rebuild a live MediaStream from the readables\n // the host transferred into this frame (one MediaStreamTrackGenerator\n // per track; pipe the readable into its writable). Mirrors the host's\n // tracksFromReadables / SDK toShareTracks on the share side.\n const tracks = msg.tracks.map((t) => {\n const generator = new MediaStreamTrackGenerator({ kind: t.kind })\n t.readable.pipeTo(generator.writable).catch(() => {})\n return generator as MediaStreamTrack\n })\n this.onSharedStream?.(msg.streamId, new MediaStream(tracks))\n break\n }\n case 'sharedStreamOffer': {\n this.sharedStreamPeers.get(msg.streamId)?.close()\n const peer = acceptSharedStreamOffer(\n msg.port,\n (stream) => this.onSharedStream?.(msg.streamId, stream),\n () => {\n if (this.sharedStreamPeers.get(msg.streamId) === peer)\n this.sharedStreamPeers.delete(msg.streamId)\n },\n )\n this.sharedStreamPeers.set(msg.streamId, peer)\n break\n }\n case 'sharedStreamRemoved':\n this.sharedStreamPeers.get(msg.streamId)?.close()\n this.onSharedStreamRemoved?.(msg.streamId)\n break\n case 'mediaDevicesChanged':\n this.hostInformation = {\n ...this.hostInformation,\n vitreSettings: {\n ...this.hostInformation.vitreSettings,\n availableMediaDevices: msg.devices,\n },\n }\n this.onMediaDevicesChanged?.(msg.devices)\n this.notifyDeviceState()\n break\n case 'bluetooth':\n this.onBluetoothMessage?.(msg)\n break\n case 'crdtUpdate':\n case 'crdtSyncComplete':\n case 'crdtRequestSync':\n case 'crdtAwarenessUpdate':\n case 'crdtSubdocUpdate':\n case 'crdtSubdocSyncComplete':\n case 'crdtSubdocTransferProgress':\n case 'crdtSubdocRequestSync':\n this.crdt.handleMessage(msg)\n break\n case 'aiInvoke':\n void this.ai.handleInvoke(msg.id, msg.name, msg.args)\n break\n case 'companionFramePeerJoined':\n this.onCompanionFramePeerJoined?.(msg.peer)\n break\n case 'companionFramePeerLeft':\n this.onCompanionFramePeerLeft?.(msg.peerId)\n break\n case 'companionFramePeersUpdated':\n this.onCompanionFramePeersUpdated?.(msg.peers)\n break\n }\n\n this.onMessageReceived?.(msg)\n }\n\n /** Stores the insets and mirrors them as `--lavitre-safe-area-inset-*` on `<html>`. */\n private applySafeAreaInsets(insets: SafeAreaInsets) {\n this.safeAreaInsets = insets\n const root =\n typeof document !== 'undefined' ? document.documentElement : undefined\n if (!root) return\n for (const edge of ['top', 'right', 'bottom', 'left'] as const) {\n root.style.setProperty(\n `--lavitre-safe-area-inset-${edge}`,\n `${insets[edge]}px`,\n )\n }\n }\n\n private _onStateReplaced(msg: StateReplaced) {\n const oldState = this.state\n this.state = msg.state\n\n let hasSharedStreamUpdate = false\n\n msg.delta.forEach((update) => {\n if (\n update.key === '@sharedStreamState.state' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: update.value as SharedStreamPlayState,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.duration' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: update.value as number,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.position' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: update.value as number,\n }\n hasSharedStreamUpdate = true\n }\n })\n\n if (hasSharedStreamUpdate) {\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n }\n\n this.onStateReplaced?.(this.state, oldState, msg.replacedBy, msg.delta)\n }\n\n public sendMessageTo(message: SendMessageTo) {\n this.postMessage({ type: 'sendMessageTo', ...message })\n }\n\n public sendMessageToAll(message: SendMessageToAll) {\n this.postMessage({ type: 'sendMessageToAll', ...message })\n }\n\n public sendKnockKnock(message: SendKnockKnock) {\n this.postMessage({ type: 'sendKnockKnock', ...message })\n }\n\n /** Release the resources owned by this frame. Tears the CRDT channel\n * down (unbinds doc/awareness listeners, destroys the default Y.Doc +\n * Awareness). Safe to call multiple times. */\n public destroy(): void {\n this.crdt.destroy()\n }\n\n public setFullscreen() {\n this.postMessage({\n type: 'setFullscreen',\n })\n }\n\n public setMenu(menu: FrameMenuEntry[]) {\n this.postMessage({\n type: 'setFrameMenu',\n menu,\n })\n }\n\n /**\n * SDK 1.47 — replace the frame's export sources after initialization.\n *\n * The initial set comes from the `ViewOptions.exportSources` returned by\n * `initializeFrame`; this is the only way to change it afterwards, e.g.\n * when a document gains a format, or to flip `availableForCompanion` on a\n * source once it becomes too large to hand to a phone.\n *\n * The call REPLACES the whole list — pass every source you still want,\n * not just the new ones. The host rebuilds both its own export menu and\n * the companions' from it.\n */\n public setExportSources(exportSources: AvailableExportSource[]) {\n this.postMessage({\n type: 'setExportSources',\n exportSources,\n })\n }\n\n public applyStreamAdvancedConstraints(\n constraints: ApplyStreamAdvancedConstraints,\n ) {\n this.postMessage({\n ...constraints,\n type: 'applyStreamAdvancedConstraints',\n })\n }\n\n /**\n * Replace the video track of this frame's shared stream with a fresh\n * `getUserMedia` capture matching `constraints` (e.g. to switch camera),\n * keeping the same share alive (`replaceTrack` on the host, no\n * renegotiation). The host forces the requested `deviceId` as `{ exact }`.\n * Resolves with the new track infos so the frame can rebuild its menu.\n */\n public async requestReplaceStream(\n constraints: MediaStreamConstraints,\n ): Promise<MediaTrackInfo[]> {\n const requestId = randomUuid()\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'replaceFrameStream', requestId, constraints },\n (msg, resolve, reject) => {\n if (\n msg.type === 'replaceFrameStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'replaceFrameStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n public setWindowed() {\n this.postMessage({\n type: 'setWindowed',\n })\n }\n\n public close() {\n this.postMessage({\n type: 'close',\n })\n }\n\n public sendToLocalFrame(\n frameConnectorId: string,\n data: any,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId,\n data,\n fileData,\n })\n }\n\n public sendToLocalMainConnector(data: any, fileData?: FileData) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId: undefined,\n data,\n fileData,\n })\n }\n\n /**\n * Convenience for companion frames: send a message to the paired Vitre\n * frame (same `frameConnectorId`). Wraps `sendToLocalFrame` with the\n * current frame's id so callers don't have to repeat it. The receiving\n * Vitre frame surfaces it on `onLocalConnectorMessageReceived` (data,\n * from, fileData). The same primitive works from a Vitre frame too,\n * but on the Vitre most apps want `sendMessageTo` / `sendMessageToAll`\n * to reach other devices instead — which the companion has no way to\n * address. See `CompanionFrame` for the trimmed surface intended for\n * apps running on a companion frame iframe.\n */\n public sendToVitreFrame(data: any, fileData?: FileData) {\n this.sendToLocalFrame(this.id, data, fileData)\n }\n\n // The companion-only send methods `sendMessageToVitreConnector` and\n // `closeOnCompanion` deliberately do NOT live on the Vitre `Frame`. They post\n // host messages (`sendToVitreConnector` / `closeOnCompanion`) that ONLY the\n // companion host decodes — a Vitre host rejects them with \"case type not\n // found\". They live on `CompanionFrame` (the subclass returned by\n // `initializeCompanionFrame`, see CompanionFrame.ts). A Vitre frame that needs\n // to reach its own connector uses `sendToLocalMainConnector` instead.\n\n public stopInteracting() {\n this.postMessage({\n type: 'stopInteracting',\n })\n }\n\n public setPosition(position: LayoutPosition) {\n this.postMessage({\n type: 'setPosition',\n ...position,\n })\n }\n\n public setVisibility(visibility: Visibility) {\n this.postMessage({\n type: 'setVisibility',\n visibility,\n })\n }\n\n public setReducedAudioMode(enabled: boolean) {\n this.postMessage({\n type: 'setReducedAudioMode',\n enabled,\n })\n }\n\n public startInteracting() {\n this.postMessage({ type: 'startInteracting' })\n }\n\n public sendToSerialPort(serialPort: SendToSerialPort) {\n this.postMessage({\n type: 'sendToSerialPort',\n ...serialPort,\n })\n }\n\n /// Request access to a serial port (see `Connector.requestSerialPortAccess`).\n /// Resolves with the granted port name (empty string if denied/cancelled).\n /// With `{ port }` the host pre-grants it; with no argument the host shows\n /// its port-picker and resolves with the chosen port.\n public async requestSerialPortAccess(\n request?: RequestSerialPortAccess,\n ): Promise<string> {\n const requestId = randomUuid()\n return await this.postRequest<string>(\n { type: 'requestSerialPortAccess', requestId, port: request?.port },\n (msg, resolve, reject) => {\n if (\n msg.type === 'serialPortAccessResult' &&\n msg.requestId === requestId\n ) {\n if (msg.port) {\n resolve(msg.port)\n } else {\n reject(msg.reason ?? 'cancelled')\n }\n }\n },\n )\n }\n\n public sendBluetoothMessage(msg: BluetoothFromApp) {\n this.postMessage({ ...msg, type: 'bluetooth' } as any)\n }\n\n public disconnectGuests(deviceIds: string[]) {\n this.postMessage({\n type: 'disconnectGuests',\n deviceIds,\n })\n }\n\n public requestStreamSizeUpdate(updates: RequestStreamSizeUpdate) {\n this.postMessage({\n type: 'requestStreamSizeUpdate',\n ...updates,\n })\n }\n\n public updateName(name: string) {\n this.postMessage({\n type: 'updateName',\n name,\n })\n }\n\n /**\n * Whether {@link shareStream} is available in this runtime (Chromium\n * Insertable Streams + same-site hosting). Same gate as\n * `Connector.canShareStream`.\n */\n public canShareStream(): boolean {\n return typeof MediaStreamTrackProcessor !== 'undefined'\n }\n\n /** Normalize `publicStorage.put`'s payload to a plain `ArrayBuffer` —\n * slicing out exactly a typed array's view (not its whole underlying\n * buffer, in case it's a subarray) so the transferred bytes match the\n * size the caller intended. */\n private async toPublicFileBuffer(\n data: ArrayBuffer | Blob | Uint8Array,\n ): Promise<ArrayBuffer> {\n if (data instanceof ArrayBuffer) return data\n if (data instanceof Blob) return await data.arrayBuffer()\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) as ArrayBuffer\n }\n\n /** Same normalization as {@link toPublicFileBuffer}, for `privateStorage.put`. */\n private async toPrivateFileBuffer(\n data: ArrayBuffer | Blob | Uint8Array,\n ): Promise<ArrayBuffer> {\n if (data instanceof ArrayBuffer) return data\n if (data instanceof Blob) return await data.arrayBuffer()\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) as ArrayBuffer\n }\n\n private toShareTracks(stream: MediaStream): {\n tracks: ShareStreamTrack[]\n transfer: Transferable[]\n } {\n const tracks: ShareStreamTrack[] = []\n const transfer: Transferable[] = []\n for (const track of stream.getTracks()) {\n const { readable } = new MediaStreamTrackProcessor({ track })\n tracks.push({\n kind: track.kind as ShareStreamTrack['kind'],\n readable,\n settings: track.getSettings(),\n })\n transfer.push(readable)\n }\n return { tracks, transfer }\n }\n\n /**\n * Share a `MediaStream` the frame produced (e.g. a WebGL-transformed track,\n * or a camera the frame opened) TO the Vitre, which forwards it to the space\n * peers. Frame-context counterpart of `Connector.shareStream`: needed because\n * a transform frame builds its output track locally and must reshare it.\n * Handed over zero-copy via the breakout box. Returns a `sharedStreamId` for\n * {@link replaceShareStream} / {@link stopShareStream}.\n */\n public async shareStream(\n stream: MediaStream,\n options?: ShareStreamOptions,\n ): Promise<string> {\n if (!this.canShareStream()) {\n throw new Error(\n 'shareStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const sharedStreamId = randomUuid()\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'shareStream', requestId, sharedStreamId, options, tracks },\n (msg, resolve, reject) => {\n if (\n msg.type === 'shareStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n return sharedStreamId\n }\n\n /**\n * Swap the source of an open frame share WITHOUT closing it (no\n * renegotiation blip). `sharedStreamId` is the value returned by\n * {@link shareStream}. See `Connector.replaceShareStream`.\n */\n public async replaceShareStream(\n sharedStreamId: string,\n streamOrTrack: MediaStream | MediaStreamTrack,\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error('replaceShareStream is not supported in this runtime')\n }\n const stream =\n streamOrTrack instanceof MediaStream\n ? streamOrTrack\n : new MediaStream([streamOrTrack])\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'replaceShareStream', requestId, sharedStreamId, tracks },\n (msg, resolve, reject) => {\n if (\n msg.type === 'shareStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /** Stop a frame share. `sharedStreamId` is the value returned by {@link shareStream}. */\n public stopShareStream(sharedStreamId: string): void {\n this.postMessage({ type: 'stopShareStream', sharedStreamId })\n }\n\n /**\n * Attach a `MediaStream` produced by this frame to a target frame's standard\n * sharing slot, WITHOUT opening a new `SharedContent` or establishing a new\n * `RTCPeerConnection`. The stream is forwarded zero-copy (breakout box) from\n * this frame's vitre to the already-open instances of `targetFrameConnectorId`\n * on other vitres; those instances receive it via {@link onSharedStream} (the\n * existing `sharedStreamAvailable` delivery arm — no new protocol arm).\n *\n * - Requires Chromium Insertable Streams (same guard as {@link shareStream}).\n * - Default target: this frame's own `frameConnectorId`, i.e. the same app\n * type running on peer vitres. Pass `opts.targetFrameConnectorId` to route\n * to a different frame type.\n * - Resolves when the host confirms delivery (or rejects with the host error).\n *\n * **Delivery semantics:**\n * - When `targetFrameConnectorId` is absent (default, target == this frame\n * type), the stream is delivered to peer vitres' instances of this frame via\n * {@link onSharedStream}. The calling frame already holds `stream` and does\n * NOT receive it back via `onSharedStream` (no loopback — intentional).\n * - When `targetFrameConnectorId` designates a DIFFERENT frame type, that\n * frame — including its instance on the emitting vitre — receives the stream\n * via {@link onSharedStream}.\n */\n public async attachStream(\n stream: MediaStream,\n opts?: { targetFrameConnectorId?: string },\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error(\n 'attachStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n {\n type: 'attachStream',\n requestId,\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n tracks,\n },\n (msg, resolve, reject) => {\n if (\n msg.type === 'attachStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /**\n * Stop a stream previously attached with {@link attachStream} on the target\n * frame. Receivers see {@link onSharedStreamRemoved}. Default target: this\n * frame's own `frameConnectorId`.\n */\n public detachStream(opts?: { targetFrameConnectorId?: string }): void {\n this.postMessage({\n type: 'detachStream',\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n })\n }\n\n /**\n * Fetch the ICE/TURN servers the HOST already uses for its own WebRTC P2P\n * (the Vitre's `StartWebRTCOffer` config, or the companion's `WebRTCOffer`\n * config — same relays, same credentials). The result feeds straight into\n * `new RTCPeerConnection({ iceServers })`, letting an app stand up its OWN\n * peer connection — e.g. a companion-camera frame connecting directly to its\n * paired Vitre transform frame — that traverses NAT through the platform's\n * TURN infrastructure without shipping its own credentials.\n *\n * Resolves to `[]` on hosts that predate this request (the caller should\n * race a timeout and fall back to a public STUN-only config). See\n * {@link IceServerConfig}.\n */\n public async getIceServers(): Promise<IceServerConfig[]> {\n const requestId = randomUuid()\n return await this.postRequest<IceServerConfig[]>(\n { type: 'getIceServers', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'iceServersResponse' && msg.requestId === requestId) {\n resolve(msg.iceServers ?? [])\n }\n },\n )\n }\n\n private requestResolvers: RequestResolver[] = []\n private async postRequest<Data>(\n data: FrameApiMessagesOut,\n handler: (\n msg: FrameApiMessagesIn,\n resolve: (data: Data) => void,\n // `any` (not `string`) so callers can reject with a typed Error, e.g.\n // AppSettingsError — most existing handlers still reject with a plain\n // string message.\n reject: (error: any) => void,\n ) => void,\n transfer?: Transferable[],\n // When set, rejects with `onTimeout()` if no matching response arrives\n // within `ms` — AND removes the pending resolver from\n // `requestResolvers`. Without that removal a host that never answers\n // (e.g. one that predates the message type) would leak the resolver\n // forever, since the only other removal path is a matching response.\n timeout?: { ms: number; onTimeout: () => any },\n ) {\n return await new Promise<Data>((resolve, reject) => {\n let isHandled = false\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const handleAndResolve = (data: Data) => {\n isHandled = true\n if (timer !== undefined) clearTimeout(timer)\n resolve(data)\n }\n\n const handleAndReject = (error: any) => {\n isHandled = true\n if (timer !== undefined) clearTimeout(timer)\n reject(error)\n }\n\n const resolver = {\n isHandled: (msg: FrameApiMessagesIn) => {\n try {\n handler(msg, handleAndResolve, handleAndReject)\n } catch (error) {\n handleAndReject(error)\n }\n return isHandled\n },\n }\n this.requestResolvers.push(resolver)\n\n if (timeout) {\n timer = setTimeout(() => {\n if (isHandled) return\n this.requestResolvers = this.requestResolvers.filter((rr) => rr !== resolver)\n handleAndReject(timeout.onTimeout())\n }, timeout.ms)\n }\n\n this.postMessage(data, transfer)\n })\n }\n\n public async requestEnumerateLocalFrames(): Promise<LoadedFrame[]> {\n const requestId = randomUuid()\n return await this.postRequest<LoadedFrame[]>(\n { type: 'enumerateLoadedFrames', requestId },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'enumerateLoadedFramesCompleted' &&\n msg.requestId === requestId\n ) {\n resolve(msg.frames)\n }\n },\n )\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendExtensionMessage(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'extensionMessage',\n data,\n target,\n fileData,\n })\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendAppMessage(data: any, target: MessageTarget, fileData?: FileData) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public sendMessageToEmbed(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public async requestVitreSettings() {\n return await this.postRequest<VitreSettings>(\n { type: 'getVitreSettings' },\n (msg, resolve, _reject) => {\n if (msg.type === 'vitreSettingsResponse') {\n resolve(msg as VitreSettings)\n }\n },\n )\n }\n\n public setVitreSettings(setters: VitreSettingsSetter) {\n this.postMessage({ type: 'setVitreSettings', ...setters })\n }\n\n /**\n * Share a URL/data with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. Drives the languette colour/info\n * and the content appears already-owned on every vitre. Default: opener.\n */\n public shareData(url: string, targetAppId?: AppId, owner?: string) {\n this.postMessage({\n type: 'shareData',\n url,\n targetAppId,\n owner,\n })\n }\n\n /**\n * Share a file with the host, which routes it to a matching app.\n * @param owner Optional device id to attribute the share to. See {@link shareData}.\n */\n public shareFile(fileData: FileData, targetAppId: AppId, owner?: string) {\n this.postMessage({\n type: 'shareFile',\n fileData,\n targetAppId,\n owner,\n })\n }\n\n public saveSettings(settings: any) {\n this.postMessage({\n type: 'saveSettings',\n settings,\n })\n }\n\n /**\n * Read the app's settings at one of the three levels — `vitre` (this\n * vitre), `team` (the vitre's team), or `space` (the space the vitre is\n * currently in). Every vitre/app instance of the team can read the same\n * value; values are JSON objects capped at 64 KB — never store secrets.\n *\n * Distinct from the legacy `saveSettings`/`onSettingsUpdated` mechanism,\n * which is a single vitre-scoped blob rendered by the host's settings\n * form (see `Connector.setSettingsSchema`).\n *\n * Rejects with an {@link AppSettingsError} of code `'unsupported'` if the\n * host doesn't answer within 10s — a vitre host older than this feature\n * never responds to `getAppSettings`.\n */\n public async getSettings(level: AppSettingsLevel): Promise<AppSettingsValue> {\n const requestId = randomUuid()\n return await this.postRequest<AppSettingsValue>(\n { type: 'getAppSettings', requestId, level },\n (msg, resolve, reject) => {\n if (msg.type === 'appSettingsResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve({ level: msg.level, value: msg.value ?? {}, version: msg.version ?? 0 })\n } else {\n reject(new AppSettingsError(msg.error ?? 'failed', level))\n }\n }\n },\n undefined,\n { ms: APP_SETTINGS_TIMEOUT_MS, onTimeout: () => new AppSettingsError('unsupported', level) },\n )\n }\n\n /**\n * Write the app's settings at `level`, with optimistic concurrency:\n * `expectedVersion` must be the version last observed for that level (from\n * {@link getSettings} or {@link onSettingsChanged}) — `0` if never\n * written. A stale version rejects with an {@link AppSettingsError} of\n * code `'conflict'`; re-read and retry. An oversized `value` (> 64 KB)\n * rejects with `'tooLarge'`.\n *\n * Rejects with code `'unsupported'` if the host doesn't answer within\n * 10s — see {@link getSettings}.\n */\n public async setSettings(\n level: AppSettingsLevel,\n value: Record<string, unknown>,\n expectedVersion: number,\n ): Promise<AppSettingsValue> {\n const requestId = randomUuid()\n return await this.postRequest<AppSettingsValue>(\n { type: 'setAppSettings', requestId, level, value, expectedVersion },\n (msg, resolve, reject) => {\n if (msg.type === 'appSettingsResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve({\n level: msg.level,\n value: msg.value ?? value,\n version: msg.version ?? expectedVersion,\n })\n } else {\n reject(new AppSettingsError(msg.error ?? 'failed', level))\n }\n }\n },\n undefined,\n { ms: APP_SETTINGS_TIMEOUT_MS, onTimeout: () => new AppSettingsError('unsupported', level) },\n )\n }\n\n public changeTeamSpace(space: string) {\n this.postMessage({\n type: 'changeTeamSpace',\n space,\n })\n }\n\n public changeTeamSpaceGuest(space: string, teamDomain: string) {\n this.postMessage({\n type: 'changeTeamSpaceGuest',\n space,\n teamDomain,\n })\n }\n\n public showNotification(notification: NotificationInfo) {\n this.postMessage({\n ...notification,\n type: 'showNotification',\n })\n }\n\n public hideNotification(notificationId: string) {\n this.postMessage({\n id: notificationId,\n type: 'hideNotification',\n })\n }\n\n public changePrivacy(privacy: Privacy) {\n this.postMessage({\n type: 'changePrivacy',\n privacy,\n })\n }\n\n public trackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'trackEvent',\n name,\n properties,\n })\n }\n\n public startTrackEvent(name: string) {\n this.postMessage({\n type: 'startTrackEvent',\n name,\n })\n }\n\n public stopTrackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'stopTrackEvent',\n name,\n properties,\n })\n }\n\n public getMainConnectorFrame(): Window | null {\n try {\n const mainFrameId = `${this.appId}|${this.appId}`\n return (window.parent.frames as any)[mainFrameId]\n } catch (_error) {\n return null\n }\n }\n\n public getMainConnector(): Connector | null {\n const mainFrame = this.getMainConnectorFrame() as any\n return mainFrame?.mainConnector as Connector\n }\n\n public setBorderOptions(borderOptions: BorderOptions) {\n this.postMessage({ type: 'setBorderOptions', ...borderOptions })\n }\n\n public setVoiceActions(actions: VoiceAction[]) {\n this.postMessage({\n type: 'setVoiceActions',\n actions,\n })\n }\n\n public async requestStreamCapture() {\n const requestId = randomUuid()\n return await this.postRequest<StreamCapture>(\n { type: 'streamFrameCaptureRequest', requestId },\n (msg, resolve, reject) => {\n if (\n msg.type === 'streamFrameCapturedResponse' &&\n msg.requestId === requestId\n ) {\n if (msg.response == null) {\n reject(msg.error ?? 'failed to get streamFrameCapturedResponse')\n } else {\n resolve(msg.response)\n }\n }\n },\n )\n }\n\n public async requestStats() {\n const requestId = randomUuid()\n return await this.postRequest<StatsResponse>(\n { type: 'getStats', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'statsResponse' && msg.requestId === requestId) {\n resolve(msg)\n }\n },\n )\n }\n\n public updateState(updates: UpdateStateEntry[], forceApplyLocally = true) {\n updates.forEach((update) => {\n //Compat fix, add value for remove action\n if (update.action === 'remove') {\n ;(update as any).value = null\n }\n })\n\n this.postMessage({\n type: 'updateState',\n updates,\n })\n\n if (forceApplyLocally) {\n updates.forEach((update) => {\n if (update.action === 'add') {\n this.state[update.key] = update.value\n } else {\n delete this.state[update.key]\n }\n })\n }\n }\n\n public sharedStream: SharedStream = {\n lastState: {\n position: 0,\n duration: 0,\n volume: 1,\n state: 'paused',\n },\n play: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'play',\n })\n },\n\n pause: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'pause',\n })\n },\n\n seek: (position: number, isRelative: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'seek',\n position,\n isRelative,\n })\n },\n\n setVolume: (volume: number, muted: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'volume',\n volume,\n muted,\n })\n },\n }\n}\n\ntype PostMessageFrameApiOut = (\n message: FrameApiMessagesOut,\n transfer?: Transferable[],\n) => void\n\nexport async function initializeFrame<T extends Frame>(\n init: (\n info: HostInformation,\n initiator: Device,\n options: InitFrameOptions,\n state?: Record<string, any>,\n ) => ViewOptions,\n createFrame?: new (\n postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n options: ViewOptions,\n ) => T,\n) {\n return await new Promise<T>((resolve) => {\n const channel = new MessageChannel()\n let frame: T | null = null\n // A shared stream can reach the frame before `initialize` (the host posts\n // it on the window while the init travels on the port). Keep those until the\n // app has had its turn to set `onSharedStream` after `await initializeFrame`.\n const earlyStreams: FrameApiMessagesIn[] = []\n const messageHandler =\n (createPostMessage: (origin: string) => PostMessageFrameApiOut) =>\n (e: MessageEvent<FrameApiMessagesIn | null>): any => {\n // Any script can post to this window, and a message whose payload\n // cannot be deserialized here arrives with `data === null`.\n if (e.data == null || typeof e.data !== 'object') return\n switch (e.data.type) {\n case 'initialize':\n if (frame === null) {\n const initializeMsg = e.data\n const options = init(\n initializeMsg.hostInfo,\n initializeMsg.initiator,\n initializeMsg.options,\n initializeMsg.state,\n )\n frame = new (createFrame ?? Frame)(\n createPostMessage(initializeMsg.hostInfo.origin),\n initializeMsg,\n options,\n initializeMsg.state,\n ) as T\n resolve(frame)\n if (earlyStreams.length > 0) {\n const created = frame\n setTimeout(() => {\n for (const msg of earlyStreams.splice(0))\n created.raiseMessage(msg)\n })\n }\n }\n break\n case 'sharedStreamAvailable':\n case 'sharedStreamOffer':\n if (frame === null) earlyStreams.push(e.data)\n else frame.raiseMessage(e.data)\n break\n default:\n frame?.raiseMessage(e.data)\n break\n }\n }\n\n channel.port1.onmessage = messageHandler(\n (_origin: string) => (message, transfer?: Transferable[]) => {\n channel.port1.postMessage(message, transfer ?? [])\n },\n )\n\n window.parent.postMessage(\n {\n type: 'connectorInitializationRequest',\n version: apiVersion,\n },\n '*',\n [channel.port2],\n )\n\n window.addEventListener(\n 'message',\n messageHandler(\n (origin: string) => (message, transfer?: Transferable[]) => {\n window.parent.postMessage(message, origin, transfer)\n },\n ),\n false,\n )\n })\n}\n"]}
1
+ {"version":3,"file":"Frame.js","sourceRoot":"","sources":["../../Frame/Frame.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,C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,OAAO,EAAE,QAAyB,EAAE,EAAE;YACzD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACtD,CAAC,CACF,EACD,KAAK,CACN,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/// <reference path=\"../Connector/insertable-streams.d.ts\" />\nimport { randomUuid } from '../Common/Uuid.js'\nimport type * as Y from 'yjs'\nimport { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js'\nimport { BlobStore } from '../Common/BlobStore.js'\nimport { AiChannel, MIN_AI_HOST_VERSION } from '../Common/AiChannel.js'\nimport { isMinVersion } from '../Common/index.js'\nimport { AppSettingsError, APP_SETTINGS_TIMEOUT_MS } from '../Common/AppSettings.js'\nimport { SettingsDefaultsResolver, defaultSettingsFileUrl } from '../Common/SettingsDefaults.js'\nimport {\n PublicStorageError,\n PUBLIC_STORAGE_TIMEOUT_MS,\n PUBLIC_STORAGE_PUT_TIMEOUT_MS,\n MAX_PUBLIC_FILE_SIZE_BYTES,\n validateExpiresIn,\n putPublicFileExpiryField,\n withDownloadUrlFallback,\n} from '../Common/PublicStorage.js'\nimport type { PublicStorageApi } from '../Common/PublicStorage.js'\nimport {\n PrivateStorageError,\n PRIVATE_STORAGE_TIMEOUT_MS,\n PRIVATE_STORAGE_PUT_TIMEOUT_MS,\n PRIVATE_STORAGE_GET_TIMEOUT_MS,\n MAX_PRIVATE_FILE_SIZE_BYTES,\n validatePrivatePath,\n validatePrivateExpiresIn,\n validateLinkExpiresIn,\n privateFileExpiryField,\n} from '../Common/PrivateStorage.js'\nimport type { PrivateStorageApi } from '../Common/PrivateStorage.js'\nimport type {\n AppId,\n AppSettingsLevel,\n AppSettingsValue,\n BluetoothFromApp,\n BluetoothToApp,\n BorderOptions,\n CompanionInformation,\n ConnectedMediaDevice,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceMessageReceived,\n DeviceScalingUpdated,\n Field,\n FileData,\n FramePeer,\n HostInformation,\n KnockKnock,\n LayoutPosition,\n LoadedFrame,\n MessageTarget,\n NotificationButtonClicked,\n NotificationInfo,\n PositionUpdated,\n SafeAreaInsets,\n SafeAreaInsetsUpdated,\n Privacy,\n PrivateFile,\n PrivateFileLink,\n PrivateStorageListResult,\n PublicFile,\n PublicStorageListResult,\n Rect,\n ReplacedBy,\n RequestSerialPortAccess,\n RequestStreamSizeUpdate,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToSerialPort,\n StateReplaced,\n StatsResponse,\n StreamCapture,\n UpdatedStateEntry,\n UpdateStateEntry,\n Visibility,\n VisibilityChanged,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type {\n Connector,\n ShareStreamOptions,\n ShareStreamTrack,\n} from '../Connector/index.js'\nimport type { MediaTrackInfo } from '../Connector/Connector.Model.js'\nimport { apiVersion } from '../Version.js'\nimport {\n acceptSharedStreamOffer,\n type SharedStreamPeer,\n} from './SharedStreamPeer.js'\nimport type {\n ApplyStreamAdvancedConstraints,\n AvailableExportSource,\n ExportData,\n ExportRequest,\n FrameApiMessagesIn,\n FrameApiMessagesOut,\n FrameMenuEntry,\n IceServerConfig,\n InitFrameOptions,\n InitializeFrame,\n SharedStreamPlayState,\n ViewOptions,\n} from './Frame.Model.js'\n\ninterface RequestResolver {\n isHandled: (msg: FrameApiMessagesIn) => boolean\n}\n\nexport type SharedStreamState = {\n position: number\n duration: number\n volume: number\n state: SharedStreamPlayState\n}\n\nexport type SharedStream = {\n lastState: SharedStreamState\n play: () => void\n pause: () => void\n seek: (position: number, isRelative?: boolean) => void\n setVolume: (volume: number) => void\n}\n\nexport class Frame {\n public onDeviceJoined?: (device: Device) => void\n public onDeviceLeft?: (deviceId: string) => void\n public onDeviceMessageReceived?: (message: DeviceMessageReceived) => void\n public onLocalConnectorMessageReceived?: (\n message: any,\n from?: string,\n fileData?: FileData,\n ) => void\n public onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void\n public onFieldUpdated?: (field: Field) => void\n public onInteractingChanged?: (isInteracting: boolean) => void\n public onPrivacyChanged?: (privacy: Privacy) => void\n public onFileProgress?: (bytes: number, totalBytes: number) => void\n public onFileLoaded?: (file: ArrayBufferLike) => void\n public onExportRequest?: (\n request: ExportRequest,\n resolve: (data: ExportData) => void,\n reject: (error: string) => void,\n ) => void\n public onKnockKnock?: (knockKnock: KnockKnock) => void\n public onSettingsUpdated?: (settings: any) => void\n /**\n * Pushed whenever the AppSettings value at a given level changes — see\n * {@link getSettings} / {@link setSettings}. Fires for changes made by\n * this app itself as well as by another vitre/app instance sharing the\n * same team/space. Added 1.52. Since 1.58 `value` carries the defaults of\n * `lavitre.settings.json` for `team` and `space`, like {@link getSettings}.\n */\n public onSettingsChanged?: (change: AppSettingsValue) => void\n /**\n * Since 1.58: where {@link getSettings} reads the defaults of the team and\n * space forms — `lavitre.settings.json` next to this document by default\n * (the version root, for `connector.html` and the frames beside it). A\n * document in a sub-folder points it at the root; `null` turns the merge\n * off. Read once, on the first settings call.\n */\n public settingsFileUrl: string | null = defaultSettingsFileUrl()\n private readonly settingsDefaults = new SettingsDefaultsResolver(() => this.settingsFileUrl)\n public onVitreSettingsUpdated?: (settings: VitreSettings) => void\n public onConnectionCodeUpdated?: (companionCode?: string) => void\n public onNotificationDismissed?: (notificationId: string) => void\n public onNotificationButtonClicked?: (\n notificationButton: NotificationButtonClicked,\n ) => void\n public onDevicePrivacyChanged?: (device: Device) => void\n public onDeviceFrameLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameConnectorLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameUnloaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onMessageReceived?: (msg: FrameApiMessagesIn) => void\n public onPendingDevicesConnectionRequested?: (\n pendingClients: Device[],\n ) => void\n /**\n * Peer-presence events for the companion frame. `onCompanionFramePeersUpdated`\n * is the AUTHORITATIVE full snapshot — it fires on every change with the\n * complete current peer set. `onCompanionFramePeerJoined` /\n * `onCompanionFramePeerLeft` are convenience incremental events derived\n * from the same underlying stream.\n *\n * Subscribe to ONE model, not both: either consume the snapshot and\n * recompute, or consume the incremental pair — wiring up both will\n * double-count every transition.\n */\n public onCompanionFramePeerJoined?: (peer: FramePeer) => void\n public onCompanionFramePeerLeft?: (peerId: string) => void\n public onCompanionFramePeersUpdated?: (peers: FramePeer[]) => void\n /**\n * @deprecated Use onBorderOptionsUpdated\n */\n public onBorderlessChanged?: (isBorderless: boolean) => void\n public onFullscreenChanged?: (isFullscreen: boolean) => void\n public onBorderOptionsUpdated?: (borderOptions: BorderOptions) => void\n public onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void\n public onStateReplaced?: (\n newState: Record<string, any>,\n oldState: Record<string, any>,\n replacedBy: ReplacedBy,\n delta: UpdatedStateEntry[],\n ) => void\n public onPositionUpdated?: (positionUpdate: PositionUpdated) => void\n /**\n * The host moved a system bar over an edge-to-edge frame (device rotated,\n * navigation mode switched). `safeAreaInsets` and the\n * `--lavitre-safe-area-inset-*` CSS variables are already updated when\n * this fires. Added 1.51.\n */\n public onSafeAreaInsetsUpdated?: (msg: SafeAreaInsetsUpdated) => void\n public onDeviceFullscreenUpdated?: (\n deviceFullscreenUpdated: DeviceFullscreenUpdated,\n ) => void\n public onVisibilityChanged?: (msg: VisibilityChanged) => void\n public onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void\n public onUpdateFrameName?: (name: string) => void\n public onSharedStreamUpdate?: (msg: SharedStreamState) => void\n /**\n * Reverse breakout box: fires when the Vitre host exposes a live\n * `MediaStream` it owns INTO this frame (e.g. a received shared camera, or a\n * companion stream routed to this frame for transformation). The stream is\n * rebuilt locally via `MediaStreamTrackGenerator` from transferred readables\n * — zero re-encode, same-site + Chromium only. Elsewhere (a web guest whose\n * page is on another site than the app, Safari, Firefox) the host sends it\n * over a local RTCPeerConnection instead; the callback is the same.\n * `streamId` matches a later `onSharedStreamRemoved`. Inverse of\n * {@link shareStream}.\n */\n public onSharedStream?: (streamId: string, stream: MediaStream) => void\n public onSharedStreamRemoved?: (streamId: string) => void\n public onMediaDevicesChanged?: (devices: ConnectedMediaDevice[]) => void\n public onBluetoothMessage?: (msg: BluetoothToApp) => void\n /** @deprecated Use `crdt.onSynced` */\n public onYjsSynced?: () => void\n /** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */\n public onYjsUpdate?: (update: Uint8Array) => void\n public hostInformation: HostInformation\n /**\n * Distances from the frame's edges to the area free of system UI, in CSS\n * px. Non-zero only for a companion frame declared\n * `CompanionFrameOption.edgeToEdge`, on a host drawing under the system\n * bars (Android). Also exposed as `--lavitre-safe-area-inset-top|right|\n * bottom|left` on `document.documentElement`, so plain CSS can use them:\n * `padding-bottom: var(--lavitre-safe-area-inset-bottom, 0px)`. Updated in\n * place before `onSafeAreaInsetsUpdated` fires. Added 1.51.\n */\n public safeAreaInsets: SafeAreaInsets = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }\n /**\n * The companion's own identity/runtime context, present only when this\n * frame is loaded by a la Vitre **companion** (`hostInformation.isCompanion`\n * is then true). Undefined on Vitre-side frames. Mirrors\n * `CompanionConnector.companionInformation`. Added 1.19.\n */\n public companionInformation?: CompanionInformation\n public initiator: Device\n public id: string\n public appId: string\n public initOptions: InitFrameOptions\n /**\n * @deprecated Use initOptions.border.modeinitOptions\n */\n public isBorderless: boolean\n public isFullscreen: boolean\n public state: Record<string, any> = {}\n\n /**\n * CRDT channel — Yjs doc + Awareness piped over the la Vitre transport.\n * Libraries (Carbone, …) can call `crdt.attach(doc, awareness)` to bring\n * their own; simple apps use `crdt.doc` / `crdt.awareness` directly.\n */\n public readonly crdt: CrdtChannel\n\n /**\n * CRDT-backed blob store built on `crdt.attachSubdoc` — see Connector.blobs.\n */\n public readonly blobs: BlobStore\n\n /**\n * Public, unauthenticated file storage scoped to the vitre's TEAM — see\n * the README \"Public storage\" section for the full semantics (scopes,\n * allowed file types, size cap, path rules). Files are readable by\n * ANYONE at the returned URL — never put private data here. Only a\n * Vitre-hosted frame has this — a companion frame cannot write.\n */\n public readonly publicStorage: PublicStorageApi = {\n put: async (path, data, contentType, scope = 'app', options) => {\n validateExpiresIn(options?.expiresIn)\n const buffer = await this.toPublicFileBuffer(data)\n if (buffer.byteLength > MAX_PUBLIC_FILE_SIZE_BYTES) {\n throw new PublicStorageError('tooLarge')\n }\n const requestId = randomUuid()\n return await this.postRequest<PublicFile>(\n {\n type: 'putPublicFile',\n requestId,\n scope,\n path,\n contentType,\n data: buffer,\n ...putPublicFileExpiryField(options?.expiresIn),\n },\n (msg, resolve, reject) => {\n if (msg.type === 'publicStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve(\n withDownloadUrlFallback(\n msg.file ?? { path, url: msg.url ?? '', size: buffer.byteLength },\n ),\n )\n } else {\n reject(new PublicStorageError(msg.error ?? 'failed'))\n }\n }\n },\n [buffer],\n { ms: PUBLIC_STORAGE_PUT_TIMEOUT_MS, onTimeout: () => new PublicStorageError('unsupported') },\n )\n },\n delete: async (path, scope = 'app') => {\n const requestId = randomUuid()\n await this.postRequest<void>(\n { type: 'deletePublicFile', requestId, scope, path },\n (msg, resolve, reject) => {\n if (msg.type === 'publicStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) resolve(undefined)\n else reject(new PublicStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PUBLIC_STORAGE_TIMEOUT_MS, onTimeout: () => new PublicStorageError('unsupported') },\n )\n },\n list: async (prefix, scope = 'app') => {\n const requestId = randomUuid()\n return await this.postRequest<PublicStorageListResult>(\n { type: 'listPublicFiles', requestId, scope, prefix },\n (msg, resolve, reject) => {\n if (msg.type === 'publicStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve({\n baseUrl: msg.baseUrl ?? '',\n files: (msg.files ?? []).map(withDownloadUrlFallback),\n })\n } else reject(new PublicStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PUBLIC_STORAGE_TIMEOUT_MS, onTimeout: () => new PublicStorageError('unsupported') },\n )\n },\n }\n\n /**\n * Private file storage scoped to the vitre's TEAM — see the README\n * \"Private storage\" section for the full semantics. Unlike\n * `publicStorage`, files here have no public link: readable by any\n * vitre or companion of the team via `get` or a temporary `getLink`\n * signed link, never by an anonymous visitor. Full (put/delete/list/\n * get/getLink) on a Vitre-hosted frame; a companion frame only has\n * `list`/`get`/`getLink` (see the `CompanionFrame` exported type).\n */\n public readonly privateStorage: PrivateStorageApi = {\n put: async (path, data, contentType, scope = 'app', options) => {\n validatePrivatePath(path)\n validatePrivateExpiresIn(options?.expiresIn)\n const buffer = await this.toPrivateFileBuffer(data)\n if (buffer.byteLength > MAX_PRIVATE_FILE_SIZE_BYTES) {\n throw new PrivateStorageError('tooLarge')\n }\n const requestId = randomUuid()\n return await this.postRequest<PrivateFile>(\n {\n type: 'putPrivateFile',\n requestId,\n scope,\n path,\n contentType,\n data: buffer,\n ...privateFileExpiryField(options?.expiresIn),\n },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve(msg.file ?? { path, size: buffer.byteLength, contentType })\n } else {\n reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n }\n },\n [buffer],\n { ms: PRIVATE_STORAGE_PUT_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n delete: async (path, scope = 'app') => {\n const requestId = randomUuid()\n await this.postRequest<void>(\n { type: 'deletePrivateFile', requestId, scope, path },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) resolve(undefined)\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n list: async (prefix, scope = 'app') => {\n const requestId = randomUuid()\n return await this.postRequest<PrivateStorageListResult>(\n { type: 'listPrivateFiles', requestId, scope, prefix },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok) resolve({ scope, files: msg.files ?? [] })\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n get: async (path, scope = 'app') => {\n const requestId = randomUuid()\n return await this.postRequest<{ data: ArrayBuffer; contentType: string }>(\n { type: 'getPrivateFile', requestId, scope, path },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok && msg.data) resolve({ data: msg.data, contentType: msg.contentType ?? '' })\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_GET_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n getLink: async (path, options) => {\n validateLinkExpiresIn(options?.expiresIn)\n const scope = options?.scope ?? 'app'\n const requestId = randomUuid()\n return await this.postRequest<PrivateFileLink>(\n {\n type: 'getPrivateFileLink',\n requestId,\n scope,\n path,\n ...privateFileExpiryField(options?.expiresIn),\n },\n (msg, resolve, reject) => {\n if (msg.type === 'privateStorageResponse' && msg.requestId === requestId) {\n if (msg.ok && msg.link) resolve(msg.link)\n else reject(new PrivateStorageError(msg.error ?? 'failed'))\n }\n },\n undefined,\n { ms: PRIVATE_STORAGE_TIMEOUT_MS, onTimeout: () => new PrivateStorageError('unsupported') },\n )\n },\n }\n\n /**\n * AI tool channel — publish a catalog of tools the on-prem agent's LLM can call\n * on this frame: `ai.registerTools([{ name, description, parameters, sensitive }],\n * (name, args) => …)`. Register SIMPLE local names; the host namespaces them as\n * `<appId>__<name>`. Invocations run against the handler and reply automatically.\n */\n public readonly ai: AiChannel\n\n /** @deprecated Use `crdt.doc`. See Connector.yjsDoc for the setter\n * rationale (legacy field-assignment backward-compat). */\n get yjsDoc() {\n return this.crdt.doc\n }\n set yjsDoc(doc: Y.Doc) {\n this.crdt.attach(doc)\n }\n\n public position: Rect\n public zIndex: number\n\n private deviceStateListeners = new Set<() => void>()\n private sharedStreamPeers = new Map<string, SharedStreamPeer>()\n\n /**\n * Called after any change of `hostInformation.device`,\n * `hostInformation.devicesInSpace` or the available media devices (device\n * joined or left, privacy, fullscreen, scaling, media devices, Vitre\n * settings), once the matching `on…` callback has run. Unlike those callbacks, several\n * listeners can coexist: SDK helpers use this so they never replace a\n * handler the app assigned. Returns the unsubscribe function. Added 1.52.\n */\n public addDeviceStateListener(listener: () => void): () => void {\n this.deviceStateListeners.add(listener)\n return () => this.deviceStateListeners.delete(listener)\n }\n\n private notifyDeviceState() {\n for (const listener of this.deviceStateListeners) {\n try {\n listener()\n } catch (error) {\n console.error('[Frame] device state listener failed', error)\n }\n }\n }\n\n constructor(\n // `protected` (not `private`) so the companion-only subclass\n // `CompanionFrameImpl` (CompanionFrame.ts) can post its companion-frame\n // messages while keeping those methods off the Vitre `Frame` surface.\n protected readonly postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n public options: ViewOptions,\n initState?: Record<string, any>,\n ) {\n this.hostInformation = initMessage.hostInfo\n this.companionInformation = initMessage.companionInfo\n this.initiator = initMessage.initiator\n this.id = initMessage.id\n this.appId = initMessage.appId ?? ''\n this.initOptions = initMessage.options\n this.isBorderless = initMessage.isBorderless\n this.isFullscreen = initMessage.isFullscreen\n this.position = initMessage.position\n this.zIndex = 0\n if (initMessage.safeAreaInsets)\n this.applySafeAreaInsets(initMessage.safeAreaInsets)\n this.isFullscreen = initMessage.isFullscreen\n\n this.postMessage({\n type: 'frameInitialized',\n options,\n })\n\n const w = window as any\n w.frameConnector = this\n w.connector = this\n this.state = initState ?? {}\n\n // Mirror of the Connector guard — both connectors must behave\n // identically. See MIN_CRDT_HOST_VERSION for the rationale.\n //\n // Exception: a companion frame (`hostInformation.isCompanion`) is never\n // gated. Its host is the la-Vitre companion, which is deployed centrally\n // and always runs HEAD, so it always carries the CRDT relay. Gating it is\n // also actively harmful: the version it advertises is the companion's OWN\n // build version, and a misconfigured deploy can ship a stale placeholder\n // (a preview build shipped `1.2.0.0`), which silently disables Yjs sync\n // for every companion frame. The real sync peer is the Vitre, whose own\n // gate still applies on its side.\n const crdtSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_CRDT_HOST_VERSION)\n this.crdt = new CrdtChannel((message, transfer) => {\n // Same as Connector: `FrameApiMessagesOut` already includes the four\n // `crdt*` arms (Frame.Model.ts), so no cast is needed.\n if (!crdtSupported) return\n this.postMessage(message, transfer)\n })\n this.crdt.onSynced(() => this.onYjsSynced?.())\n this.crdt.onUpdate((update) => this.onYjsUpdate?.(update))\n this.blobs = new BlobStore(this.crdt)\n\n // AI tool channel — same companion-exception + version gate as CRDT (a host\n // that predates the ai bridge ignores the unknown arms and never invokes).\n const aiSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_AI_HOST_VERSION)\n this.ai = new AiChannel((message) => {\n if (!aiSupported) return\n this.postMessage(message)\n })\n\n if (this.state['@sharedStreamState.state']) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: this.state['@sharedStreamState.state'] as SharedStreamPlayState,\n }\n }\n if (typeof this.state['@sharedStreamState.duration'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: this.state['@sharedStreamState.duration'] as number,\n }\n }\n if (typeof this.state['@sharedStreamState.position'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: this.state['@sharedStreamState.position'] as number,\n }\n }\n }\n\n private resolveRequest(msg: FrameApiMessagesIn) {\n this.requestResolvers = this.requestResolvers.filter(\n (rr) => !rr.isHandled(msg),\n )\n }\n\n raiseMessage(msg: FrameApiMessagesIn) {\n this.resolveRequest(msg)\n\n switch (msg.type) {\n case 'privacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n device: { ...this.hostInformation.device, privacy: msg.privacy },\n }\n this.onPrivacyChanged?.(msg.privacy)\n break\n case 'deviceJoined':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDeviceJoined?.(msg.device)\n this.notifyDeviceState()\n break\n case 'deviceLeft':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.deviceId,\n ),\n }\n this.onDeviceLeft?.(msg.deviceId)\n this.notifyDeviceState()\n break\n case 'deviceMessageReceived':\n this.onDeviceMessageReceived?.(msg)\n break\n case 'localConnectorMessageReceived':\n this.onLocalConnectorMessageReceived?.(msg.data, msg.from, msg.fileData)\n break\n case 'menuClicked':\n this.onMenuClicked?.(msg.menuId, msg.tag, msg.isChecked)\n break\n case 'fieldUpdated':\n this.onFieldUpdated?.(msg.field)\n break\n case 'isInteractingChanged':\n this.onInteractingChanged?.(msg.isInteracting)\n break\n case 'borderlessUpdated':\n this.isBorderless = msg.isBorderless\n this.onBorderlessChanged?.(msg.isBorderless)\n break\n case 'fullscreenUpdated':\n this.isFullscreen = msg.isFullscreen\n this.onFullscreenChanged?.(msg.isFullscreen)\n break\n case 'fileLoaded':\n this.onFileLoaded?.(msg.file)\n break\n case 'fileProgress':\n this.onFileProgress?.(msg.bytes, msg.totalBytes)\n break\n case 'exportRequest':\n {\n const resolve = (data: ExportData) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n data,\n })\n }\n\n const reject = (error: string) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n error,\n })\n }\n this.onExportRequest?.(msg, resolve, reject)\n }\n break\n case 'knockKnockReceived':\n this.onKnockKnock?.(msg)\n break\n case 'settingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n settings: msg.settings,\n }\n this.onSettingsUpdated?.(msg.settings)\n break\n case 'appSettingsResponse':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'appSettingsChanged':\n void this.settingsDefaults\n .merged(msg.level, msg.value ?? {}, msg.version)\n .then((change) => this.onSettingsChanged?.(change))\n break\n case 'publicStorageResponse':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'privateStorageResponse':\n // Handled by requestResolvers (postRequest pattern)\n break\n case 'vitreSettingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n space: msg.currentSpace,\n vitreSettings: msg,\n device: {\n ...this.hostInformation.device,\n name: msg.name ?? this.hostInformation.device.name,\n color: msg.color,\n },\n }\n this.onVitreSettingsUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'connectionCodeUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n companionCode: msg.companionCode,\n }\n this.onConnectionCodeUpdated?.(msg.companionCode)\n break\n case 'notificationButtonClicked':\n this.onNotificationButtonClicked?.(msg)\n break\n case 'notificationDismissed':\n this.onNotificationDismissed?.(msg.id)\n break\n case 'devicePrivacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDevicePrivacyChanged?.(msg.device)\n this.notifyDeviceState()\n break\n case 'deviceFrameLoaded':\n this.onDeviceFrameLoaded?.(msg)\n break\n case 'deviceFrameUnloaded':\n this.onDeviceFrameUnloaded?.(msg)\n break\n case 'deviceFrameConnectorLoaded':\n this.onDeviceFrameConnectorLoaded?.(msg)\n break\n case 'pendingDevicesConnectionRequested':\n this.onPendingDevicesConnectionRequested?.(msg.pendingDevices)\n break\n case 'borderOptionsUpdated':\n this.onBorderOptionsUpdated?.(msg)\n break\n case 'voiceActionDetected':\n this.onVoiceActionDetected?.(msg)\n break\n case 'stateReplaced':\n this._onStateReplaced(msg)\n break\n case 'positionUpdated':\n this.position = msg.position\n this.zIndex = msg.zIndex\n this.isFullscreen = msg.isFullscreen\n this.onPositionUpdated?.(msg)\n break\n case 'safeAreaInsetsUpdated':\n this.applySafeAreaInsets(msg.safeAreaInsets)\n this.onSafeAreaInsetsUpdated?.(msg)\n break\n case 'deviceFullscreenUpdated':\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId ? { ...d, fullscreen: msg.fullscreen } : d,\n )\n this.onDeviceFullscreenUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'visibilityChanged':\n this.onVisibilityChanged?.(msg)\n break\n case 'deviceScalingUpdated':\n if (msg.deviceId === this.hostInformation.device.id) {\n this.hostInformation.device.sendingScaling = msg.sendingScaling\n this.hostInformation.device.orientation = msg.orientation\n this.hostInformation.device.orientationBy = msg.orientationBy\n }\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId\n ? {\n ...d,\n sendingScaling: msg.sendingScaling,\n orientation: msg.orientation,\n orientationBy: msg.orientationBy,\n }\n : d,\n )\n this.onDeviceScalingUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'updateFrameName':\n this.options.name = msg.name\n this.onUpdateFrameName?.(msg.name)\n break\n case 'localSharedStreamUpdate':\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n volume: msg.volume,\n }\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n break\n case 'sharedStreamAvailable': {\n // Reverse breakout box — rebuild a live MediaStream from the readables\n // the host transferred into this frame (one MediaStreamTrackGenerator\n // per track; pipe the readable into its writable). Mirrors the host's\n // tracksFromReadables / SDK toShareTracks on the share side.\n const tracks = msg.tracks.map((t) => {\n const generator = new MediaStreamTrackGenerator({ kind: t.kind })\n t.readable.pipeTo(generator.writable).catch(() => {})\n return generator as MediaStreamTrack\n })\n this.onSharedStream?.(msg.streamId, new MediaStream(tracks))\n break\n }\n case 'sharedStreamOffer': {\n this.sharedStreamPeers.get(msg.streamId)?.close()\n const peer = acceptSharedStreamOffer(\n msg.port,\n (stream) => this.onSharedStream?.(msg.streamId, stream),\n () => {\n if (this.sharedStreamPeers.get(msg.streamId) === peer)\n this.sharedStreamPeers.delete(msg.streamId)\n },\n )\n this.sharedStreamPeers.set(msg.streamId, peer)\n break\n }\n case 'sharedStreamRemoved':\n this.sharedStreamPeers.get(msg.streamId)?.close()\n this.onSharedStreamRemoved?.(msg.streamId)\n break\n case 'mediaDevicesChanged':\n this.hostInformation = {\n ...this.hostInformation,\n vitreSettings: {\n ...this.hostInformation.vitreSettings,\n availableMediaDevices: msg.devices,\n },\n }\n this.onMediaDevicesChanged?.(msg.devices)\n this.notifyDeviceState()\n break\n case 'bluetooth':\n this.onBluetoothMessage?.(msg)\n break\n case 'crdtUpdate':\n case 'crdtSyncComplete':\n case 'crdtRequestSync':\n case 'crdtAwarenessUpdate':\n case 'crdtSubdocUpdate':\n case 'crdtSubdocSyncComplete':\n case 'crdtSubdocTransferProgress':\n case 'crdtSubdocRequestSync':\n this.crdt.handleMessage(msg)\n break\n case 'aiInvoke':\n void this.ai.handleInvoke(msg.id, msg.name, msg.args)\n break\n case 'companionFramePeerJoined':\n this.onCompanionFramePeerJoined?.(msg.peer)\n break\n case 'companionFramePeerLeft':\n this.onCompanionFramePeerLeft?.(msg.peerId)\n break\n case 'companionFramePeersUpdated':\n this.onCompanionFramePeersUpdated?.(msg.peers)\n break\n }\n\n this.onMessageReceived?.(msg)\n }\n\n /** Stores the insets and mirrors them as `--lavitre-safe-area-inset-*` on `<html>`. */\n private applySafeAreaInsets(insets: SafeAreaInsets) {\n this.safeAreaInsets = insets\n const root =\n typeof document !== 'undefined' ? document.documentElement : undefined\n if (!root) return\n for (const edge of ['top', 'right', 'bottom', 'left'] as const) {\n root.style.setProperty(\n `--lavitre-safe-area-inset-${edge}`,\n `${insets[edge]}px`,\n )\n }\n }\n\n private _onStateReplaced(msg: StateReplaced) {\n const oldState = this.state\n this.state = msg.state\n\n let hasSharedStreamUpdate = false\n\n msg.delta.forEach((update) => {\n if (\n update.key === '@sharedStreamState.state' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: update.value as SharedStreamPlayState,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.duration' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: update.value as number,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.position' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: update.value as number,\n }\n hasSharedStreamUpdate = true\n }\n })\n\n if (hasSharedStreamUpdate) {\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n }\n\n this.onStateReplaced?.(this.state, oldState, msg.replacedBy, msg.delta)\n }\n\n public sendMessageTo(message: SendMessageTo) {\n this.postMessage({ type: 'sendMessageTo', ...message })\n }\n\n public sendMessageToAll(message: SendMessageToAll) {\n this.postMessage({ type: 'sendMessageToAll', ...message })\n }\n\n public sendKnockKnock(message: SendKnockKnock) {\n this.postMessage({ type: 'sendKnockKnock', ...message })\n }\n\n /** Release the resources owned by this frame. Tears the CRDT channel\n * down (unbinds doc/awareness listeners, destroys the default Y.Doc +\n * Awareness). Safe to call multiple times. */\n public destroy(): void {\n this.crdt.destroy()\n }\n\n public setFullscreen() {\n this.postMessage({\n type: 'setFullscreen',\n })\n }\n\n public setMenu(menu: FrameMenuEntry[]) {\n this.postMessage({\n type: 'setFrameMenu',\n menu,\n })\n }\n\n /**\n * SDK 1.47 — replace the frame's export sources after initialization.\n *\n * The initial set comes from the `ViewOptions.exportSources` returned by\n * `initializeFrame`; this is the only way to change it afterwards, e.g.\n * when a document gains a format, or to flip `availableForCompanion` on a\n * source once it becomes too large to hand to a phone.\n *\n * The call REPLACES the whole list — pass every source you still want,\n * not just the new ones. The host rebuilds both its own export menu and\n * the companions' from it.\n */\n public setExportSources(exportSources: AvailableExportSource[]) {\n this.postMessage({\n type: 'setExportSources',\n exportSources,\n })\n }\n\n public applyStreamAdvancedConstraints(\n constraints: ApplyStreamAdvancedConstraints,\n ) {\n this.postMessage({\n ...constraints,\n type: 'applyStreamAdvancedConstraints',\n })\n }\n\n /**\n * Replace the video track of this frame's shared stream with a fresh\n * `getUserMedia` capture matching `constraints` (e.g. to switch camera),\n * keeping the same share alive (`replaceTrack` on the host, no\n * renegotiation). The host forces the requested `deviceId` as `{ exact }`.\n * Resolves with the new track infos so the frame can rebuild its menu.\n */\n public async requestReplaceStream(\n constraints: MediaStreamConstraints,\n ): Promise<MediaTrackInfo[]> {\n const requestId = randomUuid()\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'replaceFrameStream', requestId, constraints },\n (msg, resolve, reject) => {\n if (\n msg.type === 'replaceFrameStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'replaceFrameStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n public setWindowed() {\n this.postMessage({\n type: 'setWindowed',\n })\n }\n\n public close() {\n this.postMessage({\n type: 'close',\n })\n }\n\n public sendToLocalFrame(\n frameConnectorId: string,\n data: any,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId,\n data,\n fileData,\n })\n }\n\n public sendToLocalMainConnector(data: any, fileData?: FileData) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId: undefined,\n data,\n fileData,\n })\n }\n\n /**\n * Convenience for companion frames: send a message to the paired Vitre\n * frame (same `frameConnectorId`). Wraps `sendToLocalFrame` with the\n * current frame's id so callers don't have to repeat it. The receiving\n * Vitre frame surfaces it on `onLocalConnectorMessageReceived` (data,\n * from, fileData). The same primitive works from a Vitre frame too,\n * but on the Vitre most apps want `sendMessageTo` / `sendMessageToAll`\n * to reach other devices instead — which the companion has no way to\n * address. See `CompanionFrame` for the trimmed surface intended for\n * apps running on a companion frame iframe.\n */\n public sendToVitreFrame(data: any, fileData?: FileData) {\n this.sendToLocalFrame(this.id, data, fileData)\n }\n\n // The companion-only send methods `sendMessageToVitreConnector` and\n // `closeOnCompanion` deliberately do NOT live on the Vitre `Frame`. They post\n // host messages (`sendToVitreConnector` / `closeOnCompanion`) that ONLY the\n // companion host decodes — a Vitre host rejects them with \"case type not\n // found\". They live on `CompanionFrame` (the subclass returned by\n // `initializeCompanionFrame`, see CompanionFrame.ts). A Vitre frame that needs\n // to reach its own connector uses `sendToLocalMainConnector` instead.\n\n public stopInteracting() {\n this.postMessage({\n type: 'stopInteracting',\n })\n }\n\n public setPosition(position: LayoutPosition) {\n this.postMessage({\n type: 'setPosition',\n ...position,\n })\n }\n\n public setVisibility(visibility: Visibility) {\n this.postMessage({\n type: 'setVisibility',\n visibility,\n })\n }\n\n public setReducedAudioMode(enabled: boolean) {\n this.postMessage({\n type: 'setReducedAudioMode',\n enabled,\n })\n }\n\n public startInteracting() {\n this.postMessage({ type: 'startInteracting' })\n }\n\n public sendToSerialPort(serialPort: SendToSerialPort) {\n this.postMessage({\n type: 'sendToSerialPort',\n ...serialPort,\n })\n }\n\n /// Request access to a serial port (see `Connector.requestSerialPortAccess`).\n /// Resolves with the granted port name (empty string if denied/cancelled).\n /// With `{ port }` the host pre-grants it; with no argument the host shows\n /// its port-picker and resolves with the chosen port.\n public async requestSerialPortAccess(\n request?: RequestSerialPortAccess,\n ): Promise<string> {\n const requestId = randomUuid()\n return await this.postRequest<string>(\n { type: 'requestSerialPortAccess', requestId, port: request?.port },\n (msg, resolve, reject) => {\n if (\n msg.type === 'serialPortAccessResult' &&\n msg.requestId === requestId\n ) {\n if (msg.port) {\n resolve(msg.port)\n } else {\n reject(msg.reason ?? 'cancelled')\n }\n }\n },\n )\n }\n\n public sendBluetoothMessage(msg: BluetoothFromApp) {\n this.postMessage({ ...msg, type: 'bluetooth' } as any)\n }\n\n public disconnectGuests(deviceIds: string[]) {\n this.postMessage({\n type: 'disconnectGuests',\n deviceIds,\n })\n }\n\n public requestStreamSizeUpdate(updates: RequestStreamSizeUpdate) {\n this.postMessage({\n type: 'requestStreamSizeUpdate',\n ...updates,\n })\n }\n\n public updateName(name: string) {\n this.postMessage({\n type: 'updateName',\n name,\n })\n }\n\n /**\n * Whether {@link shareStream} is available in this runtime (Chromium\n * Insertable Streams + same-site hosting). Same gate as\n * `Connector.canShareStream`.\n */\n public canShareStream(): boolean {\n return typeof MediaStreamTrackProcessor !== 'undefined'\n }\n\n /** Normalize `publicStorage.put`'s payload to a plain `ArrayBuffer` —\n * slicing out exactly a typed array's view (not its whole underlying\n * buffer, in case it's a subarray) so the transferred bytes match the\n * size the caller intended. */\n private async toPublicFileBuffer(\n data: ArrayBuffer | Blob | Uint8Array,\n ): Promise<ArrayBuffer> {\n if (data instanceof ArrayBuffer) return data\n if (data instanceof Blob) return await data.arrayBuffer()\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) as ArrayBuffer\n }\n\n /** Same normalization as {@link toPublicFileBuffer}, for `privateStorage.put`. */\n private async toPrivateFileBuffer(\n data: ArrayBuffer | Blob | Uint8Array,\n ): Promise<ArrayBuffer> {\n if (data instanceof ArrayBuffer) return data\n if (data instanceof Blob) return await data.arrayBuffer()\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) as ArrayBuffer\n }\n\n private toShareTracks(stream: MediaStream): {\n tracks: ShareStreamTrack[]\n transfer: Transferable[]\n } {\n const tracks: ShareStreamTrack[] = []\n const transfer: Transferable[] = []\n for (const track of stream.getTracks()) {\n const { readable } = new MediaStreamTrackProcessor({ track })\n tracks.push({\n kind: track.kind as ShareStreamTrack['kind'],\n readable,\n settings: track.getSettings(),\n })\n transfer.push(readable)\n }\n return { tracks, transfer }\n }\n\n /**\n * Share a `MediaStream` the frame produced (e.g. a WebGL-transformed track,\n * or a camera the frame opened) TO the Vitre, which forwards it to the space\n * peers. Frame-context counterpart of `Connector.shareStream`: needed because\n * a transform frame builds its output track locally and must reshare it.\n * Handed over zero-copy via the breakout box. Returns a `sharedStreamId` for\n * {@link replaceShareStream} / {@link stopShareStream}.\n */\n public async shareStream(\n stream: MediaStream,\n options?: ShareStreamOptions,\n ): Promise<string> {\n if (!this.canShareStream()) {\n throw new Error(\n 'shareStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const sharedStreamId = randomUuid()\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'shareStream', requestId, sharedStreamId, options, tracks },\n (msg, resolve, reject) => {\n if (\n msg.type === 'shareStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n return sharedStreamId\n }\n\n /**\n * Swap the source of an open frame share WITHOUT closing it (no\n * renegotiation blip). `sharedStreamId` is the value returned by\n * {@link shareStream}. See `Connector.replaceShareStream`.\n */\n public async replaceShareStream(\n sharedStreamId: string,\n streamOrTrack: MediaStream | MediaStreamTrack,\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error('replaceShareStream is not supported in this runtime')\n }\n const stream =\n streamOrTrack instanceof MediaStream\n ? streamOrTrack\n : new MediaStream([streamOrTrack])\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'replaceShareStream', requestId, sharedStreamId, tracks },\n (msg, resolve, reject) => {\n if (\n msg.type === 'shareStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /** Stop a frame share. `sharedStreamId` is the value returned by {@link shareStream}. */\n public stopShareStream(sharedStreamId: string): void {\n this.postMessage({ type: 'stopShareStream', sharedStreamId })\n }\n\n /**\n * Attach a `MediaStream` produced by this frame to a target frame's standard\n * sharing slot, WITHOUT opening a new `SharedContent` or establishing a new\n * `RTCPeerConnection`. The stream is forwarded zero-copy (breakout box) from\n * this frame's vitre to the already-open instances of `targetFrameConnectorId`\n * on other vitres; those instances receive it via {@link onSharedStream} (the\n * existing `sharedStreamAvailable` delivery arm — no new protocol arm).\n *\n * - Requires Chromium Insertable Streams (same guard as {@link shareStream}).\n * - Default target: this frame's own `frameConnectorId`, i.e. the same app\n * type running on peer vitres. Pass `opts.targetFrameConnectorId` to route\n * to a different frame type.\n * - Resolves when the host confirms delivery (or rejects with the host error).\n *\n * **Delivery semantics:**\n * - When `targetFrameConnectorId` is absent (default, target == this frame\n * type), the stream is delivered to peer vitres' instances of this frame via\n * {@link onSharedStream}. The calling frame already holds `stream` and does\n * NOT receive it back via `onSharedStream` (no loopback — intentional).\n * - When `targetFrameConnectorId` designates a DIFFERENT frame type, that\n * frame — including its instance on the emitting vitre — receives the stream\n * via {@link onSharedStream}.\n */\n public async attachStream(\n stream: MediaStream,\n opts?: { targetFrameConnectorId?: string },\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error(\n 'attachStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n {\n type: 'attachStream',\n requestId,\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n tracks,\n },\n (msg, resolve, reject) => {\n if (\n msg.type === 'attachStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /**\n * Stop a stream previously attached with {@link attachStream} on the target\n * frame. Receivers see {@link onSharedStreamRemoved}. Default target: this\n * frame's own `frameConnectorId`.\n */\n public detachStream(opts?: { targetFrameConnectorId?: string }): void {\n this.postMessage({\n type: 'detachStream',\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n })\n }\n\n /**\n * Fetch the ICE/TURN servers the HOST already uses for its own WebRTC P2P\n * (the Vitre's `StartWebRTCOffer` config, or the companion's `WebRTCOffer`\n * config — same relays, same credentials). The result feeds straight into\n * `new RTCPeerConnection({ iceServers })`, letting an app stand up its OWN\n * peer connection — e.g. a companion-camera frame connecting directly to its\n * paired Vitre transform frame — that traverses NAT through the platform's\n * TURN infrastructure without shipping its own credentials.\n *\n * Resolves to `[]` on hosts that predate this request (the caller should\n * race a timeout and fall back to a public STUN-only config). See\n * {@link IceServerConfig}.\n */\n public async getIceServers(): Promise<IceServerConfig[]> {\n const requestId = randomUuid()\n return await this.postRequest<IceServerConfig[]>(\n { type: 'getIceServers', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'iceServersResponse' && msg.requestId === requestId) {\n resolve(msg.iceServers ?? [])\n }\n },\n )\n }\n\n private requestResolvers: RequestResolver[] = []\n private async postRequest<Data>(\n data: FrameApiMessagesOut,\n handler: (\n msg: FrameApiMessagesIn,\n resolve: (data: Data) => void,\n // `any` (not `string`) so callers can reject with a typed Error, e.g.\n // AppSettingsError — most existing handlers still reject with a plain\n // string message.\n reject: (error: any) => void,\n ) => void,\n transfer?: Transferable[],\n // When set, rejects with `onTimeout()` if no matching response arrives\n // within `ms` — AND removes the pending resolver from\n // `requestResolvers`. Without that removal a host that never answers\n // (e.g. one that predates the message type) would leak the resolver\n // forever, since the only other removal path is a matching response.\n timeout?: { ms: number; onTimeout: () => any },\n ) {\n return await new Promise<Data>((resolve, reject) => {\n let isHandled = false\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const handleAndResolve = (data: Data) => {\n isHandled = true\n if (timer !== undefined) clearTimeout(timer)\n resolve(data)\n }\n\n const handleAndReject = (error: any) => {\n isHandled = true\n if (timer !== undefined) clearTimeout(timer)\n reject(error)\n }\n\n const resolver = {\n isHandled: (msg: FrameApiMessagesIn) => {\n try {\n handler(msg, handleAndResolve, handleAndReject)\n } catch (error) {\n handleAndReject(error)\n }\n return isHandled\n },\n }\n this.requestResolvers.push(resolver)\n\n if (timeout) {\n timer = setTimeout(() => {\n if (isHandled) return\n this.requestResolvers = this.requestResolvers.filter((rr) => rr !== resolver)\n handleAndReject(timeout.onTimeout())\n }, timeout.ms)\n }\n\n this.postMessage(data, transfer)\n })\n }\n\n public async requestEnumerateLocalFrames(): Promise<LoadedFrame[]> {\n const requestId = randomUuid()\n return await this.postRequest<LoadedFrame[]>(\n { type: 'enumerateLoadedFrames', requestId },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'enumerateLoadedFramesCompleted' &&\n msg.requestId === requestId\n ) {\n resolve(msg.frames)\n }\n },\n )\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendExtensionMessage(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'extensionMessage',\n data,\n target,\n fileData,\n })\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendAppMessage(data: any, target: MessageTarget, fileData?: FileData) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public sendMessageToEmbed(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public async requestVitreSettings() {\n return await this.postRequest<VitreSettings>(\n { type: 'getVitreSettings' },\n (msg, resolve, _reject) => {\n if (msg.type === 'vitreSettingsResponse') {\n resolve(msg as VitreSettings)\n }\n },\n )\n }\n\n public setVitreSettings(setters: VitreSettingsSetter) {\n this.postMessage({ type: 'setVitreSettings', ...setters })\n }\n\n /**\n * Share a URL/data with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. Drives the languette colour/info\n * and the content appears already-owned on every vitre. Default: opener.\n */\n public shareData(url: string, targetAppId?: AppId, owner?: string) {\n this.postMessage({\n type: 'shareData',\n url,\n targetAppId,\n owner,\n })\n }\n\n /**\n * Share a file with the host, which routes it to a matching app.\n * @param owner Optional device id to attribute the share to. See {@link shareData}.\n */\n public shareFile(fileData: FileData, targetAppId: AppId, owner?: string) {\n this.postMessage({\n type: 'shareFile',\n fileData,\n targetAppId,\n owner,\n })\n }\n\n public saveSettings(settings: any) {\n this.postMessage({\n type: 'saveSettings',\n settings,\n })\n }\n\n /**\n * Read the app's settings at one of the three levels — `vitre` (this\n * vitre), `team` (the vitre's team), or `space` (the space the vitre is\n * currently in). Every vitre/app instance of the team can read the same\n * value; values are JSON objects capped at 64 KB — never store secrets.\n *\n * Distinct from the legacy `saveSettings`/`onSettingsUpdated` mechanism,\n * which is a single vitre-scoped blob rendered by the host's settings\n * form (see `Connector.setSettingsSchema`).\n *\n * Rejects with an {@link AppSettingsError} of code `'unsupported'` if the\n * host doesn't answer within 10s — a vitre host older than this feature\n * never responds to `getAppSettings`.\n *\n * Since 1.58, for `team` and `space`, `value` is the defaults of the app's\n * `lavitre.settings.json` (see {@link settingsFileUrl}) overlaid with what is\n * stored, and `stored` is the stored value alone. {@link setSettings} drops\n * the defaults again before writing, so writing back `{ ...value, key }` does\n * not freeze today's defaults into the store.\n */\n public async getSettings(level: AppSettingsLevel): Promise<AppSettingsValue> {\n const requestId = randomUuid()\n const read = await this.postRequest<AppSettingsValue>(\n { type: 'getAppSettings', requestId, level },\n (msg, resolve, reject) => {\n if (msg.type === 'appSettingsResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve({ level: msg.level, value: msg.value ?? {}, version: msg.version ?? 0 })\n } else {\n reject(new AppSettingsError(msg.error ?? 'failed', level))\n }\n }\n },\n undefined,\n { ms: APP_SETTINGS_TIMEOUT_MS, onTimeout: () => new AppSettingsError('unsupported', level) },\n )\n return await this.settingsDefaults.merged(read.level, read.value, read.version)\n }\n\n /**\n * Write the app's settings at `level`, with optimistic concurrency:\n * `expectedVersion` must be the version last observed for that level (from\n * {@link getSettings} or {@link onSettingsChanged}) — `0` if never\n * written. A stale version rejects with an {@link AppSettingsError} of\n * code `'conflict'`; re-read and retry. An oversized `value` (> 64 KB)\n * rejects with `'tooLarge'`.\n *\n * Rejects with code `'unsupported'` if the host doesn't answer within\n * 10s — see {@link getSettings}.\n */\n public async setSettings(\n level: AppSettingsLevel,\n value: Record<string, unknown>,\n expectedVersion: number,\n ): Promise<AppSettingsValue> {\n const requestId = randomUuid()\n const write = await this.settingsDefaults.forWrite(level, value)\n const written = await this.postRequest<AppSettingsValue>(\n {\n type: 'setAppSettings',\n requestId,\n level,\n value: write.value,\n expectedVersion,\n ...(write.schemaVersion !== undefined ? { schemaVersion: write.schemaVersion } : {}),\n },\n (msg, resolve, reject) => {\n if (msg.type === 'appSettingsResponse' && msg.requestId === requestId) {\n if (msg.ok) {\n resolve({\n level: msg.level,\n value: msg.value ?? write.value,\n version: msg.version ?? expectedVersion,\n })\n } else {\n reject(new AppSettingsError(msg.error ?? 'failed', level))\n }\n }\n },\n undefined,\n { ms: APP_SETTINGS_TIMEOUT_MS, onTimeout: () => new AppSettingsError('unsupported', level) },\n )\n return await this.settingsDefaults.merged(written.level, written.value, written.version)\n }\n\n public changeTeamSpace(space: string) {\n this.postMessage({\n type: 'changeTeamSpace',\n space,\n })\n }\n\n public changeTeamSpaceGuest(space: string, teamDomain: string) {\n this.postMessage({\n type: 'changeTeamSpaceGuest',\n space,\n teamDomain,\n })\n }\n\n public showNotification(notification: NotificationInfo) {\n this.postMessage({\n ...notification,\n type: 'showNotification',\n })\n }\n\n public hideNotification(notificationId: string) {\n this.postMessage({\n id: notificationId,\n type: 'hideNotification',\n })\n }\n\n public changePrivacy(privacy: Privacy) {\n this.postMessage({\n type: 'changePrivacy',\n privacy,\n })\n }\n\n public trackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'trackEvent',\n name,\n properties,\n })\n }\n\n public startTrackEvent(name: string) {\n this.postMessage({\n type: 'startTrackEvent',\n name,\n })\n }\n\n public stopTrackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'stopTrackEvent',\n name,\n properties,\n })\n }\n\n public getMainConnectorFrame(): Window | null {\n try {\n const mainFrameId = `${this.appId}|${this.appId}`\n return (window.parent.frames as any)[mainFrameId]\n } catch (_error) {\n return null\n }\n }\n\n public getMainConnector(): Connector | null {\n const mainFrame = this.getMainConnectorFrame() as any\n return mainFrame?.mainConnector as Connector\n }\n\n public setBorderOptions(borderOptions: BorderOptions) {\n this.postMessage({ type: 'setBorderOptions', ...borderOptions })\n }\n\n public setVoiceActions(actions: VoiceAction[]) {\n this.postMessage({\n type: 'setVoiceActions',\n actions,\n })\n }\n\n public async requestStreamCapture() {\n const requestId = randomUuid()\n return await this.postRequest<StreamCapture>(\n { type: 'streamFrameCaptureRequest', requestId },\n (msg, resolve, reject) => {\n if (\n msg.type === 'streamFrameCapturedResponse' &&\n msg.requestId === requestId\n ) {\n if (msg.response == null) {\n reject(msg.error ?? 'failed to get streamFrameCapturedResponse')\n } else {\n resolve(msg.response)\n }\n }\n },\n )\n }\n\n public async requestStats() {\n const requestId = randomUuid()\n return await this.postRequest<StatsResponse>(\n { type: 'getStats', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'statsResponse' && msg.requestId === requestId) {\n resolve(msg)\n }\n },\n )\n }\n\n public updateState(updates: UpdateStateEntry[], forceApplyLocally = true) {\n updates.forEach((update) => {\n //Compat fix, add value for remove action\n if (update.action === 'remove') {\n ;(update as any).value = null\n }\n })\n\n this.postMessage({\n type: 'updateState',\n updates,\n })\n\n if (forceApplyLocally) {\n updates.forEach((update) => {\n if (update.action === 'add') {\n this.state[update.key] = update.value\n } else {\n delete this.state[update.key]\n }\n })\n }\n }\n\n public sharedStream: SharedStream = {\n lastState: {\n position: 0,\n duration: 0,\n volume: 1,\n state: 'paused',\n },\n play: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'play',\n })\n },\n\n pause: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'pause',\n })\n },\n\n seek: (position: number, isRelative: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'seek',\n position,\n isRelative,\n })\n },\n\n setVolume: (volume: number, muted: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'volume',\n volume,\n muted,\n })\n },\n }\n}\n\ntype PostMessageFrameApiOut = (\n message: FrameApiMessagesOut,\n transfer?: Transferable[],\n) => void\n\nexport async function initializeFrame<T extends Frame>(\n init: (\n info: HostInformation,\n initiator: Device,\n options: InitFrameOptions,\n state?: Record<string, any>,\n ) => ViewOptions,\n createFrame?: new (\n postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n options: ViewOptions,\n ) => T,\n) {\n return await new Promise<T>((resolve) => {\n const channel = new MessageChannel()\n let frame: T | null = null\n // A shared stream can reach the frame before `initialize` (the host posts\n // it on the window while the init travels on the port). Keep those until the\n // app has had its turn to set `onSharedStream` after `await initializeFrame`.\n const earlyStreams: FrameApiMessagesIn[] = []\n const messageHandler =\n (createPostMessage: (origin: string) => PostMessageFrameApiOut) =>\n (e: MessageEvent<FrameApiMessagesIn | null>): any => {\n // Any script can post to this window, and a message whose payload\n // cannot be deserialized here arrives with `data === null`.\n if (e.data == null || typeof e.data !== 'object') return\n switch (e.data.type) {\n case 'initialize':\n if (frame === null) {\n const initializeMsg = e.data\n const options = init(\n initializeMsg.hostInfo,\n initializeMsg.initiator,\n initializeMsg.options,\n initializeMsg.state,\n )\n frame = new (createFrame ?? Frame)(\n createPostMessage(initializeMsg.hostInfo.origin),\n initializeMsg,\n options,\n initializeMsg.state,\n ) as T\n resolve(frame)\n if (earlyStreams.length > 0) {\n const created = frame\n setTimeout(() => {\n for (const msg of earlyStreams.splice(0))\n created.raiseMessage(msg)\n })\n }\n }\n break\n case 'sharedStreamAvailable':\n case 'sharedStreamOffer':\n if (frame === null) earlyStreams.push(e.data)\n else frame.raiseMessage(e.data)\n break\n default:\n frame?.raiseMessage(e.data)\n break\n }\n }\n\n channel.port1.onmessage = messageHandler(\n (_origin: string) => (message, transfer?: Transferable[]) => {\n channel.port1.postMessage(message, transfer ?? [])\n },\n )\n\n window.parent.postMessage(\n {\n type: 'connectorInitializationRequest',\n version: apiVersion,\n },\n '*',\n [channel.port2],\n )\n\n window.addEventListener(\n 'message',\n messageHandler(\n (origin: string) => (message, transfer?: Transferable[]) => {\n window.parent.postMessage(message, origin, transfer)\n },\n ),\n false,\n )\n })\n}\n"]}
package/dist/Version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const apiVersion = "1.56.2";
1
+ export declare const apiVersion = "1.58.0";
package/dist/Version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const apiVersion = '1.56.2';
1
+ export const apiVersion = '1.58.0';
2
2
  //# sourceMappingURL=Version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Version.js","sourceRoot":"","sources":["../Version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAA","sourcesContent":["export const apiVersion = '1.56.2'"]}
1
+ {"version":3,"file":"Version.js","sourceRoot":"","sources":["../Version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAA","sourcesContent":["export const apiVersion = '1.58.0'"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lavitre/apps",
3
- "version": "1.56.2",
3
+ "version": "1.58.0",
4
4
  "description": "TypeScript SDK for building la Vitre apps (connector, frames, companion, CRDT sync)",
5
5
  "license": "MIT",
6
6
  "type": "module",