8000 openhuman/crates/openhuman-core at main · habibtalib/openhuman · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
 
 

openhuman-core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

openhuman-core

Cargo package openhuman, library openhuman_core. Owns business rules, persistence, execution policy, the JSON-RPC/Socket.IO server, and the CLI dispatcher for OpenHuman. The openhuman-core binary itself lives in crates/openhuman-cli (it needs the openhuman-tinyhumans backend transport this library does not carry). Hosted in-process by crates/openhuman-app (the Tauri shell), crates/openhuman-embed (the typed facade for third-party embedders such as OpenCompany), crates/openhuman-tui, and crates/openhuman-cli.

See crates/openhuman-core/src/lib.rs for the crate-level doc comment and AGENTS.md ("Rust domain structure") for the preferred per-domain module shape.

Layout

Business logic lives one directory per domain under src/<domain>/. * marks modules whose pub mod declaration in lib.rs is itself #[cfg(feature)]- gated (feature of the same name unless noted). channels, mcp, skills, voice and web3 are always declared but gate most of their contents inside mod.rs behind the feature of the same name. See the [features] block in Cargo.toml for what each gate pulls in.

Domain Purpose README
agent Multi-agent orchestration, tool execution, session management README
backend The backend port: BackendTransport, BackendClient, error classification and budget-exhaustion detection. Holds no hosted URL, header policy or product identity of its own README
channels Channel implementations and runtime orchestration README
config Configuration management for the core README
core Transport, dispatch, controller registry (core::all), auth, CLI, event bus, runtime composition (core::runtime); not a domain README
cron Scheduled-job runtime: cron/human-delay parsing, job + run store, polling scheduler, output delivery README
desktop Desktop-shell-facing surfaces
flows* Saved automation workflows (tinyflows graphs) README
hooks User-authored scripts that observe and gate the agent README
hosting* Putting a workspace on the internet README
inference Unified inference domain README
integrations Agent integration tools README
mcp Host half of Model Context Protocol support README
media* Media generation and image tool contracts README
memory Memory orchestration: the host layer over tinymemory-core README
modules* Loadable native modules: capabilities that live outside this binary README
platform Host-platform services: process lifecycle, self-update, diagnostics, local transport surfaces
runtime Code-execution runtimes, client side (toolchain download/warm workers live in the tinyruntime module)
sandbox Sandbox execution backends for agent tool isolation README
search Unified search domain README
security Autonomy/risk policy, sandbox selection, audit log, secret store README
skills Skills metadata: discovery, parse, install, run README
test_support* (feature e2e-test-support) Wipe-and-reset hooks for E2E specs README
threads Conversation thread and message management README
tools Agent tool implementations and policy README
util Utility functions README
voice Speech-to-text and text-to-speech (local piper / hosted) README
web3 High-level web3 surface built on the wallet layer README
web_chat Web/desktop channel turn runner (channel.web_* RPC, WebChannelEvent bus) README

The controller contract (core::Outcome, core::StructuredRpcError, the params rules in core::params, the schema types) and in-process dispatch (core::invoke::invoke_method) live in this crate. The JSON-RPC protocol, client and server that expose them live in crates/openhuman-rpc, which depends on this crate.

The inference domain is where the pluggable LLM and embedding providers live; see gitbooks/developing/engines.md for the full provider list. Tool selection under agent includes the Jev ranker's core-side integration point; see gitbooks/developing/jev.md.

Binaries

None. This package is the library only; crates/openhuman-cli declares the openhuman-core binary, test-mcp-stub, openhuman-fleet, rss-bench and library-profile, plus every root tests/*.rs / examples/*.rs target.

openhuman-fleet is a process-per-user supervisor and reverse proxy, part of the pluggable-core work (see src/core/runtime/). test-mcp-stub is the stdio MCP server tests/mcp_registry_e2e.rs spawns. rss-bench and library-profile are dev-only profiling harnesses; see scripts/profile/. Details for each are in ../openhuman-cli/src/bin/README.md.

Feature flags

[features] default in Cargo.toml is the contributor set: what a bare cargo check/cargo test/rust-analyzer compile builds, and deliberately smaller than what the desktop app ships. The product set lives in scripts/ci/product-features.txt and is forwarded by crates/openhuman-app/Cargo.toml; scripts/ci/check-feature-forwarding.mjs asserts the two stay in sync. Slim or headless-embedding builds use --no-default-features --features "<explicit list>".

Gate names (see Cargo.toml for the full rationale behind each): http-server, inference, documents, hosting, modules, voice, web3, runtime-node, contacts, media, flows, skills, mcp, crash-reporting, channels, sandbox-landlock, sandbox-bubblewrap, browser-native, fantoccini, landlock, whatsapp-web, e2e-test-support, rss-bench, rss-bench-dhat, file-logging, scheduler-gate, bin-tools. Read the policy comments above [features] in Cargo.toml before changing either feature list.

Build and test

cargo check --manifest-path Cargo.toml
cargo build --manifest-path Cargo.toml -p openhuman-cli --bin openhuman-core
cargo test -p openhuman
pnpm debug rust [filter]
scripts/test-rust-with-mock.sh   # tests that need the shared mock backend

Auto-discovery (autotests, autoexamples, autobins) is off. Integration tests and examples live at the repo root (../../tests/*.rs, ../../examples/*.rs) with explicit [[test]]/[[example]] targets in Cargo.toml. tests/raw_coverage/*.rs is the one exception: ../../build.rs globs those files into the single raw_coverage_all target instead of one target per file. Four product-gated targets (json_rpc_e2e, observability_smoke, raw_coverage_all, x402_twit_sh_live) declare required-features and are silently skipped, not failed, under the contributor default set. Run them with the product feature set to exercise what ships.

Public entry points

  • run_core_from_args: the CLI entry point used by both crates/openhuman-cli/src/main.rs and the desktop shell binary's core and mcp subcommands. Order: load dotenv, apply the startup restart delay, initialize the keyring master key, then dispatch to core::cli.
  • CoreBuilder to CoreRuntime: the embeddable composition API. openhuman-embed layers a typed facade over it; see gitbooks/developing/embedding.md.
  • openhuman-core serve (alias run): the standalone JSON-RPC/Socket.IO server. Public endpoints: GET /health, GET /schema, GET /events.
0