/** * Transcript replay for ACP `session/load`. * * A reopening client gets the conversation before the load response: T3 sends `session/load` for * every activation of a native thread and installs its replay gate until the response arrives * (`findings/T11-B.md` Q5). This module converts `get_entries` output into plain * `user_message_chunk` / `agent_message_chunk` / `agent_thought_chunk` updates for the active branch * only, in transcript order, with the session entry id as the stable `messageId` T3 coalesces a * replayed message by. * * `createRpcEventMapper` in `mapping.ts` is turn-scoped and reconciles streamed deltas against final * message content, so replay is built here instead of being fed through it. Tool calls, tool * results, plans and mode changes never appear in replay: T3 drops replayed tool calls and plans * from display (`t3code/packages/provider-acp/src/server/adapter.ts:4886-4897`), and the plan/build * mode and the model picker are restored from the load response fields instead. */ import type { SessionUpdate } from "@agentclientprotocol/sdk"; /** * Total UTF-8 bytes of text replayed for one `session/load`. Replay is display-only, and the client * waits for it inside its 90 s load window while holding it in memory, so a transcript is bounded * instead of being replayed in full: 512 KiB is several hours of ordinary coding conversation, and * a longer transcript keeps its newest messages, which are the ones a reopen needs. */ export declare const MAX_HISTORY_REPLAY_BYTES: number; /** One message is capped so a single huge answer cannot consume the whole replay budget. */ export declare const MAX_HISTORY_MESSAGE_BYTES: number; /** Total updates for one replay; T3 coalesces by `messageId`, so this only bounds the wire cost. */ export declare const MAX_HISTORY_REPLAY_UPDATES = 512; /** The `get_entries` payload, taken as untrusted JSON because it crosses the RPC child boundary. */ export interface SessionHistorySource { entries?: unknown; leafId?: unknown; } /** * Convert `get_entries` into the replay updates for one `session/load`, newest messages first into * the budget and then restored to transcript order. The budget keeps the newest contiguous run of * messages, so a replayed branch always ends with the leaf the transcript would resume from. * Nothing is emitted for a missing leaf, an empty branch, or a payload the child did not format as a * session transcript. */ export declare function buildSessionHistoryReplay(source: SessionHistorySource): SessionUpdate[];