pub struct App { /* private fields */ }Expand description
Holds an Oxicode engine (composition root) and a single Agent built
from it. The legacy App::new(settings) constructor is gone;
use App::from_oxicode with a wired Oxicode from
build_oxicode_engine.
Implementations§
Source§impl App
impl App
Sourcepub async fn from_oxicode(
oxicode: Oxicode,
settings: Settings,
ownership_session_id: String,
session_state: Option<SessionState>,
) -> Result<Self>
pub async fn from_oxicode( oxicode: Oxicode, settings: Settings, ownership_session_id: String, session_state: Option<SessionState>, ) -> Result<Self>
Build an App from a wired Oxicode engine and a settings object.
The Oxicode should be created via build_oxicode_engine (or
services::build_oxicode) so that all 11 ports are wired. The
settings hold the user’s runtime configuration (model, thinking
level, etc.).
ownership_session_id is the per-process liveness identity used by
the agent’s issue tool (ToolContext.session_id), the TUI panel,
and the /issue slash command. It must be unique per process in
every mode (tui-<pid>-<uuid> / proc-<pid>-<uuid>) so two parallel
sessions never share one flock name — a shared name silently broke
ownership exclusivity between them.
session_state is the pre-built SessionState passed into the
agent’s with_session_hooks call. When None, fresh state is
constructed (the default for tests and most call sites — bootstrap
constructs it explicitly so the runtime and AgentSession share the
SAME queues + stop flag).
Sourcepub fn ownership_session_id(&self) -> &str
pub fn ownership_session_id(&self) -> &str
Per-process liveness identity. Used by the agent’s issue tool and any
other surface that gates on is_session_alive.
Sourcepub fn has_liveness_lock(&self) -> bool
pub fn has_liveness_lock(&self) -> bool
True iff App holds a live liveness flock under ownership_session_id.
False when there is no issue_store (e.g. headless test) or when another
live process already holds the lock (the assignment feature will surface
Assigned errors in that case — by design).
Sourcepub fn set_wasm_ext(&mut self, ext: Option<Arc<WasmExtensionManager>>)
pub fn set_wasm_ext(&mut self, ext: Option<Arc<WasmExtensionManager>>)
Set the WASM extension manager
Sourcepub fn wasm_ext(&self) -> Option<&Arc<WasmExtensionManager>>
pub fn wasm_ext(&self) -> Option<&Arc<WasmExtensionManager>>
Get the WASM extension manager
Sourcepub fn issue_store(&self) -> Option<FileIssueStore>
pub fn issue_store(&self) -> Option<FileIssueStore>
Get a clone of the local issue store, if one was opened successfully.
Sourcepub fn oxicode(&self) -> &Oxicode
pub fn oxicode(&self) -> &Oxicode
Get a reference to the underlying Oxicode engine. The catalog port and
other ports are accessible through it.
Sourcepub fn catalog(&self) -> Arc<dyn ModelCatalog> ⓘ
pub fn catalog(&self) -> Arc<dyn ModelCatalog> ⓘ
Get a clone of the model catalog port (the canonical provider/model metadata source). Used by the TUI to browse the full catalog in-TUI.
Sourcepub fn agent_tools(&self) -> Arc<ToolRegistry> ⓘ
pub fn agent_tools(&self) -> Arc<ToolRegistry> ⓘ
Get the tool registry (for registering extension tools)
Sourcepub fn ask_bridge(&self) -> Option<&Arc<AskBridge>>
pub fn ask_bridge(&self) -> Option<&Arc<AskBridge>>
Get the ask bridge, if initialized.
Sourcepub fn skills(&self) -> RwLockReadGuard<'_, SkillManager>
pub fn skills(&self) -> RwLockReadGuard<'_, SkillManager>
Get a reference to the skill manager
Sourcepub fn activate_skill(&self, name: &str) -> Result<(), String>
pub fn activate_skill(&self, name: &str) -> Result<(), String>
Activate a skill by name. Returns an error string if not found.
Sourcepub fn deactivate_skill(&self, name: &str)
pub fn deactivate_skill(&self, name: &str)
Deactivate a skill by name.
Sourcepub fn active_skills(&self) -> Vec<String>
pub fn active_skills(&self) -> Vec<String>
List currently active skill names
Sourcepub fn agent_state(&self) -> AgentState
pub fn agent_state(&self) -> AgentState
Get a clone of the current state
Sourcepub async fn run_prompt(&self, prompt: String) -> Result<String>
pub async fn run_prompt(&self, prompt: String) -> Result<String>
Run a single prompt and return the response
Sourcepub async fn run_prompt_with_events<F>(
&self,
prompt: String,
on_event: F,
) -> Result<String>
pub async fn run_prompt_with_events<F>( &self, prompt: String, on_event: F, ) -> Result<String>
Run a prompt with event callback
Sourcepub async fn switch_model(&self, model_id: &str) -> Result<()>
pub async fn switch_model(&self, model_id: &str) -> Result<()>
Switch the model used for future LLM calls.
The new provider is re-credentialed by the SDK resolver via the
wired AuthProvider port; the api_key parameter was removed in
0.55.0 (issues #39/#40).
Sourcepub fn session_state(&self) -> &SessionState
pub fn session_state(&self) -> &SessionState
Borrow the pre-built SessionState (stop flag + steering + follow-up
queues). The runtime clones the Arcs it needs into AgentSession
so the runtime and the agent’s session-level closures share the SAME
state — required for Ctrl+C and /steer to take effect mid-run.
Sourcepub fn should_stop_flag(&self) -> Arc<AtomicBool> ⓘ
pub fn should_stop_flag(&self) -> Arc<AtomicBool> ⓘ
Clone the shared stop flag. Cheap (single Arc bump).
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !UnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnsafeUnpin for App
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
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>
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
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
self file descriptor. Read moreSource§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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
impl<T> MaybeSendSync for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.