import type { Run, RunFeedback, RunQuery, RunTree, TraceStore } from '../types/tracing.js'; import { applyQuery, assembleTree } from './query.js'; export { applyQuery, assembleTree }; /** Options for the in-memory trace store. */ export interface MemoryTraceStoreOptions { /** Runs kept before the oldest is dropped. Defaults to 10,000. */ maxRuns?: number; } /** * Traces in process memory. * * Enough for development, tests, and a single-process service that only needs the last few thousand * runs. Bounded, like every other in-memory store here. */ export declare class MemoryTraceStore implements TraceStore { private readonly runs; private readonly maxRuns; constructor(options?: MemoryTraceStoreOptions); /** * Stores a run, replacing an earlier version with the same id. Drops the oldest runs beyond * `maxRuns`. */ save(run: Run): void; /** Reads a run. */ get(runId: string): Run | undefined; /** Runs matching a query. */ query(query?: RunQuery): Run[]; /** A trace's runs, assembled into a tree. */ tree(traceId: string): RunTree | undefined; /** Attaches feedback to a run. */ addFeedback(runId: string, feedback: RunFeedback): void; /** Deletes runs started before an ISO-8601 time, returning how many went. */ prune(before: string): number; /** Runs held. */ size(): number; } /** Options for the JSONL trace store. */ export interface JsonlTraceStoreOptions { /** File runs are appended to, one JSON object per line. */ file: string; /** Rewrites the file when it grows past this, keeping the newest runs. Defaults to 64 MB. */ maxBytes?: number; } /** * Traces appended to a JSONL file. * * Durable without a database, greppable with ordinary tools, and directly loadable as an evaluation * dataset. Reads load the file, so this suits a service that writes far more than it queries; a * database-backed store is the answer above that. */ export declare class JsonlTraceStore implements TraceStore { private readonly file; private readonly maxBytes; constructor(options: JsonlTraceStoreOptions); /** Appends a run. Rewrites the file, keeping the newer half, once it passes `maxBytes`. */ save(run: Run): Promise; /** Reads a run. */ get(runId: string): Promise; /** Runs matching a query. */ query(query?: RunQuery): Promise; /** A trace's runs, assembled into a tree. */ tree(traceId: string): Promise; /** Attaches feedback to a run by appending its updated version. */ addFeedback(runId: string, feedback: RunFeedback): Promise; /** * Deletes runs started before an ISO-8601 time by rewriting the file, returning how many went. */ prune(before: string): Promise; /** A later line for the same run replaces an earlier one, which is what makes appends safe. */ private load; private rotate; }