/**
 * The engine's storage seats as ONE backend contract.
 *
 * A backend is the thing a deployment constructs over one storage — a data root, a database — and whose
 * members it wires into {@link import("./runner-deps.js").RunnerDeps}. Before this contract the shape of
 * "a backend" was whatever the file family's aggregate class happened to carry, so a second backend had
 * nothing to implement and a host composing several had nothing to type its engine half against. The
 * shape now lives here, once: the bundled file backend implements it, and so does any other.
 *
 * Membership rule: a member is an engine seat whose durable store lives in the backend's storage and that
 * every backend supplies, the bundled file backend included — `retention` is the one optional member,
 * and a seat the file backend does not supply is not a member. Each member's NAME is its `RunnerDeps` seat and its TYPE is
 * that seat's store type, so each member wires into its seat as it is (name the seats; a backend object may carry
 * members that are not seats, so it is not spread). The member-to-seat correspondence is pinned in both directions
 * by the test suite, together with the classification of the store-shaped seats that are not members. One reading per member:
 *  - `fileHistoryStore` is the store only. The seat also accepts the word `"disabled"`; that word is the
 *    deployment's wiring decision, not something a storage supplies.
 *
 * A host's own product stores do not belong here: a host that keeps more stores beside these composes
 * an `EngineStorageBackend` with its own, rather than widening this contract.
 */
import type { SessionStore } from "./session.js";
import type { CheckpointStore } from "./checkpoint-store.js";
import type { ToolResultStore } from "./tool-result-store.js";
import type { SessionPolicyStore } from "./session-policy-store.js";
import type { WorkflowJournalStore } from "./workflow-journal-store.js";
import type { UsageWindowStore } from "./usage-window-store.js";
import type { BackgroundAgentStore } from "./background-agent-store.js";
import type { MailboxStore } from "./mailbox-store.js";
import type { FileHistoryStore } from "./file-history-store.js";
import type { ManagedRetentionCapability } from "./retention.js";
import type { RosterStore } from "../agents/roster-store.js";
export interface EngineStorageBackend {
    /** `RunnerDeps.sessionStore`. */
    readonly sessionStore: SessionStore;
    /** `RunnerDeps.checkpointStore`. */
    readonly checkpointStore: CheckpointStore;
    /** `RunnerDeps.toolResultStore`. */
    readonly toolResultStore: ToolResultStore;
    /** `RunnerDeps.sessionPolicyStore`. */
    readonly sessionPolicyStore: SessionPolicyStore;
    /** `RunnerDeps.workflowJournalStore`. */
    readonly workflowJournalStore: WorkflowJournalStore;
    /** `RunnerDeps.usageWindowStore`. */
    readonly usageWindowStore: UsageWindowStore;
    /** `RunnerDeps.backgroundAgentStore` — and the same instance wherever a deployment-composed Agent tool
     *  takes its agent store (the seat's pairing rule). */
    readonly backgroundAgentStore: BackgroundAgentStore;
    /** `RunnerDeps.mailboxStore` (same single-instance pairing as `backgroundAgentStore`). */
    readonly mailboxStore: MailboxStore;
    /** `RunnerDeps.rosterStore`. */
    readonly rosterStore: RosterStore;
    /** `RunnerDeps.fileHistoryStore` — the store; the seat's `"disabled"` word is not a backend's to give. */
    readonly fileHistoryStore: FileHistoryStore;
    /**
     * The backend-level managed-retention executor, when this backend has one.
     *
     * Retention execution belongs to the backend, not to each store: the capability's session deletion
     * re-checks live references under the session's exclusion
     * ({@link import("./retention.js").ManagedRetentionCapability.deleteExpiredSessions}), and those references are held by several
     * stores at once (pending checkpoints, background-agent rows, workflow runs), so only a party that
     * spans them can honor it. Absent ⇒ this backend executes no managed retention — the bundled file
     * backend is one such backend.
     *
     * Not the same field as a store's `retention`: on a store that member is the declaration WORD
     * ({@link import("./retention.js").RetentionDeclaring}, `"managed" | "none"`); here it is the
     * executor OBJECT. A backend is not a store: handed to `assertRetentionCapability` as one, a backend
     * that carries this member is refused as an unparseable declaration.
     */
    readonly retention?: ManagedRetentionCapability;
    /** Release everything the backend holds (handles, locks) so a successor over the same storage can open
     *  it. Call it at shutdown. */
    dispose(): Promise<void>;
}
