pub struct Task {
pub id: TaskId,
pub kind: TaskKind,
pub status: TaskStatus,
pub created_at: SystemTime,
pub started_at: Option<SystemTime>,
pub finished_at: Option<SystemTime>,
pub session_key: Option<String>,
pub label: Option<String>,
pub description: Option<String>,
pub stream_output: bool,
pub output_buffer: String,
}Expand description
A task with full metadata.
Fields§
§id: TaskIdUnique task ID
kind: TaskKindWhat kind of task this is
status: TaskStatusCurrent status
created_at: SystemTimeWhen the task was created
started_at: Option<SystemTime>When the task started running
finished_at: Option<SystemTime>When the task finished (completed/failed/cancelled)
session_key: Option<String>Session that owns this task
label: Option<String>User-provided label
description: Option<String>Short description of what the task is currently doing (agent-settable)
stream_output: boolWhether task output should stream to chat
output_buffer: StringAccumulated output (if buffering)
Implementations§
Source§impl Task
impl Task
Sourcepub fn with_session(self, key: impl Into<String>) -> Self
pub fn with_session(self, key: impl Into<String>) -> Self
Set the session key.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Set a label.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set a description.
Sourcepub fn with_streaming(self) -> Self
pub fn with_streaming(self) -> Self
Enable output streaming.
Sourcepub fn background(&mut self)
pub fn background(&mut self)
Move task to background.
Sourcepub fn foreground(&mut self)
pub fn foreground(&mut self)
Move task to foreground.
Sourcepub fn update_progress(&mut self, progress: TaskProgress)
pub fn update_progress(&mut self, progress: TaskProgress)
Update progress.
Sourcepub fn display_label(&self) -> String
pub fn display_label(&self) -> String
Get display label (user label or auto-generated).
Sourcepub fn display_description(&self) -> String
pub fn display_description(&self) -> String
Get short description (agent-set, or fallback to label).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more