Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 81 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 managed_worktrees: Arc<RwLock<HashMap<String, ManagedWorktreeRecord>>>, 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 memory_audit_path: PathBuf, pub protected_audit_path: PathBuf, 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 channel_automation_drafts: Arc<RwLock<HashMap<String, ChannelAutomationDraftRecord>>>, pub automation_governance: Arc<RwLock<GovernanceState>>, pub governance_engine: Arc<dyn GovernancePolicyEngine>, pub automation_v2_runs: Arc<RwLock<HashMap<String, AutomationV2RunRecord>>>, pub automation_scheduler: Arc<RwLock<AutomationScheduler>>, pub automation_scheduler_stopping: Arc<AtomicBool>, pub automations_v2_persistence: Arc<Mutex<()>>, pub workflow_plans: Arc<RwLock<HashMap<String, WorkflowPlan>>>, pub workflow_plan_drafts: Arc<RwLock<HashMap<String, WorkflowPlanDraftRecord>>>, pub workflow_planner_sessions: Arc<RwLock<HashMap<String, WorkflowPlannerSessionRecord>>>, pub workflow_learning_candidates: Arc<RwLock<HashMap<String, WorkflowLearningCandidate>>>, pub optimization_campaigns: Arc<RwLock<HashMap<String, OptimizationCampaignRecord>>>, pub optimization_experiments: Arc<RwLock<HashMap<String, OptimizationExperimentRecord>>>, 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_log_watcher_state_path: PathBuf, pub bug_monitor_log_source_states: Arc<RwLock<HashMap<String, BugMonitorLogSourceState>>>, pub bug_monitor_log_watcher_status: Arc<RwLock<BugMonitorLogWatcherStatus>>, pub bug_monitor_log_evidence_dir: PathBuf, pub bug_monitor_intake_keys: Arc<RwLock<HashMap<String, BugMonitorProjectIntakeKey>>>, pub bug_monitor_intake_keys_path: PathBuf, pub external_actions: Arc<RwLock<HashMap<String, ExternalActionRecord>>>, 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 automation_v2_session_mcp_servers: Arc<RwLock<HashMap<String, Vec<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 channel_automation_drafts_path: PathBuf, pub automation_governance_path: PathBuf, pub automation_v2_runs_path: PathBuf, pub automation_v2_runs_archive_path: PathBuf, pub optimization_campaigns_path: PathBuf, pub optimization_experiments_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 external_actions_path: PathBuf, pub workflow_runs_path: PathBuf, pub workflow_planner_sessions_path: PathBuf, pub workflow_learning_candidates_path: PathBuf, pub context_packs_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>, /* private fields */
}

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>>>§managed_worktrees: Arc<RwLock<HashMap<String, ManagedWorktreeRecord>>>§run_registry: RunRegistry§run_stale_ms: u64§memory_records: Arc<RwLock<HashMap<String, GovernedMemoryRecord>>>§memory_audit_log: Arc<RwLock<Vec<MemoryAuditEvent>>>§memory_audit_path: PathBuf§protected_audit_path: PathBuf§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>>>§channel_automation_drafts: Arc<RwLock<HashMap<String, ChannelAutomationDraftRecord>>>§automation_governance: Arc<RwLock<GovernanceState>>§governance_engine: Arc<dyn GovernancePolicyEngine>§automation_v2_runs: Arc<RwLock<HashMap<String, AutomationV2RunRecord>>>§automation_scheduler: Arc<RwLock<AutomationScheduler>>§automation_scheduler_stopping: Arc<AtomicBool>§automations_v2_persistence: Arc<Mutex<()>>§workflow_plans: Arc<RwLock<HashMap<String, WorkflowPlan>>>§workflow_plan_drafts: Arc<RwLock<HashMap<String, WorkflowPlanDraftRecord>>>§workflow_planner_sessions: Arc<RwLock<HashMap<String, WorkflowPlannerSessionRecord>>>§workflow_learning_candidates: Arc<RwLock<HashMap<String, WorkflowLearningCandidate>>>§optimization_campaigns: Arc<RwLock<HashMap<String, OptimizationCampaignRecord>>>§optimization_experiments: Arc<RwLock<HashMap<String, OptimizationExperimentRecord>>>§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_log_watcher_state_path: PathBuf§bug_monitor_log_source_states: Arc<RwLock<HashMap<String, BugMonitorLogSourceState>>>§bug_monitor_log_watcher_status: Arc<RwLock<BugMonitorLogWatcherStatus>>§bug_monitor_log_evidence_dir: PathBuf§bug_monitor_intake_keys: Arc<RwLock<HashMap<String, BugMonitorProjectIntakeKey>>>§bug_monitor_intake_keys_path: PathBuf§external_actions: Arc<RwLock<HashMap<String, ExternalActionRecord>>>§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>>>§automation_v2_session_mcp_servers: Arc<RwLock<HashMap<String, Vec<String>>>>§token_cost_per_1k_usd: f64§routines_path: PathBuf§routine_history_path: PathBuf§routine_runs_path: PathBuf§automations_v2_path: PathBuf§channel_automation_drafts_path: PathBuf§automation_governance_path: PathBuf§automation_v2_runs_path: PathBuf§automation_v2_runs_archive_path: PathBuf§optimization_campaigns_path: PathBuf§optimization_experiments_path: PathBuf§bug_monitor_config_path: PathBuf§bug_monitor_drafts_path: PathBuf§bug_monitor_incidents_path: PathBuf§bug_monitor_posts_path: PathBuf§external_actions_path: PathBuf§workflow_runs_path: PathBuf§workflow_planner_sessions_path: PathBuf§workflow_learning_candidates_path: PathBuf§context_packs_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

