/** * Per-task model matrix resolution. * * The matrix (Config.modelMatrix) maps a catalog **role**, a **phase** name, or * the `*` default to a {@link ModelMatrixEntry} (model + optional provider). * At subagent spawn time we resolve the most specific match so different task * types can run on different models — e.g. `security-scanner` on one model, * `documentation` on another — while the leader keeps its own model. * * Resolution precedence (most → least specific): * 1. exact role (matrix["security-scanner"]) * 2. the role's phase (matrix["review"]) * 3. the `*` default (matrix["*"]) * 4. undefined (caller falls back to the leader model) * * Set via the `/setmodel` slash command; this module is the single source of * truth both that command and the spawn path use to validate + resolve keys. */ import type { Config, ModelMatrixEntry } from '../types/config.js'; /** Either a static matrix or a live getter (re-read on every spawn). */ export type ModelMatrixSource = Record | (() => Record | undefined); /** All valid phase keys, in catalog order. */ export declare const MATRIX_PHASE_KEYS: readonly string[]; /** The phase a catalog role belongs to, or undefined for unknown roles. */ export declare function phaseForRole(role: string | undefined): string | undefined; export type ModelMatrixResolutionSource = 'role' | 'phase' | 'default'; export interface ModelMatrixResolution { entry: ModelMatrixEntry; source: ModelMatrixResolutionSource; key: string; } /** * Resolve the matrix entry plus the key tier it came from. Use this when the * caller needs to distinguish an explicit role/phase pin from the global `*` * default. */ export declare function resolveModelMatrixResolution(matrix: Record | undefined, role: string | undefined): ModelMatrixResolution | undefined; /** * Resolve the matrix entry for a subagent role. Returns the most specific * match (role → phase → `*`), or undefined when nothing matches. */ export declare function resolveModelMatrix(matrix: Record | undefined, role: string | undefined): ModelMatrixEntry | undefined; export interface ResolvedModelTarget { provider?: string | undefined; model?: string | undefined; modelRuntime?: Config['modelRuntime'] | undefined; fallbackModels?: string[] | undefined; fallbackProfile?: string | undefined; } export interface ResolvedSubagentModelTarget extends ResolvedModelTarget { /** Where the concrete provider/model came from. */ source: 'matrix' | 'diversity' | 'none'; /** Matrix tier used before any reviewer diversity adjustment. */ matrixSource?: ModelMatrixResolutionSource | undefined; /** True when a reviewer model was shifted away from the implementation model. */ diversified?: boolean | undefined; } /** * Expand a matrix entry into a concrete primary model plus optional fallback * chain. A profile-only matrix entry treats the first profile model as primary * and the remaining profile entries as that subagent's fallback chain. */ export declare function resolveModelTargetFromEntry(config: Config, entry: ModelMatrixEntry | undefined): ResolvedModelTarget | undefined; export interface ModelReference { provider?: string | undefined; model?: string | undefined; } /** * Roles whose output is meant to challenge an implementer. When these roles * would otherwise use the same provider/model as the implementation path, * WrongStack tries to pick a different available model to reduce correlated * model-family mistakes. Exact role/phase `/setmodel` entries still win. */ export declare function roleNeedsIndependentReviewModel(role: string | undefined): boolean; /** * Resolve a subagent's matrix target with the reviewer diversity rule applied. * * Precedence: * 1. Exact role or phase matrix entry. * 2. Global `*` matrix entry when it is already different from the * implementation model. * 3. A different configured provider/model for review roles. * 4. The matrix/leader fallback. */ export declare function resolveSubagentModelTarget(config: Config, role: string | undefined, opts?: { implementationTarget?: ModelReference | undefined; }): ResolvedSubagentModelTarget | undefined; /** * Resolve the default implementation lane. The generic Executor is the closest * stable proxy for "the implementer" when a reviewer is spawned without a * concrete sibling id. */ export declare function resolveImplementationModelTarget(config: Config): ModelReference; export declare function sameModelReference(a: ModelReference | undefined, b: ModelReference | undefined): boolean; export type MatrixKeyKind = 'role' | 'phase' | 'default' | 'unknown'; /** Classify a matrix key so `/setmodel` can reject typos before persisting. */ export declare function matrixKeyKind(key: string): MatrixKeyKind; /** True when `key` is a usable matrix key (role, phase, or `*`). */ export declare function isValidMatrixKey(key: string): boolean; //# sourceMappingURL=model-matrix.d.ts.map