import type { ResolvedThinkingLevel } from "@oh-my-pi/pi-agent-core";
import type { Api, ApiKeyResolver, AssistantMessageEventStream, Context, Model, ServiceTierByFamily, SimpleStreamOptions } from "@oh-my-pi/pi-ai";
import type { ApiKeyResolverModel } from "../config/api-key-resolver.js";
import { Settings } from "../config/settings.js";
export interface BenchCommandArgs {
    models: string[];
    flags: {
        runs?: number;
        maxTokens?: number;
        prompt?: string;
        /** Service-tier setting value (`none` omits); overrides the configured `serviceTier` setting. */
        serviceTier?: string;
        json?: boolean;
        par?: number;
    };
}
export interface BenchModelRegistry {
    getAll(): Model<Api>[];
    getApiKey(model: Model<Api>, sessionId?: string): Promise<string | undefined>;
    resolver(model: ApiKeyResolverModel, sessionId?: string): ApiKeyResolver;
    hasConfiguredAuth?(model: Model<Api>): boolean;
}
export interface BenchRuntime {
    modelRegistry: BenchModelRegistry;
    settings?: Settings;
    close?: () => void;
}
export interface BenchRunSuccess {
    ok: true;
    ttftMs: number;
    durationMs: number;
    outputTokens: number;
    /** Generation throughput measured over the post-first-token window. */
    tokensPerSecond: number;
}
export interface BenchRunFailure {
    ok: false;
    error: string;
}
export type BenchRunResult = BenchRunSuccess | BenchRunFailure;
export interface BenchAverages {
    ttftMs: number;
    durationMs: number;
    outputTokens: number;
    tokensPerSecond: number;
}
export interface BenchModelReport {
    /** Selector as the user typed it (e.g. "opus" or "gemini-3.5:low"). */
    selector: string;
    /** Resolved `provider/id`. */
    model: string;
    /** Explicit thinking level from a `:level` selector suffix; undefined = provider default. */
    thinking?: ResolvedThinkingLevel;
    results: BenchRunResult[];
    /** Averages over successful runs; null when every run failed. */
    average: BenchAverages | null;
}
export interface BenchSummary {
    runs: number;
    maxTokens: number;
    models: BenchModelReport[];
    failures: number;
    /** Requested per-family service tiers, resolved per model before reaching the wire. */
    serviceTierByFamily?: ServiceTierByFamily;
}
type BenchStreamSimple = (model: Model<Api>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStream;
export interface BenchDependencies {
    createRuntime?: () => Promise<BenchRuntime>;
    randomSessionId?: () => string;
    writeStdout?: (text: string) => void;
    writeStderr?: (text: string) => void;
    setExitCode?: (code: number) => void;
    streamSimple?: BenchStreamSimple;
    now?: () => number;
    stdoutIsTTY?: boolean;
}
/**
 * Tokens/s over the generation window (duration minus TTFT) so queue/prefill
 * latency does not dilute throughput. Falls back to total duration when the
 * response arrived as a single chunk (TTFT ~ duration).
 */
export declare function computeTokensPerSecond(outputTokens: number, durationMs: number, ttftMs: number, deltaChunkCount: number): number;
export declare function formatBenchTable(summary: BenchSummary): string;
export declare function runBenchCommand(command: BenchCommandArgs, deps?: BenchDependencies): Promise<BenchSummary>;
export {};
