config

Classes

AvailabilityCache

Defined in: packages/nexus-agents/src/config/model-availability.ts:59

Bounded TTL cache for model availability probe results. Thread-safe for single-threaded Node.js; no locks needed.

Constructors

Constructor
new AvailabilityCache(config?): AvailabilityCache;

Defined in: packages/nexus-agents/src/config/model-availability.ts:64

Parameters
config?

AvailabilityCacheConfig = {}

Returns

AvailabilityCache

Accessors

size
Get Signature
get size(): number;

Defined in: packages/nexus-agents/src/config/model-availability.ts:124

Number of cached entries.

Returns

number

Methods

clear()
clear(): void;

Defined in: packages/nexus-agents/src/config/model-availability.ts:129

Clear all cached entries.

Returns

void

entries()
entries(): readonly ProbeResult[];

Defined in: packages/nexus-agents/src/config/model-availability.ts:119

Get all cached entries (for diagnostics).

Returns

readonly ProbeResult[]

get()
get(modelId): ProbeResult | undefined;

Defined in: packages/nexus-agents/src/config/model-availability.ts:70

Get a cached probe result, or undefined if expired/missing.

Parameters
modelId

| "claude-fable-5" | "claude-opus" | "claude-sonnet" | "claude-haiku" | "gemini-3-pro" | "gemini-pro" | "gemini-3.5-flash" | "gemini-3-flash" | "gemini-flash" | "gpt-5.6-sol" | "gpt-5.5" | "codex-5.3" | "codex-5.2" | "codex-5.1-mini" | "opencode-default" | "opencode-custom-opus" | "opencode-custom-sonnet" | "openrouter-nemotron-super" | "openrouter-qwen-coder"

Returns

ProbeResult | undefined

isKnownUnavailable()
isKnownUnavailable(modelId): boolean;

Defined in: packages/nexus-agents/src/config/model-availability.ts:113

Check if a model is known-unavailable (cached and not expired).

Parameters
modelId

| "claude-fable-5" | "claude-opus" | "claude-sonnet" | "claude-haiku" | "gemini-3-pro" | "gemini-pro" | "gemini-3.5-flash" | "gemini-3-flash" | "gemini-flash" | "gpt-5.6-sol" | "gpt-5.5" | "codex-5.3" | "codex-5.2" | "codex-5.1-mini" | "opencode-default" | "opencode-custom-opus" | "opencode-custom-sonnet" | "openrouter-nemotron-super" | "openrouter-qwen-coder"

Returns

boolean

markAvailable()
markAvailable(modelId, latencyMs): void;

Defined in: packages/nexus-agents/src/config/model-availability.ts:103

Mark a model as available.

Parameters
modelId

| "claude-fable-5" | "claude-opus" | "claude-sonnet" | "claude-haiku" | "gemini-3-pro" | "gemini-pro" | "gemini-3.5-flash" | "gemini-3-flash" | "gemini-flash" | "gpt-5.6-sol" | "gpt-5.5" | "codex-5.3" | "codex-5.2" | "codex-5.1-mini" | "opencode-default" | "opencode-custom-opus" | "opencode-custom-sonnet" | "openrouter-nemotron-super" | "openrouter-qwen-coder"

latencyMs

number

Returns

void

markUnavailable()
markUnavailable(modelId, error): void;

Defined in: packages/nexus-agents/src/config/model-availability.ts:92

Mark a model as unavailable without a full probe.

Parameters
modelId

| "claude-fable-5" | "claude-opus" | "claude-sonnet" | "claude-haiku" | "gemini-3-pro" | "gemini-pro" | "gemini-3.5-flash" | "gemini-3-flash" | "gemini-flash" | "gpt-5.6-sol" | "gpt-5.5" | "codex-5.3" | "codex-5.2" | "codex-5.1-mini" | "opencode-default" | "opencode-custom-opus" | "opencode-custom-sonnet" | "openrouter-nemotron-super" | "openrouter-qwen-coder"

error

string

Returns

void

set()
set(result): void;

Defined in: packages/nexus-agents/src/config/model-availability.ts:81

Store a probe result, evicting oldest if at capacity.

Parameters
result

ProbeResult

Returns

void


AvailableModelsCache

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:79

Constructors

Constructor
new AvailableModelsCache(options): AvailableModelsCache;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:86

Parameters
options

AvailableModelsCacheOptions

Returns

AvailableModelsCache

Methods

addSource()
addSource(source): void;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:103

Register a source after construction. Used by adapter factories that wire themselves into the default cache lazily as they’re built. Duplicate names are ignored (first registration wins, on the assumption that the same factory might run twice in a test session).

Parameters
source

AvailableModelsSource

Returns

void

byProvider()
byProvider(sourceName): Promise<readonly AvailableModel[]>;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:134

Models reported by one named source (subset of getAll).

Parameters
sourceName

string

Returns

Promise<readonly AvailableModel[]>

getAll()
getAll(): Promise<readonly AvailableModel[]>;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:123

Returns the union of every source’s available models. Stale-while- revalidate: serve fresh-or-stale immediately, refresh stale entries in the background. First call (no cache yet) blocks on every source.

Returns

Promise<readonly AvailableModel[]>

has()
has(modelId): Promise<boolean>;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:140

True iff some source currently reports the given model id.

Parameters
modelId

string

Returns

Promise<boolean>

refresh()
refresh(): Promise<readonly AvailableModel[]>;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:146

Force a synchronous refresh of every source — used after a 404.

Returns

Promise<readonly AvailableModel[]>

removeSource()
removeSource(name): void;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:113

Remove a previously-registered source. Used by tests + by factories that want to drop a probe when an adapter is being disposed.

Parameters
name

string

Returns

void


ModelRegistry

Defined in: packages/nexus-agents/src/config/model-registry.ts:228

The unified model-metadata registry. Construct once, share across the process. getEntry(modelId) always returns something.

Constructors

Constructor
new ModelRegistry(options?): ModelRegistry;

Defined in: packages/nexus-agents/src/config/model-registry.ts:239

Parameters
options?

ModelRegistryOptions = {}

Returns

ModelRegistry

Methods

