/**
 * Truncates large tool_use content in agent events before broadcasting
 * over WebSocket and storing in EventBuffer.
 *
 * This prevents catastrophic memory pressure when agents write large files
 * (10MB+) — each streaming token would otherwise broadcast the full
 * accumulated content through multiple JSON serialization stages.
 *
 * The original event is never mutated — a shallow clone is returned when
 * truncation occurs. Events that don't need truncation are returned as-is
 * (zero overhead).
 */
/** Default threshold: 32KB. Normal code files pass through untouched. */
export declare const LARGE_CONTENT_THRESHOLD: number;
export interface TruncatedContent {
    _truncated: true;
    _originalLength: number;
    preview: string;
}
/**
 * If `block` is a text block whose `text` starts with the preview snapshot
 * marker and exceeds `threshold`, return a shallow-cloned truncated block.
 * Otherwise returns the original block (referential equality).
 *
 * The resulting block keeps its marker prefix (so downstream consumers can
 * still detect it) and embeds a `TruncatedContent` descriptor alongside the
 * preview text (first 512 chars of the full snapshot, excluding the marker).
 */
export declare function truncateSnapshotBlock(block: any, threshold?: number): any;
/**
 * Truncate large tool content inside a list of persisted messages (as
 * returned by the agent's `get_messages` RPC). Used when sending history
 * to clients on session open / reconnect / tab wake — previously, the full
 * untruncated history was serialized into a single WebSocket frame, which
 * caused very slow (and sometimes failing) history loads for sessions with
 * large file writes/reads.
 *
 * Returns the original array when nothing needs truncation.
 */
export declare function truncateLargeToolContentInMessages(messages: any, threshold?: number): any;
/**
 * If the event is a `message_update` or `message_end` containing tool_use
 * or toolCall blocks with large string content, return a shallow clone with
 * those content values replaced by a truncated descriptor.
 *
 * Supports both formats:
 *  - Anthropic API: `{ type: "tool_use", input: { content: "..." } }`
 *  - pi-coding-agent RPC: `{ type: "toolCall", arguments: { content: "..." } }`
 *
 * Returns the original event unchanged when no truncation is needed.
 */
export declare function truncateLargeToolContent(event: any, threshold?: number): any;
//# sourceMappingURL=truncate-large-content.d.ts.map