From 54c8ecfab79935c719f667a0a765a4960eeb6385 Mon Sep 17 00:00:00 2001 From: Blomios Date: Thu, 2 Jul 2026 15:47:39 +0200 Subject: [PATCH] =?UTF-8?q?feat(app-tauri):=20=C3=A9v=C3=A9nements=20des?= =?UTF-8?q?=20t=C3=A2ches=20de=20fond=20expos=C3=A9s=20au=20front=20(B1-B6?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Câblage des événements de complétion/mailbox/réveil vers la couche app-tauri pour consommation par le frontend (lots F1-F4 à venir). Co-Authored-By: Claude Opus 4.8 --- crates/app-tauri/src/events.rs | 144 +++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/crates/app-tauri/src/events.rs b/crates/app-tauri/src/events.rs index f31ff2e..e32e7de 100644 --- a/crates/app-tauri/src/events.rs +++ b/crates/app-tauri/src/events.rs @@ -96,6 +96,41 @@ pub enum DomainEventDto { /// New liveness, as a lowercase string (`"alive"` / `"stalled"`). liveness: AgentLivenessDto, }, + /// A background task lifecycle/delivery event occurred. + #[serde(rename_all = "camelCase")] + BackgroundTaskChanged { + /// Project id. + project_id: String, + /// Task id. + task_id: String, + /// Owner agent id. + agent_id: String, + /// Lightweight event/state label. + state: String, + }, + /// An agent inbox queue depth changed. + #[serde(rename_all = "camelCase")] + AgentInboxChanged { + /// Agent id. + agent_id: String, + /// Queue depth after the operation. + depth: usize, + /// Queue operation label. + action: String, + }, + /// An owner wake event occurred. + #[serde(rename_all = "camelCase")] + AgentWakeChanged { + /// Project id. + project_id: String, + /// Agent id. + agent_id: String, + /// Wake operation label. + action: String, + /// Failure reason, when any. + #[serde(skip_serializing_if = "Option::is_none")] + reason: Option, + }, /// An agent's runtime profile was changed (hot-swap of the AI engine). #[serde(rename_all = "camelCase")] AgentProfileChanged { @@ -359,6 +394,115 @@ impl From<&DomainEvent> for DomainEventDto { liveness: (*liveness).into(), } } + DomainEvent::BackgroundTaskStarted { + project_id, + task_id, + owner_agent_id, + } => Self::BackgroundTaskChanged { + project_id: project_id.to_string(), + task_id: task_id.to_string(), + agent_id: owner_agent_id.to_string(), + state: "started".to_owned(), + }, + DomainEvent::BackgroundTaskStateChanged { + project_id, + task_id, + owner_agent_id, + state, + } => Self::BackgroundTaskChanged { + project_id: project_id.to_string(), + task_id: task_id.to_string(), + agent_id: owner_agent_id.to_string(), + state: format!("{state:?}"), + }, + DomainEvent::BackgroundTaskCompleted { + project_id, + task_id, + owner_agent_id, + } => Self::BackgroundTaskChanged { + project_id: project_id.to_string(), + task_id: task_id.to_string(), + agent_id: owner_agent_id.to_string(), + state: "completed".to_owned(), + }, + DomainEvent::BackgroundTaskFailed { + project_id, + task_id, + owner_agent_id, + } => Self::BackgroundTaskChanged { + project_id: project_id.to_string(), + task_id: task_id.to_string(), + agent_id: owner_agent_id.to_string(), + state: "failed".to_owned(), + }, + DomainEvent::BackgroundTaskCancelled { + project_id, + task_id, + owner_agent_id, + } => Self::BackgroundTaskChanged { + project_id: project_id.to_string(), + task_id: task_id.to_string(), + agent_id: owner_agent_id.to_string(), + state: "cancelled".to_owned(), + }, + DomainEvent::BackgroundTaskCompletionDeliveryPending { + project_id, + task_id, + owner_agent_id, + } => Self::BackgroundTaskChanged { + project_id: project_id.to_string(), + task_id: task_id.to_string(), + agent_id: owner_agent_id.to_string(), + state: "deliveryPending".to_owned(), + }, + DomainEvent::BackgroundTaskCompletionDelivered { + project_id, + task_id, + owner_agent_id, + } => Self::BackgroundTaskChanged { + project_id: project_id.to_string(), + task_id: task_id.to_string(), + agent_id: owner_agent_id.to_string(), + state: "delivered".to_owned(), + }, + DomainEvent::AgentInboxQueued { agent_id, depth } => Self::AgentInboxChanged { + agent_id: agent_id.to_string(), + depth: *depth, + action: "queued".to_owned(), + }, + DomainEvent::AgentInboxDrained { agent_id, depth } => Self::AgentInboxChanged { + agent_id: agent_id.to_string(), + depth: *depth, + action: "drained".to_owned(), + }, + DomainEvent::AgentWakeScheduled { + project_id, + agent_id, + } => Self::AgentWakeChanged { + project_id: project_id.to_string(), + agent_id: agent_id.to_string(), + action: "scheduled".to_owned(), + reason: None, + }, + DomainEvent::AgentWakeStarted { + project_id, + agent_id, + } => Self::AgentWakeChanged { + project_id: project_id.to_string(), + agent_id: agent_id.to_string(), + action: "started".to_owned(), + reason: None, + }, + DomainEvent::AgentWakeFailed { + project_id, + agent_id, + reason, + } => Self::AgentWakeChanged { + project_id: project_id.to_string(), + agent_id: agent_id.to_string(), + action: "failed".to_owned(), + reason: Some(reason.clone()), + }, DomainEvent::AgentProfileChanged { agent_id, profile_id,