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

@ -1032,10 +1032,10 @@ pub fn parse_profile_id(raw: &str) -> Result<ProfileId, ErrorDto> {
// ---------------------------------------------------------------------------
use application::{
CreateAgentOutput, InspectConversationOutput, LaunchAgentOutput, ListAgentsOutput,
ReadAgentContextOutput,
ChangeAgentProfileOutput, CreateAgentOutput, InspectConversationOutput, LaunchAgentOutput,
ListAgentsOutput, ReadAgentContextOutput,
};
use domain::Agent;
use domain::{Agent, TerminalSession};
/// An agent crossing the wire. [`Agent`] already serialises camelCase
/// (`id`, `name`, `contextPath`, `profileId`, `origin` tagged, `synchronized`),
@ -1154,6 +1154,56 @@ impl From<LaunchAgentOutput> for TerminalSessionDto {
}
}
/// Request DTO for `change_agent_profile` (§15.1): hot-swap an agent's runtime
/// profile, optionally relaunching its live session in place.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ChangeAgentProfileRequestDto {
/// Id of the owning project.
pub project_id: String,
/// Id of the agent whose runtime profile to change.
pub agent_id: String,
/// Id of the new runtime profile.
pub profile_id: String,
/// Terminal height in rows for a possible hot relaunch.
pub rows: u16,
/// Terminal width in columns for a possible hot relaunch.
pub cols: u16,
}
/// Response DTO for `change_agent_profile`: the mutated agent plus the freshly
/// relaunched session when a live session was hot-swapped (absent otherwise).
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ChangeAgentProfileDto {
/// The agent now carrying the new profile.
pub agent: AgentDto,
/// The relaunched session, present only when a live session was swapped.
#[serde(skip_serializing_if = "Option::is_none")]
pub relaunched_session: Option<TerminalSessionDto>,
}
impl From<ChangeAgentProfileOutput> for ChangeAgentProfileDto {
fn from(out: ChangeAgentProfileOutput) -> Self {
Self {
agent: AgentDto(out.agent),
relaunched_session: out.relaunched.map(TerminalSessionDto::from),
}
}
}
impl From<TerminalSession> for TerminalSessionDto {
fn from(s: TerminalSession) -> Self {
Self {
session_id: s.id.to_string(),
cwd: s.cwd.as_str().to_owned(),
rows: s.pty_size.rows,
cols: s.pty_size.cols,
assigned_conversation_id: None,
}
}
}
/// Request DTO for `inspect_conversation` (T7).
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]