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
refactor(agent): move debug module under core::agent_cli
Steven Enamakel9aa7ed2d7373
diff --git a/crates/openhuman-core/src/agent/context/README.md b/crates/openhuman-core/src/agent/context/README.mdindex a7e49b9174..c3dd6d2a3d 100644--- a/crates/openhuman-core/src/agent/context/README.md+++ b/crates/openhuman-core/src/agent/context/README.md@@ -76,7 +76,7 @@ No `store.rs`. State is per-session and in-memory:- `agent::tinyagents`: `turn_middleware.rs` reads `CLEARED_PLACEHOLDER` when configuring `MicrocompactMiddleware`; `payload_summarizer.rs` and `host/context_composer.rs` build `PromptContext`s through `agent::prompts`.- **`agent_registry::agents/*/prompt.rs`**, `flows/agents/*/prompt.rs`, `skills/*/agent/*/prompt.rs`: archetype prompt modules pull prompt sections/builder through `agent::prompts`.- `channels`: [`channels/system_prompt.rs`](../../channels/system_prompt.rs) (`ChannelSystemPrompt`, used by [`channels/runtime/startup/start_channels.rs`](../../channels/runtime/startup/start_channels.rs)) calls `channels_prompt::build_system_prompt_with_identity`; [`channels/mod.rs`](../../channels/mod.rs) re-exports `build_system_prompt`; the `channels/tests/*` prompt/identity tests call it directly.-- `triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `tools::orchestrator_tools`, `integrations::composio`: consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.+- `triage`, `core::agent_cli::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `tools::orchestrator_tools`, `integrations::composio`: consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.## Notes / gotchasdiff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rsindex 28b0ea2eda..006582f8cb 100644--- a/crates/openhuman-core/src/agent/mod.rs+++ b/crates/openhuman-core/src/agent/mod.rs@@ -22,7 +22,6 @@ pub use crate::attachments::HostAttachment;pub mod bus;pub mod context;pub(crate) mod cost;-pub mod debug;pub mod goals;pub mod harness;pub mod hooks;diff --git a/crates/openhuman-core/src/agent/prompts/README.md b/crates/openhuman-core/src/agent/prompts/README.mdindex e6fb4c13ef..dca596a4e6 100644--- a/crates/openhuman-core/src/agent/prompts/README.md+++ b/crates/openhuman-core/src/agent/prompts/README.md@@ -150,7 +150,7 @@ user message via `current_datetime_line`).the tool-policy boundary.- `agent/session_host/builder/factory.rs`: picks the entry point per`PromptSource`.-- [`agent/debug/`](../debug/): `dump_agent_prompt` / `dump_all_agent_prompts` ([`mod.rs`](./mod.rs))+- [`core/agent_cli/debug/`](../debug/): `dump_agent_prompt` / `dump_all_agent_prompts` ([`mod.rs`](./mod.rs))build the same `PromptContext` to render each agent's prompt,`dump_writer.rs` writes it to disk, `prompt_size.rs` measures it.diff --git a/crates/openhuman-core/src/agent_runs/context_breakdown.rs b/crates/openhuman-core/src/agent_runs/context_breakdown.rsindex 20b8a706a0..5e58bcc2ac 100644--- a/crates/openhuman-core/src/agent_runs/context_breakdown.rs+++ b/crates/openhuman-core/src/agent_runs/context_breakdown.rs@@ -17,8 +17,8 @@ use std::sync::Mutex;use once_cell::sync::Lazy;use serde::{Deserialize, Serialize};-use crate::agent::debug::DumpPromptOptions;-use crate::agent::debug::prompt_size::{PromptSizeReport, SectionSize, ToolSize};+use crate::core::agent_cli::debug::DumpPromptOptions;+use crate::core::agent_cli::debug::prompt_size::{PromptSizeReport, SectionSize, ToolSize};use crate::config::Config;use crate::core::Outcome;use crate::core::runtime::DispatchCtx;@@ -65,7 +65,7 @@ pub struct ContextBreakdownResponse {}fn est_tokens(bytes: usize) -> usize {- bytes / crate::agent::debug::prompt_size::EST_BYTES_PER_TOKEN.max(1)+ bytes / crate::core::agent_cli::debug::prompt_size::EST_BYTES_PER_TOKEN.max(1)}/// Coarse "did anything in config change" fingerprint. Correctness only@@ -158,7 +158,7 @@ async fn history_section(// the module's own byte-per-token estimate so `bytes` stays a consistent// (if approximate) unit across every section in the response.let est = history_tokens(usage.last_turn_context_tokens as usize, fixed_prompt_tokens);- let bytes = est.saturating_mul(crate::agent::debug::prompt_size::EST_BYTES_PER_TOKEN);+ let bytes = est.saturating_mul(crate::core::agent_cli::debug::prompt_size::EST_BYTES_PER_TOKEN);Some(ContextSection {label: "history".to_string(),bytes,diff --git a/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rs b/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rsindex b3d1136146..db475caf72 100644--- a/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rs+++ b/crates/openhuman-core/src/agent_runs/context_breakdown_tests.rs@@ -1,6 +1,6 @@use super::*;-use crate::agent::debug::DumpedPrompt;-use crate::agent::debug::prompt_size::PromptSizeReport;+use crate::core::agent_cli::debug::DumpedPrompt;+use crate::core::agent_cli::debug::prompt_size::PromptSizeReport;fn sample_dump() -> DumpedPrompt {DumpedPrompt {@@ -44,7 +44,7 @@ fn tools_section_rolls_up_every_tool_into_one_row() {fn est_tokens_divides_by_the_shared_bytes_per_token_constant() {assert_eq!(est_tokens(400),- 400 / crate::agent::debug::prompt_size::EST_BYTES_PER_TOKEN+ 400 / crate::core::agent_cli::debug::prompt_size::EST_BYTES_PER_TOKEN);assert_eq!(est_tokens(0), 0);}diff --git a/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rs b/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rsindex ee6017bf20..e746305663 100644--- a/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rs+++ b/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rs@@ -7,13 +7,10 @@ mod cancel;#[path = "../../agent/orchestration/workflow_runs/engine/lifecycle.rs"]mod lifecycle;const LOG_TARGET: &str = "workflow_run_engine";-mod engine {- pub(super) use super::lifecycle::{resume_workflow_run, start_workflow_run, stop_workflow_run};-}mod ops;mod schemas;-pub(crate) use engine::{resume_workflow_run, start_workflow_run, stop_workflow_run};+pub(crate) use lifecycle::{resume_workflow_run, start_workflow_run, stop_workflow_run};pub(crate) use ops::{PARALLEL_RESEARCH_ID, builtin_definitions, definition_by_id, get_run, list_definitions,list_runs,diff --git a/crates/openhuman-core/src/agent_runs/workflow_runs/schemas.rs b/crates/openhuman-core/src/agent_runs/workflow_runs/schemas.rsindex a8ed0793da..741a45e8bf 100644--- a/crates/openhuman-core/src/agent_runs/workflow_runs/schemas.rs+++ b/crates/openhuman-core/src/agent_runs/workflow_runs/schemas.rs@@ -210,7 +210,7 @@ fn handle_start(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFutur.and_then(|v| v.as_str()).map(str::to_string);log::debug!(target: "workflow_run_rpc", "[workflow_run_rpc][{cid}] start.definition={definition_id}");- let run = super::engine::start_workflow_run(+ let run = super::start_workflow_run(&ctx,&config,&definition_id,@@ -240,7 +240,7 @@ fn handle_stop(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture.and_then(|v| v.as_str()).ok_or_else(|| "missing required param: id".to_string())?;log::debug!(target: "workflow_run_rpc", "[workflow_run_rpc][{cid}] stop.id={id}");- let run = super::engine::stop_workflow_run(&config, id).await.map_err(|e| {+ let run = super::stop_workflow_run(&config, id).await.map_err(|e| {let s = e.to_string();log::warn!(target: "workflow_run_rpc", "[workflow_run_rpc][{cid}] stop.error id={id} err={s}");s@@ -262,7 +262,7 @@ fn handle_resume(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFutu.and_then(|v| v.as_str()).ok_or_else(|| "missing required param: id".to_string())?;log::debug!(target: "workflow_run_rpc", "[workflow_run_rpc][{cid}] resume.id={id}");- let run = super::engine::resume_workflow_run(&ctx, &config, id).await.map_err(|e| {+ let run = super::resume_workflow_run(&ctx, &config, id).await.map_err(|e| {let s = e.to_string();log::warn!(target: "workflow_run_rpc", "[workflow_run_rpc][{cid}] resume.error id={id} err={s}");sdiff --git a/crates/openhuman-core/src/core/agent_cli.rs b/crates/openhuman-core/src/core/agent_cli.rsindex 4aa2e03be5..bf4e185d5d 100644--- a/crates/openhuman-core/src/core/agent_cli.rs+++ b/crates/openhuman-core/src/core/agent_cli.rs@@ -23,12 +23,14 @@use anyhow::{anyhow, Result};use std::path::PathBuf;-use crate::agent::debug::prompt_size::{render_text, PromptSizeReport};-use crate::agent::debug::{+use crate::core::agent_cli::debug::prompt_size::{render_text, PromptSizeReport};+use crate::core::agent_cli::debug::{dump_agent_prompt, dump_all_agent_prompts, write_prompt_dumps, DumpPromptOptions, DumpedPrompt,};use crate::agent_registry::host_definition::AgentDefinitionRegistry;+pub(crate) mod debug;+/// Entry point for `openhuman agent <subcommand>`.pub fn run_agent_command(args: &[String]) -> Result<()> {if args.is_empty() || is_help(&args[0]) {@@ -466,7 +468,7 @@ fn run_dump_prompt(args: &[String]) -> Result<()> {// and splitting the header onto stderr the way `print_human` does// would make `> turn.txt` drop the byte counts that give the payload// its meaning.- print!("{}", crate::agent::debug::render_wire_dump(&dumped));+ print!("{}", crate::core::agent_cli::debug::render_wire_dump(&dumped));} else if flags.json {print_json(&dumped, flags.with_tools)?;} else {diff --git a/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rs b/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rsindex f257a62ab3..178fe2e6dc 100644--- a/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rs+++ b/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rs@@ -94,7 +94,7 @@ fn session_report_measures_the_visible_belt_not_the_registry() {).expect("critic session build");- let dumped = crate::agent::debug::session_dump(&agent, "critic", String::new());+ let dumped = crate::core::agent_cli::debug::session_dump(&agent, "critic", String::new());let report = PromptSizeReport::from_dump(&dumped);let mut visible: Vec<String> = agentdiff --git a/crates/openhuman-core/src/integrations/composio/README.md b/crates/openhuman-core/src/integrations/composio/README.mdindex 930fa5b015..431e1b1079 100644--- a/crates/openhuman-core/src/integrations/composio/README.md+++ b/crates/openhuman-core/src/integrations/composio/README.md@@ -173,7 +173,7 @@ Published from `ops/` via `crate::core::bus::BUS.publish` (`crate::core::events:- `crates/openhuman-core/src/core/all.rs`: registers the controllers.- `crates/openhuman-core/src/tools/{mod,ops}.rs`, [`tools/schemas/composio.rs`](../../tools/schemas/composio.rs): wires agent tools into the tool registry.- `crates/openhuman-core/src/core/runtime/subscribers.rs`: at startup initializes trigger history and registers the three bus subscribers.-- `crates/openhuman-core/src/agent/**`: session-host tool assembly (deferred per-action tools, recorded-tool rebuild), triage escalation and debug (e.g. [`agent/subagent_host/`](../../agent/subagent_host/), [`agent/orchestration/tools/`](../../agent/orchestration/tools/), [`agent/debug/mod.rs`](../../agent/debug/mod.rs)).+- `crates/openhuman-core/src/agent/**`: session-host tool assembly (deferred per-action tools, recorded-tool rebuild), triage escalation and debug (e.g. [`agent/subagent_host/`](../../agent/subagent_host/), [`agent/orchestration/tools/`](../../agent/orchestration/tools/), [`core/agent_cli/debug/mod.rs`](../../core/agent_cli/debug/mod.rs)).- [`crates/openhuman-core/src/platform/socket/event_handlers.rs`](../../platform/socket/event_handlers.rs): parses `composio:trigger` and publishes `ComposioTriggerReceived`.- [`crates/openhuman-core/src/agent/prompts/connected_identities.rs`](../../agent/prompts/connected_identities.rs): renders connected identities into the agent prompt.- [`crates/openhuman-core/src/skills/preflight.rs`](../../skills/preflight.rs): identity gate via `connection_identity`.