diff --git a/desktop/src-tauri/src/commands/agents.rs b/desktop/src-tauri/src/commands/agents.rs index 2446d6469b..7b153be179 100644 --- a/desktop/src-tauri/src/commands/agents.rs +++ b/desktop/src-tauri/src/commands/agents.rs @@ -1,5 +1,5 @@ use nostr::{Keys, ToBech32}; -use tauri::{AppHandle, State}; +use tauri::{AppHandle, Manager, State}; use super::managed_agent_definition::validate_create_definition; @@ -352,7 +352,7 @@ where crate::managed_agents::runtime_configurations::check_selection( record, Some(&launch_owner), - launch_relay.as_str(), + workspace_relay_url.as_str(), configuration.as_ref(), )?; } diff --git a/desktop/src-tauri/src/managed_agents/mod.rs b/desktop/src-tauri/src/managed_agents/mod.rs index 65857b9643..5a21de30c5 100644 --- a/desktop/src-tauri/src/managed_agents/mod.rs +++ b/desktop/src-tauri/src/managed_agents/mod.rs @@ -110,8 +110,8 @@ pub use runtime::*; pub use runtime_commands::*; pub use runtime_types::*; pub(crate) use session_policy::{ - acp_session_policy, apply_app_acp_session_policy_env, insert_acp_session_policy_env, - AcpSessionPolicy, ManagedAgentExperimentState, ACP_SESSION_POLICY_ENV_VAR, + acp_session_policy, insert_acp_session_policy_env, AcpSessionPolicy, + ManagedAgentExperimentState, ACP_SESSION_POLICY_ENV_VAR, }; pub use storage::*; pub use teams::*; diff --git a/desktop/src-tauri/src/managed_agents/session_policy.rs b/desktop/src-tauri/src/managed_agents/session_policy.rs index 63d271a0b6..fe4251761b 100644 --- a/desktop/src-tauri/src/managed_agents/session_policy.rs +++ b/desktop/src-tauri/src/managed_agents/session_policy.rs @@ -3,8 +3,6 @@ use std::{ sync::atomic::{AtomicBool, Ordering}, }; -use tauri::{AppHandle, Manager}; - use crate::app_state::AppState; pub(crate) const ACP_SESSION_POLICY_ENV_VAR: &str = "BUZZ_ACP_SESSION_POLICY"; @@ -69,25 +67,6 @@ pub(crate) fn acp_session_policy(state: &AppState) -> AcpSessionPolicy { ) } -pub(crate) fn apply_acp_session_policy_env( - command: &mut std::process::Command, - policy: AcpSessionPolicy, -) { - command.env(ACP_SESSION_POLICY_ENV_VAR, policy.as_str()); -} - -/// Resolve the effective policy, apply it to `command`, and return it so the -/// caller can stamp the same value onto the spawn snapshot (env and badge can -/// never disagree about what the child launched with). -pub(crate) fn apply_app_acp_session_policy_env( - app: &AppHandle, - command: &mut std::process::Command, -) -> AcpSessionPolicy { - let policy = acp_session_policy(app.state::().inner()); - apply_acp_session_policy_env(command, policy); - policy -} - pub(crate) fn insert_acp_session_policy_env( policy_env: &mut BTreeMap, policy: AcpSessionPolicy, @@ -133,7 +112,9 @@ mod tests { let mut command = std::process::Command::new("true"); command.env(ACP_SESSION_POLICY_ENV_VAR, "ambient"); - apply_acp_session_policy_env(&mut command, AcpSessionPolicy::Thread); + let mut prepared_env = BTreeMap::new(); + insert_acp_session_policy_env(&mut prepared_env, AcpSessionPolicy::Thread); + command.envs(&prepared_env); assert_eq!(command_policy(&command), Some("thread")); } diff --git a/desktop/src-tauri/src/managed_agents/storage.rs b/desktop/src-tauri/src/managed_agents/storage.rs index 2eb01b5ed3..693fb302c2 100644 --- a/desktop/src-tauri/src/managed_agents/storage.rs +++ b/desktop/src-tauri/src/managed_agents/storage.rs @@ -82,7 +82,11 @@ fn is_safe_id_char(c: char) -> bool { c.is_ascii_alphanumeric() || c == '-' || c == '_' } -pub fn managed_agent_log_path(app: &AppHandle, pubkey: &str) -> Result { +/// Legacy per-agent log path, also available to isolated runtime fixtures. +pub fn managed_agent_log_path( + app: &AppHandle, + pubkey: &str, +) -> Result { Ok(managed_agents_logs_dir(app)?.join(format!("{pubkey}.log"))) }