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:
@ -69,4 +69,53 @@ describe("TauriAgentGateway invoke payloads", () => {
|
||||
request: { projectId: "proj-1", agentId: "agent-2", nodeId: "node-3" },
|
||||
});
|
||||
});
|
||||
|
||||
it("change_agent_profile wraps all five fields in the request DTO (camelCase)", async () => {
|
||||
invoke.mockResolvedValueOnce({ agent: { id: "agent-2" } });
|
||||
await new TauriAgentGateway().changeAgentProfile(
|
||||
"proj-1",
|
||||
"agent-2",
|
||||
"prof-9",
|
||||
30,
|
||||
120,
|
||||
);
|
||||
expect(invoke).toHaveBeenCalledWith("change_agent_profile", {
|
||||
request: {
|
||||
projectId: "proj-1",
|
||||
agentId: "agent-2",
|
||||
profileId: "prof-9",
|
||||
rows: 30,
|
||||
cols: 120,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("change_agent_profile returns the mutated agent and the relaunched session", async () => {
|
||||
const response = {
|
||||
agent: { id: "agent-2", profileId: "prof-9" },
|
||||
relaunchedSession: { sessionId: "sess-7", cwd: "/p", rows: 30, cols: 120 },
|
||||
};
|
||||
invoke.mockResolvedValueOnce(response);
|
||||
const out = await new TauriAgentGateway().changeAgentProfile(
|
||||
"proj-1",
|
||||
"agent-2",
|
||||
"prof-9",
|
||||
30,
|
||||
120,
|
||||
);
|
||||
expect(out.agent.profileId).toBe("prof-9");
|
||||
expect(out.relaunchedSession?.sessionId).toBe("sess-7");
|
||||
});
|
||||
|
||||
it("change_agent_profile leaves relaunchedSession undefined when the backend omits it", async () => {
|
||||
invoke.mockResolvedValueOnce({ agent: { id: "agent-2" } });
|
||||
const out = await new TauriAgentGateway().changeAgentProfile(
|
||||
"proj-1",
|
||||
"agent-2",
|
||||
"prof-9",
|
||||
30,
|
||||
120,
|
||||
);
|
||||
expect(out.relaunchedSession).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user