Skip to main content

Module config_persistence

Module config_persistence 

Source
Expand description

Config file path resolution and TOML persistence helpers.

These helpers are used by command handlers and non-command UI code, so persistence lives outside the command tree.

Every config.toml mutation funnels through mutate_config_document: the file is edited in place with toml_edit so unrelated comments, ordering, and formatting survive, and the result is replaced atomically (same-directory temp file + rename) with owner-only permissions.

Functions§

config_toml_path
migrate_legacy_route_preferences
Commit the legacy effective startup selection with its receipt in the same atomic config write. Settings remains untouched, so an interrupted cleanup or an older binary cannot erase the user’s historical choices. After this marker, Config never consults those legacy route fields again.
mutate_config_document
Parse the TOML document at path (an absent or empty file yields an empty document), apply mutate, and atomically persist the result.
persist_custom_provider
persist_hotbar_bindings
persist_mini_window_bool_key
persist_provider_model_key
Persist the model for one exact provider route without rewriting the legacy root DeepSeek fallback used by unrelated providers.
persist_root_bool_key
persist_root_string_key
persist_route_base_url
Persist the endpoint that GET /v1/config reports as base_url.
persist_status_items
persist_subagents_bool_key
persist_subagents_integer_key
persist_table_bool_key
persist_table_string_key
persist_table_value_key
persist_unset_root_key
persist_unset_table_key
set_document_value
Set the value at segments (parent tables plus the final key), creating missing intermediate tables. Replacing an existing value keeps its decor, so comments above the key and trailing same-line comments survive.
set_verified_provider_model_document
unset_document_value
Remove the value at segments. Returns Ok(true) when an entry was removed; missing keys and missing (or non-table) parents are a no-op.