/**
 * Codex local storage — filesystem layer for installed codexes.
 *
 * Stores codex YAML + lesson markdown files at <root>/codexes/<id>/.
 * Engine sees none of this; it only stores the resulting lessons that
 * opensquid seeds via `lesson.create` with `authored_by: Pack(<id>)`.
 *
 * Resolution order for the data root:
 *   1. `rootDir` parameter (explicit override; used by tests)
 *   2. `OPENSQUID_HOME` env var
 *   3. `LOOP_HOME` env var (engine-shared)
 *   4. `~/.opensquid/` default
 */
import type { Codex } from "./types.js";
export type CodexStoreErrorCode = "NOT_FOUND" | "ALREADY_INSTALLED" | "INVALID_ID" | "READ_FAILED" | "WRITE_FAILED" | "PARSE_FAILED";
export declare class CodexStoreError extends Error {
    readonly code: CodexStoreErrorCode;
    readonly cause?: unknown | undefined;
    constructor(code: CodexStoreErrorCode, message: string, cause?: unknown | undefined);
}
/**
 * Resolve the opensquid data root.
 *
 * Order: explicit rootDir → OPENSQUID_HOME → LOOP_HOME → ~/.opensquid
 */
export declare function resolveDataRoot(rootDir?: string): string;
/** Directory holding all installed codexes. */
export declare function codexesDir(rootDir?: string): string;
/** Directory for a specific codex by id. */
export declare function codexDir(id: string, rootDir?: string): string;
/**
 * Validate a codex id: lowercase alphanumeric + `._-`, max 128 chars,
 * cannot start with `._-`. Prevents path traversal and ambiguous names.
 */
export declare function validateCodexId(id: string): void;
/**
 * Install a codex into local storage.
 *
 * Writes `codex.yaml` at the canonical path. If `force=false` and a
 * codex with this id is already installed, throws ALREADY_INSTALLED.
 */
export declare function installCodex(codex: Codex, options?: {
    rootDir?: string;
    force?: boolean;
}): Promise<{
    id: string;
    path: string;
}>;
/**
 * Load an installed codex by id.
 *
 * Reads + parses `codex.yaml`. Throws NOT_FOUND if not installed, or
 * PARSE_FAILED if the manifest is malformed.
 */
export declare function getCodex(id: string, options?: {
    rootDir?: string;
}): Promise<Codex>;
/**
 * List all installed codex ids.
 *
 * Scans `<root>/codexes/` for directories that contain a `codex.yaml`.
 * Directories without a manifest are skipped (partial installs, etc.).
 * Returns ids in sorted order.
 */
export declare function listCodexes(options?: {
    rootDir?: string;
}): Promise<string[]>;
/**
 * Remove an installed codex.
 *
 * Deletes the entire `<root>/codexes/<id>/` directory. Returns true if
 * the codex existed and was removed; false if it wasn't installed.
 * Does NOT touch the engine's lesson store — the caller is responsible
 * for retiring the codex's seeded lessons via the engine RPC first.
 */
export declare function removeCodex(id: string, options?: {
    rootDir?: string;
}): Promise<boolean>;
/**
 * Resolve the path to a content file (lesson body, reference doc) inside
 * a codex. Used by the orchestrator when bank_strategy requires lazy
 * fetching the full body. Does NOT read the file — just returns the path.
 */
export declare function codexContentPath(id: string, relativePath: string, options?: {
    rootDir?: string;
}): string;
//# sourceMappingURL=store.d.ts.map