Struct CliSession
Sourcepub struct CliSession {
pub base_url: Option<String>,
pub api_key: Option<String>,
pub tenant_id: Option<String>,
pub agent_id: Option<String>,
pub trajectory_id: Option<String>,
pub scope_id: Option<String>,
}Expand description
Persistent CLI session state, stored at ~/.cellstate/session.json.
Resolution priority for every field: explicit CLI flag > env var > session > default.
Fields§
§base_url: Option<String>API base URL
api_key: Option<String>API key
tenant_id: Option<String>Current tenant scope
agent_id: Option<String>Current agent scope
trajectory_id: Option<String>Current trajectory scope
scope_id: Option<String>Current scope scope
Implementations§
Source§impl CliSession
impl CliSession
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load session from ~/.cellstate/session.json.
Returns a default (empty) session if the file doesn’t exist or can’t be parsed — the session is advisory, never a hard gate.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Save session to ~/.cellstate/session.json, creating the directory if needed.
Sourcepub fn resolve(
&self,
flag: Option<&str>,
env_key: &str,
session_value: Option<&str>,
default: Option<&str>,
) -> Option<String>
pub fn resolve( &self, flag: Option<&str>, env_key: &str, session_value: Option<&str>, default: Option<&str>, ) -> Option<String>
Resolve a value with priority: explicit flag > env var > session > default.
Sourcepub fn effective_base_url(&self, flag: Option<&str>) -> String
pub fn effective_base_url(&self, flag: Option<&str>) -> String
Get effective base_url (flag > env > session > http://localhost:3000).
Sourcepub fn effective_api_key(&self, flag: Option<&str>) -> Option<String>
pub fn effective_api_key(&self, flag: Option<&str>) -> Option<String>
Get effective api_key (flag > env > session > None).
Sourcepub fn clear_scope(&mut self)
pub fn clear_scope(&mut self)
Clear all scope fields (tenant, agent, trajectory, scope).
Trait Implementations§
Source§impl Clone for CliSession
impl Clone for CliSession
Source§fn clone(&self) -> CliSession
fn clone(&self) -> CliSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CliSession
impl Debug for CliSession
Source§impl Default for CliSession
impl Default for CliSession
Source§fn default() -> CliSession
fn default() -> CliSession
Source§impl<'de> Deserialize<'de> for CliSession
impl<'de> Deserialize<'de> for CliSession
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 PartialEq for CliSession
impl PartialEq for CliSession
Source§impl Serialize for CliSession
impl Serialize for CliSession
impl StructuralPartialEq for CliSession
Auto Trait Implementations§
impl Freeze for CliSession
impl RefUnwindSafe for CliSession
impl Send for CliSession
impl Sync for CliSession
impl Unpin for CliSession
impl UnwindSafe for CliSession
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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