import type { BrokerMultiNodeStatus, IntercomBrokerControl } from "../intercom-broker-control.js"; import { type StorageSelection } from "./provider.js"; import { type StorageSettingsSelection } from "./selection.js"; export type StorageStatusDomain = "sessions" | "journal" | "intercom"; /** How long one connectivity check may take, from loading the adapter to the answer of its `SELECT 1`. */ export declare const STORAGE_PROBE_TIMEOUT_MS = 15000; export interface StorageProbe { readonly adapter?: { readonly module: string; readonly loaded: boolean; readonly detail?: string; }; readonly connection: { readonly status: "ok" | "failed" | "skipped"; readonly detail: string; }; /** The adapter loaded but has no `openDatabase` hook, so nothing was opened. */ readonly noDatabaseHook?: true; /** The domain whose identical selection was already checked. */ readonly sameAs?: StorageStatusDomain; } export interface DomainStatus { readonly domain: StorageStatusDomain; /** The effective selection, for example `adapter @x/y (prefix t_)`; `off` for Intercom without a shared one. */ readonly selection: string; /** Where the selection comes from, for example `ATOMIC_STORAGE`, `global settings: storage`, or `default`. */ readonly source: string; /** Lower-precedence selections that are set but overridden by `source`. */ readonly overridden: readonly string[]; /** An invalid selection; Atomic stops rather than choosing another store. */ readonly error?: string; readonly probe?: StorageProbe; /** Intercom: whether a broker started now would route across machines, and why not. */ readonly multiNode?: string; /** Intercom: host names of the brokers live in the shared database, when it could be read. */ readonly liveBrokers?: readonly string[]; } export interface BrokerStatusSection { readonly state: "stopped" | "running" | "legacy" | "unknown"; readonly pid?: number; readonly sessions?: number; /** Whether the running broker reads the selection a broker started now would read. */ readonly matchesCurrent?: boolean; readonly source?: "env" | "settings"; readonly multiNode?: BrokerMultiNodeStatus; readonly multiNodeLine?: string; /** Why the broker could not be asked. */ readonly error?: string; } export interface StorageStatus { readonly agentDir: string; readonly cwd: string; readonly projectTrusted: boolean; readonly domains: readonly DomainStatus[]; readonly notes: readonly string[]; readonly broker?: BrokerStatusSection; } export interface StorageStatusOptions { readonly cwd: string; readonly agentDir: string; /** Load adapters and run a `SELECT 1` on each selected database. */ readonly probe: boolean; /** Ask the running Intercom broker about itself; needs `probe`-independent access to the bundled Intercom package. */ readonly control?: IntercomBrokerControl; } /** An error and its direct cause on one line, for status output (a module-resolution "Require stack" is dropped). */ export declare function describeStorageError(error: Error | object | string | undefined): string; export declare function describeStorageSelection(selection: StorageSelection): string; /** * Which storage each domain selects and where that selection comes from, following the same precedence as * sessions, the workflows extension and the Intercom broker; with `probe`, whether each adapter loads and each * database answers, and what the running broker uses. */ export declare function collectStorageStatus(options: StorageStatusOptions): Promise; /** * The launch warning for a shared storage adapter this executable cannot load: the Intercom broker would leave * multi-node routing off with only a `broker.log` line. Load-only: no database is opened. `undefined` when the * shared selection names no adapter or it loads. */ export declare function checkSharedStorageAdapter(agentDir: string, globalStorage: StorageSettingsSelection | undefined): Promise; //# sourceMappingURL=storage-status.d.ts.map