Skip to main content

Module session

Module session 

Source
Expand description

Session management — ID resolution, locking, snapshots, cleanup.

Structs§

SessionContext
Session context — holds the session ID, directory, base directory, and file lock.
SnapshotInfo
Info about a saved snapshot.

Functions§

acquire_session_lock
Acquire an exclusive file lock on the session directory.
cleanup_expired_sessions
Clean up expired sessions.
create_snapshot
Create a named snapshot of a session.
delete_snapshot
Delete a saved snapshot.
generate_session_id
Generate a new session_id (format: YYYYMMDD_first8ofUuid)
get_or_create_session_dir
Get or create a session directory under base_dir/sessions/<session_id>.
list_snapshots
List all saved snapshots under base_dir/snapshots/.
resolve_session
Resolve and create a session context — session ID, directory, and file lock.
resolve_session_id
Resolve session ID (priority: CLI arg → PHI_SESSION_ID env var → auto-generate).
restore_snapshot
Restore a session from a snapshot.
validate_session_id
Validate session ID format.
validate_snapshot_name
Validate snapshot name format.