1mod agent_hub;
13mod agents;
14pub mod async_events;
15pub mod auto_compaction;
16pub mod auto_memory;
17pub mod auto_refine;
18mod budget_note;
19mod budget_pricing;
20pub mod cell_file_changes;
21pub mod commands;
22pub mod compaction_op;
23pub mod compose;
24pub mod context_reminder;
25pub mod continuation;
26mod contract_checks;
27pub mod core;
28pub mod durable_store;
29mod format_version;
30pub mod frame_models;
31pub mod frames;
32pub mod guard_log;
33pub mod inspect;
34pub mod journal;
35pub mod kept_contracts;
36pub mod lane;
37mod lane_reuse;
38pub mod local_resources;
39pub mod loki_notice;
40pub mod memory_children;
41pub mod memory_guidance;
42pub mod migration;
43pub mod model_refresh;
44pub mod naming;
45pub mod nudge;
46mod pi_view;
47mod playbook_route;
48mod prompt_budget;
49pub mod recovery;
50pub mod request_keys;
51pub mod request_layer;
52pub mod request_settings;
53pub mod request_trace;
54pub mod review_command;
55pub mod session_diagrams;
56pub mod session_flags;
57mod session_images;
58mod session_judge;
59mod session_knowledge;
60mod session_modules;
61pub mod session_resources;
62pub mod session_stats;
63mod session_tools;
64pub mod situational_skills;
65pub mod startup_trace;
66pub mod stored_auth;
67pub mod subagents;
68pub mod swarm_ops;
69pub mod turn_checkpoints;
70pub mod turns;
71pub mod view;
72pub mod view_images;
73pub mod wake;
74
75use std::path::PathBuf;
76use std::sync::Arc;
77
78pub fn flag_off(value: Option<&str>) -> bool {
81 value.is_some_and(|v| matches!(v.trim().to_lowercase().as_str(), "off" | "0" | "false"))
82}
83
84pub type VarLookup = config::auth::Vars;
85
86#[derive(Clone)]
88pub struct RunEnv {
89 pub cwd: PathBuf,
90 pub home: PathBuf,
91 pub var: VarLookup,
92 pub package: PathBuf,
95}
96
97impl RunEnv {
98 pub fn agent_dir(&self) -> PathBuf {
99 config::paths::agent_dir(|k| (self.var)(k), &self.home)
100 }
101
102 pub fn package_file(&self, relative: &str) -> PathBuf {
104 config::paths::normalize(&self.package.join(relative))
105 }
106
107 pub fn docs(&self) -> PathBuf {
109 self.package_file("docs")
110 }
111
112 pub fn skills(&self) -> PathBuf {
113 self.package_file("skills")
114 }
115
116 pub fn runtime(&self) -> PathBuf {
117 self.package_file(RUNTIME_PY)
118 }
119
120 pub fn flag_off(&self, name: &str) -> bool {
121 flag_off((self.var)(name).as_deref())
122 }
123
124 pub fn process(cwd: PathBuf, package: PathBuf) -> RunEnv {
125 RunEnv {
126 cwd,
127 home: std::env::var_os("HOME").map(PathBuf::from).unwrap_or_default(),
128 var: Arc::new(|k| std::env::var(k).ok()),
129 package,
130 }
131 }
132}
133
134pub const RUNTIME_PY: &str = "src/ultron/rlm/runtime.py";
136
137#[derive(Clone, Debug, Default, PartialEq)]
139pub struct ModelFlags {
140 pub provider: Option<String>,
141 pub model: Option<String>,
142 pub api_key: Option<String>,
143 pub thinking: Option<String>,
144 pub models: Option<Vec<String>>,
146}