Skip to main content

Crate statespace_tool_runtime

Crate statespace_tool_runtime 

Source
Expand description

Core tool execution runtime for Statespace.

Provides tool parsing, frontmatter extraction, command validation, and sandboxed execution with security protections (SSRF, path traversal).

use statespace_tool_runtime::{BuiltinTool, ToolExecutor, ExecutionLimits};

let tool = BuiltinTool::from_command(&["cat".to_string(), "file.md".to_string()])?;
let executor = ToolExecutor::new(PathBuf::from("./toolsite"), ExecutionLimits::default());
let output = executor.execute(&tool).await?;

Re-exports§

pub use error::Error;
pub use error::Result;
pub use executor::ExecutionLimits;
pub use executor::FileInfo;
pub use executor::ToolExecutor;
pub use executor::ToolOutput;
pub use frontmatter::Frontmatter;
pub use frontmatter::parse_frontmatter;
pub use protocol::ActionRequest;
pub use protocol::ActionResponse;
pub use security::is_private_or_restricted_ip;
pub use security::validate_url_initial;
pub use spec::CompiledRegex;
pub use spec::SpecError;
pub use spec::ToolPart;
pub use spec::ToolSpec;
pub use spec::is_valid_tool_call;
pub use tools::BuiltinTool;
pub use tools::HttpMethod;
pub use validation::expand_env_vars;
pub use validation::expand_placeholders;
pub use validation::validate_command;
pub use validation::validate_command_with_specs;

Modules§

error
Error types for the tool runtime.
eval
Component block processing for dynamic markdown content.
executor
Tool execution with sandboxing and resource limits.
frontmatter
Frontmatter parsing for YAML (---) and TOML (+++) formats.
protocol
Tool execution request/response protocol.
security
SSRF protection for the curl tool.
spec
Tool specification parsing and validation.
tools
Tool domain models
validation
Command validation and placeholder expansion.