AiConfig class

Immutable AI configuration: which provider/model to use, the API key, the default agent mode and loop bounds.

Pure data with no I/O so it compiles to JavaScript; the native loader that reads env vars / ~/.omnyshell/ai.yaml lives in ai_config_io.dart.

Constructors

AiConfig({required AiProviderKind provider, required String model, required String apiKey, String? plannerModel, String? executorModel, String? explainerModel, String? baseUrl, AgentMode defaultMode = AgentMode.plan, String? language, int maxSteps = 24})
const

Properties

apiKey String
The API key used to authenticate with provider.
final
baseUrl String?
Overrides the provider's default API base URL (e.g. a proxy or an OpenAI-compatible endpoint). null uses the provider default.
final
defaultMode AgentMode
The agent mode used when the user does not override it per invocation.
final
executorModel String?
Optional cheaper model for the executing phase. Falls back to model.
final
explainerModel String?
Optional model for explaining a command on demand (the confirm ? option). Falls back to model (like executorModel).
final
explainModel String
The model used to explain a command on demand: explainerModel if set, otherwise the shared model (same fallback as the executor).
no setter
hashCode int
The hash code for this object.
no setterinherited
language String?
The language the agent replies in (free-form, e.g. portuguese, es), woven into the system prompt. null lets the model choose (usually the user's language or English). Shell commands/output are unaffected.
final
maxSteps int
The maximum number of provider round-trips before the agent loop stops, guarding against runaway loops and token spend.
final
model String
The shared/default model id (e.g. a Claude/GPT/Gemini model), used by both phases unless plannerModel/executorModel override it. Kept in config rather than hardcoded so it does not go stale.
final
plannerModel String?
Optional stronger model for the planning phase. Falls back to model.
final
provider AiProviderKind
The provider to send requests to.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({AiProviderKind? provider, String? model, String? apiKey, String? plannerModel, String? executorModel, String? explainerModel, String? baseUrl, AgentMode? defaultMode, String? language, int? maxSteps}) AiConfig
Returns a copy with the given fields replaced.
modelFor(AgentPhase phase) String
The model to use for phase, falling back to model when the per-phase model is unset.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited