import type Anthropic from "@anthropic-ai/sdk"; import { type ProviderToolNameMap } from "./tool-name.js"; import type { EngineTool, EngineMessage, EngineContentPart, EngineEvent } from "./types.js"; export declare function engineToolToAnthropic(tool: EngineTool, toolNameMap?: ProviderToolNameMap): Anthropic.Tool; export declare function engineToolsToAnthropic(tools: EngineTool[], toolNameMap?: ProviderToolNameMap): Anthropic.Tool[]; export declare function stringifyToolUseInputForGateway(input: unknown): string; export declare const UNMATCHED_TOOL_RESULT_REPLAY_PREFIX = "(Omitted unmatched tool results from replayed history.)"; export declare function unmatchedToolResultReplayText(part: { toolCallId: string; content: unknown; isError?: boolean; }): string; /** * Identity of a synthetic interrupted tool result in engine messages, thread * data, and the client (`client/sse-event-processor.ts` matches it verbatim). * The model never sees it bare: replay rewrites it to an error whose outcome * is unknown, or the model treats it as "did not run" and repeats a write that * may have landed. */ export declare const INTERRUPTED_TOOL_RESULT_MARKER = "Interrupted before this tool returned a result."; export declare function isInterruptedToolResult(content: unknown): boolean; export declare function backfillEngineMessagesToolResults(messages: EngineMessage[]): EngineMessage[]; export declare function engineMessageToAnthropic(msg: EngineMessage, opts?: { builderGateway?: boolean; toolNameMap?: ProviderToolNameMap; }): Anthropic.MessageParam; export declare function engineMessagesToAnthropic(messages: EngineMessage[], toolNameMap?: ProviderToolNameMap): Anthropic.MessageParam[]; export declare function engineMessagesToBuilderGatewayAnthropic(messages: EngineMessage[], toolNameMap?: ProviderToolNameMap): Anthropic.MessageParam[]; export declare function anthropicContentToEngine(content: Anthropic.ContentBlock[], toolNameMap?: ProviderToolNameMap): EngineContentPart[]; export interface AnthropicChunkStreamState { toolUseByIndex: Map; } export declare function createAnthropicChunkStreamState(): AnthropicChunkStreamState; export declare function anthropicChunkToEngineEvents(chunk: any, state?: AnthropicChunkStreamState, toolNameMap?: ProviderToolNameMap): EngineEvent[]; export interface StreamedToolInputState { byId: Map; } export declare function createStreamedToolInputState(): StreamedToolInputState; export declare function observeStreamedToolInput(state: StreamedToolInputState, event: EngineEvent): void; export declare function markStreamedToolInputDelivered(state: StreamedToolInputState, id: string): void; export declare function finalizeStreamedToolInputs(state: StreamedToolInputState, deliveredIds?: Iterable): EngineEvent[]; export declare function buildToolResultPart(toolCallId: string, toolName: string, content: string, toolInput?: unknown, isError?: boolean): EngineContentPart;