AiConfigIo class
Loads and persists AiConfig from the environment and ~/.omnyshell/ai.yaml.
File shape:
ai:
provider: anthropic # anthropic | openai | gemini
model: <model-id> # shared/default model for both phases
plannerModel: <id> # optional stronger model for planning
executorModel: <id> # optional cheaper model for execution
explainerModel: <id> # optional model for explaining a command (?)
apiKey: "..." # optional if the matching env var is set
mode: plan # default agent mode
language: portuguese # optional reply language (free-form)
baseUrl: "..." # optional API base-URL override
maxSteps: 24 # agent loop bound
Resolution: provider/model come from env (OMNYSHELL_AI_PROVIDER /
OMNYSHELL_AI_MODEL) then ai.yaml; the API key prefers the provider's env
var (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY) and falls back
to ai.yaml. load returns null when no usable provider+key can be
resolved (the caller then installs a stub :ai that prints setup help).
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Methods
-
defaultPath(
{String? home}) → String -
The default
ai.yamlpath (honoringOMNYSHELL_HOME/HOME). -
describe(
{String? path, String? home, Map< String, String> ? environment}) → AiConfigDescription -
Reports the resolved configuration without exposing the API key, for
omnyshell ai show. -
envVarFor(
AiProviderKind provider) → String - The provider's API-key environment variable name.
-
load(
{String? path, String? home, Map< String, String> ? environment}) → AiConfig? -
write(
{AiProviderKind? provider, String? model, String? apiKey, String? plannerModel, String? executorModel, String? explainerModel, AgentMode? mode, String? language, String? baseUrl, int? maxSteps, String? path, String? home}) → void -
Writes the given fields into
ai.yaml, updating only the keys provided and preserving the rest (and surrounding comments). Creates the file and its parent directory (mode 600/700 on POSIX) when missing. -
writeMode(
AgentMode mode, {String? path, String? home}) → void -
Persists just the default
mode, preserving other entries.