fix(domain,application,infrastructure,backend,app-tauri,frontend): Stop demande agent préserve la conversation ouverte — arrêt sans fermeture/clôture du chat, états cohérents après cancel sur les 3 adapters de session, cellule et workstate synchronisés — #343 (QA verte)

This commit is contained in:
2026-09-13 10:03:36 +02:00
parent a1e8a6466f
commit c37638ff24
26 changed files with 1210 additions and 232 deletions

View File

@ -1608,8 +1608,8 @@ pub trait AgentSession: Send + Sync {
/// # Errors
/// [`AgentSessionError::Io`] when the adapter attempted a concrete cancel and
/// it failed.
async fn cancel_current_turn(&self) -> Result<(), AgentSessionError> {
Ok(())
async fn cancel_current_turn(&self) -> Result<CancelCurrentTurnOutcome, AgentSessionError> {
Ok(CancelCurrentTurnOutcome::AlreadyCompleted)
}
/// Termine proprement la session (tue le process/SDK sous-jacent). Idempotent.
@ -1619,6 +1619,20 @@ pub trait AgentSession: Send + Sync {
async fn shutdown(&self) -> Result<(), AgentSessionError>;
}
/// Result of a non-destructive request to cancel one structured-agent turn.
///
/// The session itself remains live for every outcome. A missing session is not
/// represented here: the application registry reports that separately.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CancelCurrentTurnOutcome {
/// A running turn accepted the cancellation request.
Cancelled,
/// The same turn had already accepted a cancellation request.
AlreadyCancelled,
/// The session is live but no turn is currently running.
AlreadyCompleted,
}
/// **Factory** sélectionnée par le profil (ARCHITECTURE §17.1) : crée/reprend une
/// [`AgentSession`] pour un agent IA. C'est elle qui sait *quel adapter* instancier
/// (Claude/Codex) selon `profile.structured_adapter` (§17.3). Open/Closed : ajouter