Skip to content

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

chore: files changed crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs,crates/op

Steven Enamakel8ee037668094
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 4303153673..91b24474f7 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,7 @@ 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 crate::inference::tokenjuice::RETRIEVE_TOOL_NAME;
+ 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
@@ -415,7 +415,7 @@ 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 crate::inference::tokenjuice::RETRIEVE_TOOL_NAME;
+ use tinyjuice_bus::tools::RETRIEVE;
let _ = crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins();
@@ -434,7 +434,7 @@ async fn a_summarized_agent_sees_the_recovery_tool_with_compaction_off() {
#[test]
fn the_recovery_tool_joins_a_belt_only_when_something_can_point_at_it() {
- use crate::inference::tokenjuice::RETRIEVE_TOOL_NAME;
+ use tinyjuice_bus::tools::RETRIEVE;
let belt = || std::collections::HashSet::from(["web_fetch".to_string()]);
let mut unused = belt();
@@ -455,7 +455,7 @@ 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 crate::inference::tokenjuice::REPL_TOOL_NAMES;
+ use tinyjuice_bus::tools::REPL_TOOLS;
let belt = || std::collections::HashSet::from(["web_fetch".to_string()]);
let mut inactive = belt();
@@ -483,7 +483,7 @@ 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 crate::inference::tokenjuice::{REPL_TOOL_NAMES, RETRIEVE_TOOL_NAME};
+ use tinyjuice_bus::tools::{REPL_TOOLS as REPL_TOOL_NAMES, RETRIEVE as RETRIEVE_TOOL_NAME};
let _ = crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins();
diff --git a/crates/openhuman-core/src/agent/session_host/builder/mod.rs b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
index 816b8411d4..f8aadf92ed 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
@@ -246,7 +246,7 @@ pub(super) fn ensure_repl_tools_visible(
return;
}
if !crate::agent::harness::definition::is_empty_tool_scope(visible) {
- for name in crate::inference::tokenjuice::REPL_TOOL_NAMES {
+ for name in tinyjuice_bus::tools::REPL_TOOLS {
visible.insert((*name).to_string());
}
}
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 1a464585ae..e0079107c0 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
@@ -4,7 +4,8 @@ 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, REPL_TOOL_NAMES};
+ 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");
@@ -147,7 +148,8 @@ 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, REPL_TOOL_NAMES};
+ 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");
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
index dc1815658f..7ba35e49d2 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
@@ -344,7 +344,7 @@ async fn a_run_without_a_thread_keeps_one_scope() {
fn repl_tools_are_exempt_from_compaction_but_not_from_the_cap() {
// Compacting a `juice_find` answer would store it behind a second handle.
// The byte cap must still apply: each REPL tool declares its own limit.
- for tool in crate::inference::tokenjuice::REPL_TOOL_NAMES {
+ for tool in tinyjuice_bus::tools::REPL_TOOLS {
assert!(is_compaction_exempt(tool), "{tool} must not be compacted");
assert!(
!is_truncation_exempt(tool),
diff --git a/crates/openhuman-core/src/inference/tokenjuice/README.md b/crates/openhuman-core/src/inference/tokenjuice/README.md
index b01557dd6c..0d2492697b 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/README.md
+++ b/crates/openhuman-core/src/inference/tokenjuice/README.md
@@ -21,7 +21,7 @@ OpenHuman-owned files:
| [`config_patch.rs`](./config_patch.rs) | Partial update shape for the `[tokenjuice]` config block. |
| [`generate.rs`](./generate.rs) | Turn-bound, single-use summary callbacks. The host registers the model call, sends its opaque ticket through the existing contract, and withdraws the callback when the ticket drops. |
| [`repl_tools.rs`](./repl_tools.rs) | The three REPL tools (`juice_find`, `juice_extract`, `juice_summarize`) over a stored result. Declarations come from `tinyjuice-bus`; operations execute over `Query` inside the module CCR store. Registered by [`tools/ops.rs`](../../tools/ops.rs) only while `repl_handle_active(config)`. |
-| [`tools.rs`](./tools.rs) | OpenHuman agent tool implementation for the retrieve tool (`RETRIEVE_TOOL_NAME = "juice_retrieve"`; `"tokenjuice_retrieve"` is a recognized recovery-tool alias, not the tool's registered name, see `RECOVERY_TOOL_NAMES`). |
+| [`tools.rs`](./tools.rs) | OpenHuman agent tool implementation for the retrieve tool (`tinyjuice_bus::tools::RETRIEVE` (`"juice_retrieve"`); `"tokenjuice_retrieve"` is a recognized recovery-tool alias, not the tool's registered name, see `RECOVERY_TOOL_NAMES`). |
| Plain text | Compressed with TinyJuice's deterministic TextCrusher. |
| [`savings.rs`](./savings.rs) | OpenHuman model-pricing attribution and persisted dashboard stats. |
@@ -61,7 +61,7 @@ behavior. There is no linked implementation fallback.
- `tools/ops.rs` registers `crate::inference::tokenjuice::TokenjuiceRetrieveTool::new()`
in the agent tool catalog (it is not re-exported through [`tools/mod.rs`](../../tools/mod.rs)) and
treats every `RECOVERY_TOOL_NAMES` entry as a recovery tool. The registered
- tool name is `RETRIEVE_TOOL_NAME` (`"juice_retrieve"`);
+ tool name is `tinyjuice_bus::tools::RETRIEVE` (`"juice_retrieve"`);
`"tokenjuice_retrieve"` and `LEGACY_RETRIEVE_TOOL_NAME`
(`"retrieve_tool_output"`) are recognized aliases only. Only
`RECOVERY_TOOL_VISIBLE` (the live tool) is force-added to a curated
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index aa41ad53d1..f26836452e 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -11,20 +11,18 @@ pub mod tools;
use tinyjuice_bus::names::methods;
use tinyjuice_bus::types::{AgentTokenjuiceCompression, CompressorKind, ContentKind};
-pub use repl_tools::{is_repl_tool, repl_tools, repl_tools_for, REPL_TOOL_NAMES};
+pub use repl_tools::{is_repl_tool, repl_tools, repl_tools_for};
pub use tools::TokenjuiceRetrieveTool;
use tinyjuice_bus::wire::InstallRequest;
-pub use tinyjuice_bus::tools::{
- LEGACY_RETRIEVE as LEGACY_TINYJUICE_RETRIEVE_TOOL_NAME, RETRIEVE as RETRIEVE_TOOL_NAME,
-};
+use tinyjuice_bus::tools::{LEGACY_RETRIEVE, REPL_TOOLS, RETRIEVE};
pub const LEGACY_RETRIEVE_TOOL_NAME: &str = "retrieve_tool_output";
/// Every name the recovery surface answers to: the live tool plus the two
/// migration aliases a replayed transcript may still call.
pub const RECOVERY_TOOL_NAMES: &[&str] = &[
- RETRIEVE_TOOL_NAME,
- LEGACY_TINYJUICE_RETRIEVE_TOOL_NAME,
+ RETRIEVE,
+ LEGACY_RETRIEVE,
"tokenjuice_retrieve",
LEGACY_RETRIEVE_TOOL_NAME,
];
@@ -33,7 +31,7 @@ pub const RECOVERY_TOOL_NAMES: &[&str] = &[
/// advertise. Only the live tool: the aliases stay registered so an old
/// transcript replays, but putting all three on the wire charged every
/// Named agent for three copies of one schema.
-pub const RECOVERY_TOOL_VISIBLE: &[&str] = &[RETRIEVE_TOOL_NAME];
+pub const RECOVERY_TOOL_VISIBLE: &[&str] = &[RETRIEVE];
pub fn is_recovery_tool(name: &str) -> bool {
RECOVERY_TOOL_NAMES.contains(&name)
@@ -72,7 +70,7 @@ pub fn companion_tool_names(agent_id: &str, config: &crate::config::Config) -> V
names.extend(RECOVERY_TOOL_VISIBLE.iter().copied());
}
if repl_handle_active(config) {
- names.extend(REPL_TOOL_NAMES.iter().copied());
+ names.extend(REPL_TOOLS.iter().copied());
}
names
}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
index 1da518b3f9..b2262866fc 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
@@ -2,8 +2,8 @@ use super::*;
#[test]
fn recovery_tool_aliases_remain_stable() {
- assert!(is_recovery_tool(RETRIEVE_TOOL_NAME));
- assert!(is_recovery_tool(LEGACY_RETRIEVE_TOOL_NAME));
+ assert!(is_recovery_tool(tinyjuice_bus::tools::RETRIEVE));
+ assert!(is_recovery_tool(LEGACY_tinyjuice_bus::tools::RETRIEVE));
assert!(!is_recovery_tool("shell"));
}
@@ -53,7 +53,7 @@ async fn the_module_defers_a_summary_until_requested() {
.text
.contains("the rate limit is 60 requests a minute"));
assert!(
- output.text.contains(RETRIEVE_TOOL_NAME),
+ output.text.contains(tinyjuice_bus::tools::RETRIEVE),
"the original stays retrievable: {}",
output.text
);
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
index 45c3cbdc4c..2c330e43d9 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
@@ -12,10 +12,10 @@ use tinyjuice_bus::wire::{QueryError, QueryRequest, QueryResponse, QueryTarget};
use tinytools::{PermissionLevel, Tool, ToolResult};
/// The query tools TinyJuice declares. The footer suggests a subset of these.
-pub use tinyjuice_bus::tools::REPL_TOOLS as REPL_TOOL_NAMES;
+use tinyjuice_bus::tools::REPL_TOOLS;
pub fn is_repl_tool(name: &str) -> bool {
- REPL_TOOL_NAMES.contains(&name)
+ REPL_TOOLS.contains(&name)
}
@@ -79,7 +79,7 @@ pub fn repl_tools_for(config: &crate::config::Config) -> Vec<Box<dyn Tool>> {
}
log::debug!(
"[tokenjuice][repl] registering {}",
- REPL_TOOL_NAMES.join(", ")
+ REPL_TOOLS.join(", ")
);
repl_tools_with_artifacts(
Arc::new(ModuleSource {
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 f719d29186..24e2a63286 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
@@ -39,7 +39,7 @@ fn declarations_preserve_names_schemas_and_read_only_caps() {
let tools = repl_tools();
assert_eq!(
tools.iter().map(|t| t.name()).collect::<Vec<_>>(),
- REPL_TOOL_NAMES
+ tinyjuice_bus::tools::REPL_TOOLS
);
for (tool, declaration) in tools
.iter()
diff --git a/crates/openhuman-core/src/inference/tokenjuice/tools.rs b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
index f08043ed7a..e757e6e143 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
@@ -31,7 +31,7 @@ impl Default for TokenjuiceRetrieveTool {
#[async_trait]
impl Tool for TokenjuiceRetrieveTool {
fn name(&self) -> &str {
- super::RETRIEVE_TOOL_NAME
+ tinyjuice_bus::tools::RETRIEVE
}
fn description(&self) -> &str {
@@ -79,7 +79,7 @@ impl Tool for TokenjuiceRetrieveTool {
let Some(token) = token else {
return Ok(ToolResult::error(format!(
"{}: missing required 'token' argument",
- super::RETRIEVE_TOOL_NAME
+ tinyjuice_bus::tools::RETRIEVE
)));
};
@@ -137,7 +137,7 @@ fn miss_message(token: &str) -> String {
again. Proceed using the compacted summary already shown above; only if a \
specific missing detail is essential, retry with narrower arguments (a tighter \
query, filter, or smaller limit) so the result is small enough to keep in full.",
- tool = super::RETRIEVE_TOOL_NAME
+ tool = tinyjuice_bus::tools::RETRIEVE
)
}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
index 3c68304133..165335ac64 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
@@ -52,7 +52,7 @@ async fn retrieve_messages_name_only_the_tool_the_model_can_call() {
.output();
for msg in [missing, miss_message("deadbeefcafe")] {
assert!(
- msg.contains(crate::inference::tokenjuice::RETRIEVE_TOOL_NAME),
+ msg.contains(tinyjuice_bus::tools::RETRIEVE),
"{msg}"
);
assert!(!msg.contains("tokenjuice_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 02ac2eefb5..5db3e7bb21 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
@@ -30,8 +30,8 @@ fn repl_tools_are_registered_by_default_with_the_recovery_tool() {
let cfg = test_config(&tmp);
assert!(crate::inference::tokenjuice::repl_handle_active(&cfg));
let names = tool_names(&registry_for(&tmp, &cfg));
- assert_contains_all(&names, crate::inference::tokenjuice::REPL_TOOL_NAMES);
- assert_contains_all(&names, &[crate::inference::tokenjuice::RETRIEVE_TOOL_NAME]);
+ assert_contains_all(&names, tinyjuice_bus::tools::REPL_TOOLS);
+ assert_contains_all(&names, &[tinyjuice_bus::tools::RETRIEVE]);
}
#[test]
@@ -54,27 +54,27 @@ fn repl_tools_are_absent_whenever_a_handle_cannot_be_produced() {
"{label}"
);
let names = tool_names(&registry_for(&tmp, &cfg));
- for absent in crate::inference::tokenjuice::REPL_TOOL_NAMES {
+ for absent in tinyjuice_bus::tools::REPL_TOOLS {
assert!(
!names.iter().any(|n| n == absent),
"{label}: `{absent}` must not be registered"
);
}
// The whole-original recovery tool is independent of handle mode.
- assert_contains_all(&names, &[crate::inference::tokenjuice::RETRIEVE_TOOL_NAME]);
+ assert_contains_all(&names, &[tinyjuice_bus::tools::RETRIEVE]);
}
}
#[test]
fn repl_tools_belong_to_the_inference_family_and_are_read_only() {
use crate::core::all::DomainGroup;
- for name in crate::inference::tokenjuice::REPL_TOOL_NAMES {
+ for name in tinyjuice_bus::tools::REPL_TOOLS {
assert_eq!(tool_group(name), DomainGroup::Inference, "{name}");
}
let tmp = TempDir::new().unwrap();
let cfg = test_config(&tmp);
let tools = registry_for(&tmp, &cfg);
- for name in crate::inference::tokenjuice::REPL_TOOL_NAMES {
+ for name in tinyjuice_bus::tools::REPL_TOOLS {
let tool = find_tool(&tools, name);
assert_eq!(
tool.permission_level(),