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

+7 -3
View File
@@ -376,6 +376,7 @@ impl App {
let (session, turns, live_attached) = match app_server
.resume_thread(
&self.local_settings,
self.config.clone(),
thread_id,
crate::app_server_session::ResumeModelSettings::PreserveExistingThread,
@@ -411,6 +412,7 @@ impl App {
/*turn_cursor*/ None,
/*item_cursor*/ None,
Some(&self.config),
Some(&self.local_settings),
crate::app_server_session::HistoryHydrationScope::Initial,
)
.await
@@ -1086,7 +1088,7 @@ impl App {
return Ok(AppRunControl::Continue);
}
let mut resume_config = match self
let (mut resume_config, local_settings) = match self
.resume_config_for_target(tui, app_server, &target_session)
.await
{
@@ -1106,6 +1108,7 @@ impl App {
}
match app_server
.resume_thread(
&local_settings,
resume_config.clone(),
target_session.thread_id,
self.resume_model_settings(),
@@ -1115,10 +1118,11 @@ impl App {
Ok(resumed) => {
let resumed_thread_id = resumed.session.thread_id;
self.shutdown_current_thread(app_server).await;
self.local_settings = local_settings;
self.config = resume_config;
tui.set_notification_settings(
self.config.tui_notifications.method,
self.config.tui_notifications.condition,
self.local_settings.tui.notification_settings.method,
self.local_settings.tui.notification_settings.condition,
);
self.file_search
.update_search_dir(self.config.cwd.to_path_buf());