Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T05:00:06.562Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

draft.rs

105 lines · 3.0 KB · rust
1//! Pure launcher draft validation (shared by GPUI and tests).
2
3pub const FULL_AUTO_ACTIVE_LIMIT: usize = 8;
4pub const FULL_AUTO_WORKSPACE_REF: &str = "workspace.omega.supervised";
5pub const DEFAULT_TURN_CAP: u32 = 40;
6pub const DEFAULT_DONE_CONDITION: &str =
7    "The outcome works in the real system and the named verification passes.";
8
9#[derive(Debug, Clone)]
10pub struct FullAutoLauncherDraft {
11    pub title: String,
12    pub objective: String,
13    pub done_condition: String,
14    pub workspace_ref: String,
15    pub lane: String,
16    pub model: String,
17    pub turn_cap_text: String,
18    pub max_wall_clock_minutes_text: String,
19    pub fallback_lanes: Vec<String>,
20    pub submitting: bool,
21    pub error: Option<String>,
22    pub advanced_open: bool,
23}
24
25impl Default for FullAutoLauncherDraft {
26    fn default() -> Self {
27        Self {
28            title: String::new(),
29            objective: String::new(),
30            done_condition: String::new(),
31            workspace_ref: FULL_AUTO_WORKSPACE_REF.to_string(),
32            lane: "codex-local".to_string(),
33            model: String::new(),
34            turn_cap_text: DEFAULT_TURN_CAP.to_string(),
35            max_wall_clock_minutes_text: String::new(),
36            fallback_lanes: Vec::new(),
37            submitting: false,
38            error: None,
39            advanced_open: false,
40        }
41    }
42}
43
44#[derive(Debug, Clone, PartialEq, Eq)]
45pub struct LauncherValidation {
46    pub ok: bool,
47    pub message: Option<String>,
48    pub title: String,
49    pub objective: String,
50    pub done_condition: String,
51    pub turn_cap: u32,
52}
53
54pub fn validate_launcher_draft(draft: &FullAutoLauncherDraft) -> LauncherValidation {
55    let objective = draft.objective.trim().to_string();
56    if objective.is_empty() {
57        return LauncherValidation {
58            ok: false,
59            message: Some("Describe the outcome Full Auto should accomplish.".into()),
60            title: String::new(),
61            objective,
62            done_condition: String::new(),
63            turn_cap: DEFAULT_TURN_CAP,
64        };
65    }
66    let done_condition = {
67        let trimmed = draft.done_condition.trim();
68        if trimmed.is_empty() {
69            DEFAULT_DONE_CONDITION.to_string()
70        } else {
71            trimmed.to_string()
72        }
73    };
74    let title = {
75        let trimmed = draft.title.trim();
76        if trimmed.is_empty() {
77            objective
78                .lines()
79                .next()
80                .unwrap_or("Full Auto run")
81                .chars()
82                .take(80)
83                .collect()
84        } else {
85            trimmed.to_string()
86        }
87    };
88    let turn_cap = draft
89        .turn_cap_text
90        .trim()
91        .parse::<u32>()
92        .ok()
93        .filter(|value| *value > 0 && *value <= 1000)
94        .unwrap_or(DEFAULT_TURN_CAP);
95
96    LauncherValidation {
97        ok: true,
98        message: None,
99        title,
100        objective,
101        done_condition,
102        turn_cap,
103    }
104}
105
Served at tenant.openagents/omega Member data and write actions are omitted.