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
fix(json_schema): handle optional fields in composio tool contracts
Steven Enamakel498d8f612697
diff --git a/crates/openhuman-core/src/flows/ops/tool_contract_gate.rs b/crates/openhuman-core/src/flows/ops/tool_contract_gate.rsindex d1f633bcef..53d11f5e1f 100644--- a/crates/openhuman-core/src/flows/ops/tool_contract_gate.rs+++ b/crates/openhuman-core/src/flows/ops/tool_contract_gate.rs@@ -58,9 +58,8 @@ pub(crate) fn toolkit_has_curated_catalog(toolkit: &str) -> bool {}pub(crate) async fn validate_tool_contracts(config: &Config, graph: &WorkflowGraph) -> Vec<String> {- use crate::flows::tinyflows::caps::{- fetch_live_toolkit_catalog, missing_required_args, unsupported_arg_names,- };+ use crate::flows::tinyflows::caps::fetch_live_toolkit_catalog;+ use tinyagents_harness::tool::{missing_required_args, unsupported_arg_names};use tinymemory_api::composio::toolkit_from_slug;let mut errors = Vec::new();diff --git a/crates/openhuman-core/src/flows/ops/wiring_warnings.rs b/crates/openhuman-core/src/flows/ops/wiring_warnings.rsindex a4042cd123..e1765cf8d1 100644--- a/crates/openhuman-core/src/flows/ops/wiring_warnings.rs+++ b/crates/openhuman-core/src/flows/ops/wiring_warnings.rs@@ -11,7 +11,8 @@ use super::*;/// Composio schema). Best-effort like the runtime preflight — no schema, no/// warning, never a block.pub(crate) async fn graph_wiring_warnings(config: &Config, graph: &WorkflowGraph) -> Vec<String> {- use crate::flows::tinyflows::caps::{composio_required_args, missing_required_args};+ use crate::flows::tinyflows::caps::composio_required_args;+ use tinyagents_harness::tool::missing_required_args;let mut warnings = Vec::new();for node in &graph.nodes {diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rsindex d0945daee3..bd1ad10073 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs@@ -33,13 +33,6 @@ use crate::security::{CommandClass, SecurityPolicy};#[cfg(test)]use crate::security::{GateDecision, POLICY_BLOCKED_MARKER};-// The JSON Schema walkers moved to `openhuman::json_schema`, a domain owned by-// neither this seam nor `composio` — see that module's docs for why neutral-// ownership is load-bearing rather than tidiness.-//-// Re-exported so `crate::flows::tinyflows::caps::<fn>` keeps resolving for-// the callers outside this module (`flows::ops`, `tinyflows::tests`) — the-// relocation is an internal reorganization, not an API change.// The live Composio catalog and probe moved to `composio::catalog` -- the domain// that owns Composio's vocabulary. This import is the edge pointing the right// way round: the feature-gated seam depends on the always-compiled domain, not@@ -57,9 +50,7 @@ pub(crate) use crate::integrations::composio::catalog::{use super::*;-#[cfg(test)]-pub(crate) use crate::json_schema::response_fields_from_schema;-pub(crate) use crate::json_schema::{missing_required_args, unsupported_arg_names};+use tinyagents_harness::tool::missing_required_args;/// Parses a `"composio:<toolkit>:<connection_id>"` `connection_ref` (see the/// node catalog, `my_docs/ohxtf/commons/12-node-catalog-0.2.md`) and returnsdiff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rsindex 28caf87749..c9131a249a 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs@@ -1,4 +1,5 @@use super::*;+use tinyagents_harness::tool::response_fields_from_schema;/// The tier gate an `http_request` (Network-class) node calls: BLOCKED under/// a read-only tier, and passed through (to the ApprovalGate) underdiff --git a/crates/openhuman-core/src/integrations/composio/catalog/contract.rs b/crates/openhuman-core/src/integrations/composio/catalog/contract.rsindex 0ef213af28..1ed929b601 100644--- a/crates/openhuman-core/src/integrations/composio/catalog/contract.rs+++ b/crates/openhuman-core/src/integrations/composio/catalog/contract.rs@@ -11,7 +11,7 @@ use crate::integrations::composio::client::{};use crate::integrations::composio::module_client::{self as connectors, methods};use crate::integrations::composio::types::{ComposioListToolsRequest, ComposioToolsResponse};-use crate::json_schema::{compute_primary_array_path, response_fields_from_schema};+use tinyagents_harness::tool::{compute_primary_array_path, response_fields_from_schema};/// One Composio action's LIVE, ground-truth contract — the source of truth/// [Part 1 of the systemic tool-contract fix] grounds the Workflow builderdiff --git a/crates/openhuman-core/src/integrations/composio/catalog/probe.rs b/crates/openhuman-core/src/integrations/composio/catalog/probe.rsindex ab934380ec..1e43885c96 100644--- a/crates/openhuman-core/src/integrations/composio/catalog/probe.rs+++ b/crates/openhuman-core/src/integrations/composio/catalog/probe.rs@@ -10,7 +10,7 @@ use serde_json::Value;use super::contract::COMPOSIO_CATALOG_CACHE_TTL;use super::contract::{CacheEntry, ToolContract};use crate::config::Config;-use crate::json_schema::compute_primary_array_path_from_value;+use tinyagents_harness::tool::compute_primary_array_path_from_value;// ─────────────────────────────────────────────────────────────────────────────// Real-output probe (systemic tool-contract fix, Part 3 / B12)diff --git a/crates/openhuman-core/src/integrations/composio/catalog_tests.rs b/crates/openhuman-core/src/integrations/composio/catalog_tests.rsindex 2b96a5d688..7c91c6105c 100644--- a/crates/openhuman-core/src/integrations/composio/catalog_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/catalog_tests.rs@@ -7,7 +7,7 @@//! a foreign test can call it would leak implementation surface to the whole//! crate to satisfy a test.-use crate::json_schema::compute_primary_array_path_from_value;+use tinyagents_harness::tool::compute_primary_array_path_from_value;// `super` is `catalog` itself — this file is included as its child module — so// the glob reaches its private helpers as well as its imports.use super::*;diff --git a/crates/openhuman-core/src/json_schema/mod.rs b/crates/openhuman-core/src/json_schema/mod.rsdeleted file mode 100644index 7693646052..0000000000--- a/crates/openhuman-core/src/json_schema/mod.rs+++ /dev/null@@ -1,46 +0,0 @@-//! Vendor-neutral JSON Schema and JSON value walking.-//!-//! These five helpers answer questions about a tool's shape — where its primary-//! array lives, what fields its response declares, which required arguments are-//! missing, which supplied argument names the schema does not recognize — using-//! nothing but JSON Schema and `serde_json::Value`.-//!-//! # Why this is its own domain, owned by neither caller-//!-//! Both sides of the integration seam need these. The capability adapters use-//! them to describe a `tool_call` node's output to an authoring agent, and the-//! integration catalog uses them to derive a tool contract from a published-//! schema or a probed response.-//!-//! Putting them on either side forces a dependency edge from the other, and one-//! of those two directions is precisely the back-edge that has to go: an-//! always-compiled integration domain must not reach into a feature-gated-//! adapter seam, or the adapter cannot be gated off at all. Neutral ownership-//! is what makes both edges point inward here instead of at each other.-//!-//! It is also why this module is ungated. The integration domain is always-//! compiled; the adapter seam is behind `flows`. A shared dependency has to-//! survive the stricter of the two.-//!-//! # The rule for this file (and [`ops`])-//!-//! **Nothing here may name a vendor** — not a provider, not a tool-slug prefix,-//! not a response-envelope field. The one piece of provider knowledge these-//! walks legitimately need — which root keys belong to a response envelope-//! rather than the tool's own payload — is a **parameter**-//! ([`compute_primary_array_path_from_value`]'s `skip_root_keys`), supplied by-//! the caller that owns that knowledge.-//!-//! This is mechanically enforced: a case-insensitive grep for a provider name-//! over this file and [`ops`] must return nothing. Keeping the rule greppable-//! is the reason this doc states it without naming one.--mod ops;-#[cfg(test)]-mod ops_tests;--pub(crate) use ops::{- compute_primary_array_path, compute_primary_array_path_from_value, response_fields_from_schema,-};-#[cfg(any(feature = "flows", test))]-pub(crate) use ops::{missing_required_args, unsupported_arg_names};diff --git a/crates/openhuman-core/src/json_schema/ops.rs b/crates/openhuman-core/src/json_schema/ops.rsdeleted file mode 100644index 5fe5526504..0000000000--- a/crates/openhuman-core/src/json_schema/ops.rs+++ /dev/null@@ -1,8 +0,0 @@-//! Business logic for [`super`] lives in `tinyagents-harness`-//! (`tool::schema_walk`); this module only re-exports it under the names the-//! host's callers already use. See [`super`] for why this domain is neutral.--pub(crate) use tinyagents_harness::tool::{- compute_primary_array_path, compute_primary_array_path_from_value, missing_required_args,- response_fields_from_schema, unsupported_arg_names,-};diff --git a/crates/openhuman-core/src/json_schema/ops_tests.rs b/crates/openhuman-core/src/json_schema/ops_tests.rsdeleted file mode 100644index 49b8db8e6f..0000000000--- a/crates/openhuman-core/src/json_schema/ops_tests.rs+++ /dev/null@@ -1,91 +0,0 @@-use super::*;-use serde_json::{json, Value};--#[test]-fn unsupported_arg_names_empty_when_every_name_is_a_real_property() {- let schema = json!({- "type": "object",- "properties": { "channel": {"type": "string"}, "markdown_text": {"type": "string"} }- });- let args = json!({ "channel": "#general", "markdown_text": "hi" });- assert_eq!(unsupported_arg_names(Some(&schema), &args), Some(vec![]));-}--#[test]-fn unsupported_arg_names_skips_when_schema_is_none() {- let args = json!({ "anything": "goes" });- assert_eq!(unsupported_arg_names(None, &args), None);-}--#[test]-fn unsupported_arg_names_skips_when_schema_has_no_properties_object() {- // Legacy/loose schema shape (no `properties` map at all) — nothing to- // validate names against, so this must skip, not reject.- let schema = json!({ "type": "object", "description": "legacy shape" });- let args = json!({ "anything": "goes" });- assert_eq!(unsupported_arg_names(Some(&schema), &args), None);-}--#[test]-fn unsupported_arg_names_empty_for_null_or_non_object_args() {- let schema = json!({- "type": "object",- "properties": { "channel": {"type": "string"} }- });- assert_eq!(- unsupported_arg_names(Some(&schema), &Value::Null),- Some(vec![])- );- assert_eq!(- unsupported_arg_names(Some(&schema), &json!("not an object")),- Some(vec![])- );-}--#[test]-fn compute_primary_array_path_finds_a_top_level_array_property() {- let schema = json!({- "type": "object",- "properties": { "items": { "type": "array" }, "count": { "type": "integer" } }- });- assert_eq!(- compute_primary_array_path(Some(&schema)),- Some("items".to_string())- );-}--#[test]-fn compute_primary_array_path_finds_a_nested_array_property() {- // Gmail-shaped: the array lives two levels down, under `data.messages`.- let schema = json!({- "type": "object",- "properties": {- "data": {- "type": "object",- "properties": {- "messages": { "type": "array" },- "nextPageToken": { "type": "string" }- }- }- }- });- assert_eq!(- compute_primary_array_path(Some(&schema)),- Some("data.messages".to_string())- );-}--#[test]-fn compute_primary_array_path_none_when_absent_or_no_array_property() {- assert_eq!(compute_primary_array_path(None), None);- assert_eq!(- compute_primary_array_path(Some(&json!({ "type": "object" }))),- None- );- assert_eq!(- compute_primary_array_path(Some(- &json!({ "type": "object", "properties": { "id": { "type": "string" } } })- )),- None- );-}diff --git a/crates/openhuman-core/src/lib.rs b/crates/openhuman-core/src/lib.rsindex c7c2efd653..26fb25f118 100644--- a/crates/openhuman-core/src/lib.rs+++ b/crates/openhuman-core/src/lib.rs@@ -67,7 +67,6 @@ pub mod hooks;pub mod hosting;pub mod inference;pub mod integrations;-pub mod json_schema;pub mod mcp;#[cfg(feature = "media")]pub mod media;