import type { RunRetentionBatchResult } from './run-retention.js'; import type { StoredRun, StoredRunStep } from '@opensip-cli/contracts'; import type { DataStore } from '@opensip-cli/datastore'; import type { DrizzleHandle } from '@opensip-cli/datastore/internal'; export { MAX_RUN_RETENTION_BATCH_SIZE, type RunRetentionBatchResult } from './run-retention.js'; export { isResolvableStoredRunId, prepareRunStepWrite, prepareRunWrite, writePreparedRun, writePreparedRunStep, type PreparedRunStepWrite, type PreparedRunWrite, } from './run-write-shapes.js'; /** Filters for querying the host-owned run ledger. */ export interface RunListOptions { readonly limit?: number; readonly source?: StoredRun['source']; readonly name?: string; readonly cwd?: string; } /** Package-private exact Run read for transaction-scoped projections. */ export declare function readRunByIdFromTx(tx: DrizzleHandle, runId: string): StoredRun | null; /** Package-private deterministic newest-first Run page. */ export declare function readRunsPageFromTx(tx: DrizzleHandle, offset: number, limit: number, cwdWithin?: string): readonly StoredRun[]; /** Package-private corruption probe used before exposing resolvable Run IDs. */ export declare function readUnresolvableRunIdFromTx(tx: DrizzleHandle, cwdWithin?: string): string | null; /** Package-private exact RunStep count for one parent. */ export declare function countRunStepsFromTx(tx: DrizzleHandle, runId: string): number; /** Package-private deterministic RunStep page for transaction-scoped projections. */ export declare function readRunStepsPageFromTx(tx: DrizzleHandle, runId: string, offset: number, limit: number): readonly StoredRunStep[]; /** Repository for persisted host-owned runs and ordered run steps. */ export declare class RunRepo { private readonly datastore; constructor(datastore: DataStore); saveRunWithSteps(run: StoredRun, steps: readonly StoredRunStep[]): void; /** * Atomically persist only when a synchronous read-only guard still holds * after the datastore write lock and transaction have both been entered. */ saveRunWithStepsIf(run: StoredRun, steps: readonly StoredRunStep[], precondition: () => boolean): boolean; private persistRunWithSteps; saveRun(run: StoredRun): void; saveStep(step: StoredRunStep): void; getRun(id: string): StoredRun | null; listRuns(opts?: RunListOptions): readonly StoredRun[]; listStepsForRun(runId: string, limit?: number): readonly StoredRunStep[]; countStepsForRun(runId: string): number; listStepsForRunPage(runId: string, offset: number, limit: number): readonly StoredRunStep[]; listStepsForRuns(runIds: readonly string[]): ReadonlyMap; countRuns(): number; /** * Delete at most one deterministic oldest-first batch outside the newest * `keep` parent Runs. A linked retained Session protects its complete parent. */ pruneToCountBatch(keep: number, batchSize?: number): RunRetentionBatchResult; /** * Delete at most one deterministic oldest-first batch completed before the * cutoff. Parents with a still-linked Session remain protected. */ pruneOlderThanBatch(before: Date, batchSize?: number): RunRetentionBatchResult; getRunByLegacySuiteRunId(suiteRunId: string): StoredRun | null; getStepBySessionId(sessionId: string): StoredRunStep | null; /** Whether this delegation already persisted its exact implicit run evidence. */ hasImplicitRunForCommand(correlationRunId: string, tool: string, command: string, delegatedAt: string): boolean; } //# sourceMappingURL=run-repo.d.ts.map