Skip to main content

hematite/tools/
tool.rs

1use serde_json::Value;
2
3#[allow(dead_code)]
4pub trait HematiteTool {
5    fn name(&self) -> &'static str;
6    fn description(&self) -> &'static str;
7    fn risk_level(&self, args: &serde_json::Value) -> RiskLevel;
8    fn mutation_label(&self, args: &serde_json::Value) -> Option<String>;
9
10    /// Estimates the context window impact before execution
11    fn estimate_token_cost(&self, args: &Value) -> usize;
12
13    /// Mandatory security intercept prior to any execution
14    fn security_audit(&self, args: &Value) -> Result<(), String>;
15
16    /// Executes the tool in a dry-run mode
17    fn dry_run(&self, args: Value) -> Result<String, String>;
18
19    /// Executes the tool for real, potentially hitting permission guards
20    fn run(&self, args: Value) -> Result<String, String>;
21}
22
23#[derive(Debug, Clone, Copy, PartialEq, Eq)]
24pub enum RiskLevel {
25    Safe,
26    Moderate,
27    High,
28}