/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module ai/aisdk/documentsnapshot * @publicApi */ import { type AIEditorConfig } from "../aicore/utils/geteditorconfig.js"; /** * A captured selection range as character offsets into its root's serialized HTML. */ export interface DocumentCompareSnapshotRange { start: number; end: number; } /** * The captured before-state of a document plus the metadata to reconcile changes later. * The snapshot is a plain object and is safe to `JSON.stringify`, send between the frontend and backend, store, parse, * and later feed back into `DocumentCompare#diffSnapshot`. */ export interface DocumentCompareSnapshot { /** * The collaboration channel the snapshot was captured from. */ channelId: string; /** * The editing session the snapshot was captured in. */ sessionId: string; /** * The document version the snapshot was captured at. */ version: number; /** * Each root's content, serialized to HTML, keyed by root name (excluding `$graveyard`). */ content: Record; /** * Each root's captured selection as character offsets into its HTML, keyed by root name (omitted if root has no selection). */ selection: Record>; /** * The editor's feature configuration at capture time, so external processing can interpret the serialized HTML * within the editor's capabilities. */ editorConfig: AIEditorConfig; }