import * as Y from "yjs"; export declare const LIVE_COPY_TASK: { readonly read: "liveCopy.read"; readonly apply: "liveCopy.apply"; readonly seed: "liveCopy.seed"; readonly edit: "liveCopy.edit"; }; /** * Y.Map holding the saved-body revision a legacy page's live doc last took in, * with that revision's Markdown. It is bookkeeping, not page content, so a live * copy may hold it next to the field. */ export declare const SNAPSHOT_ADOPTION_MAP = "agentNativeSnapshotAdoption"; export interface LiveCopyTaskRefusal { kind: "refused"; reason: string; detail?: string; } type MaybePromise = T | Promise; export interface LiveCopyTaskHandlers { /** * The body's text. Return a refusal for content the text cannot carry; * never drop it. Must not edit `doc`. */ derive(doc: Y.Doc, field: string): MaybePromise; /** Writes the first content for `source` into `field` of an empty doc. */ seed?(doc: Y.Doc, field: string, source: string): MaybePromise; /** Server edits by name, run by `mutateLiveCopy`. */ edits?: Record MaybePromise>; } export type LiveCopyTaskFailureCode = "malformed_state" | "unsupported_content" | "state_too_large" | "not_seeded" | "derive_refused" | "derive_failed" | "build_refused" | "build_failed"; /** * What brings a client up to date without decoding on the request thread: * the state's vector, compared by bytes, and the deletions a client at that * vector may still lack, since deleting never moves a state vector. */ export interface LiveCopyCatchUp { stateVector: Uint8Array; deletions: Uint8Array; } export type LiveCopyTaskResult = { kind: "failed"; code: LiveCopyTaskFailureCode; reason: string; message: string; } | ({ kind: "unseeded"; } & LiveCopyCatchUp) | ({ kind: "live"; text?: string; } & LiveCopyCatchUp) | { kind: "unchanged"; text?: string; } | ({ kind: "changed"; state: Uint8Array; text: string; update?: Uint8Array; } & LiveCopyCatchUp); interface TaskInput { field: string; maxStateBytes: number; } export interface LiveCopyReadInput extends TaskInput { state: Uint8Array; derive: boolean; } export interface LiveCopyApplyInput extends TaskInput { state: Uint8Array | null; update: Uint8Array; } export interface LiveCopySeedInput extends TaskInput { state: Uint8Array | null; source: string; } export interface LiveCopyEditInput extends TaskInput { state: Uint8Array; edit: string; input: unknown; } /** * The tasks a live copy's runner must host. Export the result as `tasks` * from the module the runner bundles, alongside any tasks of your own. */ export declare function defineLiveCopyTasks(handlers: LiveCopyTaskHandlers): Record Promise>; export {};