interplane.Get Omega
Read in your language

sovereign-intelligence

Front door to Drake Stapleton's sovereign stack.

Brought by drakestapleton

branch main Branches Tags History

sovereign-intelligence / docs / archive / drakestapleton.com-old / crates / site-server / src / agent_status.rs

57 lines · 1638 bytes Raw Blame History
1use serde::Deserialize;
2use std::fs;
3use std::path::Path;
4
5#[derive(Deserialize, Debug, Clone)]
6struct Milestone {
7 title: String,
8 #[serde(default)]
9 status: String,
10}
11
12#[derive(Deserialize, Debug, Clone)]
13struct Goal {
14 title: String,
15 #[serde(default)]
16 #[allow(dead_code)]
17 status: String,
18 #[serde(default)]
19 milestones: Vec<Milestone>,
20}
21
22#[derive(Deserialize, Debug, Clone)]
23struct GoalsFile {
24 goals: Vec<Goal>,
25}
26
27pub fn get_active_goal_and_milestone() -> (String, String) {
28 let goals_path = Path::new("/home/drakestapleton/basecamp/goals.json");
29 if let Ok(content) = fs::read_to_string(goals_path) {
30 if let Ok(data) = serde_json::from_str::<GoalsFile>(&content) {
31 for goal in data.goals.iter().rev() {
32 let latest_completed = goal
33 .milestones
34 .iter()
35 .rev()
36 .find(|m| m.status == "completed" || m.status == "done")
37 .map(|m| m.title.clone());
38
39 let active_or_first = goal
40 .milestones
41 .iter()
42 .find(|m| m.status == "in_progress" || m.status == "active")
43 .map(|m| m.title.clone());
44
45 let milestone_str = active_or_first
46 .or(latest_completed)
47 .unwrap_or_else(|| "Milestone in progress".to_string());
48
49 return (goal.title.clone(), milestone_str);
50 }
51 }
52 }
53 (
54 "Autonomous Sovereign Systems".to_string(),
55 "Native Rust Server Execution".to_string(),
56 )
57}