import type DatabaseCtor from "better-sqlite3";
import type { ModuleLifecycleContext } from "../../../contracts/module-contract.js";
import { SqliteDualPlanningStore } from "./sqlite-dual-planning.js";
import type { WorkspaceStatusSnapshot } from "../dashboard/dashboard-status.js";
type SqliteDb = InstanceType<typeof DatabaseCtor>;
/** Non-authoritative export path (ADR: optional YAML export window). */
export declare const WORKSPACE_STATUS_DB_EXPORT_RELATIVE = "docs/maintainers/data/workspace-kit-status.db-export.yaml";
export type KitWorkspaceStatusPublic = {
    workspaceRevision: number;
    currentKitPhase: string | null;
    nextKitPhase: string | null;
    activeFocus: string | null;
    lastUpdated: string | null;
    blockers: string[];
    pendingDecisions: string[];
    nextAgentActions: string[];
    updatedAt: string;
};
/** Open dual store so YAML seed + migrations run before workspace-status IO. */
export declare function openSqliteDualForWorkspaceStatus(ctx: ModuleLifecycleContext): SqliteDualPlanningStore;
export declare function workspaceStatusTableAvailable(db: SqliteDb): boolean;
export declare function readKitWorkspaceStatusRow(db: SqliteDb): KitWorkspaceStatusPublic | null;
export declare function kitWorkspaceStatusPublicToSnapshot(row: KitWorkspaceStatusPublic): WorkspaceStatusSnapshot;
/** Prefer kit SQLite workspace status (v10+). No YAML read. */
export declare function readWorkspaceStatusSnapshotFromDual(dual: SqliteDualPlanningStore): WorkspaceStatusSnapshot | null;
/**
 * Read `kit_workspace_status` into a dashboard snapshot (user_version ≥ 10).
 * Safe on a readonly better-sqlite3 handle (no migrations).
 */
export declare function readWorkspaceStatusSnapshotFromKitSqliteDb(db: SqliteDb): WorkspaceStatusSnapshot | null;
export type WorkspaceStatusUpdatePatch = {
    currentKitPhase?: string | null;
    nextKitPhase?: string | null;
    activeFocus?: string | null;
    lastUpdated?: string | null;
    blockers?: string[];
    pendingDecisions?: string[];
    nextAgentActions?: string[];
};
export declare function applyWorkspaceStatusPatchInMemory(cur: KitWorkspaceStatusPublic, patch: WorkspaceStatusUpdatePatch): KitWorkspaceStatusPublic;
/**
 * Replace workspace status from a full YAML snapshot (e.g. after phase-snapshot file write).
 * Bumps revision and appends an audit event.
 */
export declare function replaceWorkspaceStatusFromSnapshot(db: SqliteDb, snap: WorkspaceStatusSnapshot, event: {
    kind: string;
    actor?: string | null;
    command?: string | null;
}): {
    beforeRevision: number;
    afterRevision: number;
};
/**
 * Patch workspace status with optimistic concurrency on `expectedWorkspaceRevision`.
 */
export declare function patchWorkspaceStatus(db: SqliteDb, args: {
    expectedWorkspaceRevision: number;
    patch: WorkspaceStatusUpdatePatch;
    actor?: string | null;
    command?: string | null;
    eventKind?: string;
    details?: Record<string, unknown>;
}): {
    beforeRevision: number;
    afterRevision: number;
};
export declare function findWorkspaceStatusEventByClientMutationId(db: SqliteDb, command: string, clientMutationId: string): {
    payloadDigest?: string;
    revisionBefore: number;
    revisionAfter: number;
} | null;
export declare function listWorkspaceStatusEvents(db: SqliteDb, limit: number): Array<Record<string, unknown>>;
/** Build a small YAML document from DB row (export / dry-run). */
export declare function formatWorkspaceStatusDbExportYaml(row: KitWorkspaceStatusPublic): string;
export declare function writeWorkspaceStatusDbExport(ctx: ModuleLifecycleContext, yamlBody: string): string;
export {};
