/**
 * TemporalQuery - CTL*-style temporal operators over WARP graph history.
 *
 * Implements `always` and `eventually` temporal operators from Paper IV
 * (Echo and the WARP Core). These operators evaluate predicates across
 * the graph's history by replaying patches incrementally and checking
 * the predicate at each tick boundary.
 *
 * ## Temporal Operators
 *
 * - **always(nodeId, predicate, { since })**: True iff the predicate holds
 *   at every tick since `since` where the node exists.
 * - **eventually(nodeId, predicate, { since })**: True iff the predicate holds
 *   at some tick since `since`.
 *
 * ## Implementation
 *
 * Both operators collect all patches, sort them by causal order (same as
 * materialization), then apply patches one at a time. After each patch
 * application, a node snapshot is extracted and passed to the predicate.
 *
 * The "tick" corresponds to a patch's Lamport timestamp. The `since` option
 * filters out patches with Lamport timestamps below the threshold.
 *
 * @module domain/services/TemporalQuery
 * @see Paper IV - Echo and the WARP Core (CTL* temporal logic on histories)
 */
import WarpState from './state/WarpState.ts';
import type Patch from '../types/Patch.ts';
/**
 * A node snapshot passed to temporal predicates.
 */
export interface NodeSnapshot {
    id: string;
    exists: boolean;
    props: Record<string, unknown>;
}
/**
 * A patch with its SHA, used during replay.
 */
interface PatchEntry {
    patch: Patch;
    sha: string;
}
/**
 * A checkpoint that can be used to start replay from a known-good state.
 */
interface Checkpoint {
    state: WarpState;
    maxLamport: number;
}
/**
 * TemporalQuery provides temporal logic operators over graph history.
 *
 * Constructed by WarpRuntime and exposed via `graph.temporal`.
 * Both methods are async because they need to load patches from Git.
 */
export declare class TemporalQuery {
    private readonly _loadAllPatches;
    private readonly _loadCheckpoint;
    /**
     * Creates a TemporalQuery with patch-loading and optional checkpoint functions.
     */
    constructor(options: {
        loadAllPatches: () => Promise<PatchEntry[]>;
        loadCheckpoint?: () => Promise<Checkpoint | null>;
    });
    /**
     * Tests whether a predicate holds at every tick since `since`.
     *
     * Replays patches from `since` to current. At each tick boundary,
     * builds the node snapshot and tests the predicate. Returns true only
     * if the predicate returned true at every tick where the node existed.
     *
     * Returns false if the node never existed in the range.
     *
     * @param nodeId - The node ID to evaluate
     * @param predicate - Predicate receiving node snapshot `{ id, exists, props }`. Should return boolean.
     * @param options - Options
     * @returns True if predicate held at every tick
     *
     * @example
     * const result = await graph.temporal.always(
     *   'user:alice',
     *   n => n.props.status === 'active',
     *   { since: 0 }
     * );
     */
    always(nodeId: string, predicate: (snapshot: NodeSnapshot) => boolean, options?: {
        since?: number;
    }): Promise<boolean>;
    /**
     * Tests whether a predicate holds at some tick since `since`.
     *
     * Replays patches from `since` to current. At each tick boundary,
     * builds the node snapshot and tests the predicate. Returns true as
     * soon as the predicate returns true at any tick.
     *
     * @param nodeId - The node ID to evaluate
     * @param predicate - Predicate receiving node snapshot `{ id, exists, props }`. Should return boolean.
     * @param options - Options
     * @returns True if predicate held at any tick
     *
     * @example
     * const result = await graph.temporal.eventually(
     *   'user:alice',
     *   n => n.props.status === 'merged',
     *   { since: 0 }
     * );
     */
    eventually(nodeId: string, predicate: (snapshot: NodeSnapshot) => boolean, options?: {
        since?: number;
    }): Promise<boolean>;
    /**
     * Resolves the initial state and start index for temporal replay.
     *
     * When `since > 0` and a checkpoint is available with
     * `maxLamport <= since`, uses the checkpoint state and skips
     * patches already covered by it. Otherwise falls back to an
     * empty state starting from index 0.
     *
     * **Checkpoint `maxLamport` invariant**: The checkpoint's `maxLamport` value
     * MUST represent a fully-closed Lamport tick — i.e. ALL patches with
     * `lamport <= maxLamport` are included in the checkpoint state. The
     * `findIndex` below uses strict `>` to locate the first patch *after* the
     * checkpoint boundary. If a checkpoint were created mid-tick (some but not
     * all patches at a given Lamport value included), this would silently skip
     * the remaining same-tick patches. Checkpoint creators MUST guarantee the
     * all-or-nothing inclusion property for any given Lamport tick.
     *
     * @param allPatches - All patches in causal order
     * @param since - Minimum Lamport tick
     * @returns Start state, start index, and checkpoint max lamport
     */
    private _resolveStart;
}
export {};
