Skip to main content

NewSession

Struct NewSession 

Source
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: Uuid

UUIDv7 id (generated by the caller via Uuid::now_v7 or supplied).

§started_at: i64

Unix-ms UTC start timestamp.

§agent_kind: AgentKind

Detected agent kind.

§adapter_status: AdapterStatus

Adapter 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: PathBuf

Working directory.

§hostname: Option<String>

Hostname, if known.

§hh_version: String

Halfhand 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

Source

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

Source§

fn clone(&self) -> NewSession

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NewSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.