import type { Api, AssistantMessage, Message, Model } from "../types"; /** * Normalize tool call ID for cross-provider compatibility. * OpenAI Responses API generates IDs that are 450+ chars with special characters like `|`. * Anthropic APIs require IDs matching ^[a-zA-Z0-9_-]+$ (max 64 chars). * * For aborted/errored turns, this function: * - Preserves tool call structure (unlike converting to text summaries) * - Injects synthetic "aborted" tool results * - Adds a guidance marker for the model */ /** * Detect directly adjacent private thinking blocks inside one assistant message's * content. `thinking` and `redacted_thinking` are one adjacency class: the * Anthropic wire contract rejects a replayed assistant turn where two such blocks * sit next to each other with no intervening `tool_use`/`text` block (#4416). * * This is a pure, allocation-free predicate used by defense-in-depth diagnostics * (issue #4443): the write-time transcript assertion (coding-agent persistence) * and the stream-assembler SSE diagnostic (anthropic stream completion). It never * inspects block payloads — only the block-type sequence — so it cannot leak * thinking text, signatures, or credentials. * * Blocks separated by any non-private block (`tool_use`, `text`, …) are ordinary * interleaved-thinking shape and return `false`. */ export declare function hasAdjacentPrivateThinkingBlocks(content: { type: string; }[]): boolean; export declare function transformMessages(messages: Message[], model: Model, normalizeToolCallId?: (id: string, model: Model, source: AssistantMessage) => string, options?: { repairLatestAssistantThinking?: boolean; repairAllAssistantThinking?: boolean; }): Message[];