/** * File I/O for the agency agent's saved sessions * (`lib/agents/agency-agent/lib/sessions.agency`). Plain filesystem work * under the agent's own state directory, like the REPL history file in * `cli.ts`: it is harness bookkeeping, not a tool, so it raises no * interrupt and is never handed to a model. * * Each session is two files, `.json` (the checkpoint) and * `.meta.json` (the record). There is no shared index: two agents in * the same directory would race on one, and a listing is cheap to derive. */ export type SessionRecord = { id: string; cwd: string; brain: string; created: number; lastActive: number; turns: number; title: string; }; /** Every session in `dir`, most recently active first. A malformed * record file is skipped. */ export declare function _listSessions(dir: string): Promise; /** Write the checkpoint, then the record. Returns "" on success, else the * error message. */ export declare function _saveSession(dir: string, record: SessionRecord, checkpoint: unknown): Promise; /** The parsed checkpoint, or null when the file is missing or malformed. */ export declare function _readCheckpointFile(dir: string, id: string): Promise; export type TranscriptMessage = { role: "user" | "assistant"; content: string; }; /** * The user and assistant messages of a saved session's conversation * thread: the thread the brain opens with `thread(session: name)`. Tool * calls and results are left out. */ export declare function _readTranscript(checkpointJson: unknown, session: string): TranscriptMessage[]; export declare function _installSessionHooks(onSubmit: unknown, afterTurn: unknown): void; /** * The REPL's `onSubmit` for a saved session. After a turn, once its Agency * frames have returned, the stack is "REPL waiting at the prompt"; that is * the state checkpointed and written. (A checkpoint taken inside the turn * would carry the turn's own frame, and on resume the runtime would hand * that frame to the next `onSubmit` call.) */ export declare function _sessionOnSubmit(line: string): Promise;