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>
This commit is contained in:
55
akode-rs/sandboxing/src/launch.rs
Normal file
55
akode-rs/sandboxing/src/launch.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
//! Bind filesystem and network inputs for sandbox preparation on the execution host.
|
||||
|
||||
use std::io;
|
||||
|
||||
use akode_protocol::models::PermissionProfile;
|
||||
use akode_protocol::permissions::FileSystemPath;
|
||||
use akode_utils_absolute_path::AbsolutePathBuf;
|
||||
use akode_utils_path_uri::PathUri;
|
||||
|
||||
/// The authorized profile, resolved on the host that will enforce it.
|
||||
#[derive(Debug)]
|
||||
pub(super) struct PreparedLaunchPolicy {
|
||||
pub(super) permissions: PermissionProfile,
|
||||
}
|
||||
|
||||
impl PreparedLaunchPolicy {
|
||||
/// An empty workspace list stays empty, even when the policy contains `:workspace_roots`.
|
||||
pub(super) fn resolve(
|
||||
permissions: PermissionProfile,
|
||||
policy_cwd: &PathUri,
|
||||
roots: Option<&[PathUri]>,
|
||||
) -> io::Result<Self> {
|
||||
let Some(roots) = roots else {
|
||||
return Ok(Self { permissions });
|
||||
};
|
||||
native_path(policy_cwd, "sandbox policy cwd")?;
|
||||
let workspace_roots = native_workspace_roots(roots)?;
|
||||
let (file_system, network) = permissions.to_runtime_permissions();
|
||||
for entry in &file_system.entries {
|
||||
if let FileSystemPath::Path { path } = &entry.path {
|
||||
native_path(path, "sandbox permission path")?;
|
||||
}
|
||||
}
|
||||
let file_system =
|
||||
file_system.materialize_project_roots_with_workspace_roots(&workspace_roots);
|
||||
let permissions = PermissionProfile::from_runtime_permissions_with_enforcement(
|
||||
permissions.enforcement(),
|
||||
&file_system,
|
||||
network,
|
||||
);
|
||||
Ok(Self { permissions })
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn native_workspace_roots(roots: &[PathUri]) -> io::Result<Vec<AbsolutePathBuf>> {
|
||||
roots
|
||||
.iter()
|
||||
.map(|root| native_path(root, "sandbox workspace root"))
|
||||
.collect::<io::Result<Vec<_>>>()
|
||||
}
|
||||
|
||||
fn native_path(path: &PathUri, field: &str) -> io::Result<AbsolutePathBuf> {
|
||||
path.to_abs_path()
|
||||
.map_err(|err| io::Error::new(err.kind(), format!("invalid {field}: {err}")))
|
||||
}
|
||||
Reference in New Issue
Block a user