Skip to main content

elizaos_plugin_code/
types.rs

1use serde::{Deserialize, Serialize};
2use std::path::PathBuf;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct CodeConfig {
6    pub enabled: bool,
7    pub allowed_directory: PathBuf,
8    pub timeout_ms: u64,
9    pub forbidden_commands: Vec<String>,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
13#[serde(rename_all = "snake_case")]
14pub enum FileOperationType {
15    Read,
16    Write,
17    Edit,
18    List,
19    Search,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
23pub struct FileOperation {
24    pub r#type: FileOperationType,
25    pub target: String,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct CommandHistoryEntry {
30    pub timestamp_ms: u64,
31    pub working_directory: String,
32    pub command: String,
33    pub stdout: String,
34    pub stderr: String,
35    pub exit_code: Option<i32>,
36    pub file_operations: Option<Vec<FileOperation>>,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct CommandResult {
41    pub success: bool,
42    pub stdout: String,
43    pub stderr: String,
44    pub exit_code: Option<i32>,
45    pub error: Option<String>,
46    pub executed_in: String,
47}