Files
imeai-aKode/akode-rs/exec-server/src/sandbox_selection.rs
andrea.difonzo 7c1c6dfa8d Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
  nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 12:37:52 +01:00

47 lines
1.9 KiB
Rust

//! Resolves local sandbox implementations and checks support for an explicitly selected remote MXC.
use akode_file_system::FileSystemSandboxContext;
use akode_file_system::WindowsSandboxSelection;
use akode_protocol::config_types::WindowsSandboxLevel;
use akode_protocol::models::PermissionProfile;
use akode_sandboxing::SandboxManager;
use akode_sandboxing::SandboxType;
use akode_sandboxing::SandboxablePreference;
pub(crate) fn validate_remote_mxc(info: &crate::EnvironmentInfo) -> std::io::Result<()> {
if !info.capabilities.windows_mxc {
return Err(std::io::Error::new(
std::io::ErrorKind::Unsupported,
"exec-server does not support the requested MXC Windows sandbox; update the executor",
));
}
Ok(())
}
pub(crate) fn select_sandbox(
manager: &SandboxManager,
permission_profile: &PermissionProfile,
sandbox_context: &FileSystemSandboxContext,
has_managed_network_requirements: bool,
) -> (SandboxType, Option<WindowsSandboxLevel>) {
let windows_sandbox_level = match sandbox_context.windows_sandbox_selection {
WindowsSandboxSelection::Disabled => WindowsSandboxLevel::Disabled,
WindowsSandboxSelection::RestrictedToken => WindowsSandboxLevel::RestrictedToken,
WindowsSandboxSelection::Elevated => WindowsSandboxLevel::Elevated,
WindowsSandboxSelection::Mxc => return (SandboxType::WindowsMxc, None),
};
let windows_sandbox_type = match windows_sandbox_level {
WindowsSandboxLevel::Disabled => SandboxType::None,
WindowsSandboxLevel::RestrictedToken | WindowsSandboxLevel::Elevated => {
SandboxType::WindowsRestrictedToken
}
};
let sandbox_type = manager.select_initial(
permission_profile,
SandboxablePreference::Require,
windows_sandbox_type,
has_managed_network_requirements,
);
(sandbox_type, Some(windows_sandbox_level))
}