Fix: Update source files and fix notify dependency reference
All checks were successful
BotServer CI / build (push) Successful in 11m35s

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Rodrigo Rodriguez 2026-02-13 22:30:57 +00:00
parent 5ea171d126
commit 17cb4ef147
18 changed files with 38 additions and 75 deletions

View file

@ -38,7 +38,7 @@ use diesel::prelude::*;
use log::trace; use log::trace;
use std::error::Error; use std::error::Error;
use super::basic_io::{execute_delete_file, execute_read, execute_write}; use super::basic_io::execute_delete_file;
pub async fn execute_copy( pub async fn execute_copy(
state: &AppState, state: &AppState,

View file

@ -1,7 +1,7 @@
use crate::core::shared::models::UserSession; use crate::core::shared::models::UserSession;
use crate::core::shared::state::AppState; use crate::core::shared::state::AppState;
use log::trace; use log::trace;
use rhai::{Dynamic, Engine, EvalAltResult}; use rhai::{Engine, EvalAltResult};
use serde_json::json; use serde_json::json;
use std::sync::Arc; use std::sync::Arc;

View file

@ -1,5 +1,4 @@
use super::types::{InputType, ValidationResult}; use super::types::{InputType, ValidationResult};
use log::trace;
use regex::Regex; use regex::Regex;
use uuid::Uuid; use uuid::Uuid;

View file

@ -1,16 +1,12 @@
// Bootstrap manager implementation // Bootstrap manager implementation
use crate::core::bootstrap::bootstrap_types::{BootstrapManager, BootstrapProgress}; use crate::core::bootstrap::bootstrap_types::{BootstrapManager, BootstrapProgress};
use crate::core::bootstrap::bootstrap_utils::{safe_pkill, safe_pgrep, safe_sh_command, safe_curl, safe_fuser, dump_all_component_logs, vault_health_check}; use crate::core::bootstrap::bootstrap_utils::{safe_pkill, vault_health_check};
use crate::core::config::AppConfig; use crate::core::config::AppConfig;
use crate::core::package_manager::{PackageManager, InstallMode}; use crate::core::package_manager::{InstallMode, PackageManager};
use anyhow::Result; use log::{info, warn};
use chrono::Utc;
use log::{debug, error, info, warn};
use rand::distr::Alphanumeric;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use tokio::time::{sleep, Duration}; use tokio::time::{sleep, Duration};
use uuid::Uuid;
impl BootstrapManager { impl BootstrapManager {
pub fn new(mode: InstallMode, tenant: Option<String>) -> Self { pub fn new(mode: InstallMode, tenant: Option<String>) -> Self {
@ -36,7 +32,7 @@ impl BootstrapManager {
.to_string() .to_string()
} }
pub async fn kill_stack_processes(&self) -> Result<()> { pub async fn kill_stack_processes(&self) -> anyhow::Result<()> {
info!("Killing any existing stack processes..."); info!("Killing any existing stack processes...");
let processes = crate::core::bootstrap::bootstrap_utils::get_processes_to_kill(); let processes = crate::core::bootstrap::bootstrap_utils::get_processes_to_kill();
@ -52,7 +48,7 @@ impl BootstrapManager {
Ok(()) Ok(())
} }
pub async fn start_all(&mut self) -> Result<()> { pub async fn start_all(&mut self) -> anyhow::Result<()> {
let pm = PackageManager::new(self.install_mode.clone(), self.tenant.clone())?; let pm = PackageManager::new(self.install_mode.clone(), self.tenant.clone())?;
info!("Starting bootstrap process..."); info!("Starting bootstrap process...");
@ -67,7 +63,7 @@ impl BootstrapManager {
Ok(_child) => { Ok(_child) => {
info!("Vault process started, waiting for initialization..."); info!("Vault process started, waiting for initialization...");
// Wait for vault to be ready // Wait for vault to be ready
for i in 0..10 { for _ in 0..10 {
sleep(Duration::from_secs(1)).await; sleep(Duration::from_secs(1)).await;
if vault_health_check() { if vault_health_check() {
info!("Vault is responding"); info!("Vault is responding");
@ -153,7 +149,7 @@ impl BootstrapManager {
} }
/// Run the bootstrap process /// Run the bootstrap process
pub async fn bootstrap(&mut self) -> Result<()> { pub async fn bootstrap(&mut self) -> anyhow::Result<()> {
info!("Starting bootstrap process..."); info!("Starting bootstrap process...");
// Kill any existing processes // Kill any existing processes
self.kill_stack_processes().await?; self.kill_stack_processes().await?;
@ -161,14 +157,14 @@ impl BootstrapManager {
} }
/// Sync templates to database /// Sync templates to database
pub fn sync_templates_to_database(&self) -> Result<()> { pub fn sync_templates_to_database(&self) -> anyhow::Result<()> {
info!("Syncing templates to database..."); info!("Syncing templates to database...");
// TODO: Implement actual template sync // TODO: Implement actual template sync
Ok(()) Ok(())
} }
/// Upload templates to drive /// Upload templates to drive
pub async fn upload_templates_to_drive(&self, _cfg: &AppConfig) -> Result<()> { pub async fn upload_templates_to_drive(&self, _cfg: &AppConfig) -> anyhow::Result<()> {
info!("Uploading templates to drive..."); info!("Uploading templates to drive...");
// TODO: Implement actual template upload // TODO: Implement actual template upload
Ok(()) Ok(())

View file

@ -1,6 +1,5 @@
// Bootstrap type definitions // Bootstrap type definitions
use crate::core::package_manager::InstallMode; use crate::core::package_manager::InstallMode;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::path::PathBuf; use std::path::PathBuf;

View file

@ -1,14 +1,6 @@
// Bootstrap utility functions // Bootstrap utility functions
use crate::core::config::AppConfig; use log::{debug, info, warn};
use crate::core::package_manager::setup::{DirectorySetup, EmailSetup, VectorDbSetup};
use crate::core::package_manager::{InstallMode, PackageManager};
use crate::security::command_guard::SafeCommand;
use crate::core::shared::utils::{establish_pg_connection, init_secrets_manager};
use anyhow::Result;
use log::{debug, error, info, warn};
use rand::distr::Alphanumeric;
use std::process::Command; use std::process::Command;
use uuid::Uuid;
/// Get list of processes to kill /// Get list of processes to kill
pub fn get_processes_to_kill() -> Vec<(&'static str, Vec<&'static str>)> { pub fn get_processes_to_kill() -> Vec<(&'static str, Vec<&'static str>)> {
@ -42,11 +34,7 @@ pub fn safe_pkill(pattern: &[&str], extra_args: &[&str]) {
let mut args: Vec<&str> = extra_args.to_vec(); let mut args: Vec<&str> = extra_args.to_vec();
args.extend(pattern); args.extend(pattern);
let result = if cfg!(feature = "sigkill") { let result = Command::new("pkill").args(&args).output();
Command::new("killall").args(&args).output()
} else {
Command::new("pkill").args(&args).output()
};
match result { match result {
Ok(output) => { Ok(output) => {

View file

@ -5,13 +5,12 @@ use axum::{
http::StatusCode, http::StatusCode,
response::{IntoResponse, Json}, response::{IntoResponse, Json},
}; };
use diesel::prelude::*;
use log::info; use log::info;
use std::sync::Arc; use std::sync::Arc;
/// Get current configuration /// Get current configuration
pub async fn get_config( pub async fn get_config(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
) -> impl IntoResponse { ) -> impl IntoResponse {
// Return default empty config for now // Return default empty config for now
let configs = vec![ let configs = vec![
@ -32,7 +31,7 @@ pub async fn get_config(
/// Update configuration /// Update configuration
pub async fn update_config( pub async fn update_config(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(request): Json<UpdateConfigRequest>, Json(request): Json<UpdateConfigRequest>,
) -> impl IntoResponse { ) -> impl IntoResponse {
info!("Updating config: {} = {}", request.key, request.value); info!("Updating config: {} = {}", request.key, request.value);

View file

@ -5,8 +5,6 @@ use lettre::{
transport::smtp::authentication::Credentials, transport::smtp::authentication::Credentials,
SmtpTransport, Transport, SmtpTransport, Transport,
}; };
use log::warn;
use uuid::Uuid;
/// Send invitation email /// Send invitation email
#[cfg(feature = "mail")] #[cfg(feature = "mail")]

View file

@ -2,20 +2,18 @@
use crate::core::shared::state::AppState; use crate::core::shared::state::AppState;
use crate::drive::drive_types::*; use crate::drive::drive_types::*;
use axum::{ use axum::{
extract::{Path, Query, State}, extract::{Path, State},
http::StatusCode, http::StatusCode,
response::IntoResponse,
Json, Json,
}; };
use chrono::Utc; use chrono::Utc;
use log::{debug, error, info};
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;
use uuid::Uuid; use uuid::Uuid;
/// Open a file for editing /// Open a file for editing
pub async fn open_file( pub async fn open_file(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Path(file_id): Path<String>, Path(file_id): Path<String>,
) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Opening file: {}", file_id); tracing::debug!("Opening file: {}", file_id);
@ -42,7 +40,7 @@ pub async fn open_file(
/// List all buckets /// List all buckets
pub async fn list_buckets( pub async fn list_buckets(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
) -> Result<Json<Vec<BucketInfo>>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<Vec<BucketInfo>>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Listing buckets"); tracing::debug!("Listing buckets");
@ -54,7 +52,7 @@ pub async fn list_buckets(
/// List files in a bucket /// List files in a bucket
pub async fn list_files( pub async fn list_files(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<SearchQuery>, Json(req): Json<SearchQuery>,
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
let query = req.query.clone().unwrap_or_default(); let query = req.query.clone().unwrap_or_default();
@ -70,7 +68,7 @@ pub async fn list_files(
/// Read file content /// Read file content
pub async fn read_file( pub async fn read_file(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Path(file_id): Path<String>, Path(file_id): Path<String>,
) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Reading file: {}", file_id); tracing::debug!("Reading file: {}", file_id);
@ -97,7 +95,7 @@ pub async fn read_file(
/// Write file content /// Write file content
pub async fn write_file( pub async fn write_file(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<WriteRequest>, Json(req): Json<WriteRequest>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
let file_id = req.file_id.unwrap_or_else(|| Uuid::new_v4().to_string()); let file_id = req.file_id.unwrap_or_else(|| Uuid::new_v4().to_string());
@ -110,7 +108,7 @@ pub async fn write_file(
/// Delete a file /// Delete a file
pub async fn delete_file( pub async fn delete_file(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Path(file_id): Path<String>, Path(file_id): Path<String>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Deleting file: {}", file_id); tracing::debug!("Deleting file: {}", file_id);
@ -121,10 +119,10 @@ pub async fn delete_file(
/// Create a folder /// Create a folder
pub async fn create_folder( pub async fn create_folder(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<CreateFolderRequest>, Json(req): Json<CreateFolderRequest>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
let parent_id = req.parent_id.clone().unwrap_or_default(); let _parent_id = req.parent_id.clone().unwrap_or_default();
tracing::debug!("Creating folder: {:?}", req.name); tracing::debug!("Creating folder: {:?}", req.name);
@ -134,8 +132,8 @@ pub async fn create_folder(
/// Copy a file /// Copy a file
pub async fn copy_file( pub async fn copy_file(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<CopyFileRequest>, Json(_req): Json<CopyFileRequest>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Copying file"); tracing::debug!("Copying file");
@ -145,8 +143,8 @@ pub async fn copy_file(
/// Upload file to drive /// Upload file to drive
pub async fn upload_file_to_drive( pub async fn upload_file_to_drive(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<UploadRequest>, Json(_req): Json<UploadRequest>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Uploading to drive"); tracing::debug!("Uploading to drive");
@ -156,7 +154,7 @@ pub async fn upload_file_to_drive(
/// Download file /// Download file
pub async fn download_file( pub async fn download_file(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Path(file_id): Path<String>, Path(file_id): Path<String>,
) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Downloading file: {}", file_id); tracing::debug!("Downloading file: {}", file_id);
@ -183,8 +181,8 @@ pub async fn download_file(
/// List folder contents /// List folder contents
pub async fn list_folder_contents( pub async fn list_folder_contents(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<SearchQuery>, Json(_req): Json<SearchQuery>,
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Listing folder contents"); tracing::debug!("Listing folder contents");
@ -196,7 +194,7 @@ pub async fn list_folder_contents(
/// Search files /// Search files
pub async fn search_files( pub async fn search_files(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<SearchQuery>, Json(req): Json<SearchQuery>,
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
let query = req.query.clone().unwrap_or_default(); let query = req.query.clone().unwrap_or_default();
@ -212,7 +210,7 @@ pub async fn search_files(
/// Get recent files /// Get recent files
pub async fn recent_files( pub async fn recent_files(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Getting recent files"); tracing::debug!("Getting recent files");
@ -224,7 +222,7 @@ pub async fn recent_files(
/// List favorites /// List favorites
pub async fn list_favorites( pub async fn list_favorites(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Listing favorites"); tracing::debug!("Listing favorites");
@ -236,8 +234,8 @@ pub async fn list_favorites(
/// Share folder /// Share folder
pub async fn share_folder( pub async fn share_folder(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
Json(req): Json<ShareRequest>, Json(_req): Json<ShareRequest>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Sharing folder"); tracing::debug!("Sharing folder");
@ -247,7 +245,7 @@ pub async fn share_folder(
/// List shared files/folders /// List shared files/folders
pub async fn list_shared( pub async fn list_shared(
State(state): State<Arc<AppState>>, State(_state): State<Arc<AppState>>,
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> { ) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
tracing::debug!("Listing shared resources"); tracing::debug!("Listing shared resources");

View file

@ -2,7 +2,6 @@
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::HashMap;
use uuid::Uuid;
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FileItem { pub struct FileItem {

View file

@ -151,7 +151,6 @@ async fn main() -> std::io::Result<()> {
init_database, init_logging_and_i18n, load_config, parse_cli_args, run_axum_server, init_database, init_logging_and_i18n, load_config, parse_cli_args, run_axum_server,
run_bootstrap, start_background_services, BootstrapProgress, run_bootstrap, start_background_services, BootstrapProgress,
}; };
use crate::core::package_manager::InstallMode;
use crate::core::shared::memory_monitor::MemoryStats; use crate::core::shared::memory_monitor::MemoryStats;
use crate::core::shared::memory_monitor::register_thread; use crate::core::shared::memory_monitor::register_thread;
use crate::security::set_global_panic_hook; use crate::security::set_global_panic_hook;

View file

@ -15,7 +15,6 @@ use crate::core::session::SessionManager;
use crate::core::shared::state::AppState; use crate::core::shared::state::AppState;
use crate::core::shared::utils::create_conn; use crate::core::shared::utils::create_conn;
use crate::core::shared::utils::create_s3_operator; use crate::core::shared::utils::create_s3_operator;
use crate::security::set_global_panic_hook;
use super::BootstrapProgress; use super::BootstrapProgress;
@ -682,9 +681,7 @@ pub async fn start_background_services(
pool: &crate::core::shared::utils::DbPool, pool: &crate::core::shared::utils::DbPool,
) { ) {
#[cfg(feature = "drive")] #[cfg(feature = "drive")]
use crate::DriveMonitor;
use crate::core::shared::memory_monitor::{log_process_memory, start_memory_monitor}; use crate::core::shared::memory_monitor::{log_process_memory, start_memory_monitor};
use crate::core::shared::memory_monitor::register_thread;
// Resume workflows after server restart // Resume workflows after server restart
if let Err(e) = if let Err(e) =

View file

@ -1,11 +1,10 @@
//! HTTP server initialization and routing //! HTTP server initialization and routing
use axum::extract::State;
use axum::{ use axum::{
routing::{get, post}, routing::{get, post},
Json, Router, Json, Router,
}; };
use log::{error, info, trace, warn}; use log::{error, info, warn};
use std::net::SocketAddr; use std::net::SocketAddr;
use std::sync::Arc; use std::sync::Arc;
use tower_http::trace::TraceLayer; use tower_http::trace::TraceLayer;

View file

@ -1,6 +1,5 @@
use crate::security::auth_api::{config::AuthConfig, error::AuthError, types::AuthenticatedUser}; use crate::security::auth_api::{config::AuthConfig, error::AuthError, types::AuthenticatedUser};
use axum::body::Body; use axum::body::Body;
use std::sync::Arc;
use tracing::{debug, warn}; use tracing::{debug, warn};
use uuid::Uuid; use uuid::Uuid;

View file

@ -11,6 +11,3 @@ pub mod types;
// Re-export scheduler // Re-export scheduler
pub use scheduler::TaskScheduler; pub use scheduler::TaskScheduler;
// Import types from types module
use crate::tasks::types::*;

View file

@ -2,7 +2,6 @@
use crate::core::shared::utils::DbPool; use crate::core::shared::utils::DbPool;
use crate::tasks::types::*; use crate::tasks::types::*;
use chrono::Utc; use chrono::Utc;
use diesel::prelude::*;
use std::sync::Arc; use std::sync::Arc;
use tokio::sync::RwLock; use tokio::sync::RwLock;
use uuid::Uuid; use uuid::Uuid;

View file

@ -1,5 +1,4 @@
//! HTTP handlers for task API //! HTTP handlers for task API
use crate::auto_task::TaskManifest;
use crate::core::shared::state::AppState; use crate::core::shared::state::AppState;
use crate::tasks::task_api::{html_renderers, utils}; use crate::tasks::task_api::{html_renderers, utils};
use crate::tasks::types::TaskResponse; use crate::tasks::types::TaskResponse;
@ -8,7 +7,6 @@ use axum::http::StatusCode;
use axum::response::{IntoResponse, Json}; use axum::response::{IntoResponse, Json};
use axum::routing::{delete, get, post, put}; use axum::routing::{delete, get, post, put};
use axum::Router; use axum::Router;
use chrono::Utc;
use diesel::prelude::*; use diesel::prelude::*;
use log::{error, info, warn}; use log::{error, info, warn};
use std::sync::Arc; use std::sync::Arc;

View file

@ -1,5 +1,4 @@
//! Utility functions for task API //! Utility functions for task API
use crate::auto_task::TaskManifest;
use crate::core::shared::state::AppState; use crate::core::shared::state::AppState;
use std::sync::Arc; use std::sync::Arc;