Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 51 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 automations_v2: Arc<RwLock<HashMap<String, AutomationV2Spec>>>, pub automation_v2_runs: Arc<RwLock<HashMap<String, AutomationV2RunRecord>>>, pub workflow_plans: Arc<RwLock<HashMap<String, WorkflowPlan>>>, pub workflow_plan_drafts: Arc<RwLock<HashMap<String, WorkflowPlanDraftRecord>>>, pub bug_monitor_config: Arc<RwLock<BugMonitorConfig>>, pub bug_monitor_drafts: Arc<RwLock<HashMap<String, BugMonitorDraftRecord>>>, pub bug_monitor_incidents: Arc<RwLock<HashMap<String, BugMonitorIncidentRecord>>>, pub bug_monitor_posts: Arc<RwLock<HashMap<String, BugMonitorPostRecord>>>, pub bug_monitor_runtime_status: Arc<RwLock<BugMonitorRuntimeStatus>>, pub workflows: Arc<RwLock<WorkflowRegistry>>, pub workflow_runs: Arc<RwLock<HashMap<String, WorkflowRunRecord>>>, pub workflow_hook_overrides: Arc<RwLock<HashMap<String, bool>>>, pub workflow_dispatch_seen: Arc<RwLock<HashMap<String, u64>>>, pub routine_session_policies: Arc<RwLock<HashMap<String, RoutineSessionPolicy>>>, pub automation_v2_session_runs: Arc<RwLock<HashMap<String, String>>>, pub token_cost_per_1k_usd: f64, pub routines_path: PathBuf, pub routine_history_path: PathBuf, pub routine_runs_path: PathBuf, pub automations_v2_path: PathBuf, pub automation_v2_runs_path: PathBuf, pub bug_monitor_config_path: PathBuf, pub bug_monitor_drafts_path: PathBuf, pub bug_monitor_incidents_path: PathBuf, pub bug_monitor_posts_path: PathBuf, pub workflow_runs_path: PathBuf, pub workflow_hook_overrides_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, pub pack_manager: Arc<PackManager>, pub capability_resolver: Arc<CapabilityResolver>, pub preset_registry: Arc<PresetRegistry>,
}

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>>>§automations_v2: Arc<RwLock<HashMap<String, AutomationV2Spec>>>§automation_v2_runs: Arc<RwLock<HashMap<String, AutomationV2RunRecord>>>§workflow_plans: Arc<RwLock<HashMap<String, WorkflowPlan>>>§workflow_plan_drafts: Arc<RwLock<HashMap<String, WorkflowPlanDraftRecord>>>§bug_monitor_config: Arc<RwLock<BugMonitorConfig>>§bug_monitor_drafts: Arc<RwLock<HashMap<String, BugMonitorDraftRecord>>>§bug_monitor_incidents: Arc<RwLock<HashMap<String, BugMonitorIncidentRecord>>>§bug_monitor_posts: Arc<RwLock<HashMap<String, BugMonitorPostRecord>>>§bug_monitor_runtime_status: Arc<RwLock<BugMonitorRuntimeStatus>>§workflows: Arc<RwLock<WorkflowRegistry>>§workflow_runs: Arc<RwLock<HashMap<String, WorkflowRunRecord>>>§workflow_hook_overrides: Arc<RwLock<HashMap<String, bool>>>§workflow_dispatch_seen: Arc<RwLock<HashMap<String, u64>>>§routine_session_policies: Arc<RwLock<HashMap<String, RoutineSessionPolicy>>>§automation_v2_session_runs: Arc<RwLock<HashMap<String, String>>>§token_cost_per_1k_usd: f64§routines_path: PathBuf§routine_history_path: PathBuf§routine_runs_path: PathBuf§automations_v2_path: PathBuf§automation_v2_runs_path: PathBuf§bug_monitor_config_path: PathBuf§bug_monitor_drafts_path: PathBuf§bug_monitor_incidents_path: PathBuf§bug_monitor_posts_path: PathBuf§workflow_runs_path: PathBuf§workflow_hook_overrides_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§pack_manager: Arc<PackManager>§capability_resolver: Arc<CapabilityResolver>§preset_registry: Arc<PresetRegistry>

Implementations§

Source§

impl AppState

Source§

impl AppState

Source

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

Source

pub fn is_ready(&self) -> bool

Source

pub async fn wait_until_ready_or_failed( &self, attempts: usize, sleep_ms: u64, ) -> 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>

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub async fn bug_monitor_config(&self) -> BugMonitorConfig

Source

pub async fn put_bug_monitor_config( &self, config: BugMonitorConfig, ) -> Result<BugMonitorConfig>

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub async fn list_bug_monitor_incidents( &self, limit: usize, ) -> Vec<BugMonitorIncidentRecord>

Source

pub async fn get_bug_monitor_incident( &self, incident_id: &str, ) -> Option<BugMonitorIncidentRecord>

Source

