import type { AgentId } from './types.js';
import { type ModelPricing } from './pricing/index.js';
/** Model identifiers per cloud provider (used by Claude's multi-cloud routing). */
export interface ModelPerCloud {
    firstParty: string;
    bedrock?: string;
    vertex?: string;
    foundry?: string;
    anthropicAws?: string;
    mantle?: string | null;
}
/** A reasoning effort level exposed by an agent's model. */
export interface ReasoningLevel {
    effort: string;
    description?: string;
}
/** Metadata for a single model within an agent's catalog. */
export interface ModelInfo {
    id: string;
    displayName?: string;
    description?: string;
    /** alias label (e.g. "opus", "sonnet", "haiku") that resolves to this id */
    alias?: string;
    /** true if this is the agent's default model */
    isDefault?: boolean;
    /** Per-cloud routing IDs (claude only) */
    perCloud?: ModelPerCloud;
    /** Reasoning levels (codex; claude exposes via --effort with global levels) */
    reasoningLevels?: ReasoningLevel[];
    /** Default reasoning level if applicable */
    defaultReasoningLevel?: string;
    /** Per-token USD pricing when known (from prices.json); absent for subscription/unpriced models. */
    pricing?: ModelPricing;
}
/** The complete model catalog for a specific (agent, version) pair. */
export interface ModelCatalog {
    agent: AgentId;
    version: string;
    source: ModelSourceKind;
    sourcePath: string;
    models: ModelInfo[];
    /** Aliases that the CLI resolves to a canonical id (e.g. { opus: "claude-opus-4-7" } for claude, { flash: "gemini-3-flash-preview" } for gemini) */
    aliases: Record<string, string>;
}
/** How the model catalog source was obtained. */
export type ModelSourceKind = 'bundle' | 'binary' | 'cli';
/** Describes the location and extraction strategy for a model catalog source. */
export interface ModelSource {
    path: string;
    kind: ModelSourceKind;
}
/**
 * Locate the file that authoritatively describes the installed model catalog
 * for a given (agent, version). The `kind` tells `getModelCatalog` how to
 * read it:
 *   bundle/binary -- strings(1)-style extraction (claude/codex)
 *   js            -- read + regex-parse an exported JS module (gemini)
 *   cli           -- spawn the agent's own `models` command (opencode/cursor/openclaw)
 *
 * Returns null if nothing usable is found.
 */
export declare function locateModelSource(agent: AgentId, version: string): ModelSource | null;
/**
 * Extract Claude's model catalog from its bundle/binary.
 *
 * Bundle/binary contains:
 *   - alias map: {opus:"claude-opus-4-7",sonnet:"claude-sonnet-4-6",haiku:"..."}
 *   - per-cloud maps: {firstParty:"claude-opus-4-5-...",bedrock:"...",vertex:"...",...}
 *   - constants: {OPUS_ID:"...",OPUS_NAME:"...",SONNET_ID:"...",...}
 */
/**
 * Drop a catalog id that is a proper dash-boundary prefix of a more-specific
 * sibling also present in the list (e.g. `claude-opus-4` when `claude-opus-4-8`
 * is present, or `claude-opus-4-1` when `claude-opus-4-1-20250805` is present).
 *
 * Two sources produce these prefix forms in the native binary:
 *  - standalone `.includes("claude-opus-4")` prefix-check strings (#1892)
 *  - per-cloud metadata field values such as `foundry:"claude-opus-4-1"` next
 *    to a real firstParty id `claude-opus-4-1-20250805` (#2233)
 *
 * A genuine bare current id with no longer sibling (e.g. `claude-sonnet-5`) is
 * kept. The dash boundary (`startsWith(id + '-')`) avoids collapsing
 * `claude-opus-4-1` into `claude-opus-4-10`.
 */
export declare function dropBareLegacyIds(ids: string[]): string[];
/**
 * Scan raw binary/bundle text for canonical Claude model ids, then drop bare
 * legacy / cloud-metadata prefixes (#1892, #2233). Two independent guards keep
 * non-model strings out of the catalog:
 *
 *  - **Word-boundary anchors on the id regex.** The id must not be glued to a
 *    surrounding identifier character, and must not be the truncated prefix of a
 *    longer *version* token. `(?<![A-Za-z0-9_])` rejects a glued prefix;
 *    `(?![A-Za-z0-9])` rejects a glued alnum suffix; `(?!\.\d)` rejects a
 *    dotted-version continuation — so the bare-major prefix of the binary's own
 *    "Typo in model ID" troubleshooting string `claude-sonnet-4.6` is not
 *    scraped as `claude-sonnet-4`, while a real id followed by an unrelated `.`
 *    suffix (`claude-fable-5.md`) still matches. Dash-separated segments only:
 *    the dotted form never appears in a genuine id.
 *
 *    The id body is captured inside a lookahead (`(?=(...))\1`) so the greedy
 *    `-\d+` run matches **atomically**: without it, a suffix-glued token like
 *    `claude-opus-4-1x` would fail the trailing anchor on the full match, then
 *    backtrack a segment and re-emit the bare `claude-opus-4` — the exact 404-able
 *    id this scan exists to suppress (two packed strings can end up glued with no
 *    separator in the extracted binary text). The atomic match fails outright
 *    instead of degrading to the bare form.
 *  - **`dropBareLegacyIds`.** A fully delimited string the anchors cannot tell
 *    apart from a real id — whether a bare major (`.includes("claude-opus-4")`)
 *    or a bare-minor per-cloud field value (`foundry:"claude-opus-4-1"`) — is
 *    dropped when a more-specific sibling is also present; a genuinely bare
 *    current id with no sibling (`claude-sonnet-5`) is kept.
 */