allEntries()
allEntries(): readonly ModelEntry[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:302

All loaded entries across every tier (generated + models.dev + in-tree + manifest), deduped by id (later sources overwrite earlier). This is NOT filtered to authoritative entries — models-dev/generated are catalog-breadth tiers; use hasAuthoritative() to tell them apart.

Returns

readonly ModelEntry[]

getEntry()
getEntry(modelId, hints?): ModelEntry;

Defined in: packages/nexus-agents/src/config/model-registry.ts:263

Resolve a model id to its full metadata entry. Always returns — unknown models get a derived entry with sensible defaults.

On exact miss, the normalized/identity resolution tier (#4164) runs BEFORE derivation so decorated gateway ids (Claude_Opus_4.8_hardened) still pick up the canonical entry’s pricing/metadata.

Parameters
modelId

string

hints?

ModelHints

Returns

ModelEntry

hasAuthoritative()
hasAuthoritative(modelId): boolean;

Defined in: packages/nexus-agents/src/config/model-registry.ts:292

Has the registry got an authoritative entry for this id? Consumers use this to distinguish “we know X” from “we guessed.”

Parameters
modelId

string

Returns

boolean

toMap()
toMap(): ReadonlyMap<string, ModelEntry>;

Defined in: packages/nexus-agents/src/config/model-registry.ts:307

Snapshot of canonical id → entry mapping.

Returns

ReadonlyMap<string, ModelEntry>

Interfaces

AvailabilityCacheConfig

Defined in: packages/nexus-agents/src/config/model-availability.ts:32

Configuration for the availability cache.

Properties

maxEntries?
readonly optional maxEntries?: number;

Defined in: packages/nexus-agents/src/config/model-availability.ts:36

Maximum entries in the cache. Default: 50.

ttlMs?
readonly optional ttlMs?: number;

Defined in: packages/nexus-agents/src/config/model-availability.ts:34

Time-to-live in ms for probe results. Default: 60_000 (1 min).


AvailableModel

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:56

One row in the cache: model id + which source first reported it.

Properties

id
readonly id: string;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:57

provider?
readonly optional provider?: string;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:60

provider/ prefix when the source uses one; otherwise the providerHint.

source
readonly source: string;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:58


AvailableModelsCacheOptions

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:63

Properties

now?
readonly optional now?: () => number;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:70

Override Date.now for tests.

Returns

number

sources
readonly sources: readonly AvailableModelsSource[];

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:64

staleTtlMs?
readonly optional staleTtlMs?: number;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:68

Beyond this, callers block on the next refresh. Defaults to 25 minutes.

ttlMs?
readonly optional ttlMs?: number;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:66

Freshness TTL (ms). Defaults to 5 minutes.


AvailableModelsSource

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:42

One adapter (CLI or API) that can be asked what models it currently has. Exists so this cache doesn’t have to know about IModelAdapter vs ICliAdapter — both can adapt themselves to this minimal surface.

Properties

name
readonly name: string;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:44

Stable, human-readable identifier — e.g. claude, gateway-openrouter.

providerHint?
readonly optional providerHint?: string;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:50

Optional vendor-family hint — anthropic / openai / google / etc. Used to pre-tag entries when the source’s own model ids don’t carry a provider/ prefix (Anthropic API, Google API).

Methods

listModels()
listModels(): Promise<readonly {
  id: string;
}[]>;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:52

Probe the underlying surface for currently available models.

Returns

Promise<readonly { id: string; }[]>


EnvValidationResult

Defined in: packages/nexus-agents/src/config/env-schema.ts:521

Result of validating NEXUS_* environment variables.

Properties

deprecatedVars?
readonly optional deprecatedVars?: readonly DeprecatedGatewayEnvUse[];

Defined in: packages/nexus-agents/src/config/env-schema.ts:530

Deprecated names in use (#4392 increment 3). Optional so a caller that builds this shape by hand keeps compiling; validateNexusEnv always fills it, empty when none is set.

ineffectiveVars
readonly ineffectiveVars: readonly IneffectiveVar[];

Defined in: packages/nexus-agents/src/config/env-schema.ts:524

invalidVars
readonly invalidVars: readonly InvalidVar[];

Defined in: packages/nexus-agents/src/config/env-schema.ts:523

unknownVars
readonly unknownVars: readonly UnknownVar[];

Defined in: packages/nexus-agents/src/config/env-schema.ts:522


FallbackEntry

Defined in: packages/nexus-agents/src/config/model-availability.ts:43

Fallback chain entry with model and reason for fallback.

Properties

modelId
readonly modelId: 
  | "claude-fable-5"
  | "claude-opus"
  | "claude-sonnet"
  | "claude-haiku"
  | "gemini-3-pro"
  | "gemini-pro"
  | "gemini-3.5-flash"
  | "gemini-3-flash"
  | "gemini-flash"
  | "gpt-5.6-sol"
  | "gpt-5.5"
  | "codex-5.3"
  | "codex-5.2"
  | "codex-5.1-mini"
  | "opencode-default"
  | "opencode-custom-opus"
  | "opencode-custom-sonnet"
  | "openrouter-nemotron-super"
  | "openrouter-qwen-coder";

Defined in: packages/nexus-agents/src/config/model-availability.ts:44

reason
readonly reason: string;

Defined in: packages/nexus-agents/src/config/model-availability.ts:45


IneffectiveVar

Defined in: packages/nexus-agents/src/config/env-schema.ts:506

A variable that is spelled correctly, holds a valid value, and still changes nothing — the request was reduced by a downstream clamp.

This is the category the report was missing. “Unknown” catches a typo and “invalid” catches a bad value; a correctly-set variable that is silently capped passes both and does nothing, which is the failure mode #5155 named for the boolean flags and which the timeout knobs still had.

Properties

effectiveMs
readonly effectiveMs: number;

Defined in: packages/nexus-agents/src/config/env-schema.ts:509

name
readonly name: string;

Defined in: packages/nexus-agents/src/config/env-schema.ts:507

reason
readonly reason: string;

Defined in: packages/nexus-agents/src/config/env-schema.ts:510

requestedMs
readonly requestedMs: number;

Defined in: packages/nexus-agents/src/config/env-schema.ts:508


InvalidVar

Defined in: packages/nexus-agents/src/config/env-schema.ts:491

An invalid NEXUS_* env var with error message.

Properties

error
readonly error: string;

Defined in: packages/nexus-agents/src/config/env-schema.ts:494

name
readonly name: string;

Defined in: packages/nexus-agents/src/config/env-schema.ts:492

value
readonly value: string;

Defined in: packages/nexus-agents/src/config/env-schema.ts:493


ModelEntry

Defined in: packages/nexus-agents/src/config/model-registry.ts:124

One model’s full metadata. Combines what was previously split across ModelCapability (capability/pricing/quality) and ModelBehaviorProfile (runtime behaviour toggles).

All capability + pricing + quality fields are optional because derived entries (vendor known but no authoritative data) won’t have them. Routing consumers must handle absence gracefully.

Behaviour fields always have values (defaulted from vendor/family profile if no exact entry exists).

Properties

aliases?
readonly optional aliases?: readonly string[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:133

Alternate strings that should resolve to this entry. Operators extend via the manifest (PR 4) when a gateway exposes a renamed version of a known model.

cliAlias?
readonly optional cliAlias?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:172

Short alias the CLI accepts (e.g. ‘opus’ for claude).

cliModelName?
readonly optional cliModelName?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:174

Vendor model id the CLI passes upstream (e.g. ‘claude-opus-4-6’).

cliName?
readonly optional cliName?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:170

Which CLI tool this model belongs to (e.g. ‘claude’, ‘gemini’).

contextWindow?
readonly optional contextWindow?: number;

Defined in: packages/nexus-agents/src/config/model-registry.ts:144

displayName?
readonly optional displayName?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:141

Human-readable display name for UI / logs.

family
readonly family: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:137

Family inside a vendor — claude-opus, gpt-4o, llama-3.

id
readonly id: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:127

Canonical id, e.g. claude-opus-4-1, gpt-5.4, meta/llama-3-70b.

inputModalities?
readonly optional inputModalities?: readonly ("text" | "code" | "image" | "audio" | "video" | "pdf")[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:146

matchedVia?
readonly optional matchedVia?: MatchedVia;

Defined in: packages/nexus-agents/src/config/model-registry.ts:194

Set when the normalized/identity resolution tier (#4164) matched this (decorated) id to a canonical entry. Absent for exact/alias hits and pure derivation.

maxOutputTokens?
readonly optional maxOutputTokens?: number;

Defined in: packages/nexus-agents/src/config/model-registry.ts:145

maxRecommendedTurnBudget
readonly maxRecommendedTurnBudget: number;

Defined in: packages/nexus-agents/src/config/model-registry.ts:180

maxTokensParam?
readonly optional maxTokensParam?: "max_tokens" | "max_completion_tokens";

Defined in: packages/nexus-agents/src/config/model-registry.ts:166

Max-tokens param name this model expects (carried from ModelCapability.maxTokensParam, #4049/#4067). Absence defaults to 'max_tokens' (with the OpenAI-reasoning regex fallback).

notes?
readonly optional notes?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:154

outputModalities?
readonly optional outputModalities?: readonly (
  | "text"
  | "image_png"
  | "image_jpeg"
  | "audio_pcm"
  | "audio_wav"
  | "audio_mp3"
  | "video_mp4"
  | "svg"
  | "structured_json"
  | "code")[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:147

parallelToolCalls
readonly parallelToolCalls: boolean;

Defined in: packages/nexus-agents/src/config/model-registry.ts:177

pricing?
readonly optional pricing?: {
  cacheReadPer1M?: number;
  cacheWritePer1M?: number;
  inputPer1M: number;
  outputPer1M: number;
};

Defined in: packages/nexus-agents/src/config/model-registry.ts:150

cacheReadPer1M?
optional cacheReadPer1M?: number;

Cache rates, USD per 1M tokens (#5170). OPTIONAL and absent by default: roughly half the catalogue publishes neither, and absent must stay distinguishable from zero — a 0 would price a cache-heavy call as free, where absent makes computeTokenCost report the component unpriced.

cacheWritePer1M?
optional cacheWritePer1M?: number;
inputPer1M
inputPer1M: number;
outputPer1M
outputPer1M: number;
pricingProvenance?
readonly optional pricingProvenance?: ModelPricingProvenance;

Defined in: packages/nexus-agents/src/config/model-registry.ts:152

Present when pricing has a narrower scope than generic provider billing.

profileId
readonly profileId: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:183

promptCaching
readonly promptCaching: PromptCachingMode;

Defined in: packages/nexus-agents/src/config/model-registry.ts:178

qualityScores?
readonly optional qualityScores?: {
  codeGeneration: number;
  cost: number;
  reasoning: number;
  speed: number;
};

Defined in: packages/nexus-agents/src/config/model-registry.ts:153

codeGeneration
codeGeneration: number;
cost
cost: number;
reasoning
reasoning: number;
speed
speed: number;
quirks
readonly quirks: readonly string[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:182

resolvedFrom?
readonly optional resolvedFrom?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:196

Canonical id of the matched entry the pricing/metadata came from.

source
readonly source: EntrySource;

Defined in: packages/nexus-agents/src/config/model-registry.ts:186

specialFeatures?
readonly optional specialFeatures?: readonly (
  | "extended_thinking"
  | "deep_research"
  | "streaming"
  | "grounding"
  | "citations"
  | "image_editing"
  | "voice_cloning"
  | "live_api"
  | "context_caching")[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:149

strictJson
readonly strictJson: boolean;

Defined in: packages/nexus-agents/src/config/model-registry.ts:181

toolCapabilities?
readonly optional toolCapabilities?: readonly (
  | "mcp"
  | "function_calling"
  | "computer_use"
  | "code_execution_sandbox"
  | "web_search"
  | "file_operations"
  | "structured_output"
  | "apply_patch")[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:148

toolDefinitionFormat
readonly toolDefinitionFormat: ToolDefinitionFormat;

Defined in: packages/nexus-agents/src/config/model-registry.ts:179

unsupportedParameters?
readonly optional unsupportedParameters?: readonly string[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:160

Request parameters this model rejects (carried from ModelCapability.unsupportedParameters, #4067). Consumed by model-parameter-support.ts; absence means the regex fallback applies.

vendor
readonly vendor: ModelVendor;

Defined in: packages/nexus-agents/src/config/model-registry.ts:135

Coarse vendor bucket — drives behaviour-profile fallback chains.

verifiedAt?
readonly optional verifiedAt?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:188

ISO date when this entry was last validated against the upstream.

version?
readonly optional version?: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:139

Version string (best-effort; 4-1, 2024-08-06, etc).


ModelPricingProvenance

Defined in: packages/nexus-agents/src/config/model-registry.ts:106

An official rate that applies only within the named participant program.

Properties

scope
readonly scope: "project-glasswing-participants";

Defined in: packages/nexus-agents/src/config/model-registry.ts:108

source
readonly source: "anthropic";

Defined in: packages/nexus-agents/src/config/model-registry.ts:107

upstreamUrl
readonly upstreamUrl: string;

Defined in: packages/nexus-agents/src/config/model-registry.ts:109


ModelRegistryOptions

Defined in: packages/nexus-agents/src/config/model-registry.ts:208

Properties

generatedEntries?
readonly optional generatedEntries?: readonly ModelEntry[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:221

Broad generated-catalog (LiteLLM) breadth entries. LOWEST priority — overwritten by every other tier; provides long-tail coverage so unknown models resolve to real catalog data instead of a bare derived default (#3293, preserving the legacy CapabilityDiscovery T2 breadth).

inTreeEntries?
readonly optional inTreeEntries?: readonly ModelEntry[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:210

Authoritative in-tree entries. Highest priority.

manifestEntries?
readonly optional manifestEntries?: readonly ModelEntry[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:214

Operator manifest entries. Higher priority than in-tree.

modelsDevEntries?
readonly optional modelsDevEntries?: readonly ModelEntry[];

Defined in: packages/nexus-agents/src/config/model-registry.ts:212

models.dev snapshot entries. Lower priority than in-tree.


ProbeResult

Defined in: packages/nexus-agents/src/config/model-availability.ts:23

Status of a model probe.

Properties

available
readonly available: boolean;

Defined in: packages/nexus-agents/src/config/model-availability.ts:25

checkedAt
readonly checkedAt: number;

Defined in: packages/nexus-agents/src/config/model-availability.ts:27

error?
readonly optional error?: string;

Defined in: packages/nexus-agents/src/config/model-availability.ts:28

latencyMs
readonly latencyMs: number;

Defined in: packages/nexus-agents/src/config/model-availability.ts:26

modelId
readonly modelId: 
  | "claude-fable-5"
  | "claude-opus"
  | "claude-sonnet"
  | "claude-haiku"
  | "gemini-3-pro"
  | "gemini-pro"
  | "gemini-3.5-flash"
  | "gemini-3-flash"
  | "gemini-flash"
  | "gpt-5.6-sol"
  | "gpt-5.5"
  | "codex-5.3"
  | "codex-5.2"
  | "codex-5.1-mini"
  | "opencode-default"
  | "opencode-custom-opus"
  | "opencode-custom-sonnet"
  | "openrouter-nemotron-super"
  | "openrouter-qwen-coder";

Defined in: packages/nexus-agents/src/config/model-availability.ts:24


UnknownVar

Defined in: packages/nexus-agents/src/config/env-schema.ts:485

An unknown NEXUS_* env var with optional typo suggestion.

Properties

name
readonly name: string;

Defined in: packages/nexus-agents/src/config/env-schema.ts:486

suggestion
readonly suggestion: string | null;

Defined in: packages/nexus-agents/src/config/env-schema.ts:487

Type Aliases

AppConfig

type AppConfig = z.infer<typeof AppConfigSchema>;

Defined in: packages/nexus-agents/src/config/schemas.ts:156

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


ConfigExpertConfig

type ConfigExpertConfig = z.infer<typeof ConfigExpertConfigSchema>;

Defined in: packages/nexus-agents/src/config/schemas-expert.ts:130

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


ConfigExpertDefinition

type ConfigExpertDefinition = z.infer<typeof ConfigExpertDefinitionSchema>;

Defined in: packages/nexus-agents/src/config/schemas-expert.ts:109

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


DeprecatedVar

type DeprecatedVar = DeprecatedGatewayEnvUse;

Defined in: packages/nexus-agents/src/config/env-schema.ts:518

A deprecated alias that is set: which name replaces it, and whether the replacement is also set (in which case the alias is ignored). Currently the two gateway aliases of #4392 increment 3.


EntrySource

type EntrySource = "in-tree" | "models-dev" | "manifest" | "derived" | "generated";

Defined in: packages/nexus-agents/src/config/model-registry.ts:95

Where this entry came from. Higher-priority sources override lower ones field-by-field; derived is always the fallback floor.


LoggingConfig

type LoggingConfig = z.infer<typeof LoggingConfigSchema>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:20

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


ModelConfig

type ModelConfig = z.infer<typeof ModelConfigSchema>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:54

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


ModelTiers

type ModelTiers = z.infer<typeof ModelTiersSchema>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:43

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


ProbeFn

type ProbeFn = (modelId) => Promise<ProbeResult>;

Defined in: packages/nexus-agents/src/config/model-availability.ts:40

A function that probes whether a model is reachable.

Parameters

modelId

ModelId

Returns

Promise<ProbeResult>


PromptCachingMode

type PromptCachingMode = "none" | "ephemeral" | "aggressive";

Defined in: packages/nexus-agents/src/config/model-registry.ts:85

Prompt-caching opt-in level. 'ephemeral' adds Anthropic-style cache_control markers; other providers ignore the field.


ProviderConfig

type ProviderConfig = z.infer<typeof ProviderConfigSchema>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:32

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


SecurityConfig

type SecurityConfig = z.infer<typeof SecurityConfigSchema>;

Defined in: packages/nexus-agents/src/config/schemas-security.ts:195

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)


ToolDefinitionFormat

type ToolDefinitionFormat = "openai" | "anthropic" | "gemini";

Defined in: packages/nexus-agents/src/config/model-registry.ts:79

Tool-definition format the model expects in CompletionRequest.tools. Each IModelAdapter translates from the canonical ToolDefinition shape to the provider’s native form, so this field is informational for routing/scoring, not request-side.


WorkflowConfig

type WorkflowConfig = z.infer<typeof WorkflowConfigSchema>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:65

Config exports - Configuration schemas Split from index.ts for file size compliance (Issue #285)

Variables

AppConfigSchema

const AppConfigSchema: ZodObject<{
  experts: ZodOptional<ZodObject<{
     builtin: ZodDefault<ZodBoolean>;
     custom: ZodOptional<ZodRecord<ZodString, ZodObject<{
        available: ZodDefault<ZodBoolean>;
        capabilities: ZodDefault<ZodArray<...>>;
        description: ZodOptional<ZodString>;
        domain: ZodDefault<ZodEnum<...>>;
        secondaryDomains: ZodOptional<ZodArray<...>>;
        systemPrompt: ZodString;
        temperature: ZodDefault<ZodNumber>;
        tier: ZodDefault<ZodEnum<...>>;
        tools: ZodOptional<ZodArray<...>>;
        weight: ZodDefault<ZodNumber>;
     }, $strip>>>;
  }, $strip>>;
  gateway: ZodOptional<ZodObject<{
     enabled: ZodDefault<ZodBoolean>;
     tierOverrides: ZodOptional<ZodRecord<ZodString, ZodEnum<{
        ANALYZED: "ANALYZED";
        DIRECT: "DIRECT";
        ORCHESTRATED: "ORCHESTRATED";
     }>>>;
     upstreamServers: ZodOptional<ZodArray<ZodObject<{
        args: ZodDefault<ZodArray<...>>;
        command: ZodEnum<{
           docker: ...;
           node: ...;
           npx: ...;
           python: ...;
           python3: ...;
           uvx: ...;
        }>;
        env: ZodOptional<ZodRecord<..., ...>>;
        lazy: ZodDefault<ZodBoolean>;
        name: ZodString;
        timeoutMs: ZodDefault<ZodNumber>;
     }, $strip>>>;
  }, $strip>>;
  logging: ZodOptional<ZodObject<{
     destination: ZodDefault<ZodEnum<{
        file: "file";
        stderr: "stderr";
        stdout: "stdout";
     }>>;
     filePath: ZodOptional<ZodString>;
     format: ZodDefault<ZodEnum<{
        json: "json";
        pretty: "pretty";
     }>>;
     level: ZodDefault<ZodEnum<{
        debug: "debug";
        error: "error";
        info: "info";
        warn: "warn";
     }>>;
  }, $strip>>;
  memory: ZodOptional<ZodObject<{
     decay: ZodOptional<ZodObject<{
        adaptivePriorityThreshold: ZodOptional<ZodNumber>;
        agenticImportanceThreshold: ZodOptional<ZodNumber>;
        agenticMaxEntries: ZodOptional<ZodNumber>;
        beliefMaxAgeDays: ZodOptional<ZodNumber>;
        checkCrossReferences: ZodOptional<ZodBoolean>;
        crossReferenceGracePeriodMs: ZodOptional<ZodNumber>;
        decayIntervalMs: ZodOptional<ZodNumber>;
        enabled: ZodOptional<ZodBoolean>;
        mobimemEvictOnDecay: ZodOptional<ZodBoolean>;
     }, $strip>>;
  }, $strip>>;
  models: ZodObject<{
     default: ZodString;
     providers: ZodOptional<ZodRecord<ZodString, ZodObject<{
        apiKey: ZodOptional<ZodString>;
        baseUrl: ZodOptional<ZodURL>;
        maxRetries: ZodDefault<ZodNumber>;
        timeout: ZodDefault<ZodNumber>;
     }, $strip>>>;
     tiers: ZodObject<{
        balanced: ZodArray<ZodString>;
        fast: ZodArray<ZodString>;
        powerful: ZodArray<ZodString>;
     }, $strip>;
  }, $strip>;
  observability: ZodOptional<ZodObject<{
     eventBus: ZodOptional<ZodObject<{
        enabled: ZodDefault<ZodBoolean>;
        logging: ZodDefault<ZodObject<{
           frequentEventLevel: ...;
           importantEventLevel: ...;
        }, $strip>>;
        maxHistorySize: ZodDefault<ZodNumber>;
        subscriptions: ZodDefault<ZodObject<{
           agent: ...;
           byzantine: ...;
           consensus: ...;
           message: ...;
           protocol: ...;
           session: ...;
        }, $strip>>;
     }, $strip>>;
     swarmObserverMaxEvents: ZodDefault<ZodNumber>;
  }, $strip>>;
  routing: ZodOptional<ZodObject<{
     budget: ZodOptional<ZodObject<{
        maxCostUsd: ZodOptional<ZodNumber>;
        maxLatencyMs: ZodOptional<ZodNumber>;
        maxTokens: ZodOptional<ZodNumber>;
        taskClassMaxCostUsd: ZodOptional<ZodRecord<... & ..., ZodNumber>>;
     }, $strip>>;
     latencyScoreWeight: ZodDefault<ZodNumber>;
     latencyTracker: ZodOptional<ZodObject<{
        decayFactor: ZodDefault<ZodNumber>;
        maxSampleAgeMs: ZodDefault<ZodNumber>;
        percentiles: ZodDefault<ZodArray<ZodNumber>>;
        windowSize: ZodDefault<ZodNumber>;
     }, $strip>>;
     linucb: ZodOptional<ZodObject<{
        alpha: ZodDefault<ZodNumber>;
        maxDecisionTimeMs: ZodDefault<ZodNumber>;
     }, $strip>>;
     preference: ZodOptional<ZodObject<{
        minDataPoints: ZodDefault<ZodNumber>;
     }, $strip>>;
     routingMemory: ZodOptional<ZodObject<{
        actionCacheMaxAgeMs: ZodDefault<ZodNumber>;
        confidenceThreshold: ZodDefault<ZodNumber>;
        minObservations: ZodDefault<ZodNumber>;
        successRateThreshold: ZodDefault<ZodNumber>;
     }, $strip>>;
     stages: ZodOptional<ZodObject<{
        budgetFilter: ZodDefault<ZodBoolean>;
        capabilityMatch: ZodDefault<ZodBoolean>;
        confidenceCascade: ZodDefault<ZodBoolean>;
        latencyTracking: ZodDefault<ZodBoolean>;
        linucbSelection: ZodDefault<ZodBoolean>;
        preferenceRouting: ZodDefault<ZodBoolean>;
        qualityConstraint: ZodDefault<ZodBoolean>;
        resourceStrategy: ZodDefault<ZodBoolean>;
        routingMemory: ZodDefault<ZodBoolean>;
        strategyDistillation: ZodDefault<ZodBoolean>;
        topsisRanking: ZodDefault<ZodBoolean>;
        zeroRouter: ZodDefault<ZodBoolean>;
     }, $strip>>;
     topsis: ZodOptional<ZodObject<{
        criteria: ZodOptional<ZodArray<ZodObject<..., ...>>>;
        maxCostPerRequest: ZodOptional<ZodNumber>;
        maxLatencyMs: ZodOptional<ZodNumber>;
        minQualityThreshold: ZodDefault<ZodNumber>;
        verbose: ZodDefault<ZodBoolean>;
     }, $strip>>;
     zeroRouter: ZodOptional<ZodObject<{
        difficultyToTier: ZodOptional<ZodRecord<ZodEnum<...>, ZodEnum<...>>>;
        enableCalibration: ZodDefault<ZodBoolean>;
        maxCalibrationOutcomes: ZodDefault<ZodNumber>;
        minCalibrationOutcomes: ZodDefault<ZodNumber>;
        thresholds: ZodOptional<ZodObject<{
           easyUpperBound: ...;
           hardLowerBound: ...;
        }, $strip>>;
        tierToClis: ZodOptional<ZodRecord<ZodEnum<...>, ZodArray<...>>>;
        verbose: ZodDefault<ZodBoolean>;
        weights: ZodOptional<ZodObject<{
           context_length: ...;
           creativity: ...;
           knowledge: ...;
           precision: ...;
           reasoning: ...;
        }, $strip>>;
     }, $strip>>;
  }, $strip>>;
  security: ZodOptional<ZodObject<{
     allowedPaths: ZodDefault<ZodArray<ZodString>>;
     audit: ZodOptional<ZodObject<{
        enabled: ZodDefault<ZodBoolean>;
        enableHashChain: ZodDefault<ZodBoolean>;
        logDir: ZodOptional<ZodString>;
        maxFiles: ZodDefault<ZodNumber>;
        maxFileSizeBytes: ZodDefault<ZodNumber>;
        minSeverity: ZodDefault<ZodEnum<{
           critical: ...;
           info: ...;
           warning: ...;
        }>>;
     }, $strip>>;
     auth: ZodOptional<ZodObject<{
        enabled: ZodDefault<ZodBoolean>;
        method: ZodDefault<ZodEnum<{
           oauth2: ...;
           token: ...;
        }>>;
        tokenFile: ZodOptional<ZodString>;
        tokenHeader: ZodDefault<ZodString>;
     }, $strip>>;
     blockedPatterns: ZodDefault<ZodArray<ZodString>>;
     policy: ZodOptional<ZodObject<{
        defaultMode: ZodDefault<ZodEnum<{
           read-only: ...;
           read-write: ...;
        }>>;
        policyMode: ZodDefault<ZodEnum<{
           enforce: ...;
           warn: ...;
        }>>;
     }, $strip>>;
     rateLimit: ZodDefault<ZodObject<{
        enabled: ZodDefault<ZodBoolean>;
        perTool: ZodOptional<ZodRecord<ZodString, ZodObject<..., ...>>>;
        requestsPerMinute: ZodDefault<ZodNumber>;
     }, $strip>>;
     sandbox: ZodOptional<ZodObject<{
        dockerImage: ZodOptional<ZodString>;
        fallbackToPolicy: ZodDefault<ZodBoolean>;
        mode: ZodDefault<ZodEnum<{
           container: ...;
           none: ...;
           policy: ...;
        }>>;
        networkEnabled: ZodDefault<ZodBoolean>;
     }, $strip>>;
     secretsFile: ZodOptional<ZodString>;
     timeout: ZodOptional<ZodObject<{
        defaultTimeoutMs: ZodDefault<ZodNumber>;
        enableLogging: ZodDefault<ZodBoolean>;
        maxTimeoutMs: ZodDefault<ZodNumber>;
        perToolTimeout: ZodOptional<ZodRecord<ZodString, ZodNumber>>;
        uriValidation: ZodDefault<ZodBoolean>;
     }, $strip>>;
     toolAllowlist: ZodOptional<ZodArray<ZodString>>;
  }, $strip>>;
  sica: ZodOptional<ZodObject<{
     autoSelectBest: ZodDefault<ZodBoolean>;
     enabled: ZodDefault<ZodBoolean>;
     enableObservability: ZodDefault<ZodBoolean>;
     improvementCooldownMs: ZodDefault<ZodNumber>;
     improvementThreshold: ZodDefault<ZodNumber>;
     maxActiveVersions: ZodDefault<ZodNumber>;
     minExecutionsForImprovement: ZodDefault<ZodNumber>;
  }, $strip>>;
  skills: ZodOptional<ZodObject<{
     enabled: ZodDefault<ZodBoolean>;
     enablePruning: ZodDefault<ZodBoolean>;
     executionsBeforeEvaluation: ZodDefault<ZodNumber>;
     externalPacks: ZodOptional<ZodArray<ZodObject<{
        enabled: ZodDefault<ZodBoolean>;
        name: ZodString;
        source: ZodString;
     }, $strip>>>;
     maxHistoryPerSkill: ZodDefault<ZodNumber>;
     maxSkills: ZodDefault<ZodNumber>;
     minSuccessRateForRetention: ZodDefault<ZodNumber>;
     trackExecutionHistory: ZodDefault<ZodBoolean>;
  }, $strip>>;
  workflows: ZodOptional<ZodObject<{
     maxParallel: ZodDefault<ZodNumber>;
     templatesDir: ZodDefault<ZodString>;
     timeout: ZodDefault<ZodNumber>;
  }, $strip>>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas.ts:136

Complete application configuration schema.


ConfigExpertConfigSchema

const ConfigExpertConfigSchema: ZodObject<{
  builtin: ZodDefault<ZodBoolean>;
  custom: ZodOptional<ZodRecord<ZodString, ZodObject<{
     available: ZodDefault<ZodBoolean>;
     capabilities: ZodDefault<ZodArray<ZodString>>;
     description: ZodOptional<ZodString>;
     domain: ZodDefault<ZodEnum<{
        architecture: "architecture";
        code: "code";
        documentation: "documentation";
        general: "general";
        security: "security";
        testing: "testing";
     }>>;
     secondaryDomains: ZodOptional<ZodArray<ZodEnum<{
        architecture: "architecture";
        code: "code";
        documentation: "documentation";
        general: "general";
        security: "security";
        testing: "testing";
     }>>>;
     systemPrompt: ZodString;
     temperature: ZodDefault<ZodNumber>;
     tier: ZodDefault<ZodEnum<{
        balanced: "balanced";
        fast: "fast";
        powerful: "powerful";
     }>>;
     tools: ZodOptional<ZodArray<ZodString>>;
     weight: ZodDefault<ZodNumber>;
  }, $strip>>>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-expert.ts:114

Expert configuration schema.


ConfigExpertDefinitionSchema

const ConfigExpertDefinitionSchema: ZodObject<{
  prompt: ZodString;
  temperature: ZodDefault<ZodNumber>;
  tier: ZodDefault<ZodEnum<{
     balanced: "balanced";
     fast: "fast";
     powerful: "powerful";
  }>>;
  tools: ZodOptional<ZodArray<ZodString>>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-expert.ts:102

Legacy expert definition schema (for backwards compatibility). Use CustomExpertDefinitionSchema for new implementations.


DEFAULT_ENTRY

const DEFAULT_ENTRY: Omit<ModelEntry, "id" | "vendor" | "family" | "profileId" | "source">;

Defined in: packages/nexus-agents/src/config/model-derivation.ts:21

Universal fallback. Used when nothing more specific matches — unknown vendor + family + no probe data. Safe defaults.


defaultConfig

const defaultConfig: Partial<AppConfig>;

Defined in: packages/nexus-agents/src/config/schemas.ts:161

Default configuration values.


LoggingConfigSchema

const LoggingConfigSchema: ZodObject<{
  destination: ZodDefault<ZodEnum<{
     file: "file";
     stderr: "stderr";
     stdout: "stdout";
  }>>;
  filePath: ZodOptional<ZodString>;
  format: ZodDefault<ZodEnum<{
     json: "json";
     pretty: "pretty";
  }>>;
  level: ZodDefault<ZodEnum<{
     debug: "debug";
     error: "error";
     info: "info";
     warn: "warn";
  }>>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:12

Logging configuration schema.


ModelConfigSchema

const ModelConfigSchema: ZodObject<{
  default: ZodString;
  providers: ZodOptional<ZodRecord<ZodString, ZodObject<{
     apiKey: ZodOptional<ZodString>;
     baseUrl: ZodOptional<ZodURL>;
     maxRetries: ZodDefault<ZodNumber>;
     timeout: ZodDefault<ZodNumber>;
  }, $strip>>>;
  tiers: ZodObject<{
     balanced: ZodArray<ZodString>;
     fast: ZodArray<ZodString>;
     powerful: ZodArray<ZodString>;
  }, $strip>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:48

Model configuration schema.


ModelTiersSchema

const ModelTiersSchema: ZodObject<{
  balanced: ZodArray<ZodString>;
  fast: ZodArray<ZodString>;
  powerful: ZodArray<ZodString>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:37

Model tier configuration.


ProviderConfigSchema

const ProviderConfigSchema: ZodObject<{
  apiKey: ZodOptional<ZodString>;
  baseUrl: ZodOptional<ZodURL>;
  maxRetries: ZodDefault<ZodNumber>;
  timeout: ZodDefault<ZodNumber>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:25

Provider configuration schema.


SecurityConfigSchema

const SecurityConfigSchema: ZodObject<{
  allowedPaths: ZodDefault<ZodArray<ZodString>>;
  audit: ZodOptional<ZodObject<{
     enabled: ZodDefault<ZodBoolean>;
     enableHashChain: ZodDefault<ZodBoolean>;
     logDir: ZodOptional<ZodString>;
     maxFiles: ZodDefault<ZodNumber>;
     maxFileSizeBytes: ZodDefault<ZodNumber>;
     minSeverity: ZodDefault<ZodEnum<{
        critical: "critical";
        info: "info";
        warning: "warning";
     }>>;
  }, $strip>>;
  auth: ZodOptional<ZodObject<{
     enabled: ZodDefault<ZodBoolean>;
     method: ZodDefault<ZodEnum<{
        oauth2: "oauth2";
        token: "token";
     }>>;
     tokenFile: ZodOptional<ZodString>;
     tokenHeader: ZodDefault<ZodString>;
  }, $strip>>;
  blockedPatterns: ZodDefault<ZodArray<ZodString>>;
  policy: ZodOptional<ZodObject<{
     defaultMode: ZodDefault<ZodEnum<{
        read-only: "read-only";
        read-write: "read-write";
     }>>;
     policyMode: ZodDefault<ZodEnum<{
        enforce: "enforce";
        warn: "warn";
     }>>;
  }, $strip>>;
  rateLimit: ZodDefault<ZodObject<{
     enabled: ZodDefault<ZodBoolean>;
     perTool: ZodOptional<ZodRecord<ZodString, ZodObject<{
        capacity: ZodDefault<ZodNumber>;
        refillIntervalMs: ZodDefault<ZodNumber>;
        refillRate: ZodDefault<ZodNumber>;
     }, $strip>>>;
     requestsPerMinute: ZodDefault<ZodNumber>;
  }, $strip>>;
  sandbox: ZodOptional<ZodObject<{
     dockerImage: ZodOptional<ZodString>;
     fallbackToPolicy: ZodDefault<ZodBoolean>;
     mode: ZodDefault<ZodEnum<{
        container: "container";
        none: "none";
        policy: "policy";
     }>>;
     networkEnabled: ZodDefault<ZodBoolean>;
  }, $strip>>;
  secretsFile: ZodOptional<ZodString>;
  timeout: ZodOptional<ZodObject<{
     defaultTimeoutMs: ZodDefault<ZodNumber>;
     enableLogging: ZodDefault<ZodBoolean>;
     maxTimeoutMs: ZodDefault<ZodNumber>;
     perToolTimeout: ZodOptional<ZodRecord<ZodString, ZodNumber>>;
     uriValidation: ZodDefault<ZodBoolean>;
  }, $strip>>;
  toolAllowlist: ZodOptional<ZodArray<ZodString>>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-security.ts:133

Security configuration schema.


WorkflowConfigSchema

const WorkflowConfigSchema: ZodObject<{
  maxParallel: ZodDefault<ZodNumber>;
  templatesDir: ZodDefault<ZodString>;
  timeout: ZodDefault<ZodNumber>;
}, $strip>;

Defined in: packages/nexus-agents/src/config/schemas-core.ts:59

Workflow configuration schema.

Functions

deriveEntry()

function deriveEntry(modelId, identity): ModelEntry;

Defined in: packages/nexus-agents/src/config/model-derivation.ts:125

Build an entry from vendor + family + quirks when no authoritative row matches. Source stamped 'derived'; capability fields left undefined (derived entries don’t have measured pricing/quality data).

Parameters

modelId

string

identity

ResolvedModelIdentity

Returns

ModelEntry


filterAvailableModels()

function filterAvailableModels(modelIds, cache): {
  available: string[];
  removed: string[];
};

Defined in: packages/nexus-agents/src/config/model-availability.ts:243

Filters out known-unavailable models from a set of model IDs. Returns the filtered set, or null if no models were removed. Used by scoreAllModels() to skip unavailable models.

Parameters

modelIds

readonly string[]

cache

AvailabilityCache

Returns

{
  available: string[];
  removed: string[];
}
available
available: string[];
removed
removed: string[];

getAvailabilityCache()

function getAvailabilityCache(): AvailabilityCache;

Defined in: packages/nexus-agents/src/config/model-availability.ts:224

Get the shared availability cache (lazy-init).

Returns

AvailabilityCache


getCliForModelId()

function getCliForModelId(modelId): "claude" | "gemini" | "codex" | "opencode" | undefined;

Defined in: packages/nexus-agents/src/config/model-availability.ts:177

Get the CLI name for a model ID.

Parameters

modelId

| "claude-fable-5" | "claude-opus" | "claude-sonnet" | "claude-haiku" | "gemini-3-pro" | "gemini-pro" | "gemini-3.5-flash" | "gemini-3-flash" | "gemini-flash" | "gpt-5.6-sol" | "gpt-5.5" | "codex-5.3" | "codex-5.2" | "codex-5.1-mini" | "opencode-default" | "opencode-custom-opus" | "opencode-custom-sonnet" | "openrouter-nemotron-super" | "openrouter-qwen-coder"

Returns

"claude" | "gemini" | "codex" | "opencode" | undefined


getDefaultAvailableModelsCache()

function getDefaultAvailableModelsCache(): AvailableModelsCache;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:241

Get (or lazily construct) the process-default cache. Starts with no sources — callers register them via addSource. Until at least one source is added the cache returns empty snapshots, so every consumer must treat an empty result as “unknown”, not as “no models exist”.

Returns

AvailableModelsCache


getDefaultRegistry()

function getDefaultRegistry(): ModelRegistry;

Defined in: packages/nexus-agents/src/config/model-registry.ts:472

Lazy global registry. Most consumers should accept a ModelRegistry via dependency injection instead, but this is the convenient default for migration from the existing module-level constants.

The first call constructs the registry and loads the operator manifest overlay (#2547 4a) from $NEXUS_MODELS_OVERLAY_PATH or $NEXUS_DATA_DIR/models-manifest.yaml. Missing / malformed manifests never throw — rejections are logged at warn level and dropped.

Returns

ModelRegistry


getFallbackChain()

function getFallbackChain(cli): readonly (
  | "claude-fable-5"
  | "claude-opus"
  | "claude-sonnet"
  | "claude-haiku"
  | "gemini-3-pro"
  | "gemini-pro"
  | "gemini-3.5-flash"
  | "gemini-3-flash"
  | "gemini-flash"
  | "gpt-5.6-sol"
  | "gpt-5.5"
  | "codex-5.3"
  | "codex-5.2"
  | "codex-5.1-mini"
  | "opencode-default"
  | "opencode-custom-opus"
  | "opencode-custom-sonnet"
  | "openrouter-nemotron-super"
  | "openrouter-qwen-coder")[];

Defined in: packages/nexus-agents/src/config/model-availability.ts:170

Get the fallback chain for a CLI tool.

Parameters

cli

"claude" | "gemini" | "codex" | "opencode"

Returns

readonly ( | "claude-fable-5" | "claude-opus" | "claude-sonnet" | "claude-haiku" | "gemini-3-pro" | "gemini-pro" | "gemini-3.5-flash" | "gemini-3-flash" | "gemini-flash" | "gpt-5.6-sol" | "gpt-5.5" | "codex-5.3" | "codex-5.2" | "codex-5.1-mini" | "opencode-default" | "opencode-custom-opus" | "opencode-custom-sonnet" | "openrouter-nemotron-super" | "openrouter-qwen-coder")[]


getKnownNexusVarNames()

function getKnownNexusVarNames(): readonly string[];

Defined in: packages/nexus-agents/src/config/env-schema.ts:702

Returns all known NEXUS_* variable names from the schema.

Returns

readonly string[]


resetAvailabilityCache()

function resetAvailabilityCache(): void;

Defined in: packages/nexus-agents/src/config/model-availability.ts:230

Reset the global cache (for testing).

Returns

void


resolveFallback()

function resolveFallback(modelId, cache): FallbackEntry | null;

Defined in: packages/nexus-agents/src/config/model-availability.ts:150

Resolves a fallback chain for a given model. Returns the first available model in the chain, skipping known-unavailable ones.

Parameters

modelId

| "claude-fable-5" | "claude-opus" | "claude-sonnet" | "claude-haiku" | "gemini-3-pro" | "gemini-pro" | "gemini-3.5-flash" | "gemini-3-flash" | "gemini-flash" | "gpt-5.6-sol" | "gpt-5.5" | "codex-5.3" | "codex-5.2" | "codex-5.1-mini" | "opencode-default" | "opencode-custom-opus" | "opencode-custom-sonnet" | "openrouter-nemotron-super" | "openrouter-qwen-coder"

cache

AvailabilityCache

Returns

FallbackEntry | null


setDefaultAvailableModelsCache()

function setDefaultAvailableModelsCache(cache): void;

Defined in: packages/nexus-agents/src/config/available-models-cache.ts:250

Override the default cache. Useful for tests and for operators that want a pre-populated cache wired at startup.

Parameters

cache

AvailableModelsCache | null

Returns

void


setDefaultRegistry()

function setDefaultRegistry(registry): void;

Defined in: packages/nexus-agents/src/config/model-registry.ts:509

Replace the global registry. Reserved for tests + bootstrap.

Parameters

registry

ModelRegistry | undefined

Returns

void


validateNexusEnv()

function validateNexusEnv(logger?): EnvValidationResult;

Defined in: packages/nexus-agents/src/config/env-schema.ts:669

Validates all NEXUS_* environment variables.

  • Detects unknown vars (potential typos) with Levenshtein suggestions
  • Detects invalid values for known vars
  • Reports deprecated aliases in use (not logged here — see logValidationWarnings)
  • Warn-only: never throws, never blocks startup

Parameters

logger?

ILogger

Optional logger for direct warning output

Returns

EnvValidationResult

Validation result with unknown and invalid var lists