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: files changed CONTRIBUTING.md,crates/openhuman-core/src/api/models/mod.rs,crates/openhuman-co
Steven Enamakela041a3556463
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 8e99df919b..76c99e751b 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -4,7 +4,7 @@ Thank you for your interest in contributing to OpenHuman. This guide is the fast> **New to open source or coding?** Start with [`docs/CONTRIBUTING-BEGINNERS.md`](docs/CONTRIBUTING-BEGINNERS.md) — it walks you through every step from installing tools to opening your first PR.-For deeper architecture and subsystem references, use the GitBook under [`gitbooks/developing/`](gitbooks/developing/). For coding-agent and repository-specific implementation rules, see [`AGENTS.md`](AGENTS.md) and [`CLAUDE.md`](CLAUDE.md).+For deeper architecture and subsystem references, use the GitBook under [`gitbooks/developing/`](gitbooks/developing/). For coding-agent and repository-specific implementation rules, see [`AGENTS.md`](AGENTS.md) (`CLAUDE.md` is a symlink to the same file).## Table of Contents@@ -40,9 +40,9 @@ This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDU| pnpm | `[email protected]` from [`package.json`](package.json) | The repo enforces pnpm via the root `packageManager` field. || Rust | `1.96.1` from [`rust-toolchain.toml`](rust-toolchain.toml) | Install with `rustup`; `rustfmt` and `clippy` are required components. || CMake | Current stable | Required by native Rust dependencies such as Whisper bindings. |-| Ninja | Current stable | Required on macOS and Windows to build the bundled CEF helper. CMake delegates the actual compile to Ninja; without it the `cef-dll-sys` build script aborts. |+| Ninja | Current stable | Required on Windows as the CMake generator for native crates built by `scripts/run-dev-win.sh` (e.g. Whisper bindings). || ripgrep (`rg`) | Current stable | Used by the `lint:commands-tokens` pre-push step (scans `app/src/components/commands/`). Without it, `git push` fails the hook with `rg: command not found`. |-| Tauri vendored sources | Git submodules under `crates/openhuman-app/vendor/` | Required for the CEF-aware Tauri CLI and notification plugin patches. |+| Vendored module sources | Git submodules under `vendor/` | The `tiny*` module crates patched into the Rust workspace. Run `git submodule update --init --recursive vendor/` before building. || macOS tools | Xcode Command Line Tools | Needed for local desktop builds on macOS. || Linux desktop packages | System GTK/WebKit/AppIndicator build deps | Install the package set Tauri requires for your distro before attempting desktop builds. |diff --git a/crates/openhuman-core/src/api/models/mod.rs b/crates/openhuman-core/src/api/models/mod.rsindex 321ecbfb76..4ce9243427 100644--- a/crates/openhuman-core/src/api/models/mod.rs+++ b/crates/openhuman-core/src/api/models/mod.rs@@ -1,2 +1,14 @@+//! Serde DTOs mirroring `tinyhumansai/backend` wire payloads.+//!+//! These are wire shapes only — they must track the backend's JSON, not the+//! other way around. Route implementations belong in `vendor/tinyhumans-sdk`,+//! not here.+//!+//! - [`auth`] — auth/session payloads: `Session`, `User`, `AuthErrorResponse`,+//! `AuthState`.+//! - [`socket`] — Socket.IO realtime payloads: `ConnectionStatus`,+//! `SocketState`, `SocketMessage`, and the JSON-RPC 2.0 MCP envelope types+//! `McpRequest` / `McpResponse` / `McpError`.+pub mod auth;pub mod socket;diff --git a/crates/openhuman-core/src/desktop/app_state/README.md b/crates/openhuman-core/src/desktop/app_state/README.mdindex 31aca85e7d..eb576be7a1 100644--- a/crates/openhuman-core/src/desktop/app_state/README.md+++ b/crates/openhuman-core/src/desktop/app_state/README.md@@ -23,7 +23,7 @@ Aggregator that the React shell polls every few seconds to render the OS-level c## Called by-- `crates/openhuman-core/src/agent/harness/session/builder.rs` — agent builder reads cached app state when resolving identity.+- `crates/openhuman-core/src/agent/harness/session/builder/factory.rs` — agent builder reads cached app state (`load_stored_app_state`) when resolving identity.- `crates/openhuman-core/src/core/all.rs` — registers `all_app_state_*` controllers; the shell hits these via `core_rpc_relay`.- `app/src/` — Tauri shell consumes the snapshot in its polling loops (out of scope for this README).diff --git a/crates/openhuman-core/src/inference/provider/claude_code/README.md b/crates/openhuman-core/src/inference/provider/claude_code/README.mdindex 095d3f6612..c33511510b 100644--- a/crates/openhuman-core/src/inference/provider/claude_code/README.md+++ b/crates/openhuman-core/src/inference/provider/claude_code/README.md@@ -81,11 +81,11 @@ server side.## Selection-`../factory_part_01.rs` and `../factory_part_02.rs` route a `claude-code:<model>`-provider string to this module wherever the factory needs to special-case CC-alongside `claude_agent_sdk` — e.g. `is_raw_passthrough_model`,-`external_provider_label` (labels it "Claude Code CLI" for Privacy Mode-messages), and the local/cloud/CLI dispatch branch in `create_chat_model*`.+`../factory_part_01.rs` routes a `claude-code:<model>` provider string to this+module wherever the factory needs to special-case CC alongside+`claude_agent_sdk` — e.g. `is_raw_passthrough_model`, `external_provider_label`+(labels it "Claude Code CLI" for Privacy Mode messages), and the+local/cloud/CLI dispatch branch in `create_chat_model*`.`ClaudeCodeProvider::from_env` fails fast with an actionable error when theCLI is missing or below `MIN_CLI_VERSION`.diff --git a/crates/openhuman-core/src/integrations/composio/README.md b/crates/openhuman-core/src/integrations/composio/README.mdindex f5d8746248..b46913757f 100644--- a/crates/openhuman-core/src/integrations/composio/README.md+++ b/crates/openhuman-core/src/integrations/composio/README.md@@ -2,42 +2,100 @@Backend-proxied (and optionally direct/BYO-key) access to Composio's 1000+ OAuth integrations (Gmail, Notion, GitHub, Slack, Google Calendar, …). The Rust counterpart to the backend routes under `src/routes/agentIntegrations/composio.ts`. In **backend mode** the openhuman backend owns the Composio API key, billing/margin, the toolkit allowlist, HMAC webhook verification, and Socket.IO trigger fan-out — the core never hits the Composio API directly. In **direct mode** (`composio.mode = "direct"`, gated by a user-supplied API key in the encrypted keychain) the core talks to Composio's v3 API with the user's own key against their personal tenant. This domain exposes toolkit/connection/tool/trigger management over JSON-RPC, model-facing agent tools for discovery + execution, an OAuth handoff flow, a persistent trigger-event archive, and a per-action execute pipeline (prepare → retry → error classification).+A third path underlies most of the above: profile fetch, action execution,+and sync now go through the loaded `tinyconnectors` module (via+`module_client.rs`) rather than an in-process engine — `tinymemory` v1.13.4+deleted the old in-process Composio pipeline outright (72 files, ~18.3k+lines) because reaching a connected account needs a credential this crate+must not hold. `tinyconnectors-bus` is the wire contract for that module+call; see [Module boundary](#module-boundary) below.+## Responsibilities- List toolkits, connections, agent-ready toolkits, and a local capability matrix.- Begin OAuth handoffs (`authorize`) and delete connections (with optional source-scoped memory cleanup).- Discover Composio action tool schemas (`list_tools`) and execute actions (`execute`), mode-aware over the backend/direct split.- Manage triggers: list available/active, create, enable, disable, plus a persistent trigger-event history archive.-- Fetch normalized per-toolkit user profiles and refresh stored identities; dispatch sync passes to per-toolkit providers.-- Gate agent action visibility/execution by per-toolkit user scope preferences (read/write/admin) and curated catalogs.-- Manage the Composio routing mode and the direct-mode API key (`get_mode` / `set_api_key` / `clear_api_key`).+- Fetch normalized per-toolkit user profiles, persist identity facets, and drive periodic connection sync through the `tinyconnectors` module.+- Gate agent action visibility/execution by per-toolkit user scope preferences (read/write/admin) and curated catalogs sourced from the `tinymemory-api` contract crate.+- Gate late-bound per-action tool calls behind a full live contract on first use (#4853).+- Manage the Composio routing mode and the direct-mode API key (`get_mode` / `set_api_key` / `clear_api_key`), including a BYO-key repeated-401 short-circuit.- Classify execute failures into stable error classes; funnel op-layer errors to Sentry under `domain="composio"`.+## Module boundary++Every Composio operation (profile fetch, action execution, connection sync)+now lives in the `tinyconnectors` module, loaded through `crate::modules`+behind the `modules` feature. `module_client.rs` is the single `#[cfg]`+switch for this: rather than feature-gating each of a dozen handlers+individually — twelve chances to gate one differently, with a gates-off+build failing wherever the compiler happens to hit first — the gate lives+once, here, and every handler reads the same either way.++`tinyconnectors-bus` (`vendor/tinyconnectors/crates/tinyconnectors-bus`,+pinned in `Cargo.toml` ~486–496) supplies the member names+(`module_client::methods`) and payload types with no transport and no+behaviour; it compiles none of the connector itself. A gates-off build can+still name a member and match on the contract, it just cannot call one.+`module_client::is_unsupported_by_route` distinguishes "this route does not+offer this operation" (e.g. direct mode has no webhook endpoint for+triggers) from a real transport failure.+## Key files| File | Role || --- | --- |-| `crates/openhuman-core/src/integrations/composio/mod.rs` | Export-focused module root; re-exports types, ops, schemas, agent tools, trigger-history, and (via `memory_sync::composio`) bus/periodic/providers. |+| `crates/openhuman-core/src/integrations/composio/mod.rs` | Module doc + declarations; re-exports types, ops, schemas, agent tools, trigger-history, and provider/bus types. || `crates/openhuman-core/src/integrations/composio/types.rs` | Serde domain types mirroring backend response envelopes (toolkits, connections, tools, execute, triggers, trigger events/history). Includes drift-tolerant `de_string_or_object` deserializers. |-| `crates/openhuman-core/src/integrations/composio/ops.rs` | RPC-facing `composio_*` operations returning `RpcOutcome<T>`; mode-aware client routing, memory-cleanup targets on delete, provider dispatch for profile/sync, mode + api-key ops, Sentry funnel `report_composio_op_error`. |-| `crates/openhuman-core/src/integrations/composio/schemas.rs` | Controller schemas + `handle_*` handlers; `all_controller_schemas` / `all_registered_controllers`. |-| `crates/openhuman-core/src/integrations/composio/client.rs` | `ComposioClient` (thin HTTP wrapper over `IntegrationClient` for backend routes) + `ComposioClientKind` (Backend/Direct), `create_composio_client`, and direct-mode v3 helpers (`direct_list_connections`, `direct_list_tools`, `direct_execute`, `direct_authorize`). |-| `crates/openhuman-core/src/integrations/composio/tools.rs` | Agent tools (`ComposioListToolkitsTool`, `ComposioListConnectionsTool`, `ComposioAuthorizeTool`, `ComposioListToolsTool`, `ComposioExecuteTool`) + `all_composio_agent_tools`; scope/visibility gating (`resolve_action_scope`, `evaluate_tool_visibility`). |-| `crates/openhuman-core/src/integrations/composio/tools/direct.rs` | Direct-mode Composio tool provider hitting Composio v2/v3 APIs with the user's key (`ComposioTool`, `ComposioAction`, `ComposioConnectedAccount`). |+| `crates/openhuman-core/src/integrations/composio/ops/` | RPC-facing `composio_*` operations returning `RpcOutcome<T>`, split by concern (see [Ops layout](#ops-layout)). |+| `crates/openhuman-core/src/integrations/composio/schemas.rs` + `schemas_part_01.rs`/`_02`/`_03` | Controller schemas + `handle_*` handlers; `all_controller_schemas` / `all_registered_controllers`. |+| `crates/openhuman-core/src/integrations/composio/client.rs` + `client_part_01.rs`/`_02.rs` | `ComposioClient` (thin HTTP wrapper over `IntegrationClient` for backend routes) + `ComposioClientKind` (Backend/Direct), `create_composio_client`, and direct-mode v3 helpers (`direct_list_connections`, `direct_list_tools`, `direct_execute`, `direct_authorize`). |+| `crates/openhuman-core/src/integrations/composio/module_client.rs` | The `tinyconnectors` module bridge: the one `modules`-feature `#[cfg]` switch, `methods` re-exported from `tinyconnectors_bus`, and member-failure classification (`is_unsupported_by_route`, error-prefix peeling). |+| `crates/openhuman-core/src/integrations/composio/tools.rs` + `tools_part_01.rs`/`_02`/`_03` | Agent tools (`ComposioListToolkitsTool`, `ComposioListConnectionsTool`, `ComposioAuthorizeTool`, `ComposioListToolsTool`, `ComposioExecuteTool`) + `all_composio_agent_tools`; scope/visibility gating (`resolve_action_scope`, `evaluate_tool_visibility`). |+| `crates/openhuman-core/src/integrations/composio/tools/direct.rs` + parts | Direct-mode Composio tool provider hitting Composio v2/v3 APIs with the user's key (`ComposioTool`, `ComposioAction`, `ComposioConnectedAccount`). || `crates/openhuman-core/src/integrations/composio/action_tool.rs` | `ComposioActionTool` — a `Tool` wrapping exactly one Composio action, constructed dynamically when `integrations_agent` is spawned with a toolkit. |+| `crates/openhuman-core/src/integrations/composio/contract_gate.rs` | Late-bound action contract gate (#4853): on an action's first call this turn, surfaces the full live contract (via `catalog::fetch_live_toolkit_catalog`) as a recoverable tool error before executing, so the retry has the real schema in context. |+| `crates/openhuman-core/src/integrations/composio/catalog.rs` + `catalog_part_01.rs`/`_02.rs` | Live Composio tool contracts (`fetch_live_toolkit_catalog`, `ToolContract`): Composio's own v3 `/tools` schema plus a bounded read-only response probe (`probe_tool_output_sample`) when a schema publishes no `output_parameters`. |+| `crates/openhuman-core/src/integrations/composio/connected_integrations.rs` + `connected_integrations_part_01.rs`/`_02.rs` | Cached active-connections lookups (`cached_active_integrations`, `fetch_connected_integrations*`, `fetch_toolkit_actions`) reconciled against `list_connections`. || `crates/openhuman-core/src/integrations/composio/execute_dispatch.rs` | Centralized execute path: prepare args → retry policy (auth/rate-limit) → error mapping; mode-aware over backend/direct. || `crates/openhuman-core/src/integrations/composio/execute_prepare.rs` | Local pre-flight argument validation/preparation for action calls. || `crates/openhuman-core/src/integrations/composio/auth_retry.rs` | Single-shot retry for the post-OAuth token-propagation gap ("Connection error, try to authenticate"). || `crates/openhuman-core/src/integrations/composio/error_mapping.rs` | `ComposioErrorClass` + classifier/formatter so tool failures aren't bucketed as generic gateway 502s (#1797). || `crates/openhuman-core/src/integrations/composio/oauth_handoff.rs` | OAuth handoff helpers + Meta (Instagram/Facebook) rate-limit mitigations (#1952); rate-limit error wrapping. || `crates/openhuman-core/src/integrations/composio/googlecalendar_args.rs` | Default-args transformer for Google Calendar list/find slugs (timezone/`singleEvents` defaults, #1714). |-| `crates/openhuman-core/src/integrations/composio/identity.rs` | Resolves the connected account username for a toolkit via the provider `fetch_user_profile` path (used by skill preflight identity gate). |+| `crates/openhuman-core/src/integrations/composio/identity.rs` | Resolves the connected account username for a toolkit via the connector module profile-fetch path (used by skill preflight identity gate). |+| `crates/openhuman-core/src/integrations/composio/identity_store.rs` | Persists Composio-sourced identity facets through the bound memory driver (`MemoryProfile::upsert_provider_facet`); ported from the deleted in-process engine, minus its downstream stability-scoring signal. |+| `crates/openhuman-core/src/integrations/composio/profile_md.rs` | Mirrors managed identity facet blocks into `{workspace_dir}/PROFILE.md` between `<!-- openhuman:<block>:start/end -->` markers, ported verbatim from the deleted engine's `profile_md`. |+| `crates/openhuman-core/src/integrations/composio/task_window.rs` | Recency-window narrowing for Composio task-fetch actions used by `morning_briefing`: best-effort server-side arg injection plus an authoritative client-side post-filter. |+| `crates/openhuman-core/src/integrations/composio/direct_auth/mod.rs` | Direct-mode API-key health tracking: a process-local consecutive-401-failure counter (keyed by a non-logged key fingerprint) that short-circuits repeated invalid-key polling. || `crates/openhuman-core/src/integrations/composio/trigger_history.rs` | Persistent JSONL trigger-event archive partitioned by UTC day; global `OnceLock` store (`init_global`/`global`). |-| `crates/openhuman-core/src/integrations/composio/bus.rs` | Compatibility shim re-exporting `memory_sync::composio::bus`. |-| `crates/openhuman-core/src/integrations/composio/periodic.rs` | Compatibility shim re-exporting `memory_sync::composio::periodic` (periodic sync loop). |-| `crates/openhuman-core/src/integrations/composio/providers/mod.rs` | Compatibility shim re-exporting `memory_sync::composio::providers` (native per-toolkit provider registry, curated catalogs, user-scope prefs). |+| `crates/openhuman-core/src/integrations/composio/bus.rs` | Compatibility shim re-exporting `crate::memory::sync::composio::bus` (trigger/config-change subscribers still live there). |+| `crates/openhuman-core/src/integrations/composio/periodic.rs` | Host-owned periodic connection sync loop. **Not** a shim: it used to re-export the engine's `memory_sync::composio::periodic`, but tinymemory v1.13.4 deleted that module and its would-be replacement in the `tinymemory-module` never materialized, so this file implements the tick loop directly against `ops::run_sync_within_budget`. |+| `crates/openhuman-core/src/integrations/composio/providers/mod.rs` | Two unrelated halves reunified by one former shim: curated catalogs / scope verdicts / identity vocabulary re-exported from the `tinymemory-api` contract crate (pure data, no provider needed), plus this host's own `slack` RPC layer over the connector module. The old `ComposioProvider` trait and provider registry are gone with the deleted engine. || `*_tests.rs` | Sibling test suites for each file. |+## Ops layout++`ops/mod.rs`'s module doc lists the submodule split:++| Sub-module | Contents |+| --- | --- |+| `error_utils` | `OpResult`, `resolve_client`, `report_composio_op_error`, helpers |+| `toolkits` | `composio_list_toolkits`, `composio_list_capabilities`, ... |+| `connections` | `composio_list_connections`, `composio_authorize`, `_delete_...` |+| `memory_cleanup` | Memory-cleanup helpers for connection deletion |+| `tools_ops` | `composio_list_tools` |+| `execute` | `composio_execute` |+| `triggers` | GitHub repos + trigger CRUD + trigger history |+| `providers_ops` | `composio_get_user_profile`, `_refresh_...`, `composio_sync` |+| `direct_mode` | `composio_get_mode`, `composio_set_api_key`, `_clear_...` |+| `user_scopes` | per-toolkit agent scope prefs, over the bound memory driver |++`pass_budget.rs` holds `run_sync_within_budget`, the tinyconnectors-mediated+sync pass shared by every entry point that syncs once per invocation+(periodic tick, manual provider sync, `connection_created`, the Slack ingest+RPC).+## Public surfaceFrom `mod.rs` re-exports:@@ -49,7 +107,8 @@ From `mod.rs` re-exports:- **Identity**: `connection_identity`.- **Trigger history**: `init_composio_trigger_history`, `global_composio_trigger_history`.- **Types**: `ComposioConnection`, `ComposioConnectionsResponse`, `ComposioToolkitsResponse`, `ComposioToolSchema`/`ComposioToolFunction`, `ComposioToolsResponse`, `ComposioAuthorizeResponse`, `ComposioExecuteResponse`, `ComposioDeleteResponse`, `ComposioCapability`/`ComposioCapabilitiesResponse`, `ComposioAgentReadyToolkitsResponse`, `ComposioTriggerEvent`/`ComposioTriggerMetadata`, `ComposioTriggerHistoryEntry`/`ComposioTriggerHistoryResult`.-- **Re-exported from `memory_sync::composio`**: `ComposioProvider`, `ProviderContext`, `ProviderUserProfile`, `SyncOutcome`, `SyncReason`, `all_composio_providers`, `get_composio_provider`, `init_default_composio_providers`; `ComposioTriggerSubscriber`, `ComposioConfigChangedSubscriber`, `register_composio_trigger_subscriber`; `record_sync_success`, `start_periodic_sync`.+- **Periodic sync**: `record_sync_success`, `start_periodic_sync` (from `periodic.rs`, host code — see above).+- **Re-exported from `providers::{ProviderUserProfile, SyncOutcome, SyncReason}`** (contract types, `tinymemory_api::composio`), plus `crate::memory::sync::composio::bus::{register_composio_trigger_subscriber, ComposioConfigChangedSubscriber, ComposioTriggerSubscriber}`.## RPC / controllers@@ -78,43 +137,46 @@ Namespace `composio`, exposed as `openhuman.composio_*`:| `composio.get_mode` | Current routing mode + whether a direct-mode key is set (never returns the key). || `composio.set_api_key` / `composio.clear_api_key` | Store/clear direct-mode Composio API key (key never logged/returned). |-Handlers delegate to `ops.rs`; scope handlers delegate to `providers::user_scopes`. Exports wired into `crates/openhuman-core/src/core/all.rs`.+Handlers delegate to `ops/`; scope handlers delegate to `ops::user_scopes`. Exports wired into `crates/openhuman-core/src/core/all.rs`.## Agent tools-From `tools.rs` (`all_composio_agent_tools`): `composio_list_toolkits`, `composio_list_connections`, `composio_authorize`, `composio_list_tools`, `composio_execute`. Plus `ComposioActionTool` (one tool per action, spawned for `integrations_agent`) and the direct-mode `ComposioTool` provider. Scope elevation is deliberately NOT an agent tool — the user toggles it in the UI. Visibility/execution is gated by curated catalogs + per-toolkit user-scope prefs and sandbox mode; unparseable slugs default to `Write` (fail-closed).+From `tools.rs` (`all_composio_agent_tools`): `composio_list_toolkits`, `composio_list_connections`, `composio_authorize`, `composio_list_tools`, `composio_execute`. Plus `ComposioActionTool` (one tool per action, spawned for `integrations_agent`, gated by `contract_gate.rs` on first call) and the direct-mode `ComposioTool` provider (`tools/direct.rs`). Scope elevation is deliberately NOT an agent tool — the user toggles it in the UI. Visibility/execution is gated by curated catalogs (`providers::` contract re-exports) + per-toolkit user-scope prefs and sandbox mode; unparseable slugs default to `Write` (fail-closed).## Events-Subscribers/handlers live in `memory_sync::composio::bus` (re-exported here):+Subscribers/handlers for trigger and config-change events still live in `crate::memory::sync::composio::bus` (re-exported here via `bus.rs`):-- **`ComposioTriggerSubscriber`** — reacts to `DomainEvent::ComposioTriggerReceived` (published by `socket::event_handlers` when the backend emits `composio:trigger`); archives to trigger history and drives memory ingestion.+- **`ComposioTriggerSubscriber`** — reacts to `DomainEvent::ComposioTriggerReceived` (published by `platform::socket::event_handlers` when the backend emits `composio:trigger`); archives to trigger history and drives memory ingestion.- **`ComposioConnectionCreatedSubscriber`** — reacts to `DomainEvent::ComposioConnectionCreated` (published by `composio_authorize`); eagerly warms the integrations cache.- **`ComposioConfigChangedSubscriber`** — reacts to `DomainEvent::ComposioConfigChanged` (mode/api-key changes).-Published from `ops.rs`: `DomainEvent::ComposioConnectionCreated` (authorize), `DomainEvent::ComposioConnectionDeleted` (delete), `DomainEvent::ComposioActionExecuted` (execute success/failure, with cost + elapsed).+Published from `ops/` via `crate::core::bus::BUS.publish` (`crate::core::events::DomainEvent`): `DomainEvent::ComposioConnectionCreated` (authorize), `DomainEvent::ComposioConnectionDeleted` (delete), `DomainEvent::ComposioActionExecuted` (execute success/failure, with cost + elapsed).## Persistence- **Trigger history** (`trigger_history.rs`): JSONL records under `<workspace>/state/triggers/YYYY-MM-DD.jsonl`, partitioned by UTC day, behind a process-global `OnceLock` store (file-locked via `fs2`; a process-local mutex on Windows). Exposed via `composio.list_trigger_history`.-- **Direct-mode API key**: stored in the encrypted keychain (via `credentials`); never logged/returned.-- **User scope prefs** + **identity facets / sync state**: persisted through the memory layer (`memory`, `memory_store`, `memory_tree`) by the providers in `memory_sync::composio` and by delete-time cleanup in `ops.rs`.-- **Integrations cache**: in-process cache of active connections (`cached_active_integrations` / `invalidate_connected_integrations_cache`), reconciled on each `list_connections`.+- **Direct-mode API key**: stored in the encrypted keychain (via `credentials`); never logged/returned. `direct_auth/mod.rs` additionally tracks a process-local (non-persisted) consecutive-401 counter for the same key.+- **Identity facets**: written through the bound memory driver via `identity_store.rs` (`MemoryProfile::upsert_provider_facet`) and mirrored into `PROFILE.md` by `profile_md.rs`; **user scope prefs** persist through `ops::user_scopes` over the same bound driver (`crate::memory::binding`).+- **Connection-scoped cleanup**: `ops::memory_cleanup` deletes through `MemorySourceSink::forget_matching` (the `Source` / `SourcePrefix` / `Owner` selectors) rather than through the engine's chunk store (#5560). A driver that does not serve `Sources` is refused per target, and the refusal is reported beside `memory_chunks_deleted` rather than read as a delete of nothing.+- **Integrations cache**: in-process cache of active connections (`cached_active_integrations` / `invalidate_connected_integrations_cache`, `connected_integrations.rs`), reconciled on each `list_connections`.## Dependencies- `crate::integrations` — shared `IntegrationClient` (Bearer JWT, timeouts, envelope parsing, proxy) backing backend-mode calls.- `crate::config` — `Config` / `ComposioConfig` (`mode`, `entity_id`), `config::rpc` config loading.-- `crate::memory` — the memory client used for ingestion and for reading a provider's sync state during cleanup-target discovery.-- `crate::memory::binding` — the workspace's bound memory driver. Connection-scoped cleanup deletes through `MemorySourceSink::forget_matching` (the `Source` / `SourcePrefix` / `Owner` selectors), not through the engine's chunk store (#5560). A driver that does not serve `Sources` is refused per target, and the refusal is reported beside `memory_chunks_deleted` rather than read as a delete of nothing.-- `crate::memory::sync::composio` — the actual home of providers, periodic sync, and bus subscribers (this module re-exports them via shims).-- `crate::agent::harness` — sandbox mode (`current_sandbox_mode` / `SandboxMode`) for tool gating.+- `crate::modules` — loads the `tinyconnectors` native module that `module_client.rs` calls into (behind the `modules` feature).+- `tinyconnectors_bus` — the wire contract (member names, payload types) for the `tinyconnectors` module call surface; a plain dependency, not feature-gated.+- `tinymemory_api::composio` — curated catalogs, scope verdicts, identity vocabulary, and task-fetch types (`providers/mod.rs`, `identity_store.rs`, `profile_md.rs`).+- `crate::memory::binding` — the workspace's bound memory driver. Connection-scoped cleanup deletes through `MemorySourceSink::forget_matching`; identity facets and user-scope prefs are also read/written through this binding.+- `crate::memory::sync::composio` — still owns the trigger/config-change bus subscribers (this module re-exports them via `bus.rs`) and the `slack` RPC layer re-exported from `providers/mod.rs`.+- `crate::agent::harness` — sandbox mode (`current_sandbox_mode` / `SandboxMode`) for tool gating; `current_task_recency_window` consumed by `task_window.rs`.- `crate::tools::traits` — `Tool`, `ToolResult`, `ToolCategory`, `PermissionLevel`, `ToolCallOptions`.- `crate::security` — `SecurityPolicy` / `ToolOperation` for direct-tool gating.- `crate::security::credentials` — encrypted store for the direct-mode API key.- `crate::agent::context::prompt`, `agent::prompts` — prompt/profile injection of connected identities.- `crate::core::all` — `ControllerFuture` / `RegisteredController` registry types.-- `crate::core::event_bus` — `DomainEvent`, `publish_global`.+- `crate::core::bus` (`BUS`) / `crate::core::events::DomainEvent` — event publish/subscribe.- `crate::core::observability` — Sentry error classification/reporting.- `crate::rpc` — `RpcOutcome<T>`.@@ -122,18 +184,27 @@ Published from `ops.rs`: `DomainEvent::ComposioConnectionCreated` (authorize), `- `crates/openhuman-core/src/core/all.rs` — registers the controllers.- `crates/openhuman-core/src/tools/{mod,ops,schemas}.rs` — wires agent tools into the tool registry.-- `crates/openhuman-core/src/agent/**` — harness/session/subagent spawning (`integrations_agent`), triage escalation, debug.+- `crates/openhuman-core/src/core/runtime/services.rs` — starts periodic Composio connection sync as a bootstrap job.+- `crates/openhuman-core/src/agent/**` — harness/session/subagent spawning (`integrations_agent`), triage escalation, debug (e.g. `agent/harness/subagent_runner/`, `agent/orchestration/tools/`, `agent/debug/mod.rs`).- `crates/openhuman-core/src/platform/socket/event_handlers.rs` — parses `composio:trigger` and publishes `ComposioTriggerReceived`.-- `crates/openhuman-core/src/heartbeat/planner/collectors.rs`, `subconscious/situation_report` — read connected integrations / calendar.-- `crates/openhuman-core/src/agent/learning/{linkedin_enrichment,profile_md_renderer}.rs`, `memory/read_rpc.rs`, `memory_tree/score/store.rs` — profile/identity + memory consumers.+- `crates/openhuman-core/src/agent/learning/linkedin_enrichment*.rs`, `agent/learning/profile_md_renderer.rs` — connected-identity enrichment consumers.+- `crates/openhuman-core/src/agent/prompts/connected_identities.rs` — renders connected identities into the agent prompt.- `crates/openhuman-core/src/skills/preflight.rs` — identity gate via `connection_identity`.-- `crates/openhuman-core/src/security/credentials/ops.rs`, `channels/runtime/dispatch.rs`.+- `crates/openhuman-core/src/security/credentials/ops_part_02.rs` — direct-mode API key storage.+- `crates/openhuman-core/src/channels/runtime/{startup_part_01,dispatch/routing}.rs` — channel routing over connected integrations.+- `crates/openhuman-core/src/flows/**` (`ops_part_03`/`_04`/`_05.rs`, `tinyflows/caps/tools/composio.rs`) — workflow builder capability adapters over the catalog.+- `crates/openhuman-core/src/integrations/task_sources/**` — task-source providers re-export `NormalizedTask`/`TaskFetchFilter`/`ComposioProvider::fetch_tasks` from `providers/mod.rs`.+- `crates/openhuman-core/src/memory/**` (`ops/sync.rs`, `sources/rpc_part_01.rs`/`_02.rs`, `tree/tree/mod.rs`) — memory sync and read paths over Composio-sourced data.+- `crates/openhuman-core/src/modules/{connectors_tests,memory_host}.rs` — module loader tests/wiring for the connector bridge.## Notes / gotchas-- **`bus.rs`, `periodic.rs`, `providers/mod.rs` are compatibility shims** — the real implementations live under `crates/openhuman-core/src/memory/sync/composio/`. Edit there.+- **`bus.rs` is a compatibility shim** — trigger/config-change subscribers still live under `crates/openhuman-core/src/memory/sync/composio/`. **`periodic.rs` and `providers/mod.rs` are not shims anymore** — read their own module docs; both were rewritten host-side or reunified from a contract crate after tinymemory v1.13.4 deleted the in-process Composio pipeline they used to glob-import.- **Mode-aware routing (#1710)**: `authorize`/`execute`/`list_*` go through `create_composio_client` so a `composio.mode` toggle is honoured per call; direct mode never surfaces backend-tenant data (empty allowlist, user's own connections). Backend-only ops (`delete_connection`, `list_github_repos`, the `triggers/*` family, provider profile/sync) use `resolve_client` and require a backend session token.-- **`ops.rs` is large (~2380 lines)** — only the first ~1363 lines were read in full when authoring this doc; mode/api-key ops and `sync_cache_with_connections` were located by grep at lines ~1574–2354.-- **Error classification matters for the UI**: `execute` may return pre-classified `[composio:error:<class>] …` strings (parsed by `app/src/lib/composio/formatters.ts`); `ops.rs` preserves them rather than re-wrapping.+- **`ops/` is split by concern** (see [Ops layout](#ops-layout)) rather than one large file; `pass_budget.rs` is the one piece of shared sync-pass plumbing every sync entry point calls through.+- **Error classification matters for the UI**: `execute` may return pre-classified `[composio:error:<class>] …` strings (parsed by `app/src/lib/composio/formatters.ts`); `ops/execute.rs` preserves them rather than re-wrapping.- **Sentry funnel**: `report_composio_op_error` re-tags op-layer failures under `domain="composio"` with `failure="non_2xx"|"transport"` (+ extracted backend status) so transient 5xx leaks are dropped by `before_send` while genuine bugs surface.- **Type drift tolerance**: trigger types use `de_string_or_object` / `de_opt_string_or_object` to accept upstream fields that flip between string and object shapes.+- **Direct-mode 401 short-circuit** (`direct_auth/mod.rs`): after `DIRECT_INVALID_API_KEY_THRESHOLD` (3) consecutive `401 Invalid API key` responses for the same fingerprinted key, further polls short-circuit with a stable user-facing message instead of re-hitting Composio.+- **Contract gate is per-action, per-turn** (`contract_gate.rs`, #4853): only gates `ComposioActionTool` (the per-action surface used by `integrations_agent`), not the generic `composio_execute` dispatcher, MCP bridges, or Workflow dispatchers — those are tracked as follow-up.+</content>diff --git a/docs/CONTRIBUTING-BEGINNERS.md b/docs/CONTRIBUTING-BEGINNERS.mdindex abbff6f114..cfad5e9a36 100644--- a/docs/CONTRIBUTING-BEGINNERS.md+++ b/docs/CONTRIBUTING-BEGINNERS.md@@ -71,7 +71,7 @@ Verify everything is installed:```bashnode --version # should be v24.x.x or higherpnpm --version # should be 10.10.0-rustc --version # should be 1.93.0+rustc --version # should match rust-toolchain.tomlcmake --version # any recent version```@@ -152,15 +152,15 @@ npm install -g [email protected]# Rust via rustupsudo pacman -S --needed rustup-rustup toolchain install 1.93.0 --profile minimal-rustup component add rustfmt clippy --toolchain 1.93.0+rustup toolchain install --profile minimal+rustup component add rustfmt clippy# Build tools required by native Rust crates (whisper-rs, cpal, enigo, etc.)sudo pacman -S --needed base-devel cmake pkgconf clang openssl \alsa-lib xdotool libxtst libxi libevdev```-For desktop (Tauri/CEF) builds, also install:+For desktop (Tauri) builds, also install:```bashsudo pacman -S --needed gtk3 webkit2gtk-4.1 libayatana-appindicator \@@ -174,7 +174,7 @@ Verify everything is installed:```bashnode --version # should be v24.x.x or higherpnpm --version # should be 10.10.0-rustc --version # should be 1.93.0+rustc --version # should match rust-toolchain.tomlcmake --version # any recent version```@@ -205,8 +205,8 @@ Install Rust:```bashcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh-rustup toolchain install 1.93.0 --profile minimal-rustup component add rustfmt clippy --toolchain 1.93.0+rustup toolchain install --profile minimal+rustup component add rustfmt clippy```Install native build dependencies:@@ -219,7 +219,7 @@ sudo apt-get install -y \libstdc++-14-dev```-For desktop (Tauri/CEF) builds, also install:+For desktop (Tauri) builds, also install:```bashsudo apt-get install -y \@@ -234,7 +234,7 @@ Verify everything is installed:```bashnode --version # should be v24.x.x or higherpnpm --version # should be 10.10.0-rustc --version # should be 1.93.0+rustc --version # should match rust-toolchain.tomlcmake --version # any recent version```@@ -281,7 +281,12 @@ git remote -v### 3a. Initialize submodules-The project includes vendored Tauri and CEF code as git submodules. You must do this before installing dependencies or desktop builds will fail:+The project vendors several supporting crates as git submodules under `vendor/`+(tinyagents, tinyflows, tinychannels, tinyhumans-sdk, tinybus, tinymemory,+tinywallet, tinyhosts, tinymcp, tinybox, tinyruntime, tinydocs, tinyvoice,+tinyjuice, tinyconnectors — see `.gitmodules`). The desktop shell itself uses+Tauri with the Wry webview, not CEF. You must initialize the submodules before+installing dependencies or desktop builds will fail:```bashgit submodule update --init --recursivediff --git a/tests/README.md b/tests/README.mdnew file mode 100644index 0000000000..dd959cbe5b--- /dev/null+++ b/tests/README.md@@ -0,0 +1,77 @@+# `tests/`++Rust integration and JSON-RPC E2E tests for the `openhuman` package+(`crates/openhuman-core`). This directory lives at the repo root — not inside+the crate — but every file here compiles against and links `openhuman_core::`+(the crate's `[lib]` name).++## Layout++| Path | Purpose |+| --- | --- |+| `*.rs` | Integration/E2E targets, one Cargo `[[test]]` per file. `json_rpc_e2e.rs` is the canonical home for JSON-RPC behavior (see `AGENTS.md`). |+| `raw_coverage/*_raw_coverage_e2e.rs` | Coverage suites (90 files) compiled as modules of a single `raw_coverage_all` target instead of standalone binaries. |+| `raw_coverage_all.rs` | Aggregator: includes every `raw_coverage/` file as a module. The module list is generated by root `build.rs` into `$OUT_DIR/raw_coverage_mods.rs`, so a new `raw_coverage/` file is picked up automatically with no manual registration. Each included file keeps its own `#![cfg(...)]` gate and shares `SHARED_ENV_LOCK` for process-global env mutation, since all 90 now run in one process instead of 90 (see the file's own doc comment for the full rationale). |+| `support/` | Helpers pulled into targets with `#[path]` (e.g. `noop_memory.rs`) because integration targets can't see `pub(crate)` items from the crate under test. |+| `fixtures/` | Test data: `composio_*.json` tool fixtures, `memory/`, `memory_golden/` (generated — see its own README, regenerate with `scripts/regen-memory-golden-fixture.sh`), `polymarket/`. |++There is no `Cargo.toml` here and this directory is not a Cargo workspace+member — don't add one.++## Registering a new target (read this before adding a file)++`crates/openhuman-core/Cargo.toml` sets `autotests = false` and+`autoexamples = false`, because Cargo's autodiscovery only scans beside the+manifest and this crate's tests live at the repo root instead. That means+`cargo test` silently runs **nothing** for a new `tests/<name>.rs` until it is+declared:++```toml+[[test]]+name = "<name>"+path = "../../tests/<name>.rs"+```++The same applies to `examples/*.rs` via `[[example]]`. Some targets carry+`required-features` (e.g. `observability_smoke` needs `crash-reporting`,+`x402_twit_sh_live` needs `web3`, `json_rpc_e2e` needs voice-related features,+`raw_coverage_all` has its own gate); `scripts/ci/list-feature-gated-rust-tests.mjs`+enumerates them. Files under `tests/raw_coverage/` need no `[[test]]` entry —+they ride in through `raw_coverage_all`.++`pnpm rust:layout` (`scripts/ci/check-openhuman-rust-layout.mjs`, run in CI+Lite) fails the build on:++- a `tests/*.rs` file with no matching `[[test]]` entry+- a stale `[[test]]` entry pointing at a removed file+- inline `#[cfg(test)] mod` blocks in `src/`+- files named `tests.rs` or `test.rs`++## Running++- `pnpm test:rust` → `scripts/test-rust-with-mock.sh`: starts+ `scripts/mock-api-server.mjs` on `MOCK_API_PORT` (default `18505`), waits+ for `/__admin/health`, then runs `cargo test` with the product features plus+ `bin-tools`. Pass `--test <name>` to scope to one target.+- `pnpm test:rust:e2e` → `scripts/test-rust-e2e.sh`: runs the `ALL_E2E_SUITES`+ list serially against the same mock backend. `--suite <name>` runs one+ suite; append `-- --ignored` for ignored tests.+- `scripts/test-rust-inference-e2e.sh` → `tests/inference_provider_e2e.rs`,+ against wiremock upstreams (no live LLM).+- `pnpm debug rust [filter]` → summary-sized output, full logs under+ `target/debug-logs/` (see `scripts/debug/README.md`).++Per `AGENTS.md`: never call real backend or third-party services from these+tests; mock through `scripts/mock-api-core.mjs` routes; avoid time-based+flakes.++## Related++- Domain unit tests live beside their modules as `*_tests.rs` under+ `crates/openhuman-core/src/<domain>/`, not here.+- Coverage bookkeeping: `docs/TEST-COVERAGE-MATRIX.md`. PR changed-line+ coverage must be at least 80% (`scripts/ci/rust-coverage-changed.sh`,+ `scripts/ci/assert-coverage-presence.sh`).+- Frontend E2E lives in `app/test/e2e/`, using+ `app/test/e2e/helpers/element-helpers.ts` rather than raw platform element+ types.