aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
35
akode-rs/hooks/src/environment.rs
Normal file
35
akode-rs/hooks/src/environment.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
//! Owner-admitted hooks bound to the exact environment that supplied them.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
|
||||
use akode_protocol::hooks::HookEventsToml;
|
||||
use akode_utils_path_uri::PathUri;
|
||||
use futures::future::BoxFuture;
|
||||
|
||||
/// An admitted requirements source. The owner must not populate this from user configuration.
|
||||
pub struct EnvironmentHookSource {
|
||||
pub environment_id: String,
|
||||
/// Working directory from the same captured environment used for execution.
|
||||
pub cwd: PathUri,
|
||||
pub hooks: HookEventsToml,
|
||||
}
|
||||
|
||||
/// Executes commands in ready environments without coupling the hooks engine to core or transports.
|
||||
/// Implementations must honor the timeout, terminate timed-out processes, and bound captured output.
|
||||
pub trait HookEnvironmentExecutor: Send + Sync {
|
||||
fn execute(
|
||||
&self,
|
||||
environment_id: &str,
|
||||
command: &str,
|
||||
env: &HashMap<String, String>,
|
||||
input_json: &str,
|
||||
timeout: Duration,
|
||||
) -> BoxFuture<'_, anyhow::Result<EnvironmentHookOutput>>;
|
||||
}
|
||||
|
||||
pub struct EnvironmentHookOutput {
|
||||
pub exit_code: i32,
|
||||
pub stdout: String,
|
||||
pub stderr: String,
|
||||
}
|
||||
Reference in New Issue
Block a user