pub struct TaskThread {
pub task_id: TaskId,
pub label: String,
pub description: Option<String>,
pub status: Option<TaskStatus>,
pub messages: Vec<ThreadMessage>,
pub compact_summary: Option<String>,
pub is_foreground: bool,
pub created_at: SystemTime,
pub last_activity: SystemTime,
pub model: Option<String>,
pub share_context: bool,
}Expand description
A task thread — an independent conversation context.
Fields§
§task_id: TaskIdAssociated task ID
label: StringUser-provided label for this thread
description: Option<String>Optional description (for spawned tasks)
status: Option<TaskStatus>Task status (for spawned tasks, None = simple thread)
messages: Vec<ThreadMessage>Full conversation history (compacted when switching away)
compact_summary: Option<String>Compact summary of this thread’s work (generated on switch-away)
is_foreground: boolWhether this thread is the foreground thread
created_at: SystemTimeWhen the thread was created
last_activity: SystemTimeLast activity time
model: Option<String>Model to use for this thread (None = inherit from session)
Whether to include this thread’s summary in other threads’ context
Implementations§
Source§impl TaskThread
impl TaskThread
Sourcepub fn new_task(
label: impl Into<String>,
description: impl Into<String>,
) -> Self
pub fn new_task( label: impl Into<String>, description: impl Into<String>, ) -> Self
Create a new thread for a spawned task.
Sourcepub fn add_message(&mut self, role: MessageRole, content: impl Into<String>)
pub fn add_message(&mut self, role: MessageRole, content: impl Into<String>)
Add a message to the thread.
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the message count.
Sourcepub fn estimated_tokens(&self) -> usize
pub fn estimated_tokens(&self) -> usize
Estimate token count (rough approximation: 4 chars ≈ 1 token).
Sourcepub fn compaction_prompt(&self) -> String
pub fn compaction_prompt(&self) -> String
Generate a compaction prompt for this thread.
Sourcepub fn apply_compaction(&mut self, summary: String)
pub fn apply_compaction(&mut self, summary: String)
Apply a compact summary and clear old messages.
Sourcepub fn build_context(&self) -> String
pub fn build_context(&self) -> String
Build context for this thread including compact summary.
Trait Implementations§
Source§impl Clone for TaskThread
impl Clone for TaskThread
Source§fn clone(&self) -> TaskThread
fn clone(&self) -> TaskThread
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more