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(composio): add catalog descriptions and run contract tests
Steven Enamakela8a2f9e8a8fe
diff --git a/crates/openhuman-core/src/channels/tests/common.rs b/crates/openhuman-core/src/channels/tests/common.rsindex aea1adb68a..fe834c7902 100644--- a/crates/openhuman-core/src/channels/tests/common.rs+++ b/crates/openhuman-core/src/channels/tests/common.rs@@ -1,5 +1,4 @@use crate::channels::{traits, Channel, SendMessage};-use crate::memory::{Memory, MemoryCategory, MemoryEntry};use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};use std::time::Duration;@@ -351,64 +350,6 @@ impl Tool for MockPriceTool {}}-pub(super) struct NoopMemory;--#[async_trait::async_trait]-impl Memory for NoopMemory {- fn name(&self) -> &str {- "noop"- }-- async fn store(- &self,- _namespace: &str,- _key: &str,- _content: &str,- _category: MemoryCategory,- _session_id: Option<&str>,- ) -> anyhow::Result<()> {- Ok(())- }-- async fn recall(- &self,- _query: &str,- _limit: usize,- _opts: crate::memory::RecallOpts<'_>,- ) -> anyhow::Result<Vec<MemoryEntry>> {- Ok(Vec::new())- }-- async fn get(&self, _namespace: &str, _key: &str) -> anyhow::Result<Option<MemoryEntry>> {- Ok(None)- }-- async fn list(- &self,- _namespace: Option<&str>,- _category: Option<&MemoryCategory>,- _session_id: Option<&str>,- ) -> anyhow::Result<Vec<MemoryEntry>> {- Ok(Vec::new())- }-- async fn forget(&self, _namespace: &str, _key: &str) -> anyhow::Result<bool> {- Ok(false)- }-- async fn namespace_summaries(&self) -> anyhow::Result<Vec<crate::memory::NamespaceSummary>> {- Ok(Vec::new())- }-- async fn count(&self) -> anyhow::Result<usize> {- Ok(0)- }-- async fn health_check(&self) -> bool {- true- }-}-pub(super) struct AlwaysFailChannel {pub(super) name: &'static str,pub(super) calls: Arc<AtomicUsize>,diff --git a/crates/openhuman-core/src/channels/tests/mod.rs b/crates/openhuman-core/src/channels/tests/mod.rsindex 526f377db3..d94eab8192 100644--- a/crates/openhuman-core/src/channels/tests/mod.rs+++ b/crates/openhuman-core/src/channels/tests/mod.rs@@ -9,18 +9,15 @@//! `IterativeToolModel`, `HistoryCaptureModel`, `ModelCaptureModel`), fake//! `Channel` implementations that record sends or always fail//! (`RecordingChannel`, `TelegramRecordingChannel`, `AlwaysFailChannel`), a-//! `NoopMemory`, a `MockPriceTool`, `make_workspace` for identity-file+//! `MockPriceTool`, `make_workspace` for identity-file//! fixtures, and a re-export of `agent::bus::use_real_agent_handler`.//!//! * `discord_integration.rs` — end-to-end dispatch through the Discord-//! channel with every cross-module boundary (agent runtime, memory,-//! provider) substituted, proving the domain stays encapsulated.+//! channel with every cross-module boundary (agent runtime, provider) substituted, proving the domain stays encapsulated.//! * `health.rs` — `spawn_supervised_listener` marking a component errored and restarting//! when a listener keeps failing.//! * `identity.rs` — `build_system_prompt` inlining workspace identity//! markdown into the Project Context section.-//! * `memory.rs` — conversation-history and memory-context wiring through-//! `process_channel_message`.//! * `prompt.rs` — system-prompt section assembly and bootstrap truncation.//! * `runtime_dispatch.rs` — the dispatch loop through//! `runtime::test_support::run_dispatch_harness`: inbound-envelope@@ -36,7 +33,6 @@ mod common;mod discord_integration;mod health;mod identity;-mod memory;mod prompt;mod runtime_dispatch;mod runtime_tool_calls;diff --git a/crates/openhuman-core/src/integrations/composio/contract/catalogs/descriptions.rs b/crates/openhuman-core/src/integrations/composio/contract/catalogs/descriptions.rsindex 676743f834..9a2c5aaeb8 100644--- a/crates/openhuman-core/src/integrations/composio/contract/catalogs/descriptions.rs+++ b/crates/openhuman-core/src/integrations/composio/contract/catalogs/descriptions.rs@@ -64,8 +64,3 @@ pub fn toolkit_description(slug: &str) -> &'static str {_ => "Interact with this connected service via its available actions",}}---#[cfg(test)]-#[path = "descriptions_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/integrations/composio/contract/catalogs/descriptions_tests.rs b/crates/openhuman-core/src/integrations/composio/contract/catalogs/descriptions_tests.rsdeleted file mode 100644index 144e954b9d..0000000000--- a/crates/openhuman-core/src/integrations/composio/contract/catalogs/descriptions_tests.rs+++ /dev/null@@ -1,61 +0,0 @@-//! Tests for the surrounding module.-#![allow(clippy::expect_used, clippy::unwrap_used, clippy::panic)]--use super::*;--/// Every action slug these notes tell the model to call must be one the-/// toolkit actually exposes. A note naming a slug that was renamed or-/// dropped from the curated list is worse than no note: it sends the model-/// after a tool that is not in its list.-#[test]-fn result_notes_only_name_curated_action_slugs() {- // Each toolkit is checked against its OWN catalogue. Pooling them would- // let a Gmail note name a Slack-only action and still pass, which is the- // mistake most likely to be made when editing prose that mentions both.- let gmail: Vec<&str> = crate::integrations::composio::contract::catalogs::gmail::GMAIL_CURATED- .iter()- .map(|tool| tool.slug)- .collect();- let slack: Vec<&str> = crate::integrations::composio::contract::catalogs::messaging::SLACK_CURATED- .iter()- .map(|tool| tool.slug)- .collect();-- for (slug, curated) in [("gmail", &gmail), ("slack", &slack)] {- let notes = toolkit_result_notes(slug).expect("both toolkits have notes");- for word in notes.split(|c: char| !(c.is_ascii_uppercase() || c == '_')) {- // An all-caps underscored token in this prose is an action slug.- if word.len() > 6 && word.contains('_') {- assert!(- curated.contains(&word),- "{slug} notes name `{word}`, which is not one of {slug}'s curated actions"- );- }- }- }-}--/// A toolkit nobody has established a result shape for gets no entry — a-/// guess about a response is worse here than silence.-#[test]-fn result_notes_absent_for_unestablished_toolkits() {- assert!(toolkit_result_notes("notion").is_none());- assert!(toolkit_result_notes("definitely_not_a_toolkit").is_none());-}--/// The failure this entry exists for: a sub-agent searched threads, got-/// snippets rather than bodies, and reported that mail which does exist-/// could not be found. The note has to name both halves — that a thread-/// listing has no body, and which action produces one.-#[test]-fn gmail_notes_separate_finding_a_thread_from_reading_it() {- let notes = toolkit_result_notes("gmail").expect("gmail has notes");- assert!(- notes.contains("GMAIL_LIST_THREADS") && notes.contains("never a message body"),- "must say a thread listing carries no body: {notes}"- );- assert!(- notes.contains("GMAIL_FETCH_MESSAGE_BY_THREAD_ID"),- "must name the action that reads the thread: {notes}"- );-}diff --git a/crates/openhuman-core/src/integrations/composio/contract/mod.rs b/crates/openhuman-core/src/integrations/composio/contract/mod.rsindex e15396de23..17b0ccf9c0 100644--- a/crates/openhuman-core/src/integrations/composio/contract/mod.rs+++ b/crates/openhuman-core/src/integrations/composio/contract/mod.rs@@ -1,7 +1,7 @@//! The Composio vocabulary the host's integration code shares: toolkit//! catalogs (curated action lists and descriptions), connected-identity-//! profiles, per-toolkit user scope preferences, provider sync bookkeeping and-//! the normalised task shape.+//! profiles, per-toolkit user scope preferences, sync run shapes and the+//! normalised task shape.//!//! These types used to be part of TinyMemory's v1 bus contract, which carried//! them only because the memory engine ran Composio syncs. Memory v2 does not,@@ -12,27 +12,20 @@ pub mod catalogs;pub mod profile;pub mod runs;pub mod scopes;-pub mod state;pub mod tasks;pub use profile::{canonicalize, normalize_connection_identifier, render_connected_identities_section,ConnectedIdentity, IdentityKind, ProviderUserProfile,};-pub use runs::{ComposioUsage, ComposioUsageHandle, SyncOutcome, SyncReason};+pub use runs::{SyncOutcome, SyncReason};pub use scopes::{agent_ready_toolkits, classify_unknown, find_curated, toolkit_from_slug, CuratedTool,ToolScope, UserScopePref,};-pub use state::{- extract_item_id, DailyBudget, SyncState, DEFAULT_DAILY_REQUEST_LIMIT, KV_NAMESPACE,- STATE_NAMESPACE,-};pub use tasks::{GithubFetchMode, NormalizedTask, TaskContainer, TaskFetchFilter, TaskKind};pub use catalogs::{catalog_for_toolkit, curated_scope_for, has_native_provider, is_action_visible_with_pref,- native_provider_sync_interval_secs, parse_sync_interval_override, sync_interval_env_var,- toolkit_description, toolkit_has_scope, toolkit_result_notes, CAPABILITY_TOOLKITS,- NATIVE_PROVIDERS,+ toolkit_description, NATIVE_PROVIDERS,};diff --git a/crates/openhuman-core/src/integrations/composio/contract/runs.rs b/crates/openhuman-core/src/integrations/composio/contract/runs.rsindex 91c3821399..d4eb967fb6 100644--- a/crates/openhuman-core/src/integrations/composio/contract/runs.rs+++ b/crates/openhuman-core/src/integrations/composio/contract/runs.rs@@ -1,16 +1,8 @@-//! What one provider sync run was for, what it cost, and what it produced.+//! What one `composio_sync` run was for, and what it reported.//!-//! Three shapes, read in three different places: [`SyncReason`] is an *input* a-//! provider branches on (backfill everything, or pull since the cursor),-//! [`ComposioUsage`] is a running tally the execute chokepoint accumulates, and-//! [`SyncOutcome`] is the *report* a finished run hands back for the status-//! panel and the sync audit log.-//!-//! All three are serde shapes with no behaviour beyond arithmetic. The run-//! itself — the HTTP calls, the ingestion, the audit-log write — is the engine-//! crate's.--use std::sync::{Arc, Mutex};+//! [`SyncReason`] is the run's trigger, passed to the connector module;+//! [`SyncOutcome`] is the `openhuman.composio_sync` reply. Both are serde+//! shapes with no behaviour.use serde::{Deserialize, Serialize};@@ -69,43 +61,6 @@ pub struct SyncOutcome {pub details: serde_json::Value,}-impl SyncOutcome {- /// How long the run took, in milliseconds.- ///- /// Saturating rather than panicking: the two timestamps come from separate- /// clock reads and a backwards system-clock adjustment between them would- /// otherwise take a status panel down over a cosmetic number.- pub fn elapsed_ms(&self) -> u64 {- self.finished_at_ms.saturating_sub(self.started_at_ms)- }-}--/// Per-sync accumulator for Composio billable-action usage.-///-/// Lives behind a shared handle on the provider context so the single `execute`-/// chokepoint can tally every action a provider fires during one run, whichever-/// provider it is and however many pages it paginates. The finished tally is-/// reported alongside the [`SyncOutcome`] for the sync audit log.-#[derive(Debug, Clone, Default, Serialize, Deserialize)]-pub struct ComposioUsage {- /// Count of `execute` calls that returned a response this run.- ///- /// A provider-reported failure still counts — it reached Composio and was- /// billed. Transport errors do not.- pub actions_called: u32,- /// Sum of each response's backend-reported `cost_usd`.- pub cost_usd: f64,-}--/// Shared, interior-mutable handle to a [`ComposioUsage`] tally.-///-/// Cloning a provider context shares the same underlying counter, so the count-/// is stable no matter how the context is passed around within one sync.-///-/// A `std` `Mutex` rather than an async one on purpose: the lock is taken for a-/// single increment and never held across an `await`, and this crate carries no-/// async runtime to borrow one from.-pub type ComposioUsageHandle = Arc<Mutex<ComposioUsage>>;#[cfg(test)]#[path = "runs_tests.rs"]