import type { SceneRegion } from "@uptimizr/schema"; import { type ApiKeyCapability, type ApiKeyRecord, type CreateApiKeyOptions, type SceneRegionRecord } from "@uptimizr/db"; /** * The persistent stores the `uptimizr` CLI can bootstrap (`init` / `new-project` * / `migrate`). Mirrors the `COLLECTOR_STORE` values `serve` accepts, minus * `memory`, which keeps nothing between processes and so has nothing to * initialise. */ export declare const CLI_STORES: readonly ["duckdb", "postgres", "mssql", "clickhouse"]; export type CliStoreKind = (typeof CLI_STORES)[number]; /** * The slice of a store the CLI needs: mint projects and API keys against an * already-migrated store, then release the connection. Each engine's * `createProject` / `createApiKey` live in its own package; this narrows them * to one engine-neutral shape so the commands stay store-agnostic. */ export interface CliStore { createProject(name: string): Promise<{ id: string; name: string; }>; /** * Issue an API key; the plaintext is returned exactly once. Defaults to the * `query` (read-only) capability when no options are given; `init` and * `new-project` pass {@link OWNER_KEY_CAPABILITIES} instead. */ createApiKey(projectId: string, options?: CreateApiKeyOptions): Promise<{ key: string; record: ApiKeyRecord; }>; /** Look a project up so a command can fail fast on a wrong `--project`. */ getProject(projectId: string): Promise<{ id: string; name: string; } | null>; /** * Replace a scene's region set (ADR 0051 §2) — the CLI's `regions set`, the * offline sibling of `PUT /api/v1/scenes/:sceneId/regions`. */ putSceneRegions(projectId: string, sceneId: string, regions: readonly SceneRegion[]): Promise; /** Read a scene's regions — the CLI's `regions get`. */ getSceneRegions(projectId: string, sceneId: string): Promise; close(): Promise; } /** * The capability set `init` and `new-project` mint their **first** key with. * * That key is the operator's own — it goes into the dashboard, not into an * agent — so it carries everything the operator's own surfaces need: * * - `query` — the aggregate analytics API. * - `query:raw` — session replay and the live per-session follow. Inert on its * own: those routes are gated twice and also need `ENABLE_RAW_SESSION_RETENTION` * on the collector (ADR 0003), so granting it here turns nothing on. Without * it, switching retention on later made replay answer `403` until a second key * was minted and swapped into the dashboard. * - `annotate` — the project metadata write path (scene regions today). * * Narrower keys stay deliberate: `uptimizr new-key` still defaults to `query` * alone, which is what an agent or MCP client should be handed (ADR 0051 §7). */ export declare const OWNER_KEY_CAPABILITIES: readonly ApiKeyCapability[]; /** Label written on the first key, so `whoami` and the audit log can name it. */ export declare const OWNER_KEY_LABEL = "owner"; /** * Mint the operator's first key on a freshly created project — the single key * `init` and `new-project` issue. */ export declare function createOwnerApiKey(store: CliStore, projectId: string): Promise<{ key: string; record: ApiKeyRecord; }>; /** * Normalise `COLLECTOR_STORE` for the CLI: unset (or blank) selects the OSS * DuckDB default; `memory` and unknown values throw with an actionable message * rather than silently bootstrapping the wrong store. */ export declare function resolveCliStoreKind(env?: NodeJS.ProcessEnv): CliStoreKind; /** * The `.env` `uptimizr init` writes when none exists: the secret, the selected * store, and whichever of that store's connection variables were set. */ export declare function renderEnv(secret: string, store: CliStoreKind, env?: NodeJS.ProcessEnv): string; /** * Open the store selected by `COLLECTOR_STORE` and apply its migrations, the * same way `serve` does on boot, then hand back the metadata helpers the CLI * commands need. Connection settings come from the same env variables as * `serve` (`DUCKDB_PATH`, `POSTGRES_URL`, `MSSQL_URL`, `CLICKHOUSE_*`, …), so a * project minted here is the one the running collector will resolve. */ export declare function openCliStore(env?: NodeJS.ProcessEnv): Promise; //# sourceMappingURL=cliStore.d.ts.map