import type { ChatEvent } from './chat.js'; export interface StoredTurn { id: string; /** The question asked; absent for a turn the observer started — its first event is the anomaly. */ question?: string; proactive: boolean; startedAtMs: number; events: ChatEvent[]; /** False once it ended — with a report, an error, a stop, or simply because nobody was left to answer. */ running: boolean; } export interface ChatHistoryOptions { /** Turns kept; the oldest go first. Default 100. */ maxTurns?: number; /** Events kept per turn (steps of a long investigation). Default 500. */ maxEvents?: number; } export declare class ChatHistory { private readonly turns; private readonly maxTurns; private readonly maxEvents; constructor(options?: ChatHistoryOptions); /** Begins a turn. An id already known is left as it is: the same question is not recorded twice. */ start(turn: Pick & { question?: string; running?: boolean; }): void; /** Adds an event to a turn; one that ends the turn stops it. An unknown (already dropped) turn is ignored. */ add(id: string, event: ChatEvent): void; /** The turn is over, whatever its last event was (the asker's connection closed, the handler returned). */ end(id: string): void; has(id: string): boolean; /** Oldest first. Copies: what the caller does with them does not reach the history. */ list(): StoredTurn[]; }