@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.
- package/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/Common/AiChannel.d.ts +59 -0
- package/dist/Common/AiChannel.js +97 -0
- package/dist/Common/AiChannel.js.map +1 -0
- package/dist/Common/BlobStore.d.ts +44 -0
- package/dist/Common/BlobStore.js +186 -0
- package/dist/Common/BlobStore.js.map +1 -0
- package/dist/Common/Common.Model.d.ts +1020 -0
- package/dist/Common/Common.Model.js +21 -0
- package/dist/Common/Common.Model.js.map +1 -0
- package/dist/Common/CrdtChannel.d.ts +198 -0
- package/dist/Common/CrdtChannel.js +659 -0
- package/dist/Common/CrdtChannel.js.map +1 -0
- package/dist/Common/Version.d.ts +21 -0
- package/dist/Common/Version.js +62 -0
- package/dist/Common/Version.js.map +1 -0
- package/dist/Common/index.d.ts +6 -0
- package/dist/Common/index.js +32 -0
- package/dist/Common/index.js.map +1 -0
- package/dist/CompanionConnector/CompanionConnector.Model.d.ts +85 -0
- package/dist/CompanionConnector/CompanionConnector.Model.js +17 -0
- package/dist/CompanionConnector/CompanionConnector.Model.js.map +1 -0
- package/dist/CompanionConnector/CompanionConnector.d.ts +28 -0
- package/dist/CompanionConnector/CompanionConnector.js +385 -0
- package/dist/CompanionConnector/CompanionConnector.js.map +1 -0
- package/dist/CompanionConnector/index.d.ts +2 -0
- package/dist/CompanionConnector/index.js +3 -0
- package/dist/CompanionConnector/index.js.map +1 -0
- package/dist/CompanionFrame/CompanionFrame.d.ts +103 -0
- package/dist/CompanionFrame/CompanionFrame.js +100 -0
- package/dist/CompanionFrame/CompanionFrame.js.map +1 -0
- package/dist/CompanionFrame/index.d.ts +1 -0
- package/dist/CompanionFrame/index.js +2 -0
- package/dist/CompanionFrame/index.js.map +1 -0
- package/dist/Connector/Connector.Model.d.ts +567 -0
- package/dist/Connector/Connector.Model.js +2 -0
- package/dist/Connector/Connector.Model.js.map +1 -0
- package/dist/Connector/Connector.d.ts +227 -0
- package/dist/Connector/Connector.js +1337 -0
- package/dist/Connector/Connector.js.map +1 -0
- package/dist/Connector/index.d.ts +2 -0
- package/dist/Connector/index.js +3 -0
- package/dist/Connector/index.js.map +1 -0
- package/dist/Frame/Frame.Model.d.ts +533 -0
- package/dist/Frame/Frame.Model.js +2 -0
- package/dist/Frame/Frame.Model.js.map +1 -0
- package/dist/Frame/Frame.d.ts +309 -0
- package/dist/Frame/Frame.js +1408 -0
- package/dist/Frame/Frame.js.map +1 -0
- package/dist/Frame/SyncAdapter.d.ts +75 -0
- package/dist/Frame/SyncAdapter.js +134 -0
- package/dist/Frame/SyncAdapter.js.map +1 -0
- package/dist/Frame/index.d.ts +3 -0
- package/dist/Frame/index.js +4 -0
- package/dist/Frame/index.js.map +1 -0
- package/dist/MediaLink/MediaLink.d.ts +178 -0
- package/dist/MediaLink/MediaLink.js +1432 -0
- package/dist/MediaLink/MediaLink.js.map +1 -0
- package/dist/MediaLink/index.d.ts +1 -0
- package/dist/MediaLink/index.js +2 -0
- package/dist/MediaLink/index.js.map +1 -0
- package/dist/Native/index.d.ts +170 -0
- package/dist/Native/index.js +19 -0
- package/dist/Native/index.js.map +1 -0
- package/dist/Version.d.ts +1 -0
- package/dist/Version.js +2 -0
- package/dist/Version.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CrdtChannel.js","sourceRoot":"","sources":["../../Common/CrdtChannel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,uBAAuB,CAAA;AAqE9B,wEAAwE;AACxE,wEAAwE;AACxE,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAA;AAE7C,yEAAyE;AACzE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O,OAAO;QACb,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;YAC/C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAA;QAC/B,CAAC;QACD,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAA;YAC3D,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAA;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import * as Y from 'yjs'\nimport {\n Awareness,\n applyAwarenessUpdate,\n encodeAwarenessUpdate,\n} from 'y-protocols/awareness'\n\n// Outbound messages emitted by the channel toward the la Vitre host.\nexport type CrdtOutboundMessage =\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n // Real Yjs SyncStep1: `stateVector` advertises what we already have so a\n // holder can answer with a minimal diff. Optional + backward-compatible:\n // an old host strips the field (its decoder is `Decode.succeed`), an old\n // holder ignores it and replies full state, and Yjs merges either way.\n // `silent` marks a MAINTENANCE re-advertise (pending-recovery or the\n // periodic reconcile): the host relays it to peers for a diff but does NOT\n // echo `crdtSyncComplete`, keeping `onSynced` a once-per-initial-sync\n // signal. Optional + backward-compatible — an old host ignores it and\n // re-sends `crdtSyncComplete` (idempotent: listeners already fired).\n | { type: 'crdtRequestSync'; stateVector?: ArrayBufferLike; silent?: boolean }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n // Subdocument channel — keyed by the yjs subdoc `guid` (a globally unique\n // UUIDv4 shared by every peer that received the parent's manifest). The\n // host routes / forwards / shadows these exactly like the main doc but\n // under `(appId, guid)` instead of `appId`. Pure transport: the SDK never\n // looks inside a subdoc, it just moves its updates.\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n\n// Inbound messages the host delivers via Connector/Frame.raiseMessage.\nexport type CrdtInboundMessage =\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n // SyncStep1 from a remote peer: it attached and wants our main doc state.\n // `stateVector` (when present) is what it already has — answer with just\n // the diff (`encodeStateAsUpdate(doc, sv)`); absent/empty ⇒ full state.\n | { type: 'crdtRequestSync'; stateVector?: ArrayBufferLike }\n // Re-sync trigger from the host: a new peer connected (a leaf has no\n // peer-connect event of its own), so re-emit our SyncStep1 to fold the\n // newcomer in. Loop-free: the reply is a diff, not another request.\n | { type: 'crdtResync' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n // Wire-transfer progress for a subdoc whose full state is streaming in as\n // reassembled fragments on the host. Fires repeatedly DURING the transfer,\n // BEFORE the final `crdtSubdocUpdate` (and its apply) — the determinate\n // counterpart to the post-apply, fire-once `onSubdocBytes`. `receivedBytes`\n // is monotonic and in the SAME payload units as the eventual update, so the\n // last event equals `crdtSubdocUpdate.byteLength`. Optional + backward-\n // compatible: an old host never sends it; a new host's emission is harmless\n // to an old SDK (the dispatch switch has no throwing default).\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n // On-demand pull: a remote peer asked for this subdoc (it has the\n // manifest entry but not the bytes). If WE hold it attached, reply with\n // its full state. This is what makes \"deferred, never auto-pushed at\n // late-join\" work — bytes move only when someone actually requests them.\n | { type: 'crdtSubdocRequestSync'; guid: string }\n\nexport type CrdtPostMessage = (\n message: CrdtOutboundMessage,\n transfer?: Transferable[],\n) => void\n\nexport type CrdtAttachment = {\n dispose(): void\n}\n\n// The host-side decoder for the four `crdt*` messages ships in la Vitre\n// 26.5.1. Pre-26.5.1 hosts reject any unknown message type and fail the\n// WHOLE message parse (not just the unknown frame), which would break ALL\n// app messaging — not merely CRDT. Connector and Frame both gate emission\n// on `isMinVersion(hostInformation.version, MIN_CRDT_HOST_VERSION)`; a\n// single shared constant keeps the two connectors from drifting.\nexport const MIN_CRDT_HOST_VERSION = '26.5.1'\n\n// Sentinel origin tag — both directions use it so the outbound listeners\n// don't echo back what they just applied.\nconst ORIGIN_REMOTE = 'lavitre:crdt:remote'\n\n// When an applied update references structs we never received (a causal\n// hole), Yjs parks it in `store.pendingStructs` — invisible, unrendered, and\n// on a broadcast passe-plat with no per-peer retransmit, never refilled on its\n// own. We recover by re-advertising our state vector after this debounce,\n// coalescing a burst of holey updates into a single SyncStep1.\nconst PENDING_RECOVERY_DEBOUNCE_MS = 250\n\n// Periodic safety-net reconcile. The sync protocol assumes a lossless ordered\n// channel; the broadcast passe-plat can still silently drop (a peer dropped\n// mid-ramp-up, a back-pressure eviction), and a LOST TAIL leaves no\n// `pendingStructs` for the reactive recovery to notice. Re-advertising our\n// state vector on this interval makes convergence eventual no matter which\n// events fired — the role a provider's `resyncInterval` plays.\nconst RESYNC_INTERVAL_MS = 20_000\n\ntype AwarenessChange = {\n added: number[]\n updated: number[]\n removed: number[]\n}\n\n/**\n * Yjs sync + awareness channel piped over the la Vitre app transport.\n *\n * By default exposes a `doc` and `awareness` already wired to the host —\n * simple apps just use them. Libraries that bring their own `Y.Doc` /\n * `Awareness` (Carbone, etc.) call `attach(doc, awareness)` to swap them in.\n *\n * Sync messages and awareness messages travel on separate envelope types\n * (`crdtUpdate` vs `crdtAwarenessUpdate`), so the F# host can route, throttle\n * and log them independently.\n */\nexport class CrdtChannel {\n private _defaultDoc: Y.Doc = new Y.Doc()\n private _defaultAwareness: Awareness\n\n private _doc: Y.Doc\n private _awareness: Awareness\n\n private _docUpdateHandler:\n | ((update: Uint8Array, origin: unknown) => void)\n | null = null\n private _awarenessUpdateHandler:\n | ((change: AwarenessChange, origin: unknown) => void)\n | null = null\n\n private _onSyncedListeners: Set<() => void> = new Set()\n\n // `onSynced` fires once per attach cycle (initial handshake + each\n // re-attach), per its documented contract — NOT on every inbound\n // `crdtSyncComplete`. The periodic reconcile (and any pre-`silent` host)\n // re-send `crdtSyncComplete`; this flag swallows the duplicates so a\n // maintenance resync never re-signals \"synced\". Reset in `attach()`.\n private _syncedFired = false\n private _onUpdateListeners: Set<(update: Uint8Array) => void> = new Set()\n\n // Subdoc transport state. Keyed by `subdoc.guid`. Each entry holds the\n // subdoc + its bound update handler so we can detach symmetrically. The\n // SDK is content-blind here: it moves a subdoc's bytes, it does not know\n // (or care) that Carbone uses subdocs for deferred asset blobs.\n private _subdocs = new Map<\n string,\n { doc: Y.Doc; handler: (u: Uint8Array, o: unknown) => void }\n >()\n // Cumulative inbound bytes per subdoc guid — feeds the generic progress\n // signal (a multi-MB blob streaming in wants a loading bar; that's true\n // for any app with heavy media, not just Carbone).\n private _subdocBytes = new Map<string, number>()\n private _onSubdocBytesListeners = new Set<\n (guid: string, receivedBytes: number) => void\n >()\n // Determinate transfer-progress listeners — fed by host `crdtSubdoc\n // TransferProgress` messages, fired while fragments are still reassembling\n // (before apply). Separate from `_onSubdocBytesListeners` (post-apply).\n private _onSubdocTransferProgressListeners = new Set<\n (guid: string, receivedBytes: number, totalBytes: number) => void\n >()\n private _onSubdocSyncedListeners = new Map<string, Set<() => void>>()\n\n // A handshake is queued for the next microtask. Set whenever we schedule\n // one, cleared when it fires. `attach()` consults this to avoid emitting\n // a second handshake when a caller does `new CrdtChannel()` immediately\n // followed by `attach()` in the same task — both microtasks would\n // otherwise observe the same `_doc` and fire two `crdtRequestSync` (and\n // two `crdtRequestAwareness`), producing duplicate `crdtSyncComplete`\n // events and double-invoking `onSynced` listeners.\n private _handshakeScheduled = false\n\n // Tear-down flag. `destroy()` sets it; subsequent `dispose()` calls from\n // outstanding attach handles become no-ops so we don't `_bind()` against\n // a destroyed default doc.\n private _destroyed = false\n\n // A pending-structs recovery re-sync is queued. Set when we detect a causal\n // hole after applying an update, cleared when the debounced re-advertise\n // fires. Coalesces a burst of holey updates into one SyncStep1 (see\n // `_recoverIfPending`).\n private _recoverScheduled = false\n\n // Periodic reconcile timer (RESYNC_INTERVAL_MS). Browser `setInterval`\n // returns a number; Node returns a Timeout we `unref()` so this maintenance\n // timer never keeps a test process alive.\n private _resyncTimer: ReturnType<typeof setInterval> | null = null\n\n // Subdoc guids with a debounced full re-pull in flight — the subdoc\n // analogue of `_recoverScheduled` (causal-hole recovery per guid).\n private _subdocsRecovering = new Set<string>()\n\n constructor(private readonly postMessage: CrdtPostMessage) {\n this._defaultAwareness = new Awareness(this._defaultDoc)\n this._doc = this._defaultDoc\n this._awareness = this._defaultAwareness\n this._bind()\n // Defer the initial handshake to a microtask so callers (Connector /\n // Frame, or any user holding a freshly-constructed channel) have a frame\n // to subscribe via `onSynced` / `onUpdate` before `crdtSyncComplete`\n // arrives — synchronous-transport tests would otherwise miss the event.\n this._scheduleHandshake()\n this._resyncTimer = setInterval(\n () => this._periodicReconcile(),\n RESYNC_INTERVAL_MS,\n )\n const timer: unknown = this._resyncTimer\n if (timer && typeof (timer as { unref?: unknown }).unref === 'function') {\n ;(timer as { unref: () => void }).unref()\n }\n }\n\n get doc(): Y.Doc {\n return this._doc\n }\n\n get awareness(): Awareness {\n return this._awareness\n }\n\n /** Stable numeric identifier for this peer in the Yjs awareness protocol. */\n get clientId(): number {\n return this._awareness.clientID\n }\n\n /**\n * Swap the default `Y.Doc` / `Awareness` for caller-provided ones. The\n * default ones remain alive but stop syncing. Call `dispose()` on the\n * returned handle to revert.\n *\n * Typical use: a library like Carbone instantiates its own Y.Doc internally\n * and exposes a `SyncAdapter` API that takes `(doc, awareness)`. The host\n * app forwards them straight to `attach()`.\n */\n attach(doc: Y.Doc, awareness?: Awareness): CrdtAttachment {\n const realAwareness = awareness ?? new Awareness(doc)\n this._unbind()\n // Carry over any state the SDK already buffered into the new doc.\n // Between channel construction and attach() the initial handshake\n // can deliver peer state that lands in `_defaultDoc`; without this\n // transfer the user's freshly-attached doc would observe an empty\n // store until the post-attach handshake round-trips back. Applying\n // with the remote sentinel keeps the SDK from re-broadcasting it.\n if (doc !== this._defaultDoc) {\n const buffered = Y.encodeStateAsUpdate(this._defaultDoc)\n Y.applyUpdate(doc, buffered, ORIGIN_REMOTE)\n }\n this._doc = doc\n this._awareness = realAwareness\n this._bind()\n // Same microtask deferral as the constructor — a caller that calls\n // attach() then immediately subscribes to onSynced needs the handshake\n // to ship after their subscription lands. If the constructor already\n // queued a handshake that hasn't fired yet, `_scheduleHandshake()`\n // skips ours: the pending one will pick up the now-attached doc.\n this._syncedFired = false\n this._scheduleHandshake()\n return {\n dispose: () => {\n // No-op if the channel has been destroyed or another attach() has\n // swapped the active doc/awareness — this handle is stale and\n // reverting would either bind against a destroyed doc or blow away\n // a newer attachment.\n if (this._destroyed) return\n if (this._doc !== doc || this._awareness !== realAwareness) return\n this._unbind()\n this._doc = this._defaultDoc\n this._awareness = this._defaultAwareness\n this._bind()\n },\n }\n }\n\n /** Subscribe to every sync-complete event — fires once after the initial\n * handshake AND again after each subsequent `attach()` re-handshake.\n * Returns an unsubscribe function. (The listener is NOT auto-removed\n * after the first call.) */\n onSynced(cb: () => void): () => void {\n this._onSyncedListeners.add(cb)\n return () => {\n this._onSyncedListeners.delete(cb)\n }\n }\n\n /** Subscribe to every Yjs doc update — local or remote. */\n onUpdate(cb: (update: Uint8Array) => void): () => void {\n this._onUpdateListeners.add(cb)\n return () => {\n this._onUpdateListeners.delete(cb)\n }\n }\n\n /**\n * Connect a yjs SUBDOCUMENT to this transport on its own channel, keyed\n * by `subdoc.guid`. Returns a disposer.\n *\n * Re-attaching the SAME `Y.Doc` instance is a no-op (returns a disposer\n * for it). Re-attaching a DIFFERENT instance under the same guid replaces\n * the entry (off the old handler, on the new) — last attach wins, so a\n * stale disposer never tears down a live doc's handler.\n *\n * `opts.requestSync` (default true) emits the on-demand pull request. The\n * writer of a subdoc (e.g. `BlobStore.put`) already holds the\n * authoritative state and can pass `false` to skip a wasted round-trip.\n *\n * Low-level primitive — the caller drives WHEN to attach and WHAT the\n * subdoc contains. `frame.blobs` is the convenience built on top.\n */\n attachSubdoc(\n subdoc: Y.Doc,\n opts?: { requestSync?: boolean },\n ): () => void {\n const guid = subdoc.guid\n if (this._destroyed) return () => {}\n\n const existing = this._subdocs.get(guid)\n if (existing) {\n if (existing.doc === subdoc) return () => this.detachSubdoc(guid)\n // Same guid, different Y.Doc instance: swap handlers, last wins.\n existing.doc.off('update', existing.handler)\n }\n\n const handler = (update: Uint8Array, origin: unknown) => {\n if (origin === ORIGIN_REMOTE) return\n const buf = this._exactFitBuffer(update)\n this.postMessage({ type: 'crdtSubdocUpdate', guid, update: buf }, [buf])\n }\n subdoc.on('update', handler)\n this._subdocs.set(guid, { doc: subdoc, handler })\n if (opts?.requestSync !== false) {\n this.postMessage({ type: 'crdtSubdocRequestSync', guid })\n }\n return () => this.detachSubdoc(guid)\n }\n\n /** Subscribe to cumulative inbound bytes for a subdoc (progress bar).\n * Fires `(guid, totalReceivedBytes)` on every inbound subdoc update. */\n onSubdocBytes(\n cb: (guid: string, receivedBytes: number) => void,\n ): () => void {\n this._onSubdocBytesListeners.add(cb)\n return () => {\n this._onSubdocBytesListeners.delete(cb)\n }\n }\n\n /** Subscribe to determinate transfer progress for a subdoc whose full state\n * is streaming in (the host reassembles WebRTC fragments and reports bytes\n * as they land). Fires `(guid, receivedBytes, totalBytes)` repeatedly\n * DURING the transfer, BEFORE the update is applied — unlike `onSubdocBytes`\n * which fires once, after apply, for an atomic subdoc that arrives as a\n * single message. `receivedBytes` is monotonic (high-water on the host) and\n * reaches `totalBytes` (the eventual update size, in the same units) on\n * completion → a determinate progress bar. Returns an unsubscribe function.\n *\n * Requires a host that emits `crdtSubdocTransferProgress`; against an older\n * host the callback simply never fires (fall back to an indeterminate\n * spinner gated on `onSubdocSynced`). */\n onSubdocTransferProgress(\n cb: (guid: string, receivedBytes: number, totalBytes: number) => void,\n ): () => void {\n this._onSubdocTransferProgressListeners.add(cb)\n return () => {\n this._onSubdocTransferProgressListeners.delete(cb)\n }\n }\n\n /** One-shot-per-handshake: fires when the host reports this subdoc's\n * initial sync is complete. */\n onSubdocSynced(guid: string, cb: () => void): () => void {\n let set = this._onSubdocSyncedListeners.get(guid)\n if (!set) {\n set = new Set()\n this._onSubdocSyncedListeners.set(guid, set)\n }\n set.add(cb)\n return () => {\n this._onSubdocSyncedListeners.get(guid)?.delete(cb)\n }\n }\n\n /** Stop transporting a subdoc by guid (symmetric to the disposer returned\n * by `attachSubdoc`). Safe to call for an unknown guid.\n *\n * Pending `onSubdocSynced` waiters are FLUSHED (invoked) before the\n * listener set is dropped — otherwise a `BlobStore.get()` awaiting this\n * subdoc would hang forever when the blob is removed mid-flight. The\n * woken callback re-reads and resolves (to null for a gone subdoc). */\n detachSubdoc(guid: string): void {\n const e = this._subdocs.get(guid)\n if (!e) return\n e.doc.off('update', e.handler)\n this._subdocs.delete(guid)\n this._subdocBytes.delete(guid)\n const waiters = this._onSubdocSyncedListeners.get(guid)\n this._onSubdocSyncedListeners.delete(guid)\n if (waiters) for (const cb of [...waiters]) cb()\n }\n\n\n /** Internal — dispatched by Connector / Frame on every crdt* message. */\n handleMessage(msg: CrdtInboundMessage): void {\n switch (msg.type) {\n case 'crdtUpdate': {\n if (!msg.update) return\n const bytes = new Uint8Array(msg.update)\n Y.applyUpdate(this._doc, bytes, ORIGIN_REMOTE)\n // Snapshot the listener set before iterating: a callback may\n // unsubscribe (or add a new one) and live-Set mutation during\n // iteration is a sharp edge we don't want callers to step on.\n for (const cb of [...this._onUpdateListeners]) cb(bytes)\n // The update may depend on structs we never received (causal hole) —\n // recover by re-advertising our state vector. No-op when integrated\n // cleanly, which is the overwhelmingly common case.\n this._recoverIfPending()\n break\n }\n case 'crdtSyncComplete':\n // Once per attach cycle (see `_syncedFired`): the periodic reconcile\n // and pre-`silent` hosts re-send this; don't re-fire `onSynced`.\n if (this._syncedFired) break\n this._syncedFired = true\n for (const cb of [...this._onSyncedListeners]) cb()\n break\n case 'crdtAwarenessUpdate': {\n if (!msg.update) return\n const bytes = new Uint8Array(msg.update)\n applyAwarenessUpdate(this._awareness, bytes, ORIGIN_REMOTE)\n break\n }\n case 'crdtSubdocUpdate': {\n if (!msg.update) return\n const entry = this._subdocs.get(msg.guid)\n if (!entry) return // subdoc not attached (yet) — drop, peer will resync\n const bytes = new Uint8Array(msg.update)\n Y.applyUpdate(entry.doc, bytes, ORIGIN_REMOTE)\n const total = (this._subdocBytes.get(msg.guid) ?? 0) + bytes.byteLength\n this._subdocBytes.set(msg.guid, total)\n for (const cb of [...this._onSubdocBytesListeners]) cb(msg.guid, total)\n // A subdoc chunk can land on a causal hole too (an earlier chunk\n // dropped) — re-pull the whole subdoc so the hole closes.\n this._recoverSubdocIfPending(msg.guid)\n break\n }\n case 'crdtSubdocSyncComplete': {\n const set = this._onSubdocSyncedListeners.get(msg.guid)\n if (set) for (const cb of [...set]) cb()\n break\n }\n case 'crdtSubdocTransferProgress': {\n // Pure notification — no apply, no doc mutation. Snapshot the set so a\n // callback that unsubscribes mid-iteration doesn't trip the loop.\n for (const cb of [...this._onSubdocTransferProgressListeners])\n cb(msg.guid, msg.receivedBytes, msg.totalBytes)\n break\n }\n case 'crdtRequestSync': {\n // SyncStep2: a peer attached and wants our main doc state. If it\n // advertised a state vector, answer with ONLY the diff it is missing\n // (`encodeStateAsUpdate(doc, theirSV)`); otherwise ship the full\n // snapshot (legacy peer / a host that stripped the field). The host\n // no longer shadows main docs, so each current holder answering is\n // the only way bytes converge at late-join. Multiple/duplicate\n // responses are fine — Yjs merges idempotently. We deliberately do\n // NOT re-advertise our own SV here: both sides emit SyncStep1\n // independently on handshake, so a diff reply cannot start a loop.\n const remoteSv =\n msg.stateVector && (msg.stateVector as ArrayBuffer).byteLength > 0\n ? new Uint8Array(msg.stateVector)\n : undefined\n const diff = Y.encodeStateAsUpdate(this._doc, remoteSv)\n const buf = this._exactFitBuffer(diff)\n this.postMessage({ type: 'crdtUpdate', update: buf }, [buf])\n break\n }\n case 'crdtResync': {\n // The host saw a new peer connect and asks us to re-advertise. Re-emit\n // our SyncStep1 so the newcomer's holder set includes us. The leaf has\n // no peer-connect event of its own, which is why the host drives this.\n this._emitInitialHandshake()\n break\n }\n case 'crdtSubdocRequestSync': {\n // A peer wants this subdoc. If we have it attached, answer with its\n // full state as a normal subdoc update; the host fans it back.\n const entry = this._subdocs.get(msg.guid)\n if (!entry) return\n const full = Y.encodeStateAsUpdate(entry.doc)\n const buf = this._exactFitBuffer(full)\n this.postMessage(\n { type: 'crdtSubdocUpdate', guid: msg.guid, update: buf },\n [buf],\n )\n break\n }\n }\n }\n\n destroy(): void {\n if (this._destroyed) return\n this._destroyed = true\n if (this._resyncTimer !== null) {\n clearInterval(this._resyncTimer)\n this._resyncTimer = null\n }\n this._subdocsRecovering.clear()\n this._unbind()\n for (const guid of [...this._subdocs.keys()]) this.detachSubdoc(guid)\n this._onSubdocBytesListeners.clear()\n this._onSubdocTransferProgressListeners.clear()\n this._onSubdocSyncedListeners.clear()\n this._subdocBytes.clear()\n this._defaultAwareness.destroy()\n this._defaultDoc.destroy()\n this._onSyncedListeners.clear()\n this._onUpdateListeners.clear()\n }\n\n private _scheduleHandshake(): void {\n if (this._handshakeScheduled || this._destroyed) return\n this._handshakeScheduled = true\n queueMicrotask(() => {\n this._handshakeScheduled = false\n if (this._destroyed) return\n this._emitInitialHandshake()\n })\n }\n\n private _emitInitialHandshake(): void {\n // SyncStep1: advertise our current state vector so a holder answers with a\n // minimal diff. Host replies with that diff via `crdtUpdate` then\n // `crdtSyncComplete`, and with remote peers' awareness via\n // `crdtAwarenessUpdate`. The SV is small (no doc content) — sent by copy,\n // not transfer. An empty default doc encodes an empty SV ⇒ the holder\n // replies its full state, exactly today's behaviour.\n const sv = Y.encodeStateVector(this._doc)\n this.postMessage({\n type: 'crdtRequestSync',\n stateVector: this._exactFitBuffer(sv),\n })\n this.postMessage({ type: 'crdtRequestAwareness' })\n }\n\n /** After applying a remote update the doc may hold structs that depend on\n * state we never received — a CAUSAL HOLE. Yjs parks them in\n * `store.pendingStructs`: invisible, unrendered, and on a broadcast\n * passe-plat (no per-peer retransmit) never refilled on their own. Holes\n * form when an earlier update was dropped during connection ramp-up, or\n * when the sender created local structs under a suppressed origin (e.g.\n * derived writes made while applying a remote update, which the anti-loop\n * guard then skips) — both leave a gap in a client's clock sequence.\n * Re-advertise our state vector (SyncStep1); a holder answers with exactly\n * the diff we're missing and the hole closes — the same round-trip as the\n * initial handshake. Debounced so a burst of holey updates triggers one\n * re-sync, and we re-check `pendingStructs` after the delay so a hole that\n * closed on its own (a reordered tail arriving) costs nothing. */\n private _recoverIfPending(): void {\n if (this._destroyed || this._recoverScheduled) return\n if (!this._doc.store.pendingStructs) return\n this._recoverScheduled = true\n setTimeout(() => {\n this._recoverScheduled = false\n if (this._destroyed || !this._doc.store.pendingStructs) return\n const sv = Y.encodeStateVector(this._doc)\n this.postMessage({\n type: 'crdtRequestSync',\n stateVector: this._exactFitBuffer(sv),\n silent: true,\n })\n }, PENDING_RECOVERY_DEBOUNCE_MS)\n }\n\n /** Periodic safety-net reconcile (RESYNC_INTERVAL_MS). Re-advertise our main\n * state vector unconditionally — this is the ONLY thing that catches silent\n * divergence the event path misses (a lost tail with no `pendingStructs`, a\n * back-pressure eviction, a botched reconnect): the holder replies with a\n * diff, normally empty. `silent` keeps it off the `onSynced` path. Subdocs\n * are re-pulled only when they actually hold a hole (a full subdoc fetch is\n * expensive, so we don't poll them blindly). */\n private _periodicReconcile(): void {\n if (this._destroyed || this._doc === this._defaultDoc) return\n const sv = Y.encodeStateVector(this._doc)\n this.postMessage({\n type: 'crdtRequestSync',\n stateVector: this._exactFitBuffer(sv),\n silent: true,\n })\n for (const [guid, entry] of this._subdocs) {\n if (entry.doc.store.pendingStructs) this._recoverSubdocIfPending(guid)\n }\n }\n\n /** Subdoc analogue of `_recoverIfPending`: a subdoc update can land on a\n * causal hole (a missing earlier chunk) just like the main doc. Debounced\n * per guid; re-requests the subdoc's full state (subdocs carry no SV diff\n * on the wire — `crdtSubdocRequestSync` answers with the whole thing). */\n private _recoverSubdocIfPending(guid: string): void {\n if (this._destroyed || this._subdocsRecovering.has(guid)) return\n const entry = this._subdocs.get(guid)\n if (!entry || !entry.doc.store.pendingStructs) return\n this._subdocsRecovering.add(guid)\n setTimeout(() => {\n this._subdocsRecovering.delete(guid)\n const e = this._subdocs.get(guid)\n if (this._destroyed || !e || !e.doc.store.pendingStructs) return\n this.postMessage({ type: 'crdtSubdocRequestSync', guid })\n }, PENDING_RECOVERY_DEBOUNCE_MS)\n }\n\n /** Yjs' `'update'` event currently emits tight Uint8Arrays — but the\n * transferable optimization assumes `update.buffer` IS the payload.\n * Returning an exact-fit buffer (slicing when needed) makes that\n * assumption explicit and survives any future Yjs change that yields\n * a view over a larger backing buffer (e.g. a pooled scratch buffer).\n */\n private _exactFitBuffer(update: Uint8Array): ArrayBuffer {\n if (\n update.byteOffset === 0 &&\n update.byteLength === update.buffer.byteLength &&\n update.buffer instanceof ArrayBuffer\n ) {\n return update.buffer\n }\n // `slice()` returns a fresh ArrayBuffer of exactly the right size.\n return update.slice().buffer as ArrayBuffer\n }\n\n private _bind(): void {\n this._docUpdateHandler = (update, origin) => {\n if (origin === ORIGIN_REMOTE) return\n // Notify local listeners BEFORE postMessage. The host transport\n // (real window.postMessage, Worker.postMessage) treats the second\n // arg as transferables and detaches the buffer; any listener\n // running after would receive a Uint8Array backed by a detached\n // buffer (length 0 / throws on read). Snapshot the set so an\n // unsubscribe inside a callback doesn't trip iteration.\n for (const cb of [...this._onUpdateListeners]) cb(update)\n const buf = this._exactFitBuffer(update)\n this.postMessage({ type: 'crdtUpdate', update: buf }, [buf])\n }\n this._doc.on('update', this._docUpdateHandler)\n\n this._awarenessUpdateHandler = (change, origin) => {\n if (origin === ORIGIN_REMOTE) return\n const clients = change.added.concat(change.updated, change.removed)\n if (clients.length === 0) return\n const update = encodeAwarenessUpdate(this._awareness, clients)\n const buf = this._exactFitBuffer(update)\n this.postMessage({ type: 'crdtAwarenessUpdate', update: buf }, [buf])\n }\n this._awareness.on('update', this._awarenessUpdateHandler)\n }\n\n private _unbind(): void {\n if (this._docUpdateHandler) {\n this._doc.off('update', this._docUpdateHandler)\n this._docUpdateHandler = null\n }\n if (this._awarenessUpdateHandler) {\n this._awareness.off('update', this._awarenessUpdateHandler)\n this._awarenessUpdateHandler = null\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare the numeric core (major.minor.patch) of two version strings,
|
|
3
|
+
* ignoring any `-channel.build` suffix. Returns -1 if a < b, 0 if a == b,
|
|
4
|
+
* 1 if a > b.
|
|
5
|
+
*
|
|
6
|
+
* Suffix-insensitive ON PURPOSE — see `parseCore`. `isMinVersion` gates
|
|
7
|
+
* features/protocols on the peer-reported version, and every real
|
|
8
|
+
* la Vitre build is `X.Y.Z-channel.build`; a build of 26.5.1 has all of
|
|
9
|
+
* 26.5.1's features regardless of channel, so `26.5.1-mainX64.7130` must
|
|
10
|
+
* rank EQUAL to `26.5.1`, not below it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function compareVersions(a: string, b: string): -1 | 0 | 1;
|
|
13
|
+
/**
|
|
14
|
+
* Check if a version string is at least the given minimum version
|
|
15
|
+
* (core comparison — `-channel.build` suffix ignored, see compareVersions).
|
|
16
|
+
* Returns false if version is undefined/null.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* isMinVersion(connector.hostInformation.version, '26.2.3')
|
|
20
|
+
*/
|
|
21
|
+
export declare function isMinVersion(version: string | undefined | null, minVersion: string): boolean;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Parse the numeric core (major.minor.patch...) of a version string,
|
|
2
|
+
// IGNORING any `-suffix`.
|
|
3
|
+
//
|
|
4
|
+
// la Vitre's version convention is `X.Y.Z-<channel>.<build>`, e.g.
|
|
5
|
+
// `26.5.1-mainX64.7130`. The `-mainX64.7130` part is build metadata
|
|
6
|
+
// (release channel + CI build number), NOT a SemVer pre-release: a
|
|
7
|
+
// `26.5.1-mainX64.7130` build IS a fully-featured 26.5.1 (it ships every
|
|
8
|
+
// 26.5.1 feature, including the CRDT decoder). Treating the suffix as a
|
|
9
|
+
// SemVer §11 pre-release — i.e. ranking it BELOW `26.5.1` — made
|
|
10
|
+
// `isMinVersion(hostVersion, '26.5.1')` return false for every real
|
|
11
|
+
// la Vitre build (they all carry that suffix), which silently disabled
|
|
12
|
+
// CRDT emission everywhere. So feature/compat gates must compare the
|
|
13
|
+
// core only. Non-numeric or missing segments coerce to 0 (defensive: a
|
|
14
|
+
// host version is reported by the peer; we never want NaN to make a
|
|
15
|
+
// compat gate compare as equal).
|
|
16
|
+
function parseCore(v) {
|
|
17
|
+
const dash = v.indexOf('-');
|
|
18
|
+
const coreStr = dash === -1 ? v : v.slice(0, dash);
|
|
19
|
+
return coreStr.split('.').map((p) => {
|
|
20
|
+
const n = Number(p);
|
|
21
|
+
return Number.isFinite(n) ? n : 0;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Compare the numeric core (major.minor.patch) of two version strings,
|
|
26
|
+
* ignoring any `-channel.build` suffix. Returns -1 if a < b, 0 if a == b,
|
|
27
|
+
* 1 if a > b.
|
|
28
|
+
*
|
|
29
|
+
* Suffix-insensitive ON PURPOSE — see `parseCore`. `isMinVersion` gates
|
|
30
|
+
* features/protocols on the peer-reported version, and every real
|
|
31
|
+
* la Vitre build is `X.Y.Z-channel.build`; a build of 26.5.1 has all of
|
|
32
|
+
* 26.5.1's features regardless of channel, so `26.5.1-mainX64.7130` must
|
|
33
|
+
* rank EQUAL to `26.5.1`, not below it.
|
|
34
|
+
*/
|
|
35
|
+
export function compareVersions(a, b) {
|
|
36
|
+
const ca = parseCore(a);
|
|
37
|
+
const cb = parseCore(b);
|
|
38
|
+
const len = Math.max(ca.length, cb.length);
|
|
39
|
+
for (let i = 0; i < len; i++) {
|
|
40
|
+
const na = ca[i] ?? 0;
|
|
41
|
+
const nb = cb[i] ?? 0;
|
|
42
|
+
if (na < nb)
|
|
43
|
+
return -1;
|
|
44
|
+
if (na > nb)
|
|
45
|
+
return 1;
|
|
46
|
+
}
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if a version string is at least the given minimum version
|
|
51
|
+
* (core comparison — `-channel.build` suffix ignored, see compareVersions).
|
|
52
|
+
* Returns false if version is undefined/null.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* isMinVersion(connector.hostInformation.version, '26.2.3')
|
|
56
|
+
*/
|
|
57
|
+
export function isMinVersion(version, minVersion) {
|
|
58
|
+
if (!version)
|
|
59
|
+
return false;
|
|
60
|
+
return compareVersions(version, minVersion) >= 0;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=Version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Version.js","sourceRoot":"","sources":["../../Common/Version.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,0BAA0B;AAC1B,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,mEAAmE;AACnE,yEAAyE;AACzE,wEAAwE;AACxE,iEAAiE;AACjE,oEAAoE;AACpE,uEAAuE;AACvE,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,iCAAiC;AACjC,SAAS,SAAS,CAAC,CAAS;IAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC3B,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;IAClD,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAClC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACnB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;IACvB,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;IACvB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAA;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QACrB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC,CAAA;QACtB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,CAAC,CAAA;IACvB,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAkC,EAClC,UAAkB;IAElB,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,OAAO,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;AAClD,CAAC","sourcesContent":["// Parse the numeric core (major.minor.patch...) of a version string,\n// IGNORING any `-suffix`.\n//\n// la Vitre's version convention is `X.Y.Z-<channel>.<build>`, e.g.\n// `26.5.1-mainX64.7130`. The `-mainX64.7130` part is build metadata\n// (release channel + CI build number), NOT a SemVer pre-release: a\n// `26.5.1-mainX64.7130` build IS a fully-featured 26.5.1 (it ships every\n// 26.5.1 feature, including the CRDT decoder). Treating the suffix as a\n// SemVer §11 pre-release — i.e. ranking it BELOW `26.5.1` — made\n// `isMinVersion(hostVersion, '26.5.1')` return false for every real\n// la Vitre build (they all carry that suffix), which silently disabled\n// CRDT emission everywhere. So feature/compat gates must compare the\n// core only. Non-numeric or missing segments coerce to 0 (defensive: a\n// host version is reported by the peer; we never want NaN to make a\n// compat gate compare as equal).\nfunction parseCore(v: string): number[] {\n const dash = v.indexOf('-')\n const coreStr = dash === -1 ? v : v.slice(0, dash)\n return coreStr.split('.').map((p) => {\n const n = Number(p)\n return Number.isFinite(n) ? n : 0\n })\n}\n\n/**\n * Compare the numeric core (major.minor.patch) of two version strings,\n * ignoring any `-channel.build` suffix. Returns -1 if a < b, 0 if a == b,\n * 1 if a > b.\n *\n * Suffix-insensitive ON PURPOSE — see `parseCore`. `isMinVersion` gates\n * features/protocols on the peer-reported version, and every real\n * la Vitre build is `X.Y.Z-channel.build`; a build of 26.5.1 has all of\n * 26.5.1's features regardless of channel, so `26.5.1-mainX64.7130` must\n * rank EQUAL to `26.5.1`, not below it.\n */\nexport function compareVersions(a: string, b: string): -1 | 0 | 1 {\n const ca = parseCore(a)\n const cb = parseCore(b)\n const len = Math.max(ca.length, cb.length)\n for (let i = 0; i < len; i++) {\n const na = ca[i] ?? 0\n const nb = cb[i] ?? 0\n if (na < nb) return -1\n if (na > nb) return 1\n }\n return 0\n}\n\n/**\n * Check if a version string is at least the given minimum version\n * (core comparison — `-channel.build` suffix ignored, see compareVersions).\n * Returns false if version is undefined/null.\n *\n * @example\n * isMinVersion(connector.hostInformation.version, '26.2.3')\n */\nexport function isMinVersion(\n version: string | undefined | null,\n minVersion: string,\n): boolean {\n if (!version) return false\n return compareVersions(version, minVersion) >= 0\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './Common.Model.js';
|
|
2
|
+
export { compareVersions, isMinVersion } from './Version.js';
|
|
3
|
+
export { CrdtChannel, MIN_CRDT_HOST_VERSION, type CrdtAttachment, type CrdtInboundMessage, type CrdtOutboundMessage, type CrdtPostMessage, } from './CrdtChannel.js';
|
|
4
|
+
export { BlobStore } from './BlobStore.js';
|
|
5
|
+
export { AiChannel, MIN_AI_HOST_VERSION, type AiTool, type AiToolHandler, type AiInboundMessage, type AiOutboundMessage, type AiPostMessage, } from './AiChannel.js';
|
|
6
|
+
export declare const ensureDefaultValue: <T>(value: Partial<T> | null, defaultValue: T) => T;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from './Common.Model.js';
|
|
2
|
+
export { compareVersions, isMinVersion } from './Version.js';
|
|
3
|
+
export { CrdtChannel, MIN_CRDT_HOST_VERSION, } from './CrdtChannel.js';
|
|
4
|
+
export { BlobStore } from './BlobStore.js';
|
|
5
|
+
export { AiChannel, MIN_AI_HOST_VERSION, } from './AiChannel.js';
|
|
6
|
+
export const ensureDefaultValue = (value, defaultValue) => {
|
|
7
|
+
const ensureValue = (value, defaultValue) => {
|
|
8
|
+
if (defaultValue === undefined) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
if (typeof value !== typeof defaultValue) {
|
|
12
|
+
return defaultValue;
|
|
13
|
+
}
|
|
14
|
+
if (typeof defaultValue === 'object') {
|
|
15
|
+
if (Array.isArray(defaultValue)) {
|
|
16
|
+
if (!Array.isArray(value)) {
|
|
17
|
+
return defaultValue;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
value = value === undefined || value == null ? {} : value;
|
|
24
|
+
Object.keys(defaultValue).forEach((key) => {
|
|
25
|
+
value[key] = ensureDefaultValue(value[key], defaultValue[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
return ensureValue(value === undefined ? {} : value, defaultValue);
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@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AC,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","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 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}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { FileData, Language, MenuEntry, CompanionUser, CompanionInformation } from '../Common/index.js';
|
|
2
|
+
import type { CloseFrame, FrameOwnerChanged, OpenFrame, RootMenuEntry, SetFrameOwner } from '../Connector/Connector.Model.js';
|
|
3
|
+
import type { OpenFrameOptions } from '../Common/Common.Model.js';
|
|
4
|
+
export type { Language };
|
|
5
|
+
export type CompanionHostInformation = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
color: string;
|
|
9
|
+
teamDomain?: string;
|
|
10
|
+
teamName?: string;
|
|
11
|
+
space: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use `CompanionHostInformation`. The host of a companion
|
|
15
|
+
* connector IS the Vitre it is connected to, so `hostInformation` now
|
|
16
|
+
* carries the Vitre identity directly (this used to be nested under
|
|
17
|
+
* `CompanionHostInformation.connectedVitre`).
|
|
18
|
+
*/
|
|
19
|
+
export type ConnectedVitre = CompanionHostInformation;
|
|
20
|
+
export type { CompanionUser, CompanionInformation };
|
|
21
|
+
export type CompanionConnectorOptions = {
|
|
22
|
+
name: string;
|
|
23
|
+
iconUrl?: string;
|
|
24
|
+
menu?: RootMenuEntry[];
|
|
25
|
+
};
|
|
26
|
+
export type CompanionInitializeConnector = {
|
|
27
|
+
hostInfo: CompanionHostInformation;
|
|
28
|
+
companionInfo: CompanionInformation;
|
|
29
|
+
appId?: string;
|
|
30
|
+
};
|
|
31
|
+
export type CompanionConnectorInitialized = {
|
|
32
|
+
options: CompanionConnectorOptions;
|
|
33
|
+
};
|
|
34
|
+
export type SendMessageToVitreConnector = {
|
|
35
|
+
message: string;
|
|
36
|
+
fileData?: FileData;
|
|
37
|
+
};
|
|
38
|
+
export type MessageFromVitreConnector = {
|
|
39
|
+
message: string;
|
|
40
|
+
fileData?: FileData;
|
|
41
|
+
};
|
|
42
|
+
export type CompanionConnectorApiMessagesIn = ({
|
|
43
|
+
type: 'initialize';
|
|
44
|
+
} & CompanionInitializeConnector) | {
|
|
45
|
+
type: 'menuClicked';
|
|
46
|
+
menuId: string;
|
|
47
|
+
isChecked: boolean;
|
|
48
|
+
tag: any;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'frameLoaded';
|
|
51
|
+
frameConnectorId: string;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'frameUnloaded';
|
|
54
|
+
frameConnectorId: string;
|
|
55
|
+
} | ({
|
|
56
|
+
type: 'frameOwnerChanged';
|
|
57
|
+
} & FrameOwnerChanged) | ({
|
|
58
|
+
type: 'messageFromVitreConnector';
|
|
59
|
+
} & MessageFromVitreConnector);
|
|
60
|
+
export type SetMenuMode = 'replace' | 'append';
|
|
61
|
+
export type SetMenuOptions = {
|
|
62
|
+
mode?: SetMenuMode;
|
|
63
|
+
};
|
|
64
|
+
export type OpenCompanionFrame = {
|
|
65
|
+
frameConnectorId: string;
|
|
66
|
+
options: Omit<OpenFrameOptions, 'frameConnectorId'>;
|
|
67
|
+
};
|
|
68
|
+
export type CompanionConnectorApiMessagesOut = ({
|
|
69
|
+
type: 'connectorInitialized';
|
|
70
|
+
} & CompanionConnectorInitialized) | {
|
|
71
|
+
type: 'setRootMenu';
|
|
72
|
+
menu: RootMenuEntry[];
|
|
73
|
+
mode?: SetMenuMode;
|
|
74
|
+
} | ({
|
|
75
|
+
type: 'openFrame';
|
|
76
|
+
} & OpenFrame) | ({
|
|
77
|
+
type: 'closeFrame';
|
|
78
|
+
} & CloseFrame) | ({
|
|
79
|
+
type: 'setFrameOwner';
|
|
80
|
+
} & SetFrameOwner) | ({
|
|
81
|
+
type: 'openCompanionFrame';
|
|
82
|
+
} & OpenCompanionFrame) | ({
|
|
83
|
+
type: 'sendMessageToVitreConnector';
|
|
84
|
+
} & SendMessageToVitreConnector);
|
|
85
|
+
export type { MenuEntry, RootMenuEntry };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Distinct API for connectors hosted on a la Vitre Companion (the mobile /
|
|
2
|
+
// web app a user runs alongside the Vitre). The companion runs the same
|
|
3
|
+
// app code but in a very different context — it has no Vitre device, no
|
|
4
|
+
// shared space awareness, no notifications, no settings persistence, …
|
|
5
|
+
// Rather than exposing the full Vitre `Connector` API with empty stubs
|
|
6
|
+
// (which would silently swallow `setShareTarget`, `showNotification`,
|
|
7
|
+
// `setVitreSettings`, …), the companion connector exposes ONLY what
|
|
8
|
+
// genuinely applies here: declaring a menu, opening frames, and exchanging
|
|
9
|
+
// opaque app messages with the matching Vitre `Connector` for the same
|
|
10
|
+
// app.
|
|
11
|
+
//
|
|
12
|
+
// Anything not listed here is intentionally absent. The Vitre side has
|
|
13
|
+
// the same surface restriction in the other direction: it can
|
|
14
|
+
// `sendMessageToCompanionConnector` but companion connectors do NOT receive
|
|
15
|
+
// device events, knock-knocks, settings, etc.
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=CompanionConnector.Model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanionConnector.Model.js","sourceRoot":"","sources":["../../CompanionConnector/CompanionConnector.Model.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,wEAAwE;AACxE,uEAAuE;AACvE,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,uEAAuE;AACvE,OAAO;AACP,EAAE;AACF,uEAAuE;AACvE,8DAA8D;AAC9D,4EAA4E;AAC5E,8CAA8C","sourcesContent":["// Distinct API for connectors hosted on a la Vitre Companion (the mobile /\n// web app a user runs alongside the Vitre). The companion runs the same\n// app code but in a very different context — it has no Vitre device, no\n// shared space awareness, no notifications, no settings persistence, …\n// Rather than exposing the full Vitre `Connector` API with empty stubs\n// (which would silently swallow `setShareTarget`, `showNotification`,\n// `setVitreSettings`, …), the companion connector exposes ONLY what\n// genuinely applies here: declaring a menu, opening frames, and exchanging\n// opaque app messages with the matching Vitre `Connector` for the same\n// app.\n//\n// Anything not listed here is intentionally absent. The Vitre side has\n// the same surface restriction in the other direction: it can\n// `sendMessageToCompanionConnector` but companion connectors do NOT receive\n// device events, knock-knocks, settings, etc.\n\nimport type {\n FileData,\n Language,\n MenuEntry,\n CompanionUser,\n CompanionInformation,\n} from '../Common/index.js'\nimport type {\n CloseFrame,\n FrameOwnerChanged,\n OpenFrame,\n RootMenuEntry,\n SetFrameOwner,\n} from '../Connector/Connector.Model.js'\nimport type { OpenFrameOptions } from '../Common/Common.Model.js'\n\nexport type { Language }\n\n/// Snapshot of the authenticated companion user. Optional because the\n/// companion has guest sessions (no logged-in user) too.\n///\n/// Identity of the Vitre this companion is currently connected to. The\n/// connector only exists in the context of a live connection so this is\n/// always present once `initialize` fires.\n///\n/// `teamDomain` / `teamName` are optional because they aren't always\n/// known by the companion at the time the connector is initialized\n/// (e.g. guest sessions). The connector cannot observe later updates\n/// through this object — it is only refreshed on a new `initialize`.\n/// If you need the team identity and it is missing at init, fall back\n/// to `space` and accept the gap rather than waiting.\n/// The host of a companion connector IS the Vitre it is connected to, so\n/// `connector.hostInformation` carries the Vitre identity directly.\nexport type CompanionHostInformation = {\n id: string\n name: string\n color: string\n teamDomain?: string\n teamName?: string\n space: string\n}\n\n/**\n * @deprecated Use `CompanionHostInformation`. The host of a companion\n * connector IS the Vitre it is connected to, so `hostInformation` now\n * carries the Vitre identity directly (this used to be nested under\n * `CompanionHostInformation.connectedVitre`).\n */\nexport type ConnectedVitre = CompanionHostInformation\n\n/// `CompanionUser` / `CompanionInformation` now live in `Common` so the\n/// Frame module can surface `companionInformation` on companion-side frames\n/// too. Re-exported here for backward compatibility with existing\n/// `@lavitre/apps/CompanionConnector` consumers.\nexport type { CompanionUser, CompanionInformation }\n\n/// Declared by the companion connector at boot. Mirrors a subset of the\n/// Vitre `ConnectorOptions` — only `name`, `iconUrl` and `menu` apply.\n/// `shareTarget`, `settingsSchema`, `voiceActions` are Vitre-only and\n/// intentionally absent.\nexport type CompanionConnectorOptions = {\n name: string\n iconUrl?: string\n menu?: RootMenuEntry[]\n}\n\nexport type CompanionInitializeConnector = {\n hostInfo: CompanionHostInformation\n companionInfo: CompanionInformation\n /// Optional on purpose: a host may omit it for a generic connector that\n /// isn't tied to a single app. When present it is the routing key for\n /// `messageFromVitreConnector` / `sendMessageToVitreConnector`. The\n /// runtime warns (see `CompanionConnector` constructor) if it is missing\n /// so a misconfigured host surfaces at runtime rather than silently\n /// failing to route.\n appId?: string\n}\n\nexport type CompanionConnectorInitialized = {\n options: CompanionConnectorOptions\n}\n\n/// Payload a companion connector sends to the matching Vitre `Connector`\n/// (same `appId`). The Vitre connector receives the mirror message\n/// `messageFromCompanionConnector` with `fromCompanionId` set so it can\n/// reply targeted-back.\nexport type SendMessageToVitreConnector = {\n message: string\n fileData?: FileData\n}\n\n/// Payload the companion connector receives when its matching Vitre\n/// `Connector` calls `sendMessageToCompanionConnector`.\nexport type MessageFromVitreConnector = {\n message: string\n fileData?: FileData\n}\n\n/// Inbound to a companion connector (host → connector iframe).\nexport type CompanionConnectorApiMessagesIn =\n | ({ type: 'initialize' } & CompanionInitializeConnector)\n | {\n type: 'menuClicked'\n menuId: string\n isChecked: boolean\n tag: any\n }\n | { type: 'frameLoaded'; frameConnectorId: string }\n | { type: 'frameUnloaded'; frameConnectorId: string }\n | ({ type: 'frameOwnerChanged' } & FrameOwnerChanged)\n | ({ type: 'messageFromVitreConnector' } & MessageFromVitreConnector)\n\n/// How a companion connector's `setMenu` combines with the menu the\n/// Vitre-side `Connector` published for the same app.\n///\n/// `'replace'` (default, and the historical behaviour) — the companion\n/// connector's menu fully replaces the Vitre menu for this app on the\n/// companion: the Vitre-pushed entries are suppressed.\n///\n/// `'append'` — the companion connector's entries are added *after* the\n/// Vitre menu; both are rendered. Use this to contribute companion-only\n/// entries without hiding what the Vitre published.\nexport type SetMenuMode = 'replace' | 'append'\n\n/// Options for `CompanionConnector.setMenu`.\nexport type SetMenuOptions = {\n /// See `SetMenuMode`. Omitted ⇒ `'replace'`.\n mode?: SetMenuMode\n}\n\n/// Payload of the companion-side `openCompanionFrame` outbound. The\n/// companion's CompanionConnector calls this to ask the host to open\n/// (or focus) a frame full-page on this companion. If the Vitre is\n/// reachable the host also announces the open to it so a paired frame\n/// mounts there (same as the Vitre-driven open path, in reverse). The\n/// `frameConnectorId` MUST match the paired Vitre frame's id so the two\n/// frames bind on both sides.\nexport type OpenCompanionFrame = {\n frameConnectorId: string\n options: Omit<OpenFrameOptions, 'frameConnectorId'>\n}\n\n/// Outbound from a companion connector (connector iframe → host).\nexport type CompanionConnectorApiMessagesOut =\n | ({ type: 'connectorInitialized' } & CompanionConnectorInitialized)\n | { type: 'setRootMenu'; menu: RootMenuEntry[]; mode?: SetMenuMode }\n | ({ type: 'openFrame' } & OpenFrame)\n | ({ type: 'closeFrame' } & CloseFrame)\n | ({ type: 'setFrameOwner' } & SetFrameOwner)\n /// Open or focus a paired frame full-page on this companion. Distinct\n /// from `openFrame` because the host treats it as a navigation event\n /// (camera-share style) rather than a side-panel mount. See\n /// `OpenCompanionFrame`.\n | ({ type: 'openCompanionFrame' } & OpenCompanionFrame)\n | ({ type: 'sendMessageToVitreConnector' } & SendMessageToVitreConnector)\n\n/// Re-exported here for callers that want to declare `menu` entries\n/// without importing from two modules. `MenuEntry` originates in\n/// `../Common`; `RootMenuEntry` originates in `../Connector/Connector.Model`.\n/// Both are surfaced from here purely for caller convenience.\nexport type { MenuEntry, RootMenuEntry }\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FileData, OpenFrameOptions } from '../Common/index.js';
|
|
2
|
+
import type { RootMenuEntry } from '../Connector/Connector.Model.js';
|
|
3
|
+
import type { CompanionConnectorApiMessagesIn, CompanionConnectorApiMessagesOut, CompanionConnectorOptions, CompanionHostInformation, CompanionInformation, CompanionInitializeConnector, SetMenuOptions } from './CompanionConnector.Model.js';
|
|
4
|
+
export declare class CompanionConnector {
|
|
5
|
+
private readonly postMessage;
|
|
6
|
+
hostInformation: CompanionHostInformation;
|
|
7
|
+
companionInformation: CompanionInformation;
|
|
8
|
+
appId: string;
|
|
9
|
+
options: CompanionConnectorOptions;
|
|
10
|
+
onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void;
|
|
11
|
+
onFrameLoaded?: (frameConnectorId: string) => void;
|
|
12
|
+
onFrameUnloaded?: (frameConnectorId: string) => void;
|
|
13
|
+
onFrameOwnerChanged?: (frameConnectorId: string, owner: string) => void;
|
|
14
|
+
onMessageFromVitreConnector?: (message: string, fileData?: FileData) => void;
|
|
15
|
+
onMessageReceived?: (msg: CompanionConnectorApiMessagesIn) => void;
|
|
16
|
+
constructor(postMessage: (message: CompanionConnectorApiMessagesOut, transfer?: Transferable[]) => void, initMessage: CompanionInitializeConnector, options: CompanionConnectorOptions);
|
|
17
|
+
raiseMessage(msg: CompanionConnectorApiMessagesIn): void;
|
|
18
|
+
setMenu(menu: RootMenuEntry[], options?: SetMenuOptions): void;
|
|
19
|
+
openFrame(options: OpenFrameOptions): void;
|
|
20
|
+
closeFrame(frameConnectorId: string): void;
|
|
21
|
+
setFrameOwner(frameConnectorId: string, owner: string): void;
|
|
22
|
+
openCompanionFrame(frameConnectorId: string, options: Omit<OpenFrameOptions, 'frameConnectorId'>): void;
|
|
23
|
+
sendMessageToVitreConnector(message: string, fileData?: FileData): void;
|
|
24
|
+
}
|
|
25
|
+
type PostMessageOut = (message: CompanionConnectorApiMessagesOut, transfer?: Transferable[]) => void;
|
|
26
|
+
export declare function initializeCompanionConnector<T extends CompanionConnector>(buildOptions: (host: CompanionHostInformation) => CompanionConnectorOptions | Promise<CompanionConnectorOptions>, createConnector: new (postMessage: PostMessageOut, initMessage: CompanionInitializeConnector, options: CompanionConnectorOptions) => T): Promise<T>;
|
|
27
|
+
export declare function initializeCompanionConnector(buildOptions: (host: CompanionHostInformation) => CompanionConnectorOptions | Promise<CompanionConnectorOptions>): Promise<CompanionConnector>;
|
|
28
|
+
export {};
|