Skip to main content

wraith_runtime/
bootstrap.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum BootstrapPhase {
3    CliEntry,
4    FastPathVersion,
5    StartupProfiler,
6    SystemPromptFastPath,
7    ChromeMcpFastPath,
8    DaemonWorkerFastPath,
9    BridgeFastPath,
10    DaemonFastPath,
11    BackgroundSessionFastPath,
12    TemplateFastPath,
13    EnvironmentRunnerFastPath,
14    MainRuntime,
15}
16
17#[derive(Debug, Clone, PartialEq, Eq)]
18pub struct BootstrapPlan {
19    phases: Vec<BootstrapPhase>,
20}
21
22impl BootstrapPlan {
23    #[must_use]
24    pub fn wraith_default() -> Self {
25        Self::from_phases(vec![
26            BootstrapPhase::CliEntry,
27            BootstrapPhase::FastPathVersion,
28            BootstrapPhase::StartupProfiler,
29            BootstrapPhase::SystemPromptFastPath,
30            BootstrapPhase::ChromeMcpFastPath,
31            BootstrapPhase::DaemonWorkerFastPath,
32            BootstrapPhase::BridgeFastPath,
33            BootstrapPhase::DaemonFastPath,
34            BootstrapPhase::BackgroundSessionFastPath,
35            BootstrapPhase::TemplateFastPath,
36            BootstrapPhase::EnvironmentRunnerFastPath,
37            BootstrapPhase::MainRuntime,
38        ])
39    }
40
41    #[must_use]
42    pub fn from_phases(phases: Vec<BootstrapPhase>) -> Self {
43        let mut deduped = Vec::new();
44        for phase in phases {
45            if !deduped.contains(&phase) {
46                deduped.push(phase);
47            }
48        }
49        Self { phases: deduped }
50    }
51
52    #[must_use]
53    pub fn phases(&self) -> &[BootstrapPhase] {
54        &self.phases
55    }
56}