/** * Subagent session-log reader — turns a background agent's on-disk session * JSONL into the message list the client's transcript reducer consumes. * * Why disk: `background_agent_event` relays are ephemeral (they exist only on * SSE clients connected while the agent streams). After a browser reload the * reducer state is gone, so the session log is the only source of truth for * a subagent transcript. The child process appends entries as it works, so * reading the file mid-run yields the transcript up to the last completed * message. */ export interface SubagentLogSource { /** Path to the agent's session JSONL (known after the child exits). */ sessionFile?: string; /** Directory the child writes its session into (known at spawn time). */ sessionDir?: string; } export declare class SubagentSessionLogNotFoundError extends Error { constructor(); } /** * Find chain step session JSONLs under step-N/ directories, ordered by numeric * step index. Returns an empty list for missing/non-chain directories. */ export declare function discoverSubagentStepSessionFiles(sessionDir: string): string[]; /** * Find the most recently modified .jsonl in a session directory. Parity with * discoverSessionFile in @dreb/coding-agent's subagent tool. Normal subagents * write directly under sessionDir; chain-mode subagents register the chain root * but write per-step logs under step-N/ subdirectories. */ export declare function discoverSubagentSessionFile(sessionDir: string): string | undefined; /** * Read the message payloads from a subagent session log. * * Subagent sessions are single-shot and linear (no branching/compaction), so * a straight scan of `type: "message"` entries reconstructs the transcript. * Chain-mode subagents write one linear log per step; those step logs are * concatenated in numeric step order. Malformed lines are skipped (the tail * line can be mid-write). * * @throws when no session file can be located — callers surface this loudly. */ export declare function readSubagentMessages(source: SubagentLogSource): unknown[]; //# sourceMappingURL=subagent-log.d.ts.map