feat(agent): UI hot-swap de profil (A2) — commande Tauri + sélecteur + dialog

- Tauri : commande change_agent_profile + ChangeAgentProfileRequestDto/Dto
  (camelCase, relaunchedSession omis si None), câblage state.rs par composition.
- Front : gateway changeAgentProfile (adapters Tauri+mock), sélecteur de profil
  par agent, dialog de confirmation FR (« Changer le moteur abandonne l'historique
  de conversation… »), refresh sur event agentProfileChanged.

Tests : app-tauri dto 5/5 ; vitest 314/314 (mapping, payload, dialog gating,
libellé FR, refresh). 0 régression.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 10:07:35 +02:00
parent 2433e173a1
commit b82e3e1a40
13 changed files with 731 additions and 10 deletions

View File

@ -10,7 +10,8 @@ use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use application::{
AssignSkillToAgent, CheckEmbedderSuggestion, CloseProject, CloseTab, CloseTerminal,
AssignSkillToAgent, ChangeAgentProfile, CheckEmbedderSuggestion, CloseProject, CloseTab,
CloseTerminal,
ConfigureProfiles, CreateAgentFromScratch, CreateAgentFromTemplate, CreateLayout, CreateMemory,
CreateProject, CreateSkill, CreateTemplate, DeleteAgent, DeleteEmbedderProfile, DeleteLayout,
DeleteMemory, DeleteProfile, DeleteSkill, DeleteTemplate, DescribeEmbedderEngines,
@ -128,6 +129,8 @@ pub struct AppState {
pub delete_agent: Arc<DeleteAgent>,
/// Launch an agent (spawn PTY, apply injection strategy).
pub launch_agent: Arc<LaunchAgent>,
/// Hot-swap an agent's runtime profile, relaunching its live session in place (§15.1).
pub change_agent_profile: Arc<ChangeAgentProfile>,
/// Best-effort inspection of a conversation (last topic + token indicator)
/// for the resume popup (T7). Optional/extensible: backed by a `Vec` of
/// [`domain::ports::SessionInspector`]s; an empty/missing match yields empty
@ -514,6 +517,20 @@ impl AppState {
Some(Arc::clone(&check_embedder_suggestion)),
));
// Hot-swap an agent's runtime profile (§15.1). Reuses the shared context/
// profile/project/fs stores, the live-session registry and PTY port, and
// *composes* the launcher above for the in-place relaunch (no duplication).
let change_agent_profile = Arc::new(ChangeAgentProfile::new(
Arc::clone(&contexts_port),
Arc::clone(&profile_store_port),
Arc::clone(&store_port),
Arc::clone(&fs_port),
Arc::clone(&terminal_sessions),
Arc::clone(&pty_port),
Arc::clone(&launch_agent),
Arc::clone(&events_port),
));
// --- Conversation inspection (T7) ---
// Best-effort, optional, extensible: a `Vec` of SessionInspectors routed
// by profile. Adding an inspectable CLI = pushing one more adapter here.
@ -699,6 +716,7 @@ impl AppState {
update_agent_context,
delete_agent,
launch_agent,
change_agent_profile,
inspect_conversation,
project_store,
create_template,