pub struct Session {Show 21 fields
pub id: SessionId,
pub parent_id: Option<SessionId>,
pub session_type: SessionType,
pub tenant_id: Option<String>,
pub mode: SessionMode,
pub state: SessionState,
pub config: SessionConfig,
pub permission_policy: PermissionPolicy,
pub messages: Vec<SessionMessage>,
pub current_leaf_id: Option<MessageId>,
pub summary: Option<String>,
pub total_usage: TokenUsage,
pub total_cost_usd: f64,
pub static_context_hash: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub error: Option<String>,
pub todos: Vec<TodoItem>,
pub current_plan: Option<Plan>,
pub compact_history: Vec<CompactRecord>,
}Fields§
§id: SessionId§parent_id: Option<SessionId>§session_type: SessionType§tenant_id: Option<String>§mode: SessionMode§state: SessionState§config: SessionConfig§permission_policy: PermissionPolicy§messages: Vec<SessionMessage>§current_leaf_id: Option<MessageId>§summary: Option<String>§total_usage: TokenUsage§total_cost_usd: f64§static_context_hash: Option<String>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>§expires_at: Option<DateTime<Utc>>§error: Option<String>§todos: Vec<TodoItem>§current_plan: Option<Plan>§compact_history: Vec<CompactRecord>Implementations§
Source§impl Session
impl Session
pub fn new(config: SessionConfig) -> Self
pub fn with_id(id: SessionId, config: SessionConfig) -> Self
pub fn new_subagent( parent_id: SessionId, agent_type: impl Into<String>, description: impl Into<String>, config: SessionConfig, ) -> Self
pub fn is_subagent(&self) -> bool
pub fn is_running(&self) -> bool
pub fn is_terminal(&self) -> bool
pub fn is_expired(&self) -> bool
pub fn add_message(&mut self, message: SessionMessage)
pub fn get_current_branch(&self) -> Vec<&SessionMessage>
pub fn to_api_messages(&self) -> Vec<Message>
pub fn branch_length(&self) -> usize
pub fn set_state(&mut self, state: SessionState)
pub fn set_todos(&mut self, todos: Vec<TodoItem>)
pub fn todos_in_progress_count(&self) -> usize
pub fn enter_plan_mode(&mut self, name: Option<String>) -> &Plan
pub fn update_plan_content(&mut self, content: String)
pub fn exit_plan_mode(&mut self) -> Option<Plan>
pub fn cancel_plan(&mut self) -> Option<Plan>
pub fn is_in_plan_mode(&self) -> bool
pub fn record_compact(&mut self, record: CompactRecord)
pub fn update_summary(&mut self, summary: impl Into<String>)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
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 Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
Source§fn deserialize_with(body: ResponseBody) -> Result<D, Error>
fn deserialize_with(body: ResponseBody) -> Result<D, Error>
Deserialize the response body using the specified format. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.