Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 25 fields pub runtime: Arc<OnceLock<RuntimeState>>, pub startup: Arc<RwLock<StartupState>>, pub in_process_mode: Arc<AtomicBool>, pub api_token: Arc<RwLock<Option<String>>>, pub engine_leases: Arc<RwLock<HashMap<String, EngineLease>>>, pub run_registry: RunRegistry, pub run_stale_ms: u64, pub memory_records: Arc<RwLock<HashMap<String, GovernedMemoryRecord>>>, pub memory_audit_log: Arc<RwLock<Vec<MemoryAuditEvent>>>, pub missions: Arc<RwLock<HashMap<String, MissionState>>>, pub shared_resources: Arc<RwLock<HashMap<String, SharedResourceRecord>>>, pub shared_resources_path: PathBuf, pub routines: Arc<RwLock<HashMap<String, RoutineSpec>>>, pub routine_history: Arc<RwLock<HashMap<String, Vec<RoutineHistoryEvent>>>>, pub routine_runs: Arc<RwLock<HashMap<String, RoutineRunRecord>>>, pub routine_session_policies: Arc<RwLock<HashMap<String, RoutineSessionPolicy>>>, pub routines_path: PathBuf, pub routine_history_path: PathBuf, pub routine_runs_path: PathBuf, pub agent_teams: AgentTeamRuntime, pub web_ui_enabled: Arc<AtomicBool>, pub web_ui_prefix: Arc<RwLock<String>>, pub server_base_url: Arc<RwLock<String>>, pub channels_runtime: Arc<Mutex<ChannelRuntime>>, pub host_runtime_context: HostRuntimeContext,
}

Fields§

§runtime: Arc<OnceLock<RuntimeState>>§startup: Arc<RwLock<StartupState>>§in_process_mode: Arc<AtomicBool>§api_token: Arc<RwLock<Option<String>>>§engine_leases: Arc<RwLock<HashMap<String, EngineLease>>>§run_registry: RunRegistry§run_stale_ms: u64§memory_records: Arc<RwLock<HashMap<String, GovernedMemoryRecord>>>§memory_audit_log: Arc<RwLock<Vec<MemoryAuditEvent>>>§missions: Arc<RwLock<HashMap<String, MissionState>>>§shared_resources: Arc<RwLock<HashMap<String, SharedResourceRecord>>>§shared_resources_path: PathBuf§routines: Arc<RwLock<HashMap<String, RoutineSpec>>>§routine_history: Arc<RwLock<HashMap<String, Vec<RoutineHistoryEvent>>>>§routine_runs: Arc<RwLock<HashMap<String, RoutineRunRecord>>>§routine_session_policies: Arc<RwLock<HashMap<String, RoutineSessionPolicy>>>§routines_path: PathBuf§routine_history_path: PathBuf§routine_runs_path: PathBuf§agent_teams: AgentTeamRuntime§web_ui_enabled: Arc<AtomicBool>§web_ui_prefix: Arc<RwLock<String>>§server_base_url: Arc<RwLock<String>>§channels_runtime: Arc<Mutex<ChannelRuntime>>§host_runtime_context: HostRuntimeContext

Implementations§

Source§

impl AppState

Source

pub fn new_starting(attempt_id: String, in_process: bool) -> Self

Source

pub fn is_ready(&self) -> bool

Source

pub fn mode_label(&self) -> &'static str

Source

pub fn configure_web_ui(&self, enabled: bool, prefix: String)

Source

pub fn web_ui_enabled(&self) -> bool

Source

pub fn web_ui_prefix(&self) -> String

Source

pub fn set_server_base_url(&self, base_url: String)

Source

pub fn server_base_url(&self) -> String

Source

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

Source

pub async fn set_api_token(&self, token: Option<String>)

Source

pub async fn startup_snapshot(&self) -> StartupSnapshot

Source

pub fn host_runtime_context(&self) -> HostRuntimeContext

Source

