Skip to main content

Stack

Struct Stack 

Source
pub struct Stack {
Show 21 fields pub host: Arc<Host>, pub delegation: Delegation, pub lanes: Lanes, pub events: Arc<RuntimeEvents>, pub cell_progress: Arc<Mutex<Option<CellProgress>>>, pub agents: Agents, pub usage: UsageLedger, pub frames: Arc<FrameSession>, pub schedules: Arc<SchedulesModule>, pub goal: Arc<GoalDriver>, pub work: OnceLock<DurableWork>, pub context: OnceLock<Arc<ContextControl>>, pub images: Arc<ViewImages>, pub swarm: OnceLock<Arc<SwarmOps>>, pub budget_note: Arc<OnceLock<Arc<dyn Fn(&str) -> Option<String> + Send + Sync>>>, pub request_layer: Arc<OnceLock<RequestLayer>>, pub context_reminders: Arc<ContextReminders>, pub lane_steer: Arc<OnceLock<Arc<dyn Fn(&str, &str) -> bool + Send + Sync>>>, pub stats: Arc<SessionStats>, pub wake: RootWake, pub ledger: Ledger, /* private fields */
}
Expand description

One session’s host stack: the sandboxed host, the REPL lanes, the subagent host and the kernel-API modules.

Fields§

§host: Arc<Host>§delegation: Delegation§lanes: Lanes§events: Arc<RuntimeEvents>§cell_progress: Arc<Mutex<Option<CellProgress>>>

The durable progress of the root lane’s running cell: what its shell operations print is its partial output, kept if the worker dies before the cell ends.

§agents: Agents

The typed-agent host (agents.*, background.*, workflows.run) and its usage ledger.

§usage: UsageLedger§frames: Arc<FrameSession>

The session’s bounded-inference frames (rlm.infer, rlm.map, rlm.frames): budgets, traces, tasks.

§schedules: Arc<SchedulesModule>

schedules.* and the session goal (goal.*, /goal), on the root lane.

§goal: Arc<GoalDriver>§work: OnceLock<DurableWork>

Schedules, the goal and shell jobs as durable work: recovered when the stack opens, its tick running.

§context: OnceLock<Arc<ContextControl>>

Model-owned context of every lane (ctx.*; collapse on return on the root), once the session actor opened it.

§images: Arc<ViewImages>

The images each lane’s running cell attached with view_image, and the model each lane’s results go to.

§swarm: OnceLock<Arc<SwarmOps>>

swarm.*, board.*, notes.* and persistent children, once the session actor opened the durable runtime.

§budget_note: Arc<OnceLock<Arc<dyn Fn(&str) -> Option<String> + Send + Sync>>>

The budget line every lane’s cell results end with, once the session actor wired it (crate::budget_note).

§request_layer: Arc<OnceLock<RequestLayer>>

A layer over every lane’s host requests, set by a composition root whose root is not the session actor’s (crate::request_layer); none: requests pass through.

§context_reminders: Arc<ContextReminders>

The context-pressure reminder every lane’s cell results may end with (crate::context_reminder): each lane’s limit and, once the session actor wired it, the meter of its context use.

§lane_steer: Arc<OnceLock<Arc<dyn Fn(&str, &str) -> bool + Send + Sync>>>

Steering into a child lane’s running conversation (crate::agent_hub), once the session actor wired it.

§stats: Arc<SessionStats>

The session’s runtime counters (crate::session_stats), for /usage.

§wake: RootWake

Whether the host wakes the root lane when its work ends (crate::wake): set by the composer that drives the root; every other lane waits in its cell.

§ledger: Ledger

The session’s refinements ledger (crate::auto_refine proposes into it and delivers from it).

Implementations§

Source§

impl Stack

Source

pub fn record_judge_rows_in(&self, session: SharedSession)

judge.decide records its calls as usage rows of session: for a composer whose modules keep no session values (an ultron claude server); a native session’s go to its values already.

Source

pub fn memory(&self) -> Option<&MemoryService>

memory.*’s service, when memory is on (crate::auto_memory recalls and keeps through it).

Source

pub fn prompt_schedules(&self) -> &Arc<ScheduleModule> ⓘ

schedule.*: the session’s scheduled prompts (fired by the server through the session actor).

Source

pub fn pool_stats(&self) -> Value

poolStats() as the worker answers an inspected rlm.pool: the lanes’ kernel pool, plus the session’s file-hook guard statistics (guards) when it has guards.

Source

pub fn guard_stats(&self) -> Vec<Value>

fileHooks.stats() over the whole session: the session host’s guards, with the same guards of every worktree subagent’s host (live or ended) added in.

Source

pub fn begin_turn(&self)

A new root turn began (fileHooks.beginTurn()): every host’s per-turn guard times start from zero.

Source

pub fn cell_handler( &self, lane: &str, cell: Option<(Signal, Park)>, ) -> Arc<dyn HostHandler> ⓘ

The handler lane’s requests go to (outermost layer first). cell: the cell’s wait signal and park callback (subagent waits end with the cell); none for requests outside a cell.

Source

pub fn rlm(&self, lane: &str) -> Result<Rlm, String>

The rlm tool over lane (opened when needed).

Source

pub fn commands(&self) -> Vec<Value>

listCommands: /mcp, /review, prompt templates and skills (crate::commands).

Source

pub fn prompt_templates(&self) -> Vec<PromptTemplate>

The session’s prompt templates, the ones Stack::commands lists as /name commands.

Source

pub fn model(&self) -> &Model

The model the session’s lanes run on unless told otherwise.

Source

pub fn root_model(&self) -> Model

Source

pub fn set_root_model(&self, model: &Model)

The root lane switched to model (set_model, cycle_model): frames, the predict adapter and the root’s view_image follow it.

Source

pub fn keys(&self) -> &Keys

The key of each request’s provider, resolved when it is sent.

Source

pub fn system(&self) -> String

The root lane’s system prompt, in the settings’ current mode.

Source

pub fn child_system(&self, model: &Model) -> String

The system prompt of a subagent lane on model (crate::wake: its runtime guide says to await before replying; crate::memory_guidance: a model cheaper than the root’s is told how to use memory too).

Source

pub fn hand_over(&self)

As Stack::close, for a worker whose session a successor worker takes over: running shell jobs keep running, journaled as running, for the successor to follow (DurableWork::hand_over), and subagents are not cancelled: their tasks stay unfinished in the journal, so the successor reattaches them as after a crash.

Source

pub fn close(&self)

Stop the session’s lanes and subagents, and its durable work (the tick, goal jobs, shell jobs).

Source

pub fn cell_hints(&self) -> &Arc<CellHints> ⓘ

The session’s situational hints (ULTRON_HINTS).

Source

pub fn mcp(&self) -> &Arc<Gateway> ⓘ

The session’s MCP gateway (/mcp, and the REPL’s mcp namespace through tools.*).

Source

pub fn tool_calls(&self) -> &Arc<ToolCalls> ⓘ

The session’s REPL tool calls (tools.*).

Source

pub fn mask(&self) -> MaskText

The session’s masking of text that reaches the model (see session_mask).

Auto Trait Implementations§

§

impl !Freeze for Stack

§

impl !RefUnwindSafe for Stack

§

impl !UnwindSafe for Stack

§

impl Forget for Stack

§

impl Move for Stack

§

impl Send for Stack

§

impl Sync for Stack

§

impl Unpin for Stack

§

impl UnsafeUnpin for Stack

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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