pub struct Agent {
pub messages: Vec<Message>,
/* private fields */
}Fields§
§messages: Vec<Message>Implementations§
Source§impl Agent
impl Agent
pub fn new(client: ModelClient) -> Self
pub fn with_config(client: ModelClient, config: AgentConfig) -> Self
pub fn default(client: ModelClient) -> Self
Sourcepub fn set_steering_rx(&mut self, rx: UnboundedReceiver<String>)
pub fn set_steering_rx(&mut self, rx: UnboundedReceiver<String>)
Replace the steering receiver on a live agent. This is used by the
TUI to attach a fresh channel before each send() call so that
mid-turn steering can be injected.
pub async fn send(&mut self, prompt: &str) -> Result<String>
Sourcepub async fn send_with_goal(
&mut self,
prompt: &str,
goal_pause_rx: Option<&mut UnboundedReceiver<String>>,
) -> Result<String>
pub async fn send_with_goal( &mut self, prompt: &str, goal_pause_rx: Option<&mut UnboundedReceiver<String>>, ) -> Result<String>
Goal-aware wrapper around send(). After the initial turn
completes, the agent checks the persistent goal store. If the goal
is still Active, it injects a continuation prompt as a system
message (steering, not user input — matching Codex’s
continuation_steering_item) and starts another send() turn
internally.
The TUI sees the agent running longer and receives
GoalContinuation / GoalTurnAccounted / GoalErrorTransition
events for display and accounting.
goal_pause_rx is an optional receiver that the TUI can use to
signal a deferred pause or clear. Values: “pause” or “clear”.
Sourcepub fn last_send_usage(&self) -> &Usage
pub fn last_send_usage(&self) -> &Usage
Returns the cumulative token usage from the most recent send() call.
This is the sum of usage across all model iterations within that call.
pub fn set_event_sink(&mut self, sink: EventSink)
pub fn restore_messages(&mut self, messages: Vec<Message>)
Sourcepub fn lean_resume(&mut self) -> Result<()>
pub fn lean_resume(&mut self) -> Result<()>
Crash-recovery method: flush working memory down to the initial system messages and bootstrap a lean context from externalized state in SQLite.
After calling this the orchestrator retains its system prompt, agents.md, and skills catalog messages, plus a single synthetic system message that summarises the active goal, threads, and worksets so it can resume work without re-reading the full conversation history.
pub fn terminal_manager(&self) -> &TerminalManager
Auto Trait Implementations§
impl !RefUnwindSafe for Agent
impl !UnwindSafe for Agent
impl Freeze for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
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
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>
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>
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)
&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)
&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
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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