Separate TUI preferences from server configuration (#42202)

## Why

TUI preferences and persistence paths belong to the local client, while thread
configuration and account requirements may come from the active app server.
Keeping both in the same resolved `Config` can replace live local preferences
when a thread is resumed, forked, reconnected, or switched.

## What changed

- Add `LocalSettings` as the TUI-owned source for UI, history, notice, and local
  persistence settings, and preserve it across session lifecycle transitions.
- Write preference changes to the selected user config file and reload local
  settings from disk when changing roots.
- Use the app server's account response for authentication-dependent onboarding
  and status UI instead of the local model-provider configuration.
- Retain platform family and OS metadata reported by remote app servers.

## Testing

- Cover local setting defaults, overrides, persistence destinations, reloads,
  and preservation across widget replacement and root switching.
- Cover remote platform metadata and server-controlled authentication UI.

GitOrigin-RevId: dbc2965fb1d6cbecb3f973f6133f3dcd4467b753
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-02 04:20:38 +00:00
1 parent 0b509e930e
commit 9d57be71ba
87 files changed
+1188 -459

No files matched your search

+5 -2
View File
@@ -92,7 +92,8 @@ impl App {
{
return;
}
let keymap = match RuntimeKeymap::from_config(&config.tui_keymap) {
let local_settings = crate::local_settings::LocalSettings::from(&config);
let keymap = match RuntimeKeymap::from_config(&local_settings.tui.keymap) {
Ok(keymap) => keymap,
Err(error) => return self.chat_widget.add_error_message(error),
};
@@ -144,6 +145,7 @@ impl App {
let transitioned = if has_rollout {
app_server
.fork_thread_at(
&local_settings,
config.clone(),
thread_id,
/*last_turn_id*/ None,
@@ -191,10 +193,11 @@ impl App {
tracing::warn!("failed to unsubscribe tracked thread {tracked_id}: {error}");
}
}
self.local_settings = local_settings;
self.config = config;
self.file_search
.update_search_dir(self.config.cwd.to_path_buf());
let notify = &self.config.tui_notifications;
let notify = &self.local_settings.tui.notification_settings;
tui.set_notification_settings(notify.method, notify.condition);
if let Err(error) = tui.clear_ambient_pet_image() {
tracing::warn!(%error, "failed to clear ambient pet image");