feat(frontend): popup de confirmation à la fermeture avec travail en cours (#83)

Écoute l'event Tauri `app-exit-work-guard` (émis par le backend quand la
fermeture de la fenêtre main est interceptée) et affiche une popup modale
"Du travail est encore en cours" avec le résumé pluralisé exact du carnet
#83, le détail agents/tâches capé à 5 lignes, et les deux actions Annuler
(focus par défaut, no-op local) / Quitter quand même (danger, appelle
confirm_app_exit). Pas d'option "ne plus demander".

- domain/ports/adapters (Tauri listen+invoke, HTTP desktop-only stub, mock
  avec helpers de test) : onAppExitWorkGuard/confirmAppExit sur
  SystemGateway, suivant le patron déjà utilisé pour focused-project et les
  domain events.
- AppExitConfirmDialog : mounted une fois près de la racine (App.tsx), à
  côté d'AnnouncementsProvider — role="alertdialog", focus trap, Échap =
  Annuler, pas de fermeture au clic extérieur, ne se referme jamais
  automatiquement (un event pendant l'ouverture rafraîchit juste le résumé).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-20 19:16:29 +02:00
parent 294865f805
commit 8509653e3c
9 changed files with 565 additions and 1 deletions

View File

@ -13,6 +13,43 @@ export interface HealthReport {
note: string | null;
}
// ---------------------------------------------------------------------------
// App-exit work guard (ticket #83) — confirmation before quitting IdeA while
// agents/background tasks are active. Mirrors the backend
// `AppExitWorkGuardStateDto` (main window only; detached windows don't carry
// this guard).
// ---------------------------------------------------------------------------
/** One active work item contributing to {@link AppExitWorkGuardState}. */
export type AppExitWorkGuardDetail =
| {
kind: "busyAgent";
projectId: string;
projectName: string;
agentId: string;
agentName: string;
ticketId: string | null;
}
| {
kind: "activeBackgroundTask";
projectId: string;
projectName: string;
agentId: string;
agentName: string;
taskId: string;
state: string;
taskKind: string;
};
/** App-wide shutdown guard read model, carried by the `app-exit-work-guard` event. */
export interface AppExitWorkGuardState {
hasWorkInProgress: boolean;
busyAgentCount: number;
activeBackgroundTaskCount: number;
totalWorkCount: number;
details: AppExitWorkGuardDetail[];
}
/**
* Lifecycle status of a local model server during an agent launch (F35, mirror
* of the backend `ModelServerStatusDto`, tagged on `state`, camelCase wire).