/** * Llm error taxonomy, provider-neutral failure codes, and classifier helpers. * The {@link HarnessError} base is re-exported from `@qilin-agent/util-error` * so `llm` and the capability packages it depends on share one base. * @module @qilin-agent/llm/error */ import { HarnessError } from '@qilin-agent/util-error'; export { HarnessError }; /** Canonical provider-neutral code for a model request rejected because its context window was exceeded. */ export declare const CONTEXT_WINDOW_EXCEEDED_CODE = "CONTEXT_WINDOW_EXCEEDED"; /** Canonical provider-neutral code for an exhausted account quota or balance. */ export declare const QUOTA_EXCEEDED_CODE = "QUOTA"; /** * Canonical provider-neutral code for a provider's content-safety refusal. The * attempt produced billed usage but no answer; the provider's explanation, such * as which images were blocked, travels in the message. Deliberately outside * the default retryable set — a refusal repeats when the request does. */ export declare const CONTENT_REFUSED_CODE = "CONTENT_REFUSED"; /** * Canonical provider-neutral code for a response that completed normally but * carried no content blocks at all. Providers occasionally emit a degenerate * completion (a terminal stop with zero output); adapters classify it as this * failure instead of yielding an empty assistant message, because an empty * message silently ends the turn with nothing for the user or the loop to act * on. The attempt produced nothing durable, so retry policy treats it as safe * to repeat. */ export declare const EMPTY_RESPONSE_CODE = "EMPTY_RESPONSE"; /** * Canonical provider-neutral code for a credential that was supplied but * cannot be used — malformed rather than absent. Distinct from * `MISSING_CREDENTIAL` because the fix differs: correct the stored value * rather than supply one. Deliberately outside the default retryable set — * a malformed credential fails identically on every attempt. */ export declare const INVALID_CREDENTIAL_CODE = "INVALID_CREDENTIAL"; /** * Recognize the context-overflow wording used by OpenAI-compatible providers * and library adapters. Adapters pass all available provider code, type, and * message text so both thrown and in-band delivery styles share one classifier. * @param detail - provider error code/type/message text joined into one string. * @returns true when the detail identifies a request exceeding the model context window. */ export declare function isContextWindowExceededError(detail: string): boolean; /** * Recognize provider wording that identifies an exhausted account quota rather * than a transient request-rate limit. * @param detail - provider error code/type/message text joined into one string. * @returns true only for terminal quota, balance, credit, budget, or usage-limit wording. */ export declare function isQuotaExceededError(detail: string): boolean; /** * Render a thrown value with its full `cause` chain and AggregateError * members, so transport wrappers like undici's `TypeError: fetch failed` * surface the underlying failure instead of masking it. Plain structured * failures render their own data-backed `message`. Diagnostic-surface * rendering only (messages, notices, logs) — never parse the result; route on * {@link HarnessError.code}. * @param value - the caught value (`unknown` in catch clauses). * @returns the outermost message first, each cause appended with `: ` (skipped * when it repeats the wrapper message verbatim), and AggregateError members * bracketed and `; `-joined. */ export declare function errorChain(value: unknown): string; /** * Narrow an arbitrary thrown value to a HarnessError (for `instanceof` at runtime boundaries). * @param value - the caught value (`unknown` in catch clauses). * @returns true only for real instances; duck-typed or cross-realm errors do not narrow. */ export declare function isHarnessError(value: unknown): value is HarnessError; /** * Canonical code for a request an image-capable route cannot send until more * of its images are offloaded. The failure's `offloadImages` names how many * more of the oldest retained occurrences must be offloaded; * `dsh-compaction-image-offload` records an `image/offload` selection before * the agent or summarizer retries with freshly derived input. */ export declare const IMAGE_OFFLOAD_REQUIRED_CODE = "IMAGE_OFFLOAD_REQUIRED"; //# sourceMappingURL=error.d.ts.map