AppConfig

Struct AppConfig 

Source
pub struct AppConfig {
Show 17 fields pub hotkey_listen: String, pub hotkey_new_session: String, pub grace_period_secs: u32, pub llm: LlmSettings, pub voice: VoiceSettings, pub mcp_servers: Vec<McpServerEntry>, pub mdh_pointers: HashMap<String, String>, pub ui: UiSettings, pub privacy: PrivacySettings, pub nats_url: String, pub developer: DeveloperSettings, pub notifications: NotificationSettings, pub web_search: WebSearchConfig, pub permissions: GlobalPermissionSettings, pub pipeline: PipelineSettings, pub prompt_enhancement: PromptEnhancementSettings, pub hooks: HooksSettings,
}
Expand description

Application configuration persisted to a YAML file.

Only fields that differ from their defaults are written to disk. All other fields fall back to Default::default() at load time, keeping the YAML file minimal and human-readable.

Fields§

§hotkey_listen: String

Global hotkey to toggle the app or trigger recording.

§hotkey_new_session: String

Global hotkey to open a new agent session window.

§grace_period_secs: u32

Grace period in seconds for agent shutdown.

§llm: LlmSettings

LLM configuration and provider selection.

§voice: VoiceSettings

Voice/STT configuration.

§mcp_servers: Vec<McpServerEntry>

MCP server configuration (full spec, Claude Code compatible).

§mdh_pointers: HashMap<String, String>

MDH pointer mappings

§ui: UiSettings

UI preferences (theme, accent)

§privacy: PrivacySettings

Privacy and data-handling preferences shared by onboarding and settings.

§nats_url: String

NATS URL for embedded MQ connectivity.

§developer: DeveloperSettings

Developer and simulator settings

§notifications: NotificationSettings

Notification settings for response completion and feedback

§web_search: WebSearchConfig

Web search configuration

§permissions: GlobalPermissionSettings

Global permission settings for tool execution

§pipeline: PipelineSettings

Pipeline and context management settings

§prompt_enhancement: PromptEnhancementSettings

Prompt enhancement settings

§hooks: HooksSettings

Hooks configuration.

Implementations§

Source§

impl AppConfig

Source

pub fn data_dir() -> PathBuf

Returns the default directory for storing Gestura data On all platforms: ~/.gestura/

When GESTURA_HOME_DIR is set, Gestura resolves its data directory from that override instead of the OS home-directory lookup. This keeps spawned CLI processes and tests deterministic on platforms where standard home-dir resolution ignores HOME/USERPROFILE overrides.

Source

pub fn default_path() -> PathBuf

Returns the default config path: ~/.gestura/config.yaml

Source

pub fn legacy_json_path() -> PathBuf

Returns the legacy config path used by older versions: ~/.gestura/config.json

Source

pub fn legacy_json_backup_path() -> PathBuf

Returns the legacy config backup path: ~/.gestura/config.json.backup

Source

pub fn exists() -> bool

Check if a configuration file exists

Source

pub fn is_first_run() -> bool

Check if this is the first run of the application

Source

pub fn whisper_models_dir() -> PathBuf

Returns the default directory for Whisper models

Source

pub fn default_whisper_model_path() -> PathBuf

Returns the default path for the recommended Whisper model

Source

pub fn load_from_path(path: impl AsRef<Path>) -> AppConfig

Load configuration from disk at an explicit path.

If the file does not exist or cannot be read/parsed, this returns AppConfig::default.

Source

pub async fn load_from_path_async(path: impl AsRef<Path>) -> AppConfig

Load configuration from disk at an explicit path (async).

If the file does not exist or cannot be read/parsed, this returns AppConfig::default.

Source

pub fn get(&self, key: &str) -> Option<String>

Get a config value by dot-notation key (e.g., “llm.primary”)

Source

pub fn list_keys() -> Vec<&'static str>

List all available config keys

Source

pub fn set(&mut self, key: &str, value: &str) -> bool

Set a config value by its dot-notation key.

Source

pub fn update_voice_provider(&mut self, provider: &str)

Update the selected voice provider.

Source

pub fn update_whisper_model_filename(&mut self, model_filename: &str)

Update the configured Whisper model using a managed filename.

Source

pub fn update_local_whisper_model_path(&mut self, model_path: impl Into<String>)

Point the local Whisper configuration at an explicit model path.

Source

pub fn update_audio_device(&mut self, device_name: Option<String>)

Update the selected audio input device (None = system default).

Source

pub fn update_llm_provider(&mut self, provider: &str) -> Result<(), AppError>

Update the primary LLM provider and ensure its config block exists.

Source

pub fn update_provider_model( &mut self, provider: &str, model: &str, ) -> Result<(), AppError>

Update the model for a specific LLM provider.

Source

pub fn update_ollama_config( &mut self, base_url: &str, model: &str, ) -> Result<(), AppError>

