theway_daemon/executor/
sandbox.rs1use std::path::Path;
11use std::time::Duration;
12
13use async_trait::async_trait;
14use theway_core::executor::{CommandOutput, ExecutorError, ExecutorKind, Result, ToolExecutor};
15
16#[derive(Debug, Clone, Copy, Default)]
20pub struct SandboxExecutor;
21
22impl SandboxExecutor {
23 pub fn new() -> Self {
24 Self
25 }
26
27 fn unsupported<T>() -> Result<T> {
30 Err(ExecutorError::UnsupportedKind(ExecutorKind::Sandbox))
31 }
32}
33
34#[async_trait]
35impl ToolExecutor for SandboxExecutor {
36 async fn kind(&self) -> ExecutorKind {
37 ExecutorKind::Sandbox
38 }
39
40 async fn read_file(&self, _path: &Path) -> Result<String> {
41 Self::unsupported()
42 }
43
44 async fn write_file(&self, _path: &Path, _content: &str) -> Result<()> {
45 Self::unsupported()
46 }
47
48 async fn run_command(
49 &self,
50 _cwd: &Path,
51 _argv: &[String],
52 _timeout: Duration,
53 ) -> Result<CommandOutput> {
54 Self::unsupported()
55 }
56
57 async fn list_dir(&self, _path: &Path) -> Result<Vec<String>> {
58 Self::unsupported()
59 }
60
61 async fn grep(&self, _pattern: &str, _path: &Path) -> Result<Vec<String>> {
62 Self::unsupported()
63 }
64
65 async fn find(&self, _glob: &str, _path: &Path) -> Result<Vec<String>> {
66 Self::unsupported()
67 }
68
69 async fn git(&self, _args: &[String]) -> Result<CommandOutput> {
70 Self::unsupported()
71 }
72}