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

@ -14,7 +14,7 @@
import { Channel, invoke } from "@tauri-apps/api/core";
import type { Agent } from "@/domain";
import type { Agent, TerminalSession } from "@/domain";
import type {
AgentGateway,
ConversationDetails,
@ -74,6 +74,23 @@ export class TauriAgentGateway implements AgentGateway {
});
}
changeAgentProfile(
projectId: string,
agentId: string,
profileId: string,
rows: number,
cols: number,
): Promise<{ agent: Agent; relaunchedSession?: TerminalSession }> {
// `change_agent_profile` takes a single `request` DTO; the camelCase keys
// match the backend `ChangeAgentProfileRequestDto`. The response carries the
// mutated agent and, when a live session was hot-swapped, the relaunched one
// (omitted otherwise — `relaunchedSession` stays `undefined`).
return invoke<{ agent: Agent; relaunchedSession?: TerminalSession }>(
"change_agent_profile",
{ request: { projectId, agentId, profileId, rows, cols } },
);
}
readContext(projectId: string, agentId: string): Promise<string> {
return invoke<string>("read_agent_context", { projectId, agentId });
}