From 0bb08f4ae1caffe89f6175687f13a4b579b1b71b Mon Sep 17 00:00:00 2001 From: jaberjaber23 Date: Fri, 27 Feb 2026 20:47:14 +0300 Subject: [PATCH] PR fixes --- Cargo.lock | 51 +++++++---- crates/openfang-api/src/routes.rs | 37 ++++++++ crates/openfang-api/static/index_body.html | 4 +- .../openfang-api/static/js/pages/scheduler.js | 88 ++++++++++++------- crates/openfang-channels/src/mastodon.rs | 61 ++++++++++--- crates/openfang-extensions/src/oauth.rs | 49 +++++++++++ crates/openfang-extensions/src/vault.rs | 73 ++++++++++++++- crates/openfang-kernel/Cargo.toml | 1 + crates/openfang-kernel/src/cron.rs | 74 +++++++++++++--- crates/openfang-kernel/src/kernel.rs | 9 +- crates/openfang-kernel/src/metering.rs | 3 + crates/openfang-kernel/src/scheduler.rs | 4 +- crates/openfang-runtime/src/drivers/mod.rs | 11 ++- crates/openfang-runtime/src/model_catalog.rs | 33 ++++++- crates/openfang-runtime/src/web_fetch.rs | 59 ++++++++++++- crates/openfang-types/src/config.rs | 25 ++++++ crates/openfang-types/src/model_catalog.rs | 1 + 17 files changed, 501 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 32656b65..9d683edd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1071,6 +1071,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "cron" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5877d3fbf742507b66bc2a1945106bd30dd8504019d596901ddd012a4dd01740" +dependencies = [ + "chrono", + "once_cell", + "winnow 0.6.26", +] + [[package]] name = "crossbeam" version = "0.8.4" @@ -3650,7 +3661,7 @@ dependencies = [ [[package]] name = "openfang-api" -version = "0.1.0" +version = "0.1.6" dependencies = [ "async-trait", "axum", @@ -3686,7 +3697,7 @@ dependencies = [ [[package]] name = "openfang-channels" -version = "0.1.0" +version = "0.1.6" dependencies = [ "async-trait", "axum", @@ -3713,7 +3724,7 @@ dependencies = [ [[package]] name = "openfang-cli" -version = "0.1.0" +version = "0.1.6" dependencies = [ "clap", "clap_complete", @@ -3740,7 +3751,7 @@ dependencies = [ [[package]] name = "openfang-desktop" -version = "0.1.0" +version = "0.1.6" dependencies = [ "axum", "open", @@ -3766,7 +3777,7 @@ dependencies = [ [[package]] name = "openfang-extensions" -version = "0.1.0" +version = "0.1.6" dependencies = [ "aes-gcm", "argon2", @@ -3794,7 +3805,7 @@ dependencies = [ [[package]] name = "openfang-hands" -version = "0.1.0" +version = "0.1.6" dependencies = [ "chrono", "dashmap", @@ -3811,10 +3822,11 @@ dependencies = [ [[package]] name = "openfang-kernel" -version = "0.1.0" +version = "0.1.6" dependencies = [ "async-trait", "chrono", + "cron", "crossbeam", "dashmap", "dirs 6.0.0", @@ -3846,7 +3858,7 @@ dependencies = [ [[package]] name = "openfang-memory" -version = "0.1.0" +version = "0.1.6" dependencies = [ "async-trait", "chrono", @@ -3865,7 +3877,7 @@ dependencies = [ [[package]] name = "openfang-migrate" -version = "0.1.0" +version = "0.1.6" dependencies = [ "chrono", "dirs 6.0.0", @@ -3884,7 +3896,7 @@ dependencies = [ [[package]] name = "openfang-runtime" -version = "0.1.0" +version = "0.1.6" dependencies = [ "anyhow", "async-trait", @@ -3915,7 +3927,7 @@ dependencies = [ [[package]] name = "openfang-skills" -version = "0.1.0" +version = "0.1.6" dependencies = [ "chrono", "hex", @@ -3937,7 +3949,7 @@ dependencies = [ [[package]] name = "openfang-types" -version = "0.1.0" +version = "0.1.6" dependencies = [ "async-trait", "chrono", @@ -3956,7 +3968,7 @@ dependencies = [ [[package]] name = "openfang-wire" -version = "0.1.0" +version = "0.1.6" dependencies = [ "async-trait", "chrono", @@ -4638,7 +4650,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -8250,6 +8262,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e90edd2ac1aa278a5c4599b1d89cf03074b610800f866d4026dc199d7929a28" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "0.7.14" @@ -8491,7 +8512,7 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" [[package]] name = "xtask" -version = "0.1.0" +version = "0.1.6" [[package]] name = "yoke" diff --git a/crates/openfang-api/src/routes.rs b/crates/openfang-api/src/routes.rs index d2a8b14c..ed36d688 100644 --- a/crates/openfang-api/src/routes.rs +++ b/crates/openfang-api/src/routes.rs @@ -6930,6 +6930,36 @@ pub async fn patch_agent_config( } }; + // Input length limits + const MAX_NAME_LEN: usize = 256; + const MAX_DESC_LEN: usize = 4096; + const MAX_PROMPT_LEN: usize = 65_536; + + if let Some(ref name) = req.name { + if name.len() > MAX_NAME_LEN { + return ( + StatusCode::PAYLOAD_TOO_LARGE, + Json(serde_json::json!({"error": format!("Name exceeds max length ({MAX_NAME_LEN} chars)")})), + ); + } + } + if let Some(ref desc) = req.description { + if desc.len() > MAX_DESC_LEN { + return ( + StatusCode::PAYLOAD_TOO_LARGE, + Json(serde_json::json!({"error": format!("Description exceeds max length ({MAX_DESC_LEN} chars)")})), + ); + } + } + if let Some(ref prompt) = req.system_prompt { + if prompt.len() > MAX_PROMPT_LEN { + return ( + StatusCode::PAYLOAD_TOO_LARGE, + Json(serde_json::json!({"error": format!("System prompt exceeds max length ({MAX_PROMPT_LEN} chars)")})), + ); + } + } + // Validate color format if provided if let Some(ref color) = req.color { if !color.is_empty() && !color.starts_with('#') { @@ -7069,6 +7099,13 @@ pub async fn clone_agent( } }; + if req.new_name.len() > 256 { + return ( + StatusCode::PAYLOAD_TOO_LARGE, + Json(serde_json::json!({"error": "Name exceeds max length (256 chars)"})), + ); + } + if req.new_name.trim().is_empty() { return ( StatusCode::BAD_REQUEST, diff --git a/crates/openfang-api/static/index_body.html b/crates/openfang-api/static/index_body.html index 7d2a2a83..08ee3d7d 100644 --- a/crates/openfang-api/static/index_body.html +++ b/crates/openfang-api/static/index_body.html @@ -1523,7 +1523,7 @@ Agent Status Last Run - Runs + Next Run Actions @@ -1543,7 +1543,7 @@ - +