pub struct AgentSession {
pub agent: Agent,
pub session: Arc<Mutex<Session>>,
pub extensions: Option<ExtensionRegion>,
/* private fields */
}Fields§
§agent: Agent§session: Arc<Mutex<Session>>§extensions: Option<ExtensionRegion>Extension lifecycle region — ensures the JS runtime thread is shut down when the session ends.
Implementations§
Source§impl AgentSession
impl AgentSession
pub const fn runtime_repair_mode_from_policy_mode( mode: RepairPolicyMode, ) -> RepairMode
pub fn new( agent: Agent, session: Arc<Mutex<Session>>, save_enabled: bool, compaction_settings: ResolvedCompactionSettings, ) -> Self
pub fn with_model_registry(self, registry: ModelRegistry) -> Self
pub fn with_auth_storage(self, auth: AuthStorage) -> Self
pub fn set_model_registry(&mut self, registry: ModelRegistry)
pub fn set_auth_storage(&mut self, auth: AuthStorage)
pub async fn set_provider_model( &mut self, provider_id: &str, model_id: &str, ) -> Result<()>
pub const fn save_enabled(&self) -> bool
Sourcepub async fn compact_now(
&mut self,
on_event: impl Fn(AgentEvent) + Send + Sync + 'static,
) -> Result<()>
pub async fn compact_now( &mut self, on_event: impl Fn(AgentEvent) + Send + Sync + 'static, ) -> Result<()>
Force-run compaction synchronously (used by /compact slash command).
pub async fn enable_extensions( &mut self, enabled_tools: &[&str], cwd: &Path, config: Option<&Config>, extension_entries: &[PathBuf], ) -> Result<()>
pub async fn enable_extensions_with_policy( &mut self, enabled_tools: &[&str], cwd: &Path, config: Option<&Config>, extension_entries: &[PathBuf], policy: Option<ExtensionPolicy>, repair_policy: Option<RepairPolicyMode>, pre_warmed: Option<PreWarmedExtensionRuntime>, ) -> Result<()>
pub async fn save_and_index(&mut self) -> Result<()>
pub async fn persist_session(&mut self) -> Result<()>
pub async fn run_text( &mut self, input: String, on_event: impl Fn(AgentEvent) + Send + Sync + 'static, ) -> Result<AssistantMessage>
pub async fn run_text_with_abort( &mut self, input: String, abort: Option<AbortSignal>, on_event: impl Fn(AgentEvent) + Send + Sync + 'static, ) -> Result<AssistantMessage>
pub async fn run_with_content( &mut self, content: Vec<ContentBlock>, on_event: impl Fn(AgentEvent) + Send + Sync + 'static, ) -> Result<AssistantMessage>
pub async fn run_with_content_with_abort( &mut self, content: Vec<ContentBlock>, abort: Option<AbortSignal>, on_event: impl Fn(AgentEvent) + Send + Sync + 'static, ) -> Result<AssistantMessage>
Auto Trait Implementations§
impl !Freeze for AgentSession
impl !RefUnwindSafe for AgentSession
impl Send for AgentSession
impl Sync for AgentSession
impl Unpin for AgentSession
impl UnsafeUnpin for AgentSession
impl !UnwindSafe for AgentSession
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
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