import type { Workflow } from "./workflow-store.js";
export type GateStatus = "pending" | "passed" | "failed";
export interface GateSignalStep {
    name: string;
    type: "command" | "llm-review" | "agent-qa" | "human-signoff";
    passed: boolean;
    skipped?: boolean;
    output: string;
    duration_ms: number;
    expect?: "success" | "failure";
    artifact?: {
        content: string;
        contentType: string;
        metadata?: Record<string, string>;
    };
    /**
     * Lifecycle status for in-flight rows. Set on initial enumeration by
     * `VerificationHarness.beginVerification()` so the gate-store signal
     * carries useful progress information from the moment it is recorded
     * (eliminating the gate-store ↔ activeVerifications race). Omitted on
     * fully-completed rows where `passed`/`skipped` already carry the verdict.
     */
    status?: "waiting" | "running" | "passed" | "failed" | "skipped";
    /** Optional phase number, mirrored from the workflow VerifyStep for ordering. */
    phase?: number;
}
export interface GateSignal {
    id: string;
    gateId: string;
    goalId: string;
    sessionId: string;
    timestamp: number;
    commitSha: string;
    metadata?: Record<string, string>;
    content?: string;
    contentVersion?: number;
    verification: {
        status: "running" | "passed" | "failed";
        steps: GateSignalStep[];
    };
}
export interface GateState {
    gateId: string;
    goalId: string;
    status: GateStatus;
    currentContent?: string;
    currentContentVersion?: number;
    currentMetadata?: Record<string, string>;
    signals: GateSignal[];
    /** Signals at or before this timestamp are ineligible for verification-step cache reuse. */
    verificationCacheInvalidatedAt?: number;
    updatedAt: number;
}
export interface GateResetResult {
    requestedGateId: string;
    affectedGateIds: string[];
    changedGateIds: string[];
    unchangedGateIds: string[];
    previousStatuses: Record<string, GateStatus>;
}
export declare class GateStore {
    private readonly storeDir;
    private readonly storeFile;
    private gates;
    /** Optional callback invoked when gate summary truth changes (for bumping goal generation). */
    onStatusChange?: (goalId: string, gateId: string) => void;
    constructor(stateDir: string);
    private load;
    private save;
    /** Initialize pending gate states for a new goal. */
    initGatesForGoal(goalId: string, gateIds: string[]): void;
    getGate(goalId: string, gateId: string): GateState | undefined;
    getGatesForGoal(goalId: string): GateState[];
    /** Append a signal to a gate's history. */
    recordSignal(signal: GateSignal): void;
    updateGateStatus(goalId: string, gateId: string, status: GateStatus): void;
    updateGateContent(goalId: string, gateId: string, content: string, version: number): void;
    updateGateMetadata(goalId: string, gateId: string, metadata: Record<string, string>): void;
    /** Update a signal's verification results by signal ID. */
    updateSignalVerification(signalId: string, verification: GateSignal["verification"]): void;
    private getDependentGateIds;
    /**
     * Reset a selected gate and every transitive dependent to pending.
     * Preserves signal history, current content, content version, and metadata.
     */
    resetGateAndDependents(goalId: string, gateId: string, workflow: Workflow): GateResetResult;
    /**
     * Reset downstream gates to pending when an upstream gate is re-signaled.
     * Uses the workflow definition to find transitive dependents.
     */
    cascadeReset(goalId: string, gateId: string, workflow: Workflow): void;
    /** Remove all gates for a goal (cleanup on goal deletion). */
    removeGoalGates(goalId: string): void;
}
//# sourceMappingURL=gate-store.d.ts.map