import type { ModelMessage, ToolSet, TypedToolResult } from "ai"; import type { HarnessStepResult } from "#harness/step-hooks.js"; import type { HarnessToolLookup } from "#harness/types.js"; type StepResponseMessage = HarnessStepResult["response"]["messages"][number]; type ToolResponsePart = Extract["content"][number]; type ToolResultPart = Extract; export declare function withAccumulatedResponseMessages(input: { readonly invalidInputToolCallIds?: ReadonlySet; readonly responseMessages: readonly StepResponseMessage[]; readonly stepResult: HarnessStepResult; readonly toolResults?: readonly TypedToolResult[]; }): HarnessStepResult; /** True when provider history still owes a result for any assistant tool call. */ export declare function hasUnansweredToolCall(messages: readonly ModelMessage[]): boolean; /** * Appends synthesized tool results for calls that have no result anywhere in * the step's response messages. Exported for its dedupe contract: a call * already answered — including provider-executed results the SDK keeps * inline in the assistant message — must never receive a second * `tool-result`, or the next Anthropic call rejects the history with * "each tool_use must have a single result". */ export declare function appendMissingToolResultMessages(input: { readonly append: readonly ToolResultPart[]; readonly responseMessages: readonly StepResponseMessage[]; }): StepResponseMessage[]; /** * CallIds answered anywhere in the response messages. Scans every message * role: provider-executed tool results arrive inline in the *assistant* * message (the SDK only moves them to a `tool` message during provider * history normalization, which runs after the backfill paths), so a * tool-message-only scan would let a synthesized result duplicate them. */ export declare function extractToolResultCallIds(messages: readonly ModelMessage[]): ReadonlySet; export declare function answerSkippedToolCalls(step: HarnessStepResult, tools: HarnessToolLookup): ToolResultPart[]; export {};