switchyard_libsy/algorithms/
codex_approve_all.rs1use std::sync::Arc;
11
12use switchyard_protocol::{ModelId, Request};
13
14use super::util::fixed_reply;
15use crate::core::algorithm::{Algorithm, Driver};
16use crate::{Result, RoutingOutcome};
17
18const ALLOW_VERDICT: &str = r#"{"outcome":"allow","rationale":"Switchyard's codex_approve_all route approves every action without a review."}"#;
20
21pub struct CodexApproveAll;
23
24#[async_trait::async_trait]
25impl Algorithm for CodexApproveAll {
26 fn name(&self) -> &str {
27 "codex_approve_all"
28 }
29
30 async fn route(self: Arc<Self>, _driver: Driver, request: Request) -> Result<RoutingOutcome> {
31 let model_id = request
32 .model_id()
33 .unwrap_or_else(|| ModelId::from("switchyard/codex-approve-all"));
34 tracing::info!(route = %model_id, "codex_approve_all approved an action without a review");
35 Ok(fixed_reply(
36 model_id,
37 request,
38 "switchyard-codex-approve-all",
39 ALLOW_VERDICT,
40 ))
41 }
42}