Skip to content

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

chore: reformat schema tests and imports

Steven Enamakel850938a458dc
diff --git a/crates/openhuman-core/src/cron/tools/add.rs b/crates/openhuman-core/src/cron/tools/add.rs
index 28a9d9d7f2..2e2c0b28bf 100644
--- a/crates/openhuman-core/src/cron/tools/add.rs
+++ b/crates/openhuman-core/src/cron/tools/add.rs
@@ -1,9 +1,9 @@
-use crate::tools::schema_cache::static_schema;
use crate::config::Config;
use crate::cron::job_builder::{create_agent_job, AgentJobInput};
use crate::cron::origin::{current_job_origin, current_turn_may_skip_approval};
use crate::cron::{self, DeliveryConfig, JobType, Schedule, SessionTarget};
use crate::security::SecurityPolicy;
+use crate::tools::schema_cache::static_schema;
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/cron/tools/add_schema_tests.rs b/crates/openhuman-core/src/cron/tools/add_schema_tests.rs
index 78070bc9c4..133e54487a 100644
--- a/crates/openhuman-core/src/cron/tools/add_schema_tests.rs
+++ b/crates/openhuman-core/src/cron/tools/add_schema_tests.rs
@@ -3,78 +3,84 @@ use serde_json::json;
fn expected_cron_add() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "name": { "type": "string", "description": "Short human-readable name for the job (e.g. 'drink_water_reminder'). Always provide a name." },
- "schedule": {
- "description": "Schedule: cron expression, one-shot at time, or fixed interval.",
- "oneOf": [
- {
- "type": "object",
- "description": "Repeating cron schedule. 'tz' is an IANA timezone (e.g. 'America/Los_Angeles'); defaults to device-local timezone.",
- "properties": {
- "kind": { "type": "string", "const": "cron" },
- "expr": { "type": "string", "description": "Cron expression (5, 6, or 7 fields). For agent jobs, consecutive runs must be at least 5 minutes apart." },
- "tz": { "type": "string", "description": "Optional IANA timezone name" },
- "active_hours": {
- "type": "object",
- "description": "Optional: only run during these local hours",
- "properties": {
- "start": { "type": "string", "description": "Start time HH:MM (e.g. '09:00')" },
- "end": { "type": "string", "description": "End time HH:MM (e.g. '17:00')" }
- },
- "required": ["start", "end"],
- "additionalProperties": false
- }
- },
- "required": ["kind", "expr"],
- "additionalProperties": false
+ "type": "object",
+ "properties": {
+ "name": { "type": "string", "description": "Short human-readable name for the job (e.g. 'drink_water_reminder'). Always provide a name." },
+ "schedule": {
+ "description": "Schedule: cron expression, one-shot at time, or fixed interval.",
+ "oneOf": [
+ {
+ "type": "object",
+ "description": "Repeating cron schedule. 'tz' is an IANA timezone (e.g. 'America/Los_Angeles'); defaults to device-local timezone.",
+ "properties": {
+ "kind": { "type": "string", "const": "cron" },
+ "expr": { "type": "string", "description": "Cron expression (5, 6, or 7 fields). For agent jobs, consecutive runs must be at least 5 minutes apart." },
+ "tz": { "type": "string", "description": "Optional IANA timezone name" },
+ "active_hours": {
+ "type": "object",
+ "description": "Optional: only run during these local hours",
+ "properties": {
+ "start": { "type": "string", "description": "Start time HH:MM (e.g. '09:00')" },
+ "end": { "type": "string", "description": "End time HH:MM (e.g. '17:00')" }
+ },
+ "required": ["start", "end"],
+ "additionalProperties": false
+ }
},
- {
- "type": "object",
- "description": "One-shot job that runs once at a specific UTC instant.",
- "properties": {
- "kind": { "type": "string", "const": "at" },
- "at": { "type": "string", "description": "ISO-8601 UTC timestamp" }
- },
- "required": ["kind", "at"],
- "additionalProperties": false
+ "required": ["kind", "expr"],
+ "additionalProperties": false
+ },
+ {
+ "type": "object",
+ "description": "One-shot job that runs once at a specific UTC instant.",
+ "properties": {
+ "kind": { "type": "string", "const": "at" },
+ "at": { "type": "string", "description": "ISO-8601 UTC timestamp" }
},
- {
- "type": "object",
- "description": "Repeating job that fires every N milliseconds.",
- "properties": {
- "kind": { "type": "string", "const": "every" },
- "every_ms": { "type": "integer", "description": "Interval in milliseconds (must be > 0; at least 300000 = 5 minutes for agent jobs)" }
- },
- "required": ["kind", "every_ms"],
- "additionalProperties": false
- }
- ]
- },
- "job_type": { "type": "string", "enum": ["shell", "agent"] },
- "command": { "type": "string" },
- "prompt": { "type": "string" },
- "session_target": { "type": "string", "enum": ["isolated", "current", "main"], "description": "Defaults to 'current' (a fresh run that sees the recent conversation it was created in and replies there) when created inside a conversation, otherwise 'isolated'." },
- "model": { "type": "string" },
- "delivery": {
- "type": "object",
- "description": "Delivery config. Defaults to 'origin' (reply into the conversation this job was created in) when created inside a conversation, otherwise 'proactive'. Modes: origin, proactive, announce (needs channel+to), none (silent).",
- "properties": {
- "mode": { "type": "string", "enum": ["origin", "proactive", "announce", "none"] },
- "channel": { "type": "string", "description": "Required for announce mode" },
- "to": { "type": "string", "description": "Required for announce mode" },
- "best_effort": { "type": "boolean", "default": true }
+ "required": ["kind", "at"],
+ "additionalProperties": false
+ },
+ {
+ "type": "object",
+ "description": "Repeating job that fires every N milliseconds.",
+ "properties": {
+ "kind": { "type": "string", "const": "every" },
+ "every_ms": { "type": "integer", "description": "Interval in milliseconds (must be > 0; at least 300000 = 5 minutes for agent jobs)" }
+ },
+ "required": ["kind", "every_ms"],
+ "additionalProperties": false
}
- },
- "delete_after_run": { "type": "boolean" }
+ ]
+ },
+ "job_type": { "type": "string", "enum": ["shell", "agent"] },
+ "command": { "type": "string" },
+ "prompt": { "type": "string" },
+ "session_target": { "type": "string", "enum": ["isolated", "current", "main"], "description": "Defaults to 'current' (a fresh run that sees the recent conversation it was created in and replies there) when created inside a conversation, otherwise 'isolated'." },
+ "model": { "type": "string" },
+ "delivery": {
+ "type": "object",
+ "description": "Delivery config. Defaults to 'origin' (reply into the conversation this job was created in) when created inside a conversation, otherwise 'proactive'. Modes: origin, proactive, announce (needs channel+to), none (silent).",
+ "properties": {
+ "mode": { "type": "string", "enum": ["origin", "proactive", "announce", "none"] },
+ "channel": { "type": "string", "description": "Required for announce mode" },
+ "to": { "type": "string", "description": "Required for announce mode" },
+ "best_effort": { "type": "boolean", "default": true }
+ }
},
- "required": ["name", "schedule"]
- })
+ "delete_after_run": { "type": "boolean" }
+ },
+ "required": ["name", "schedule"]
+ })
}
#[test]
fn cron_add_static_schema_matches_json_literal() {
- let tool = CronAddTool::new(std::sync::Arc::new(crate::config::Config::default()), std::sync::Arc::new(crate::security::SecurityPolicy::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_cron_add());
+ let tool = CronAddTool::new(
+ std::sync::Arc::new(crate::config::Config::default()),
+ std::sync::Arc::new(crate::security::SecurityPolicy::default()),
+ );
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_cron_add()
+ );
}
diff --git a/crates/openhuman-core/src/desktop/control/tools.rs b/crates/openhuman-core/src/desktop/control/tools.rs
index 2a412d9d61..5c0bd6ce39 100644
--- a/crates/openhuman-core/src/desktop/control/tools.rs
+++ b/crates/openhuman-core/src/desktop/control/tools.rs
@@ -223,13 +223,21 @@ impl Tool for DesktopTool {
fn parameters_schema(&self) -> Value {
match self.kind {
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::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")),
+ DesktopToolKind::ContinueGoal => {
+ static_schema!(include_str!("parameters/desktop_continue_goal.json"))
+ }
}
}
diff --git a/crates/openhuman-core/src/flows/builder_tools/draft_edit_schema_tests.rs b/crates/openhuman-core/src/flows/builder_tools/draft_edit_schema_tests.rs
index 66d3f8a367..78107c94c3 100644
--- a/crates/openhuman-core/src/flows/builder_tools/draft_edit_schema_tests.rs
+++ b/crates/openhuman-core/src/flows/builder_tools/draft_edit_schema_tests.rs
@@ -3,49 +3,52 @@ use serde_json::json;
fn expected_edit_workflow() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "draft_id": {
- "type": "string",
- "description": "A working draft to edit as the base; the applied edit is written back to it. Provide one of draft_id / flow_id / graph."
- },
- "flow_id": {
- "type": "string",
- "description": "The saved flow to edit as the base graph. Provide one of draft_id / flow_id / graph."
- },
- "graph": {
- "type": "object",
- "description": "An inline base tinyflows WorkflowGraph to edit. Provide one of draft_id / flow_id / graph.",
- "properties": {
- "nodes": { "type": "array" },
- "edges": { "type": "array" }
- }
- },
- "ops": {
- "type": "array",
- "description": "The structured edits, applied in order. Each item is { op, ... } — see the tool description for op shapes.",
- "items": { "type": "object", "properties": { "op": { "type": "string" } }, "required": ["op"] },
- "minItems": 1
- },
- "name": {
- "type": "string",
- "description": "Name for the resulting proposed flow. Defaults to the base flow's name."
- },
- "instruction": {
- "type": "string",
- "description": "The change that motivated these ops (echoed back on the review card)."
- },
- "require_approval": {
- "type": "boolean",
- "description": "Force a human-approval gate on every outbound action once saved. Defaults to true."
+ "type": "object",
+ "properties": {
+ "draft_id": {
+ "type": "string",
+ "description": "A working draft to edit as the base; the applied edit is written back to it. Provide one of draft_id / flow_id / graph."
+ },
+ "flow_id": {
+ "type": "string",
+ "description": "The saved flow to edit as the base graph. Provide one of draft_id / flow_id / graph."
+ },
+ "graph": {
+ "type": "object",
+ "description": "An inline base tinyflows WorkflowGraph to edit. Provide one of draft_id / flow_id / graph.",
+ "properties": {
+ "nodes": { "type": "array" },
+ "edges": { "type": "array" }
}
},
- "required": ["ops"]
- })
+ "ops": {
+ "type": "array",
+ "description": "The structured edits, applied in order. Each item is { op, ... } — see the tool description for op shapes.",
+ "items": { "type": "object", "properties": { "op": { "type": "string" } }, "required": ["op"] },
+ "minItems": 1
+ },
+ "name": {
+ "type": "string",
+ "description": "Name for the resulting proposed flow. Defaults to the base flow's name."
+ },
+ "instruction": {
+ "type": "string",
+ "description": "The change that motivated these ops (echoed back on the review card)."
+ },
+ "require_approval": {
+ "type": "boolean",
+ "description": "Force a human-approval gate on every outbound action once saved. Defaults to true."
+ }
+ },
+ "required": ["ops"]
+ })
}
#[test]
fn edit_workflow_static_schema_matches_json_literal() {
let tool = EditWorkflowTool::new(std::sync::Arc::new(crate::config::Config::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_edit_workflow());
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_edit_workflow()
+ );
}
diff --git a/crates/openhuman-core/src/flows/builder_tools/dry_run_schema_tests.rs b/crates/openhuman-core/src/flows/builder_tools/dry_run_schema_tests.rs
index 3130263c89..488092d152 100644
--- a/crates/openhuman-core/src/flows/builder_tools/dry_run_schema_tests.rs
+++ b/crates/openhuman-core/src/flows/builder_tools/dry_run_schema_tests.rs
@@ -3,34 +3,37 @@ use serde_json::json;
fn expected_dry_run_workflow() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "draft_id": {
- "type": "string",
- "description": "A working draft to simulate. Provide one of draft_id / flow_id / graph (draft_id wins)."
+ "type": "object",
+ "properties": {
+ "draft_id": {
+ "type": "string",
+ "description": "A working draft to simulate. Provide one of draft_id / flow_id / graph (draft_id wins)."
+ },
+ "flow_id": {
+ "type": "string",
+ "description": "A saved flow to simulate. Provide one of draft_id / flow_id / graph."
+ },
+ "graph": {
+ "type": "object",
+ "description": "An inline tinyflows WorkflowGraph to simulate: { nodes: [...], edges: [...] }. Provide one of draft_id / flow_id / graph.",
+ "properties": {
+ "nodes": { "type": "array" },
+ "edges": { "type": "array" }
},
- "flow_id": {
- "type": "string",
- "description": "A saved flow to simulate. Provide one of draft_id / flow_id / graph."
- },
- "graph": {
- "type": "object",
- "description": "An inline tinyflows WorkflowGraph to simulate: { nodes: [...], edges: [...] }. Provide one of draft_id / flow_id / graph.",
- "properties": {
- "nodes": { "type": "array" },
- "edges": { "type": "array" }
- },
- "required": ["nodes", "edges"]
- },
- "input": {
- "description": "Optional trigger input passed to the run (defaults to {})."
- }
+ "required": ["nodes", "edges"]
+ },
+ "input": {
+ "description": "Optional trigger input passed to the run (defaults to {})."
}
- })
+ }
+ })
}
#[test]
fn dry_run_workflow_static_schema_matches_json_literal() {
let tool = DryRunWorkflowTool::new(std::sync::Arc::new(crate::config::Config::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_dry_run_workflow());
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_dry_run_workflow()
+ );
}
diff --git a/crates/openhuman-core/src/flows/builder_tools/persistence_schema_tests.rs b/crates/openhuman-core/src/flows/builder_tools/persistence_schema_tests.rs
index e48b446034..1001a3ba14 100644
--- a/crates/openhuman-core/src/flows/builder_tools/persistence_schema_tests.rs
+++ b/crates/openhuman-core/src/flows/builder_tools/persistence_schema_tests.rs
@@ -3,37 +3,40 @@ use serde_json::json;
fn expected_save_workflow() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "flow_id": {
- "type": "string",
- "description": "Id of the EXISTING saved flow to write the graph to (the persistence target — always required)."
- },
- "draft_id": {
- "type": "string",
- "description": "A working draft whose graph to persist onto the flow. Provide this OR inline `graph`; if both are given, draft_id wins."
- },
- "graph": {
- "type": "object",
- "description": "The full tinyflows WorkflowGraph to persist: { name?, nodes: [...], edges: [...] }. Provide this OR `draft_id`. Same shape as propose_workflow.",
- "properties": {
- "nodes": { "type": "array" },
- "edges": { "type": "array" }
- },
- "required": ["nodes", "edges"]
+ "type": "object",
+ "properties": {
+ "flow_id": {
+ "type": "string",
+ "description": "Id of the EXISTING saved flow to write the graph to (the persistence target — always required)."
+ },
+ "draft_id": {
+ "type": "string",
+ "description": "A working draft whose graph to persist onto the flow. Provide this OR inline `graph`; if both are given, draft_id wins."
+ },
+ "graph": {
+ "type": "object",
+ "description": "The full tinyflows WorkflowGraph to persist: { name?, nodes: [...], edges: [...] }. Provide this OR `draft_id`. Same shape as propose_workflow.",
+ "properties": {
+ "nodes": { "type": "array" },
+ "edges": { "type": "array" }
},
- "name": {
- "type": "string",
- "description": "Optional new human-readable name for the flow."
- }
+ "required": ["nodes", "edges"]
},
- "required": ["flow_id"],
- "additionalProperties": false
- })
+ "name": {
+ "type": "string",
+ "description": "Optional new human-readable name for the flow."
+ }
+ },
+ "required": ["flow_id"],
+ "additionalProperties": false
+ })
}
#[test]
fn save_workflow_static_schema_matches_json_literal() {
let tool = SaveWorkflowTool::new(std::sync::Arc::new(crate::config::Config::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_save_workflow());
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_save_workflow()
+ );
}
diff --git a/crates/openhuman-core/src/flows/discovery_tools_schema_tests.rs b/crates/openhuman-core/src/flows/discovery_tools_schema_tests.rs
index 8cff1f311c..127765a1ce 100644
--- a/crates/openhuman-core/src/flows/discovery_tools_schema_tests.rs
+++ b/crates/openhuman-core/src/flows/discovery_tools_schema_tests.rs
@@ -3,69 +3,72 @@ use serde_json::json;
fn expected_suggest_workflows() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "suggestions": {
- "type": "array",
- "description": "1-8 workflow suggestions, highest-value first.",
- "items": {
- "type": "object",
- "properties": {
- "title": {
- "type": "string",
- "description": "Short, human-friendly title, e.g. \"Auto-file email receipts\"."
- },
- "one_liner": {
- "type": "string",
- "description": "One sentence describing what the workflow does."
- },
- "rationale": {
- "type": "string",
- "description": "Why this is suggested to THIS user, grounded in what you observed."
- },
- "trigger_hint": {
- "type": "string",
- "description": "Likely trigger: \"schedule\" | \"app_event\" | \"manual\" (only these self-fire).",
- "enum": ["schedule", "app_event", "manual"]
- },
- "steps_outline": {
- "type": "array",
- "items": { "type": "string" },
- "description": "Plain-language step outline, one per element."
- },
- "suggested_connections": {
- "type": "array",
- "items": { "type": "string" },
- "description": "Real connection_ref values from list_flow_connections. Never invented."
- },
- "suggested_slugs": {
- "type": "array",
- "items": { "type": "string" },
- "description": "Real Composio action slugs from search_tool_catalog. Never hallucinated."
- },
- "build_prompt": {
- "type": "string",
- "description": "Self-contained natural-language brief handed to the workflow-builder on \"Build this\"."
- },
- "confidence": {
- "type": "number",
- "description": "Your confidence in [0,1] that this is a genuinely useful, buildable automation."
- }
+ "type": "object",
+ "properties": {
+ "suggestions": {
+ "type": "array",
+ "description": "1-8 workflow suggestions, highest-value first.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "title": {
+ "type": "string",
+ "description": "Short, human-friendly title, e.g. \"Auto-file email receipts\"."
},
- "required": ["title", "one_liner", "rationale", "build_prompt"]
- }
- },
- "run_id": {
- "type": "string",
- "description": "Optional correlation id for the discovery run that produced these."
+ "one_liner": {
+ "type": "string",
+ "description": "One sentence describing what the workflow does."
+ },
+ "rationale": {
+ "type": "string",
+ "description": "Why this is suggested to THIS user, grounded in what you observed."
+ },
+ "trigger_hint": {
+ "type": "string",
+ "description": "Likely trigger: \"schedule\" | \"app_event\" | \"manual\" (only these self-fire).",
+ "enum": ["schedule", "app_event", "manual"]
+ },
+ "steps_outline": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Plain-language step outline, one per element."
+ },
+ "suggested_connections": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Real connection_ref values from list_flow_connections. Never invented."
+ },
+ "suggested_slugs": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Real Composio action slugs from search_tool_catalog. Never hallucinated."
+ },
+ "build_prompt": {
+ "type": "string",
+ "description": "Self-contained natural-language brief handed to the workflow-builder on \"Build this\"."
+ },
+ "confidence": {
+ "type": "number",
+ "description": "Your confidence in [0,1] that this is a genuinely useful, buildable automation."
+ }
+ },
+ "required": ["title", "one_liner", "rationale", "build_prompt"]
}
},
- "required": ["suggestions"]
- })
+ "run_id": {
+ "type": "string",
+ "description": "Optional correlation id for the discovery run that produced these."
+ }
+ },
+ "required": ["suggestions"]
+ })
}
#[test]
fn suggest_workflows_static_schema_matches_json_literal() {
let tool = SuggestWorkflowsTool::new(std::sync::Arc::new(crate::config::Config::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_suggest_workflows());
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_suggest_workflows()
+ );
}
diff --git a/crates/openhuman-core/src/flows/memory_tools_schema_tests.rs b/crates/openhuman-core/src/flows/memory_tools_schema_tests.rs
index 5acd1eb59c..9d7cd2dd7d 100644
--- a/crates/openhuman-core/src/flows/memory_tools_schema_tests.rs
+++ b/crates/openhuman-core/src/flows/memory_tools_schema_tests.rs
@@ -3,34 +3,39 @@ use serde_json::json;
fn expected_flow_memory_remember() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "flow_id": {
- "type": "string",
- "description": "Informational only: inside a running flow the active flow's own id \
- (from the run's trusted origin) is authoritative and this value is ignored. This \
- tool ONLY works inside a workflow run — calling it from chat or any other context \
- without a trusted run origin is refused, regardless of what is passed here."
- },
- "key": {
- "type": "string",
- "description": "Unique key for this memory within the flow's own memory"
- },
- "content": {
- "type": "string",
- "description": "The information to remember"
- },
- "category": {
- "type": "string",
- "description": "What kind of statement this is: 'fact' (default), 'preference', 'procedure', 'correction', or anything else (stored as 'other')."
- }
+ "type": "object",
+ "properties": {
+ "flow_id": {
+ "type": "string",
+ "description": "Informational only: inside a running flow the active flow's own id \
+ (from the run's trusted origin) is authoritative and this value is ignored. This \
+ tool ONLY works inside a workflow run — calling it from chat or any other context \
+ without a trusted run origin is refused, regardless of what is passed here."
},
- "required": ["flow_id", "key", "content"]
- })
+ "key": {
+ "type": "string",
+ "description": "Unique key for this memory within the flow's own memory"
+ },
+ "content": {
+ "type": "string",
+ "description": "The information to remember"
+ },
+ "category": {
+ "type": "string",
+ "description": "What kind of statement this is: 'fact' (default), 'preference', 'procedure', 'correction', or anything else (stored as 'other')."
+ }
+ },
+ "required": ["flow_id", "key", "content"]
+ })
}
#[test]
fn flow_memory_remember_static_schema_matches_json_literal() {
- let tool = FlowMemoryRememberTool::new(std::sync::Arc::new(crate::security::SecurityPolicy::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_flow_memory_remember());
+ let tool = FlowMemoryRememberTool::new(std::sync::Arc::new(
+ crate::security::SecurityPolicy::default(),
+ ));
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_flow_memory_remember()
+ );
}
diff --git a/crates/openhuman-core/src/flows/tools_schema_tests.rs b/crates/openhuman-core/src/flows/tools_schema_tests.rs
index d868487555..a0fbde4ade 100644
--- a/crates/openhuman-core/src/flows/tools_schema_tests.rs
+++ b/crates/openhuman-core/src/flows/tools_schema_tests.rs
@@ -3,65 +3,68 @@ use serde_json::json;
fn expected_propose_workflow() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "name": {
- "type": "string",
- "description": "Human-readable name for the proposed flow."
- },
- "graph": {
- "type": "object",
- "description": "A tinyflows WorkflowGraph: { name?, nodes: [...], edges: [...] }. See the tool description for node kinds and their config shapes.",
- "properties": {
- "nodes": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "id": { "type": "string", "description": "Unique id within the graph." },
- "kind": {
- "type": "string",
- "enum": [
- "trigger", "agent", "tool_call", "http_request",
- "code", "shell", "condition", "switch", "merge", "split_out",
- "transform", "output_parser", "sub_workflow", "memory",
- "dedup", "loop", "spawn", "gate", "scatter", "gather",
- "approval", "void"
- ]
- },
- "name": { "type": "string", "description": "Human-readable node name." },
- "config": { "description": "Kind-specific configuration; see tool description." }
- },
- "required": ["id", "kind", "name"]
- }
- },
- "edges": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "from_node": { "type": "string" },
- "to_node": { "type": "string" },
- "from_port": { "type": "string", "description": "Defaults to \"main\". For a condition/switch branch, this is where the branch label (e.g. \"true\"/\"false\") goes." },
- "to_port": { "type": "string", "description": "Defaults to \"main\". Almost always stays \"main\" — branch labels go on from_port, not here." }
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Human-readable name for the proposed flow."
+ },
+ "graph": {
+ "type": "object",
+ "description": "A tinyflows WorkflowGraph: { name?, nodes: [...], edges: [...] }. See the tool description for node kinds and their config shapes.",
+ "properties": {
+ "nodes": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "description": "Unique id within the graph." },
+ "kind": {
+ "type": "string",
+ "enum": [
+ "trigger", "agent", "tool_call", "http_request",
+ "code", "shell", "condition", "switch", "merge", "split_out",
+ "transform", "output_parser", "sub_workflow", "memory",
+ "dedup", "loop", "spawn", "gate", "scatter", "gather",
+ "approval", "void"
+ ]
},
- "required": ["from_node", "to_node"]
- }
+ "name": { "type": "string", "description": "Human-readable node name." },
+ "config": { "description": "Kind-specific configuration; see tool description." }
+ },
+ "required": ["id", "kind", "name"]
}
},
- "required": ["nodes", "edges"]
+ "edges": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "from_node": { "type": "string" },
+ "to_node": { "type": "string" },
+ "from_port": { "type": "string", "description": "Defaults to \"main\". For a condition/switch branch, this is where the branch label (e.g. \"true\"/\"false\") goes." },
+ "to_port": { "type": "string", "description": "Defaults to \"main\". Almost always stays \"main\" — branch labels go on from_port, not here." }
+ },
+ "required": ["from_node", "to_node"]
+ }
+ }
},
- "require_approval": {
- "type": "boolean",
- "description": "Force a human-approval gate on every outbound tool/HTTP action this flow takes once saved. Defaults to true for agent-proposed flows."
- }
+ "required": ["nodes", "edges"]
},
- "required": ["name", "graph"]
- })
+ "require_approval": {
+ "type": "boolean",
+ "description": "Force a human-approval gate on every outbound tool/HTTP action this flow takes once saved. Defaults to true for agent-proposed flows."
+ }
+ },
+ "required": ["name", "graph"]
+ })
}
#[test]
fn propose_workflow_static_schema_matches_json_literal() {
let tool = ProposeWorkflowTool::new(std::sync::Arc::new(crate::config::Config::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_propose_workflow());
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_propose_workflow()
+ );
}
diff --git a/crates/openhuman-core/src/memory/tools_schema_tests.rs b/crates/openhuman-core/src/memory/tools_schema_tests.rs
index 22e4603c88..a0820f1799 100644
--- a/crates/openhuman-core/src/memory/tools_schema_tests.rs
+++ b/crates/openhuman-core/src/memory/tools_schema_tests.rs
@@ -3,36 +3,36 @@ use serde_json::json;
fn expected_memory() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "action": {
- "type": "string",
- "enum": ["recall", "fetch", "learn", "forget"],
- "description": "What to do."
- },
- "question": {"type": "string", "description": "recall: the question to answer from memory."},
- "query": {"type": "string", "description": "fetch: what to search for."},
- "mode": {"type": "string", "enum": ["hybrid", "keyword", "vector"], "description": "fetch: retrieval mode; only the engine's declared modes work (hybrid is always safe)."},
- "filter": {"type": "object", "description": "recall/fetch: metadata filter, e.g. {\"kinds\": [\"learning\"], \"workspace\": \"/path\", \"repo\": \"owner/name\"}."},
- "limit": {"type": "integer", "minimum": 1, "maximum": 100, "description": "recall/fetch: most results."},
- "cursor": {"type": "string", "description": "fetch: next-page cursor."},
- "refers_to": {
- "type": "object",
- "additionalProperties": false,
- "description": "recall/fetch: the local calendar dates the question is about, resolved against the Current Date & Time line. Set it whenever the question mentions or implies a time, in any language: \"yesterday\", \"last Saturday\", \"in March\", \"kal\", \"pichle hafte\", \"el viernes\". A single day has from == to. If a word can mean the past or the future (Hindi \"kal\"), cover both days. Prefer this over filter.observed_after/observed_before: those drop every memory recorded on another day, this only ranks the matching days first.",
- "properties": {
- "from": {"type": "string", "format": "date", "description": "First local date, YYYY-MM-DD."},
- "to": {"type": "string", "format": "date", "description": "Last local date, YYYY-MM-DD, inclusive."}
- },
- "required": ["from", "to"]
+ "type": "object",
+ "properties": {
+ "action": {
+ "type": "string",
+ "enum": ["recall", "fetch", "learn", "forget"],
+ "description": "What to do."
+ },
+ "question": {"type": "string", "description": "recall: the question to answer from memory."},
+ "query": {"type": "string", "description": "fetch: what to search for."},
+ "mode": {"type": "string", "enum": ["hybrid", "keyword", "vector"], "description": "fetch: retrieval mode; only the engine's declared modes work (hybrid is always safe)."},
+ "filter": {"type": "object", "description": "recall/fetch: metadata filter, e.g. {\"kinds\": [\"learning\"], \"workspace\": \"/path\", \"repo\": \"owner/name\"}."},
+ "limit": {"type": "integer", "minimum": 1, "maximum": 100, "description": "recall/fetch: most results."},
+ "cursor": {"type": "string", "description": "fetch: next-page cursor."},
+ "refers_to": {
+ "type": "object",
+ "additionalProperties": false,
+ "description": "recall/fetch: the local calendar dates the question is about, resolved against the Current Date & Time line. Set it whenever the question mentions or implies a time, in any language: \"yesterday\", \"last Saturday\", \"in March\", \"kal\", \"pichle hafte\", \"el viernes\". A single day has from == to. If a word can mean the past or the future (Hindi \"kal\"), cover both days. Prefer this over filter.observed_after/observed_before: those drop every memory recorded on another day, this only ranks the matching days first.",
+ "properties": {
+ "from": {"type": "string", "format": "date", "description": "First local date, YYYY-MM-DD."},
+ "to": {"type": "string", "format": "date", "description": "Last local date, YYYY-MM-DD, inclusive."}
},
- "text": {"type": "string", "description": "learn: the learning, one self-contained sentence."},
- "kind": {"type": "string", "enum": ["preference", "fact", "procedure", "correction", "other"], "description": "learn: what kind of learning (default fact)."},
- "confidence": {"type": "number", "minimum": 0, "maximum": 1, "description": "learn: confidence (default 0.8)."},
- "ids": {"type": "array", "items": {"type": "string"}, "description": "forget: item ids to remove."}
+ "required": ["from", "to"]
},
- "required": ["action"]
- })
+ "text": {"type": "string", "description": "learn: the learning, one self-contained sentence."},
+ "kind": {"type": "string", "enum": ["preference", "fact", "procedure", "correction", "other"], "description": "learn: what kind of learning (default fact)."},
+ "confidence": {"type": "number", "minimum": 0, "maximum": 1, "description": "learn: confidence (default 0.8)."},
+ "ids": {"type": "array", "items": {"type": "string"}, "description": "forget: item ids to remove."}
+ },
+ "required": ["action"]
+ })
}
#[test]
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser.rs b/crates/openhuman-core/src/tools/impl/browser/browser.rs
index e80dcba8c6..8965a93140 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser.rs
@@ -7,10 +7,10 @@ mod pending;
mod session_pool;
#[path = "browser_task_actions.rs"]
mod task_actions;
-use crate::tools::schema_cache::static_schema;
use crate::modules::browser::BrowserClient;
use crate::security::approval::{ApprovalGate, GateOutcome};
use crate::security::SecurityPolicy;
+use crate::tools::schema_cache::static_schema;
use async_trait::async_trait;
use pending::{approval_target, needs_host_confirmation, Pending};
use serde_json::{json, Value};
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_schema_tests.rs b/crates/openhuman-core/src/tools/impl/browser/browser_schema_tests.rs
index 58bd0b0fbb..a8807ddceb 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser_schema_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser_schema_tests.rs
@@ -10,6 +10,15 @@ fn expected_browser() -> serde_json::Value {
#[test]
fn browser_static_schema_matches_json_literal() {
- let tool = BrowserTool::new(std::sync::Arc::new(crate::security::SecurityPolicy::default()), std::sync::Arc::new(BrowserClient::new(std::sync::Arc::new(crate::config::Config::default()))), 3);
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_browser());
+ let tool = BrowserTool::new(
+ std::sync::Arc::new(crate::security::SecurityPolicy::default()),
+ std::sync::Arc::new(BrowserClient::new(std::sync::Arc::new(
+ crate::config::Config::default(),
+ ))),
+ 3,
+ );
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_browser()
+ );
}
diff --git a/crates/openhuman-core/src/tools/impl/system/proxy_config.rs b/crates/openhuman-core/src/tools/impl/system/proxy_config.rs
index 30d3075aa2..d9d5559f9a 100644
--- a/crates/openhuman-core/src/tools/impl/system/proxy_config.rs
+++ b/crates/openhuman-core/src/tools/impl/system/proxy_config.rs
@@ -1,8 +1,8 @@
-use crate::tools::schema_cache::static_schema;
use crate::config::{
runtime_proxy_config, set_runtime_proxy_config, Config, ProxyConfig, ProxyScope,
};
use crate::security::SecurityPolicy;
+use crate::tools::schema_cache::static_schema;
use crate::util::MaybeSet;
use async_trait::async_trait;
use serde_json::{json, Value};
diff --git a/crates/openhuman-core/src/tools/impl/system/proxy_config_schema_tests.rs b/crates/openhuman-core/src/tools/impl/system/proxy_config_schema_tests.rs
index d0388e6b84..fde492121e 100644
--- a/crates/openhuman-core/src/tools/impl/system/proxy_config_schema_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/proxy_config_schema_tests.rs
@@ -3,57 +3,63 @@ use serde_json::json;
fn expected_proxy_config() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "action": {
- "type": "string",
- "enum": ["get", "set", "disable", "list_services", "apply_env", "clear_env"],
- "default": "get"
- },
- "enabled": {
- "type": "boolean",
- "description": "Enable or disable proxy"
- },
- "scope": {
- "type": "string",
- "description": "Proxy scope: environment | openhuman | services"
- },
- "http_proxy": {
- "type": ["string", "null"],
- "description": "HTTP proxy URL"
- },
- "https_proxy": {
- "type": ["string", "null"],
- "description": "HTTPS proxy URL"
- },
- "all_proxy": {
- "type": ["string", "null"],
- "description": "Fallback proxy URL for all protocols"
- },
- "no_proxy": {
- "description": "Comma-separated string or array of NO_PROXY entries",
- "oneOf": [
- {"type": "string"},
- {"type": "array", "items": {"type": "string"}}
- ]
- },
- "services": {
- "description": "Comma-separated string or array of service selectors used when scope=services",
- "oneOf": [
- {"type": "string"},
- {"type": "array", "items": {"type": "string"}}
- ]
- },
- "clear_env": {
- "type": "boolean",
- "description": "When action=disable, clear process proxy environment variables"
- }
+ "type": "object",
+ "properties": {
+ "action": {
+ "type": "string",
+ "enum": ["get", "set", "disable", "list_services", "apply_env", "clear_env"],
+ "default": "get"
+ },
+ "enabled": {
+ "type": "boolean",
+ "description": "Enable or disable proxy"
+ },
+ "scope": {
+ "type": "string",
+ "description": "Proxy scope: environment | openhuman | services"
+ },
+ "http_proxy": {
+ "type": ["string", "null"],
+ "description": "HTTP proxy URL"
+ },
+ "https_proxy": {
+ "type": ["string", "null"],
+ "description": "HTTPS proxy URL"
+ },
+ "all_proxy": {
+ "type": ["string", "null"],
+ "description": "Fallback proxy URL for all protocols"
+ },
+ "no_proxy": {
+ "description": "Comma-separated string or array of NO_PROXY entries",
+ "oneOf": [
+ {"type": "string"},
+ {"type": "array", "items": {"type": "string"}}
+ ]
+ },
+ "services": {
+ "description": "Comma-separated string or array of service selectors used when scope=services",
+ "oneOf": [
+ {"type": "string"},
+ {"type": "array", "items": {"type": "string"}}
+ ]
+ },
+ "clear_env": {
+ "type": "boolean",
+ "description": "When action=disable, clear process proxy environment variables"
}
- })
+ }
+ })
}
#[test]
fn proxy_config_static_schema_matches_json_literal() {
- let tool = ProxyConfigTool::new(std::sync::Arc::new(crate::config::Config::default()), std::sync::Arc::new(crate::security::SecurityPolicy::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_proxy_config());
+ let tool = ProxyConfigTool::new(
+ std::sync::Arc::new(crate::config::Config::default()),
+ std::sync::Arc::new(crate::security::SecurityPolicy::default()),
+ );
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_proxy_config()
+ );
}
diff --git a/crates/openhuman-core/src/tools/impl/system/schedule.rs b/crates/openhuman-core/src/tools/impl/system/schedule.rs
index ee6d069a32..fd258d1660 100644
--- a/crates/openhuman-core/src/tools/impl/system/schedule.rs
+++ b/crates/openhuman-core/src/tools/impl/system/schedule.rs
@@ -1,9 +1,9 @@
-use crate::tools::schema_cache::static_schema;
use crate::config::Config;
use crate::cron::job_builder::{create_agent_job, AgentJobInput};
use crate::cron::origin::{current_job_origin, current_turn_may_skip_approval};
use crate::cron::{self, Schedule};
use crate::security::SecurityPolicy;
+use crate::tools::schema_cache::static_schema;
use anyhow::Result;
use async_trait::async_trait;
use chrono::{DateTime, Utc};
diff --git a/crates/openhuman-core/src/tools/impl/system/schedule_schema_tests.rs b/crates/openhuman-core/src/tools/impl/system/schedule_schema_tests.rs
index 2661ef45c1..7e28bc4e90 100644
--- a/crates/openhuman-core/src/tools/impl/system/schedule_schema_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/schedule_schema_tests.rs
@@ -3,48 +3,54 @@ use serde_json::json;
fn expected_schedule() -> serde_json::Value {
json!({
- "type": "object",
- "properties": {
- "action": {
- "type": "string",
- "enum": ["create", "add", "once", "list", "get", "cancel", "remove", "pause", "resume"],
- "description": "Action to perform"
- },
- "expression": {
- "type": "string",
- "description": "Cron expression for recurring tasks (e.g. '*/5 * * * *')."
- },
- "delay": {
- "type": "string",
- "description": "Delay for one-shot tasks (e.g. '30m', '2h', '1d')."
- },
- "run_at": {
- "type": "string",
- "description": "Absolute RFC3339 time for one-shot tasks (e.g. '2030-01-01T00:00:00Z')."
- },
- "command": {
- "type": "string",
- "description": "Shell command to execute. Use 'command' for shell jobs OR 'prompt' for agent jobs."
- },
- "prompt": {
- "type": "string",
- "description": "Agent prompt for recurring agent tasks (e.g. reminders, briefings). Use this instead of 'command' for user-facing notifications."
- },
- "name": {
- "type": "string",
- "description": "Short human-readable name for the job (e.g. 'drink_water_reminder'). Always provide a name."
- },
- "id": {
- "type": "string",
- "description": "Task ID. Required for get/cancel/remove/pause/resume."
- }
+ "type": "object",
+ "properties": {
+ "action": {
+ "type": "string",
+ "enum": ["create", "add", "once", "list", "get", "cancel", "remove", "pause", "resume"],
+ "description": "Action to perform"
},
- "required": ["action"]
- })
+ "expression": {
+ "type": "string",
+ "description": "Cron expression for recurring tasks (e.g. '*/5 * * * *')."
+ },
+ "delay": {
+ "type": "string",
+ "description": "Delay for one-shot tasks (e.g. '30m', '2h', '1d')."
+ },
+ "run_at": {
+ "type": "string",
+ "description": "Absolute RFC3339 time for one-shot tasks (e.g. '2030-01-01T00:00:00Z')."
+ },
+ "command": {
+ "type": "string",
+ "description": "Shell command to execute. Use 'command' for shell jobs OR 'prompt' for agent jobs."
+ },
+ "prompt": {
+ "type": "string",
+ "description": "Agent prompt for recurring agent tasks (e.g. reminders, briefings). Use this instead of 'command' for user-facing notifications."
+ },
+ "name": {
+ "type": "string",
+ "description": "Short human-readable name for the job (e.g. 'drink_water_reminder'). Always provide a name."
+ },
+ "id": {
+ "type": "string",
+ "description": "Task ID. Required for get/cancel/remove/pause/resume."
+ }
+ },
+ "required": ["action"]
+ })
}
#[test]
fn schedule_static_schema_matches_json_literal() {
- let tool = ScheduleTool::new(std::sync::Arc::new(crate::security::SecurityPolicy::default()), crate::config::Config::default());
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_schedule());
+ let tool = ScheduleTool::new(
+ std::sync::Arc::new(crate::security::SecurityPolicy::default()),
+ crate::config::Config::default(),
+ );
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_schedule()
+ );
}
diff --git a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs b/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs
index df3a5a6872..5db1c32622 100644
--- a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs
+++ b/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs
@@ -141,7 +141,9 @@ impl Tool for AudioGenerateAndEmailPodcastTool {
}
fn parameters_schema(&self) -> serde_json::Value {
- static_schema!(include_str!("parameters/audio_generate_and_email_podcast.json"))
+ static_schema!(include_str!(
+ "parameters/audio_generate_and_email_podcast.json"
+ ))
}
fn permission_level(&self) -> PermissionLevel {
diff --git a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast_schema_tests.rs b/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast_schema_tests.rs
index 122e3da928..0671220861 100644
--- a/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast_schema_tests.rs
+++ b/crates/openhuman-core/src/voice/audio_toolkit/tools/podcast_schema_tests.rs
@@ -3,25 +3,31 @@ use serde_json::json;
fn expected_audio_generate_and_email_podcast() -> serde_json::Value {
json!({
- "type": "object",
- "required": ["text", "to", "subject", "body"],
- "properties": {
- "text": { "type": "string", "description": "Text to synthesize into audio." },
- "to": { "type": "string", "description": "Recipient email address." },
- "subject": { "type": "string", "description": "Email subject line." },
- "body": { "type": "string", "description": "Email body text." },
- "title": { "type": "string", "description": "Optional title used in the default file name." },
- "output_path": { "type": "string", "description": "Optional workspace-relative output path." },
- "provider": { "type": "string", "description": "Optional TTS provider override (`cloud` or `piper`)." },
- "voice": { "type": "string", "description": "Optional voice id for the chosen provider." },
- "format": { "type": "string", "enum": ["mp3", "wav"], "description": "Desired audio format." },
- "attachment_name": { "type": "string", "description": "Optional attachment file name override." }
- }
- })
+ "type": "object",
+ "required": ["text", "to", "subject", "body"],
+ "properties": {
+ "text": { "type": "string", "description": "Text to synthesize into audio." },
+ "to": { "type": "string", "description": "Recipient email address." },
+ "subject": { "type": "string", "description": "Email subject line." },
+ "body": { "type": "string", "description": "Email body text." },
+ "title": { "type": "string", "description": "Optional title used in the default file name." },
+ "output_path": { "type": "string", "description": "Optional workspace-relative output path." },
+ "provider": { "type": "string", "description": "Optional TTS provider override (`cloud` or `piper`)." },
+ "voice": { "type": "string", "description": "Optional voice id for the chosen provider." },
+ "format": { "type": "string", "enum": ["mp3", "wav"], "description": "Desired audio format." },
+ "attachment_name": { "type": "string", "description": "Optional attachment file name override." }
+ }
+ })
}
#[test]
fn audio_generate_and_email_podcast_static_schema_matches_json_literal() {
- let tool = AudioGenerateAndEmailPodcastTool::new(std::sync::Arc::new(crate::config::Config::default()), std::sync::Arc::new(crate::security::SecurityPolicy::default()));
- assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_audio_generate_and_email_podcast());
+ let tool = AudioGenerateAndEmailPodcastTool::new(
+ std::sync::Arc::new(crate::config::Config::default()),
+ std::sync::Arc::new(crate::security::SecurityPolicy::default()),
+ );
+ assert_eq!(
+ tinytools::Tool::parameters_schema(&tool),
+ expected_audio_generate_and_email_podcast()
+ );
}