pub async fn put_bug_monitor_incident( &self, incident: BugMonitorIncidentRecord, ) -> Result<BugMonitorIncidentRecord>

Source

pub async fn list_bug_monitor_posts( &self, limit: usize, ) -> Vec<BugMonitorPostRecord>

Source

pub async fn get_bug_monitor_post( &self, post_id: &str, ) -> Option<BugMonitorPostRecord>

Source

pub async fn put_bug_monitor_post( &self, post: BugMonitorPostRecord, ) -> Result<BugMonitorPostRecord>

Source

pub async fn update_bug_monitor_runtime_status( &self, update: impl FnOnce(&mut BugMonitorRuntimeStatus), ) -> BugMonitorRuntimeStatus

Source

pub async fn list_bug_monitor_drafts( &self, limit: usize, ) -> Vec<BugMonitorDraftRecord>

Source

pub async fn get_bug_monitor_draft( &self, draft_id: &str, ) -> Option<BugMonitorDraftRecord>

Source

pub async fn put_bug_monitor_draft( &self, draft: BugMonitorDraftRecord, ) -> Result<BugMonitorDraftRecord>

Source

pub async fn submit_bug_monitor_draft( &self, submission: BugMonitorSubmission, ) -> Result<BugMonitorDraftRecord>

Source

pub async fn update_bug_monitor_draft_status( &self, draft_id: &str, next_status: &str, reason: Option<&str>, ) -> Result<BugMonitorDraftRecord>

Source

pub async fn bug_monitor_status(&self) -> BugMonitorStatus

Source

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

Source

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

Source

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

Source

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

Source

pub async fn reload_workflows(&self) -> Result<Vec<WorkflowValidationMessage>>

Source

pub async fn workflow_registry(&self) -> WorkflowRegistry

Source

pub async fn list_workflows(&self) -> Vec<WorkflowSpec>

Source

pub async fn get_workflow(&self, workflow_id: &str) -> Option<WorkflowSpec>

Source

pub async fn list_workflow_hooks( &self, workflow_id: Option<&str>, ) -> Vec<WorkflowHookBinding>

Source

pub async fn set_workflow_hook_enabled( &self, binding_id: &str, enabled: bool, ) -> Result<Option<WorkflowHookBinding>>

Source

pub async fn put_workflow_run(&self, run: WorkflowRunRecord) -> Result<()>

Source

pub async fn update_workflow_run( &self, run_id: &str, update: impl FnOnce(&mut WorkflowRunRecord), ) -> Option<WorkflowRunRecord>

Source

pub async fn list_workflow_runs( &self, workflow_id: Option<&str>, limit: usize, ) -> Vec<WorkflowRunRecord>

Source

pub async fn get_workflow_run(&self, run_id: &str) -> Option<WorkflowRunRecord>

Source

pub async fn put_automation_v2( &self, automation: AutomationV2Spec, ) -> Result<AutomationV2Spec>

Source

pub async fn get_automation_v2( &self, automation_id: &str, ) -> Option<AutomationV2Spec>

Source

pub async fn put_workflow_plan(&self, plan: WorkflowPlan)

Source

pub async fn get_workflow_plan(&self, plan_id: &str) -> Option<WorkflowPlan>

Source

pub async fn put_workflow_plan_draft(&self, draft: WorkflowPlanDraftRecord)

Source

pub async fn get_workflow_plan_draft( &self, plan_id: &str, ) -> Option<WorkflowPlanDraftRecord>

Source

pub async fn list_automations_v2(&self) -> Vec<AutomationV2Spec>

Source

pub async fn delete_automation_v2( &self, automation_id: &str, ) -> Result<Option<AutomationV2Spec>>

Source

pub async fn create_automation_v2_run( &self, automation: &AutomationV2Spec, trigger_type: &str, ) -> Result<AutomationV2RunRecord>

Source

pub async fn get_automation_v2_run( &self, run_id: &str, ) -> Option<AutomationV2RunRecord>

Source

pub async fn list_automation_v2_runs( &self, automation_id: Option<&str>, limit: usize, ) -> Vec<AutomationV2RunRecord>

Source

pub async fn claim_next_queued_automation_v2_run( &self, ) -> Option<AutomationV2RunRecord>

Source

pub async fn update_automation_v2_run( &self, run_id: &str, update: impl FnOnce(&mut AutomationV2RunRecord), ) -> Option<AutomationV2RunRecord>

Source

pub async fn add_automation_v2_session( &self, run_id: &str, session_id: &str, ) -> Option<AutomationV2RunRecord>

Source

pub async fn clear_automation_v2_session( &self, run_id: &str, session_id: &str, ) -> Option<AutomationV2RunRecord>

Source

pub async fn apply_provider_usage_to_runs( &self, session_id: &str, prompt_tokens: u64, completion_tokens: u64, total_tokens: u64, )

Source

pub async fn evaluate_automation_v2_misfires(&self, now_ms: u64) -> Vec<String>

Methods from Deref<Target = RuntimeState>§

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