Implement remote execution
build / build-linux-amd64 (push) Successful in 1m58s

This commit is contained in:
2026-05-22 14:18:48 +02:00
parent 475da0e950
commit 6a0b698384
13 changed files with 1188 additions and 4 deletions
+18
View File
@@ -33,3 +33,21 @@ fn serialize(r: &ResolvedStrategy) -> (i64, Value) {
}),
)
}
/// `true` iff the resolved strategy for `peer_id` carries
/// `config_options."enable-remote-exec" = "Y"`. Default is `false` (no
/// strategy assigned, or strategy didn't set the key) — exec is opt-in
/// per the design in docs/AGENT-API-AUTH.md.
pub async fn allows_remote_exec(state: &AppState, peer_id: &str) -> bool {
let resolved = state
.db
.strategy_resolve_for(peer_id)
.await
.unwrap_or_default();
let cfg: Value = serde_json::from_str(&resolved.config_options_json)
.unwrap_or_else(|_| json!({}));
cfg.get("enable-remote-exec")
.and_then(|v| v.as_str())
.map(|s| s.eq_ignore_ascii_case("Y"))
.unwrap_or(false)
}