/**
 * The ONE reading of a model's capability declarations — image input, reasoning and fast mode.
 *
 * A `Model` declares each capability in one of three states: on (`reasoning: true`, `fastMode: true`; `input` lists
 * `"image"`), off (`reasoning: false`, `fastMode: false`; an `input` list without `"image"`), or not at all (the key is
 * absent). That declaration is the one fact ({@link capabilityOf}); it has two readers, and what "not at all" means to each is
 * said once per capability, in that reader's cell of {@link UNKNOWN_CAPABILITY_READS} — no caller decides it for itself:
 *  - {@link capabilityHeld} — the engine's OWN choices (a seat's tier, a summary's output floor, a model selection, a published
 *    tier table, an image path) read the `engine` cell;
 *  - {@link capabilityTried} — sending what a REQUESTER asked for (the task's tier, the model entry's own default tier, the
 *    session's fast speed) reads the `requested` cell: an undeclared capability marked tried goes out unless the request
 *    withholds it ({@link requestWithheld}).
 * (The PDF profile's no-metadata shortcut in `pdfModelCapabilitiesOf` looks at the absence itself.) A request never carries a
 * capability declared off; one declared on is never dropped here.
 *
 * A declaration of the wrong shape is refused where it is read: a `reasoning` or `fastMode` that is not a boolean, or an
 * `input` that is not a list of strings, throws, naming the model and the key. Reading it some other way (by truthiness, or
 * as undeclared) would turn a typo into a capability nobody declared.
 */
import type { Model } from "../internal/llm.js";
/** The capabilities a model declares. `image` = accepts image input (`Model.input` lists `"image"`); `fast_mode` = its endpoint
 *  serves the faster output tier for this model (`Model.fastMode`, `brain/fast-mode.ts`). */
export declare const MODEL_CAPABILITIES: readonly ["image", "reasoning", "fast_mode"];
export type ModelCapability = (typeof MODEL_CAPABILITIES)[number];
/** What a model's entry says about one capability. `unknown` = the entry does not say. */
export declare const CAPABILITY_DECLARATIONS: readonly ["declared_on", "declared_off", "unknown"];
export type CapabilityDeclaration = (typeof CAPABILITY_DECLARATIONS)[number];
/**
 * What a capability the entry does not declare means, per capability and per reader — the only place this is said. A
 * capability has a cell only for a reader that reads it (asking for a cell it lacks does not compile):
 *  - `engine` — what the engine's own choices read ({@link capabilityHeld}): `held` | `not_held`;
 *  - `requested` — whether a requester's ask of it goes out ({@link capabilityTried}): `tried` = it goes out, and the stream
 *    engine's fall-back answers a failure of the request that carried it (the same request without it, one request more at
 *    most); `not_tried` = it does not.
 *
 * | capability | `engine` | `requested` | why |
 * |---|---|---|---|
 * | `image` | held | — | an entry that never filled in `input` keeps the images it was always sent; no requester asks for image input apart from the images themselves |
 * | `reasoning` | not held | tried | the engine chooses no thinking tier for such an entry, sizes nothing for its thinking, selects it for no reasoning need and publishes no tier for it (the explicit off is spelled to it only where the entry names its wire's dialect, `offSpelling`, brain/reasoning.ts); a tier the requester asks for goes out |
 * | `fast_mode` | — | not tried | the engine never chooses fast speed, only a requester asks for it; availability is the deployment's declaration (the name of a model is not read for it), and a request for it would be billed at the fast rate by an endpoint nobody said serves it — a cost no fall-back takes back |
 */
export declare const UNKNOWN_CAPABILITY_READS: Readonly<{
    readonly image: Readonly<{
        engine: "held";
    }>;
    readonly reasoning: Readonly<{
        engine: "not_held";
        requested: "tried";
    }>;
    readonly fast_mode: Readonly<{
        requested: "not_tried";
    }>;
}>;
type UnknownCapabilityCells = typeof UNKNOWN_CAPABILITY_READS;
/** The capabilities the engine's own choices read: those with an `engine` cell. */
export type EngineReadCapability = {
    [C in ModelCapability]: "engine" extends keyof UnknownCapabilityCells[C] ? C : never;
}[ModelCapability];
/** The capabilities a requester's ask reads: those with a `requested` cell. */
export type RequestedCapability = {
    [C in ModelCapability]: "requested" extends keyof UnknownCapabilityCells[C] ? C : never;
}[ModelCapability];
/** The part of a model this module reads (`id` only names the model in a refusal; the structural readers that take a
 *  model-shaped object without one still get the same answer). */
export type CapabilityDeclaringModel = {
    readonly id?: Model["id"];
    readonly reasoning?: unknown;
    readonly fastMode?: unknown;
    readonly input?: unknown;
};
/** The entry's declaration of `cap`. Throws a `TypeError` on a declaration of the wrong shape (see the module note). */
export declare function capabilityOf(model: CapabilityDeclaringModel, cap: ModelCapability): CapabilityDeclaration;
/** The engine's-own-choices reader: whether the engine treats the model as having `cap` — declared on, or undeclared where
 *  its `engine` cell ({@link UNKNOWN_CAPABILITY_READS}) says held. A model listing, a selection, a seat, a published table read
 *  this. */
