/** * Helpers for detecting and parsing the llama.cpp addon's * `ContextOverflow` status error (`LlmErrors.hpp::ContextOverflow = 14`). * * The addon's JS-facing throw goes through `js_throw_error(env, code, * msg)` (see `JsUtils.hpp::JSCATCH`) where `code` comes from * `qvac_errors::StatusError::codeString()` and formats as * `"[ :: ContextOverflow ]"`. The message carries the * C++-formatted detail (which may include the prompt/ctx sizes). That * codeString survives only the synchronous throw path — asynchronous run * errors are transported as `exception.what()` alone, with no code. * * These helpers let the plugin handler convert that addon error into a * typed `ContextOverflowError` and let unit tests assert the detection * + extraction logic without a real model load. */ export declare function isAddonContextOverflowError(err: unknown): boolean; export type ContextOverflowSizes = { /** The prompt alone, in tokens; unset when the guard reports KV cells. */ promptTokens?: number; /** Cached conversation on a warm-cache guard, in `ctxSize` units. */ cachedTokens?: number; /** Total the failing guard reported, in `ctxSize` units; the guards trigger on `>=`, so it can equal the window. */ requiredTokens?: number; /** Effective per-request ceiling: `ctx_size` split across slots at `parallel > 1`. */ ctxSize?: number; }; export declare function parseContextOverflowMessage(message: string): ContextOverflowSizes;