import type { IOResult } from '../io/types.ts'; import type { OpRecord } from './record.ts'; import { type ObserverStore } from './store.ts'; export type EventDict = Record; /** * Persists LogEntry records to an ObserverStore as JSONL files. * * The hidden recorder: it owns no mount and its store is reachable only * through this class, so the log is invisible to agents. Views * (/.bash_history, the history builtin) render from the query methods * below; swapping infra (RAM, disk, opfs) means passing a different * store, nothing above this seam changes. */ export declare class Observer { private readonly _store; constructor(store?: ObserverStore); get store(): ObserverStore; private log; logOp(rec: OpRecord, agent: string, session: string, cwd?: string): Promise; /** * Record one finished typed line: its ops, then its command. The line * reader's single recording call: every op the line emitted lands * first, then the command entry itself. */ logExecution(command: string, io: IOResult, opRecords: OpRecord[], agent: string, session: string, cwd?: string): Promise; /** Append a command entry without an execution (history -s). */ logCommandText(command: string, session: string, agent?: string, cwd?: string): Promise; /** Append a clear tombstone for a session (history -c). */ logClear(session: string, agent?: string): Promise; /** Append a delete event for one listing entry (history -d). */ logDelete(session: string, offset: number, agent?: string): Promise; /** * All recorded events across sessions, in timestamp order. Stable over * the per-file line order, so events that share a millisecond (one * line's ops plus its command entry) keep append order. */ events(): Promise; /** Command events across all sessions, in append order. */ commandEvents(): Promise; /** * One session's visible history listing, append order. Projects the * session's events: commands after the last clear tombstone, with * delete events applied at the position they were issued (history -d * renumbers subsequent entries, GNU behavior). */ sessionCommandEvents(session: string): Promise; /** * Rewind the recorder to a snapshot's events. Clears the store first, * mirroring `ws.cache.clear()` on the checkout path: restoring means * becoming the snapshot, so events from the pre-restore timeline do * not survive. Foreign-format entries (e.g. the Python snapshot's * different history shape) without a recognized `type` are skipped: * the views filter by `type` so they are unusable here anyway. */ loadEvents(events: EventDict[]): Promise; } //# sourceMappingURL=observer.d.ts.map