Skip to main content

ContextControl

Struct ContextControl 

Source
pub struct ContextControl { /* private fields */ }

Implementations§

Source§

impl ContextControl

Source

pub fn new(branches: Arc<dyn ContextBranches>) -> Self

Source

pub fn with_trim(self, trim: bool) -> Self

Trim old tool results before a threshold compaction (default on; ULTRON_COMPACTION_TRIM=off turns it off).

Source

pub fn state(&self) -> Result<Value, String>

Forgotten, pinned and noted items of the root branch (ctx.state, the /rlm panel).

Source

pub fn handle_request( &self, kind: &str, payload: &Map<String, Value>, lane: &str, ) -> Result<Value, String>

Source§

impl ContextControl

Source

pub fn tool_start(&self, lane: &str, tool_name: &str, tool_call_id: &str)

Harness tool_start: a root rlm cell starts; finished tasks not yet attributed belong to it.

Source

pub fn tool_end(&self, lane: &str, tool_call_id: &str)

Source

pub fn message_end(&self, lane: &str, role: &str) -> Result<(), String>

Harness message_end: once the root model answered after a cell’s output, collapse it.

Source

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

Source

pub fn task_ended(&self, task: &Value, cost: Option<f64>)

A task’s terminal result is durable (NativeTask JSON). Root-level tasks are attributed to the root cell that returns them.

Source

pub fn entry_added(&self, lane: &str, entry: &Value) -> Option<Value>

Harness entry_added: drops a pending copy of the entry; for a context edit, the event observers receive.

Source

pub fn before_compaction( &self, lane: &str, reason: &str, tokens_before: i64, context_window: Option<i64>, reserve_tokens: i64, ) -> Result<bool, String>

Harness before_compaction: for a threshold compaction, trims tool results the model answered after when that brings the estimate under 90% of the threshold; true declines the compaction.

Source

pub fn kept_across_compaction( &self, lane: &str, ) -> Result<Option<String>, String>

Notes and pinned items that the newest compaction cut off, as one bounded text block.

Source

pub fn transform_context( &self, lane: &str, messages: &[Value], ) -> Result<Option<Vec<Value>>, String>

Harness transform_context: after a compaction summary, shows again the notes and pinned items it cut off (only for lanes that used ctx, and the root). None leaves the messages unchanged.

Trait Implementations§

Source§

impl ApiModule for ContextControl

Source§

fn prefixes(&self) -> &[&str]

Source§

fn handle(&self, request: &Request<'_>) -> Result<Value, String>

Source§

fn start(&self, _host: &dyn TaskHost) -> Result<(), String>

Called once before the first request is served.

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