Skip to content

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

test(session_host): use fully qualified juice tool constants

Steven Enamakel20fbdff0a26c
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 91b24474f7..1b3bf09389 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
@@ -357,7 +357,6 @@ async fn a_zero_tool_agent_does_not_gain_the_compaction_recovery_tool() {
// quietly become "one tool" — and there is nothing for it to recover,
// because an agent with no tools produces no tool output to truncate.
use crate::agent::session_host::types::OpenHumanSessionHost;
- use tinyjuice_bus::tools::RETRIEVE;
// Tolerant of an already-initialised singleton: this binary shares one
// `OnceLock` across every test, so whether we are first is a property of
@@ -372,7 +371,7 @@ async fn a_zero_tool_agent_does_not_gain_the_compaction_recovery_tool() {
assert!(
!agent
.visible_tool_names_for_test()
- .contains(RETRIEVE_TOOL_NAME),
+ .contains(tinyjuice_bus::tools::RETRIEVE),
"a deliberately tool-less agent must not be handed the recovery tool"
);
}
@@ -415,7 +414,6 @@ async fn a_summarized_agent_sees_the_recovery_tool_with_compaction_off() {
// the compaction router off (the default). The orchestrator is the agent
// that gets them, so it must see the tool whatever the router says.
use crate::agent::session_host::types::OpenHumanSessionHost;
- use tinyjuice_bus::tools::RETRIEVE;
let _ = crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins();
@@ -427,23 +425,22 @@ async fn a_summarized_agent_sees_the_recovery_tool_with_compaction_off() {
.expect("orchestrator is a shipped agent definition");
let visible = agent.visible_tool_names_for_test();
assert!(
- visible.is_empty() || visible.contains(RETRIEVE_TOOL_NAME),
+ visible.is_empty() || visible.contains(tinyjuice_bus::tools::RETRIEVE),
"the orchestrator's summaries point at a tool it must be able to call"
);
}
#[test]
fn the_recovery_tool_joins_a_belt_only_when_something_can_point_at_it() {
- use tinyjuice_bus::tools::RETRIEVE;
let belt = || std::collections::HashSet::from(["web_fetch".to_string()]);
let mut unused = belt();
super::ensure_recovery_tool_visible(&mut unused, false);
- assert!(!unused.contains(RETRIEVE_TOOL_NAME));
+ assert!(!unused.contains(tinyjuice_bus::tools::RETRIEVE));
let mut needed = belt();
super::ensure_recovery_tool_visible(&mut needed, true);
- assert!(needed.contains(RETRIEVE_TOOL_NAME));
+ assert!(needed.contains(tinyjuice_bus::tools::RETRIEVE));
let tmp = tempfile::TempDir::new().unwrap();
let mut config = test_config(&tmp);
@@ -455,16 +452,15 @@ fn the_recovery_tool_joins_a_belt_only_when_something_can_point_at_it() {
#[test]
fn the_repl_tools_join_a_belt_only_while_handle_mode_is_active() {
use crate::agent::harness::definition::NO_TOOLS_SENTINEL;
- use tinyjuice_bus::tools::REPL_TOOLS;
let belt = || std::collections::HashSet::from(["web_fetch".to_string()]);
let mut inactive = belt();
super::ensure_repl_tools_visible(&mut inactive, false);
- assert!(REPL_TOOL_NAMES.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!(REPL_TOOL_NAMES.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();
@@ -483,7 +479,6 @@ async fn a_curated_orchestrator_sees_and_holds_every_juice_tool_in_handle_mode()
// (`ToolScope::Named`) belt that lacked them was told to call tools it
// could not dispatch.
use crate::agent::session_host::types::OpenHumanSessionHost;
- use tinyjuice_bus::tools::{REPL_TOOLS as REPL_TOOL_NAMES, RETRIEVE as RETRIEVE_TOOL_NAME};
let _ = crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins();
@@ -504,7 +499,7 @@ 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 REPL_TOOL_NAMES.iter().copied().chain([RETRIEVE_TOOL_NAME]) {
+ 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/agent/session_host/runtime_session_juice_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_juice_tests.rs
index e0079107c0..2be1cc2e93 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_juice_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_juice_tests.rs
@@ -5,7 +5,6 @@ use super::*;
#[tokio::test]
async fn a_resumed_thread_keeps_recorded_juice_specs_and_executors_when_repl_is_off() {
use crate::inference::tokenjuice::repl_tools_for;
- use tinyjuice_bus::tools::REPL_TOOLS as REPL_TOOL_NAMES;
crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins()
.expect("builtin definitions");
@@ -30,7 +29,7 @@ async fn a_resumed_thread_keeps_recorded_juice_specs_and_executors_when_repl_is_
.iter()
.map(|spec| spec.name.as_str())
.collect::<Vec<_>>(),
- REPL_TOOL_NAMES
+ tinyjuice_bus::tools::REPL_TOOLS
);
for spec in &mut recorded_specs {
spec.description = format!("frozen declaration for {}", spec.name);
@@ -149,7 +148,6 @@ async fn a_resumed_thread_keeps_recorded_juice_specs_and_executors_when_repl_is_
#[tokio::test]
async fn resumed_juice_snapshot_does_not_add_live_repl_declarations() {
use crate::inference::tokenjuice::repl_tools_for;
- use tinyjuice_bus::tools::REPL_TOOLS as REPL_TOOL_NAMES;
crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins()
.expect("builtin definitions");
@@ -167,7 +165,7 @@ async fn resumed_juice_snapshot_does_not_add_live_repl_declarations() {
config.tokenjuice.repl_handle_enabled = true;
let mut recorded_spec = repl_tools_for(&config)
.into_iter()
- .find(|tool| tool.name() == REPL_TOOL_NAMES[0])
+ .find(|tool| tool.name() == tinyjuice_bus::tools::REPL_TOOLS[0])
.expect("juice_find")
.spec();
recorded_spec.description = "frozen juice_find declaration".into();
@@ -199,7 +197,7 @@ async fn resumed_juice_snapshot_does_not_add_live_repl_declarations() {
.filter(|spec| crate::inference::tokenjuice::is_repl_tool(&spec.name))
.map(|spec| spec.name.as_str())
.collect::<Vec<_>>();
- assert_eq!(juice_names, [REPL_TOOL_NAMES[0]]);
+ assert_eq!(juice_names, [tinyjuice_bus::tools::REPL_TOOLS[0]]);
let frozen = prepared
.specs()
.iter()