Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/vida-core/src/agent_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::mcp::{McpManager, McpTool, McpToolResult, McpToolResultContent};
use crate::tool_validator::validate_tool_call;

const MAX_TOOL_ITERATIONS: usize = 8;
#[allow(dead_code)]
const TOOL_CALL_TIMEOUT_SECS: u64 = 30;
const TOOL_CALL_START: &str = "<tool_call>";
const TOOL_CALL_END: &str = "</tool_call>";
Expand Down
10 changes: 4 additions & 6 deletions crates/vida-core/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::time::Instant;
use tokio::sync::mpsc;
use uuid::Uuid;

Expand Down Expand Up @@ -643,13 +642,13 @@ impl VidaEngine {
"Too many login attempts. Try again later.".to_string(),
));
} else {
self.login_blocked_until.remove(&username.to_string());
self.login_blocked_until.remove(username);
}
}

match self.authenticate_user(username, password).await {
Ok(session) => {
self.login_attempts.remove(&username.to_string());
self.login_attempts.remove(username);
self.current_actor = Some(session.clone());
Ok(session)
}
Expand All @@ -665,7 +664,7 @@ impl VidaEngine {
username.to_string(),
now + std::time::Duration::from_secs(LOGIN_BLOCK_SECS),
);
self.login_attempts.remove(&username.to_string());
self.login_attempts.remove(username);
}
}
Err(err)
Expand Down Expand Up @@ -1249,8 +1248,7 @@ impl VidaEngine {
name: &str,
) -> Result<WorkspaceConfig, VidaError> {
let workspace_path = std::path::Path::new(path);
let mut config = WorkspaceConfig::default();
config.name = name.to_string();
let config = WorkspaceConfig { name: name.to_string(), ..Default::default() };

save_workspace_config(workspace_path, &config)?;

Expand Down
9 changes: 2 additions & 7 deletions crates/vida-core/src/permissions.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
#[serde(rename_all = "lowercase")]
pub enum PermissionMode {
Yolo,
#[default]
Ask,
Sandbox,
}

impl Default for PermissionMode {
fn default() -> Self {
Self::Ask
}
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "snake_case")]
pub enum PermissionType {
Expand Down
5 changes: 2 additions & 3 deletions crates/vida-core/src/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,7 @@ mod server {
let _ = socket
.send(ws::Message::Text(
serde_json::json!({"error": e.to_string()})
.to_string()
.into(),
.to_string(),
))
.await;
return;
Expand Down Expand Up @@ -1007,7 +1006,7 @@ mod server {
};
let is_done = matches!(event, StreamEvent::Done);
if socket
.send(ws::Message::Text(json.to_string().into()))
.send(ws::Message::Text(json.to_string()))
.await
.is_err()
{
Expand Down
2 changes: 1 addition & 1 deletion crates/vida-core/src/tool_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn validate_against_schema(value: &Value, schema: &Value) -> Result<(), String>
"array" => validate_array(value, schema)?,
"string" if !value.is_string() => return Err("expected string".to_string()),
"number" if !value.is_number() => return Err("expected number".to_string()),
"integer" if !value.as_i64().is_some() && !value.as_u64().is_some() => {
"integer" if value.as_i64().is_none() && value.as_u64().is_none() => {
return Err("expected integer".to_string())
}
"boolean" if !value.is_boolean() => return Err("expected boolean".to_string()),
Expand Down