pub struct Session {
pub id: SessionId,
pub name: String,
pub working_dir: PathBuf,
pub created_at: u64,
pub updated_at: u64,
pub messages: Vec<Message>,
pub user_renamed: bool,
}Expand description
A session represents an independent conversation context.
Fields§
§id: SessionIdUnique identifier.
name: StringDisplay name (AI-generated or user-specified).
working_dir: PathBufWorking directory this session is associated with.
created_at: u64Creation timestamp (seconds since UNIX epoch).
updated_at: u64Last update timestamp.
messages: Vec<Message>Conversation messages.
user_renamed: boolTrue once the user has explicitly run /rename. Drives the
session-name badge above the input box: auto-named sessions
(default / session-* / first-message-derived) stay badge-less
so the chrome doesn’t get noisy on every fresh conversation —
the badge is reserved for names the user deliberately chose.
#[serde(default)] so sessions saved before this field exists
load as false (i.e., behave like auto-named).
Implementations§
Source§impl Session
impl Session
Sourcepub fn default_session(working_dir: PathBuf) -> Self
pub fn default_session(working_dir: PathBuf) -> Self
Create a default session (used on first launch).
Sourcepub fn rename(&mut self, name: String)
pub fn rename(&mut self, name: String)
Update the session’s name in response to an explicit user
/rename. Also flips user_renamed so the session-name badge
becomes visible — auto_name_from_messages must NOT call this.
Sourcepub fn auto_name_from_messages(&mut self)
pub fn auto_name_from_messages(&mut self)
Auto-name an untouched session from the first real user message.
This mirrors the TUI persistence behavior: default names are replaced by the first non-synthetic user turn, while user-renamed sessions are left alone.
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>,
Source§impl From<&Session> for SessionMeta
impl From<&Session> for SessionMeta
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more