Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: reformat code and update documentation for consistency

Steven Enamakele99a88d1799c
diff --git a/crates/openhuman-core/src/agent/message_convert.rs b/crates/openhuman-core/src/agent/message_convert.rs
index 7ce2379fb7..d3e64f4a2b 100644
--- a/crates/openhuman-core/src/agent/message_convert.rs
+++ b/crates/openhuman-core/src/agent/message_convert.rs
@@ -19,8 +19,7 @@ use tinyinference_llm::message::{
};
use tinyinference_llm::tool::ToolCall as TaToolCall;
use tinytools_agent::dialect::{
- DialectMessage, DialectResponse, DialectRole, ToolDialect, ToolResultEntry,
- TranscriptEntry,
+ DialectMessage, DialectResponse, DialectRole, ToolDialect, ToolResultEntry, TranscriptEntry,
};
use crate::agent::messages::{ChatMessage, ConversationMessage, ToolResultMessage};
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs
index 5011d528f3..e7d49c28a3 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs
@@ -428,7 +428,8 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext> for Too
&& budget_bytes > 0
&& self.artifact_store.is_some()
&& content.len() > budget_bytes
- && content.len() as u64 <= tinytools_std::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES)
+ && content.len() as u64
+ <= tinytools_std::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES)
.then(|| content.clone());
// 1+2. TinyJuice: the LLM summary stage (when this agent has a
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
index 09d23e95ed..151953d903 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
@@ -33,7 +33,9 @@ fn log_body() -> String {
let rows: String = (0..900)
.map(|i| format!("row {i}: value {}\n", i * 7))
.collect();
- let tail: String = (900..1000).map(|i| format!("row {i}: value {}\n", i * 7)).collect();
+ let tail: String = (900..1000)
+ .map(|i| format!("row {i}: value {}\n", i * 7))
+ .collect();
format!("# Report\n{rows}ERROR: needle in the middle\n{tail}")
}
@@ -45,7 +47,11 @@ async fn store_behind_handle(store: &MemoryCcrStore, content: &str) -> (String,
..CompressOptions::default()
};
let out = tinyjuice::compress_content_with_store(content, None, &options, store).await;
- assert_eq!(out.compressor, CompressorKind::Repl, "handle mode must apply");
+ assert_eq!(
+ out.compressor,
+ CompressorKind::Repl,
+ "handle mode must apply"
+ );
let handle = out.ccr_token.clone().expect("a handle");
(out.text, handle)
}
@@ -58,7 +64,10 @@ fn result_text(result: &ToolResult) -> String {
fn declares_the_three_repl_tools_read_only_capped_and_small() {
let tools = repl_tools();
let names: Vec<&str> = tools.iter().map(|t| t.name()).collect();
- assert_eq!(names, REPL_TOOL_NAMES, "same tools, same order as TinyJuice");
+ assert_eq!(
+ names, REPL_TOOL_NAMES,
+ "same tools, same order as TinyJuice"
+ );
let mut schema_bytes = 0;
for t in &tools {
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 4f02fc7921..25f9d013d9 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -465,15 +465,9 @@ pub fn all_tools_with_runtime(
// diff, lint and test the working tree in the action sandbox. They
// were defined but never registered, so the belts naming them held
// nothing. `Deferred`, so they cost no schema until found.
- Box::new(ReadDiffTool::new(
- action_dir.to_path_buf(),
- )),
- Box::new(RunLinterTool::new(
- action_dir.to_path_buf(),
- )),
- Box::new(RunTestsTool::new(
- action_dir.to_path_buf(),
- )),
+ Box::new(ReadDiffTool::new(action_dir.to_path_buf())),
+ Box::new(RunLinterTool::new(action_dir.to_path_buf())),
+ Box::new(RunTestsTool::new(action_dir.to_path_buf())),
Box::new(PushoverTool::new(
security.clone(),
action_dir.to_path_buf(),
@@ -668,7 +662,9 @@ pub fn all_tools_with_runtime(
// every turn.
if crate::inference::tokenjuice::repl_handle_active(root_config) {
tools.extend(crate::inference::tokenjuice::repl_tools());
- log::debug!("[tools::ops][tokenjuice] registered juice_find, juice_extract, juice_summarize");
+ log::debug!(
+ "[tools::ops][tokenjuice] registered juice_find, juice_extract, juice_summarize"
+ );
}
// Presentation generation (#2778). Native-Rust engine (ppt-rs
diff --git a/crates/openhuman-core/src/tools/ops_tests_repl_tools_tests.rs b/crates/openhuman-core/src/tools/ops_tests_repl_tools_tests.rs
index bd9c6d8b07..5e56a8ea97 100644
--- a/crates/openhuman-core/src/tools/ops_tests_repl_tools_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests_repl_tools_tests.rs
@@ -41,7 +41,9 @@ fn repl_tools_are_absent_whenever_a_handle_cannot_be_produced() {
("compaction off", |c| c.context.compaction_enabled = false),
("router off", |c| c.tokenjuice.router_enabled = false),
("ccr off", |c| c.tokenjuice.ccr_enabled = false),
- ("handle mode off", |c| c.tokenjuice.repl_handle_enabled = false),
+ ("handle mode off", |c| {
+ c.tokenjuice.repl_handle_enabled = false
+ }),
];
for (label, flip) in off {
let mut cfg = test_config(&tmp);
diff --git a/gitbooks/developing/architecture/agent-harness.md b/gitbooks/developing/architecture/agent-harness.md
index 6391f9d645..82b08f0f34 100644
--- a/gitbooks/developing/architecture/agent-harness.md
+++ b/gitbooks/developing/architecture/agent-harness.md
@@ -342,7 +342,7 @@ Before a fresh tool result enters history (and ahead of the byte-budget backstop
- **HTML** → strip markup to readable text.
- **Plain text** → the opt-in Python/ML "Kompress" compressor (ModernBERT), or pass-through.
-Every lossy compression offloads the original to the **CCR (Compress-Cache-Retrieve)** store behind a `⟦tj:<hash>⟧` marker, so compaction is effectively lossless: the agent calls `tokenjuice_retrieve` (token + optional byte/line range) to fetch the full original on demand. The same engine is exposed as a universal `compress_content(content, hint, opts)` for any large payload (file reads, web fetches), and as read-only `tokenjuice.*` debug RPCs. Configured via the `[tokenjuice]` block / `OPENHUMAN_TOKENJUICE_*` env. Agent definitions can override tool-result compression with `tokenjuice_compression = "auto" | "full" | "light" | "off"`; `auto` resolves coding-model agents (`[model] hint = "coding"`) to `light`, which disables CCR-backed lossy compression so coding agents keep raw build/test/diff/search text unless a reduction is truly lossless. Other agents default to `full`. The ML (Kompress) path runs as a `kompress` backend of the shared [`runtime_python_server`](../../../crates/openhuman-core/src/runtime/python_server/) (torch + ModernBERT pip-installed at runtime), gated by the `ml_compression_enabled` flag and degrading gracefully to a native compressor when the Python runtime is unavailable.
+Every lossy compression offloads the original to the **CCR (Compress-Cache-Retrieve)** store behind a `⟦tj:<hash>⟧` marker, so compaction is effectively lossless: the agent calls `tokenjuice_retrieve` (token + optional byte/line range) to fetch the full original on demand. The same engine is exposed as a universal `compress_content(content, hint, opts)` for any large payload (file reads, web fetches), and as read-only `tokenjuice.*` debug RPCs. Compaction is on by default (`context.compaction_enabled`; `OPENHUMAN_COMPACTION=0` opts out). A large result is stored and replaced by a stats line, a 500-character head and a handle that the read-only `juice_find` / `juice_extract` / `juice_summarize` tools query (`tokenjuice.repl_handle_enabled`), so the LLM summary stage is skipped for results that get a handle. Configured via the `[tokenjuice]` block / `OPENHUMAN_TOKENJUICE_*` env. Agent definitions can override tool-result compression with `tokenjuice_compression = "auto" | "full" | "light" | "off"`; `auto` resolves coding-model agents (`[model] hint = "coding"`) to `light`, which disables CCR-backed lossy compression so coding agents keep raw build/test/diff/search text unless a reduction is truly lossless. Other agents default to `full`. The ML (Kompress) path runs as a `kompress` backend of the shared [`runtime_python_server`](../../../crates/openhuman-core/src/runtime/python_server/) (torch + ModernBERT pip-installed at runtime), gated by the `ml_compression_enabled` flag and degrading gracefully to a native compressor when the Python runtime is unavailable.
### Missing capabilities