ticket117: synchronie métier idea_ask_agent + corrélation task ↔ rendezvous
This commit is contained in:
@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::conversation::ConversationId;
|
||||
use crate::ids::{AgentId, ProjectId, ScheduleId, TaskId};
|
||||
use crate::ids::{AgentId, ProjectId, RendezvousId, ScheduleId, TaskId};
|
||||
use crate::mailbox::TicketId;
|
||||
|
||||
/// Maximum length for human-facing task labels.
|
||||
@ -59,6 +59,22 @@ pub enum BackgroundTaskWakePolicy {
|
||||
RecordOnly,
|
||||
}
|
||||
|
||||
/// Structural link from a background task to a composite inter-agent rendezvous.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BackgroundTaskRendezvousLink {
|
||||
/// Stable business rendezvous id, independent from any task id.
|
||||
pub rendezvous_id: RendezvousId,
|
||||
/// Mailbox ticket that must receive the eventual business `Final`.
|
||||
pub ticket_id: TicketId,
|
||||
/// Agent that requested the rendezvous, when known.
|
||||
pub requester_agent_id: Option<AgentId>,
|
||||
/// Target agent doing the work.
|
||||
pub target_agent_id: AgentId,
|
||||
/// Conversation entered by the target turn.
|
||||
pub conversation_id: ConversationId,
|
||||
}
|
||||
|
||||
/// Kind-specific payload of a background task.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", tag = "kind")]
|
||||
@ -107,6 +123,9 @@ pub struct BackgroundTask {
|
||||
pub owner_agent_id: AgentId,
|
||||
/// Kind-specific payload.
|
||||
pub kind: BackgroundTaskKind,
|
||||
/// Optional composite rendezvous this task participates in.
|
||||
#[serde(default)]
|
||||
pub rendezvous: Option<BackgroundTaskRendezvousLink>,
|
||||
/// Current lifecycle state.
|
||||
pub state: BackgroundTaskState,
|
||||
/// Completion wake policy.
|
||||
@ -143,6 +162,7 @@ impl BackgroundTask {
|
||||
project_id,
|
||||
owner_agent_id,
|
||||
kind,
|
||||
rendezvous: None,
|
||||
state: BackgroundTaskState::Queued,
|
||||
wake_policy,
|
||||
created_at_ms: now_ms,
|
||||
@ -155,6 +175,13 @@ impl BackgroundTask {
|
||||
Ok(task)
|
||||
}
|
||||
|
||||
/// Returns a copy linked to a composite inter-agent rendezvous.
|
||||
#[must_use]
|
||||
pub fn with_rendezvous(mut self, link: BackgroundTaskRendezvousLink) -> Self {
|
||||
self.rendezvous = Some(link);
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns a copy moved to a non-terminal state.
|
||||
///
|
||||
/// Terminal transitions must use [`Self::complete`] so the result/state
|
||||
|
||||
Reference in New Issue
Block a user