/**
 * Writer - WARP writer abstraction for safe graph mutations.
 *
 * A Writer is the only way to mutate a WarpRuntime state. It owns a writerId
 * and maintains a single-writer chain under refs/warp/<graph>/writers/<writerId>.
 *
 * Key guarantees:
 * - Single-writer chain per writerId
 * - Ref-safe identity
 * - CAS-based updates to prevent concurrent forks
 * - Schema:2 only (Patch ops with OR-Set semantics)
 *
 * @module domain/warp/Writer
 * @see WARP Writer Spec v1
 */
import { PatchSession } from './PatchSession.ts';
import WriterError from '../errors/WriterError.ts';
import type VersionVector from '../crdt/VersionVector.ts';
import type Patch from '../types/Patch.ts';
import type WarpKernelPort from '../../ports/WarpKernelPort.ts';
import type PatchJournalPort from '../../ports/PatchJournalPort.ts';
import type LoggerPort from '../../ports/LoggerPort.ts';
import type BlobStoragePort from '../../ports/BlobStoragePort.ts';
import type CommitMessageCodecPort from '../../ports/CommitMessageCodecPort.ts';
import type { WarpState } from '../services/JoinReducer.ts';
export { WriterError };
type OnDeleteWithData = 'reject' | 'cascade' | 'warn';
interface WriterOptions {
    persistence: WarpKernelPort;
    graphName: string;
    writerId: string;
    versionVector: VersionVector;
    getCurrentState: () => WarpState | null;
    onCommitSuccess?: (result: {
        patch: Patch;
        sha: string;
    }) => void | Promise<void>;
    onDeleteWithData?: OnDeleteWithData;
    patchJournal: PatchJournalPort;
    commitMessageCodec?: CommitMessageCodecPort;
    logger?: LoggerPort;
    blobStorage?: BlobStoragePort;
}
/**
 * Writer class for creating and committing patches to a WARP graph.
 */
export declare class Writer {
    private _persistence;
    private _graphName;
    private _writerId;
    private _versionVector;
    private _getCurrentState;
    private _onCommitSuccess;
    private _onDeleteWithData;
    private _patchJournal;
    private _commitMessageCodec;
    private _logger;
    private _blobStorage;
    private _commitInProgress;
    constructor(opts: WriterOptions);
    /** Gets the writer ID. */
    get writerId(): string;
    /** Gets the graph name. */
    get graphName(): string;
    /**
     * Gets the current writer head SHA.
     *
     * @returns The tip SHA or null if no commits yet
     */
    head(): Promise<string | null>;
    /**
     * Begins a new patch session.
     *
     * Reads the current writer head and captures it as the expected parent
     * for CAS-based commit.
     */
    beginPatch(): Promise<PatchSession>;
    /**
     * Constructs PatchBuilder options from Writer state.
     */
    private _buildPatchOpts;
    /**
     * Reads the previous commit's Lamport timestamp and returns the next value.
     */
    private _resolveNextLamport;
    /**
     * Convenience method to build and commit a patch in one call.
     */
    commitPatch(build: (p: PatchSession) => void | Promise<void>): Promise<string>;
}
