Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(desktop): add parameter schemas for desktop control tools

Steven Enamakel1addd6c4beb2
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_act.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_act.json
new file mode 100644
index 0000000000..80188ae3d9
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_act.json
@@ -0,0 +1,29 @@
+{
+ "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"
+ ]
+}
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_apps.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_apps.json
new file mode 100644
index 0000000000..e1a8346a83
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_apps.json
@@ -0,0 +1,4 @@
+{
+ "type": "object",
+ "properties": {}
+}
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_continue_goal.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_continue_goal.json
new file mode 100644
index 0000000000..370e469a4b
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_continue_goal.json
@@ -0,0 +1,12 @@
+{
+ "type": "object",
+ "properties": {
+ "confirmation_id": {
+ "type": "string",
+ "description": "One-use handle approved by the user in Connections"
+ }
+ },
+ "required": [
+ "confirmation_id"
+ ]
+}
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_find.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_find.json
new file mode 100644
index 0000000000..ec29851bb2
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_find.json
@@ -0,0 +1,22 @@
+{
+ "type": "object",
+ "properties": {
+ "app": {
+ "type": "string"
+ },
+ "role": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "root": {
+ "type": "string"
+ },
+ "limit": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 20
+ }
+ }
+}
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_goal.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_goal.json
new file mode 100644
index 0000000000..44be157727
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_goal.json
@@ -0,0 +1,118 @@
+{
+ "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"
+ },
+ "goal": {
+ "type": "string",
+ "description": "One bounded desktop task; describe the intended visible result"
+ },
+ "allowed_operations": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "string",
+ "enum": [
+ "CLICK",
+ "TYPE_TEXT",
+ "CHECK",
+ "UNCHECK",
+ "EXPAND",
+ "COLLAPSE",
+ "SCROLL"
+ ]
+ },
+ "description": "Mutating operations Jev may execute; enumerate those needed for this task"
+ },
+ "allowed_targets": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "string"
+ },
+ "description": "Exact accessible name, description, or native_id.value from desktop_snapshot or desktop_find for each action target"
+ },
+ "text_slots": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "description": "Prepared text keyed by an exact allowed target. Copy user supplied text verbatim; do not normalize punctuation, spacing, or case"
+ },
+ "success": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "enum": [
+ "name_present",
+ "name_contains",
+ "value_equals",
+ "value_contains",
+ "state_contains"
+ ]
+ },
+ "name": {
+ "type": "string",
+ "description": "Exact accessible name, description, or native_id.value from the snapshot for name_present, value_equals, value_contains, or state_contains"
+ },
+ "fragment": {
+ "type": "string",
+ "description": "For name_contains, a stable substring of the visible descendant name, such as the exact outgoing message text"
+ },
+ "within": {
+ "type": "string",
+ "description": "For name_contains, the exact accessible name of the ancestor container, such as the active conversation message list"
+ },
+ "value": {
+ "type": "string"
+ },
+ "state": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "kind"
+ ]
+ },
+ "description": "All predicates must match a fresh accessibility observation before completion. name_contains requires fragment and within"
+ },
+ "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
+}
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_launch.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_launch.json
new file mode 100644
index 0000000000..64f021d467
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_launch.json
@@ -0,0 +1,13 @@
+{
+ "type": "object",
+ "properties": {
+ "app": {
+ "type": "string",
+ "description": "Application name, e.g. Spotify or TextEdit"
+ }
+ },
+ "required": [
+ "app"
+ ],
+ "additionalProperties": false
+}
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_snapshot.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_snapshot.json
new file mode 100644
index 0000000000..5277314112
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_snapshot.json
@@ -0,0 +1,24 @@
+{
+ "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
+ }
+ }
+}
diff --git a/crates/openhuman-core/src/desktop/control/parameters/desktop_windows.json b/crates/openhuman-core/src/desktop/control/parameters/desktop_windows.json
new file mode 100644
index 0000000000..191ea2d81d
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/parameters/desktop_windows.json
@@ -0,0 +1,9 @@
+{
+ "type": "object",
+ "properties": {
+ "app": {
+ "type": "string",
+ "description": "Optional application name"
+ }
+ }
+}
diff --git a/crates/openhuman-core/src/desktop/control/tools.rs b/crates/openhuman-core/src/desktop/control/tools.rs
index 1ee9baa094..2a412d9d61 100644
--- a/crates/openhuman-core/src/desktop/control/tools.rs
+++ b/crates/openhuman-core/src/desktop/control/tools.rs
@@ -1,5 +1,6 @@
//! Deferred desktop tools. Only their names and descriptions enter discovery.
+use crate::tools::schema_cache::static_schema;
use std::sync::Arc;
use async_trait::async_trait;
@@ -221,45 +222,14 @@ impl Tool for DesktopTool {
fn parameters_schema(&self) -> Value {
match self.kind {
- 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":{
- "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":{
- "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":{
- "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":{
- "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"},
- "goal":{"type":"string","description":"One bounded desktop task; describe the intended visible result"},
- "allowed_operations":{"type":"array","minItems":1,"items":{"type":"string","enum":["CLICK","TYPE_TEXT","CHECK","UNCHECK","EXPAND","COLLAPSE","SCROLL"]},"description":"Mutating operations Jev may execute; enumerate those needed for this task"},
- "allowed_targets":{"type":"array","minItems":1,"items":{"type":"string"},"description":"Exact accessible name, description, or native_id.value from desktop_snapshot or desktop_find for each action target"},
- "text_slots":{"type":"object","additionalProperties":{"type":"string"},"description":"Prepared text keyed by an exact allowed target. Copy user supplied text verbatim; do not normalize punctuation, spacing, or case"},
- "success":{"type":"array","minItems":1,"items":{"type":"object","properties":{
- "kind":{"type":"string","enum":["name_present","name_contains","value_equals","value_contains","state_contains"]},
- "name":{"type":"string","description":"Exact accessible name, description, or native_id.value from the snapshot for name_present, value_equals, value_contains, or state_contains"},
- "fragment":{"type":"string","description":"For name_contains, a stable substring of the visible descendant name, such as the exact outgoing message text"},
- "within":{"type":"string","description":"For name_contains, the exact accessible name of the ancestor container, such as the active conversation message list"},
- "value":{"type":"string"},"state":{"type":"string"}},
- "required":["kind"]},"description":"All predicates must match a fresh accessibility observation before completion. name_contains requires fragment and within"},
- "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":{
- "confirmation_id":{"type":"string","description":"One-use handle approved by the user in Connections"}},
- "required":["confirmation_id"]}),
+ DesktopToolKind::Apps => static_schema!(include_str!("parameters/desktop_apps.json")),
+ DesktopToolKind::Windows => static_schema!(include_str!("parameters/desktop_windows.json")),
+ DesktopToolKind::Launch => static_schema!(include_str!("parameters/desktop_launch.json")),
+ DesktopToolKind::Snapshot => static_schema!(include_str!("parameters/desktop_snapshot.json")),
+ DesktopToolKind::Find => static_schema!(include_str!("parameters/desktop_find.json")),
+ DesktopToolKind::Act => static_schema!(include_str!("parameters/desktop_act.json")),
+ DesktopToolKind::Goal => static_schema!(include_str!("parameters/desktop_goal.json")),
+ DesktopToolKind::ContinueGoal => static_schema!(include_str!("parameters/desktop_continue_goal.json")),
}
}
@@ -449,3 +419,7 @@ impl Tool for DesktopTool {
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
+
+#[cfg(test)]
+#[path = "tools_schema_tests.rs"]
+mod schema_tests;
diff --git a/crates/openhuman-core/src/desktop/control/tools_schema_tests.rs b/crates/openhuman-core/src/desktop/control/tools_schema_tests.rs
new file mode 100644
index 0000000000..b91d675e76
--- /dev/null
+++ b/crates/openhuman-core/src/desktop/control/tools_schema_tests.rs
@@ -0,0 +1,46 @@
+use super::*;
+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":{
+ "app":{"type":"string","description":"Application name, e.g. Spotify or TextEdit"}},
+ "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":{
+ "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":{
+ "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":{
+ "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"},
+ "goal":{"type":"string","description":"One bounded desktop task; describe the intended visible result"},
+ "allowed_operations":{"type":"array","minItems":1,"items":{"type":"string","enum":["CLICK","TYPE_TEXT","CHECK","UNCHECK","EXPAND","COLLAPSE","SCROLL"]},"description":"Mutating operations Jev may execute; enumerate those needed for this task"},
+ "allowed_targets":{"type":"array","minItems":1,"items":{"type":"string"},"description":"Exact accessible name, description, or native_id.value from desktop_snapshot or desktop_find for each action target"},
+ "text_slots":{"type":"object","additionalProperties":{"type":"string"},"description":"Prepared text keyed by an exact allowed target. Copy user supplied text verbatim; do not normalize punctuation, spacing, or case"},
+ "success":{"type":"array","minItems":1,"items":{"type":"object","properties":{
+ "kind":{"type":"string","enum":["name_present","name_contains","value_equals","value_contains","state_contains"]},
+ "name":{"type":"string","description":"Exact accessible name, description, or native_id.value from the snapshot for name_present, value_equals, value_contains, or state_contains"},
+ "fragment":{"type":"string","description":"For name_contains, a stable substring of the visible descendant name, such as the exact outgoing message text"},
+ "within":{"type":"string","description":"For name_contains, the exact accessible name of the ancestor container, such as the active conversation message list"},
+ "value":{"type":"string"},"state":{"type":"string"}},
+ "required":["kind"]},"description":"All predicates must match a fresh accessibility observation before completion. name_contains requires fragment and within"},
+ "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":{
+ "confirmation_id":{"type":"string","description":"One-use handle approved by the user in Connections"}},
+ "required":["confirmation_id"]})),
+ ]
+}