@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,100 @@
1
+ import { Frame, initializeFrame } from '../Frame/Frame.js';
2
+ /**
3
+ * Runtime class for a frame iframe loaded by the la Vitre **companion**.
4
+ * Extends the shared `Frame` runtime (same wire, same lifecycle) with the two
5
+ * send methods that ONLY make sense — and are ONLY decoded by the host — on the
6
+ * companion side:
7
+ *
8
+ * - `sendMessageToVitreConnector` → host message `sendToVitreConnector`, which
9
+ * the companion host relays to the app's Vitre-side main `Connector`
10
+ * (`onMessageFromCompanionFrame`).
11
+ * - `closeOnCompanion` → host message `closeOnCompanion` (local companion
12
+ * close; the Vitre keeps its own frame).
13
+ *
14
+ * Both live HERE, not on `Frame`: the Vitre host does NOT decode those message
15
+ * types, so calling them from a Vitre frame produced a "case type not found"
16
+ * parse error on the Vitre. Keeping them off `Frame` makes that misuse a
17
+ * compile error. A Vitre frame that needs to reach its own connector uses
18
+ * `sendToLocalMainConnector` instead.
19
+ */
20
+ class CompanionFrameImpl extends Frame {
21
+ /**
22
+ * Send a message straight to this app's Vitre-side main `Connector` — even
23
+ * when there is NO paired Vitre frame (a local companion frame). The Vitre
24
+ * connector receives it on `onMessageFromCompanionFrame(fromCompanionId,
25
+ * frameConnectorId, message, fileData)`, `frameConnectorId` set to this
26
+ * frame's id so the app can tell which companion frame spoke. Frame-side
27
+ * counterpart of `CompanionConnector.sendMessageToVitreConnector` (which has
28
+ * no frame id).
29
+ */
30
+ sendMessageToVitreConnector(message, fileData) {
31
+ this.postMessage({
32
+ type: 'sendToVitreConnector',
33
+ frameConnectorId: this.id,
34
+ message,
35
+ fileData,
36
+ });
37
+ }
38
+ /**
39
+ * Close the iframe locally on the companion and remove this companion from
40
+ * the per-frame `framePresence` on the Vitre. The Vitre keeps its own frame
41
+ * open (`openFrame` re-shows the same frame); use `close()` to close globally.
42
+ * See `FrameApiMessagesOut`'s `closeOnCompanion` arm doc for the rationale.
43
+ */
44
+ closeOnCompanion() {
45
+ this.postMessage({
46
+ type: 'closeOnCompanion',
47
+ });
48
+ }
49
+ }
50
+ /**
51
+ * Mirror of `initializeFrame` for the companion side. Same wire-level
52
+ * handshake (`connectorInitializationRequest` posted with a MessageChannel
53
+ * `port2` transferred to the parent) — the companion host's behaviour is
54
+ * identical to the Vitre's at that protocol point (see
55
+ * `lavitre-companion/.../CompanionApps.State.fs:postFrameInit`). It instantiates
56
+ * the companion runtime subclass `CompanionFrameImpl`, so the returned
57
+ * `CompanionFrame` carries the companion-only send methods; existing helpers
58
+ * like `createVitreSyncAdapter` keep working (they only touch `frame.crdt`).
59
+ *
60
+ * Usage:
61
+ * const frame = await initializeCompanionFrame((host, initiator, opts) => ({
62
+ * name: 'My App',
63
+ * allowFullscreen: true,
64
+ * }))
65
+ * frame.sendToVitreFrame({ kind: 'hello', from: 'companion' })
66
+ * frame.closeOnCompanion()
67
+ */
68
+ export async function initializeCompanionFrame(init) {
69
+ // Instantiate the companion runtime subclass. The wire protocol is identical
70
+ // to the Vitre side at the `connectorInitializationRequest` boundary, so the
71
+ // host (Vitre or companion) routes by its own context; the subclass just adds
72
+ // the companion-only send methods to the surface.
73
+ return await initializeFrame(init, CompanionFrameImpl);
74
+ }
75
+ /**
76
+ * Convenience guard for apps that ship a single `frame.tsx` entry but want to
77
+ * branch behaviour based on context. Reads the dedicated
78
+ * `hostInformation.isCompanion` flag set by `lavitre-companion`
79
+ * (CompanionApps.State.fs:buildVitreLikeHostInformation). Old hosts that
80
+ * predate the flag omit it, in which case we conservatively return `false` and
81
+ * the caller behaves as on a Vitre — the safer default since the Vitre surface
82
+ * is the superset.
83
+ *
84
+ * Note: to USE the companion-only send methods (`sendMessageToVitreConnector`,
85
+ * `closeOnCompanion`) you need a `CompanionFrame` from `initializeCompanionFrame`
86
+ * (ship a dedicated companion entry). This guard only narrows behaviour/UX, not
87
+ * the static type — a value from `initializeFrame` stays a Vitre `Frame`.
88
+ *
89
+ * Usage:
90
+ * const frame = await initializeFrame(init)
91
+ * if (isCompanionFrame(frame.hostInformation)) {
92
+ * // Apply companion-only UX (e.g. a "Leave this frame" button)
93
+ * } else {
94
+ * // Vitre surface: sendMessageTo / sendKnockKnock / setVitreSettings / …
95
+ * }
96
+ */
97
+ export function isCompanionFrame(hostInformation) {
98
+ return hostInformation.isCompanion === true;
99
+ }
100
+ //# sourceMappingURL=CompanionFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompanionFrame.js","sourceRoot":"","sources":["../../CompanionFrame/CompanionFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAI1D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,kBAAmB,SAAQ,KAAK;IACpC;;;;;;;;OAQG;IACI,2BAA2B,CAAC,OAAe,EAAE,QAAmB;QACrE,IAAI,CAAC,WAAW,CAAC;YACf,IAAI,EAAE,sBAAsB;YAC5B,gBAAgB,EAAE,IAAI,CAAC,EAAE;YACzB,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACI,gBAAgB;QACrB,IAAI,CAAC,WAAW,CAAC;YACf,IAAI,EAAE,kBAAkB;SACzB,CAAC,CAAA;IACJ,CAAC;CACF;AAqGD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,IAKgB;IAEhB,6EAA6E;IAC7E,6EAA6E;IAC7E,8EAA8E;IAC9E,kDAAkD;IAClD,OAAO,MAAM,eAAe,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,gBAAgB,CAAC,eAAgC;IAC/D,OAAO,eAAe,CAAC,WAAW,KAAK,IAAI,CAAA;AAC7C,CAAC","sourcesContent":["import { Frame, initializeFrame } from '../Frame/Frame.js'\nimport type { InitFrameOptions, ViewOptions } from '../Frame/Frame.Model.js'\nimport type { Device, FileData, HostInformation } from '../Common/index.js'\n\n/**\n * Runtime class for a frame iframe loaded by the la Vitre **companion**.\n * Extends the shared `Frame` runtime (same wire, same lifecycle) with the two\n * send methods that ONLY make sense — and are ONLY decoded by the host — on the\n * companion side:\n *\n * - `sendMessageToVitreConnector` → host message `sendToVitreConnector`, which\n * the companion host relays to the app's Vitre-side main `Connector`\n * (`onMessageFromCompanionFrame`).\n * - `closeOnCompanion` → host message `closeOnCompanion` (local companion\n * close; the Vitre keeps its own frame).\n *\n * Both live HERE, not on `Frame`: the Vitre host does NOT decode those message\n * types, so calling them from a Vitre frame produced a \"case type not found\"\n * parse error on the Vitre. Keeping them off `Frame` makes that misuse a\n * compile error. A Vitre frame that needs to reach its own connector uses\n * `sendToLocalMainConnector` instead.\n */\nclass CompanionFrameImpl extends Frame {\n /**\n * Send a message straight to this app's Vitre-side main `Connector` — even\n * when there is NO paired Vitre frame (a local companion frame). The Vitre\n * connector receives it on `onMessageFromCompanionFrame(fromCompanionId,\n * frameConnectorId, message, fileData)`, `frameConnectorId` set to this\n * frame's id so the app can tell which companion frame spoke. Frame-side\n * counterpart of `CompanionConnector.sendMessageToVitreConnector` (which has\n * no frame id).\n */\n public sendMessageToVitreConnector(message: string, fileData?: FileData) {\n this.postMessage({\n type: 'sendToVitreConnector',\n frameConnectorId: this.id,\n message,\n fileData,\n })\n }\n\n /**\n * Close the iframe locally on the companion and remove this companion from\n * the per-frame `framePresence` on the Vitre. The Vitre keeps its own frame\n * open (`openFrame` re-shows the same frame); use `close()` to close globally.\n * See `FrameApiMessagesOut`'s `closeOnCompanion` arm doc for the rationale.\n */\n public closeOnCompanion() {\n this.postMessage({\n type: 'closeOnCompanion',\n })\n }\n}\n\n/**\n * SDK surface intended for apps running inside a frame iframe loaded by the\n * la Vitre **companion** (not by a Vitre). Mirrors the `Connector` /\n * `CompanionConnector` split: a companion frame talks to its paired Vitre frame\n * and to its own host, but has no notion of other Vitres in the space — so the\n * broadcast-style send methods (`sendMessageTo`, `sendMessageToAll`,\n * `sendKnockKnock`) and the Vitre-only side effects (`setVitreSettings`,\n * `setShareTarget`, the device-event callbacks) are deliberately not exposed.\n * Conversely, the companion-only `sendMessageToVitreConnector` /\n * `closeOnCompanion` (see {@link CompanionFrameImpl}) are exposed HERE and\n * nowhere else — in particular NOT on the Vitre `Frame`.\n *\n * `crdt` flows through the la Vitre Yjs transport identical to the Vitre side —\n * the same Y.Doc and Awareness end up in sync on the Vitre frame, on other\n * companions of the same `(appId, frameId)` presence set, and on this\n * companion. Apps using carbone or any other Y-doc-backed library can keep\n * using `createVitreSyncAdapter(frame)` unchanged — the adapter only touches\n * `frame.crdt`.\n */\nexport type CompanionFrame = Pick<\n CompanionFrameImpl,\n // Identity\n | 'id'\n | 'appId'\n | 'options'\n | 'initOptions'\n | 'initiator'\n | 'hostInformation'\n | 'companionInformation'\n | 'state'\n\n // CRDT\n | 'crdt'\n | 'blobs'\n | 'yjsDoc'\n\n // Lifecycle and visual state\n | 'isFullscreen'\n | 'isBorderless'\n | 'position'\n | 'zIndex'\n | 'setFullscreen'\n | 'setWindowed'\n | 'setMenu'\n\n // Send to paired Vitre frame (the only useful peer for a companion frame)\n | 'sendToVitreFrame'\n\n // Companion-only: send straight to the app's Vitre-side main Connector —\n // works even with no paired Vitre frame (a local companion frame). Lands on\n // the Vitre connector's `onMessageFromCompanionFrame`.\n | 'sendMessageToVitreConnector'\n\n // Stream share — a companion frame (e.g. a camera page opened via\n // `openCompanionFrame`) can originate a MediaStream toward the Vitre. The\n // companion host forwards it over its Vitre P2P, tagged for this app; the\n // app's Vitre frame then receives it via `onSharedStream` (reverse\n // exposure), optionally transforms it, and reshares to the space. Same\n // runtime as the Vitre `Frame` — only surfaced here in the type.\n | 'canShareStream'\n | 'shareStream'\n | 'replaceShareStream'\n | 'stopShareStream'\n | 'attachStream'\n | 'detachStream'\n // ICE/TURN config the companion host already holds (from its `WebRTCOffer`)\n // — lets a companion-camera frame open its own RTCPeerConnection directly to\n // the paired Vitre transform frame, NAT-traversing via the same relays.\n | 'getIceServers'\n // Receive a stream the host exposes into this companion frame (symmetric\n // to the Vitre side; harmless if the host never pushes one).\n | 'onSharedStream'\n | 'onSharedStreamRemoved'\n\n // Close behaviours\n // - `close` is the existing GLOBAL close (kills the Vitre frame too —\n // the same as `connector.closeFrame(frameConnectorId)`). Keep it\n // exposed for the rare app that genuinely wants to close for\n // everyone from the companion side.\n | 'close'\n // - `closeOnCompanion` is the *local* close: companion's iframe\n // unmounts + companion is removed from the frame's `framePresence`\n // on the Vitre, but the Vitre keeps its own frame open. Equivalent\n // to the late-join state: `openFrame` will re-show the same frame.\n | 'closeOnCompanion'\n\n // Inbound surface — same as Frame but only the events that fire on a\n // companion frame are useful in practice. Apps wire whichever they\n // need; the unused callbacks stay `undefined`.\n | 'onLocalConnectorMessageReceived' // messages from the paired Vitre frame\n | 'onMessageReceived' // catch-all (every inbound type)\n | 'onMenuClicked'\n | 'onFieldUpdated'\n | 'onFullscreenChanged'\n | 'onBorderlessChanged'\n | 'onYjsSynced'\n | 'onYjsUpdate'\n>\n\n/**\n * Mirror of `initializeFrame` for the companion side. Same wire-level\n * handshake (`connectorInitializationRequest` posted with a MessageChannel\n * `port2` transferred to the parent) — the companion host's behaviour is\n * identical to the Vitre's at that protocol point (see\n * `lavitre-companion/.../CompanionApps.State.fs:postFrameInit`). It instantiates\n * the companion runtime subclass `CompanionFrameImpl`, so the returned\n * `CompanionFrame` carries the companion-only send methods; existing helpers\n * like `createVitreSyncAdapter` keep working (they only touch `frame.crdt`).\n *\n * Usage:\n * const frame = await initializeCompanionFrame((host, initiator, opts) => ({\n * name: 'My App',\n * allowFullscreen: true,\n * }))\n * frame.sendToVitreFrame({ kind: 'hello', from: 'companion' })\n * frame.closeOnCompanion()\n */\nexport async function initializeCompanionFrame(\n init: (\n info: HostInformation,\n initiator: Device,\n options: InitFrameOptions,\n state?: Record<string, any>,\n ) => ViewOptions,\n): Promise<CompanionFrame> {\n // Instantiate the companion runtime subclass. The wire protocol is identical\n // to the Vitre side at the `connectorInitializationRequest` boundary, so the\n // host (Vitre or companion) routes by its own context; the subclass just adds\n // the companion-only send methods to the surface.\n return await initializeFrame(init, CompanionFrameImpl)\n}\n\n/**\n * Convenience guard for apps that ship a single `frame.tsx` entry but want to\n * branch behaviour based on context. Reads the dedicated\n * `hostInformation.isCompanion` flag set by `lavitre-companion`\n * (CompanionApps.State.fs:buildVitreLikeHostInformation). Old hosts that\n * predate the flag omit it, in which case we conservatively return `false` and\n * the caller behaves as on a Vitre — the safer default since the Vitre surface\n * is the superset.\n *\n * Note: to USE the companion-only send methods (`sendMessageToVitreConnector`,\n * `closeOnCompanion`) you need a `CompanionFrame` from `initializeCompanionFrame`\n * (ship a dedicated companion entry). This guard only narrows behaviour/UX, not\n * the static type — a value from `initializeFrame` stays a Vitre `Frame`.\n *\n * Usage:\n * const frame = await initializeFrame(init)\n * if (isCompanionFrame(frame.hostInformation)) {\n * // Apply companion-only UX (e.g. a \"Leave this frame\" button)\n * } else {\n * // Vitre surface: sendMessageTo / sendKnockKnock / setVitreSettings / …\n * }\n */\nexport function isCompanionFrame(hostInformation: HostInformation): boolean {\n return hostInformation.isCompanion === true\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from './CompanionFrame.js';
@@ -0,0 +1,2 @@
1
+ export * from './CompanionFrame.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../CompanionFrame/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './CompanionFrame.js'\n"]}
@@ -0,0 +1,567 @@
1
+ import type { AppMessage, BorderOptions, ChangePrivacy, ChangeTeamSpace, ChangeTeamSpaceGuest, ChromeStyle, ConnectedMediaDevice, ConnectionCodeUpdated, DeviceFrameReference, DeviceFullscreenUpdated, DeviceJoined, DeviceLeft, DeviceMessageReceived, DevicePrivacyChanged, DeviceScalingUpdated, EnumerateLoadedFrames, EnumerateLoadedFramesCompleted, EventTelemetry, FieldUpdated, FileData, FramePrivacy, GetStats, HideNotification, HostInformation, Interaction, KnockKnock, LayoutPosition, LayoutPositionWithRules, LocalConnectorMessageReceived, MenuClicked, MenuEntry, MenuVisibility, NotificationButtonClicked, NotificationDismissed, NotificationInfo, OpenFrameOptions, PendingDevicesInfo, PositionType, PositionUpdated, PrivacyChanged, RequestSerialPortAccess, SerialPortAccessResult, ResizeMode, SaveSettings, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToLocalFrame, SendToSerialPort, SetReducedAudioMode, SettingsUpdated, ShareDataRequest, ShareFileRequest, Size, StartEventTelemetry, StateReplaced, StatsResponse, UpdateState, ViewMode, Visibility, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
2
+ export type InitializeConnector = {
3
+ hostInfo: HostInformation;
4
+ appId?: string;
5
+ state?: Record<string, any>;
6
+ };
7
+ export type RegExpDefinition = {
8
+ pattern: string;
9
+ options: string;
10
+ };
11
+ export type ShareTargetOptions = {
12
+ name?: string;
13
+ urlDomains?: string[];
14
+ urlRegex?: string[];
15
+ urlRegexWithOptions?: RegExpDefinition[];
16
+ files?: FileShareTarget[];
17
+ /**
18
+ * Icon shown for this share target in the companion import picker. A bitmap
19
+ * (full colour). May be a path relative to the connector URL — the host
20
+ * resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl` are
21
+ * set, the companion prefers `maskIconUrl`. When neither is set the picker
22
+ * falls back to the app icon (`ConnectorOptions.iconUrl`).
23
+ */
24
+ iconUrl?: string;
25
+ /**
26
+ * Monochrome mask icon for this share target, tinted by the companion theme
27
+ * (CSS `mask`). May be relative to the connector URL — resolved absolute by
28
+ * the host. Preferred over `iconUrl` when both are set.
29
+ */
30
+ maskIconUrl?: string;
31
+ };
32
+ export type FileShareTarget = {
33
+ fileExtension?: string;
34
+ fileExtensionRegex?: RegExpDefinition;
35
+ binaryHeader?: ArrayBufferLike;
36
+ mimeTypes?: string[];
37
+ tag?: any;
38
+ id: string;
39
+ };
40
+ export type MenuCategoryInfo = {
41
+ type: 'mainMenu';
42
+ label?: string;
43
+ description?: string;
44
+ order?: number;
45
+ };
46
+ export type SettingsMenuCategoryInfo = {
47
+ type: 'settingsMenu';
48
+ label?: string;
49
+ description?: string;
50
+ };
51
+ export type MainMenuQuickActions = {
52
+ type: 'mainMenuQuickActions';
53
+ label?: string;
54
+ description?: string;
55
+ order?: number;
56
+ };
57
+ export type ExportMenuCategory = {
58
+ type: 'exportMenu';
59
+ label?: string;
60
+ description?: string;
61
+ order?: number;
62
+ };
63
+ export type RootMenuCategory = {
64
+ type: 'desktopIcons';
65
+ } | MainMenuQuickActions | MenuCategoryInfo | SettingsMenuCategoryInfo | ExportMenuCategory;
66
+ export type RootMenuEntry = Omit<MenuEntry, 'category'> & {
67
+ category?: RootMenuCategory;
68
+ };
69
+ export type ConnectorOptions = {
70
+ name: string;
71
+ iconUrl?: string;
72
+ menu?: RootMenuEntry[];
73
+ /**
74
+ * @deprecated Use `shareTargets`. When `shareTargets` is set the host uses it
75
+ * and ignores this field. Kept on the wire for older Vitres that only read a
76
+ * single share target — the SDK mirrors `shareTargets[0]` here automatically.
77
+ */
78
+ shareTarget?: ShareTargetOptions;
79
+ /**
80
+ * Share targets advertised by this app. Several may be declared so an app can
81
+ * receive distinct kinds of content (each with its own `name`/matchers). When
82
+ * provided, this supersedes the deprecated singular `shareTarget`.
83
+ */
84
+ shareTargets?: ShareTargetOptions[];
85
+ settingsSchema?: any;
86
+ settingsSchemaUI?: any;
87
+ voiceActions?: VoiceAction[];
88
+ };
89
+ export type ConnectorInitialized = {
90
+ options: ConnectorOptions;
91
+ };
92
+ export type OpenFrame = {
93
+ options: OpenFrameOptions;
94
+ };
95
+ export type OpenLocalFrame = {
96
+ options: OpenFrameOptions;
97
+ };
98
+ export type EnumerateMediaDevices = {
99
+ requestId: string;
100
+ };
101
+ export type OpenStream = {
102
+ requestId: string;
103
+ streamId: string;
104
+ constraints: MediaStreamConstraints;
105
+ };
106
+ export type OpenStreamFrame = {
107
+ constraints?: MediaStreamConstraints;
108
+ streamSourceUrl?: string;
109
+ requestId: string;
110
+ frameConnectorId: string;
111
+ name: string;
112
+ url: string;
113
+ allowFullscreen?: boolean;
114
+ /**
115
+ * @deprecated Use menuVisibility property vitre v20
116
+ */
117
+ hideMenu?: boolean;
118
+ startPosition?: LayoutPosition;
119
+ startPositions?: LayoutPositionWithRules[];
120
+ interaction?: Interaction;
121
+ resizeMode?: ResizeMode;
122
+ mode?: ViewMode;
123
+ data?: any;
124
+ file?: FileData;
125
+ privacy?: FramePrivacy;
126
+ mirrorInitiatorStream?: boolean;
127
+ size?: Size;
128
+ minSize?: Size;
129
+ maxSize?: Size;
130
+ startInteractive?: boolean;
131
+ border?: BorderOptions;
132
+ positionType?: PositionType;
133
+ voiceActions?: VoiceAction[];
134
+ visibility?: Visibility;
135
+ menuVisibility?: MenuVisibility;
136
+ closable?: boolean;
137
+ closeLabel?: string;
138
+ };
139
+ export type SetRootMenu = {
140
+ menu: RootMenuEntry[];
141
+ };
142
+ export type SettingsSchema = {
143
+ schema: any;
144
+ schemaUI: any;
145
+ };
146
+ export type SetFramePosition = {
147
+ frameConnectorId: string;
148
+ position: LayoutPosition;
149
+ };
150
+ export type CloseFrame = {
151
+ frameConnectorId: string;
152
+ };
153
+ export type SetFrameOwner = {
154
+ frameConnectorId: string;
155
+ /** Device id of the new owner (HostInformation.devicesInSpace[].id). */
156
+ owner: string;
157
+ };
158
+ export type SetChromeStyle = {
159
+ frameConnectorId: string;
160
+ } & ChromeStyle;
161
+ export type FrameOwnerChanged = {
162
+ frameConnectorId: string;
163
+ owner: string;
164
+ };
165
+ /**
166
+ * @deprecated Use `SetShareTargets` (`setShareTargets`).
167
+ */
168
+ export type SetShareTarget = {
169
+ shareTarget: ShareTargetOptions;
170
+ };
171
+ export type SetShareTargets = {
172
+ shareTargets: ShareTargetOptions[];
173
+ };
174
+ export type FrameUnloaded = {
175
+ frameConnectorId: string;
176
+ };
177
+ export type FrameInfo = {
178
+ frameConnectorId: string;
179
+ zIndex: number;
180
+ };
181
+ export type ShareDataReceived = {
182
+ data: ShareData;
183
+ };
184
+ export type FileShareDataReceived = {
185
+ data: FileData;
186
+ };
187
+ export type ShareData = {
188
+ url: string;
189
+ };
190
+ export type TrackKind = 'audio' | 'video';
191
+ export type MediaTrackInfo = {
192
+ id: string;
193
+ kind: TrackKind;
194
+ deviceName: string;
195
+ capabilities: MediaTrackCapabilities;
196
+ settings: MediaTrackSettings;
197
+ };
198
+ export type OpenStreamCompleted = {
199
+ requestId: string;
200
+ streamId: string;
201
+ error?: string;
202
+ tracks?: MediaTrackInfo[];
203
+ };
204
+ export type ShareStreamTrack = {
205
+ kind: TrackKind;
206
+ readable: ReadableStream;
207
+ settings?: MediaTrackSettings;
208
+ };
209
+ export type ShareStreamOptions = {
210
+ /** Display label for the share (defaults to the app name). */
211
+ name?: string;
212
+ /** Source resolution hint, used by the host to size the share. */
213
+ width?: number;
214
+ height?: number;
215
+ /**
216
+ * Controls how remote peers render this shared stream.
217
+ *
218
+ * - `'appFrame'` (default when absent): receivers load the app iframe, exactly
219
+ * as before this field existed. N-1 receivers that do not know this field
220
+ * will behave as `'appFrame'` automatically (backward-compatible).
221
+ * - `'standard'`: receivers render a classic shared-video languette without
222
+ * loading the app iframe. Use when the app provides raw video/audio and the
223
+ * frame UI is not meaningful on the receiver side (e.g. a camera feed).
224
+ */
225
+ receiverDisplay?: 'standard' | 'appFrame';
226
+ };
227
+ export type ShareStream = {
228
+ requestId: string;
229
+ sharedStreamId: string;
230
+ options?: ShareStreamOptions;
231
+ tracks: ShareStreamTrack[];
232
+ };
233
+ export type ReplaceShareStream = {
234
+ requestId: string;
235
+ sharedStreamId: string;
236
+ tracks: ShareStreamTrack[];
237
+ };
238
+ export type StopShareStream = {
239
+ sharedStreamId: string;
240
+ };
241
+ export type ShareStreamCompleted = {
242
+ requestId: string;
243
+ sharedStreamId: string;
244
+ error?: string;
245
+ };
246
+ export type OpenStreamFrameCompleted = {
247
+ requestId: string;
248
+ error?: string;
249
+ tracks?: MediaTrackInfo[];
250
+ streamSourceUrl?: string;
251
+ };
252
+ export type EnumerateMediaDevicesCompleted = {
253
+ requestId: string;
254
+ devices: ConnectedMediaDevice[];
255
+ };
256
+ export type FramePositionUpdated = {
257
+ frameConnectorId: string;
258
+ } & PositionUpdated;
259
+ export type ExternalMessageReceived = {
260
+ requestId: string;
261
+ appId: string;
262
+ message: any;
263
+ apiKeyId: string;
264
+ apiKeyName: string;
265
+ };
266
+ export type ExternalMessageResponseData = {
267
+ requestId: string;
268
+ response?: any;
269
+ };
270
+ export type RequestAppTokenData = {
271
+ requestId: string;
272
+ };
273
+ export type AppTokenReceivedData = {
274
+ requestId: string;
275
+ token?: string;
276
+ error?: string;
277
+ };
278
+ export type ExecuteInFrameData = {
279
+ requestId: string;
280
+ /** Must match the `name` attribute of the <iframe> embedded in frame.html. */
281
+ frameName: string;
282
+ /** Runs as a function body — use `return <expr>` to yield a value. */
283
+ code: string;
284
+ };
285
+ export type ExecuteInFrameResultData = {
286
+ requestId: string;
287
+ /** JSON string of the injected code's return value; absent on error. */
288
+ result?: string;
289
+ error?: string;
290
+ };
291
+ export type SetFrameSize = {
292
+ frameId: string;
293
+ size: Size;
294
+ };
295
+ export type MessageFromCompanionConnector = {
296
+ fromCompanionId: string;
297
+ message: string;
298
+ fileData?: FileData;
299
+ };
300
+ export type MessageFromCompanionFrame = {
301
+ fromCompanionId: string;
302
+ frameConnectorId: string;
303
+ message: string;
304
+ fileData?: FileData;
305
+ };
306
+ export type FrameMenuClickedOnCompanion = {
307
+ frameConnectorId: string;
308
+ fromCompanionId: string;
309
+ menuId: string;
310
+ isChecked: boolean;
311
+ tag?: any;
312
+ };
313
+ export type CompanionConnectorTarget = {
314
+ kind: 'all';
315
+ } | {
316
+ kind: 'one';
317
+ companionId: string;
318
+ };
319
+ export type SendMessageToCompanionConnector = {
320
+ target: CompanionConnectorTarget;
321
+ message: string;
322
+ fileData?: FileData;
323
+ };
324
+ export type ConnectorApiMessagesIn = ({
325
+ type: 'devicePrivacyChanged';
326
+ } & DevicePrivacyChanged) | ({
327
+ type: 'initialize';
328
+ } & InitializeConnector) | ({
329
+ type: 'deviceJoined';
330
+ } & DeviceJoined) | ({
331
+ type: 'deviceLeft';
332
+ } & DeviceLeft) | ({
333
+ type: 'deviceMessageReceived';
334
+ } & DeviceMessageReceived) | ({
335
+ type: 'deviceFullscreenUpdated';
336
+ } & DeviceFullscreenUpdated) | ({
337
+ type: 'menuClicked';
338
+ } & MenuClicked) | ({
339
+ type: 'fieldUpdated';
340
+ } & FieldUpdated) | ({
341
+ type: 'shareDataReceived';
342
+ } & ShareDataReceived) | ({
343
+ type: 'fileShareDataReceived';
344
+ } & FileShareDataReceived) | ({
345
+ type: 'frameLoaded';
346
+ } & FrameInfo) | ({
347
+ type: 'frameConnectorLoaded';
348
+ } & FrameInfo) | ({
349
+ type: 'frameConnectorLoading';
350
+ } & OpenFrame) | ({
351
+ type: 'privacyChanged';
352
+ } & PrivacyChanged) | ({
353
+ type: 'frameUnloaded';
354
+ } & FrameUnloaded) | ({
355
+ type: 'enumerateMediaDevicesCompleted';
356
+ } & EnumerateMediaDevicesCompleted) | ({
357
+ type: 'openStreamCompleted';
358
+ } & OpenStreamCompleted) | ({
359
+ type: 'openStreamFrameCompleted';
360
+ } & OpenStreamFrameCompleted) | ({
361
+ type: 'shareStreamCompleted';
362
+ } & ShareStreamCompleted) | ({
363
+ type: 'enumerateLoadedFramesCompleted';
364
+ } & EnumerateLoadedFramesCompleted) | ({
365
+ type: 'localConnectorMessageReceived';
366
+ } & LocalConnectorMessageReceived) | ({
367
+ type: 'extensionMessage';
368
+ } & AppMessage) | ({
369
+ type: 'vitreSettingsResponse';
370
+ } & VitreSettings) | ({
371
+ type: 'knockKnockReceived';
372
+ } & KnockKnock) | ({
373
+ type: 'settingsUpdated';
374
+ } & SettingsUpdated) | ({
375
+ type: 'vitreSettingsUpdated';
376
+ } & VitreSettings) | ({
377
+ type: 'notificationDismissed';
378
+ } & NotificationDismissed) | ({
379
+ type: 'notificationButtonClicked';
380
+ } & NotificationButtonClicked) | ({
381
+ type: 'frameZIndexChanged';
382
+ } & FrameInfo) | ({
383
+ type: 'deviceFrameLoaded';
384
+ } & DeviceFrameReference) | ({
385
+ type: 'deviceFrameUnloaded';
386
+ } & DeviceFrameReference) | ({
387
+ type: 'deviceFrameConnectorLoaded';
388
+ } & DeviceFrameReference) | ({
389
+ type: 'pendingDevicesConnectionRequested';
390
+ } & PendingDevicesInfo) | ({
391
+ type: 'appMessage';
392
+ } & AppMessage) | ({
393
+ type: 'voiceActionDetected';
394
+ } & VoiceActionDetection) | ({
395
+ type: 'framePositionUpdated';
396
+ } & FramePositionUpdated) | ({
397
+ type: 'deviceScalingUpdated';
398
+ } & DeviceScalingUpdated) | ({
399
+ type: 'stateReplaced';
400
+ } & StateReplaced) | ({
401
+ type: 'statsResponse';
402
+ } & StatsResponse) | ({
403
+ type: 'serialPortAccessResult';
404
+ requestId: string;
405
+ } & SerialPortAccessResult) | ({
406
+ type: 'frameOwnerChanged';
407
+ } & FrameOwnerChanged) | ({
408
+ type: 'connectionCodeUpdated';
409
+ } & ConnectionCodeUpdated) | ({
410
+ type: 'externalMessageReceived';
411
+ } & ExternalMessageReceived) | ({
412
+ type: 'appTokenReceived';
413
+ } & AppTokenReceivedData) | ({
414
+ type: 'executeInFrameResult';
415
+ } & ExecuteInFrameResultData) | ({
416
+ type: 'mediaDevicesChanged';
417
+ } & MediaDevicesChanged) | {
418
+ type: 'crdtUpdate';
419
+ update: ArrayBufferLike;
420
+ } | {
421
+ type: 'crdtSyncComplete';
422
+ } | {
423
+ type: 'crdtRequestSync';
424
+ } | {
425
+ type: 'crdtAwarenessUpdate';
426
+ update: ArrayBufferLike;
427
+ } | {
428
+ type: 'crdtSubdocUpdate';
429
+ guid: string;
430
+ update: ArrayBufferLike;
431
+ } | {
432
+ type: 'crdtSubdocSyncComplete';
433
+ guid: string;
434
+ } | {
435
+ type: 'crdtSubdocTransferProgress';
436
+ guid: string;
437
+ receivedBytes: number;
438
+ totalBytes: number;
439
+ } | {
440
+ type: 'crdtSubdocRequestSync';
441
+ guid: string;
442
+ } | ({
443
+ type: 'messageFromCompanionConnector';
444
+ } & MessageFromCompanionConnector) | ({
445
+ type: 'messageFromCompanionFrame';
446
+ } & MessageFromCompanionFrame) | ({
447
+ type: 'frameMenuClickedOnCompanion';
448
+ } & FrameMenuClickedOnCompanion);
449
+ export type MediaDevicesChanged = {
450
+ devices: ConnectedMediaDevice[];
451
+ };
452
+ export type ConnectorApiMessagesOut = ({
453
+ type: 'sendMessageTo';
454
+ } & SendMessageTo) | ({
455
+ type: 'sendMessageToAll';
456
+ } & SendMessageToAll) | ({
457
+ type: 'connectorInitialized';
458
+ } & ConnectorInitialized) | ({
459
+ type: 'openFrame';
460
+ } & OpenFrame) | ({
461
+ type: 'openLocalFrame';
462
+ } & OpenLocalFrame) | ({
463
+ type: 'sendToLocalFrame';
464
+ } & SendToLocalFrame) | ({
465
+ type: 'enumerateMediaDevices';
466
+ } & EnumerateMediaDevices) | ({
467
+ type: 'openStream';
468
+ } & OpenStream) | ({
469
+ type: 'openStreamFrame';
470
+ } & OpenStreamFrame) | ({
471
+ type: 'shareStream';
472
+ } & ShareStream) | ({
473
+ type: 'replaceShareStream';
474
+ } & ReplaceShareStream) | ({
475
+ type: 'stopShareStream';
476
+ } & StopShareStream) | ({
477
+ type: 'setRootMenu';
478
+ } & SetRootMenu) | ({
479
+ type: 'enumerateLoadedFrames';
480
+ } & EnumerateLoadedFrames) | ({
481
+ type: 'setShareTarget';
482
+ } & SetShareTarget) | ({
483
+ type: 'setShareTargets';
484
+ } & SetShareTargets) | ({
485
+ type: 'extensionMessage';
486
+ } & AppMessage) | ({
487
+ type: 'appMessage';
488
+ } & AppMessage) | {
489
+ type: 'getVitreSettings';
490
+ } | ({
491
+ type: 'setVitreSettings';
492
+ } & VitreSettingsSetter) | ({
493
+ type: 'shareFile';
494
+ } & ShareFileRequest) | ({
495
+ type: 'shareData';
496
+ } & ShareDataRequest) | ({
497
+ type: 'saveSettings';
498
+ } & SaveSettings) | ({
499
+ type: 'changeTeamSpace';
500
+ } & ChangeTeamSpace) | ({
501
+ type: 'changeTeamSpaceGuest';
502
+ } & ChangeTeamSpaceGuest) | ({
503
+ type: 'showNotification';
504
+ } & NotificationInfo) | ({
505
+ type: 'hideNotification';
506
+ } & HideNotification) | ({
507
+ type: 'changePrivacy';
508
+ } & ChangePrivacy) | ({
509
+ type: 'trackEvent';
510
+ } & EventTelemetry) | ({
511
+ type: 'startTrackEvent';
512
+ } & StartEventTelemetry) | ({
513
+ type: 'stopTrackEvent';
514
+ } & EventTelemetry) | ({
515
+ type: 'setSettingsSchema';
516
+ } & SettingsSchema) | {
517
+ type: 'setVoiceActions';
518
+ actions: VoiceAction[];
519
+ } | ({
520
+ type: 'closeFrame';
521
+ } & CloseFrame) | ({
522
+ type: 'setFrameOwner';
523
+ } & SetFrameOwner) | ({
524
+ type: 'setChromeStyle';
525
+ } & SetChromeStyle) | ({
526
+ type: 'setFramePosition';
527
+ } & SetFramePosition) | ({
528
+ type: 'updateState';
529
+ } & UpdateState) | ({
530
+ type: 'sendKnockKnock';
531
+ } & SendKnockKnock) | ({
532
+ type: 'getStats';
533
+ } & GetStats) | ({
534
+ type: 'setReducedAudioMode';
535
+ } & SetReducedAudioMode) | ({
536
+ type: 'externalMessageResponse';
537
+ } & ExternalMessageResponseData) | ({
538
+ type: 'requestAppToken';
539
+ } & RequestAppTokenData) | ({
540
+ type: 'executeInFrame';
541
+ } & ExecuteInFrameData) | ({
542
+ type: 'setFrameSize';
543
+ } & SetFrameSize) | ({
544
+ type: 'sendToSerialPort';
545
+ } & SendToSerialPort) | ({
546
+ type: 'requestSerialPortAccess';
547
+ requestId: string;
548
+ } & RequestSerialPortAccess) | {
549
+ type: 'crdtUpdate';
550
+ update: ArrayBufferLike;
551
+ } | {
552
+ type: 'crdtRequestSync';
553
+ } | {
554
+ type: 'crdtAwarenessUpdate';
555
+ update: ArrayBufferLike;
556
+ } | {
557
+ type: 'crdtRequestAwareness';
558
+ } | {
559
+ type: 'crdtSubdocUpdate';
560
+ guid: string;
561
+ update: ArrayBufferLike;
562
+ } | {
563
+ type: 'crdtSubdocRequestSync';
564
+ guid: string;
565
+ } | ({
566
+ type: 'sendMessageToCompanionConnector';
567
+ } & SendMessageToCompanionConnector);