use serde_json::Value;
use crate::error::KernelResult;
use crate::types::{ToolContext, ToolOutput};
#[async_trait::async_trait]
pub trait TransactionalTool: Send + Sync + 'static {
fn id(&self) -> &'static str;
async fn execute(
&self,
ctx: &ToolContext,
args: Value,
) -> Result<ToolOutput, crate::error::KernelError>;
async fn compensate(
&self,
ctx: &ToolContext,
args: Value,
output: ToolOutput,
) -> Result<(), crate::error::KernelError>;
fn is_irreversible(&self) -> bool {
false
}
#[allow(dead_code)]
fn _result_type(&self) -> Option<KernelResult<ToolOutput>> {
None
}
}