Skip to main content

Session

Struct Session 

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

Implementations§

Source§

impl Session

Source

pub fn open(root: impl AsRef<Path>) -> Result<Self>

Source

pub fn open_with_redactor( root: impl AsRef<Path>, redactor: Option<Arc<Redactor>>, ) -> Result<Self>

Source

pub fn open_with_context( root: impl AsRef<Path>, redactor: Option<Arc<Redactor>>, project_index: Option<Arc<AnchorIndex>>, ) -> Result<Self>

Source

pub fn open_existing( root: impl AsRef<Path>, sid: &str, ) -> Result<Self, SessionOpenError>

Source

pub fn open_existing_with_redactor( root: impl AsRef<Path>, sid: &str, redactor: Option<Arc<Redactor>>, ) -> Result<Self, SessionOpenError>

Source

pub fn open_existing_with_context( root: impl AsRef<Path>, sid: &str, redactor: Option<Arc<Redactor>>, project_index: Option<Arc<AnchorIndex>>, ) -> Result<Self, SessionOpenError>

Source

pub fn open_ephemeral() -> Self

Source

pub fn project_index(&self) -> Option<Arc<AnchorIndex>>

Source

pub fn approval(&self) -> Arc<ApprovalRegistry>

Source

pub fn compact_reviews(&self) -> Arc<CompactReviewRegistry>

Source

pub fn forms(&self) -> Arc<FormRegistry>

Source

pub fn fs_access_mode(&self) -> Option<FsAccessMode>

Source

pub fn set_fs_access_mode(&self, mode: FsAccessMode)

Source

pub fn compact_review_mode(&self) -> CompactReviewMode

Source

pub fn set_compact_review_mode(&self, mode: CompactReviewMode)

Source

pub fn read_files(&self) -> Arc<Mutex<HashSet<PathBuf>>>

Source

pub fn output_store(&self) -> Arc<OutputStore>

Source

pub fn mark_file_read(&self, path: &Path)

Source

pub fn stream_tx(&self) -> Sender<StreamFrame>

Source

pub fn set_current_root(&self, handle: String)

Source

pub fn current_root(&self) -> Option<String>

Source

pub fn clear_current_root(&self)

Source

pub fn record_successful_flow(&self) -> Option<u64>

Source

pub fn successful_flow_count(&self) -> u64

Source

pub fn stream_subscribe(&self) -> Receiver<StreamFrame>

Source

pub fn id(&self) -> &SessionId

Source

pub fn dir(&self) -> &Path

Source

pub fn transcript_replay(&self) -> Vec<TranscriptEntry>

Source

pub fn events_path(&self) -> Option<PathBuf>

Source

pub async fn plan_system_prompt(&self) -> Option<String>

Source

pub fn goal(&self) -> Option<String>

Source

pub fn subscribe_goal(&self) -> Receiver<Option<String>>

Source

pub fn goal_watch(&self) -> &Sender<Option<String>>

Source

pub fn subscribe_context(&self) -> Receiver<ContextSnapshot>

Source

pub fn subscribe_attach(&self) -> Receiver<usize>

Source

pub fn subscribe_pending_approvals(&self) -> Receiver<Vec<PendingApproval>>

Source

pub fn meta(&self) -> Option<SessionMeta>

Source

pub fn request_manual_compact(&self)

Source

pub fn take_manual_compact_request(&self) -> bool

Source

pub fn set_goal(&self, goal: Option<String>)

Source

pub fn set_attach_count(&self, count: usize)

Source

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>, )

Source

pub fn last_input_tokens(&self) -> u64

Source

pub async fn acquire_compact_lock(&self) -> MutexGuard<'_, ()>

Source

pub async fn acquire_compact_lock_owned(&self) -> OwnedMutexGuard<()>

Source

pub fn compact_lock_handle(&self) -> Arc<Mutex<()>>

Source

pub fn refresh_window_snapshot(&self)

Source

pub fn cumulative_input_tokens(&self) -> u64

Source

pub fn reset_input_tokens_to(&self, tokens: u64)

Source

pub fn last_model(&self) -> String

Source

pub fn set_current_model(&self, model: impl Into<String>)

Source

pub fn update_mcp_server(&self, status: McpServerStatus)

Source

pub fn set_memory_recent_count(&self, count: u16)

Source

pub fn subscribe_todos(&self) -> Receiver<Vec<Todo>>

Source

pub fn todos_watch(&self) -> &Sender<Vec<Todo>>

Source

pub fn subscribe_plans(&self) -> Receiver<Vec<Plan>>

Source

pub fn plans_watch(&self) -> &Sender<Vec<Plan>>

Source

pub async fn refresh_plans_from_store_async(&self)

Source

pub fn refresh_todos_from_store(&self)

Source

pub async fn refresh_todos_from_store_async(&self)

Source

pub fn sink(&self) -> &EventSink

Source

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).

Source

pub fn emit_attachment_degrade( &self, message_seq: u64, part_index: usize, file_basename: String, reason: String, )

Source

pub fn record_attachment_degrade(&self, reason: &str) -> usize

Source

pub fn messages(&self) -> MessageWindow

Source

pub fn messages_full(&self) -> Arc<Vec<Message>>

Source

pub fn messages_handle(&self) -> Arc<Mutex<Vec<Message>>>

Source

pub fn message_count(&self) -> usize

Source

pub fn user_message_count(&self) -> usize

Source

pub fn push_system_note(&self, text: String)

Source

pub fn approval_cooldown_ok_for_compact(&self) -> bool

Source

pub fn emit_compact_warning( &self, model: &str, current_tokens: u64, threshold: u64, budget: u64, reason: &str, )

Source

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.

Source

pub fn commit_rewritten_window( &self, replacement: Vec<Message>, before_tokens: u64, before_window_tokens: u64, rewritten_count: usize, ) -> Option<CompactResult>

Source

pub fn commit_compacted_window( &self, summary: String, replacement: Vec<Message>, range: CompactRange, before_tokens: u64, before_window_tokens: u64, ) -> Option<CompactResult>

Source

pub fn compact_messages( &self, summary: String, range: CompactRange, before_tokens: u64, ) -> Option<CompactResult>

Source

pub fn begin_turn(&self, user_msg: Message) -> TurnId

Source

pub fn mark_streamed(&self)

Source

pub fn take_streamed_flag(&self) -> bool

Source

pub fn end_turn(&self)

Source

pub fn current_turn(&self) -> Option<TurnId>

Source

pub fn enqueue_injection( &self, text: impl Into<String>, ) -> Result<InjectionId, EnqueueError>

Source

pub fn enqueue_injection_with_level( &self, text: impl Into<String>, level: InjectionLevel, redirect_target: Option<String>, ) -> Result<InjectionId, EnqueueError>

Source

pub fn subscribe_injections(&self) -> Receiver<Injection>

Source

pub fn mark_injection_consumed(&self, id: &InjectionId)

Source

pub fn peek_pending_l2_or_higher(&self, turn_id: &TurnId) -> Option<Injection>

Source

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.

Source

pub fn list_pending_injections(&self) -> Vec<Injection>

Source

pub fn cancel_flow(&self)

Source

pub fn flow_cancel_token(&self) -> CancellationToken

Source

pub async fn shutdown(&self)

Source

pub async fn flush_writer(&self)

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> Downcast for T
where T: Any,

Source§

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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more