Skip to content

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

fix(tokenjuice): advertise only the live recovery tool to curated agents

Steven Enamakel72bf8d429a1f
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 375934dce6..db38f6afc4 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
@@ -159,12 +159,14 @@ pub(super) fn visible_tool_specs_for_policy(
.collect()
}
-/// Ensure the CCR recovery tool (`retrieve_tool_output`) is a member of a
+/// Ensure the CCR recovery tool (`tinyjuice_retrieve`) is a member of a
/// non-empty visibility allowlist. Compaction runs on every agent's tool
/// output, so any agent with a curated `ToolScope::Named` list must still be
-/// able to act on a `retrieve_tool_output("…")` footer. An empty set already
-/// means "no filter" (all tools visible), so it is left untouched — including
-/// the deliberately tool-less `Named([])` case, which must stay tool-less.
+/// able to act on a `⟦tj:…⟧` marker. Only the live tool is added; the legacy
+/// aliases in `RECOVERY_TOOL_NAMES` stay registered for transcript replay but
+/// off the wire. An empty set already means "no filter" (all tools visible),
+/// so it is left untouched — including the deliberately tool-less
+/// `Named([])` case, which must stay tool-less.
pub(super) fn ensure_recovery_tool_visible(visible: &mut std::collections::HashSet<String>) {
// `is_empty_tool_scope`, not `is_empty`: a belt holding only
// `NO_TOOLS_SENTINEL` is a deliberate zero-tool agent, and the compaction
@@ -172,7 +174,7 @@ pub(super) fn ensure_recovery_tool_visible(visible: &mut std::collections::HashS
// to truncate. Adding it would turn "no tools" into "one tool" and put a
// schema back on a turn whose whole point is that it stays flat.
if !crate::agent::harness::definition::is_empty_tool_scope(visible) {
- for name in crate::inference::tokenjuice::RECOVERY_TOOL_NAMES {
+ for name in crate::inference::tokenjuice::RECOVERY_TOOL_VISIBLE {
visible.insert((*name).to_string());
}
}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index 7839cb3a8d..d5984adbdf 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -16,12 +16,20 @@ use types::InstallRequest;
pub const RETRIEVE_TOOL_NAME: &str = "tinyjuice_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,
"tokenjuice_retrieve",
LEGACY_RETRIEVE_TOOL_NAME,
];
+/// The recovery tool a curated (`ToolScope::Named`) belt is guaranteed to
+/// 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 fn is_recovery_tool(name: &str) -> bool {
RECOVERY_TOOL_NAMES.contains(&name)
}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/tools.rs b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
index 6e4936eed9..ec98b7ef9d 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
@@ -35,12 +35,9 @@ impl Tool for TokenjuiceRetrieveTool {
}
fn description(&self) -> &str {
- "Retrieve the full, original text of a tool result that was compacted to save \
- context. When output shows a marker like `⟦tj:a1b2c3d4⟧` (or a legacy \
- `retrieve_tool_output(\"…\")` footer), call this with that token to get the \
- complete original back. Optionally pass a `range` to fetch just a byte or line \
- slice. Use it only when you actually need the dropped detail — the compacted \
- view is usually enough."
+ "Retrieve the full text of a tool result that was compacted to save context. \
+ Pass the token from its `⟦tj:a1b2c3d4⟧` marker; optionally a `range` for a \
+ byte or line slice. Only when you need the dropped detail."
}
fn parameters_schema(&self) -> Value {
@@ -49,7 +46,7 @@ impl Tool for TokenjuiceRetrieveTool {
"properties": {
"token": {
"type": "string",
- "description": "The hash from a ⟦tj:…⟧ marker (or legacy retrieve footer)."
+ "description": "The hash from a ⟦tj:…⟧ marker."
},
"range": {
"type": "object",