/** * Persists action execution history and latest snapshots per strategy action instance. * * @module */ import type { ActionExecutionRecord, ActionFilter, ActionLatestState, ReadActionHistoryOptions } from "./types.js"; import { sanitizeActionName } from "./paths.js"; /** Optional overrides for a single {@link ActionStore.write} (per-action retention and test clocks). */ export interface ActionStoreWriteOptions { /** Drop lines with `startedAt` older than `now - retentionMs`. */ retentionMs?: number; /** Wall clock for retention cutoff (defaults to `Date.now()`). */ now?: number; } /** * Persists `latest.json` plus rolling time-window JSONL history for each action instance. */ export declare class ActionStore { private readonly stateDir; private readonly retentionMs; /** * @param stateDir - Runtime state root (same convention as scanners: adds `strategies/...` internally). * @param retentionMs - Default drop window for history lines (default 24h); per-write overrides allowed. */ constructor(stateDir: string, retentionMs?: number); /** * Atomically writes the latest snapshot, appends one JSONL line, and prunes stale history lines. */ write(record: ActionExecutionRecord, latestState: ActionLatestState, options?: ActionStoreWriteOptions): Promise; /** Reads `latest.json` for one action instance; returns null when missing. */ readLatest(address: string, actionName: string): Promise; /** * Reads JSONL history with optional filters. * Returns **newest-first** (last line in file is most recent; after optional `limit`, order is newest → oldest). */ readHistory(address: string, actionName: string, opts?: ReadActionHistoryOptions): Promise; /** * Loads all `latest.json` files under each strategy's action directories, optionally filtered. */ readAllLatest(filter?: ActionFilter): Promise; private readHistoryInternal; private writeHistory; } export { sanitizeActionName }; //# sourceMappingURL=action-store.d.ts.map