use std::path::Path;
use std::time::Duration;
use async_trait::async_trait;
use theway_core::executor::{CommandOutput, ExecutorError, ExecutorKind, Result, ToolExecutor};
#[derive(Debug, Clone, Copy, Default)]
pub struct SandboxExecutor;
impl SandboxExecutor {
pub fn new() -> Self {
Self
}
fn unsupported<T>() -> Result<T> {
Err(ExecutorError::UnsupportedKind(ExecutorKind::Sandbox))
}
}
#[async_trait]
impl ToolExecutor for SandboxExecutor {
async fn kind(&self) -> ExecutorKind {
ExecutorKind::Sandbox
}
async fn read_file(&self, _path: &Path) -> Result<String> {
Self::unsupported()
}
async fn write_file(&self, _path: &Path, _content: &str) -> Result<()> {
Self::unsupported()
}
async fn run_command(
&self,
_cwd: &Path,
_argv: &[String],
_timeout: Duration,
) -> Result<CommandOutput> {
Self::unsupported()
}
async fn list_dir(&self, _path: &Path) -> Result<Vec<String>> {
Self::unsupported()
}
async fn grep(&self, _pattern: &str, _path: &Path) -> Result<Vec<String>> {
Self::unsupported()
}
async fn find(&self, _glob: &str, _path: &Path) -> Result<Vec<String>> {
Self::unsupported()
}
async fn git(&self, _args: &[String]) -> Result<CommandOutput> {
Self::unsupported()
}
}