/** * Error humanizer for the agent streaming path. * * Raw upstream provider errors (e.g. OpenRouter 429s) surface as JSON blobs * containing internal identifiers (org_..., user_id, provider_name, model * names). These must never reach end users via the `error` ServerEvent. * * This module converts any caught error into a short, safe, user-facing * string. Raw errors are still logged server-side at the catch sites; this * helper only controls the user-facing message. Unknown, non-transient errors * keep a sanitized version of their underlying cause so the UI can show what * actually happened instead of only a generic fallback. */ /** * Classification table for user-facing message mapping only. Retry * decisions live in the shared transient-error classifier * (src/sdk/ai/utils/transient-error.ts → isTransientApiError). * * Documented divergence: this table is intentionally NOT unified with * isTransientApiError, which is wider (HTTP 5xx, "temporarily * unavailable", internal/server errors, stream endings). Mapping those * signals here would change user-facing strings — e.g. a bare * "500 Internal Server Error" would surface as "Network error. Please try * again." instead of the sanitized underlying cause. Keep this table in * sync manually when new transient signals are added for retries. */ export declare const PROVIDER_ERROR_PATTERNS: RegExp; /** * Convert a caught error into a clean, user-facing message. * * Classification (priority order): * 1. Rate limit / 429 / overloaded / 529 / "too many requests" / * "temporarily rate-limited" → "Rate limit reached. Please try again in a moment." * 2. timeout / econnreset / "fetch failed" / network → "Network error. Please try again." * 3. Any other Error / string → a sanitized, concise version of the underlying * cause. Non-string/non-Error values (or values whose cause is empty after * sanitization) → "Something went wrong. Please try again." * * The sanitizer still strips JSON blobs, stack frames, URLs, absolute paths, * and internal identifiers (org_..., user_id, provider_name, is_byok, * upstream model names). */ export declare function humanizeProviderError(err: unknown): string; //# sourceMappingURL=error-humanizer.d.ts.map