import { Editor } from '../../core/Editor.js';
import { StoryLocator } from '@superdoc/document-api';
/** Broad category of a content story. */
export type StoryKind = 'body' | 'headerFooter' | 'note';
/**
 * A resolved story runtime — provides the editor and metadata needed
 * to execute document-api operations against a specific story.
 *
 * Runtimes are cached by {@link storyKey} and may be evicted when the
 * cache reaches capacity. The optional {@link dispose} callback is invoked
 * on eviction to release resources.
 */
export interface StoryRuntime {
    /** The locator that was resolved to produce this runtime. */
    locator: StoryLocator;
    /** Canonical cache key for this story (deterministic, one-way). */
    storyKey: string;
    /** The ProseMirror editor for this story's content. */
    editor: Editor;
    /** Broad category of the story. */
    kind: StoryKind;
    /**
     * Whether this runtime may be stored in the shared runtime cache.
     *
     * Defaults to `true` when omitted. Runtimes that represent a temporary
     * write-only view of a story that does not yet exist should set this to
     * `false` so dry-runs and failed writes do not pollute later reads.
     */
    cacheable?: boolean;
    /** Called when the runtime is being disposed (evicted or invalidated). */
    dispose?: () => void;
    /**
     * Persists the story editor's current state back to the canonical OOXML part.
     *
     * Called after a successful mutation to sync changes from the in-memory
     * ProseMirror state to the document's parts storage. For body stories
     * this is a no-op (ProseMirror handles persistence directly). For
     * non-body stories, this writes back through `mutatePart` / `exportSubEditorToPart`.
     *
     * @param hostEditor - The host (body) editor, needed for parts runtime access.
     */
    commit?: (hostEditor: Editor) => void;
    /**
     * Persists the provided editor state back to the canonical OOXML part.
     *
     * This is the session-aware variant of {@link commit}. It is used when the
     * interactive editing session mounts a different editor instance than the
     * runtime originally resolved (for example, a hidden-host editor created from
     * a cached headless runtime). When omitted, callers may fall back to
     * {@link commit}, which commits the runtime's own editor.
     *
     * @param hostEditor - The host (body) editor.
     * @param storyEditor - The editor whose state should be exported.
     */
    commitEditor?: (hostEditor: Editor, storyEditor: Editor) => void;
}
//# sourceMappingURL=story-types.d.ts.map