pub struct SessionManager { /* private fields */ }Expand description
Manages session registration and lookup.
Implementations§
Source§impl SessionManager
impl SessionManager
pub fn new(team_id: Option<&str>) -> Self
Sourcepub fn resolve_role(&self, session_id: &str) -> Result<Option<RoleDefinition>>
pub fn resolve_role(&self, session_id: &str) -> Result<Option<RoleDefinition>>
Resolve a session’s role. Checks in order:
- In-memory cache (SESSIONS DashMap)
- Registration file on disk
- HOOKWISE_ROLE env var
Sourcepub fn get_or_populate(
&self,
session_id: &str,
cwd: &str,
) -> Result<SessionContext>
pub fn get_or_populate( &self, session_id: &str, cwd: &str, ) -> Result<SessionContext>
Get the full session context, populating if needed.
Sourcepub fn register(
&self,
session_id: &str,
role_name: &str,
task: Option<&str>,
prompt_file: Option<&str>,
) -> Result<()>
pub fn register( &self, session_id: &str, role_name: &str, task: Option<&str>, prompt_file: Option<&str>, ) -> Result<()>
Register a session with a role.
Sourcepub fn switch_role(&self, session_id: &str, new_role: &str) -> Result<()>
pub fn switch_role(&self, session_id: &str, new_role: &str) -> Result<()>
Switch a session’s role. Clears the session’s cache entries.
Sourcepub fn is_registered(&self, session_id: &str) -> bool
pub fn is_registered(&self, session_id: &str) -> bool
Check if a session is registered (either with a role or disabled).
Sourcepub fn is_disabled(&self, session_id: &str) -> bool
pub fn is_disabled(&self, session_id: &str) -> bool
Check if a session is disabled.
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnwindSafe for SessionManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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