/**
 * Error thrown when code accesses turn state after its activity turn has ended.
 */
export declare class TurnStateSealedError extends Error {
    constructor();
}
/**
 * Mutable key/value state scoped to one activity turn.
 *
 * Values are persisted as JSON at the end of the turn when the state is dirty.
 * Instances are not thread-safe and must not be retained after the handler completes.
 */
export declare class TurnState {
    private readonly data;
    private dirty;
    private sealed;
    /**
     * Creates turn state from an optional persisted snapshot.
     * @param data Initial values. Loading values does not mark the state dirty.
     */
    constructor(data?: Readonly<Record<string, unknown>>);
    /** Whether this scope changed during the current turn. */
    get isDirty(): boolean;
    /** Whether this scope contains no values. */
    get isEmpty(): boolean;
    /** Whether this scope has been sealed after turn processing. */
    get isSealed(): boolean;
    /** Number of values in this scope. */
    get size(): number;
    /**
     * Reads a value from this scope.
     *
     * Reads never mark state dirty. Call `set` after changing mutable values so
     * the scope is persisted at the end of the turn.
     * @param key Stable key used to persist the value.
     */
    get<T = unknown>(key: string): T | undefined;
    /**
     * Writes a value and marks this scope dirty.
     *
     * Values must be JSON-serializable when the turn is saved.
     * @param key Stable key used to persist the value.
     * @param value Value to store.
     */
    set<T>(key: string, value: T): this;
    /**
     * Removes a value. The scope is marked dirty only when the key existed.
     * @param key Key to remove.
     */
    delete(key: string): boolean;
    /**
     * Tests whether a key exists in this scope.
     * @param key Key to test.
     */
    has(key: string): boolean;
    /** Removes every value. An already-empty scope remains clean. */
    clear(): void;
    /**
     * Returns a shallow record snapshot for persistence.
     *
     * This remains available after sealing so storage adapters can finish a save.
     */
    toRecord(): Record<string, unknown>;
    /** Seals this scope so handlers cannot access it after the turn completes. */
    seal(): void;
    /** @internal Marks this scope as synchronized with its backing store. */
    markClean(): void;
    private ensureActive;
}
