pub struct NewSession {
pub id: Uuid,
pub started_at: i64,
pub agent_kind: AgentKind,
pub adapter_status: AdapterStatus,
pub command: Vec<String>,
pub cwd: PathBuf,
pub hostname: Option<String>,
pub hh_version: String,
pub model: Option<String>,
pub git_branch: Option<String>,
pub git_sha: Option<String>,
pub git_dirty: Option<bool>,
}Expand description
Input for creating a new session (FR-1.2).
Fields§
§id: UuidUUIDv7 id (generated by the caller via Uuid::now_v7 or supplied).
started_at: i64Unix-ms UTC start timestamp.
agent_kind: AgentKindDetected agent kind.
adapter_status: AdapterStatusAdapter state for this session (FR-1.5): Active while a structured
adapter is tailing events, Degraded if it failed but PTY/FS recording
continues, None for a generic PTY-only session. Written to the
sessions.adapter_status column by crate::store::Store::create_session
and updated at finalize via
crate::store::Store::set_session_adapter_meta.
command: Vec<String>Full command line as an argv vector (stored as JSON).
cwd: PathBufWorking directory.
hostname: Option<String>Hostname, if known.
hh_version: StringHalfhand version string.
model: Option<String>Model name, if an adapter reported one.
git_branch: Option<String>Git branch, if cwd is a repo.
git_sha: Option<String>Git HEAD sha, if cwd is a repo.
git_dirty: Option<bool>Whether the git tree had uncommitted changes.
Implementations§
Source§impl NewSession
impl NewSession
Sourcepub fn short_id(&self) -> String
pub fn short_id(&self) -> String
The 6-hex-char short id (SRS §1.3/FR-1.2).
§SRS deviation (flagged)
The SRS says “first 6 hex of the UUID”, but a UUIDv7’s first 12 hex are
the 48-bit unix-ms timestamp, so the first 6 hex are ~constant for ~194
days and would collide immediately under the short_id UNIQUE
constraint (SRS §4.1). To keep short ids actually unique and useful as
the SRS intends, we derive the 6 hex from the random tail of the UUIDv7
(simple[26..32], part of rand_b). This is a deviation from the
literal wording that should be reconciled with the SRS author; see the
decisions summary and docs/adr/.
Trait Implementations§
Source§impl Clone for NewSession
impl Clone for NewSession
Source§fn clone(&self) -> NewSession
fn clone(&self) -> NewSession
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more