The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(tools): reformat schema tests and cache macro
Steven Enamakel71a7bb312a72
diff --git a/crates/openhuman-core/src/desktop/control/tools_schema_tests.rs b/crates/openhuman-core/src/desktop/control/tools_schema_tests.rsindex 3c87d759bb..10f6373c1e 100644--- a/crates/openhuman-core/src/desktop/control/tools_schema_tests.rs+++ b/crates/openhuman-core/src/desktop/control/tools_schema_tests.rs@@ -3,24 +3,44 @@ use serde_json::json;fn expected_schemas() -> Vec<(DesktopToolKind, serde_json::Value)> {vec![- (DesktopToolKind::Apps, json!({"type":"object","properties":{}})),- (DesktopToolKind::Windows, json!({"type":"object","properties":{- "app":{"type":"string","description":"Optional application name"}}})),- (DesktopToolKind::Launch, json!({"type":"object","properties":{+ (+ DesktopToolKind::Apps,+ json!({"type":"object","properties":{}}),+ ),+ (+ DesktopToolKind::Windows,+ json!({"type":"object","properties":{+ "app":{"type":"string","description":"Optional application name"}}}),+ ),+ (+ DesktopToolKind::Launch,+ json!({"type":"object","properties":{"app":{"type":"string","description":"Application name, e.g. Spotify or TextEdit"}},- "required":["app"],"additionalProperties":false})),- (DesktopToolKind::Snapshot, json!({"type":"object","properties":{+ "required":["app"],"additionalProperties":false}),+ ),+ (+ DesktopToolKind::Snapshot,+ json!({"type":"object","properties":{"app":{"type":"string"}, "window_id":{"type":"string","minLength":1,"description":"Exact window ID from desktop_list_windows"}, "skeleton":{"type":"boolean"},- "root_ref":{"type":"string"}, "max_depth":{"type":"integer","minimum":1,"maximum":12}}})),- (DesktopToolKind::Find, json!({"type":"object","properties":{+ "root_ref":{"type":"string"}, "max_depth":{"type":"integer","minimum":1,"maximum":12}}}),+ ),+ (+ DesktopToolKind::Find,+ json!({"type":"object","properties":{"app":{"type":"string"},"role":{"type":"string"},"name":{"type":"string"},- "root":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":20}}})),- (DesktopToolKind::Act, json!({"type":"object","properties":{+ "root":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":20}}}),+ ),+ (+ DesktopToolKind::Act,+ json!({"type":"object","properties":{"operation":{"type":"string","enum":["click","focus","type","check","uncheck","expand","collapse"]},"ref_id":{"type":"string","description":"Snapshot-qualified ref from desktop_snapshot or desktop_find"},"text":{"type":"string","description":"Required for type"}},- "required":["operation","ref_id"]})),- (DesktopToolKind::Goal, json!({"type":"object","properties":{+ "required":["operation","ref_id"]}),+ ),+ (+ DesktopToolKind::Goal,+ json!({"type":"object","properties":{"app":{"type":"string","description":"Native app to control"},"window":{"type":"string","description":"Optional exact title of an observed app window"},"window_id":{"type":"string","minLength":1,"description":"Optional exact window ID from desktop_list_windows; binds actions and verification to that native window"},@@ -38,10 +58,14 @@ fn expected_schemas() -> Vec<(DesktopToolKind, serde_json::Value)> {"max_steps":{"type":"integer","minimum":1,"maximum":20},"max_model_calls":{"type":"integer","minimum":1,"maximum":40},"max_elapsed_ms":{"type":"integer","minimum":1000,"maximum":300000}},- "required":["app","goal","allowed_operations","allowed_targets","success"],"additionalProperties":false})),- (DesktopToolKind::ContinueGoal, json!({"type":"object","properties":{+ "required":["app","goal","allowed_operations","allowed_targets","success"],"additionalProperties":false}),+ ),+ (+ DesktopToolKind::ContinueGoal,+ json!({"type":"object","properties":{"confirmation_id":{"type":"string","description":"One-use handle approved by the user in Connections"}},- "required":["confirmation_id"]})),+ "required":["confirmation_id"]}),+ ),]}diff --git a/crates/openhuman-core/src/tools/schema_cache.rs b/crates/openhuman-core/src/tools/schema_cache.rsindex 56278fe15a..a4ccd94894 100644--- a/crates/openhuman-core/src/tools/schema_cache.rs+++ b/crates/openhuman-core/src/tools/schema_cache.rs@@ -29,10 +29,7 @@ macro_rules! static_schema {($src:expr) => {{static SCHEMA: ::std::sync::LazyLock<::serde_json::Value> =::std::sync::LazyLock::new(|| {- $crate::tools::schema_cache::parse_embedded(- concat!(file!(), ":", line!()),- $src,- )+ $crate::tools::schema_cache::parse_embedded(concat!(file!(), ":", line!()), $src)});::std::clone::Clone::clone(&*SCHEMA)}};diff --git a/crates/openhuman-core/src/tools/schema_cache_tests.rs b/crates/openhuman-core/src/tools/schema_cache_tests.rsindex 5d5bfd2fe8..9ba381be94 100644--- a/crates/openhuman-core/src/tools/schema_cache_tests.rs+++ b/crates/openhuman-core/src/tools/schema_cache_tests.rs@@ -12,10 +12,13 @@ fn parse_embedded_panics_with_site_on_malformed_json() {parse_embedded("test:1", "{ nope");}+fn cached() -> serde_json::Value {+ static_schema!(r#"{"a":1}"#)+}+#[test]fn static_schema_clones_independently() {- let mut first = static_schema!(r#"{"a":1}"#);+ let mut first = cached();first["a"] = serde_json::json!(2);- let second = static_schema!(r#"{"a":1}"#);- assert_eq!(second["a"], 1);+ assert_eq!(cached()["a"], 1);}