pub struct Settings {Show 20 fields
pub last_provider: ProviderKind,
pub provider_urls: HashMap<ProviderKind, String>,
pub provider_models: HashMap<ProviderKind, String>,
pub preferred_mode: AgentMode,
pub ollama_api_key: Option<SecretString>,
pub openai_compat_api_key: Option<SecretString>,
pub sockudo_app_id: Option<String>,
pub sockudo_app_key: Option<String>,
pub sockudo_app_secret: Option<SecretString>,
pub ollama_timeout_secs: u64,
pub ollama_max_retries: u32,
pub ollama_think_type: OllamaThinkType,
pub show_thinking: bool,
pub context_limit: Option<u32>,
pub auto_accept_mode: AutoAcceptMode,
pub skip_health_check: bool,
pub safe_command_prefixes: Option<Vec<String>>,
pub denied_command_prefixes: Option<Vec<String>>,
pub project_md_files: Option<Vec<String>>,
pub auto_compact_enabled: bool,
}Expand description
Persisted application settings — pure data type with no I/O.
Use SettingsStore to load and save instances of this type.
Fields§
§last_provider: ProviderKind§provider_urls: HashMap<ProviderKind, String>Per-provider URL overrides. Keyed by ProviderKind so switching
providers remembers each one’s last URL. Migrated from the legacy
last_provider_url field on load.
(default: empty)
provider_models: HashMap<ProviderKind, String>Per-provider model selections. Keyed by ProviderKind so switching
providers remembers each one’s last model. Migrated from the legacy
last_model field on load.
(default: empty)
preferred_mode: AgentMode§ollama_api_key: Option<SecretString>§openai_compat_api_key: Option<SecretString>API key sent as Authorization: Bearer <key> by the OpenAI-compatible
provider (--openai-compat). Set via --api-key or OPENAI_API_KEY
env var. Not used by Ollama, llama.cpp, vLLM, or Sockudo.
sockudo_app_id: Option<String>Sockudo app ID for the AI Transport provider.
sockudo_app_key: Option<String>Sockudo app key (used as auth_key in signed API requests and WebSocket URL).
sockudo_app_secret: Option<SecretString>Sockudo app secret (used to sign API requests via HMAC-SHA256).
ollama_timeout_secs: u64Timeout in seconds for Ollama requests (default: 5)
ollama_max_retries: u32Maximum number of retries for Ollama requests (default: 3)
ollama_think_type: OllamaThinkTypeControls the think/reasoning level for Ollama (default: Medium)
show_thinking: boolShow the model’s thinking/reasoning chain inline during streaming (default: true)
context_limit: Option<u32>Context limit for warning calculations only (default: None, uses model default)
auto_accept_mode: AutoAcceptModeControl how aggressively tool calls are auto-approved:
off– never auto-accept (prompt for everything)safe– auto-accept read-only commands (default)all– auto-accept every tool call (dangerous)
Parsed from /autoaccept command. Use safe for everyday use.
Legacy boolean configs are also accepted via field resolution
in SettingsStore::load().
skip_health_check: boolSkip the provider health check at startup (default: false).
Useful for the --openai-compat provider when the gateway requires a
separate scope on /health, or for any server without a /health
endpoint. When true, the agent proceeds straight to model selection
and reports any connection error on the first real request instead.
safe_command_prefixes: Option<Vec<String>>List of command prefixes considered safe for auto-accept (default: see get_default_safe_commands)
denied_command_prefixes: Option<Vec<String>>List of command prefixes that are always denied auto-accept, even if they match a safe prefix. Takes priority over the safe list. (default: empty)
project_md_files: Option<Vec<String>>Override the project instruction file discovery list.
When set, replaces the hardcoded default list (TINYHARNESS.md, AGENTS.md, etc.).
Use TINYHARNESS_MD_FILES env var for the highest priority override.
(default: None → use hardcoded defaults)
auto_compact_enabled: boolEnable auto-compact tool (default: true). When false, the auto_compact tool is not registered with the provider, so the model cannot request conversation compaction.
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn get_safe_commands(&self) -> Vec<String>
pub fn get_safe_commands(&self) -> Vec<String>
Returns the list of safe command prefixes, using defaults if not configured.
Sourcepub fn get_denied_commands(&self) -> Vec<String>
pub fn get_denied_commands(&self) -> Vec<String>
Returns the list of always-denied command prefixes. These take priority over the safe list — if a command matches both a safe prefix and a denied prefix, it is denied. Defaults to an empty list (nothing denied).
Sourcepub fn get_url_for(&self, kind: ProviderKind) -> Option<&str>
pub fn get_url_for(&self, kind: ProviderKind) -> Option<&str>
Get the saved URL for a specific provider kind, if any.
Sourcepub fn set_url_for(&mut self, kind: ProviderKind, url: String)
pub fn set_url_for(&mut self, kind: ProviderKind, url: String)
Set the URL for a specific provider kind.
Sourcepub fn get_model_for(&self, kind: ProviderKind) -> Option<&str>
pub fn get_model_for(&self, kind: ProviderKind) -> Option<&str>
Get the saved model for a specific provider kind, if any.
Sourcepub fn set_model_for(&mut self, kind: ProviderKind, model: String)
pub fn set_model_for(&mut self, kind: ProviderKind, model: String)
Set the model for a specific provider kind.
Sourcepub fn get_current_model(&self) -> Option<&str>
pub fn get_current_model(&self) -> Option<&str>
Get the saved model for the current (last_provider) kind, if any.
Sourcepub fn get_current_url(&self) -> Option<&str>
pub fn get_current_url(&self) -> Option<&str>
Get the saved URL for the current (last_provider) kind, if any.