import { A as Agent, K as Krikos } from '../types-iaO2gHBL.js'; /** * Structural registry adapters for Krikos: write-through mirrors of the agent registry into an * external store for cross-process query, without Krikos importing any database driver. * * The engine's own persistence is a single snapshot via a {@link import('../types.js').StateBackend}. * These adapters are a different concern: they project each agent as an individually queryable * row or key so a dashboard, a CISO report, or another service can read the fleet inventory * directly from Postgres, SQLite, or a key-value store. Krikos matches the minimal client shape * structurally; the host passes a ready, credentialed object. * * @packageDocumentation */ /** A write-through registry mirror: upsert and remove one agent at a time. */ interface RegistryStore { /** Inserts or replaces the row/entry for `agent`. */ upsert(agent: Agent): Promise | void; /** Removes the row/entry for `agentId`, if present. */ remove(agentId: string): Promise | void; } /** The flat row shape an agent projects to, stable and driver-agnostic. */ interface AgentRow { readonly id: string; readonly name: string; readonly status: string; readonly issuer: string; readonly framework: string | null; readonly fingerprint: string; readonly credential_version: number; readonly capabilities: string; readonly issued_at: number; readonly expires_at: number | null; readonly updated_at: number; } /** Projects an agent to its flat row. Capabilities and metadata are JSON-encoded. */ declare function toRow(agent: Agent): AgentRow; /** Structural SQL executor: runs a parameterized statement. Postgres, SQLite, or any wrapper. */ type SqlExecutor = (sql: string, params: readonly unknown[]) => Promise | unknown; /** * Creates a write-through registry store backed by a SQL table. * * The host supplies an executor and a table name; Krikos issues upsert and delete statements with * positional `?` placeholders (the most portable form across SQLite and, via a wrapper, Postgres). * Krikos imports no driver and never sees credentials. * * @param exec - The parameterized statement executor. * @param table - The table name. Defaults to `krikos_agents`. * @returns A {@link RegistryStore}. */ declare function sqlRegistryStore(exec: SqlExecutor, table?: string): RegistryStore; /** Structural key-value client for the registry mirror; satisfied by Redis, Upstash, CF KV. */ interface KvClientLike { set(key: string, value: string): Promise | unknown; del?(key: string): Promise | unknown; } /** * Creates a write-through registry store backed by a key-value client, one JSON value per agent * under ``. When the client exposes `del`, removal deletes the key; otherwise removal * writes an empty tombstone value. * * @param kv - The structural key-value client. * @param prefix - The key prefix. Defaults to `krikos:agent:`. * @returns A {@link RegistryStore}. */ declare function kvRegistryStore(kv: KvClientLike, prefix?: string): RegistryStore; /** * Synchronizes the entire current registry into a {@link RegistryStore} in one pass. Use it to * seed a fresh mirror or to reconcile after pruning. Returns the number of agents written. * * @param krikos - The registry to read. * @param store - The destination store. * @returns The number of agents upserted. */ declare function syncAll(krikos: Krikos, store: RegistryStore): Promise; /** * Wires a live write-through mirror: on every agent lifecycle event, re-read the agent and upsert * it (or remove it when it no longer exists). Best-effort and non-blocking; store faults are * swallowed so a mirror outage never breaks the registry. Returns an unsubscribe function. * * For exactness after a prune, follow up with {@link syncAll}. * * @param krikos - The registry to observe. * @param store - The destination store. * @returns An unsubscribe function. */ declare function mirrorRegistry(krikos: Krikos, store: RegistryStore): () => void; export { type AgentRow, type KvClientLike, type RegistryStore, type SqlExecutor, kvRegistryStore, mirrorRegistry, sqlRegistryStore, syncAll, toRow };