export declare function scanClaudeCatalogIds(text: string): string[];
/**
 * Parse `grok models` stdout into a catalog. Exported for unit tests.
 *
 * Output shape (verified 0.2.118):
 *   You are logged in with grok.com.
 *
 *   Default model: grok-4.5
 *
 *   Available models:
 *     * grok-4.5 (default)
 *
 * The `Default model:` line is authoritative; rows may also carry a leading `*`
 * and a `(default)` flag. Grok has no `--json` on this subcommand. Settings live
 * in `config.toml` / `models_cache.json`, not `settings.json`, so the native
 * settings.json reader cannot surface the default — the catalog is the source
 * that makes `resolveConfiguredModel` return a cli-default for Grok.
 */
export declare function parseGrokModelsStdout(stdout: string): {
    models: ModelInfo[];
    aliases: Record<string, string>;
};
export declare function getModelCatalog(agent: AgentId, version: string): ModelCatalog | null;
/** The result of resolving a user-supplied model string against the catalog. */
export interface ResolvedModel {
    /** The model string to forward to the CLI (canonical id when we can resolve, else passed through unchanged). */
    forwarded: string;
    /** The canonical id, when we could resolve the input through the alias map. */
    canonical?: string;
    /** Warning to surface to the user (e.g. "model X not in known catalog for v Y"). */
    warning?: string;
}
/**
 * Resolve a user-supplied model string for a specific (agent, version).
 *
 * Pass-through semantics: we never block. If the input doesn't match anything
 * we know about, we forward it as-is and return a warning the caller can log.
 *
 * - If `requested` matches an alias in the catalog (e.g. "opus"), we still
 *   forward the alias (the CLI accepts both), but we report the canonical id
 *   so logs/metadata can record the concrete model.
 * - If `requested` matches a known canonical id, no warning.
 * - If `requested` is unknown to our extractor, we forward it and warn.
 */
export declare function resolveModel(agent: AgentId, version: string, requested: string): ResolvedModel;
/**
 * Resolve the model id an `agents run` will ACTUALLY use, for cost estimation
 * (issue #346). The run path resolves the model in this precedence:
 *   1. explicit `--model` (or profile/workflow/runDefaults value) — `requested`
 *   2. otherwise the agent CLI's own built-in default, which we read from the
 *      extracted catalog's `isDefault` model.
 * Returns null only when we have neither — the caller must then treat the
 * estimate as unpriced rather than silently using an unpriced placeholder id
 * like `${agent}-default`.
 */
export declare function resolveEffectiveModel(agent: AgentId, version: string, requested?: string): string | null;
/** Where the model a given agent+version will actually run with came from. */
export type ConfiguredModelSource = 'run-default' | 'config' | 'cli-default';
export interface ConfiguredModel {
    /** The model id the agent will run with (e.g. `opus`, `gpt-5-codex`). */
    model: string;
    source: ConfiguredModelSource;
}
/**
 * The model a given agent+version is actually configured to use right now, with
 * where that selection comes from. First hit wins:
 *   1. run-default — the user's agents-cli `run.defaults` in agents.yaml
 *   2. config      — the agent's OWN native settings.json `model` field
 *   3. cli-default — the CLI's built-in default: the catalog's `isDefault` model
 *                    if one is flagged (e.g. Kimi), otherwise the literal
 *                    `default` for a model-capable agent whose runtime picks its
 *                    own default (Claude/Codex don't flag one — Claude's own UI
 *                    calls this "Default").
 * Each layer is a real source the agent consults; `version` must be concrete.
 * Returns null only when the agent exposes no model catalog at all.
 */
export declare function resolveConfiguredModel(agent: AgentId, version: string): ConfiguredModel | null;
/**
 * Join the identity cluster — `agent@version · model · account` — with a dim
 * separator, dropping empty pieces. Pieces are pre-colored by the caller so the
 * same cluster reads identically across `view`, `use`, `add`, and `status`.
 */
export declare function formatAgentIdentity(...parts: Array<string | null | undefined>): string;
/**
 * Build the per-agent CLI flags for a unified reasoning effort knob.
 *
 * Both Claude (`--effort`) and Codex (`-c model_reasoning_effort=...`) expose a
 * reasoning intensity dial. Inputs accepted: low | medium | high | xhigh | max | auto.
 * - Codex only supports low/medium/high; xhigh and max are clamped to high.
 * - 'auto' skips reasoning flags for codex (lets it use model default).
 * - 'auto' passes --effort auto to claude if supported.
 */
export declare function buildReasoningFlags(agent: AgentId, level: string): string[];
