import { MutationOptions, InsertInput, TextMutationReceipt, SDMutationReceipt, WriteRequest, StyleApplyInput, PlanReceipt, ReplaceInput, SelectionMutationRequest, StoryLocator } from '../../../../../../document-api/src/index.js';
import { Editor } from '../../core/Editor.js';
import { StoryRuntime } from '../story-runtime/story-types.js';
/**
 * Resolves a story runtime with write intent.
 *
 * Convenience wrapper around {@link resolveStoryRuntime} that always passes
 * `{ intent: 'write' }`, enabling story-specific resolvers to materialize
 * parts that do not yet exist (e.g., blank header/footer slots).
 *
 * @param editor  - The host (body) editor.
 * @param locator - Target story. `undefined` defaults to body.
 */
export declare function resolveWriteStoryRuntime(editor: Editor, locator?: StoryLocator): StoryRuntime;
/**
 * Disposes a story runtime only if it is ephemeral (non-cacheable).
 *
 * Cacheable runtimes are managed by the LRU cache and must not be
 * disposed by the caller. Ephemeral runtimes (e.g., temporary write-only
 * views) must be cleaned up after use to avoid leaking editor instances.
 *
 * @param runtime - The story runtime to conditionally dispose.
 */
export declare function disposeEphemeralWriteRuntime(runtime: StoryRuntime): void;
export declare const STUB_WHERE: {
    by: "select";
    select: {
        type: "text";
        pattern: string;
        mode: "exact";
    };
    require: "exactlyOne";
};
/**
 * Execute a domain command through the plan engine. Builds a single-step
 * CompiledPlan with a `domain.command` executor that delegates to the
 * provided handler closure.
 *
 * This is the bridge for all domain wrappers (create, lists, comments,
 * trackChanges) to route their mutations through executeCompiledPlan.
 */
export declare function executeDomainCommand(editor: Editor, handler: () => boolean, options?: {
    expectedRevision?: string;
    changeMode?: 'direct' | 'tracked';
}): PlanReceipt;
/**
 * Write wrapper for target-less insert operations only.
 *
 * Targeted inserts now route through `selectionMutationWrapper` via
 * `SelectionMutationAdapter`. This wrapper handles the no-target fallback
 * path that inserts at the document end.
 */
export declare function writeWrapper(editor: Editor, request: WriteRequest, options?: MutationOptions): TextMutationReceipt;
/** @deprecated Legacy wrapper. New code routes through selectionMutationWrapper. */
export declare function styleApplyWrapper(editor: Editor, input: StyleApplyInput, options?: MutationOptions): TextMutationReceipt;
/**
 * Bridge between SelectionMutationAdapter.execute() and the plan engine.
 *
 * Builds a one-step MutationPlan with a proper where clause and routes
 * it through compile → validate → execute. This is the single execution
 * path for all selection-based mutations (delete, replace-text, format.apply).
 */
export declare function selectionMutationWrapper(editor: Editor, request: SelectionMutationRequest, options?: MutationOptions): TextMutationReceipt;
/**
 * Insert structured content (markdown or html) at a target position.
 *
 * Routes through `executeDomainCommand` to enforce the revision guard.
 * Conversion (markdown → AST → PM, or html → insertContentAt) happens
 * inside the handler, so list-definition side effects only occur after the
 * revision check passes. HTML content is passed directly to
 * `editor.commands.insertContentAt` to avoid prosemirror-model dual-copy
 * issues when the Editor is loaded from a bundled dist.
 *
 * Tracked mode is explicitly rejected for structured content in this implementation.
 */
export declare function insertStructuredWrapper(editor: Editor, input: InsertInput, options?: MutationOptions): SDMutationReceipt;
/**
 * Entry point for structural replace operations.
 *
 * Detects structural (SDFragment) input and delegates to the structural
 * replace engine. Non-structural input is rejected (legacy replace uses writeWrapper).
 */
export declare function replaceStructuredWrapper(editor: Editor, input: ReplaceInput, options?: MutationOptions): SDMutationReceipt;
//# sourceMappingURL=plan-wrappers.d.ts.map