Skip to main content

Settings

Struct Settings 

Source
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: OllamaThinkType

Controls the think/reasoning level for Ollama (default: Medium)

§show_thinking: bool

Show 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: AutoAcceptMode

Control 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: bool

Skip 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: bool

Enable 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: bool

Enable 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

Source

pub fn get_safe_commands(&self) -> Vec<String>

Returns the list of safe command prefixes, using defaults if not configured.

Source

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).

Source

pub fn get_url_for(&self, kind: ProviderKind) -> Option<&str>

Get the saved URL for a specific provider kind, if any.

Source

pub fn set_url_for(&mut self, kind: ProviderKind, url: String)

Set the URL for a specific provider kind.

Source

pub fn get_model_for(&self, kind: ProviderKind) -> Option<&str>

Get the saved model for a specific provider kind, if any.

Source

pub fn set_model_for(&mut self, kind: ProviderKind, model: String)

Set the model for a specific provider kind.

Source

pub fn get_current_model(&self) -> Option<&str>

Get the saved model for the current (last_provider) kind, if any.

Source

pub fn get_current_url(&self) -> Option<&str>

Get the saved URL for the current (last_provider) kind, if any.

Source

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).

Source

pub fn effective_max_retries(&self) -> u32

Effective maximum number of request retries, resolving None to the per-provider default (Ollama: 3, others: 0).

Trait Implementations§

Source§

impl Clone for Settings

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Settings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Settings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Settings

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Settings> for SockudoCredentials

Source§

fn from(settings: &Settings) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Settings

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more