CoAgent8 - Source API
    Preparing search index...

    Function selectModel

    • Selects the model of a turn: the call's, else the session's, else the configured default, else the CLI's own default. A name the catalog lists, by id or alias, becomes the exact listed model; an unlisted name the CLI resolves itself is replaced by the concrete model the CLI reports for it, so consent, price checks and the turn name the same model.

      Parameters

      • id: "codex" | "claude" | "agy"

        Backend of the turn.

      • probe: AdapterProbeResult

        Its current probe; config.defaultModel is the CLI's own configured default.

      • requested: { model?: string; session?: string } = {}

        The call's model and the session's model, if any.

      • options: SelectModelOptions = {}

        observeAfresh asks the CLI again instead of reusing an observed model (doctor, which has just read the catalogs afresh). constraint applies a price limit when neither the call nor a session names a model, as choosePricedModel describes; a named model is returned as is and checked by the caller. config supplies an existing snapshot or configuration; catalog reuses pre-observed catalog evidence from provider routing (EXEC-001-T05a).

      Returns Promise<ModelSelection>

      MODEL_UNAVAILABLE when no source names a model; PRICE_LIMIT when a constraint applies and no model of this backend meets it.