pub struct Session {
pub turn: TurnState,
pub watch: WatchHub,
pub watch_hub: Arc<WatchHub>,
pub flow_registry: Arc<FlowRegistry>,
pub compaction: CompactionState,
pub interactions: InteractionServices,
/* private fields */
}Fields§
§turn: TurnState§watch: WatchHub§watch_hub: Arc<WatchHub>§flow_registry: Arc<FlowRegistry>§compaction: CompactionState§interactions: InteractionServicesImplementations§
Source§impl Session
impl Session
pub fn open(root: impl AsRef<Path>) -> Result<Self>
pub fn open_with_redactor( root: impl AsRef<Path>, redactor: Option<Arc<Redactor>>, ) -> Result<Self>
pub fn open_with_context( root: impl AsRef<Path>, redactor: Option<Arc<Redactor>>, project_index: Option<Arc<AnchorIndex>>, ) -> Result<Self>
pub fn open_existing( root: impl AsRef<Path>, sid: &str, ) -> Result<Self, SessionOpenError>
pub fn open_existing_with_redactor( root: impl AsRef<Path>, sid: &str, redactor: Option<Arc<Redactor>>, ) -> Result<Self, SessionOpenError>
pub fn open_existing_with_context( root: impl AsRef<Path>, sid: &str, redactor: Option<Arc<Redactor>>, project_index: Option<Arc<AnchorIndex>>, ) -> Result<Self, SessionOpenError>
pub fn open_ephemeral() -> Self
pub fn project_index(&self) -> Option<Arc<AnchorIndex>>
pub fn approval(&self) -> Arc<ApprovalRegistry> ⓘ
pub fn compact_reviews(&self) -> Arc<CompactReviewRegistry> ⓘ
pub fn forms(&self) -> Arc<FormRegistry> ⓘ
pub fn fs_access_mode(&self) -> Option<FsAccessMode>
pub fn set_fs_access_mode(&self, mode: FsAccessMode)
pub fn compact_review_mode(&self) -> CompactReviewMode
pub fn set_compact_review_mode(&self, mode: CompactReviewMode)
pub fn read_files(&self) -> Arc<Mutex<HashSet<PathBuf>>> ⓘ
pub fn output_store(&self) -> Arc<OutputStore> ⓘ
pub fn mark_file_read(&self, path: &Path)
pub fn stream_tx(&self) -> Sender<StreamFrame>
pub fn set_current_root(&self, handle: String)
pub fn current_root(&self) -> Option<String>
pub fn clear_current_root(&self)
pub fn record_successful_flow(&self) -> Option<u64>
pub fn successful_flow_count(&self) -> u64
pub fn stream_subscribe(&self) -> Receiver<StreamFrame>
pub fn id(&self) -> &SessionId
pub fn dir(&self) -> &Path
pub fn transcript_replay(&self) -> Vec<TranscriptEntry>
pub fn events_path(&self) -> Option<PathBuf>
pub async fn plan_system_prompt(&self) -> Option<String>
pub fn goal(&self) -> Option<String>
pub fn subscribe_goal(&self) -> Receiver<Option<String>>
pub fn goal_watch(&self) -> &Sender<Option<String>>
pub fn subscribe_context(&self) -> Receiver<ContextSnapshot>
pub fn subscribe_attach(&self) -> Receiver<usize>
pub fn subscribe_pending_approvals(&self) -> Receiver<Vec<PendingApproval>>
pub fn meta(&self) -> Option<SessionMeta>
pub fn request_manual_compact(&self)
pub fn take_manual_compact_request(&self) -> bool
pub fn set_goal(&self, goal: Option<String>)
pub fn set_attach_count(&self, count: usize)
pub fn record_llm_call( &self, model: &str, tokens_in: u64, tokens_out: u64, cache_read: u64, cache_write: u64, ttft_ms: Option<u64>, tokens_per_sec: Option<f64>, )
pub fn last_input_tokens(&self) -> u64
pub async fn acquire_compact_lock(&self) -> MutexGuard<'_, ()>
pub async fn acquire_compact_lock_owned(&self) -> OwnedMutexGuard<()>
pub fn compact_lock_handle(&self) -> Arc<Mutex<()>> ⓘ
pub fn refresh_window_snapshot(&self)
pub fn cumulative_input_tokens(&self) -> u64
pub fn reset_input_tokens_to(&self, tokens: u64)
pub fn last_model(&self) -> String
pub fn set_current_model(&self, model: impl Into<String>)
pub fn update_mcp_server(&self, status: McpServerStatus)
pub fn set_memory_recent_count(&self, count: u16)
pub fn subscribe_todos(&self) -> Receiver<Vec<Todo>>
pub fn todos_watch(&self) -> &Sender<Vec<Todo>>
pub fn subscribe_plans(&self) -> Receiver<Vec<Plan>>
pub fn plans_watch(&self) -> &Sender<Vec<Plan>>
pub async fn refresh_plans_from_store_async(&self)
pub fn refresh_todos_from_store(&self)
pub async fn refresh_todos_from_store_async(&self)
pub fn sink(&self) -> &EventSink
Sourcepub fn append_message(&self, msg: Message, flow_run_id: Option<FlowRunId>)
pub fn append_message(&self, msg: Message, flow_run_id: Option<FlowRunId>)
Single-writer append. Emits the matching event before the in-memory push so events.jsonl remains the authority (§I5).
pub fn emit_attachment_degrade( &self, message_seq: u64, part_index: usize, file_basename: String, reason: String, )
pub fn record_attachment_degrade(&self, reason: &str) -> usize
pub fn messages(&self) -> MessageWindow
pub fn messages_full(&self) -> Arc<Vec<Message>> ⓘ
pub fn messages_handle(&self) -> Arc<Mutex<Vec<Message>>> ⓘ
pub fn message_count(&self) -> usize
pub fn user_message_count(&self) -> usize
pub fn push_system_note(&self, text: String)
pub fn approval_cooldown_ok_for_compact(&self) -> bool
pub fn emit_compact_warning( &self, model: &str, current_tokens: u64, threshold: u64, budget: u64, reason: &str, )
Sourcepub fn compact_messages_auto(&self, summary: String) -> Option<CompactResult>
pub fn compact_messages_auto(&self, summary: String) -> Option<CompactResult>
Convenience wrapper that computes the compact range and token count from the current message window. Used by tests and internal callers that don’t already have a pre-computed range.
pub fn commit_rewritten_window( &self, replacement: Vec<Message>, before_tokens: u64, before_window_tokens: u64, rewritten_count: usize, ) -> Option<CompactResult>
pub fn commit_compacted_window( &self, summary: String, replacement: Vec<Message>, range: CompactRange, before_tokens: u64, before_window_tokens: u64, ) -> Option<CompactResult>
pub fn compact_messages( &self, summary: String, range: CompactRange, before_tokens: u64, ) -> Option<CompactResult>
pub fn begin_turn(&self, user_msg: Message) -> TurnId
pub fn mark_streamed(&self)
pub fn take_streamed_flag(&self) -> bool
pub fn end_turn(&self)
pub fn current_turn(&self) -> Option<TurnId>
pub fn enqueue_injection( &self, text: impl Into<String>, ) -> Result<InjectionId, EnqueueError>
pub fn enqueue_injection_with_level( &self, text: impl Into<String>, level: InjectionLevel, redirect_target: Option<String>, ) -> Result<InjectionId, EnqueueError>
pub fn subscribe_injections(&self) -> Receiver<Injection>
pub fn mark_injection_consumed(&self, id: &InjectionId)
pub fn peek_pending_l2_or_higher(&self, turn_id: &TurnId) -> Option<Injection>
Sourcepub fn drain_injections(&self, turn_id: &TurnId) -> Vec<Injection>
pub fn drain_injections(&self, turn_id: &TurnId) -> Vec<Injection>
Drain all Pending injections for turn_id. Marks them Injected.
Returns them in creation order.
pub fn list_pending_injections(&self) -> Vec<Injection>
pub fn cancel_flow(&self)
pub fn flow_cancel_token(&self) -> CancellationToken
pub async fn shutdown(&self)
pub async fn flush_writer(&self)
Auto Trait Implementations§
impl !Freeze for Session
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.