Update Ollama’s base URL and selected model.

Source

pub fn apply_notification_settings_patch( &mut self, patch: NotificationSettingsPatch, )

Apply a partial notification-settings update.

Source

pub fn update_default_enabled_tools(&mut self, patch: HashMap<String, bool>)

Merge default enabled-tool preferences into the global permission settings.

Source

pub fn set_default_permission_level( &mut self, level: &str, ) -> Result<(), AppError>

Update the default permission level for new sessions.

Source

pub fn set_theme_mode(&mut self, theme_mode: &str)

Update the selected UI theme mode.

Source

pub fn apply_prompt_enhancement_settings_patch( &mut self, patch: PromptEnhancementSettingsPatch, )

Apply a partial prompt-enhancement settings update.

Source

pub fn add_mcp_server_entry( &mut self, entry: McpServerEntry, ) -> Result<(), AppError>

Add an MCP server entry, rejecting duplicate names.

Source

pub fn remove_mcp_server( &mut self, name: &str, ) -> Result<McpServerEntry, AppError>

Remove an MCP server entry by name.

Source

pub fn set_mcp_server_enabled( &mut self, name: &str, enabled: bool, ) -> Result<(), AppError>

Enable or disable an MCP server by name.

Source

pub fn apply_env_overrides(self) -> AppConfig

Apply environment variable overrides to the configuration

Source

pub fn normalize_derived_defaults(&mut self)

Normalizes configuration fields whose defaults depend on sibling values.

Source

pub fn find_mcp_server(&self, name: &str) -> Option<&McpServerEntry>

Find an MCP server entry by name (immutable).

Source

pub fn find_mcp_server_mut(&mut self, name: &str) -> Option<&mut McpServerEntry>

Find an MCP server entry by name (mutable).

Trait Implementations§

Source§

impl AppConfigSecurityExt for AppConfig

Source§

fn load() -> Self

Load configuration from disk, falling back to defaults if missing (sync version).

If ~/.gestura/config.yaml is missing but ~/.gestura/config.json exists, this will automatically migrate the JSON file to YAML.

This method also handles migration of secrets to the secure keystore.

Source§

async fn load_async() -> Self

Load configuration from disk asynchronously, falling back to defaults if missing.

This is the preferred method for GUI/Tauri commands to avoid blocking the UI thread.

Source§

fn save_to_path(&self, path: impl AsRef<Path>) -> Result<()>

Save configuration to disk at an explicit path.

This handles stripping secrets before writing to disk if security is enabled.

Source§

fn save(&self) -> Result<()>

Save configuration to disk (sync version).

Source§

async fn save_async(&self) -> Result<()>

Save configuration to disk asynchronously.

Source§

async fn save_to_path_async(&self, path: impl AsRef<Path>) -> Result<()>

Save configuration to disk at an explicit path (async).

This is the async equivalent of AppConfig::save_to_path.

Source§

fn sanitize_secrets(&mut self)

Clear secrets from the struct (used before saving to disk)

Source§

fn api_key_keychain_status() -> Vec<(&'static str, bool)>

Check which API key providers have secrets stored in the OS keychain.

Returns a list of (provider_label, is_present) tuples for every known provider. This is intended for CLI/TUI display — no secret values are exposed.

When the security feature is disabled (or keychain access is disabled at runtime) every provider reports false.

Source§

fn has_plaintext_secrets(&self) -> bool

Returns true if the config struct currently contains any plaintext secrets that should not be persisted to disk.

Source§

fn hydrate_secrets_sync(&mut self) -> Result<()>

Load secrets from keystore into the struct (sync)

Source§

async fn hydrate_secrets(&mut self) -> Result<()>

Async version of hydrate secrets

Source§

fn migrate_secrets_sync(&self) -> Result<bool>

Move secrets from the struct (if present) to the keychain. Returns true if any secrets were migrated.

Source§

async fn migrate_secrets(&self) -> Result<bool>

Async version of migrate secrets

Source§

fn load_with_env() -> Self

Load configuration with environment variable overrides applied

This is the recommended way to load configuration as it respects the full precedence hierarchy: env vars > config file > defaults

Source§

async fn load_with_env_async() -> Self

Load configuration asynchronously with environment variable overrides

Source§

impl Clone for AppConfig

Source§

fn clone(&self) -> AppConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AppConfig

Source§

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

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

impl Default for AppConfig

Source§

fn default() -> AppConfig

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

impl<'de> Deserialize<'de> for AppConfig

Source§

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

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

impl From<&AppConfig> for HotReloadableSettings

Source§

fn from(config: &AppConfig) -> HotReloadableSettings

Converts to this type from the input type.
Source§

impl PartialEq for AppConfig

Source§

fn eq(&self, other: &AppConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AppConfig

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AppConfig

Source§

impl StructuralPartialEq for AppConfig

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<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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,