/** * Problem: * When reconnecting or reloading a session via `session/load`, upstream `agy_acp_server` * drops thought chains, intermediate reasoning steps, and agent message chunks, loading an incomplete history. * * Solution: * Reads raw protobuf-encoded conversation steps directly from the session's SQLite database, * reconstructing thought and message update events for session replay. */ import { SESSION_UPDATES, type AcpStreamMessage, type AcpFix } from "../../core/types.js"; import { STEP_TYPE_USER, STEP_TYPE_AGENT } from "../orphaned-checkpoints/index.js"; import { decodeVarint, getField } from "../../lib/protobuf.js"; export { decodeVarint, getField }; export declare function extractTimestamp(payload: Uint8Array): string | undefined; export type ConversationStep = { readonly kind: "user" | "assistant" | "thought"; readonly idx: number; readonly text: string; readonly timestamp?: string | undefined; } | { readonly kind: "tool_call"; readonly idx: number; readonly callId: string; readonly name: string; readonly rawInputJson: string; readonly timestamp?: string | undefined; }; export { STEP_TYPE_USER, STEP_TYPE_AGENT }; export declare function utf8(bytes: Uint8Array | null): string; export declare function isInternalProxyPrompt(text: string): boolean; export declare function decodeStep(stepType: number, payload: Uint8Array, idx: number, timestamp?: string): ConversationStep[]; export declare function conversationDbPath(sessionId: string, customDbPath?: string): string; export declare function readConversationSteps(sessionId: string, customDbPath?: string): ConversationStep[]; export declare function deriveToolTitle(name: string, rawInput: unknown): string; export declare function sessionUpdateMessage(sessionId: string, update: Record): AcpStreamMessage; export declare function textChunkUpdate(sessionId: string, sessionUpdate: typeof SESSION_UPDATES.USER_MESSAGE_CHUNK | typeof SESSION_UPDATES.AGENT_MESSAGE_CHUNK | typeof SESSION_UPDATES.AGENT_THOUGHT_CHUNK, text: string): AcpStreamMessage; export declare function toolCallUpdates(sessionId: string, step: Extract): AcpStreamMessage[]; export declare function synthesizeStepUpdates(sessionId: string, step: ConversationStep): AcpStreamMessage[]; export declare function synthesizeReplayUpdates(sessionId: string, steps: readonly ConversationStep[]): AcpStreamMessage[]; export interface DroppedHistoryChunksFix extends AcpFix { readConversationSteps?: (sessionId: string, customDbPath?: string) => ConversationStep[]; } export declare const droppedHistoryChunksFix: DroppedHistoryChunksFix; export type HistoryReconstructionFix = DroppedHistoryChunksFix; export declare const historyReconstructionFix: DroppedHistoryChunksFix; //# sourceMappingURL=index.d.ts.map