pub fn premium_governance_enabled(&self) -> bool

Source

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

Source

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

Source

pub async fn bootstrap_automation_governance(&self) -> Result<usize>

Source

pub async fn get_automation_governance( &self, automation_id: &str, ) -> Option<AutomationGovernanceRecord>

Source

pub async fn get_or_bootstrap_automation_governance( &self, automation: &AutomationV2Spec, ) -> AutomationGovernanceRecord

Source

pub async fn upsert_automation_governance( &self, record: AutomationGovernanceRecord, ) -> Result<AutomationGovernanceRecord>

Source

pub async fn set_automation_governance_provenance( &self, automation_id: &str, provenance: AutomationProvenanceRecord, ) -> Result<AutomationGovernanceRecord>

Source

pub async fn sync_automation_governance_from_spec( &self, automation: &AutomationV2Spec, provenance: Option<AutomationProvenanceRecord>, ) -> Result<AutomationGovernanceRecord>

Source

pub async fn pause_automation_creation_for_agent( &self, agent_id: &str, paused: bool, ) -> Result<()>

Source

pub async fn can_create_automation_for_actor( &self, actor: &GovernanceActorRef, provenance: &AutomationProvenanceRecord, declared_capabilities: &AutomationDeclaredCapabilities, ) -> Result<(), GovernanceError>

Source

pub async fn can_escalate_declared_capabilities( &self, actor: &GovernanceActorRef, previous: &AutomationDeclaredCapabilities, next: &AutomationDeclaredCapabilities, ) -> Result<(), GovernanceError>

Source

pub async fn can_mutate_automation( &self, automation_id: &str, actor: &GovernanceActorRef, destructive: bool, ) -> Result<AutomationGovernanceRecord, GovernanceError>

Source

pub async fn record_automation_creation( &self, automation: &AutomationV2Spec, provenance: AutomationProvenanceRecord, ) -> Result<AutomationGovernanceRecord>

Source

pub async fn grant_automation_modify_access( &self, automation_id: &str, granted_to: GovernanceActorRef, granted_by: GovernanceActorRef, reason: Option<String>, ) -> Result<AutomationGrantRecord>

Source

pub async fn revoke_automation_modify_access( &self, automation_id: &str, grant_id: &str, revoked_by: GovernanceActorRef, reason: Option<String>, ) -> Result<Option<AutomationGrantRecord>>

Source

