/** * Context-overflow error detection helpers. * * Provider error messages vary — Anthropic returns "prompt is too long", * OpenAI returns "context_length_exceeded", Bedrock returns "Input is too * long", Google returns a size-limit phrase. This module centralises the * phrase list so the agent graph's emergency-prune retry can classify * errors consistently instead of duplicating inline substring matches at * each call site. * * The strict check (`isContextOverflowError`) matches only known phrases. * The loose check (`isLikelyContextOverflowError`) also matches a heuristic * regex for providers we haven't explicitly catalogued. Both filter out * false positives (rate-limit, auth, quota, billing) that might otherwise * trigger an unnecessary prune retry. */ /** * Extracts a human-readable error message from an unknown error value. * Walks common shapes: strings, Error instances, `{ message }`, * `{ error: string }`, `{ error: { message } }`. Falls back to * JSON.stringify or String() so callers never have to null-check. */ export declare function extractErrorMessage(error: unknown): string; /** * Strict check: returns true only for known, unambiguous context-overflow * phrases. Use when the recovery action is expensive (full prune + retry) * and false positives are undesirable. */ export declare function isContextOverflowError(errorMessage?: string): boolean; /** * Loose check: returns true for known phrases OR heuristic regex matches. * Preferred by the graph's emergency-prune retry because the cost of a * false positive is one extra retry with a smaller context, while the * cost of a false negative is an opaque provider failure surfaced to * the user. */ export declare function isLikelyContextOverflowError(errorMessage?: string): boolean;