import type Database from "better-sqlite3";
import { type PlanArtifactStatus, type PlanArtifactV1 } from "./plan-artifact-v1.js";
/**
 * Canonical PlanArtifact JSON files (gitignored workspace data):
 *   `.workspace-kit/planning/plan-artifacts/{planId}/artifact.v{version}.json`
 *
 * Fast dashboard / list pointer in planning SQLite module-state:
 *   module id `planning-plan-artifact:{planId}` → {@link PlanArtifactIndexStateV1}
 */
export declare const PLAN_ARTIFACT_ROOT_REL: string;
export declare const PLAN_ARTIFACT_MODULE_ID_PREFIX = "planning-plan-artifact:";
/** Redacted summary index; full WBS lives in the JSON file only. */
export type PlanArtifactIndexStateV1 = {
    schemaVersion: 1;
    planId: string;
    currentVersion: number;
    planRef: string;
    status: PlanArtifactStatus;
    title: string;
    planningType: string;
    updatedAt: string;
    wbsRowCount: number;
    openQuestionCount: number;
};
export type PlanArtifactStoragePaths = {
    rootRelative: string;
    rootAbsolute: string;
    planDirRelative: string;
    planDirAbsolute: string;
    artifactFileRelative: (version: number) => string;
    artifactFileAbsolute: (version: number) => string;
    moduleId: string;
};
export declare function planArtifactModuleId(planId: string): string;
export declare function getPlanArtifactStoragePaths(workspacePath: string, planId: string): PlanArtifactStoragePaths;
export declare function upsertPlanArtifactIndexOnDatabase(db: Database.Database, moduleId: string, index: PlanArtifactIndexStateV1): void;
export declare function resolveLatestPlanArtifactVersion(workspacePath: string, planId: string): number | null;
export type WritePlanArtifactVersionOptions = {
    effectiveConfig?: Record<string, unknown>;
    /** Reuse an open planning SQLite handle to avoid multi-connection `SQLITE_BUSY`. */
    sqliteDb?: Database.Database;
};
export declare function writePlanArtifactVersion(workspacePath: string, artifact: PlanArtifactV1, options?: WritePlanArtifactVersionOptions): PlanArtifactStoragePaths;
export declare function readPlanArtifactVersion(workspacePath: string, planId: string, version: number): PlanArtifactV1 | null;
export declare function readLatestPlanArtifact(workspacePath: string, planId: string): PlanArtifactV1 | null;
export declare function readPlanArtifactIndex(workspacePath: string, planId: string, effectiveConfig?: Record<string, unknown>): PlanArtifactIndexStateV1 | null;
/**
 * Persist a new version (increments from latest on disk). Caller supplies merged document body.
 */
export declare function writeNextPlanArtifactVersion(workspacePath: string, artifact: PlanArtifactV1, options?: WritePlanArtifactVersionOptions): {
    artifact: PlanArtifactV1;
    paths: PlanArtifactStoragePaths;
};
export declare function listPlanArtifactSummaries(workspacePath: string, effectiveConfig?: Record<string, unknown>): PlanArtifactIndexStateV1[];
