feat(backend,frontend): lot utilisateur #310 #311 #312 #313 — horodatage conversation, stop agent robuste, préférence terminal par défaut, paramètres projet (QA verte)

- #310: horodatage de tous les messages et événements de conversation visibles — composant partagé EntryTimestamp, timestamps propagés dans le transcript chat, les annonces inter-agent et le viewer de conversation, normalisation côté domain/adapters (conversation_log, paginate).
- #311: stop d'agent robuste pour PTY non monté, sessions headless et CLI custom — lifecycle/orchestrator durcis, ponts chat app-tauri/web-server alignés, arrêt fiable sans session orpheline.
- #312: préférence globale d'interface terminal par défaut — nouveau store settings (domain/application/infrastructure + tests), DTO et commandes backend, adapter frontend userSettings, panneau TerminalSettings dans les paramètres globaux.
- #313: Paramètres du projet — contexte de projet éditable et couleur de thème par projet (ProjectSettingsPanel + projectTheme), teinte des onglets projet, persistance via DTO projet.

QA verte (GO QA sur feature/batch-310-311-312-313-chat-stop-prefs-theme) — vérifications Git: git diff --cached --check OK; staging borné à crates/ et frontend/ (74 fichiers, +2105/-531), commit unique de lot conforme à la convention des lots (précédents batch-151/158/159, batch-210/211/212) car les fichiers partagés (dto.rs, commands.rs, CustomAgentChatView) entrelacent les 4 tickets.

fichiers .ideai/* (agents/test.md, chat-drafts.json, system-permissions.json, tickets/counter.json, tickets/index.json, tickets/308-313/), attachments/ et scripts/ hors périmètre et préservés en worktree ; aucun push.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-10 21:26:16 +02:00
parent fc45594d9a
commit 402a60f213
74 changed files with 2105 additions and 531 deletions

View File

@ -26,13 +26,15 @@ import { ProfilesSettings } from "@/features/first-run";
import { DevicesScreen } from "@/features/devices";
import { PluginsPanel } from "@/features/plugins";
import { DeploymentSettings } from "./DeploymentSettings";
import { TerminalSettings } from "./TerminalSettings";
/** The Settings sections, in menu/nav order. */
export type SettingsSection = "aiProfiles" | "deployment" | "devices" | "plugins";
export type SettingsSection = "aiProfiles" | "terminal" | "deployment" | "devices" | "plugins";
/** Human labels, shared by the nav column and the `Settings` menu (ticket #78 — French). */
export const SETTINGS_SECTION_LABEL: Record<SettingsSection, string> = {
aiProfiles: "Profils IA",
terminal: "Terminal",
deployment: "Déploiement",
devices: "Appareils",
plugins: "Plugins",
@ -41,6 +43,7 @@ export const SETTINGS_SECTION_LABEL: Record<SettingsSection, string> = {
/** Section order — the single source of truth for both nav and menu. */
export const SETTINGS_SECTIONS: SettingsSection[] = [
"aiProfiles",
"terminal",
"deployment",
"devices",
"plugins",
@ -98,6 +101,8 @@ export function SettingsView({
<div className="w-full max-w-2xl">
{section === "aiProfiles" ? (
<ProfilesSettings />
) : section === "terminal" ? (
<TerminalSettings />
) : section === "deployment" ? (
<DeploymentSettings />
) : section === "plugins" ? (

View File

@ -0,0 +1,30 @@
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { DIProvider } from "@/app/di";
import { createMockGateways } from "@/adapters/mock";
import { TerminalSettings } from "./TerminalSettings";
describe("TerminalSettings", () => {
it("loads and persists the exclusive global default without touching sessions", async () => {
const gateways = createMockGateways();
const update = vi.spyOn(gateways.userSettings, "updateUserSettings");
const close = vi.spyOn(gateways.terminal, "closeTerminal");
render(
<DIProvider gateways={gateways}>
<TerminalSettings />
</DIProvider>,
);
const native = (await screen.findByLabelText("TUI native")) as HTMLInputElement;
const cli = screen.getByLabelText("CLI IdeA") as HTMLInputElement;
await waitFor(() => expect(native.checked).toBe(true));
fireEvent.click(cli);
await waitFor(() =>
expect(update).toHaveBeenCalledWith({ defaultAgentTerminalInterface: "ideaCli" }),
);
expect(cli.checked).toBe(true);
expect(close).not.toHaveBeenCalled();
expect(screen.getByText("Utilisée à l'ouverture d'un nouveau terminal. Les terminaux déjà ouverts ne sont pas modifiés.")).toBeTruthy();
});
});

View File

@ -0,0 +1,86 @@
import { useEffect, useState } from "react";
import type { DefaultAgentTerminalInterface } from "@/ports";
import { Panel, Spinner } from "@/shared";
import { useGateways } from "@/app/di";
const choices: Array<{ value: DefaultAgentTerminalInterface; label: string }> = [
{ value: "nativeTui", label: "TUI native" },
{ value: "ideaCli", label: "CLI IdeA" },
];
export function TerminalSettings() {
const { userSettings } = useGateways();
const [value, setValue] = useState<DefaultAgentTerminalInterface>("nativeTui");
const [busy, setBusy] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
let cancelled = false;
setBusy(true);
userSettings
.readUserSettings()
.then((settings) => {
if (!cancelled) {
setValue(settings.defaultAgentTerminalInterface ?? "nativeTui");
setError(null);
}
})
.catch(() => {
if (!cancelled) setError("Impossible de charger la préférence de terminal.");
})
.finally(() => {
if (!cancelled) setBusy(false);
});
return () => {
cancelled = true;
};
}, [userSettings]);
async function select(next: DefaultAgentTerminalInterface) {
const previous = value;
setValue(next);
setBusy(true);
setError(null);
try {
const saved = await userSettings.updateUserSettings({
defaultAgentTerminalInterface: next,
});
setValue(saved.defaultAgentTerminalInterface ?? "nativeTui");
} catch {
setValue(previous);
setError("Impossible d’enregistrer la préférence de terminal.");
} finally {
setBusy(false);
}
}
return (
<Panel title="Terminal" className="flex flex-col gap-4 p-4">
<fieldset disabled={busy} className="flex flex-col gap-3">
<legend className="text-sm font-semibold text-content">
Interface de terminal par défaut
</legend>
<div className="flex flex-col gap-2">
{choices.map((choice) => (
<label key={choice.value} className="flex items-center gap-2 text-sm text-content">
<input
type="radio"
name="default-agent-terminal-interface"
value={choice.value}
checked={value === choice.value}
onChange={() => void select(choice.value)}
/>
{choice.label}
</label>
))}
</div>
<p className="text-xs text-muted">
Utilisée à l'ouverture d'un nouveau terminal. Les terminaux déjà ouverts ne sont pas modifiés.
</p>
</fieldset>
{busy && <Spinner size={14} />}
{error && <p role="alert" className="text-sm text-danger">{error}</p>}
</Panel>
);
}

View File

@ -7,5 +7,6 @@ export {
type SettingsSection,
} from "./SettingsView";
export { DeploymentSettings } from "./DeploymentSettings";
export { TerminalSettings } from "./TerminalSettings";
export { useDeployment } from "./useDeployment";
export type { DeploymentVm } from "./useDeployment";