import type { Api, AssistantMessage } from "../types"; export declare const Flag: { readonly Class: 4096; readonly ThinkingLoop: 65536; readonly Transient: 131072; readonly Timeout: 262144; readonly UsageLimit: 524288; readonly StaleResponsesItem: 1048576; readonly MalformedFunctionCall: 2097152; readonly ProviderFinishError: 4194304; readonly ContextOverflow: 8388608; readonly AuthFailed: 16777216; readonly SilentAbort: 33554432; readonly UserInterrupt: 67108864; readonly Abort: 134217728; /** Anthropic strict-tool grammar too large / schema too complex to compile (400). */ readonly Grammar: 268435456; /** Anthropic model/account does not support fast mode / the `speed` parameter. */ readonly FastModeUnsupported: 536870912; /** OAuth refresh failed definitively — the stored grant is dead, re-login required. */ readonly OAuthExpiry: 1073741824; }; export type Flag = (typeof Flag)[keyof typeof Flag]; export declare const STREAM_READ_ERROR_PATTERN: RegExp; export declare const TRANSIENT_TRANSPORT_PATTERN: RegExp; /** * Local llama.cpp / Ollama deterministic tool-call argument JSON parse failure. * The model emitted invalid JSON in a tool call and the server returned HTTP 500 * with this exact text — replaying the same prompt yields the same malformed * output, so callers strip {@link Flag.Transient} when this matches. */ export declare const LLAMA_CPP_TOOL_CALL_PARSE_PATTERN: RegExp; /** Whether an OAuth refresh error message means the grant is definitively dead. */ export declare function isOAuthExpiry(errorMessage: string): boolean; export declare function create(...flags: number[]): number; export declare function is(id: number | undefined, flag: Flag): boolean; export declare function retriable(id: number | undefined, opts?: { replayUnsafe?: boolean; }): boolean; export declare function status(error: unknown): number | undefined; export declare function isStreamReadErrorText(text: string): boolean; export declare function classify(error: unknown, api?: Api): number; /** * Whether an error (or message string) classifies as an account usage/quota * limit — the persistent, credential-rotation-worthy kind. This is the public * accessor for {@link Flag.UsageLimit}; prefer it over re-running message * regexes at call sites. */ export declare function isUsageLimit(error: unknown, api?: Api): boolean; /** * Anthropic strict-tool grammar too large / schema too complex to compile. * Accessor for {@link Flag.Grammar}. */ export declare function isGrammarError(error: unknown): boolean; /** * Anthropic model/account does not support fast mode / the `speed` parameter. * Accessor for {@link Flag.FastModeUnsupported}. */ export declare function isFastModeUnsupported(error: unknown): boolean; /** * GitHub Copilot 400 `model_not_supported` routing flap — transient. Reads the * structural `code` (and falls back to {@link Flag.Transient} text classification). */ export declare function isCopilotTransientModelError(error: unknown): boolean; export declare function classifyMessage(message: { api?: Api; errorId?: number; errorMessage?: string; errorStatus?: number; }): number; export declare function attach(error: E, id: number): E; export declare function isContextOverflow(message: AssistantMessage, contextWindow?: number): boolean; export declare function stringify(id: number | undefined): string; /** Transient stream corruption where the response was truncated mid-JSON. */ export declare function isTransientStreamParseError(error: unknown): boolean; /** Any malformed stream-envelope error (prefix-tagged or out-of-order events). */ export declare function isStreamEnvelopeError(error: unknown): boolean; /** Stream-envelope errors safe to retry against the provider (event ordering only). */ export declare function isRetryableStreamEnvelopeError(error: unknown): boolean;