@lavitre/apps 1.49.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.
Files changed (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +121 -0
  3. package/dist/Common/AiChannel.d.ts +59 -0
  4. package/dist/Common/AiChannel.js +97 -0
  5. package/dist/Common/AiChannel.js.map +1 -0
  6. package/dist/Common/BlobStore.d.ts +44 -0
  7. package/dist/Common/BlobStore.js +186 -0
  8. package/dist/Common/BlobStore.js.map +1 -0
  9. package/dist/Common/Common.Model.d.ts +1020 -0
  10. package/dist/Common/Common.Model.js +21 -0
  11. package/dist/Common/Common.Model.js.map +1 -0
  12. package/dist/Common/CrdtChannel.d.ts +198 -0
  13. package/dist/Common/CrdtChannel.js +659 -0
  14. package/dist/Common/CrdtChannel.js.map +1 -0
  15. package/dist/Common/Version.d.ts +21 -0
  16. package/dist/Common/Version.js +62 -0
  17. package/dist/Common/Version.js.map +1 -0
  18. package/dist/Common/index.d.ts +6 -0
  19. package/dist/Common/index.js +32 -0
  20. package/dist/Common/index.js.map +1 -0
  21. package/dist/CompanionConnector/CompanionConnector.Model.d.ts +85 -0
  22. package/dist/CompanionConnector/CompanionConnector.Model.js +17 -0
  23. package/dist/CompanionConnector/CompanionConnector.Model.js.map +1 -0
  24. package/dist/CompanionConnector/CompanionConnector.d.ts +28 -0
  25. package/dist/CompanionConnector/CompanionConnector.js +385 -0
  26. package/dist/CompanionConnector/CompanionConnector.js.map +1 -0
  27. package/dist/CompanionConnector/index.d.ts +2 -0
  28. package/dist/CompanionConnector/index.js +3 -0
  29. package/dist/CompanionConnector/index.js.map +1 -0
  30. package/dist/CompanionFrame/CompanionFrame.d.ts +103 -0
  31. package/dist/CompanionFrame/CompanionFrame.js +100 -0
  32. package/dist/CompanionFrame/CompanionFrame.js.map +1 -0
  33. package/dist/CompanionFrame/index.d.ts +1 -0
  34. package/dist/CompanionFrame/index.js +2 -0
  35. package/dist/CompanionFrame/index.js.map +1 -0
  36. package/dist/Connector/Connector.Model.d.ts +567 -0
  37. package/dist/Connector/Connector.Model.js +2 -0
  38. package/dist/Connector/Connector.Model.js.map +1 -0
  39. package/dist/Connector/Connector.d.ts +227 -0
  40. package/dist/Connector/Connector.js +1337 -0
  41. package/dist/Connector/Connector.js.map +1 -0
  42. package/dist/Connector/index.d.ts +2 -0
  43. package/dist/Connector/index.js +3 -0
  44. package/dist/Connector/index.js.map +1 -0
  45. package/dist/Frame/Frame.Model.d.ts +533 -0
  46. package/dist/Frame/Frame.Model.js +2 -0
  47. package/dist/Frame/Frame.Model.js.map +1 -0
  48. package/dist/Frame/Frame.d.ts +309 -0
  49. package/dist/Frame/Frame.js +1408 -0
  50. package/dist/Frame/Frame.js.map +1 -0
  51. package/dist/Frame/SyncAdapter.d.ts +75 -0
  52. package/dist/Frame/SyncAdapter.js +134 -0
  53. package/dist/Frame/SyncAdapter.js.map +1 -0
  54. package/dist/Frame/index.d.ts +3 -0
  55. package/dist/Frame/index.js +4 -0
  56. package/dist/Frame/index.js.map +1 -0
  57. package/dist/MediaLink/MediaLink.d.ts +178 -0
  58. package/dist/MediaLink/MediaLink.js +1432 -0
  59. package/dist/MediaLink/MediaLink.js.map +1 -0
  60. package/dist/MediaLink/index.d.ts +1 -0
  61. package/dist/MediaLink/index.js +2 -0
  62. package/dist/MediaLink/index.js.map +1 -0
  63. package/dist/Native/index.d.ts +170 -0
  64. package/dist/Native/index.js +19 -0
  65. package/dist/Native/index.js.map +1 -0
  66. package/dist/Version.d.ts +1 -0
  67. package/dist/Version.js +2 -0
  68. package/dist/Version.js.map +1 -0
  69. package/package.json +76 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Connector.Model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Connector.Model.js","sourceRoot":"","sources":["../../Connector/Connector.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AppMessage,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n ChromeStyle,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceJoined,\n DeviceLeft,\n DeviceMessageReceived,\n DevicePrivacyChanged,\n DeviceScalingUpdated,\n EnumerateLoadedFrames,\n EnumerateLoadedFramesCompleted,\n EventTelemetry,\n FieldUpdated,\n FileData,\n FramePrivacy,\n GetStats,\n HideNotification,\n HostInformation,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LayoutPositionWithRules,\n LocalConnectorMessageReceived,\n MenuClicked,\n MenuEntry,\n MenuVisibility,\n NotificationButtonClicked,\n NotificationDismissed,\n NotificationInfo,\n OpenFrameOptions,\n PendingDevicesInfo,\n PositionType,\n PositionUpdated,\n PrivacyChanged,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetReducedAudioMode,\n SettingsUpdated,\n ShareDataRequest,\n ShareFileRequest,\n Size,\n StartEventTelemetry,\n StateReplaced,\n StatsResponse,\n UpdateState,\n ViewMode,\n Visibility,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\n\nexport type InitializeConnector = {\n hostInfo: HostInformation\n appId?: string\n state?: Record<string, any>\n}\n\nexport type RegExpDefinition = {\n pattern: string\n options: string\n}\n\nexport type ShareTargetOptions = {\n name?: string\n urlDomains?: string[]\n urlRegex?: string[]\n urlRegexWithOptions?: RegExpDefinition[]\n files?: FileShareTarget[]\n /**\n * Icon shown for this share target in the companion import picker. A bitmap\n * (full colour). May be a path relative to the connector URL — the host\n * resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl` are\n * set, the companion prefers `maskIconUrl`. When neither is set the picker\n * falls back to the app icon (`ConnectorOptions.iconUrl`).\n */\n iconUrl?: string\n /**\n * Monochrome mask icon for this share target, tinted by the companion theme\n * (CSS `mask`). May be relative to the connector URL — resolved absolute by\n * the host. Preferred over `iconUrl` when both are set.\n */\n maskIconUrl?: string\n}\n\nexport type FileShareTarget = {\n fileExtension?: string\n fileExtensionRegex?: RegExpDefinition\n binaryHeader?: ArrayBufferLike\n mimeTypes?: string[]\n tag?: any\n id: string\n}\n\nexport type MenuCategoryInfo = {\n type: 'mainMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type SettingsMenuCategoryInfo = {\n type: 'settingsMenu'\n label?: string\n description?: string\n}\n\nexport type MainMenuQuickActions = {\n type: 'mainMenuQuickActions'\n label?: string\n description?: string\n order?: number\n}\n\nexport type ExportMenuCategory = {\n type: 'exportMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type RootMenuCategory =\n | { type: 'desktopIcons' }\n | MainMenuQuickActions\n | MenuCategoryInfo\n | SettingsMenuCategoryInfo\n | ExportMenuCategory\n\nexport type RootMenuEntry = Omit<MenuEntry, 'category'> & {\n category?: RootMenuCategory\n}\n\nexport type ConnectorOptions = {\n name: string\n iconUrl?: string\n menu?: RootMenuEntry[]\n /**\n * @deprecated Use `shareTargets`. When `shareTargets` is set the host uses it\n * and ignores this field. Kept on the wire for older Vitres that only read a\n * single share target — the SDK mirrors `shareTargets[0]` here automatically.\n */\n shareTarget?: ShareTargetOptions\n /**\n * Share targets advertised by this app. Several may be declared so an app can\n * receive distinct kinds of content (each with its own `name`/matchers). When\n * provided, this supersedes the deprecated singular `shareTarget`.\n */\n shareTargets?: ShareTargetOptions[]\n settingsSchema?: any\n settingsSchemaUI?: any\n voiceActions?: VoiceAction[]\n}\n\nexport type ConnectorInitialized = {\n options: ConnectorOptions\n}\n\nexport type OpenFrame = {\n options: OpenFrameOptions\n}\n\nexport type OpenLocalFrame = {\n options: OpenFrameOptions\n}\n\nexport type EnumerateMediaDevices = {\n requestId: string\n}\n\nexport type OpenStream = {\n requestId: string\n streamId: string\n constraints: MediaStreamConstraints\n}\n\nexport type OpenStreamFrame = {\n constraints?: MediaStreamConstraints\n streamSourceUrl?: string\n requestId: string\n frameConnectorId: string\n name: string\n url: string\n allowFullscreen?: boolean\n /**\n * @deprecated Use menuVisibility property vitre v20\n */\n hideMenu?: boolean\n startPosition?: LayoutPosition\n startPositions?: LayoutPositionWithRules[]\n interaction?: Interaction\n resizeMode?: ResizeMode\n mode?: ViewMode\n data?: any\n file?: FileData\n privacy?: FramePrivacy\n mirrorInitiatorStream?: boolean\n size?: Size\n minSize?: Size\n maxSize?: Size\n startInteractive?: boolean\n border?: BorderOptions\n positionType?: PositionType\n voiceActions?: VoiceAction[]\n visibility?: Visibility\n menuVisibility?: MenuVisibility\n closable?: boolean\n closeLabel?: string\n}\n\nexport type SetRootMenu = {\n menu: RootMenuEntry[]\n}\n\nexport type SettingsSchema = {\n schema: any\n schemaUI: any\n}\n\nexport type SetFramePosition = {\n frameConnectorId: string\n position: LayoutPosition\n}\n\nexport type CloseFrame = {\n frameConnectorId: string\n}\n\nexport type SetFrameOwner = {\n frameConnectorId: string\n /** Device id of the new owner (HostInformation.devicesInSpace[].id). */\n owner: string\n}\n\n/// Live update of an already-open frame's shared-content style (background /\n/// box-shadow / drop-shadow surface, and companion icon). Emitted by\n/// `connector.setChromeStyle`. Only the provided fields are changed; the others\n/// keep their current value.\nexport type SetChromeStyle = {\n frameConnectorId: string\n} & ChromeStyle\n\n/// Host→app notification that an already-open shared frame's owner was\n/// reassigned via `setFrameOwner`, INCLUDING changes initiated by another\n/// device in the space. Surfaced on the SDK `Connector` as\n/// `onFrameOwnerChanged`. `owner` is the new owner's device id\n/// (HostInformation.devicesInSpace[].id).\nexport type FrameOwnerChanged = {\n frameConnectorId: string\n owner: string\n}\n\n/**\n * @deprecated Use `SetShareTargets` (`setShareTargets`).\n */\nexport type SetShareTarget = {\n shareTarget: ShareTargetOptions\n}\n\nexport type SetShareTargets = {\n shareTargets: ShareTargetOptions[]\n}\n\nexport type FrameUnloaded = {\n frameConnectorId: string\n}\n\nexport type FrameInfo = {\n frameConnectorId: string\n zIndex: number\n}\n\nexport type ShareDataReceived = {\n data: ShareData\n}\n\nexport type FileShareDataReceived = {\n data: FileData\n}\n\nexport type ShareData = {\n url: string\n}\n\nexport type TrackKind = 'audio' | 'video'\n\nexport type MediaTrackInfo = {\n id: string\n kind: TrackKind\n deviceName: string\n capabilities: MediaTrackCapabilities\n settings: MediaTrackSettings\n}\n\nexport type OpenStreamCompleted = {\n requestId: string\n streamId: string\n error?: string\n tracks?: MediaTrackInfo[]\n}\n\n/// One track of an app-provided shared stream. `readable` is the transferable\n/// output of a `MediaStreamTrackProcessor` (breakout box) — the host rebuilds a\n/// live `MediaStreamTrack` from it via `MediaStreamTrackGenerator`. Listed in\n/// the postMessage transfer list, so the host receives the SAME stream\n/// zero-copy (no re-encode) — works only when app and host are same-site\n/// (e.g. `*.apps.lavit.re` ↔ `app.lavit.re`) and Chromium.\nexport type ShareStreamTrack = {\n kind: TrackKind\n readable: ReadableStream\n settings?: MediaTrackSettings\n}\n\nexport type ShareStreamOptions = {\n /** Display label for the share (defaults to the app name). */\n name?: string\n /** Source resolution hint, used by the host to size the share. */\n width?: number\n height?: number\n /**\n * Controls how remote peers render this shared stream.\n *\n * - `'appFrame'` (default when absent): receivers load the app iframe, exactly\n * as before this field existed. N-1 receivers that do not know this field\n * will behave as `'appFrame'` automatically (backward-compatible).\n * - `'standard'`: receivers render a classic shared-video languette without\n * loading the app iframe. Use when the app provides raw video/audio and the\n * frame UI is not meaningful on the receiver side (e.g. a camera feed).\n */\n receiverDisplay?: 'standard' | 'appFrame'\n}\n\nexport type ShareStream = {\n requestId: string\n sharedStreamId: string\n options?: ShareStreamOptions\n tracks: ShareStreamTrack[]\n}\n\n/// Swap the source track(s) of an already-open app share WITHOUT closing it.\n/// The host swaps the underlying track in place (sender.replaceTrack on the\n/// vitre→peer side, no renegotiation), so peers see continuity.\nexport type ReplaceShareStream = {\n requestId: string\n sharedStreamId: string\n tracks: ShareStreamTrack[]\n}\n\nexport type StopShareStream = {\n sharedStreamId: string\n}\n\nexport type ShareStreamCompleted = {\n requestId: string\n sharedStreamId: string\n error?: string\n}\n\nexport type OpenStreamFrameCompleted = {\n requestId: string\n error?: string\n tracks?: MediaTrackInfo[]\n streamSourceUrl?: string\n}\n\nexport type EnumerateMediaDevicesCompleted = {\n requestId: string\n devices: ConnectedMediaDevice[]\n}\n\nexport type FramePositionUpdated = {\n frameConnectorId: string\n} & PositionUpdated\n\nexport type ExternalMessageReceived = {\n requestId: string\n appId: string\n message: any\n apiKeyId: string\n apiKeyName: string\n}\n\nexport type ExternalMessageResponseData = {\n requestId: string\n response?: any\n}\n\nexport type RequestAppTokenData = {\n requestId: string\n}\n\nexport type AppTokenReceivedData = {\n requestId: string\n token?: string\n error?: string\n}\n\nexport type ExecuteInFrameData = {\n requestId: string\n /** Must match the `name` attribute of the <iframe> embedded in frame.html. */\n frameName: string\n /** Runs as a function body — use `return <expr>` to yield a value. */\n code: string\n}\n\nexport type ExecuteInFrameResultData = {\n requestId: string\n /** JSON string of the injected code's return value; absent on error. */\n result?: string\n error?: string\n}\n\nexport type SetFrameSize = {\n frameId: string\n size: Size\n}\n\n/// Inbound to a Vitre `Connector` from a companion-side\n/// `CompanionConnector` (same `appId`). `fromCompanionId` is the\n/// connection-id of the sending companion so the Vitre connector can reply\n/// targeted-back via `sendMessageToCompanionConnector`.\nexport type MessageFromCompanionConnector = {\n fromCompanionId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a companion FRAME sent a message via\n/// `CompanionFrame.sendMessageToVitreConnector` (works for a local companion\n/// frame with no paired Vitre frame). Carries the `frameConnectorId` of the\n/// companion frame that spoke, on top of the connector-message shape.\nexport type MessageFromCompanionFrame = {\n fromCompanionId: string\n frameConnectorId: string\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a Vitre `Connector` when a connected companion clicks a\n/// menu entry that lives on a frame's options menu AND was declared with\n/// `availability: 'companion'` (or `'companionAdmin'`). The click did NOT\n/// fire on the Vitre — it fired on the companion-side render of the\n/// frame's options. The Vitre-side connector receives this so the app\n/// can react (typically: call `openCompanionFrame` from the companion's\n/// main connector, or push state into the frame). Distinct from\n/// `menuClicked` so apps that only care about Vitre-side menu clicks\n/// don't get woken up by companion clicks.\n///\n/// `frameConnectorId` is the id of the frame whose options menu was\n/// clicked; `fromCompanionId` is the connection-id of the clicker so\n/// targeted reactions are possible.\nexport type FrameMenuClickedOnCompanion = {\n frameConnectorId: string\n fromCompanionId: string\n menuId: string\n isChecked: boolean\n tag?: any\n}\n\n/// Target for `sendMessageToCompanionConnector` — broadcast to every\n/// companion currently connected to the Vitre, or address a single\n/// companion by id. Discriminated on `kind` so the union is unambiguous\n/// for callers and for the host that routes on this shape (a structural\n/// `{ all: true } | { companionId }` would let `{ all: true, companionId }`\n/// slip past the type system via an intermediate variable).\nexport type CompanionConnectorTarget =\n | { kind: 'all' }\n | { kind: 'one'; companionId: string }\n\n/// Payload emitted by a Vitre `Connector` when it wants to talk to the\n/// companion-side `CompanionConnector` for the same `appId`.\nexport type SendMessageToCompanionConnector = {\n target: CompanionConnectorTarget\n message: string\n fileData?: FileData\n}\n\nexport type ConnectorApiMessagesIn =\n | ({ type: 'devicePrivacyChanged' } & DevicePrivacyChanged)\n | ({ type: 'initialize' } & InitializeConnector)\n | ({ type: 'deviceJoined' } & DeviceJoined)\n | ({ type: 'deviceLeft' } & DeviceLeft)\n | ({ type: 'deviceMessageReceived' } & DeviceMessageReceived)\n | ({ type: 'deviceFullscreenUpdated' } & DeviceFullscreenUpdated)\n | ({ type: 'menuClicked' } & MenuClicked)\n | ({ type: 'fieldUpdated' } & FieldUpdated)\n | ({ type: 'shareDataReceived' } & ShareDataReceived)\n | ({ type: 'fileShareDataReceived' } & FileShareDataReceived)\n | ({ type: 'frameLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoaded' } & FrameInfo)\n | ({ type: 'frameConnectorLoading' } & OpenFrame)\n | ({ type: 'privacyChanged' } & PrivacyChanged)\n | ({ type: 'frameUnloaded' } & FrameUnloaded)\n | ({\n type: 'enumerateMediaDevicesCompleted'\n } & EnumerateMediaDevicesCompleted)\n | ({ type: 'openStreamCompleted' } & OpenStreamCompleted)\n | ({ type: 'openStreamFrameCompleted' } & OpenStreamFrameCompleted)\n | ({ type: 'shareStreamCompleted' } & ShareStreamCompleted)\n | ({\n type: 'enumerateLoadedFramesCompleted'\n } & EnumerateLoadedFramesCompleted)\n | ({ type: 'localConnectorMessageReceived' } & LocalConnectorMessageReceived)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'vitreSettingsResponse' } & VitreSettings)\n | ({ type: 'knockKnockReceived' } & KnockKnock)\n | ({ type: 'settingsUpdated' } & SettingsUpdated)\n | ({ type: 'vitreSettingsUpdated' } & VitreSettings)\n | ({ type: 'notificationDismissed' } & NotificationDismissed)\n | ({ type: 'notificationButtonClicked' } & NotificationButtonClicked)\n | ({ type: 'frameZIndexChanged' } & FrameInfo)\n | ({ type: 'deviceFrameLoaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameUnloaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameConnectorLoaded' } & DeviceFrameReference)\n | ({ type: 'pendingDevicesConnectionRequested' } & PendingDevicesInfo)\n | ({ type: 'appMessage' } & AppMessage)\n | ({ type: 'voiceActionDetected' } & VoiceActionDetection)\n | ({ type: 'framePositionUpdated' } & FramePositionUpdated)\n | ({ type: 'deviceScalingUpdated' } & DeviceScalingUpdated)\n | ({ type: 'stateReplaced' } & StateReplaced)\n | ({ type: 'statsResponse' } & StatsResponse)\n | ({ type: 'serialPortAccessResult'; requestId: string } & SerialPortAccessResult)\n | ({ type: 'frameOwnerChanged' } & FrameOwnerChanged)\n | ({ type: 'connectionCodeUpdated' } & ConnectionCodeUpdated)\n | ({ type: 'externalMessageReceived' } & ExternalMessageReceived)\n | ({ type: 'appTokenReceived' } & AppTokenReceivedData)\n | ({ type: 'executeInFrameResult' } & ExecuteInFrameResultData)\n | ({ type: 'mediaDevicesChanged' } & MediaDevicesChanged)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'messageFromCompanionConnector'\n } & MessageFromCompanionConnector)\n | ({\n type: 'messageFromCompanionFrame'\n } & MessageFromCompanionFrame)\n | ({\n type: 'frameMenuClickedOnCompanion'\n } & FrameMenuClickedOnCompanion)\n\nexport type MediaDevicesChanged = {\n devices: ConnectedMediaDevice[]\n}\n\nexport type ConnectorApiMessagesOut =\n | ({ type: 'sendMessageTo' } & SendMessageTo)\n | ({ type: 'sendMessageToAll' } & SendMessageToAll)\n | ({ type: 'connectorInitialized' } & ConnectorInitialized)\n | ({ type: 'openFrame' } & OpenFrame)\n | ({ type: 'openLocalFrame' } & OpenLocalFrame)\n | ({ type: 'sendToLocalFrame' } & SendToLocalFrame)\n | ({ type: 'enumerateMediaDevices' } & EnumerateMediaDevices)\n | ({ type: 'openStream' } & OpenStream)\n | ({ type: 'openStreamFrame' } & OpenStreamFrame)\n | ({ type: 'shareStream' } & ShareStream)\n | ({ type: 'replaceShareStream' } & ReplaceShareStream)\n | ({ type: 'stopShareStream' } & StopShareStream)\n | ({ type: 'setRootMenu' } & SetRootMenu)\n | ({ type: 'enumerateLoadedFrames' } & EnumerateLoadedFrames)\n | ({ type: 'setShareTarget' } & SetShareTarget)\n | ({ type: 'setShareTargets' } & SetShareTargets)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'appMessage' } & AppMessage)\n | { type: 'getVitreSettings' }\n | ({ type: 'setVitreSettings' } & VitreSettingsSetter)\n | ({ type: 'shareFile' } & ShareFileRequest)\n | ({ type: 'shareData' } & ShareDataRequest)\n | ({ type: 'saveSettings' } & SaveSettings)\n | ({ type: 'changeTeamSpace' } & ChangeTeamSpace)\n | ({ type: 'changeTeamSpaceGuest' } & ChangeTeamSpaceGuest)\n | ({ type: 'showNotification' } & NotificationInfo)\n | ({ type: 'hideNotification' } & HideNotification)\n | ({ type: 'changePrivacy' } & ChangePrivacy)\n | ({ type: 'trackEvent' } & EventTelemetry)\n | ({ type: 'startTrackEvent' } & StartEventTelemetry)\n | ({ type: 'stopTrackEvent' } & EventTelemetry)\n | ({ type: 'setSettingsSchema' } & SettingsSchema)\n | { type: 'setVoiceActions'; actions: VoiceAction[] }\n | ({ type: 'closeFrame' } & CloseFrame)\n | ({ type: 'setFrameOwner' } & SetFrameOwner)\n | ({ type: 'setChromeStyle' } & SetChromeStyle)\n | ({ type: 'setFramePosition' } & SetFramePosition)\n | ({ type: 'updateState' } & UpdateState)\n | ({ type: 'sendKnockKnock' } & SendKnockKnock)\n | ({ type: 'getStats' } & GetStats)\n | ({ type: 'setReducedAudioMode' } & SetReducedAudioMode)\n | ({ type: 'externalMessageResponse' } & ExternalMessageResponseData)\n | ({ type: 'requestAppToken' } & RequestAppTokenData)\n | ({ type: 'executeInFrame' } & ExecuteInFrameData)\n | ({ type: 'setFrameSize' } & SetFrameSize)\n | ({ type: 'sendToSerialPort' } & SendToSerialPort)\n | ({ type: 'requestSerialPortAccess'; requestId: string } & RequestSerialPortAccess)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({\n type: 'sendMessageToCompanionConnector'\n } & SendMessageToCompanionConnector)\n"]}
@@ -0,0 +1,227 @@
1
+ import type * as Y from 'yjs';
2
+ import { CrdtChannel } from '../Common/CrdtChannel.js';
3
+ import { BlobStore } from '../Common/BlobStore.js';
4
+ import type { AppId, AppMessage, ChromeStyle, ConnectedMediaDevice, Device, DeviceFrameReference, DeviceFullscreenUpdated, DeviceMessageReceived, DeviceScalingUpdated, Field, FileData, HostInformation, KnockKnock, LayoutPosition, MessageTarget, NotificationButtonClicked, NotificationInfo, OpenFrameOptions, Privacy, ReplacedBy, RequestSerialPortAccess, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToSerialPort, Size, StatsResponse, UpdatedStateEntry, UpdateStateEntry, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
5
+ import type { Frame } from '../Frame/index.js';
6
+ import type { CompanionConnectorTarget, ExternalMessageReceived, ConnectorApiMessagesIn, ConnectorApiMessagesOut, ConnectorOptions, FrameInfo, FramePositionUpdated, InitializeConnector, MediaTrackInfo, OpenStreamFrame, RootMenuEntry, SettingsSchema, ShareData, ShareStreamOptions, ShareTargetOptions } from './Connector.Model.js';
7
+ export declare class Connector {
8
+ private readonly postMessage;
9
+ options: ConnectorOptions;
10
+ onDeviceJoined?: (device: Device) => void;
11
+ onDeviceLeft?: (deviceId: string) => void;
12
+ onDeviceMessageReceived?: (message: DeviceMessageReceived) => void;
13
+ onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void;
14
+ onFieldUpdated?: (field: Field) => void;
15
+ onFrameConnectorLoading?: (options: OpenFrameOptions) => void;
16
+ onShareDataReceived?: (shareData: ShareData) => void;
17
+ onShareFileReceived?: (shareData: FileData) => void;
18
+ onFrameLoaded?: (frameConnectorId: string) => void;
19
+ onFrameConnectorLoaded?: (frameConnectorId: string) => void;
20
+ onFrameUnloaded?: (frameConnectorId: string) => void;
21
+ onLocalConnectorMessageReceived?: (message: any, from?: string, fileData?: FileData) => void;
22
+ onPrivacyChanged?: (privacy: Privacy) => void;
23
+ /** @deprecated Use onEmbedMessage */
24
+ onExtensionMessage?: (extensionMessage: AppMessage) => void;
25
+ /** @deprecated Use onEmbedMessage */
26
+ onAppMessage?: (appMessage: AppMessage) => void;
27
+ onEmbedMessage?: (embedMessage: AppMessage) => void;
28
+ onKnockKnockReceived?: (knockKnock: KnockKnock) => void;
29
+ onPendingDevicesConnectionRequested?: (pendingClients: Device[]) => void;
30
+ onSettingsUpdated?: (settings: any) => void;
31
+ onVitreSettingsUpdated?: (settings: VitreSettings) => void;
32
+ onConnectionCodeUpdated?: (companionCode?: string) => void;
33
+ onNotificationDismissed?: (notificationId: string) => void;
34
+ onNotificationButtonClicked?: (notificationButton: NotificationButtonClicked) => void;
35
+ onDevicePrivacyChanged?: (device: Device) => void;
36
+ onFrameZIndexChanged?: (frameInfo: FrameInfo) => void;
37
+ onDeviceFrameLoaded?: (deviceFrameReference: DeviceFrameReference) => void;
38
+ onDeviceFrameConnectorLoaded?: (deviceFrameReference: DeviceFrameReference) => void;
39
+ onDeviceFrameUnloaded?: (deviceFrameReference: DeviceFrameReference) => void;
40
+ onMessageReceived?: (msg: ConnectorApiMessagesIn) => void;
41
+ onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void;
42
+ onDeviceFullscreenUpdated?: (msg: DeviceFullscreenUpdated) => void;
43
+ onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void;
44
+ onFramePositionUpdated?: (msg: FramePositionUpdated) => void;
45
+ onStateReplaced?: (newState: Record<string, any>, oldState: Record<string, any>, replacedBy: ReplacedBy, delta: UpdatedStateEntry[]) => void;
46
+ onExternalMessageReceived?: (msg: ExternalMessageReceived) => any | Promise<any> | void;
47
+ onAppTokenRefreshed?: (token: string) => void;
48
+ onMediaDevicesChanged?: (devices: ConnectedMediaDevice[]) => void;
49
+ onFrameOwnerChanged?: (frameConnectorId: string, owner: string) => void;
50
+ onMessageFromCompanionConnector?: (fromCompanionId: string, message: string, fileData?: FileData) => void;
51
+ onMessageFromCompanionFrame?: (fromCompanionId: string, frameConnectorId: string, message: string, fileData?: FileData) => void;
52
+ onFrameMenuClickedOnCompanion?: (frameConnectorId: string, fromCompanionId: string, menuId: string, isChecked: boolean, tag: any) => void;
53
+ /** @deprecated Use `crdt.onSynced` */
54
+ onYjsSynced?: () => void;
55
+ /** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */
56
+ onYjsUpdate?: (update: Uint8Array) => void;
57
+ appId: string;
58
+ hostInformation: HostInformation;
59
+ openedFrames: FrameInfo[];
60
+ state: Record<string, any>;
61
+ appToken: string | null;
62
+ private appTokenRefreshTimer;
63
+ /**
64
+ * CRDT channel — Yjs doc + Awareness piped over the la Vitre transport.
65
+ * Libraries (Carbone, …) can call `crdt.attach(doc, awareness)` to bring
66
+ * their own; simple apps use `crdt.doc` / `crdt.awareness` directly.
67
+ */
68
+ readonly crdt: CrdtChannel;
69
+ /**
70
+ * CRDT-backed blob store built on `crdt.attachSubdoc`. `put` / `get` /
71
+ * `list` / `onProgress` for heavy binaries (images, PDFs, 3D, …) that
72
+ * must be retrievable by anyone joining the doc, even late. Opinionated
73
+ * but bare — see BlobStore.
74
+ */
75
+ readonly blobs: BlobStore;
76
+ /** @deprecated Use `crdt.doc`. The setter forwards to `crdt.attach(doc)`
77
+ * so legacy callers that ever assigned `connector.yjsDoc = myDoc` keep
78
+ * working — without it, getter-only would throw `TypeError: Cannot set
79
+ * property yjsDoc which has only a getter` under strict mode / ESM. */
80
+ get yjsDoc(): Y.Doc;
81
+ set yjsDoc(doc: Y.Doc);
82
+ constructor(postMessage: (message: ConnectorApiMessagesOut, transfer?: Transferable[]) => void, initMessage: InitializeConnector, options: ConnectorOptions);
83
+ private resolveRequest;
84
+ raiseMessage(msg: ConnectorApiMessagesIn): void;
85
+ private _onStateReplaced;
86
+ private _onExternalMessageReceived;
87
+ requestAppToken(): Promise<string>;
88
+ /**
89
+ * Run JavaScript inside a (cross-origin) child iframe this app embeds in its
90
+ * frame.html, and resolve with the JSON-parsed return value.
91
+ *
92
+ * The iframe must carry a `name` attribute (e.g. `<iframe name="my-target">`)
93
+ * matching `frameName`. `code` runs as a function body — use `return <expr>` to
94
+ * produce a value (any JSON-serializable value round-trips; `undefined` → `null`).
95
+ *
96
+ * Requires the `injectScriptIntoFrame` app authorization and the native (CEF)
97
+ * host (rejects on a web host). The host also restricts the target to this app's
98
+ * own frame subtree.
99
+ */
100
+ executeInFrame<T = unknown>(frameName: string, code: string): Promise<T>;
101
+ startAppTokenRefresh(intervalMs?: number): void;
102
+ stopAppTokenRefresh(): void;
103
+ /** Release the resources owned by this connector. Stops the app-token
104
+ * refresh timer and tears the CRDT channel down (unbinds doc/awareness
105
+ * listeners, destroys the default Y.Doc + Awareness). Safe to call
106
+ * multiple times. */
107
+ destroy(): void;
108
+ updateState(updates: UpdateStateEntry[], forceApplyLocally?: boolean): void;
109
+ private requestResolvers;
110
+ private postRequest;
111
+ requestStats(): Promise<StatsResponse>;
112
+ requestEnumerateDevices(): Promise<ConnectedMediaDevice[]>;
113
+ requestOpenStream(streamId: string, constraints: MediaStreamConstraints): Promise<MediaTrackInfo[]>;
114
+ private convertConstraintsToVitreConstraints;
115
+ requestOpenStreamFrame(openStreamFrame: Omit<OpenStreamFrame, 'requestId'>): Promise<MediaTrackInfo[]>;
116
+ /**
117
+ * Whether {@link shareStream} is available in this runtime. Requires the
118
+ * MediaStreamTrack Insertable Streams API (Chromium-only) and the app being
119
+ * served same-site as the Vitre host (so the transferred stream survives the
120
+ * iframe boundary zero-copy). Apps should feature-detect before offering a
121
+ * share action.
122
+ */
123
+ canShareStream(): boolean;
124
+ private toShareTracks;
125
+ /**
126
+ * Share a camera/microphone (or any) `MediaStream` the app controls TO the
127
+ * Vitre, which forwards it to the other peers in the space like a regular
128
+ * shared stream. The stream is handed over zero-copy (no re-encode) via the
129
+ * breakout box; the app keeps ownership of its tracks and can stop them
130
+ * independently.
131
+ *
132
+ * Returns a `sharedStreamId` to pass to {@link replaceShareStream} /
133
+ * {@link stopShareStream}. Throws if {@link canShareStream} is false.
134
+ */
135
+ shareStream(stream: MediaStream, options?: ShareStreamOptions): Promise<string>;
136
+ /**
137
+ * Swap the source of an open share WITHOUT closing it (e.g. switch camera,
138
+ * or camera→screen). Peers keep receiving on the same slot with no
139
+ * renegotiation blip. `sharedStreamId` is the value returned by
140
+ * {@link shareStream}.
141
+ */
142
+ replaceShareStream(sharedStreamId: string, streamOrTrack: MediaStream | MediaStreamTrack): Promise<void>;
143
+ /** Stop an app share. `sharedStreamId` is the value returned by {@link shareStream}. */
144
+ stopShareStream(sharedStreamId: string): void;
145
+ getFrame(frameConnectorId: string): Window | null;
146
+ getFrameConnector(frameConnector: string): Frame | null;
147
+ openFrame(frameOptions: OpenFrameOptions): Promise<FrameInfo>;
148
+ openLocalFrame(frameOptions: OpenFrameOptions): Promise<FrameInfo>;
149
+ sendMessageTo(message: SendMessageTo): void;
150
+ sendMessageToAll(message: SendMessageToAll): void;
151
+ sendKnockKnock(message: SendKnockKnock): void;
152
+ sendToLocalFrame(frameConnectorId: string, data: any, fileData?: FileData): void;
153
+ setMenu(menu: RootMenuEntry[]): void;
154
+ /**
155
+ * @deprecated Use sendAppMessage on vitre v18
156
+ */
157
+ sendExtensionMessage(data: any, target: MessageTarget, fileData?: FileData): void;
158
+ /** @deprecated Use sendMessageToEmbed */
159
+ sendAppMessage(data: any, target: MessageTarget, fileData?: FileData): void;
160
+ sendMessageToEmbed(data: any, target: MessageTarget, fileData?: FileData): void;
161
+ requestVitreSettings(): Promise<VitreSettings>;
162
+ setVitreSettings(setters: VitreSettingsSetter): void;
163
+ /**
164
+ * Share a URL/data with the host, which routes it to a matching app.
165
+ * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to
166
+ * attribute the resulting shared content to. The owner drives the languette
167
+ * colour/info and the content appears already-owned on every vitre. When
168
+ * omitted the share is owned by the opener (default).
169
+ */
170
+ shareData(url: string, targetAppId?: AppId, owner?: string): void;
171
+ /**
172
+ * Share a file with the host, which routes it to a matching app.
173
+ * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to
174
+ * attribute the resulting shared content to. See {@link shareData}.
175
+ */
176
+ shareFile(fileData: FileData, targetAppId: AppId, owner?: string): void;
177
+ saveSettings(settings: any): void;
178
+ changeTeamSpace(space: string): void;
179
+ changeTeamSpaceGuest(space: string, teamDomain: string): void;
180
+ showNotification(notification: NotificationInfo): void;
181
+ hideNotification(notificationId: string): void;
182
+ changePrivacy(privacy: Privacy): void;
183
+ trackEvent(name: string, properties?: Record<string, any>): void;
184
+ startTrackEvent(name: string): void;
185
+ stopTrackEvent(name: string, properties?: Record<string, any>): void;
186
+ setSettingsSchema(schema: SettingsSchema): void;
187
+ /**
188
+ * Update the app's share target at any time. The new share target replaces
189
+ * the one provided at initialization (ConnectorOptions.shareTarget) and is
190
+ * applied immediately by the host. Can be called repeatedly.
191
+ *
192
+ * @deprecated Use `setShareTargets` to advertise one or more share targets.
193
+ */
194
+ setShareTarget(shareTarget: ShareTargetOptions): void;
195
+ /**
196
+ * Update the app's share targets at any time. The new array replaces the ones
197
+ * provided at initialization (ConnectorOptions.shareTargets) and is applied
198
+ * immediately by the host. Can be called repeatedly.
199
+ */
200
+ setShareTargets(shareTargets: ShareTargetOptions[]): void;
201
+ setVoiceActions(actions: VoiceAction[]): void;
202
+ setFramePosition(frameConnectorId: string, position: LayoutPosition): void;
203
+ closeFrame(frameConnectorId: string): void;
204
+ /**
205
+ * Reassign the owner of an already-opened shared frame. `owner` is a
206
+ * device id from `HostInformation.devicesInSpace[].id`. The new owner
207
+ * drives the languette colour, and when it is a Vitre it takes over
208
+ * hosting the frame so it survives the opener disconnecting.
209
+ */
210
+ setFrameOwner(frameConnectorId: string, owner: string): void;
211
+ /**
212
+ * Update the visual style of an already-open frame's shared content at any
213
+ * time — the same surface styling and companion icon that
214
+ * `OpenFrameOptions` sets at open time, but applied live. Only the fields you
215
+ * pass change; omitted fields keep their current value. Pass an empty string
216
+ * to clear an override back to the host default (e.g. `{ background: '' }`).
217
+ * The host re-renders the surface on this Vitre, on peer Vitres / tableaux
218
+ * showing the frame, and re-propagates the icon to connected companions.
219
+ */
220
+ setChromeStyle(frameConnectorId: string, style: ChromeStyle): void;
221
+ setReducedAudioMode(enabled: boolean): void;
222
+ setFrameSize(frameId: string, size: Size): void;
223
+ sendToSerialPort(serialPort: SendToSerialPort): void;
224
+ requestSerialPortAccess(request?: RequestSerialPortAccess): Promise<string>;
225
+ sendMessageToCompanionConnector(target: CompanionConnectorTarget, message: string, fileData?: FileData): void;
226
+ }
227
+ export declare function initializeConnector<T extends Connector>(init: (info: HostInformation) => ConnectorOptions, createConnector?: new (postMessage: (message: ConnectorApiMessagesOut, transfer?: Transferable[] | undefined) => void, initializeMessage: InitializeConnector, options: ConnectorOptions) => T): Promise<T>;