Discover TUI collaboration modes from the app server (#42401)

## What changed

- Fetch `collaborationMode/list` during TUI startup and reconnect, and use the
  returned catalog for visible collaboration-mode selection.
- Keep collaboration-mode discovery optional with a two-second timeout so an
  unavailable, invalid, or unsupported response does not block bootstrap.
- Preserve discovered modes when the model catalog refreshes, clear restored
  developer-instruction overrides when selecting a server mode, and retain a
  `/plan` draft when plan mode is unavailable.

## Testing

- Cover optional discovery failures and catalog refresh on reconnect.
- Cover server mode selection, model refreshes, restored settings, and
  unavailable plan mode.

GitOrigin-RevId: a6e35c14aab2e38526606164091ac64c500151bb
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-03 00:45:48 +00:00
1 parent 54a4077c8b
commit d4dc882998
15 files changed
+292 -22

No files matched your search

@@ -801,9 +801,7 @@ impl ChatWidget {
});
}
SlashCommand::Plan if !trimmed.is_empty() => {
if !self.apply_plan_slash_command() {
return;
}
let plan_available = self.apply_plan_slash_command();
let mut user_message = self.prepared_inline_user_message(
args,
text_elements,
@@ -812,7 +810,8 @@ impl ChatWidget {
mention_bindings,
source,
);
if !self.is_session_configured()
if !plan_available
|| !self.is_session_configured()
|| self.current_model().trim().is_empty()
|| (!self.current_model_supports_images()
&& (!user_message.local_images.is_empty()
@@ -825,6 +824,10 @@ impl ChatWidget {
element.byte_range.end += PLAN_PREFIX.len();
}
}
if !plan_available {
self.restore_user_message_to_composer(user_message);
return;
}
if self.is_session_configured() {
self.reasoning_buffer.clear();
self.reasoning_header = None;