- Remove agent_loop from server (was ~400 lines) — server dispatches to workers - AgentManager simplified to pure dispatcher (send_event → worker) - Remove LLM config requirement from server (workers bring their own via config.yaml) - Remove process_feedback, build_feedback_tools from server - Remove chat API endpoint (LLM on workers only) - Remove service proxy (services run on workers) - Worker reads LLM config from its own config.yaml - ws_worker.rs handles WorkerToServer::Update messages (DB + broadcast) - Verified locally: tori server + tori worker connect and register
77 lines
1.7 KiB
Rust
77 lines
1.7 KiB
Rust
pub mod api;
|
|
pub mod agent;
|
|
pub mod db;
|
|
pub mod kb;
|
|
pub mod llm;
|
|
pub mod exec;
|
|
pub mod state;
|
|
pub mod template;
|
|
pub mod timer;
|
|
pub mod tools;
|
|
pub mod worker;
|
|
pub mod sink;
|
|
pub mod worker_runner;
|
|
pub mod ws;
|
|
pub mod ws_worker;
|
|
|
|
use std::sync::Arc;
|
|
use serde::Deserialize;
|
|
|
|
pub struct AppState {
|
|
pub db: db::Database,
|
|
pub config: Config,
|
|
pub agent_mgr: Arc<agent::AgentManager>,
|
|
pub kb: Option<Arc<kb::KbManager>>,
|
|
pub obj_root: String,
|
|
pub auth: Option<api::auth::AuthConfig>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct Config {
|
|
/// LLM config is optional on the server — workers bring their own.
|
|
#[serde(default)]
|
|
pub llm: Option<LlmConfig>,
|
|
pub server: ServerConfig,
|
|
pub database: DatabaseConfig,
|
|
#[serde(default)]
|
|
pub template_repo: Option<TemplateRepoConfig>,
|
|
/// Path to EC private key PEM file for JWT signing
|
|
#[serde(default)]
|
|
pub jwt_private_key: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct TemplateRepoConfig {
|
|
pub gitea_url: String,
|
|
pub owner: String,
|
|
pub repo: String,
|
|
#[serde(default = "default_repo_path")]
|
|
pub local_path: String,
|
|
}
|
|
|
|
fn default_repo_path() -> String {
|
|
if std::path::Path::new("/app/oseng-templates").is_dir() {
|
|
"/app/oseng-templates".to_string()
|
|
} else {
|
|
"oseng-templates".to_string()
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, Deserialize)]
|
|
pub struct LlmConfig {
|
|
pub base_url: String,
|
|
pub api_key: String,
|
|
pub model: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct ServerConfig {
|
|
pub host: String,
|
|
pub port: u16,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct DatabaseConfig {
|
|
pub path: String,
|
|
}
|