import { type DataStore } from './data-store.js'; /** * Per-payload size ceiling (UTF-8 bytes of the JSON serialization). Exceeding * it ERRORS (a typed `ValidationError`) rather than evicting — silent eviction * hides bugs; an explicit cap teaches the tool author to shard or summarize. * Documented on the `cli.toolState` seam JSDoc (ADR-0042). */ export declare const TOOL_STATE_MAX_PAYLOAD_BYTES: number; /** * The generic host-owned keyed tool-state repository (ADR-0042). One repo over * the shared `tool_state` table, scoped by the `tool` column — every tool gets * durable keyed JSON persistence without owning schema, the same generic-table * pattern the ADR-0036 baseline pair proved. Tools consume it through the * `cli.toolState` seams; the payload is opaque to the host. * * ## Versioning convention for toolState values * * For any key whose value shape a tool treats as versioned, the tool SHOULD * include a top-level numeric `"__version": N` (starting at 1) inside the * object it puts. The host never reads or enforces it — use * `extractPayloadVersion` (from '@opensip-cli/core') inside your tool code * when you `get` a key to decide projection/migration. * * Keys that are truly schemaless (arbitrary user data) may omit `__version`. * See the payload schema evolution plan / ADR-0050 for safe vs. major rules. */ export declare class ToolStateRepo { private readonly datastore; constructor(datastore: DataStore); /** Read one payload, or undefined when the key has never been put. */ get(tool: string, key: string): unknown; /** * Upsert one payload under `(tool, key)`. * * Callers that version the state for a stable key SHOULD put an object * whose top level contains `"__version": 1` (or higher after a breaking change * per the evolution rules). The host stores it opaquely; on read the caller * uses `extractPayloadVersion(payload)` to inspect. * * @throws {ValidationError} when the JSON serialization exceeds * {@link TOOL_STATE_MAX_PAYLOAD_BYTES} (error, never evict). */ put(tool: string, key: string, payload: unknown): void; /** Delete one key (no-op when absent). */ delete(tool: string, key: string): void; /** List this tool's keys, sorted (never another tool's). */ list(tool: string): readonly string[]; /** Delete ALL of this tool's state rows; returns the deleted count. */ clear(tool: string): number; } //# sourceMappingURL=tool-state-repo.d.ts.map