/**
 * PatchSession - Fluent patch builder with CAS-safe commit.
 *
 * A PatchSession is created by Writer.beginPatch() and provides a fluent API
 * for building graph mutations. The commit uses compare-and-swap semantics
 * to prevent concurrent forks of the writer chain.
 *
 * @module domain/warp/PatchSession
 * @see WARP Writer Spec v1
 */
import type { PatchBuilder } from '../services/PatchBuilder.ts';
import type RefPort from '../../ports/RefPort.ts';
import type Patch from '../types/Patch.ts';
interface PatchSessionOptions {
    builder: PatchBuilder;
    persistence: RefPort;
    graphName: string;
    writerId: string;
    expectedOldHead: string | null;
}
/**
 * Fluent patch session for building and committing graph mutations.
 */
export declare class PatchSession {
    private _builder;
    private _graphName;
    private _writerId;
    private _expectedOldHead;
    private _committed;
    constructor({ builder, persistence: _persistence, graphName, writerId, expectedOldHead }: PatchSessionOptions);
    /**
     * Gets the expected old head SHA (for testing).
     * @internal
     */
    get _expectedOldHeadForTest(): string | null;
    /** Adds a node to the graph. */
    addNode(nodeId: string): this;
    /**
     * Removes a node from the graph.
     * Uses observed dots from materialized state for OR-Set removal.
     */
    removeNode(nodeId: string): this;
    /** Adds an edge between two nodes. */
    addEdge(from: string, to: string, label: string): this;
    /**
     * Removes an edge between two nodes.
     * Uses observed dots from materialized state for OR-Set removal.
     */
    removeEdge(from: string, to: string, label: string): this;
    /** Sets a property on a node. */
    setProperty(nodeId: string, key: string, value: unknown): this;
    /** Sets a property on an edge. */
    setEdgeProperty(from: string, to: string, label: string, key: string, value: unknown): this;
    /** Attaches content to a node. */
    attachContent(nodeId: string, content: Uint8Array | string, metadata?: {
        mime?: string | null;
        size?: number | null;
    }): Promise<this>;
    /** Clears content from a node. */
    clearContent(nodeId: string): this;
    /** Attaches content to an edge. */
    attachEdgeContent(from: string, to: string, label: string, content: Uint8Array | string, metadata?: {
        mime?: string | null;
        size?: number | null;
    }): Promise<this>;
    /** Clears content from an edge. */
    clearEdgeContent(from: string, to: string, label: string): this;
    /** Builds the Patch object without committing. */
    build(): Patch;
    /**
     * Commits the patch to the graph with CAS protection.
     *
     * @returns The commit SHA of the new patch
     */
    commit(): Promise<string>;
    /** Ensures the patch has at least one operation. */
    private _ensureNotEmpty;
    /** Gets the number of operations in this patch. */
    get opCount(): number;
    /** Ensures the session hasn't been committed yet. */
    private _ensureNotCommitted;
}
export {};