pub async fn request_approval( &self, request_type: GovernanceApprovalRequestType, requested_by: GovernanceActorRef, target_resource: GovernanceResourceRef, rationale: String, context: Value, expires_at_ms: Option<u64>, ) -> Result<GovernanceApprovalRequest>

Source

pub async fn list_approval_requests( &self, request_type: Option<GovernanceApprovalRequestType>, status: Option<GovernanceApprovalStatus>, ) -> Vec<GovernanceApprovalRequest>

Source

pub async fn decide_approval_request( &self, approval_id: &str, reviewer: GovernanceActorRef, approved: bool, notes: Option<String>, ) -> Result<Option<GovernanceApprovalRequest>>

Source

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

Source

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

Source

pub async fn agent_spend_summary( &self, agent_id: &str, ) -> Option<AgentSpendSummary>

Source

pub async fn list_agent_spend_summaries(&self) -> Vec<AgentSpendSummary>

Source

pub async fn agent_creation_review_summary( &self, agent_id: &str, ) -> Option<AgentCreationReviewSummary>

Source

pub async fn list_agent_creation_review_summaries( &self, ) -> Vec<AgentCreationReviewSummary>

Source

pub async fn record_agent_creation_review_progress( &self, agent_id: &str, automation_id: &str, ) -> Result<()>

Source

pub async fn acknowledge_agent_creation_review( &self, agent_id: &str, reviewer: GovernanceActorRef, notes: Option<String>, ) -> Result<()>

Source

pub async fn acknowledge_automation_review( &self, automation_id: &str, reviewer: GovernanceActorRef, notes: Option<String>, ) -> Result<Option<AutomationGovernanceRecord>>

Source

pub async fn pause_automation_for_dependency_revocation( &self, automation_id: &str, reason: String, evidence: Value, ) -> Result<()>

Source

pub async fn record_automation_review_progress( &self, automation_id: &str, reason: AutomationLifecycleReviewKind, run_id: Option<String>, detail: Option<String>, ) -> Result<()>

Source

pub async fn run_automation_governance_health_check(&self) -> Result<usize>

Source

pub async fn retire_automation_v2( &self, automation_id: &str, actor: GovernanceActorRef, reason: Option<String>, ) -> Result<Option<AutomationV2Spec>>

Source

pub async fn extend_automation_v2_retirement( &self, automation_id: &str, actor: GovernanceActorRef, expires_at_ms: Option<u64>, reason: Option<String>, ) -> Result<Option<AutomationV2Spec>>

Source

pub async fn record_automation_v2_spend( &self, run_id: &str, prompt_tokens: u64, completion_tokens: u64, total_tokens: u64, delta_cost_usd: f64, ) -> Result<()>

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 archive_stale_automation_v2_runs( &self, retention_days: u64, ) -> Result<usize>

Source

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

Source

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

Source

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

Source

