MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / settings_payload

Function settings_payload

src/dashboard/settings_api.rs:149–204  ·  view source on GitHub ↗
(state: &DashboardState)

Source from the content-addressed store, hash-verified

147}
148
149async fn settings_payload(state: &DashboardState) -> std::result::Result<Value, JsonError> {
150 let project_config = load_config(&state.project_root).map_err(|err| internal_error(&err))?;
151 let project_config_path = crate::config::get_config_path(&state.project_root);
152 let user = UserConfig::load();
153 let user_config_path = user_config::config_path()
154 .map(|path| path.display().to_string())
155 .unwrap_or_default();
156
157 let global_automation = user.automation.clone();
158 let project_automation = automation_config::load_project_config(&state.dashboard_root)
159 .await
160 .ok()
161 .flatten();
162 let automation =
163 automation_config::effective_config(&global_automation, project_automation.as_ref())
164 .unwrap_or(global_automation);
165
166 Ok(json!({
167 "project": {
168 "config_path": project_config_path.display().to_string(),
169 "config": project_config,
170 "tracedecay_dir_gitignored": crate::config::is_in_gitignore(&state.project_root),
171 },
172 "user": {
173 "config_path": user_config_path,
174 "upload_enabled": user.upload_enabled,
175 "watcher_debounce": user.watcher_debounce,
176 "extraction_timeout_secs": user.extraction_timeout_secs,
177 "installed_agents": user.installed_agents,
178 },
179 "automation": {
180 "config_endpoint": AUTOMATION_CONFIG_ENDPOINT,
181 "enabled": automation.enabled,
182 "backend": automation.backend,
183 "host_mode": automation.host_mode,
184 },
185 "environment": environment_payload(),
186 "storage": {
187 "project_id": state.project_id,
188 "project_root": state.project_root.display().to_string(),
189 "storage_mode": state.storage_mode,
190 "store_root": state.store_root.display().to_string(),
191 "dashboard_root": state.dashboard_root.display().to_string(),
192 "graph_db": state.graph_db_path,
193 "memory_db": state.mem_db_path,
194 "lcm_db": state.lcm_db_path,
195 "lcm_scope": state.lcm_scope,
196 "savings_db": state.savings_db_path,
197 },
198 "version": {
199 "version": env!("CARGO_PKG_VERSION"),
200 "channel": if crate::cloud::is_beta() { "beta" } else { "stable" },
201 "cached_latest_version": non_empty(&user.cached_latest_version),
202 },
203 }))
204}
205
206fn environment_payload() -> Value {

Callers 3

get_settingsFunction · 0.85
patch_project_settingsFunction · 0.85
patch_user_settingsFunction · 0.85

Calls 7

load_configFunction · 0.85
get_config_pathFunction · 0.85
config_pathFunction · 0.85
load_project_configFunction · 0.85
effective_configFunction · 0.85
internal_errorFunction · 0.70
loadFunction · 0.70

Tested by

no test coverage detected