import type { AssistantMessage, ToolCall, ToolResultMessage } from "../types.js"; /** Runtime settings for cross-turn tool-call repetition detection. */ export interface ToolCallLoopGuardOptions { readonly threshold: number; readonly exemptTools: readonly string[]; /** Lets transport calls inherit an exemption from their dispatched tool without exempting the transport itself. */ readonly exemptionAlias?: (call: ToolCall) => string | undefined; } /** A completed assistant turn plus the tool results it produced. */ export interface ToolCallLoopTurn { readonly message: AssistantMessage; readonly toolResults: readonly ToolResultMessage[]; /** The turn also delivered context outside its tool results (extension `additionalContext`). */ readonly injectedContext?: boolean; } /** Details needed to steer the model away from a repeated tool call. */ export interface RepeatedToolCallDetection { readonly kind: "repeated_tool_call"; readonly toolName: string; readonly count: number; readonly resultSummary: string; readonly argumentsSummary: string; } /** Detects consecutive identical assistant tool calls across model turns. */ export declare class ToolCallLoopGuard { #private; /** Keeps transport-specific exemption policy outside the shared repetition detector. */ constructor(options: ToolCallLoopGuardOptions); /** Records one completed turn and reports repetitions at or beyond the threshold. */ recordTurn(turn: ToolCallLoopTurn): RepeatedToolCallDetection | null; }