pub struct Session {Show 15 fields
pub id: String,
pub title: String,
pub name: Option<String>,
pub model: String,
pub thinking_level: String,
pub system_prompt: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub total_input_tokens: u64,
pub total_output_tokens: u64,
pub session_cost: f64,
pub api_messages: Vec<Value>,
pub abort_context: Option<String>,
pub parent_session: Option<String>,
pub compacted_into: Option<String>,
}Fields§
§id: String§title: String§name: Option<String>§model: String§thinking_level: String§system_prompt: Option<String>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>§total_input_tokens: u64§total_output_tokens: u64§session_cost: f64§api_messages: Vec<Value>§abort_context: Option<String>Saved abort context — injected into the next user message on /continue
parent_session: Option<String>ID of the session this was compacted from (backward link)
compacted_into: Option<String>ID of the session created by compacting this one (forward link)
Implementations§
Source§impl Session
impl Session
pub fn new( model: &str, thinking_level: &str, system_prompt: Option<&str>, ) -> Self
Sourcepub fn new_from_compaction(parent: &Session, summary: String) -> Self
pub fn new_from_compaction(parent: &Session, summary: String) -> Self
Create a new session from a compaction summary, linked to the parent.
Sourcepub fn auto_title(&mut self)
pub fn auto_title(&mut self)
Set title from the first user message if not already set
pub async fn save(&self) -> Result<()>
pub fn load(id: &str) -> Result<Self>
pub fn info(&self) -> SessionInfo
Sourcepub fn set_name(&mut self, name: &str) -> Result<()>
pub fn set_name(&mut self, name: &str) -> Result<()>
Assign a name to this session. Validates name, enforces uniqueness across sessions, and rejects collisions with existing chain names. Idempotent: re-applying the current name is a no-op.
pub fn clear_name(&mut self)
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 UnsafeUnpin 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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.