pub struct LiveSessionFile {
pub version: u8,
pub sessions: HashMap<SessionKey, HookSession>,
pub updated_at: Option<DateTime<Utc>>,
}Expand description
Contents of ~/.ccboard/live-sessions.json
Fields§
§version: u8Schema version — always 1 for now, used for future migrations
sessions: HashMap<SessionKey, HookSession>Active sessions keyed by “{session_id}:{tty}”
updated_at: Option<DateTime<Utc>>When this file was last written
Implementations§
Source§impl LiveSessionFile
impl LiveSessionFile
Sourcepub fn default_path() -> Option<PathBuf>
pub fn default_path() -> Option<PathBuf>
Default path: ~/.ccboard/live-sessions.json
Sourcepub fn load(path: &Path) -> Result<Self, HookStateError>
pub fn load(path: &Path) -> Result<Self, HookStateError>
Load from disk. Returns Default if file does not exist; errors only on parse failure.
Sourcepub fn save(&self, path: &Path) -> Result<(), HookStateError>
pub fn save(&self, path: &Path) -> Result<(), HookStateError>
Atomic write: write to .tmp, then rename (APFS/ext4-safe)
Sourcepub fn prune_stopped(&mut self, max_age: Duration)
pub fn prune_stopped(&mut self, max_age: Duration)
Remove Stopped sessions older than max_age
Sourcepub fn prune_stale_running(&mut self, max_age: Duration)
pub fn prune_stale_running(&mut self, max_age: Duration)
Remove Running / WaitingInput sessions not updated within max_age.
Handles Claude processes that crashed or were killed without sending a Stop hook. Default recommended value: 10 minutes.
Sourcepub fn upsert(
&mut self,
key: SessionKey,
session_id: String,
cwd: String,
tty: String,
new_status: HookSessionStatus,
event_name: String,
)
pub fn upsert( &mut self, key: SessionKey, session_id: String, cwd: String, tty: String, new_status: HookSessionStatus, event_name: String, )
Upsert a session: create if new, update status/timestamp if existing.
Special rule: UserPromptSubmit on a Stopped session revives it to Running.
Trait Implementations§
Source§impl Clone for LiveSessionFile
impl Clone for LiveSessionFile
Source§fn clone(&self) -> LiveSessionFile
fn clone(&self) -> LiveSessionFile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LiveSessionFile
impl Debug for LiveSessionFile
Source§impl Default for LiveSessionFile
impl Default for LiveSessionFile
Source§fn default() -> LiveSessionFile
fn default() -> LiveSessionFile
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LiveSessionFile
impl<'de> Deserialize<'de> for LiveSessionFile
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 LiveSessionFile
impl RefUnwindSafe for LiveSessionFile
impl Send for LiveSessionFile
impl Sync for LiveSessionFile
impl Unpin for LiveSessionFile
impl UnsafeUnpin for LiveSessionFile
impl UnwindSafe for LiveSessionFile
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