Skip to content

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

style: apply rustfmt formatting to tokenjuice and repl tool tests

Steven Enamakel19145ab3d8fe
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
index 1b3bf09389..a8a0030c41 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
@@ -456,11 +456,15 @@ fn the_repl_tools_join_a_belt_only_while_handle_mode_is_active() {
let mut inactive = belt();
super::ensure_repl_tools_visible(&mut inactive, false);
- assert!(tinyjuice_bus::tools::REPL_TOOLS.iter().all(|n| !inactive.contains(*n)));
+ assert!(tinyjuice_bus::tools::REPL_TOOLS
+ .iter()
+ .all(|n| !inactive.contains(*n)));
let mut active = belt();
super::ensure_repl_tools_visible(&mut active, true);
- assert!(tinyjuice_bus::tools::REPL_TOOLS.iter().all(|n| active.contains(*n)));
+ assert!(tinyjuice_bus::tools::REPL_TOOLS
+ .iter()
+ .all(|n| active.contains(*n)));
// "No filter" and "deliberately no tools" both stay as they were.
let mut unfiltered = std::collections::HashSet::new();
@@ -499,7 +503,11 @@ async fn a_curated_orchestrator_sees_and_holds_every_juice_tool_in_handle_mode()
);
let registered: std::collections::HashSet<&str> =
agent.tools().iter().map(|t| t.name()).collect();
- for name in tinyjuice_bus::tools::REPL_TOOLS.iter().copied().chain([tinyjuice_bus::tools::RETRIEVE]) {
+ for name in tinyjuice_bus::tools::REPL_TOOLS
+ .iter()
+ .copied()
+ .chain([tinyjuice_bus::tools::RETRIEVE])
+ {
assert!(
visible.contains(name),
"{name} must be visible to the orchestrator"
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index 5714943bc6..b27ef0c8dd 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -60,7 +60,9 @@ pub fn repl_handle_active(config: &crate::config::Config) -> bool {
/// Whether TinyJuice may summarize this agent's tool output. Only the
/// orchestrator gets a summary model, and a zero threshold turns it off.
pub fn summarizes_tool_output(agent_id: &str, config: &crate::config::Config) -> bool {
- enabled(config) && agent_id == "orchestrator" && config.context.summarizer_payload_threshold_tokens > 0
+ enabled(config)
+ && agent_id == "orchestrator"
+ && config.context.summarizer_payload_threshold_tokens > 0
}
/// The TinyJuice tools a compacted result can point the model at: the CCR
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
index 2c330e43d9..d3f6315e6b 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
@@ -18,7 +18,6 @@ pub fn is_repl_tool(name: &str) -> bool {
REPL_TOOLS.contains(&name)
}
-
/// Largest persisted tool-result artifact read through the handle slot: the
/// same limit `file_read` applies, which is also the most the artifact store
/// ever writes.
@@ -77,10 +76,7 @@ pub fn repl_tools_for(config: &crate::config::Config) -> Vec<Box<dyn Tool>> {
if !super::repl_handle_active(config) {
return Vec::new();
}
- log::debug!(
- "[tokenjuice][repl] registering {}",
- REPL_TOOLS.join(", ")
- );
+ log::debug!("[tokenjuice][repl] registering {}", REPL_TOOLS.join(", "));
repl_tools_with_artifacts(
Arc::new(ModuleSource {
config: Some(Arc::new(config.clone())),
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 24e2a63286..5bd883955f 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
@@ -122,11 +122,17 @@ async fn marker_and_bare_handles_reach_the_source_and_junk_does_not() {
let source = Arc::new(RecordingSource::default());
let tools = repl_tools_with(source.clone(), ReplLimits::default());
for ok in ["abc123", " abc123 ", "\u{27e6}tj:abc123\u{27e7}"] {
- let r = tools[0].execute(json!({"handle": ok, "query":"x"})).await.unwrap();
+ let r = tools[0]
+ .execute(json!({"handle": ok, "query":"x"}))
+ .await
+ .unwrap();
assert!(!r.output().contains("not a juice handle"), "{ok}");
}
for bad in ["call_abc", "../x", &"f".repeat(65)] {
- let r = tools[0].execute(json!({"handle": bad, "query":"x"})).await.unwrap();
+ let r = tools[0]
+ .execute(json!({"handle": bad, "query":"x"}))
+ .await
+ .unwrap();
assert!(r.is_error, "{bad}");
}
}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
index 165335ac64..5d6657a44a 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
@@ -51,10 +51,7 @@ async fn retrieve_messages_name_only_the_tool_the_model_can_call() {
.unwrap()
.output();
for msg in [missing, miss_message("deadbeefcafe")] {
- assert!(
- msg.contains(tinyjuice_bus::tools::RETRIEVE),
- "{msg}"
- );
+ assert!(msg.contains(tinyjuice_bus::tools::RETRIEVE), "{msg}");
assert!(!msg.contains("tokenjuice_retrieve"), "{msg}");
assert!(!msg.contains("tinyjuice_retrieve"), "{msg}");
}
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 c6d6235a19..faff73d05c 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
@@ -90,13 +90,10 @@ fn juice_off_registers_no_juice_or_recovery_tools() {
let mut cfg = test_config(&tmp);
cfg.components.juice = false;
let names = tool_names(&registry_for(&tmp, &cfg));
- for absent in tinyjuice_bus::tools::REPL_TOOLS
- .iter()
- .chain([
- &tinyjuice_bus::tools::RETRIEVE,
- &tinyjuice_bus::tools::LEGACY_RETRIEVE,
- ])
- {
+ for absent in tinyjuice_bus::tools::REPL_TOOLS.iter().chain([
+ &tinyjuice_bus::tools::RETRIEVE,
+ &tinyjuice_bus::tools::LEGACY_RETRIEVE,
+ ]) {
assert!(!names.iter().any(|n| n == absent), "`{absent}` registered");
}
// Unchanged elsewhere: the rest of the registry is still there.