pub async fn persist_optimization_experiments(&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_log_watcher_state(&self) -> Result<()>

Source

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

Source

pub async fn get_bug_monitor_log_source_state( &self, project_id: &str, source_id: &str, ) -> Option<BugMonitorLogSourceState>

Source

pub async fn put_bug_monitor_log_source_state( &self, source_state: BugMonitorLogSourceState, ) -> Result<BugMonitorLogSourceState>

Source

pub async fn update_bug_monitor_log_watcher_status( &self, update: impl FnOnce(&mut BugMonitorLogWatcherStatus), ) -> BugMonitorLogWatcherStatus

Source

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

Source

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

Source

pub async fn list_bug_monitor_intake_keys( &self, ) -> Vec<BugMonitorProjectIntakeKey>

Source

pub async fn put_bug_monitor_intake_key( &self, key: BugMonitorProjectIntakeKey, ) -> Result<BugMonitorProjectIntakeKey>

Source

pub async fn validate_bug_monitor_intake_key( &self, raw_key: &str, project_id: &str, required_scope: &str, ) -> Option<BugMonitorProjectIntakeKey>

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 load_external_actions(&self) -> Result<()>

Source

pub async fn persist_external_actions(&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 delete_bug_monitor_incidents( &self, ids: &[String], ) -> Result<usize>

Source

pub async fn clear_bug_monitor_incidents(&self) -> Result<usize>

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 delete_bug_monitor_posts(&self, ids: &[String]) -> Result<usize>

Source

pub async fn clear_bug_monitor_posts(&self) -> Result<usize>

Source

pub async fn list_external_actions( &self, limit: usize, ) -> Vec<ExternalActionRecord>

Source

pub async fn get_external_action( &self, action_id: &str, ) -> Option<ExternalActionRecord>

Source

pub async fn get_external_action_by_idempotency_key( &self, idempotency_key: &str, ) -> Option<ExternalActionRecord>

Source

pub async fn put_external_action( &self, action: ExternalActionRecord, ) -> Result<ExternalActionRecord>

Source

pub async fn record_external_action( &self, action: ExternalActionRecord, ) -> Result<ExternalActionRecord>

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 delete_bug_monitor_drafts(&self, ids: &[String]) -> Result<usize>

Source

pub async fn clear_bug_monitor_drafts(&self) -> Result<usize>

§

impl AppState

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

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

pub async fn bug_monitor_status_snapshot(&self) -> BugMonitorStatus

pub async fn bug_monitor_status(&self) -> BugMonitorStatus

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

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

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

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

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

pub async fn workflow_registry(&self) -> WorkflowRegistry

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

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

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

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

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

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

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

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

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

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

pub fn automation_v2_runtime_context( &self, run: &AutomationV2RunRecord, ) -> Option<AutomationRuntimeContextMaterialization>

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

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

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

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

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

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

pub async fn put_workflow_planner_session( &self, session: WorkflowPlannerSessionRecord, ) -> Result<WorkflowPlannerSessionRecord>

pub async fn get_workflow_planner_session( &self, session_id: &str, ) -> Option<WorkflowPlannerSessionRecord>

pub async fn list_workflow_planner_sessions( &self, project_slug: Option<&str>, ) -> Vec<WorkflowPlannerSessionRecord>

pub async fn delete_workflow_planner_session( &self, session_id: &str, ) -> Option<WorkflowPlannerSessionRecord>

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

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

pub async fn get_workflow_learning_candidate( &self, candidate_id: &str, ) -> Option<WorkflowLearningCandidate>

pub async fn list_workflow_learning_candidates( &self, workflow_id: Option<&str>, status: Option<WorkflowLearningCandidateStatus>, kind: Option<WorkflowLearningCandidateKind>, ) -> Vec<WorkflowLearningCandidate>

pub async fn put_workflow_learning_candidate( &self, candidate: WorkflowLearningCandidate, ) -> Result<WorkflowLearningCandidate>

pub async fn upsert_workflow_learning_candidate( &self, candidate: WorkflowLearningCandidate, ) -> Result<WorkflowLearningCandidate>

pub async fn update_workflow_learning_candidate( &self, candidate_id: &str, update: impl FnOnce(&mut WorkflowLearningCandidate), ) -> Option<WorkflowLearningCandidate>

pub async fn workflow_learning_metrics_for_workflow( &self, workflow_id: &str, ) -> WorkflowLearningMetricsSnapshot

pub async fn workflow_learning_context_for_automation_node( &self, automation: &AutomationV2Spec, node: &AutomationFlowNode, ) -> (Vec<String>, Option<String>)

pub async fn record_automation_v2_run_learning_usage( &self, run_id: &str, candidate_ids: &[String], ) -> Option<AutomationV2RunRecord>

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

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

pub async fn put_optimization_campaign( &self, campaign: OptimizationCampaignRecord, ) -> Result<OptimizationCampaignRecord>

pub async fn get_optimization_campaign( &self, optimization_id: &str, ) -> Option<OptimizationCampaignRecord>

pub async fn list_optimization_campaigns( &self, ) -> Vec<OptimizationCampaignRecord>

pub async fn put_optimization_experiment( &self, experiment: OptimizationExperimentRecord, ) -> Result<OptimizationExperimentRecord>

pub async fn get_optimization_experiment( &self, optimization_id: &str, experiment_id: &str, ) -> Option<OptimizationExperimentRecord>

pub async fn list_optimization_experiments( &self, optimization_id: &str, ) -> Vec<OptimizationExperimentRecord>

pub async fn count_optimization_experiments( &self, optimization_id: &str, ) -> usize

§

impl AppState

pub async fn apply_optimization_winner( &self, optimization_id: &str, experiment_id: &str, ) -> Result<(OptimizationCampaignRecord, OptimizationExperimentRecord, AutomationV2Spec), String>

pub async fn reconcile_optimization_campaigns(&self) -> Result<usize, String>

pub async fn apply_optimization_action( &self, optimization_id: &str, action: &str, experiment_id: Option<&str>, run_id: Option<&str>, reason: Option<&str>, ) -> Result<OptimizationCampaignRecord, String>

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

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

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

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

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

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

pub async fn reap_stale_running_automation_runs( &self, stale_after_ms: u64, ) -> usize

§

impl AppState

pub async fn recover_in_flight_runs(&self) -> usize

pub async fn auto_resume_stale_reaped_runs(&self) -> usize

pub fn is_automation_scheduler_stopping(&self) -> bool

pub fn set_automation_scheduler_stopping(&self, stopping: bool)

pub async fn fail_running_automation_runs_for_shutdown(&self) -> usize

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

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

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

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

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

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

pub async fn set_automation_v2_session_mcp_servers( &self, session_id: &str, servers: Vec<String>, )

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

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

pub async fn forget_automation_v2_sessions(&self, session_ids: &[String])

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

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

§

impl AppState

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

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

pub async fn evaluate_automation_v2_watches( &self, ) -> Vec<(String, String, Option<HandoffArtifact>)>

Evaluate watch conditions for all active automations and return the IDs of automations whose conditions are met, along with a human-readable trigger reason and the handoff that triggered it (if any).

An automation is skipped if it already has a Queued or Running run (dedup).

pub async fn create_automation_v2_watch_run( &self, automation: &AutomationV2Spec, trigger_reason: String, consumed_handoff_id: Option<String>, ) -> Result<AutomationV2RunRecord>

Create a run triggered by a watch condition, recording the trigger reason and the consumed handoff ID (if any).

pub async fn deposit_automation_v2_handoff( &self, workspace_root: &str, handoff: &HandoffArtifact, handoff_cfg: &AutomationHandoffConfig, ) -> Result<()>

Deposit a handoff artifact into the workspace inbox/ directory. If auto_approve is true (Phase 1 default), the file is immediately moved to approved/ so the downstream watch condition can fire on the next tick.

pub async fn consume_automation_v2_handoff( &self, workspace_root: &str, handoff: &HandoffArtifact, handoff_cfg: &AutomationHandoffConfig, consuming_run_id: &str, consuming_automation_id: &str, ) -> Result<Option<HandoffArtifact>>

Atomically consume a handoff artifact: rename it from approved/ to archived/, stamping the consuming run’s metadata into the file for audit. Returns the updated artifact. This is idempotent — if the file is already gone from approved/, it returns None (race-safe).

pub async fn try_mark_triage_timed_out( &self, draft_id: &str, last_post_error: String, ) -> Result<Option<BugMonitorDraftRecord>>

Atomically transition a Bug Monitor draft to triage_timed_out, returning the updated draft only if WE set the marker. If another concurrent caller got there first, or the draft already has an issue posted, returns Ok(None) and the caller MUST skip the publish step. If the marker was set in memory but persistence failed, returns Err; the caller MUST also skip publish in that case so a marker that didn’t survive a restart can’t produce a duplicate GitHub issue when recovery runs again post-restart.

The check + mutation happens entirely under one write lock so it cannot race with another invocation. Without this, two near-simultaneous status pollers (UI heartbeat or anything else hitting bug_monitor_status) each fire their own recover_overdue_bug_monitor_triage_runs, both see the draft as not-yet-timed-out at read time, both mark it, and both call publish_draft — producing duplicate GitHub issues for the same incident (see issues #45 and #46, 3s apart, same triage_run_id).

Source§

impl AppState

Source§

impl AppState

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