import type { SqliteConnection } from './sqlite-connection.js'; import type { NormalizedInterventionBatch } from '../intervention-evidence-normalizer.js'; import type { InterventionAuditRelations, InterventionAuditSelector, InterventionRecordKind } from '../types/intervention-evidence-contract.js'; export interface InterventionSourceConflict { observationKey: string; existingDigest: string; incomingDigest: string; } export interface AppendObservationBatchResult { /** false only when source conflicts were reported (inserted rows stay committed). */ ok: boolean; insertedCount: number; duplicates: string[]; conflicts: InterventionSourceConflict[]; reason?: string; nextAction?: string; } export interface InterventionAuditReadOptions { /** Max records per kind section. Default 50, clamped to [1, 200]. */ limit?: number; /** Resume one kind from the cursor returned in relations.pages. */ cursor?: { kind: InterventionRecordKind; after: { recordedAt: string; evidenceId: string; }; }; } export type InterventionAuditRead = { available: true; relations: InterventionAuditRelations; } | { available: false; reason: string; nextAction?: string; }; export declare class SqliteInterventionEvidenceStore { private readonly connection; constructor(connection: SqliteConnection); /** Returns the workspace evidence scope, or null when not yet established. */ getEvidenceScope(): { scopeId: string; establishedAt: string; } | null; /** * Resolve the host that owns a behavior episode: the episode row's own * native_refs hostKind (an episode IS observed by exactly one host). * Returns null when the episode is absent or its stored refs are corrupt — * callers fall back to an explicit Unknown/derived marker, never a guess. */ findEpisodeHostKind(episodeKey: string): 'openclaw' | 'codex' | 'workbuddy' | null; /** * Append one normalized batch atomically. Scope is established on first * append; a batch from a different scope is rejected without writes. * Conflicting payloads under an existing natural key are reported — the * original stays intact and other records in the batch still commit. */ appendObservationBatch(batch: NormalizedInterventionBatch): AppendObservationBatchResult; /** * Read-side for the four audit queries (SPEC §13.8). Read-only friendly: * on a state.db that predates the evidence tables this reports * unavailable instead of creating anything. */ readAuditRelations(selector: InterventionAuditSelector, options?: InterventionAuditReadOptions): InterventionAuditRead; } //# sourceMappingURL=sqlite-intervention-evidence-store.d.ts.map