import { type LLMAgentFailurePolicy, type SystemicToolFailureReport, type ToolFailedResultContext, type ToolFailureContext } from '../client/agentRun.typedefs'; export declare class SystemicToolFailureError extends Error { readonly report: SystemicToolFailureReport; constructor(report: SystemicToolFailureReport); } /** * One tracker belongs to one agent run. Nested runs get their own tracker, so * five failures inside one delegation stop that delegation without poisoning * its siblings or the root agent's counters. * * A refused call counts as a failure, not as a success: a gate that keeps * saying no to the same arguments is exactly the unbounded retry loop the * streak exists to bound, and it is what the transcript already records it as. */ export declare class AgentToolFailurePolicy { private readonly policy; private readonly abortOnSystemicFailure?; private readonly streaks; constructor(policy: LLMAgentFailurePolicy, abortOnSystemicFailure?: ((error: SystemicToolFailureError) => void) | undefined); recordSuccess(toolName: string): void; /** * Records a thrown failure and returns the error the model should read — * the original one, one carrying the corrective nudge, or the systemic * report that also stops the delegation. */ describeFailure(failure: ToolFailureContext): Error; /** * Two outcomes the model reads as a result rather than as a throw: a call a * gate refused, and a delegation this policy itself stopped. Neither did the * work, so both keep the streak running and both carry the escalation in the * text — a root that re-delegates the same doomed work is in exactly the * retry loop the counter exists to break. */ describeFailedResult(failure: ToolFailedResultContext): string; private recordAttempt; private hasReachedAbortThreshold; private hasReachedNudgeThreshold; private appendNudge; private buildSystemicFailure; /** * A nudge that can never fire, or an abort that fires on the first failure, * silently turns the policy into something other than what it says. Both are * configuration mistakes, so they fail where configuration is read. */ private static assertUsableThresholds; } /** * Two calls are "the same call" when their arguments carry the same values, * whatever order the model happened to serialize the keys in. Ordering is a * plain code-unit comparison rather than `localeCompare`, which is locale * sensitive and may call two distinct keys equal. */ export declare function canonicalizeToolInput(value: unknown): unknown;