agent_sdk_toolkit/shell/types.rs
1//! Concrete shell tool helpers layered over core policy and effect contracts. Use
2//! these modules only behind host approval, sandbox, timeout, and network policy.
3//! Execution starts host processes; request and policy types are data-only. This file
4//! contains the types portion of that contract.
5//!
6use std::path::PathBuf;
7
8use serde::{Deserialize, Serialize};
9
10#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
11/// Shell shell request request or result value.
12/// Creating the value does not spawn a process; shell executors document policy checks and command side effects.
13pub struct ShellRequest {
14 /// Command and arguments requested for shell execution. The first element
15 /// is the executable path/name.
16 pub argv: Vec<String>,
17 /// Working directory requested for command execution; hosts must keep it
18 /// inside approved bounds.
19 pub cwd: Option<PathBuf>,
20 /// Environment overrides requested for shell execution. Hosts should
21 /// treat values as sensitive unless policy says otherwise.
22 pub env: Vec<(String, String)>,
23 /// Timeout budget in milliseconds for the requested operation.
24 pub timeout_ms: u64,
25 /// Whether the request asks for network access. Host sandbox policy is
26 /// still authoritative.
27 pub network: bool,
28 /// Whether the shell request should be cancelled before process launch.
29 pub cancel_before_start: bool,
30}
31
32#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
33/// Shell shell result request or result value.
34/// Creating the value does not spawn a process; shell executors document policy checks and command side effects.
35pub struct ShellResult {
36 /// Process exit status when the process reported one.
37 pub exit_code: Option<i32>,
38 /// Captured standard output. Current shell execution captures the full
39 /// buffered stream; hosts should add bounds before using it with
40 /// untrusted commands.
41 pub stdout: String,
42 /// Captured standard error. Current shell execution captures the full
43 /// buffered stream; hosts should add bounds before using it with
44 /// untrusted commands.
45 pub stderr: String,
46 /// Whether execution ended because the timeout budget elapsed.
47 pub timed_out: bool,
48 /// Whether the SDK/tooling owns the launched process lifecycle for
49 /// cancellation and cleanup evidence.
50 pub agent_owned: bool,
51}