import type { ChatMessage, NativeToolCall, ReasoningArtifactReplayObserver, ReasoningArtifactReplayTarget, ToolDefinition } from "../../types.js"; import { type ToolChoice } from "../tool-protocol.js"; import "../../tools/definitions.js"; export declare function toAnthropicTools(defs: ToolDefinition[]): Array<{ name: string; description: string; input_schema: ToolDefinition["parameters"]; }>; type AnthropicContentBlock = { type: "text"; text: string; } | ({ type: "thinking"; thinking: string; signature: string; } & Record) | { type: "image"; source: { type: "base64"; media_type: string; data: string; }; } | { type: "tool_use"; id: string; name: string; input: Record; } | { type: "tool_result"; tool_use_id: string; content: string; is_error?: boolean; }; interface AnthropicReasoningReplayOptions { readonly target: ReasoningArtifactReplayTarget; readonly observe?: ReasoningArtifactReplayObserver | undefined; } /** * Convert dialect-neutral history to Anthropic Messages API messages. * The first system message is owned by the top-level `system` field; later * System messages become marked user turns in place. Consecutive * tool results collapse into one user turn. */ export declare function toAnthropicToolMessages(messages: ChatMessage[], replay?: AnthropicReasoningReplayOptions): Array<{ role: "user" | "assistant"; content: string | AnthropicContentBlock[]; }>; export declare function anthropicToolBodyFields(options: { tools?: ToolDefinition[] | undefined; toolChoice?: ToolChoice | undefined; }): Record; export interface AnthropicThinkingBlock { readonly sequence: number; readonly thinking: string; readonly signature?: string | undefined; readonly raw: Record; readonly toolCallIndex?: number | undefined; } type AnthropicWireContentBlock = { type: string; text?: string; thinking?: string; signature?: string; id?: string; name?: string; input?: unknown; [key: string]: unknown; }; export declare function parseAnthropicToolUseBlocks(content: AnthropicWireContentBlock[] | undefined): { text: string; thinkingText: string; thinkingBlocks: AnthropicThinkingBlock[]; toolCalls: NativeToolCall[]; thinkingSignature?: string; }; interface AnthropicStreamBlock { kind: "text" | "thinking" | "tool_use"; id?: string; name?: string; json: string; text: string; signature: string; } export interface AnthropicToolStreamState { text: string; thinking: string; /** Anthropic `signature_delta` for the thinking block. */ thinkingSignature: string; /** block index → partial content block */ blocks: Map; } export declare function createAnthropicToolStreamState(): AnthropicToolStreamState; export declare function handleAnthropicStreamEvent(state: AnthropicToolStreamState, event: { type?: string; index?: number; content_block?: { type?: string; id?: string; name?: string; text?: string; thinking?: string; signature?: string; }; delta?: { type?: string; text?: string; thinking?: string; partial_json?: string; signature?: string; }; }): { textDelta?: string; thinkingDelta?: string; toolCallDelta?: { index: number; id?: string; name?: string; argumentsBytes?: number; nameBecameKnown?: boolean; }; }; export declare function finalizeAnthropicToolStream(state: AnthropicToolStreamState): { text: string; thinkingText: string; thinkingBlocks: AnthropicThinkingBlock[]; toolCalls: NativeToolCall[]; thinkingSignature?: string; }; export {};