export declare function capabilityHeld(model: CapabilityDeclaringModel, cap: EngineReadCapability): boolean;
/**
 * The requester's reader: whether one request sends what its requester asked of `cap` — declared on, or undeclared where its
 * `requested` cell ({@link UNKNOWN_CAPABILITY_READS}) says tried and not in the request's `withheld` set
 * ({@link requestWithheld}). What makes a try safe is the stream engine's fall-back (a request that tried it and failed before
 * any content, however it failed, is followed by the same request without it, the call's budgets unspent); a request that
 * withholds the capability is the request {@link capabilityHeld} alone would build. Read only where a requester's ask enters a
 * request (the reasoning applier's entry predicate, `reasoningRequestCarried`; the fast-mode applier's entry check,
 * `fastModeUnavailableFor`).
 */
export declare function capabilityTried(model: CapabilityDeclaringModel, cap: RequestedCapability, withheld?: readonly ModelCapability[]): boolean;
/** What a remembered endpoint answers: why it is remembered — the refusal last cured there named the capability (`named`, in the
 *  wordings that name the thinking parameters refused, `thinkingRefusalStated`) or did not (`refused`), or a request that carried
 *  it broke off after it had begun answering (`broke_off`, {@link noteCapabilityBrokeOff}). The person's notice says which, in a
 *  later conversation too. */
export interface CapabilityMemory {
    readonly why: "named" | "refused" | "broke_off";
}
/** The model a request is sent as, for the memory's key: its wire id and its wire family. */
export type CapabilityEndpointModel = {
    readonly id: string;
    readonly api: string;
};
/** The speed a request goes at (`fast` = it carries fast mode's fast-speed parameter, `requestSpeedOf` in brain/fast-mode.ts):
 *  part of the memory's key, so what a fast request learned about a capability holds for fast requests only. Every reader and
 *  writer of the memory passes the speed of the request it is about — there is no default. */
export type CapabilityRequestSpeed = "fast" | "standard";
/**
 * Count, for this process, a cure at the endpoint `url` at `speed`: the endpoint refused a request that tried the undeclared
 * `cap` (its own words, before it produced anything), and the same request without it, as built, truly succeeded there (the
 * call kept its output; a retry of that request counts, a re-shape of it — a lowered output cap, standard speed — does not, so
 * the speed is the refused request's). The second cure in a row remembers the endpoint at that speed. Answers whether it is now
 * remembered. Written by the stream engine's fall-back only, and only then — never on the refusal alone, never on a fall-back
 * after a failure that refused nothing (a server error, a page, a retry asked for, a tear, a stall), never for a capability the
 * entry declares.
 */
export declare function noteCapabilityCured(model: CapabilityEndpointModel, url: string, speed: CapabilityRequestSpeed, cap: ModelCapability, memory: CapabilityMemory & {
    why: "named" | "refused";
}): boolean;
/** A request that TRIED `cap` at the endpoint `url` at `speed` was taken — the call kept its output — and the call still ended in
 *  a failure or a cut: it broke off carrying the capability. The endpoint is remembered at that speed at once, without the run of
 *  cures: a later call to it (the agent loop's next turn among them) goes without the capability instead of trying it again. */
export declare function noteCapabilityBrokeOff(model: CapabilityEndpointModel, url: string, speed: CapabilityRequestSpeed, cap: ModelCapability): void;
/** A request that TRIED `cap` truly succeeded at the endpoint `url` at `speed`: the cures counted there are not in a row any more,
 *  so the count is forgotten. (A remembered endpoint never sees one — its requests withhold the capability.) */
export declare function noteCapabilityTaken(model: CapabilityEndpointModel, url: string, speed: CapabilityRequestSpeed, cap: ModelCapability): void;
/** What the endpoint memory holds for (`model`, `url`, `speed`, `cap`) — `undefined` unless the endpoint is remembered at that
 *  speed (a count still short of it answers nothing). A read is a use, whatever the entry holds: it refreshes the entry against
 *  the ceiling. */
export declare function rememberedCapabilityWithhold(model: CapabilityEndpointModel, url: string, speed: CapabilityRequestSpeed, cap: ModelCapability): CapabilityMemory | undefined;
/** Test seam: empties the process's endpoint memory, as at a process start. Never called by production code (a restart
 *  empties it; the durable answer is the model's catalog entry). */
export declare function __resetCapabilityMemory(): void;
/**
 * The capabilities one request withholds from `model` at `url` at `speed`, for a request that TRIES what the entry does not
 * declare — a turn of the agent loop (`tries`: the stream option `tryUndeclared`); for any other request `undefined`: it reads
 * the declaration only (the requester's reader is not consulted, so nothing undeclared is tried, counted or remembered). A
 * call's first build reads the endpoint memory at the speed that build goes at (each undeclared capability this endpoint is
 * remembered to serve without at that speed, {@link noteCapabilityCured}); every later build of the same call is handed the set
 * the call decided (`decided`, the engine's build overrides: the first build's set, plus the capability its fall-back withholds)
 * and reads nothing else, so a rebuild of the call's request (an output-cap re-shape, standard speed, the fall-back) is not
 * moved by what other calls learned meanwhile. Read once per request build by the
 * brain that builds it, and handed to the requester's reader ({@link capabilityTried}'s `withheld`, through the reasoning
 * applier). Only a capability whose `requested` cell says tried can be in it; one the entry declares (on or off) never is.
 */
export declare function requestWithheld(model: CapabilityEndpointModel & CapabilityDeclaringModel, url: string, speed: CapabilityRequestSpeed, decided: readonly ModelCapability[] | undefined, tries: boolean | undefined): ModelCapability[] | undefined;
export {};
