@lavitre/apps 1.64.0 → 1.65.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.
package/README.md CHANGED
@@ -215,6 +215,15 @@ connector.trackEvent('started', { version: connector.appVersion, channel: connec
215
215
  - Not to be confused with `hostInformation.version`, the HOST's version (`'36.6.0-mainX64.7130'`), whose `mainX64` is the host's build channel.
216
216
  - On the companion (SDK 1.64), `CompanionConnector` and `CompanionFrame` expose the same `appVersion` / `appChannel` — the values of the app on the Vitre the companion is connected to. `undefined` on a host that predates them.
217
217
 
218
+ ### Sharing a frame's stream from another site — `frame.shareStream` (SDK 1.65)
219
+
220
+ `frame.shareStream(stream)` hands the frame's tracks to the Vitre, which shares them with the space. Two transports, chosen by the SDK:
221
+
222
+ - **Same site as the Vitre page, Chromium** (e.g. `*.apps.lavit.re` in `app.lavit.re`): the track readables are transferred, no re-encoding.
223
+ - **Otherwise** (a preview served from `*.netlify.app`, a browser without `MediaStreamTrackProcessor`): the stream goes over a local `RTCPeerConnection` to the Vitre, re-encoded once on the same machine. Only with a host that announces it (`shareStreamPeer`); `replaceShareStream` then swaps the tracks on the frame's own sender, for the kinds the share already carries.
224
+
225
+ A connector decides before opening the frame with `connector.canFrameShareStream()` (same checks, from the connector, which runs on the app's site too). `frame.canShareStream()` is `false` when neither works — an older Vitre with a frame on another site, where a transferred share would die on its first frame. Keep a fallback for that case (e.g. let the host open the camera with `connector.requestOpenStreamFrame`). `attachStream` and `Connector.shareStream` keep the readables transport only.
226
+
218
227
  ### Native or web host — `isNativeHost`
219
228
 
220
229
  ```ts
@@ -0,0 +1,2 @@
1
+ export declare function siteOf(origin: string): string | undefined;
2
+ export declare function isSameSiteAsParent(ownOrigin: string, ancestorOrigins: ArrayLike<string> | undefined): boolean;
@@ -0,0 +1,26 @@
1
+ // Which site a frame or connector sits on, relative to the Vitre page that
2
+ // embeds it: track readables only cross between documents of the same site.
3
+ /// "Site" approximated by the scheme and the last two host labels, as the
4
+ /// host does (`sharingHost.canTransferTrackReadables`): it holds for every
5
+ /// la Vitre domain. Pure, for tests.
6
+ export function siteOf(origin) {
7
+ try {
8
+ const url = new URL(origin);
9
+ return `${url.protocol}//${url.hostname.split('.').slice(-2).join('.')}`;
10
+ }
11
+ catch {
12
+ return undefined;
13
+ }
14
+ }
15
+ /// Whether this frame can transfer track readables to the page that embeds
16
+ /// it: same site, judged from `location.ancestorOrigins` (Chromium). Without
17
+ /// that list (other engines) the answer is yes; those engines have no
18
+ /// `MediaStreamTrackProcessor` anyway, which is checked separately.
19
+ export function isSameSiteAsParent(ownOrigin, ancestorOrigins) {
20
+ const parent = ancestorOrigins?.[0];
21
+ if (parent == null)
22
+ return true;
23
+ const own = siteOf(ownOrigin);
24
+ return own != null && own === siteOf(parent);
25
+ }
26
+ //# sourceMappingURL=Site.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Site.js","sourceRoot":"","sources":["../../Common/Site.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAE5E,0EAA0E;AAC1E,2EAA2E;AAC3E,qCAAqC;AACrC,MAAM,UAAU,MAAM,CAAC,MAAc;IACnC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAA;QAC3B,OAAO,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,6EAA6E;AAC7E,sEAAsE;AACtE,oEAAoE;AACpE,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,eAA8C;IAE9C,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC,CAAC,CAAC,CAAA;IACnC,IAAI,MAAM,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;IAC7B,OAAO,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["// Which site a frame or connector sits on, relative to the Vitre page that\n// embeds it: track readables only cross between documents of the same site.\n\n/// \"Site\" approximated by the scheme and the last two host labels, as the\n/// host does (`sharingHost.canTransferTrackReadables`): it holds for every\n/// la Vitre domain. Pure, for tests.\nexport function siteOf(origin: string): string | undefined {\n try {\n const url = new URL(origin)\n return `${url.protocol}//${url.hostname.split('.').slice(-2).join('.')}`\n } catch {\n return undefined\n }\n}\n\n/// Whether this frame can transfer track readables to the page that embeds\n/// it: same site, judged from `location.ancestorOrigins` (Chromium). Without\n/// that list (other engines) the answer is yes; those engines have no\n/// `MediaStreamTrackProcessor` anyway, which is checked separately.\nexport function isSameSiteAsParent(\n ownOrigin: string,\n ancestorOrigins: ArrayLike<string> | undefined,\n): boolean {\n const parent = ancestorOrigins?.[0]\n if (parent == null) return true\n const own = siteOf(ownOrigin)\n return own != null && own === siteOf(parent)\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from './Common.Model.js';
2
2
  export { compareVersions, isMinVersion } from './Version.js';
3
+ export { isSameSiteAsParent, siteOf } from './Site.js';
3
4
  export { CrdtChannel, MIN_CRDT_HOST_VERSION, type CrdtAttachment, type CrdtInboundMessage, type CrdtOutboundMessage, type CrdtPostMessage, } from './CrdtChannel.js';
4
5
  export { BlobStore } from './BlobStore.js';
5
6
  export { AppSettingsError, APP_SETTINGS_TIMEOUT_MS, type AppSettingsErrorCode, } from './AppSettings.js';
@@ -1,5 +1,6 @@
1
1
  export * from './Common.Model.js';
2
2
  export { compareVersions, isMinVersion } from './Version.js';
3
+ export { isSameSiteAsParent, siteOf } from './Site.js';
3
4
  export { CrdtChannel, MIN_CRDT_HOST_VERSION, } from './CrdtChannel.js';
4
5
  export { BlobStore } from './BlobStore.js';
5
6
  export { AppSettingsError, APP_SETTINGS_TIMEOUT_MS, } from './AppSettings.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EACL,WAAW,EACX,qBAAqB,GAKtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,GAGhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,kCAAkC,EAClC,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,GAIxB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,2BAA2B,EAC3B,mCAAmC,EACnC,mCAAmC,EACnC,uCAAuC,EACvC,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,GAMvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,SAAS,EACT,mBAAmB,GAMpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAwB,EACxB,YAAe,EACf,EAAE;IACF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,YAAiB,EAAE,EAAE;QACpD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YACzC,OAAO,YAAY,CAAA;QACrB,CAAC;QAED,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,OAAO,YAAY,CAAA;gBACrB,CAAC;qBAAM,CAAC;oBACN,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YAED,KAAK,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACzD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACxC,KAAK,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,OAAO,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,YAAY,CAAM,CAAA;AACzE,CAAC,CAAA;AACD,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './Common.Model.js'\nexport { compareVersions, isMinVersion } from './Version.js'\nexport {\n CrdtChannel,\n MIN_CRDT_HOST_VERSION,\n type CrdtAttachment,\n type CrdtInboundMessage,\n type CrdtOutboundMessage,\n type CrdtPostMessage,\n} from './CrdtChannel.js'\nexport { BlobStore } from './BlobStore.js'\nexport {\n AppSettingsError,\n APP_SETTINGS_TIMEOUT_MS,\n type AppSettingsErrorCode,\n} from './AppSettings.js'\nexport {\n SETTINGS_FILE_NAME,\n SettingsDefaultsResolver,\n defaultsOfProperties,\n mergeDefaults,\n parseSettingsFile,\n withoutDefaults,\n type SettingsFileDefaults,\n type SettingsFormLevel,\n} from './SettingsDefaults.js'\nexport {\n PublicStorageError,\n PUBLIC_STORAGE_TIMEOUT_MS,\n PUBLIC_STORAGE_PUT_TIMEOUT_MS,\n MAX_PUBLIC_FILE_SIZE_BYTES,\n MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS,\n validateExpiresIn,\n putPublicFileExpiryField,\n withDownloadUrlFallback,\n type PublicStorageErrorCode,\n type PublicStorageApi,\n type PublicStoragePutOptions,\n} from './PublicStorage.js'\nexport {\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 MIN_PRIVATE_FILE_EXPIRES_IN_SECONDS,\n MAX_PRIVATE_LINK_EXPIRES_IN_SECONDS,\n DEFAULT_PRIVATE_LINK_EXPIRES_IN_SECONDS,\n MAX_PRIVATE_PATH_LENGTH,\n MAX_PRIVATE_PATH_SEGMENTS,\n validatePrivatePath,\n validatePrivateExpiresIn,\n validateLinkExpiresIn,\n privateFileExpiryField,\n type PrivateStorageErrorCode,\n type PrivateStorageApi,\n type PrivateStorageReadApi,\n type PrivateStoragePutOptions,\n type PrivateStorageGetLinkOptions,\n} from './PrivateStorage.js'\nexport {\n AiChannel,\n MIN_AI_HOST_VERSION,\n type AiTool,\n type AiToolHandler,\n type AiInboundMessage,\n type AiOutboundMessage,\n type AiPostMessage,\n} from './AiChannel.js'\n\nexport const ensureDefaultValue = <T>(\n value: Partial<T> | null,\n defaultValue: T,\n) => {\n const ensureValue = (value: any, defaultValue: any) => {\n if (defaultValue === undefined) {\n return value\n }\n\n if (typeof value !== typeof defaultValue) {\n return defaultValue\n }\n\n if (typeof defaultValue === 'object') {\n if (Array.isArray(defaultValue)) {\n if (!Array.isArray(value)) {\n return defaultValue\n } else {\n return value\n }\n }\n\n value = value === undefined || value == null ? {} : value\n Object.keys(defaultValue).forEach((key) => {\n value[key] = ensureDefaultValue(value[key], defaultValue[key])\n })\n }\n\n return value\n }\n\n return ensureValue(value === undefined ? {} : value, defaultValue) as T\n}\nexport * from './PreviewScaling.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EACL,WAAW,EACX,qBAAqB,GAKtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,GAGhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,kCAAkC,EAClC,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,GAIxB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,2BAA2B,EAC3B,mCAAmC,EACnC,mCAAmC,EACnC,uCAAuC,EACvC,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,GAMvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,SAAS,EACT,mBAAmB,GAMpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAwB,EACxB,YAAe,EACf,EAAE;IACF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,YAAiB,EAAE,EAAE;QACpD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YACzC,OAAO,YAAY,CAAA;QACrB,CAAC;QAED,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,OAAO,YAAY,CAAA;gBACrB,CAAC;qBAAM,CAAC;oBACN,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YAED,KAAK,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACzD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACxC,KAAK,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,OAAO,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,YAAY,CAAM,CAAA;AACzE,CAAC,CAAA;AACD,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './Common.Model.js'\nexport { compareVersions, isMinVersion } from './Version.js'\nexport { isSameSiteAsParent, siteOf } from './Site.js'\nexport {\n CrdtChannel,\n MIN_CRDT_HOST_VERSION,\n type CrdtAttachment,\n type CrdtInboundMessage,\n type CrdtOutboundMessage,\n type CrdtPostMessage,\n} from './CrdtChannel.js'\nexport { BlobStore } from './BlobStore.js'\nexport {\n AppSettingsError,\n APP_SETTINGS_TIMEOUT_MS,\n type AppSettingsErrorCode,\n} from './AppSettings.js'\nexport {\n SETTINGS_FILE_NAME,\n SettingsDefaultsResolver,\n defaultsOfProperties,\n mergeDefaults,\n parseSettingsFile,\n withoutDefaults,\n type SettingsFileDefaults,\n type SettingsFormLevel,\n} from './SettingsDefaults.js'\nexport {\n PublicStorageError,\n PUBLIC_STORAGE_TIMEOUT_MS,\n PUBLIC_STORAGE_PUT_TIMEOUT_MS,\n MAX_PUBLIC_FILE_SIZE_BYTES,\n MIN_PUBLIC_FILE_EXPIRES_IN_SECONDS,\n validateExpiresIn,\n putPublicFileExpiryField,\n withDownloadUrlFallback,\n type PublicStorageErrorCode,\n type PublicStorageApi,\n type PublicStoragePutOptions,\n} from './PublicStorage.js'\nexport {\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 MIN_PRIVATE_FILE_EXPIRES_IN_SECONDS,\n MAX_PRIVATE_LINK_EXPIRES_IN_SECONDS,\n DEFAULT_PRIVATE_LINK_EXPIRES_IN_SECONDS,\n MAX_PRIVATE_PATH_LENGTH,\n MAX_PRIVATE_PATH_SEGMENTS,\n validatePrivatePath,\n validatePrivateExpiresIn,\n validateLinkExpiresIn,\n privateFileExpiryField,\n type PrivateStorageErrorCode,\n type PrivateStorageApi,\n type PrivateStorageReadApi,\n type PrivateStoragePutOptions,\n type PrivateStorageGetLinkOptions,\n} from './PrivateStorage.js'\nexport {\n AiChannel,\n MIN_AI_HOST_VERSION,\n type AiTool,\n type AiToolHandler,\n type AiInboundMessage,\n type AiOutboundMessage,\n type AiPostMessage,\n} from './AiChannel.js'\n\nexport const ensureDefaultValue = <T>(\n value: Partial<T> | null,\n defaultValue: T,\n) => {\n const ensureValue = (value: any, defaultValue: any) => {\n if (defaultValue === undefined) {\n return value\n }\n\n if (typeof value !== typeof defaultValue) {\n return defaultValue\n }\n\n if (typeof defaultValue === 'object') {\n if (Array.isArray(defaultValue)) {\n if (!Array.isArray(value)) {\n return defaultValue\n } else {\n return value\n }\n }\n\n value = value === undefined || value == null ? {} : value\n Object.keys(defaultValue).forEach((key) => {\n value[key] = ensureDefaultValue(value[key], defaultValue[key])\n })\n }\n\n return value\n }\n\n return ensureValue(value === undefined ? {} : value, defaultValue) as T\n}\nexport * from './PreviewScaling.js'\n"]}
@@ -15,6 +15,12 @@ export type InitializeConnector = {
15
15
  * older than this field. Added 1.63.
16
16
  */
17
17
  appChannel?: string;
18
+ /**
19
+ * What the host can do beyond this message's shape. `'shareStreamPeer'`: a
20
+ * frame's `shareStream` reaches the host from another site, over a local
21
+ * peer connection. Omitted by hosts older than this field. Added 1.65.
22
+ */
23
+ hostCapabilities?: string[];
18
24
  state?: Record<string, any>;
19
25
  };
20
26
  export type RegExpDefinition = {
@@ -1 +1 @@
1
- {"version":3,"file":"Connector.Model.js","sourceRoot":"","sources":["../../Connector/Connector.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AppMessage,\n AppSettingsChanged,\n AppSettingsResponse,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n ChromeStyle,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n DeletePublicFile,\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 GetAppSettings,\n GetStats,\n HideNotification,\n HostInformation,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LayoutPositionWithRules,\n ListPublicFiles,\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 PublicStorageResponse,\n PutPublicFile,\n DeletePrivateFile,\n GetPrivateFile,\n GetPrivateFileLink,\n ListPrivateFiles,\n PrivateStorageResponse,\n PutPrivateFile,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetAppSettings,\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 /**\n * The version of this app the vitre loaded — the semver it was deployed\n * under (`begin_deploy`), e.g. `'1.4.0'`. Not the host version\n * (`hostInfo.version`). Omitted by hosts older than this field. Added 1.63.\n */\n appVersion?: string\n /**\n * The app channel that version was selected through (`'preview'`, `'beta'`…),\n * when a team or space follows a channel for this app. Omitted when the version\n * is the team's own selection, a pinned version or a global one, and by hosts\n * older than this field. Added 1.63.\n */\n appChannel?: 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 /**\n * The app's settings, rendered by the la Vitre settings form and read back from\n * `hostInformation.settings`.\n *\n * This is a **map of fields**, NOT a full JSON schema: one key per setting, the\n * same keys as `hostInformation.settings`. The host builds the enclosing\n * `{ type: 'object', title: <app name>, properties: … }` itself.\n *\n * ```ts\n * // RIGHT\n * settingsSchema: {\n * city: { type: 'string', title: 'City', default: 'Paris' },\n * layout: { type: 'object', title: 'Layout', properties: { columns: { type: 'number' } } },\n * }\n * // WRONG — a full JSON schema\n * settingsSchema: { type: 'object', properties: { city: { type: 'string' } } }\n * ```\n */\n settingsSchema?: SettingsSchemaProperties\n /** react-jsonschema-form `uiSchema`, keyed like `settingsSchema` (one entry per field). */\n settingsSchemaUI?: any\n voiceActions?: VoiceAction[]\n /**\n * The kinds of frames this app opens, when it opens more than one — e.g.\n * Carbone's \"Page blanche\", \"PDF\", \"Image\". Each kind gets its own entry in\n * the Vitre's app start positions (settings), next to the app itself, so a\n * PDF can open on one monitor and a board on another. A frame says which\n * kind it is with `OpenFrameOptions.frameKind`. Declared up front because\n * the settings list them before any frame has been opened.\n *\n * Hosts that predate the option ignore it: every frame of the app opens at\n * the app's own position.\n */\n frameKinds?: FrameKind[]\n}\n\n/** One kind of frame an app opens — see `ConnectorOptions.frameKinds`. */\nexport type FrameKind = {\n /**\n * Stable identifier, stored in the Vitre settings: never translate it, and\n * never change it once released, or the positions saved for it are lost.\n * Letters, digits, `-`, `_` and `.` only.\n */\n id: string\n /** Label shown in the settings, after the app name (\"Carbone – PDF\"). */\n name: string\n}\n\n/**\n * One setting: the JSON-Schema subset the la Vitre settings form renders\n * (`string`, `number`, `boolean`, `enum`, `array` with `items`, `object` with\n * `properties`). Every nested `properties` value and `items` is itself a\n * `SettingsFieldSchema` object, never a bare string; `required` is a list of key\n * names on the enclosing object, never `required: true` on a field.\n */\nexport type SettingsFieldSchema = {\n type?: string\n title?: string\n description?: string\n default?: unknown\n enum?: unknown[]\n enumNames?: string[]\n items?: SettingsFieldSchema | SettingsFieldSchema[]\n properties?: SettingsSchemaProperties\n required?: string[]\n [keyword: string]: unknown\n}\n\n/** A map of fields — see `ConnectorOptions.settingsSchema`. */\nexport type SettingsSchemaProperties = { [field: string]: SettingsFieldSchema }\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 /** See `OpenFrameOptions.frameKind`. */\n frameKind?: string\n}\n\nexport type SetRootMenu = {\n menu: RootMenuEntry[]\n}\n\nexport type SettingsSchema = {\n /** A map of fields, NOT a full JSON schema — see `ConnectorOptions.settingsSchema`. */\n schema: SettingsSchemaProperties\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: 'appSettingsResponse' } & AppSettingsResponse)\n | ({ type: 'appSettingsChanged' } & AppSettingsChanged)\n | ({ type: 'publicStorageResponse' } & PublicStorageResponse)\n | ({ type: 'privateStorageResponse' } & PrivateStorageResponse)\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: 'getAppSettings' } & GetAppSettings)\n | ({ type: 'setAppSettings' } & SetAppSettings)\n | ({ type: 'putPublicFile' } & PutPublicFile)\n | ({ type: 'deletePublicFile' } & DeletePublicFile)\n | ({ type: 'listPublicFiles' } & ListPublicFiles)\n | ({ type: 'putPrivateFile' } & PutPrivateFile)\n | ({ type: 'deletePrivateFile' } & DeletePrivateFile)\n | ({ type: 'listPrivateFiles' } & ListPrivateFiles)\n | ({ type: 'getPrivateFile' } & GetPrivateFile)\n | ({ type: 'getPrivateFileLink' } & GetPrivateFileLink)\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"]}
1
+ {"version":3,"file":"Connector.Model.js","sourceRoot":"","sources":["../../Connector/Connector.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AppMessage,\n AppSettingsChanged,\n AppSettingsResponse,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n ChromeStyle,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n DeletePublicFile,\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 GetAppSettings,\n GetStats,\n HideNotification,\n HostInformation,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LayoutPositionWithRules,\n ListPublicFiles,\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 PublicStorageResponse,\n PutPublicFile,\n DeletePrivateFile,\n GetPrivateFile,\n GetPrivateFileLink,\n ListPrivateFiles,\n PrivateStorageResponse,\n PutPrivateFile,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetAppSettings,\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 /**\n * The version of this app the vitre loaded — the semver it was deployed\n * under (`begin_deploy`), e.g. `'1.4.0'`. Not the host version\n * (`hostInfo.version`). Omitted by hosts older than this field. Added 1.63.\n */\n appVersion?: string\n /**\n * The app channel that version was selected through (`'preview'`, `'beta'`…),\n * when a team or space follows a channel for this app. Omitted when the version\n * is the team's own selection, a pinned version or a global one, and by hosts\n * older than this field. Added 1.63.\n */\n appChannel?: string\n /**\n * What the host can do beyond this message's shape. `'shareStreamPeer'`: a\n * frame's `shareStream` reaches the host from another site, over a local\n * peer connection. Omitted by hosts older than this field. Added 1.65.\n */\n hostCapabilities?: 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 /**\n * The app's settings, rendered by the la Vitre settings form and read back from\n * `hostInformation.settings`.\n *\n * This is a **map of fields**, NOT a full JSON schema: one key per setting, the\n * same keys as `hostInformation.settings`. The host builds the enclosing\n * `{ type: 'object', title: <app name>, properties: … }` itself.\n *\n * ```ts\n * // RIGHT\n * settingsSchema: {\n * city: { type: 'string', title: 'City', default: 'Paris' },\n * layout: { type: 'object', title: 'Layout', properties: { columns: { type: 'number' } } },\n * }\n * // WRONG — a full JSON schema\n * settingsSchema: { type: 'object', properties: { city: { type: 'string' } } }\n * ```\n */\n settingsSchema?: SettingsSchemaProperties\n /** react-jsonschema-form `uiSchema`, keyed like `settingsSchema` (one entry per field). */\n settingsSchemaUI?: any\n voiceActions?: VoiceAction[]\n /**\n * The kinds of frames this app opens, when it opens more than one — e.g.\n * Carbone's \"Page blanche\", \"PDF\", \"Image\". Each kind gets its own entry in\n * the Vitre's app start positions (settings), next to the app itself, so a\n * PDF can open on one monitor and a board on another. A frame says which\n * kind it is with `OpenFrameOptions.frameKind`. Declared up front because\n * the settings list them before any frame has been opened.\n *\n * Hosts that predate the option ignore it: every frame of the app opens at\n * the app's own position.\n */\n frameKinds?: FrameKind[]\n}\n\n/** One kind of frame an app opens — see `ConnectorOptions.frameKinds`. */\nexport type FrameKind = {\n /**\n * Stable identifier, stored in the Vitre settings: never translate it, and\n * never change it once released, or the positions saved for it are lost.\n * Letters, digits, `-`, `_` and `.` only.\n */\n id: string\n /** Label shown in the settings, after the app name (\"Carbone – PDF\"). */\n name: string\n}\n\n/**\n * One setting: the JSON-Schema subset the la Vitre settings form renders\n * (`string`, `number`, `boolean`, `enum`, `array` with `items`, `object` with\n * `properties`). Every nested `properties` value and `items` is itself a\n * `SettingsFieldSchema` object, never a bare string; `required` is a list of key\n * names on the enclosing object, never `required: true` on a field.\n */\nexport type SettingsFieldSchema = {\n type?: string\n title?: string\n description?: string\n default?: unknown\n enum?: unknown[]\n enumNames?: string[]\n items?: SettingsFieldSchema | SettingsFieldSchema[]\n properties?: SettingsSchemaProperties\n required?: string[]\n [keyword: string]: unknown\n}\n\n/** A map of fields — see `ConnectorOptions.settingsSchema`. */\nexport type SettingsSchemaProperties = { [field: string]: SettingsFieldSchema }\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 /** See `OpenFrameOptions.frameKind`. */\n frameKind?: string\n}\n\nexport type SetRootMenu = {\n menu: RootMenuEntry[]\n}\n\nexport type SettingsSchema = {\n /** A map of fields, NOT a full JSON schema — see `ConnectorOptions.settingsSchema`. */\n schema: SettingsSchemaProperties\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: 'appSettingsResponse' } & AppSettingsResponse)\n | ({ type: 'appSettingsChanged' } & AppSettingsChanged)\n | ({ type: 'publicStorageResponse' } & PublicStorageResponse)\n | ({ type: 'privateStorageResponse' } & PrivateStorageResponse)\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: 'getAppSettings' } & GetAppSettings)\n | ({ type: 'setAppSettings' } & SetAppSettings)\n | ({ type: 'putPublicFile' } & PutPublicFile)\n | ({ type: 'deletePublicFile' } & DeletePublicFile)\n | ({ type: 'listPublicFiles' } & ListPublicFiles)\n | ({ type: 'putPrivateFile' } & PutPrivateFile)\n | ({ type: 'deletePrivateFile' } & DeletePrivateFile)\n | ({ type: 'listPrivateFiles' } & ListPrivateFiles)\n | ({ type: 'getPrivateFile' } & GetPrivateFile)\n | ({ type: 'getPrivateFileLink' } & GetPrivateFileLink)\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"]}
@@ -86,6 +86,11 @@ export declare class Connector {
86
86
  * pinned or a global version — or on a host that does not send it.
87
87
  */
88
88
  appChannel?: string;
89
+ /**
90
+ * What the host announces it can do (`'shareStreamPeer'`…). Empty on a host
91
+ * older than this field. Added 1.65.
92
+ */
93
+ readonly hostCapabilities: string[];
89
94
  hostInformation: HostInformation;
90
95
  openedFrames: FrameInfo[];
91
96
  state: Record<string, any>;
@@ -160,6 +165,15 @@ export declare class Connector {
160
165
  requestOpenStream(streamId: string, constraints: MediaStreamConstraints): Promise<MediaTrackInfo[]>;
161
166
  private convertConstraintsToVitreConstraints;
162
167
  requestOpenStreamFrame(openStreamFrame: Omit<OpenStreamFrame, 'requestId'>): Promise<MediaTrackInfo[]>;
168
+ /**
169
+ * Whether a frame this app opens will be able to `frame.shareStream`: the
170
+ * app is on the same site as the Vitre page (track readables cross), or the
171
+ * host takes a frame's stream over a local peer connection
172
+ * (`hostCapabilities` has `'shareStreamPeer'`). Decide here, before opening
173
+ * the frame, whether it should open a camera itself or let the host open it
174
+ * (`requestOpenStreamFrame`). Added 1.65.
175
+ */
176
+ canFrameShareStream(): boolean;
163
177
  /**
164
178
  * Whether {@link shareStream} is available in this runtime. Requires the
165
179
  * MediaStreamTrack Insertable Streams API (Chromium-only) and the app being
@@ -3,6 +3,7 @@ import { randomUuid } from '../Common/Uuid.js';
3
3
  import { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js';
4
4
  import { BlobStore } from '../Common/BlobStore.js';
5
5
  import { isMinVersion } from '../Common/index.js';
6
+ import { isSameSiteAsParent } from '../Common/Site.js';
6
7
  import { AppSettingsError, APP_SETTINGS_TIMEOUT_MS } from '../Common/AppSettings.js';
7
8
  import { SettingsDefaultsResolver, defaultSettingsFileUrl } from '../Common/SettingsDefaults.js';
8
9
  import { PublicStorageError, PUBLIC_STORAGE_TIMEOUT_MS, PUBLIC_STORAGE_PUT_TIMEOUT_MS, MAX_PUBLIC_FILE_SIZE_BYTES, validateExpiresIn, putPublicFileExpiryField, withDownloadUrlFallback, } from '../Common/PublicStorage.js';
@@ -385,6 +386,16 @@ export class Connector {
385
386
  writable: true,
386
387
  value: void 0
387
388
  });
389
+ /**
390
+ * What the host announces it can do (`'shareStreamPeer'`…). Empty on a host
391
+ * older than this field. Added 1.65.
392
+ */
393
+ Object.defineProperty(this, "hostCapabilities", {
394
+ enumerable: true,
395
+ configurable: true,
396
+ writable: true,
397
+ value: void 0
398
+ });
388
399
  Object.defineProperty(this, "hostInformation", {
389
400
  enumerable: true,
390
401
  configurable: true,
@@ -607,6 +618,7 @@ export class Connector {
607
618
  this.appId = initMessage.appId ?? '';
608
619
  this.appVersion = initMessage.appVersion;
609
620
  this.appChannel = initMessage.appChannel;
621
+ this.hostCapabilities = initMessage.hostCapabilities ?? [];
610
622
  this.state = initMessage.state ?? {};
611
623
  // Mirror the first of `shareTargets` onto the deprecated singular `shareTarget`
612
624
  // so older Vitres (which only read `shareTarget`) still get the primary target.
@@ -1135,6 +1147,20 @@ export class Connector {
1135
1147
  }
1136
1148
  });
1137
1149
  }
1150
+ /**
1151
+ * Whether a frame this app opens will be able to `frame.shareStream`: the
1152
+ * app is on the same site as the Vitre page (track readables cross), or the
1153
+ * host takes a frame's stream over a local peer connection
1154
+ * (`hostCapabilities` has `'shareStreamPeer'`). Decide here, before opening
1155
+ * the frame, whether it should open a camera itself or let the host open it
1156
+ * (`requestOpenStreamFrame`). Added 1.65.
1157
+ */
1158
+ canFrameShareStream() {
1159
+ return ((typeof MediaStreamTrackProcessor !== 'undefined' &&
1160
+ isSameSiteAsParent(location.origin, location.ancestorOrigins)) ||
1161
+ (this.hostCapabilities.includes('shareStreamPeer') &&
1162
+ typeof RTCPeerConnection !== 'undefined'));
1163
+ }
1138
1164
  /**
1139
1165
  * Whether {@link shareStream} is available in this runtime. Requires the
1140
1166
  * MediaStreamTrack Insertable Streams API (Chromium-only) and the app being