pub async fn set_phase(&self, phase: impl Into<String>)

Source

pub async fn mark_ready(&self, runtime: RuntimeState) -> Result<()>

Source

pub async fn mark_failed( &self, phase: impl Into<String>, error: impl Into<String>, )

Source

pub async fn channel_statuses(&self) -> HashMap<String, ChannelStatus>

Source

pub async fn restart_channel_listeners(&self) -> Result<()>

Source

pub async fn load_shared_resources(&self) -> Result<()>

Source

pub async fn persist_shared_resources(&self) -> Result<()>

Source

pub async fn get_shared_resource( &self, key: &str, ) -> Option<SharedResourceRecord>

Source

pub async fn list_shared_resources( &self, prefix: Option<&str>, limit: usize, ) -> Vec<SharedResourceRecord>

Source

pub async fn put_shared_resource( &self, key: String, value: Value, if_match_rev: Option<u64>, updated_by: String, ttl_ms: Option<u64>, ) -> Result<SharedResourceRecord, ResourceStoreError>

Source

pub async fn delete_shared_resource( &self, key: &str, if_match_rev: Option<u64>, ) -> Result<Option<SharedResourceRecord>, ResourceStoreError>

Source

pub async fn load_routines(&self) -> Result<()>

Source

pub async fn load_routine_history(&self) -> Result<()>

Source

pub async fn load_routine_runs(&self) -> Result<()>

Source

pub async fn persist_routines(&self) -> Result<()>

Source

pub async fn persist_routine_history(&self) -> Result<()>

Source

pub async fn persist_routine_runs(&self) -> Result<()>

Source

pub async fn put_routine( &self, routine: RoutineSpec, ) -> Result<RoutineSpec, RoutineStoreError>

Source

pub async fn list_routines(&self) -> Vec<RoutineSpec>

Source

pub async fn get_routine(&self, routine_id: &str) -> Option<RoutineSpec>

Source

pub async fn delete_routine( &self, routine_id: &str, ) -> Result<Option<RoutineSpec>, RoutineStoreError>

Source

pub async fn evaluate_routine_misfires( &self, now_ms: u64, ) -> Vec<RoutineTriggerPlan>

Source

pub async fn mark_routine_fired( &self, routine_id: &str, fired_at_ms: u64, ) -> Option<RoutineSpec>

Source

pub async fn append_routine_history(&self, event: RoutineHistoryEvent)

Source

pub async fn list_routine_history( &self, routine_id: &str, limit: usize, ) -> Vec<RoutineHistoryEvent>

Source

pub async fn create_routine_run( &self, routine: &RoutineSpec, trigger_type: &str, run_count: u32, status: RoutineRunStatus, detail: Option<String>, ) -> RoutineRunRecord

Source

pub async fn get_routine_run(&self, run_id: &str) -> Option<RoutineRunRecord>

Source

pub async fn list_routine_runs( &self, routine_id: Option<&str>, limit: usize, ) -> Vec<RoutineRunRecord>

Source

pub async fn claim_next_queued_routine_run(&self) -> Option<RoutineRunRecord>

Source

pub async fn set_routine_session_policy( &self, session_id: String, run_id: String, routine_id: String, allowed_tools: Vec<String>, )

Source

pub async fn routine_session_policy( &self, session_id: &str, ) -> Option<RoutineSessionPolicy>

Source

pub async fn clear_routine_session_policy(&self, session_id: &str)

Source

pub async fn update_routine_run_status( &self, run_id: &str, status: RoutineRunStatus, reason: Option<String>, ) -> Option<RoutineRunRecord>

Source

pub async fn append_routine_run_artifact( &self, run_id: &str, artifact: RoutineRunArtifact, ) -> Option<RoutineRunRecord>

Trait Implementations§

Source§

impl Clone for AppState

Source§

fn clone(&self) -> AppState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for AppState

Source§

type Target = RuntimeState

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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: 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: 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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