diff --git a/AGENTS.md b/AGENTS.md index fc63ecee3..f6de8d1a8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -313,6 +313,7 @@ Deep link plugin is registered where supported; behavior is platform-specific (s - **`src/openhuman/`** — Domain logic. Current domains: `about_app`, `accessibility`, `agent`, `app_state`, `approval`, `autocomplete`, `billing`, `channels`, `composio`, `config`, `context`, `cost`, `credentials`, `cron`, `doctor`, `embeddings`, `encryption`, `health`, `heartbeat`, `integrations`, `learning`, `local_ai`, `meet`, `meet_agent`, `memory`, `migration`, `node_runtime`, `notifications`, `overlay`, `people`, `prompt_injection`, `provider_surfaces`, `providers`, `redirect_links`, `referral`, `routing`, `scheduler_gate`, `screen_intelligence`, `security`, `service`, `skills`, `socket`, `subconscious`, `team`, `text_input`, `threads`, `tokenjuice`, `tool_timeout`, `tools`, `tree_summarizer`, `update`, `voice`, `wallet`, `webhooks`, `webview_accounts`, `webview_apis`, `webview_notifications`. RPC controllers in per-domain `rpc.rs`; use **`RpcOutcome`** pattern (see "RPC Controller Pattern" below). - **`src/openhuman/` module layout**: **New** functionality must live in a **dedicated subdirectory** (e.g. `openhuman/my_domain/mod.rs` plus related files, or a new subfolder under an existing domain). Do **not** add new standalone `*.rs` files directly at `src/openhuman/` root (`dev_paths.rs` and `util.rs` are grandfathered). +- **Tool ownership rule**: Tool implementations that belong to a domain/module must live in that owning module's `tools.rs` (and optional `tools/` submodules), not in `src/openhuman/tools/impl/`. Re-export those tool types from `src/openhuman/tools/mod.rs` so callers continue to import agent-callable tools through `crate::openhuman::tools::*`. Keep `src/openhuman/tools/impl/` only for genuinely cross-cutting tool families without a clear owning domain (for example filesystem, browser/computer control, and generic system/network utilities). - **Controller schema contract**: Shared controller metadata types live in `src/core/types.rs` / `src/core/mod.rs` (`ControllerSchema`, `FieldSchema`, `TypeSchema`) and are consumed by adapters (RPC/CLI). - **Domain schema files**: For each domain, define controller schema metadata in a dedicated module inside the domain folder (example: `src/openhuman/cron/schemas.rs`) and export from the domain `mod.rs`. - **Controller-only exposure rule**: Expose domain functionality to **CLI and JSON-RPC through the controller registry** (`schemas.rs` + registered handlers wired into `src/core/all.rs`). Do **not** add domain-specific branches in `src/core/cli.rs` or `src/core/jsonrpc.rs`. diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md index 7260dc33f..e244e6fcd 100644 --- a/docs/TEST-COVERAGE-MATRIX.md +++ b/docs/TEST-COVERAGE-MATRIX.md @@ -306,11 +306,11 @@ Canonical mapping of every product feature to its test source(s). Drives gap-fil | ID | Feature | Layer | Test path(s) | Status | Notes | | ----- | ------------------------------------------ | ----- | ----------------------------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------- | -| 8.4.1 | Save Preference (general / situational) | RU | `src/openhuman/tools/impl/agent/save_preference_tests.rs` | ✅ | `save_preference` tool → `user_pref_{general,situational}`, topic-keyed | +| 8.4.1 | Save Preference (general / situational) | RU | `src/openhuman/agent/tools/save_preference_tests.rs` | ✅ | `save_preference` tool → `user_pref_{general,situational}`, topic-keyed | | 8.4.2 | Lane A — Standing Prefs in System Prompt | RU | `src/openhuman/learning/prompt_sections.rs`, `src/openhuman/agent/harness/session/turn_tests.rs` | ✅ | General prefs rendered into the system prompt at thread start | | 8.4.3 | Lane B — Situational Recall (vector-gated) | RU | `src/openhuman/memory/store/unified/query_tests.rs::recall_relevant_by_vector_gates_on_similarity` | ✅ | Per-turn; relevant query injects, unrelated suppresses | -| 8.4.4 | Same-Topic Contradiction (replace) | RU | `src/openhuman/tools/impl/agent/save_preference_tests.rs::recategorising_moves_pref_between_namespaces` | ✅ | `ON CONFLICT REPLACE`; a topic lives in exactly one scope | -| 8.4.5 | Cross-Topic Contradiction Surfacing | RU | `src/openhuman/tools/impl/agent/save_preference_tests.rs::save_surfaces_related_preference_for_contradiction_check` | ✅ | Related prefs surfaced in the tool result for the chat agent to resolve | +| 8.4.4 | Same-Topic Contradiction (replace) | RU | `src/openhuman/agent/tools/save_preference_tests.rs::recategorising_moves_pref_between_namespaces` | ✅ | `ON CONFLICT REPLACE`; a topic lives in exactly one scope | +| 8.4.5 | Cross-Topic Contradiction Surfacing | RU | `src/openhuman/agent/tools/save_preference_tests.rs::save_surfaces_related_preference_for_contradiction_check` | ✅ | Related prefs surfaced in the tool result for the chat agent to resolve | | 8.4.6 | vector_chunks Model-Signature Recall Guard | RU | `src/openhuman/memory/store/unified/query_tests.rs::vector_recall_excludes_other_model_signature` | ✅ | Excludes cross-model vectors; dim-guards legacy rows | --- @@ -368,7 +368,7 @@ Canonical mapping of every product feature to its test source(s). Drives gap-fil | ------ | ------------------------- | ----- | ----------------------------------------------------- | ------ | ----- | | 10.3.1 | Incoming Message Sync | RU+WD | `src/openhuman/channels/tests/`, `gmail-flow.spec.ts` | ✅ | | | 10.3.2 | Message Deduplication | RU | `src/openhuman/channels/tests/` | ✅ | | -| 10.3.3 | WhatsApp Agent Retrieval | RU | `src/openhuman/tools/impl/whatsapp_data/` (this PR), `tests/json_rpc_e2e.rs::whatsapp_data_agent_tools_e2e_1341` (this PR) | ✅ | Three read-only agent tools wrap the local SQLite store; ingest stays internal-only. See [`docs/whatsapp-data-flow.md`](whatsapp-data-flow.md). | +| 10.3.3 | WhatsApp Agent Retrieval | RU | `src/openhuman/whatsapp_data/tools/` (this PR), `tests/json_rpc_e2e.rs::whatsapp_data_agent_tools_e2e_1341` (this PR) | ✅ | Three read-only agent tools wrap the local SQLite store; ingest stays internal-only. See [`docs/whatsapp-data-flow.md`](whatsapp-data-flow.md). | | 10.3.4 | Real-Time vs Delayed Sync | RU | `src/openhuman/channels/tests/runtime_dispatch.rs` | ✅ | | ### 10.4 Messaging Operations diff --git a/docs/agent-subagent-tool-flow.md b/docs/agent-subagent-tool-flow.md index 602d86832..88e8ed1a2 100644 --- a/docs/agent-subagent-tool-flow.md +++ b/docs/agent-subagent-tool-flow.md @@ -17,7 +17,7 @@ The code path is split across several layers: - built-in agent definitions in `src/openhuman/agent/agents/` - harness data + task-local plumbing in `src/openhuman/agent/harness/` - main session lifecycle in `src/openhuman/agent/harness/session/` -- delegation tools in `src/openhuman/tools/impl/agent/` +- delegation tools in `src/openhuman/agent/tools/` - synthesised `delegate_*` tools in `src/openhuman/tools/orchestrator_tools.rs` If you only read one file, the system looks simpler than it is. The actual runtime path crosses all of them. @@ -42,7 +42,7 @@ If you only read one file, the system looks simpler than it is. The actual runti ### Subagent path -- `src/openhuman/tools/impl/agent/spawn_subagent.rs` +- `src/openhuman/agent/tools/spawn_subagent.rs` Runtime tool entrypoint for explicit subagent spawns. - `src/openhuman/agent/harness/fork_context.rs` Task-local parent and fork context. @@ -330,7 +330,7 @@ That history format is what the next iteration reasons from. ## Where `spawn_subagent` Enters -The explicit delegation tool lives in `src/openhuman/tools/impl/agent/spawn_subagent.rs`. +The explicit delegation tool lives in `src/openhuman/agent/tools/spawn_subagent.rs`. Its flow is: diff --git a/docs/dev-workflow-plan.md b/docs/dev-workflow-plan.md index f7d09e2c7..e4efd976d 100644 --- a/docs/dev-workflow-plan.md +++ b/docs/dev-workflow-plan.md @@ -120,7 +120,7 @@ You are an autonomous developer agent. Your job is to pick a GitHub issue and de **Not blocked on #2707** — can be done now. -The `cron_add` logic exists in the agent tool (`src/openhuman/tools/impl/cron/add.rs`) but isn't exposed as an RPC controller. Need to add it to `src/openhuman/cron/schemas.rs`. +The `cron_add` logic exists in the agent tool (`src/openhuman/cron/tools/add.rs`) but isn't exposed as an RPC controller. Need to add it to `src/openhuman/cron/schemas.rs`. **Changes:** - `src/openhuman/cron/schemas.rs` — Add `"add"` controller with inputs: `name`, `schedule`, `prompt`, `session_target`, `model`, `agent_id`, `delivery`, `delete_after_run` diff --git a/docs/whatsapp-data-flow.md b/docs/whatsapp-data-flow.md index 3c45feaa2..ebde3a47a 100644 --- a/docs/whatsapp-data-flow.md +++ b/docs/whatsapp-data-flow.md @@ -60,7 +60,7 @@ The scanner write-path RPCs are registered as **internal-only** in [`src/core/al The agent surfaces are exclusively read-only: -- [`src/openhuman/tools/impl/whatsapp_data/`](../src/openhuman/tools/impl/whatsapp_data/) — `whatsapp_data_list_chats`, `whatsapp_data_list_messages`, `whatsapp_data_search_messages`. All three wrap their RPC counterparts and emit a `"provider": "whatsapp"` tag in the response so the agent can cite WhatsApp as the source. +- [`src/openhuman/whatsapp_data/tools/`](../src/openhuman/whatsapp_data/tools/) — `whatsapp_data_list_chats`, `whatsapp_data_list_messages`, `whatsapp_data_search_messages`. All three wrap their RPC counterparts and emit a `"provider": "whatsapp"` tag in the response so the agent can cite WhatsApp as the source. - [`src/openhuman/memory/query/`](../src/openhuman/memory/query/) — generic `memory_tree_*` tools. Filter by `source_kind: "chat"` or query directly; WhatsApp chat-day transcripts are tagged `whatsapp` so they surface in cross-source flows. ## Why the orchestrator only lists three of these diff --git a/gitbooks/developing/architecture/security.md b/gitbooks/developing/architecture/security.md index d04129f15..63db7273f 100644 --- a/gitbooks/developing/architecture/security.md +++ b/gitbooks/developing/architecture/security.md @@ -104,8 +104,8 @@ The agent never sees the choice — it just calls into `Sandbox::run(...)` and t - `src/openhuman/cron/scheduler.rs` — wraps shell jobs in `SecurityPolicy::from_config`. - `src/openhuman/tools/local_cli.rs`, `tools/ops.rs`, and most `tools/impl/{system,network,memory,agent}/*.rs` — every executable tool consults `SecurityPolicy`. - `src/openhuman/tools/impl/network/{curl,http_request,composio}.rs` — risk-classify outbound calls. -- `src/openhuman/tools/impl/memory/{store,forget}.rs` — sensitive-write tracking. -- `src/openhuman/tools/impl/agent/delegate.rs` — sub-agent dispatch goes through the autonomy gate. +- `src/openhuman/memory/tools/{store,forget}.rs` — sensitive-write tracking. +- `src/openhuman/agent/tools/delegate.rs` — sub-agent dispatch goes through the autonomy gate. - `src/openhuman/credentials/` — uses `SecretStore` and `redact`. ## Tests diff --git a/src/core/event_bus/README.md b/src/core/event_bus/README.md index 571caea90..8a1e40087 100644 --- a/src/core/event_bus/README.md +++ b/src/core/event_bus/README.md @@ -28,7 +28,7 @@ In-process pub/sub plus typed request/response. Owns the global `EventBus` singl ## Called by - ~33 sites across the workspace. Hot consumers: -- `src/openhuman/agent/bus.rs`, `agent/triage/{events,evaluator,escalation}.rs`, `tools/impl/agent/{dispatch,spawn_subagent}.rs` — agent + sub-agent events. +- `src/openhuman/agent/bus.rs`, `agent/triage/{events,evaluator,escalation}.rs`, `agent/tools/{dispatch,spawn_subagent}.rs` — agent + sub-agent events. - `src/openhuman/memory/conversations/bus.rs` — conversation persistence subscriber. - `src/openhuman/channels/bus.rs` — `ChannelInboundSubscriber`. - `src/openhuman/cron/{bus,scheduler}.rs` — `CronDeliverySubscriber` + `CronJobTriggered` emission. diff --git a/src/core/observability.rs b/src/core/observability.rs index 3bcb564e0..5521dac4b 100644 --- a/src/core/observability.rs +++ b/src/core/observability.rs @@ -1092,7 +1092,7 @@ fn is_provider_user_state_message(lower: &str) -> bool { // personal Composio v3 tenant rejected with a 401 because the stored // API key is invalid / revoked / has the wrong prefix. The canonical // wire shape rendered by - // `src/openhuman/composio/tools/impl/network/composio.rs::response_error` + // `src/openhuman/composio/composio/tools/direct.rs::response_error` // and the various direct-mode op wrappers is: // // `[composio-direct] list_connections failed: Composio v3 diff --git a/src/openhuman/agent/README.md b/src/openhuman/agent/README.md index 7a006a695..cd2234872 100644 --- a/src/openhuman/agent/README.md +++ b/src/openhuman/agent/README.md @@ -34,7 +34,7 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp - `src/openhuman/composio/bus.rs` — Composio trigger envelopes go through `agent::triage`. - `src/openhuman/notifications/rpc.rs` — surfaces agent runs to the UI. - `src/openhuman/learning/{reflection,tool_tracker,user_profile}.rs` — read transcripts + tool outcomes. -- `src/openhuman/tools/impl/agent/{dispatch,spawn_subagent}.rs` — `spawn_subagent` tool delegates here. +- `src/openhuman/agent/tools/{dispatch,spawn_subagent}.rs` — `spawn_subagent` tool delegates here. - `src/core/all.rs` — controller registry wires `all_agent_registered_controllers`. ## Tests diff --git a/src/openhuman/agent/harness/definition.rs b/src/openhuman/agent/harness/definition.rs index c1cc3a204..15adf3a74 100644 --- a/src/openhuman/agent/harness/definition.rs +++ b/src/openhuman/agent/harness/definition.rs @@ -167,8 +167,8 @@ pub struct AgentDefinition { /// so that reading a TOML makes the distinction obvious: `tools` is /// "what I execute directly", `subagents` is "what I can delegate to". /// - /// [`ArchetypeDelegationTool`]: crate::openhuman::tools::impl::agent::ArchetypeDelegationTool - /// [`SkillDelegationTool`]: crate::openhuman::tools::impl::agent::SkillDelegationTool + /// [`ArchetypeDelegationTool`]: crate::openhuman::agent::tools::ArchetypeDelegationTool + /// [`SkillDelegationTool`]: crate::openhuman::agent::tools::SkillDelegationTool #[serde(default)] pub subagents: Vec, diff --git a/src/openhuman/agent/mod.rs b/src/openhuman/agent/mod.rs index 68ffe8c1a..bbdf6733a 100644 --- a/src/openhuman/agent/mod.rs +++ b/src/openhuman/agent/mod.rs @@ -43,6 +43,7 @@ mod schemas; pub mod stop_hooks; pub mod task_board; pub mod tool_policy; +pub mod tools; pub mod tree_loader; pub mod triage; pub use schemas::{ diff --git a/src/openhuman/tools/impl/agent/mod.rs b/src/openhuman/agent/tools.rs similarity index 100% rename from src/openhuman/tools/impl/agent/mod.rs rename to src/openhuman/agent/tools.rs diff --git a/src/openhuman/tools/impl/agent/archetype_delegation.rs b/src/openhuman/agent/tools/archetype_delegation.rs similarity index 100% rename from src/openhuman/tools/impl/agent/archetype_delegation.rs rename to src/openhuman/agent/tools/archetype_delegation.rs diff --git a/src/openhuman/tools/impl/agent/ask_clarification.rs b/src/openhuman/agent/tools/ask_clarification.rs similarity index 100% rename from src/openhuman/tools/impl/agent/ask_clarification.rs rename to src/openhuman/agent/tools/ask_clarification.rs diff --git a/src/openhuman/tools/impl/agent/delegate.rs b/src/openhuman/agent/tools/delegate.rs similarity index 100% rename from src/openhuman/tools/impl/agent/delegate.rs rename to src/openhuman/agent/tools/delegate.rs diff --git a/src/openhuman/tools/impl/agent/delegate_tests.rs b/src/openhuman/agent/tools/delegate_tests.rs similarity index 100% rename from src/openhuman/tools/impl/agent/delegate_tests.rs rename to src/openhuman/agent/tools/delegate_tests.rs diff --git a/src/openhuman/tools/impl/agent/delegate_to_personality.rs b/src/openhuman/agent/tools/delegate_to_personality.rs similarity index 100% rename from src/openhuman/tools/impl/agent/delegate_to_personality.rs rename to src/openhuman/agent/tools/delegate_to_personality.rs diff --git a/src/openhuman/tools/impl/agent/dispatch.rs b/src/openhuman/agent/tools/dispatch.rs similarity index 100% rename from src/openhuman/tools/impl/agent/dispatch.rs rename to src/openhuman/agent/tools/dispatch.rs diff --git a/src/openhuman/tools/impl/agent/plan_exit.rs b/src/openhuman/agent/tools/plan_exit.rs similarity index 100% rename from src/openhuman/tools/impl/agent/plan_exit.rs rename to src/openhuman/agent/tools/plan_exit.rs diff --git a/src/openhuman/tools/impl/agent/remember_preference.rs b/src/openhuman/agent/tools/remember_preference.rs similarity index 100% rename from src/openhuman/tools/impl/agent/remember_preference.rs rename to src/openhuman/agent/tools/remember_preference.rs diff --git a/src/openhuman/tools/impl/agent/run_skill.rs b/src/openhuman/agent/tools/run_skill.rs similarity index 100% rename from src/openhuman/tools/impl/agent/run_skill.rs rename to src/openhuman/agent/tools/run_skill.rs diff --git a/src/openhuman/tools/impl/agent/save_preference.rs b/src/openhuman/agent/tools/save_preference.rs similarity index 100% rename from src/openhuman/tools/impl/agent/save_preference.rs rename to src/openhuman/agent/tools/save_preference.rs diff --git a/src/openhuman/tools/impl/agent/save_preference_tests.rs b/src/openhuman/agent/tools/save_preference_tests.rs similarity index 100% rename from src/openhuman/tools/impl/agent/save_preference_tests.rs rename to src/openhuman/agent/tools/save_preference_tests.rs diff --git a/src/openhuman/tools/impl/agent/skill_delegation.rs b/src/openhuman/agent/tools/skill_delegation.rs similarity index 100% rename from src/openhuman/tools/impl/agent/skill_delegation.rs rename to src/openhuman/agent/tools/skill_delegation.rs diff --git a/src/openhuman/tools/impl/agent/spawn_parallel_agents.rs b/src/openhuman/agent/tools/spawn_parallel_agents.rs similarity index 100% rename from src/openhuman/tools/impl/agent/spawn_parallel_agents.rs rename to src/openhuman/agent/tools/spawn_parallel_agents.rs diff --git a/src/openhuman/tools/impl/agent/spawn_parallel_agents_test.rs b/src/openhuman/agent/tools/spawn_parallel_agents_test.rs similarity index 100% rename from src/openhuman/tools/impl/agent/spawn_parallel_agents_test.rs rename to src/openhuman/agent/tools/spawn_parallel_agents_test.rs diff --git a/src/openhuman/tools/impl/agent/spawn_subagent.rs b/src/openhuman/agent/tools/spawn_subagent.rs similarity index 100% rename from src/openhuman/tools/impl/agent/spawn_subagent.rs rename to src/openhuman/agent/tools/spawn_subagent.rs diff --git a/src/openhuman/tools/impl/agent/spawn_worker_thread.rs b/src/openhuman/agent/tools/spawn_worker_thread.rs similarity index 100% rename from src/openhuman/tools/impl/agent/spawn_worker_thread.rs rename to src/openhuman/agent/tools/spawn_worker_thread.rs diff --git a/src/openhuman/tools/impl/agent/todo.rs b/src/openhuman/agent/tools/todo.rs similarity index 100% rename from src/openhuman/tools/impl/agent/todo.rs rename to src/openhuman/agent/tools/todo.rs diff --git a/src/openhuman/audio_toolkit/mod.rs b/src/openhuman/audio_toolkit/mod.rs index dab8f8202..e1859e904 100644 --- a/src/openhuman/audio_toolkit/mod.rs +++ b/src/openhuman/audio_toolkit/mod.rs @@ -1,5 +1,6 @@ mod ops; mod schemas; +pub mod tools; mod types; pub use ops::{ diff --git a/src/openhuman/tools/impl/audio/mod.rs b/src/openhuman/audio_toolkit/tools.rs similarity index 100% rename from src/openhuman/tools/impl/audio/mod.rs rename to src/openhuman/audio_toolkit/tools.rs diff --git a/src/openhuman/tools/impl/audio/podcast.rs b/src/openhuman/audio_toolkit/tools/podcast.rs similarity index 100% rename from src/openhuman/tools/impl/audio/podcast.rs rename to src/openhuman/audio_toolkit/tools/podcast.rs diff --git a/src/openhuman/codegraph/mod.rs b/src/openhuman/codegraph/mod.rs index c48d8aa67..2acaa6e0d 100644 --- a/src/openhuman/codegraph/mod.rs +++ b/src/openhuman/codegraph/mod.rs @@ -20,6 +20,7 @@ pub mod index; pub mod search; pub mod store; +pub mod tools; pub use index::{ code_tokens, count_code_files, current_ref, index_ref, structural_doc, IndexMode, IndexReport, diff --git a/src/openhuman/tools/impl/codegraph/mod.rs b/src/openhuman/codegraph/tools.rs similarity index 100% rename from src/openhuman/tools/impl/codegraph/mod.rs rename to src/openhuman/codegraph/tools.rs diff --git a/src/openhuman/composio/client.rs b/src/openhuman/composio/client.rs index 9b62be845..2d66ba64f 100644 --- a/src/openhuman/composio/client.rs +++ b/src/openhuman/composio/client.rs @@ -689,7 +689,7 @@ const MODE_DIRECT_PAT: &str = COMPOSIO_MODE_DIRECT; /// (calls `api.tinyhumans.ai/agent-integrations/composio/*`). /// /// `Direct` wraps the existing direct-mode HTTP wrapper from -/// `tools/impl/network/composio.rs` that calls +/// `composio/tools/direct.rs` that calls /// `https://backend.composio.dev/api/v{2,3}` with `x-api-key`. The /// direct client does not currently cover every endpoint the /// backend-proxied path exposes (no per-toolkit allowlist, no @@ -801,7 +801,7 @@ pub fn create_composio_client( // ── Direct-mode response reshapers ────────────────────────────────── // -// The direct-mode `ComposioTool` (in `tools/impl/network/composio.rs`) +// The direct-mode `ComposioTool` (in `composio/tools/direct.rs`) // speaks `backend.composio.dev/api/v3/*` natively. The helpers below // reshape those v3 responses into the same envelopes the // backend-proxied [`ComposioClient`] returns, so callers in `ops.rs` / diff --git a/src/openhuman/composio/tools.rs b/src/openhuman/composio/tools.rs index 551b32bad..70b3f02c6 100644 --- a/src/openhuman/composio/tools.rs +++ b/src/openhuman/composio/tools.rs @@ -45,6 +45,10 @@ use super::providers::{ }; use super::types::ComposioToolsResponse; +mod direct; + +pub use direct::{ComposioAction, ComposioConnectedAccount, ComposioTool}; + /// Decision returned by [`evaluate_tool_visibility`]. enum ToolDecision { /// Action is curated for this toolkit and user scope allows it. diff --git a/src/openhuman/tools/impl/network/composio.rs b/src/openhuman/composio/tools/direct.rs similarity index 99% rename from src/openhuman/tools/impl/network/composio.rs rename to src/openhuman/composio/tools/direct.rs index b597ac06c..9d9295b7b 100644 --- a/src/openhuman/tools/impl/network/composio.rs +++ b/src/openhuman/composio/tools/direct.rs @@ -1091,5 +1091,5 @@ impl ComposioConnectedAccount { } #[cfg(test)] -#[path = "composio_tests.rs"] +#[path = "direct_tests.rs"] mod tests; diff --git a/src/openhuman/tools/impl/network/composio_tests.rs b/src/openhuman/composio/tools/direct_tests.rs similarity index 100% rename from src/openhuman/tools/impl/network/composio_tests.rs rename to src/openhuman/composio/tools/direct_tests.rs diff --git a/src/openhuman/config/schema/tools.rs b/src/openhuman/config/schema/tools.rs index 0a808cee4..ac4d8850d 100644 --- a/src/openhuman/config/schema/tools.rs +++ b/src/openhuman/config/schema/tools.rs @@ -734,7 +734,7 @@ mod search_config_tests { /// (the async push surface that the backend currently mediates via /// socket.io) do not work in direct mode — the user has to enable them /// out-of-band on Composio's dashboard and configure their own webhook -/// sink. See `tools/impl/network/composio.rs` for the underlying client. +/// sink. See `composio/tools/direct.rs` for the underlying client. pub const COMPOSIO_MODE_BACKEND: &str = "backend"; pub const COMPOSIO_MODE_DIRECT: &str = "direct"; diff --git a/src/openhuman/cron/README.md b/src/openhuman/cron/README.md index d7dad76eb..9c4432336 100644 --- a/src/openhuman/cron/README.md +++ b/src/openhuman/cron/README.md @@ -54,4 +54,4 @@ current channel + reply target — that is the routing path for the Telegram - Unit: `ops_tests.rs`, `scheduler_tests.rs`, `store_tests.rs`. - Schema/parsing coverage lives inside `schedule.rs` and `schemas.rs` `#[cfg(test)] mod tests` blocks. -- Delivery validation: `tools::impl::cron::add::tests` (announce-mode `allowed_users` checks). +- Delivery validation: `cron::tools::add::tests` (announce-mode `allowed_users` checks). diff --git a/src/openhuman/cron/mod.rs b/src/openhuman/cron/mod.rs index d1fd69b1e..3bfedfeaa 100644 --- a/src/openhuman/cron/mod.rs +++ b/src/openhuman/cron/mod.rs @@ -4,6 +4,7 @@ mod schedule; mod schemas; pub mod seed; mod store; +pub mod tools; mod types; pub mod scheduler; diff --git a/src/openhuman/tools/impl/cron/mod.rs b/src/openhuman/cron/tools.rs similarity index 100% rename from src/openhuman/tools/impl/cron/mod.rs rename to src/openhuman/cron/tools.rs diff --git a/src/openhuman/tools/impl/cron/add.rs b/src/openhuman/cron/tools/add.rs similarity index 100% rename from src/openhuman/tools/impl/cron/add.rs rename to src/openhuman/cron/tools/add.rs diff --git a/src/openhuman/tools/impl/cron/list.rs b/src/openhuman/cron/tools/list.rs similarity index 100% rename from src/openhuman/tools/impl/cron/list.rs rename to src/openhuman/cron/tools/list.rs diff --git a/src/openhuman/tools/impl/cron/remove.rs b/src/openhuman/cron/tools/remove.rs similarity index 100% rename from src/openhuman/tools/impl/cron/remove.rs rename to src/openhuman/cron/tools/remove.rs diff --git a/src/openhuman/tools/impl/cron/run.rs b/src/openhuman/cron/tools/run.rs similarity index 100% rename from src/openhuman/tools/impl/cron/run.rs rename to src/openhuman/cron/tools/run.rs diff --git a/src/openhuman/tools/impl/cron/runs.rs b/src/openhuman/cron/tools/runs.rs similarity index 100% rename from src/openhuman/tools/impl/cron/runs.rs rename to src/openhuman/cron/tools/runs.rs diff --git a/src/openhuman/tools/impl/cron/update.rs b/src/openhuman/cron/tools/update.rs similarity index 100% rename from src/openhuman/tools/impl/cron/update.rs rename to src/openhuman/cron/tools/update.rs diff --git a/src/openhuman/integrations/mod.rs b/src/openhuman/integrations/mod.rs index 2c58456a8..a7d66ab90 100644 --- a/src/openhuman/integrations/mod.rs +++ b/src/openhuman/integrations/mod.rs @@ -6,38 +6,11 @@ //! endpoints directly when enabled; those callers must keep configured base URLs //! trusted because requests leave the local core process. -pub mod apify; -pub mod brave; pub mod client; -pub mod google_places; -pub mod parallel; -pub mod querit; -pub mod searxng; -pub mod seltz; -pub mod stock_prices; -pub mod tinyfish; -pub mod twilio; +pub mod tools; pub mod types; -pub use apify::{ApifyGetRunResultsTool, ApifyGetRunStatusTool, ApifyRunActorTool}; -pub use brave::{ - BraveImageSearchTool, BraveNewsSearchTool, BraveVideoSearchTool, BraveWebSearchTool, -}; pub use client::{build_client, pricing_for_config, IntegrationClient}; -pub use google_places::{GooglePlacesDetailsTool, GooglePlacesSearchTool}; -pub use parallel::{ - ParallelChatTool, ParallelDatasetTool, ParallelEnrichTool, ParallelExtractTool, - ParallelResearchTool, ParallelSearchTool, -}; -pub use querit::QueritSearchTool; -pub use searxng::{SearxngSearchArgs, SearxngSearchResponse, SearxngSearchTool}; -pub use seltz::SeltzSearchTool; -pub use stock_prices::{ - StockCommodityTool, StockCryptoSeriesTool, StockExchangeRateTool, StockOptionsTool, - StockQuoteTool, -}; -pub use tinyfish::{TinyFishAgentRunTool, TinyFishFetchTool, TinyFishSearchTool}; -pub use twilio::TwilioCallTool; pub use types::{ BackendResponse, IntegrationPricing, IntegrationPricingEntry, PricingIntegrations, ToolScope, }; diff --git a/src/openhuman/integrations/tools.rs b/src/openhuman/integrations/tools.rs new file mode 100644 index 000000000..cc1baf02f --- /dev/null +++ b/src/openhuman/integrations/tools.rs @@ -0,0 +1,34 @@ +use super::IntegrationClient; + +mod apify; +mod brave; +mod google_places; +mod parallel; +mod querit; +mod searxng; +mod seltz; +mod stock_prices; +mod tinyfish; +mod twilio; + +pub use apify::{ApifyGetRunResultsTool, ApifyGetRunStatusTool, ApifyRunActorTool}; +pub use brave::{ + BraveImageSearchTool, BraveNewsSearchTool, BraveVideoSearchTool, BraveWebSearchTool, +}; +pub use google_places::{GooglePlacesDetailsTool, GooglePlacesSearchTool}; +pub use parallel::{ + ParallelChatTool, ParallelDatasetTool, ParallelEnrichTool, ParallelExtractTool, + ParallelResearchTool, ParallelSearchTool, SearchResponse, SearchResultItem, +}; +pub use querit::QueritSearchTool; +pub use searxng::{ + normalize_categories, SearxngSearchArgs, SearxngSearchResponse, SearxngSearchTool, + MAX_RESULTS as SEARXNG_MAX_RESULTS, +}; +pub use seltz::SeltzSearchTool; +pub use stock_prices::{ + StockCommodityTool, StockCryptoSeriesTool, StockExchangeRateTool, StockOptionsTool, + StockQuoteTool, +}; +pub use tinyfish::{TinyFishAgentRunTool, TinyFishFetchTool, TinyFishSearchTool}; +pub use twilio::TwilioCallTool; diff --git a/src/openhuman/integrations/apify.rs b/src/openhuman/integrations/tools/apify.rs similarity index 100% rename from src/openhuman/integrations/apify.rs rename to src/openhuman/integrations/tools/apify.rs diff --git a/src/openhuman/integrations/apify_tests.rs b/src/openhuman/integrations/tools/apify_tests.rs similarity index 100% rename from src/openhuman/integrations/apify_tests.rs rename to src/openhuman/integrations/tools/apify_tests.rs diff --git a/src/openhuman/integrations/brave.rs b/src/openhuman/integrations/tools/brave.rs similarity index 100% rename from src/openhuman/integrations/brave.rs rename to src/openhuman/integrations/tools/brave.rs diff --git a/src/openhuman/integrations/google_places.rs b/src/openhuman/integrations/tools/google_places.rs similarity index 100% rename from src/openhuman/integrations/google_places.rs rename to src/openhuman/integrations/tools/google_places.rs diff --git a/src/openhuman/integrations/parallel.rs b/src/openhuman/integrations/tools/parallel.rs similarity index 100% rename from src/openhuman/integrations/parallel.rs rename to src/openhuman/integrations/tools/parallel.rs diff --git a/src/openhuman/integrations/parallel_tests.rs b/src/openhuman/integrations/tools/parallel_tests.rs similarity index 100% rename from src/openhuman/integrations/parallel_tests.rs rename to src/openhuman/integrations/tools/parallel_tests.rs diff --git a/src/openhuman/integrations/querit.rs b/src/openhuman/integrations/tools/querit.rs similarity index 100% rename from src/openhuman/integrations/querit.rs rename to src/openhuman/integrations/tools/querit.rs diff --git a/src/openhuman/integrations/searxng.rs b/src/openhuman/integrations/tools/searxng.rs similarity index 100% rename from src/openhuman/integrations/searxng.rs rename to src/openhuman/integrations/tools/searxng.rs diff --git a/src/openhuman/integrations/seltz.rs b/src/openhuman/integrations/tools/seltz.rs similarity index 100% rename from src/openhuman/integrations/seltz.rs rename to src/openhuman/integrations/tools/seltz.rs diff --git a/src/openhuman/integrations/stock_prices.rs b/src/openhuman/integrations/tools/stock_prices.rs similarity index 100% rename from src/openhuman/integrations/stock_prices.rs rename to src/openhuman/integrations/tools/stock_prices.rs diff --git a/src/openhuman/integrations/tinyfish.rs b/src/openhuman/integrations/tools/tinyfish.rs similarity index 100% rename from src/openhuman/integrations/tinyfish.rs rename to src/openhuman/integrations/tools/tinyfish.rs diff --git a/src/openhuman/integrations/tinyfish_tests.rs b/src/openhuman/integrations/tools/tinyfish_tests.rs similarity index 100% rename from src/openhuman/integrations/tinyfish_tests.rs rename to src/openhuman/integrations/tools/tinyfish_tests.rs diff --git a/src/openhuman/integrations/twilio.rs b/src/openhuman/integrations/tools/twilio.rs similarity index 98% rename from src/openhuman/integrations/twilio.rs rename to src/openhuman/integrations/tools/twilio.rs index 09840c440..7390c8415 100644 --- a/src/openhuman/integrations/twilio.rs +++ b/src/openhuman/integrations/tools/twilio.rs @@ -10,7 +10,8 @@ //! //! The backend handles Twilio API credentials, billing, and rate limiting. -use super::{IntegrationClient, ToolScope}; +use super::IntegrationClient; +use crate::openhuman::integrations::ToolScope; use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolResult}; use async_trait::async_trait; use serde::Deserialize; diff --git a/src/openhuman/mcp_server/tools.rs b/src/openhuman/mcp_server/tools.rs index 7e0f9600b..1a182769c 100644 --- a/src/openhuman/mcp_server/tools.rs +++ b/src/openhuman/mcp_server/tools.rs @@ -5,8 +5,8 @@ use crate::openhuman::agent::harness::AgentDefinitionRegistry; use crate::openhuman::agent::Agent; use crate::openhuman::config::rpc as config_rpc; use crate::openhuman::inference::provider::traits::build_tool_instructions_text; -use crate::openhuman::integrations::searxng::MAX_RESULTS as SEARXNG_MAX_RESULTS; use crate::openhuman::security::{SecurityPolicy, ToolOperation}; +use crate::openhuman::tools::SEARXNG_MAX_RESULTS; use super::write_dispatch; @@ -737,7 +737,7 @@ fn build_rpc_params( let mut params = Map::new(); params.insert("query".to_string(), Value::String(query)); if let Some(categories) = optional_string_array(&args, "categories")? { - crate::openhuman::integrations::searxng::normalize_categories(categories.clone()) + crate::openhuman::tools::normalize_categories(categories.clone()) .map_err(|err| ToolCallError::InvalidParams(err.to_string()))?; params.insert("categories".to_string(), Value::from(categories)); } diff --git a/src/openhuman/memory/mod.rs b/src/openhuman/memory/mod.rs index a1d39485e..759d82b3b 100644 --- a/src/openhuman/memory/mod.rs +++ b/src/openhuman/memory/mod.rs @@ -26,6 +26,7 @@ pub mod read_rpc; pub mod remember; pub mod schema; pub mod sync; +pub mod tools; pub mod util; // Tree instances — policy and orchestration over the generic memory_tree engine. diff --git a/src/openhuman/tools/impl/memory/mod.rs b/src/openhuman/memory/tools.rs similarity index 100% rename from src/openhuman/tools/impl/memory/mod.rs rename to src/openhuman/memory/tools.rs diff --git a/src/openhuman/tools/impl/memory/forget.rs b/src/openhuman/memory/tools/forget.rs similarity index 100% rename from src/openhuman/tools/impl/memory/forget.rs rename to src/openhuman/memory/tools/forget.rs diff --git a/src/openhuman/tools/impl/memory/recall.rs b/src/openhuman/memory/tools/recall.rs similarity index 100% rename from src/openhuman/tools/impl/memory/recall.rs rename to src/openhuman/memory/tools/recall.rs diff --git a/src/openhuman/tools/impl/memory/store.rs b/src/openhuman/memory/tools/store.rs similarity index 100% rename from src/openhuman/tools/impl/memory/store.rs rename to src/openhuman/memory/tools/store.rs diff --git a/src/openhuman/security/README.md b/src/openhuman/security/README.md index 8832da9ef..014614d83 100644 --- a/src/openhuman/security/README.md +++ b/src/openhuman/security/README.md @@ -27,8 +27,8 @@ Trust boundary for the autonomous core. Owns the autonomy / risk policy, sandbox - `src/openhuman/cron/scheduler.rs` — wraps shell jobs in `SecurityPolicy::from_config`. - `src/openhuman/tools/local_cli.rs`, `tools/ops.rs`, and most `tools/impl/{system,network,memory,agent}/*.rs` — every executable tool consults `SecurityPolicy`. - `src/openhuman/tools/impl/network/{curl,http_request,composio}.rs` — risk-classify outbound calls. -- `src/openhuman/tools/impl/memory/{store,forget}.rs` — sensitive-write tracking. -- `src/openhuman/tools/impl/agent/delegate.rs` — sub-agent dispatch goes through autonomy gate. +- `src/openhuman/memory/tools/{store,forget}.rs` — sensitive-write tracking. +- `src/openhuman/agent/tools/delegate.rs` — sub-agent dispatch goes through autonomy gate. - `src/openhuman/credentials/` — uses `SecretStore` and `redact`. ## Tests diff --git a/src/openhuman/todos/ops.rs b/src/openhuman/todos/ops.rs index b984a5a43..f234a391b 100644 --- a/src/openhuman/todos/ops.rs +++ b/src/openhuman/todos/ops.rs @@ -444,7 +444,7 @@ fn emit_progress(location: &BoardLocation, cards: &[TaskBoardCard]) { } /// Process-global lock that test code (here and in -/// `tools::impl::agent::todo`) uses to serialize access to the shared +/// `agent::tools::todo`) uses to serialize access to the shared /// scratch store under `cargo test`'s parallel runner. #[cfg(test)] pub(crate) fn scratch_test_lock() -> std::sync::MutexGuard<'static, ()> { diff --git a/src/openhuman/tools/impl/mod.rs b/src/openhuman/tools/impl/mod.rs index d54280060..1d2e8dc0b 100644 --- a/src/openhuman/tools/impl/mod.rs +++ b/src/openhuman/tools/impl/mod.rs @@ -1,25 +1,11 @@ -pub mod agent; -pub mod audio; pub mod browser; -pub mod codegraph; pub mod computer; -pub mod cron; pub mod filesystem; -pub mod memory; pub mod network; pub mod system; -pub mod wallet; -pub mod whatsapp_data; -pub use agent::*; -pub use audio::*; pub use browser::*; -pub use codegraph::*; pub use computer::*; -pub use cron::*; pub use filesystem::*; -pub use memory::*; pub use network::*; pub use system::*; -pub use wallet::*; -pub use whatsapp_data::*; diff --git a/src/openhuman/tools/impl/network/mod.rs b/src/openhuman/tools/impl/network/mod.rs index 3344c3890..41caf6934 100644 --- a/src/openhuman/tools/impl/network/mod.rs +++ b/src/openhuman/tools/impl/network/mod.rs @@ -1,5 +1,4 @@ mod clob_auth; -mod composio; mod curl; mod gitbooks; mod gmail_unsubscribe; @@ -12,7 +11,6 @@ mod url_guard; mod web_fetch; mod web_search; -pub use composio::{ComposioAction, ComposioConnectedAccount, ComposioTool}; pub use curl::CurlTool; pub use gitbooks::{GitbooksGetPageTool, GitbooksSearchTool}; pub use gmail_unsubscribe::GmailUnsubscribeTool; diff --git a/src/openhuman/tools/impl/network/web_search.rs b/src/openhuman/tools/impl/network/web_search.rs index 280c20cf4..29e6750e5 100644 --- a/src/openhuman/tools/impl/network/web_search.rs +++ b/src/openhuman/tools/impl/network/web_search.rs @@ -1,6 +1,6 @@ -use crate::openhuman::integrations::parallel::{SearchResponse, SearchResultItem}; -use crate::openhuman::integrations::{IntegrationClient, SeltzSearchTool}; +use crate::openhuman::integrations::IntegrationClient; use crate::openhuman::tools::traits::{Tool, ToolCallOptions, ToolResult}; +use crate::openhuman::tools::{SearchResponse, SearchResultItem, SeltzSearchTool}; use async_trait::async_trait; use serde_json::{json, Value}; use sha2::{Digest, Sha256}; diff --git a/src/openhuman/tools/mod.rs b/src/openhuman/tools/mod.rs index 618a1a5bd..80ab955aa 100644 --- a/src/openhuman/tools/mod.rs +++ b/src/openhuman/tools/mod.rs @@ -11,6 +11,15 @@ pub(crate) mod user_filter; #[path = "impl/mod.rs"] pub(crate) mod implementations; +pub use crate::openhuman::agent::tools::*; +pub use crate::openhuman::audio_toolkit::tools::*; +pub use crate::openhuman::codegraph::tools::*; +pub use crate::openhuman::composio::tools::*; +pub use crate::openhuman::cron::tools::*; +pub use crate::openhuman::integrations::tools::*; +pub use crate::openhuman::memory::tools::*; +pub use crate::openhuman::wallet::tools::*; +pub use crate::openhuman::whatsapp_data::tools::*; pub use implementations::*; pub use ops::*; pub use policy::{DefaultToolPolicy, PolicyDecision, ToolPolicy}; diff --git a/src/openhuman/tools/ops.rs b/src/openhuman/tools/ops.rs index 2f7c593de..3735e09e3 100644 --- a/src/openhuman/tools/ops.rs +++ b/src/openhuman/tools/ops.rs @@ -388,34 +388,24 @@ pub fn all_tools_with_runtime( // pick it up once direct Parallel routing lands. let client = crate::openhuman::integrations::build_client(root_config); if let Some(client) = client { + tools.push(Box::new(crate::openhuman::tools::ParallelSearchTool::new( + Arc::clone(&client), + ))); + tools.push(Box::new(crate::openhuman::tools::ParallelExtractTool::new( + Arc::clone(&client), + ))); + tools.push(Box::new(crate::openhuman::tools::ParallelChatTool::new( + Arc::clone(&client), + ))); tools.push(Box::new( - crate::openhuman::integrations::ParallelSearchTool::new(Arc::clone( - &client, - )), - )); - tools.push(Box::new( - crate::openhuman::integrations::ParallelExtractTool::new(Arc::clone( - &client, - )), - )); - tools.push(Box::new( - crate::openhuman::integrations::ParallelChatTool::new(Arc::clone(&client)), - )); - tools.push(Box::new( - crate::openhuman::integrations::ParallelResearchTool::new(Arc::clone( - &client, - )), - )); - tools.push(Box::new( - crate::openhuman::integrations::ParallelEnrichTool::new(Arc::clone( - &client, - )), - )); - tools.push(Box::new( - crate::openhuman::integrations::ParallelDatasetTool::new(Arc::clone( - &client, - )), + crate::openhuman::tools::ParallelResearchTool::new(Arc::clone(&client)), )); + tools.push(Box::new(crate::openhuman::tools::ParallelEnrichTool::new( + Arc::clone(&client), + ))); + tools.push(Box::new(crate::openhuman::tools::ParallelDatasetTool::new( + Arc::clone(&client), + ))); // Layer the unified web_search slot too so the // agent's default research path keeps working. tools.push(Box::new(WebSearchTool::new( @@ -437,29 +427,25 @@ pub fn all_tools_with_runtime( SearchEngine::Brave => { tracing::debug!("[search] active engine = brave (BYO direct API)"); let api_key = search.brave.api_key.clone(); + tools.push(Box::new(crate::openhuman::tools::BraveWebSearchTool::new( + api_key.clone(), + max_results, + timeout_secs, + ))); + tools.push(Box::new(crate::openhuman::tools::BraveNewsSearchTool::new( + api_key.clone(), + max_results, + timeout_secs, + ))); tools.push(Box::new( - crate::openhuman::integrations::BraveWebSearchTool::new( + crate::openhuman::tools::BraveImageSearchTool::new( api_key.clone(), max_results, timeout_secs, ), )); tools.push(Box::new( - crate::openhuman::integrations::BraveNewsSearchTool::new( - api_key.clone(), - max_results, - timeout_secs, - ), - )); - tools.push(Box::new( - crate::openhuman::integrations::BraveImageSearchTool::new( - api_key.clone(), - max_results, - timeout_secs, - ), - )); - tools.push(Box::new( - crate::openhuman::integrations::BraveVideoSearchTool::new( + crate::openhuman::tools::BraveVideoSearchTool::new( api_key, max_results, timeout_secs, @@ -469,21 +455,19 @@ pub fn all_tools_with_runtime( SearchEngine::Querit => { tracing::debug!("[search] active engine = querit (BYO direct API)"); tools.push(Box::new( - crate::openhuman::integrations::QueritSearchTool::new_web_search_tool( - search.querit.api_key.clone(), - None, - max_results, - timeout_secs, - ), - )); - tools.push(Box::new( - crate::openhuman::integrations::QueritSearchTool::new( + crate::openhuman::tools::QueritSearchTool::new_web_search_tool( search.querit.api_key.clone(), None, max_results, timeout_secs, ), )); + tools.push(Box::new(crate::openhuman::tools::QueritSearchTool::new( + search.querit.api_key.clone(), + None, + max_results, + timeout_secs, + ))); } } } @@ -552,14 +536,14 @@ pub fn all_tools_with_runtime( if let Some(client) = crate::openhuman::integrations::build_client(root_config) { tracing::debug!("[integrations] client built successfully"); if root_config.integrations.apify.is_active() { + tools.push(Box::new(crate::openhuman::tools::ApifyRunActorTool::new( + Arc::clone(&client), + ))); tools.push(Box::new( - crate::openhuman::integrations::ApifyRunActorTool::new(Arc::clone(&client)), + crate::openhuman::tools::ApifyGetRunStatusTool::new(Arc::clone(&client)), )); tools.push(Box::new( - crate::openhuman::integrations::ApifyGetRunStatusTool::new(Arc::clone(&client)), - )); - tools.push(Box::new( - crate::openhuman::integrations::ApifyGetRunResultsTool::new(Arc::clone(&client)), + crate::openhuman::tools::ApifyGetRunResultsTool::new(Arc::clone(&client)), )); tracing::debug!("[integrations] registered apify tools"); } else { @@ -567,10 +551,10 @@ pub fn all_tools_with_runtime( } if root_config.integrations.google_places.is_active() { tools.push(Box::new( - crate::openhuman::integrations::GooglePlacesSearchTool::new(Arc::clone(&client)), + crate::openhuman::tools::GooglePlacesSearchTool::new(Arc::clone(&client)), )); tools.push(Box::new( - crate::openhuman::integrations::GooglePlacesDetailsTool::new(Arc::clone(&client)), + crate::openhuman::tools::GooglePlacesDetailsTool::new(Arc::clone(&client)), )); tracing::debug!("[integrations] registered google_places tools"); } else { @@ -586,43 +570,43 @@ pub fn all_tools_with_runtime( ); } if root_config.integrations.tinyfish.is_active() { + tools.push(Box::new(crate::openhuman::tools::TinyFishSearchTool::new( + Arc::clone(&client), + ))); + tools.push(Box::new(crate::openhuman::tools::TinyFishFetchTool::new( + Arc::clone(&client), + ))); tools.push(Box::new( - crate::openhuman::integrations::TinyFishSearchTool::new(Arc::clone(&client)), - )); - tools.push(Box::new( - crate::openhuman::integrations::TinyFishFetchTool::new(Arc::clone(&client)), - )); - tools.push(Box::new( - crate::openhuman::integrations::TinyFishAgentRunTool::new(Arc::clone(&client)), + crate::openhuman::tools::TinyFishAgentRunTool::new(Arc::clone(&client)), )); tracing::debug!("[integrations] registered tinyfish tools"); } else { tracing::debug!("[integrations] tinyfish disabled — skipping"); } if root_config.integrations.stock_prices.is_active() { + tools.push(Box::new(crate::openhuman::tools::StockQuoteTool::new( + Arc::clone(&client), + ))); tools.push(Box::new( - crate::openhuman::integrations::StockQuoteTool::new(Arc::clone(&client)), + crate::openhuman::tools::StockExchangeRateTool::new(Arc::clone(&client)), )); + tools.push(Box::new(crate::openhuman::tools::StockOptionsTool::new( + Arc::clone(&client), + ))); tools.push(Box::new( - crate::openhuman::integrations::StockExchangeRateTool::new(Arc::clone(&client)), - )); - tools.push(Box::new( - crate::openhuman::integrations::StockOptionsTool::new(Arc::clone(&client)), - )); - tools.push(Box::new( - crate::openhuman::integrations::StockCryptoSeriesTool::new(Arc::clone(&client)), - )); - tools.push(Box::new( - crate::openhuman::integrations::StockCommodityTool::new(Arc::clone(&client)), + crate::openhuman::tools::StockCryptoSeriesTool::new(Arc::clone(&client)), )); + tools.push(Box::new(crate::openhuman::tools::StockCommodityTool::new( + Arc::clone(&client), + ))); tracing::debug!("[integrations] registered stock_prices tools"); } else { tracing::debug!("[integrations] stock_prices disabled — skipping"); } if root_config.integrations.twilio.is_active() { - tools.push(Box::new( - crate::openhuman::integrations::TwilioCallTool::new(Arc::clone(&client)), - )); + tools.push(Box::new(crate::openhuman::tools::TwilioCallTool::new( + Arc::clone(&client), + ))); tracing::debug!("[integrations] registered twilio tools"); } else { tracing::debug!("[integrations] twilio disabled — skipping"); diff --git a/src/openhuman/tools/schemas.rs b/src/openhuman/tools/schemas.rs index 5edbdc264..bd75b6647 100644 --- a/src/openhuman/tools/schemas.rs +++ b/src/openhuman/tools/schemas.rs @@ -11,8 +11,8 @@ use serde_json::{json, Map, Value}; use crate::core::all::{ControllerFuture, RegisteredController}; use crate::core::{ControllerSchema, FieldSchema, TypeSchema}; use crate::openhuman::config::rpc as config_rpc; -use crate::openhuman::integrations::searxng::MAX_RESULTS as SEARXNG_MAX_RESULTS; use crate::openhuman::tools::traits::Tool; +use crate::openhuman::tools::SEARXNG_MAX_RESULTS; use crate::rpc::RpcOutcome; pub fn all_controller_schemas() -> Vec { @@ -517,7 +517,7 @@ fn handle_web_search(params: Map) -> ControllerFuture { }); let resp = client - .post::( + .post::( "/agent-integrations/parallel/search", &body, ) @@ -568,7 +568,7 @@ fn handle_seltz_search(params: Map) -> ControllerFuture { "[rpc][tools.seltz_search] start" ); - let tool = crate::openhuman::integrations::SeltzSearchTool::new( + let tool = crate::openhuman::tools::SeltzSearchTool::new( config.seltz.api_key.clone(), config.seltz.api_url.clone(), max_results, @@ -650,7 +650,7 @@ fn handle_querit_search(params: Map) -> ControllerFuture { "[rpc][tools.querit_search] start" ); - let tool = crate::openhuman::integrations::QueritSearchTool::new( + let tool = crate::openhuman::tools::QueritSearchTool::new( config.search.querit.api_key.clone(), None, max_results, @@ -729,7 +729,7 @@ fn handle_searxng_search(params: Map) -> ControllerFuture { "[rpc][tools.searxng_search] start" ); - let tool = crate::openhuman::integrations::SearxngSearchTool::new( + let tool = crate::openhuman::tools::SearxngSearchTool::new( config.searxng.base_url.clone(), config.searxng.max_results, config.searxng.default_language.clone(), @@ -737,7 +737,7 @@ fn handle_searxng_search(params: Map) -> ControllerFuture { ); let response = tool - .search(crate::openhuman::integrations::SearxngSearchArgs { + .search(crate::openhuman::tools::SearxngSearchArgs { query, categories, language, diff --git a/src/openhuman/wallet/mod.rs b/src/openhuman/wallet/mod.rs index fb5c54800..24147a526 100644 --- a/src/openhuman/wallet/mod.rs +++ b/src/openhuman/wallet/mod.rs @@ -10,6 +10,7 @@ mod execution; mod ops; mod rpc; mod schemas; +pub mod tools; #[cfg(test)] pub(crate) mod test_support; diff --git a/src/openhuman/tools/impl/wallet/mod.rs b/src/openhuman/wallet/tools.rs similarity index 100% rename from src/openhuman/tools/impl/wallet/mod.rs rename to src/openhuman/wallet/tools.rs diff --git a/src/openhuman/tools/impl/wallet/chain_status.rs b/src/openhuman/wallet/tools/chain_status.rs similarity index 100% rename from src/openhuman/tools/impl/wallet/chain_status.rs rename to src/openhuman/wallet/tools/chain_status.rs diff --git a/src/openhuman/tools/impl/wallet/prepare_transfer.rs b/src/openhuman/wallet/tools/prepare_transfer.rs similarity index 100% rename from src/openhuman/tools/impl/wallet/prepare_transfer.rs rename to src/openhuman/wallet/tools/prepare_transfer.rs diff --git a/src/openhuman/tools/impl/wallet/status.rs b/src/openhuman/wallet/tools/status.rs similarity index 100% rename from src/openhuman/tools/impl/wallet/status.rs rename to src/openhuman/wallet/tools/status.rs diff --git a/src/openhuman/whatsapp_data/mod.rs b/src/openhuman/whatsapp_data/mod.rs index 165616d75..21031e6a9 100644 --- a/src/openhuman/whatsapp_data/mod.rs +++ b/src/openhuman/whatsapp_data/mod.rs @@ -21,6 +21,7 @@ pub mod rpc; mod schemas; mod sqlite_retry; pub mod store; +pub mod tools; pub mod types; pub use schemas::{ diff --git a/src/openhuman/tools/impl/whatsapp_data/mod.rs b/src/openhuman/whatsapp_data/tools.rs similarity index 100% rename from src/openhuman/tools/impl/whatsapp_data/mod.rs rename to src/openhuman/whatsapp_data/tools.rs diff --git a/src/openhuman/tools/impl/whatsapp_data/list_chats.rs b/src/openhuman/whatsapp_data/tools/list_chats.rs similarity index 100% rename from src/openhuman/tools/impl/whatsapp_data/list_chats.rs rename to src/openhuman/whatsapp_data/tools/list_chats.rs diff --git a/src/openhuman/tools/impl/whatsapp_data/list_messages.rs b/src/openhuman/whatsapp_data/tools/list_messages.rs similarity index 100% rename from src/openhuman/tools/impl/whatsapp_data/list_messages.rs rename to src/openhuman/whatsapp_data/tools/list_messages.rs diff --git a/src/openhuman/tools/impl/whatsapp_data/search_messages.rs b/src/openhuman/whatsapp_data/tools/search_messages.rs similarity index 100% rename from src/openhuman/tools/impl/whatsapp_data/search_messages.rs rename to src/openhuman/whatsapp_data/tools/search_messages.rs