/**
 * Test-connection probe for Anthropic API keys.
 *
 * Implements the staged-advisory contract: each call walks an ordered
 * sequence of stages (reachable → auth → listing → model_in_list), and
 * returns the per-stage outcomes plus an overall ok flag. The overall
 * flag is true IFF every non-advisory stage passed; the `model_in_list`
 * stage is advisory, so a missing model.id only surfaces as a hint —
 * the user might be using a preview-tagged or beta model that isn't in
 * the public listing yet.
 *
 * No upstream error bodies are echoed. Stage details are short,
 * human-authored strings, and never carry the API key, header values,
 * or the upstream response payload beyond what's explicitly modeled
 * here.
 *
 * Other providers (r2, brave) still use the legacy stub shape — they
 * return `{ ok, message, durationMs }` only, no stages. The shared
 * TestResult type below treats the new fields as optional so both
 * shapes coexist behind one type until later waves promote the rest
 * to staged diagnostics.
 */
/**
 * One step in a staged probe. The Anthropic probe today emits four
 * stages in order. Other probes (r2, brave) don't emit stages — they
 * fill `stages: undefined`.
 *
 * `error_code` is a stable string the UI can switch on (e.g. 'network',
 * 'unauthorized', 'upstream_5xx'). `detail` is human-readable copy
 * suitable for direct display; it never carries the secret value or an
 * echoed upstream-body fragment beyond a short canned phrase.
 */
export interface ProbeStage {
    name: 'reachable' | 'auth' | 'listing' | 'model_in_list';
    ok: boolean;
    error_code?: string;
    detail?: string;
}
export interface ProbeAdvisory {
    /**
     * Mirror of the `model_in_list` stage outcome — true when the
     * configured model.id was found in /v1/models, false when absent.
     * Undefined when the probe didn't get far enough to check (e.g.
     * stopped at `auth`).
     */
    model_in_list?: boolean;
    /** Top-N nearby IDs from the listing response, when model_in_list is false. */
    suggestions?: string[];
}
export interface TestResult {
    ok: boolean;
    /**
     * Short, human-readable status. Never carries the secret value.
     * Legacy callers (r2, brave stubs) still set this; the staged
     * Anthropic probe also sets it (mirrors the final stage's detail or
     * a one-liner summary) so a UI that hasn't been taught about
     * `stages` still has copy to render.
     */
    message?: string;
    /** Wall-clock duration in ms. */
    durationMs?: number;
    /**
     * Ordered probe stages. Present when the probe is staged; absent for
     * legacy stubs. The Anthropic probe always emits 1–4 entries
     * depending on how far it got.
     */
    stages?: ProbeStage[];
    /** Advisory hints (model_in_list, did-you-mean suggestions). */
    advisory?: ProbeAdvisory;
}
/**
 * Optional context passed alongside the probed value. Today only the
 * configured `model_id` is plumbed in — the API layer reads it from
 * the secret store and forwards it so stage 4 can verify the listing
 * contains the user's chosen ID. Stub probes ignore this param.
 */
export interface ProbeContext {
    model_id?: string;
}
/**
 * Pick the top-N closest model IDs to `needle` from `haystack`. Prefix
 * matches win first, then sort the rest by Levenshtein distance.
 * Returns at most `limit` entries.
 */
export declare function suggestModelIds(needle: string, haystack: readonly string[], limit?: number): string[];
/**
 * Anthropic probe entry point.
 *
 * Signature is loose so the legacy `(apiKey) => Promise<TestResult>`
 * call sites in `registry.ts` and the `/api/secrets/:key/test`
 * dispatcher keep working. When the API layer has a configured
 * `model.id` it forwards it via `ctx.model_id`; otherwise stage 4
 * runs without a needle and reports `model_in_list: undefined`.
 *
 * The injected `fetchImpl` lets unit tests swap in a mock without
 * patching the global. Default = the platform `fetch`.
 */
export declare function probeAnthropic(apiKey: string, ctx?: ProbeContext, fetchImpl?: typeof fetch): Promise<TestResult>;
