pub struct Settings {Show 21 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 request_timeout_secs: Option<u64>,
pub request_max_retries: Option<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,
pub questions_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).
request_timeout_secs: Option<u64>Request timeout in seconds, applied to every provider that supports
timeouts (Ollama, OpenAI-compatible, Sockudo). None → per-provider
default (Ollama: 5s, Sockudo: 120s, OpenAI-compatible: 30s).
Set via /timeout <secs>.
request_max_retries: Option<u32>Maximum number of retries for transient network failures, applied to
every provider that supports retries (Ollama, OpenAI-compatible).
None → per-provider default (Ollama: 3, OpenAI-compatible: 0).
Set via /retries <count>.
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 where neither /health
nor /v1/models can vouch for the backend. When the server has no
/health endpoint (HTTP 404), the check automatically falls back to
/v1/models and passes if that returns a non-empty model list.
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.
questions_enabled: boolEnable the question tool (default: true).
When false, the question tool is not advertised to the provider, so
the model cannot stop the agent to ask the user a multiple-choice
question. Toggle with /questions.
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.
Sourcepub fn effective_timeout_secs(&self) -> u64
pub fn effective_timeout_secs(&self) -> u64
Effective request timeout in seconds, resolving None (or a stored
0) to the per-provider default (Ollama: 5s, Sockudo: 120s, others: 30s).
Sourcepub fn effective_max_retries(&self) -> u32
pub fn effective_max_retries(&self) -> u32
Effective maximum number of request retries, resolving None to the
per-provider default (Ollama: 3, others: 0).