/** * hmem v2 — append-only, immutable events log (replaces v1 O-entry exchanges). * * Each event carries a per-session monotonic `seq` (starts at 1) assigned as * MAX(seq)+1 for the session, and a ULID `event_uid`. Events are NEVER updated or * deleted — there is deliberately no mutation API (master-plan D1, scenario 6). * * Project attribution is *derived*, not stored: `eventsForProject` joins events to * `session_bindings` on the segment `[from_seq, to_seq]` that contains an event's * seq (D2). Retroactive correction therefore only edits a boundary integer in * `session_bindings` — no event row is ever moved. This dissolves the v1 * `move_nodes` staleness class. */ import type Database from 'better-sqlite3'; import type { EventRow } from './types.js'; export interface EventsApi { appendEvent(p: { session_id: string; role: 'user' | 'assistant'; content: string; }): { seq: number; event_uid: string; }; maxSeq(session_id: string): number; eventsForSession(session_id: string): EventRow[]; getSessionLog(session_id: string): EventRow[]; eventsForProject(project_uid: string): EventRow[]; } export declare function createEventsApi(db: Database.Database): EventsApi;