feat(domain): modèle de tâches de fond de 1re classe et mailbox (B1)
Entités BackgroundTask et Inbox, identifiants, événements et ports du domaine pour la récupération de complétion post-tour et la réception de messages concurrents. Fondations des lots infra/application suivants. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
//! Domain events published on the [`crate::ports::EventBus`] and relayed to the
|
||||
//! presentation layer (ARCHITECTURE §3.2).
|
||||
|
||||
use crate::ids::{AgentId, ProfileId, ProjectId, SessionId, SkillId, TemplateId};
|
||||
use crate::ids::{AgentId, ProfileId, ProjectId, SessionId, SkillId, TaskId, TemplateId};
|
||||
use crate::mailbox::TicketId;
|
||||
use crate::memory::MemorySlug;
|
||||
use crate::template::TemplateVersion;
|
||||
@ -41,6 +41,108 @@ pub enum DomainEvent {
|
||||
/// The session it runs in.
|
||||
session_id: SessionId,
|
||||
},
|
||||
/// A first-class background task started running.
|
||||
BackgroundTaskStarted {
|
||||
/// The owning project.
|
||||
project_id: ProjectId,
|
||||
/// The task.
|
||||
task_id: TaskId,
|
||||
/// The agent that owns completion delivery.
|
||||
owner_agent_id: AgentId,
|
||||
},
|
||||
/// A first-class background task changed state.
|
||||
BackgroundTaskStateChanged {
|
||||
/// The owning project.
|
||||
project_id: ProjectId,
|
||||
/// The task.
|
||||
task_id: TaskId,
|
||||
/// The agent that owns completion delivery.
|
||||
owner_agent_id: AgentId,
|
||||
/// New state.
|
||||
state: crate::background_task::BackgroundTaskState,
|
||||
},
|
||||
/// A first-class background task completed successfully.
|
||||
BackgroundTaskCompleted {
|
||||
/// The owning project.
|
||||
project_id: ProjectId,
|
||||
/// The task.
|
||||
task_id: TaskId,
|
||||
/// The agent that owns completion delivery.
|
||||
owner_agent_id: AgentId,
|
||||
},
|
||||
/// A first-class background task failed.
|
||||
BackgroundTaskFailed {
|
||||
/// The owning project.
|
||||
project_id: ProjectId,
|
||||
/// The task.
|
||||
task_id: TaskId,
|
||||
/// The agent that owns completion delivery.
|
||||
owner_agent_id: AgentId,
|
||||
},
|
||||
/// A first-class background task was cancelled.
|
||||
BackgroundTaskCancelled {
|
||||
/// The owning project.
|
||||
project_id: ProjectId,
|
||||
/// The task.
|
||||
task_id: TaskId,
|
||||
/// The agent that owns completion delivery.
|
||||
owner_agent_id: AgentId,
|
||||
},
|
||||
/// A first-class background task has a terminal result not yet delivered.
|
||||
BackgroundTaskCompletionDeliveryPending {
|
||||
/// The owning project.
|
||||
project_id: ProjectId,
|
||||
/// The task.
|
||||
task_id: TaskId,
|
||||
/// The agent that owns completion delivery.
|
||||
owner_agent_id: AgentId,
|
||||
},
|
||||
/// A first-class background task completion was delivered.
|
||||
BackgroundTaskCompletionDelivered {
|
||||
/// The owning project.
|
||||
project_id: ProjectId,
|
||||
/// The task.
|
||||
task_id: TaskId,
|
||||
/// The agent that owns completion delivery.
|
||||
owner_agent_id: AgentId,
|
||||
},
|
||||
/// An item was queued in an agent inbox.
|
||||
AgentInboxQueued {
|
||||
/// Target agent.
|
||||
agent_id: AgentId,
|
||||
/// Queue depth after enqueue.
|
||||
depth: usize,
|
||||
},
|
||||
/// An item was drained from an agent inbox.
|
||||
AgentInboxDrained {
|
||||
/// Target agent.
|
||||
agent_id: AgentId,
|
||||
/// Queue depth after drain.
|
||||
depth: usize,
|
||||
},
|
||||
/// A wake was scheduled for an agent.
|
||||
AgentWakeScheduled {
|
||||
/// Owning project.
|
||||
project_id: ProjectId,
|
||||
/// Target agent.
|
||||
agent_id: AgentId,
|
||||
},
|
||||
/// A wake turn started for an agent.
|
||||
AgentWakeStarted {
|
||||
/// Owning project.
|
||||
project_id: ProjectId,
|
||||
/// Target agent.
|
||||
agent_id: AgentId,
|
||||
},
|
||||
/// A wake attempt failed.
|
||||
AgentWakeFailed {
|
||||
/// Owning project.
|
||||
project_id: ProjectId,
|
||||
/// Target agent.
|
||||
agent_id: AgentId,
|
||||
/// Human-readable reason.
|
||||
reason: String,
|
||||
},
|
||||
/// A target agent produced a synchronous reply to an inter-agent `ask`
|
||||
/// (ARCHITECTURE §17.4): the requester sent a task via `agent.message`, IdeA
|
||||
/// drove the target's structured session to its turn `Final`, and this is the
|
||||
|
||||
Reference in New Issue
Block a user