Skip to content

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

Merge remote-tracking branch 'upstream/cutover-juice' into module-released-cutover

Steven Enamakel74d8c60f701a
diff --cc Cargo.lock
index ac197e74d9,f377ca7f78..e412f41844
--- a/Cargo.lock
+++ b/Cargo.lock
@@@ -7808,35 -7787,9 +7777,9 @@@ dependencies =
"tokio",
]
- [[package]]
- name = "tinyjuice"
- version = "0.7.1"
- dependencies = [
- "anyhow",
- "async-trait",
- "dirs 7.0.0",
- "hex",
- "jaq-core",
- "jaq-json",
- "jaq-std",
- "log",
- "once_cell",
- "regex",
- "serde",
- "serde_json",
- "sha2 0.11.0",
- "thiserror 2.0.20",
- "tinyjuice-bus",
- "tinytools",
- "tokio",
- "unicode-segmentation",
- "unicode-width",
- "uuid",
- ]
-
[[package]]
name = "tinyjuice-bus"
-version = "0.7.0"
+version = "0.7.1"
dependencies = [
"serde",
"serde_json",
diff --cc crates/openhuman-app/Cargo.lock
index 738a1d71d7,2a038cbed1..6ab0b7f0e1
--- a/crates/openhuman-app/Cargo.lock
+++ b/crates/openhuman-app/Cargo.lock
@@@ -8108,35 -8099,9 +8088,9 @@@ dependencies =
"tokio",
]
- [[package]]
- name = "tinyjuice"
- version = "0.7.1"
- dependencies = [
- "anyhow",
- "async-trait",
- "dirs 7.0.0",
- "hex",
- "jaq-core",
- "jaq-json",
- "jaq-std",
- "log",
- "once_cell",
- "regex",
- "serde",
- "serde_json",
- "sha2 0.11.0",
- "thiserror 2.0.20",
- "tinyjuice-bus",
- "tinytools",
- "tokio",
- "unicode-segmentation",
- "unicode-width",
- "uuid",
- ]
-
[[package]]
name = "tinyjuice-bus"
-version = "0.7.0"
+version = "0.7.1"
dependencies = [
"serde",
"serde_json",
diff --cc crates/openhuman-core/Cargo.toml
index b45abeaac4,5a3364b60d..098ebdef95
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@@ -497,39 -517,22 +497,9 @@@ tinyvoice = { path = "../../vendor/tiny
# After cloning: `git submodule update --init vendor/tinyjuice`.
tinyjuice-bus = { path = "../../vendor/tinyjuice/crates/tinyjuice-bus" }
- # TinyJuice — the engine crate, for its pure content transforms only.
-# TinyHosts — the unified hosting API: one `Host` trait over a hosting provider,
-# and the `launch` flow that puts a Next.js application, its database, its
-# environment and its domains on it in the one order that works.
--#
- # The router, the CCR cache, the rule engine and ranged retrieval stay behind
- # the loadable-module boundary: those need the module's state, its disk tier and
- # its retrieval markers, and nothing here calls them. What this dependency buys
- # is the stateless half — `compressors::html::html_to_markdown`, which `web_fetch`
- # runs on every HTML response so the model reads a page's prose, headings and
- # links instead of its minified JS.
-# The provider vocabulary stops inside the crate. What OpenHuman gets is the
-# model — sites, deployments, databases, domains, analytics — so which provider
-# a user pastes a key for is a config value here rather than a code path.
--#
- # That transform has no business being reimplemented here: it is content
- # handling, TinyJuice owns content handling, and a second copy would drift.
- # Reaching it through TinyBus instead would make a core tool's default output
- # depend on whether an optional cdylib loaded and on `compaction_enabled`
- # (default `false`), which is not a defensible way to decide what a fetched page
- # looks like. See `src/inference/tokenjuice/README.md`.
-# Taken with the `vercel` provider only, which is the one that exists.
--#
- # `default-features = false` drops `tinyjuice-treesitter` and with it the three
- # tree-sitter grammars — those serve the code compressor, which lives behind the
- # module boundary and is not called from here.
-# Vendored as a path dependency like `tinyhumans-sdk`: the crate is not
-# published to crates.io, so there is no `[patch.crates-io]` entry for it.
-# After cloning: `git submodule update --init vendor/tinyhosts`.
--#
- # The `tinytools` feature adds `tinyjuice::repl::tools`, the `juice_find`,
- # `juice_extract` and `juice_summarize` tool declarations. It names tinytools by
- # URL; the root `[patch]` redirects that to the copy tinyagents vendors, so
- # there is still exactly one `tinytools` package and one `Tool` trait. The CCR
- # store those ops read lives in the module, so the host wraps the tools and
- # feeds them each original over the bus: see `inference/tokenjuice/repl_tools.rs`.
- tinyjuice = { path = "../../vendor/tinyjuice", default-features = false, features = ["tinytools", "host"] }
-
- # Transport-free host contract for the compiled TinyHosts provider module.
- # Provider operations, deployment sequencing, and bounded source preparation
- # stay in the owner repository; OpenHuman adds only the configured adapter.
++# Transport-free vocabulary for the compiled TinyHosts provider module.
# Optional: exclusive to the default-OFF `hosting` feature.
-tinyhosts = { path = "../../vendor/tinyhosts", default-features = false, features = ["vercel", "tools"], optional = true }
+tinyhosts-bus = { path = "../../vendor/tinyhosts/crates/tinyhosts-bus", optional = true }
# TinyWallet — host-agnostic multi-chain wallet primitives. Owns the address
# formats themselves: parsing, validation, and the conversions between their
diff --cc crates/openhuman-core/src/inference/tokenjuice/README.md
index 28efb3728d,f8bc04571f..2e517f103b
--- a/crates/openhuman-core/src/inference/tokenjuice/README.md
+++ b/crates/openhuman-core/src/inference/tokenjuice/README.md
@@@ -21,9 -20,10 +20,10 @@@ OpenHuman-owned files
| [`types.rs`](./types.rs) | Re-export of the `tinyjuice-bus` contract (`tinyjuice_bus::types::{AgentTokenjuiceCompression, CompressOptions, CompressedOutput, CompressorKind, ContentHint, ContentKind}` and `tinyjuice_bus::wire::{CacheStats, CompactResponse, InstallRequest, RangeUnit, RetrieveRange}`) under the paths ~40 call sites in this crate already use. |
| [`schemas.rs`](./schemas.rs) | JSON-RPC controller schemas and handlers. |
| [`config_patch.rs`](./config_patch.rs) | Partial update shape for the `[tokenjuice]` config block. |
- | [`repl_tools.rs`](./repl_tools.rs) | The three REPL tools (`juice_find`, `juice_extract`, `juice_summarize`) over a stored result. TinyJuice owns the ops and declarations (`tinyjuice::repl::tools`, cargo feature `tinytools`); the CCR store lives in the module, so each call fetches the original with `Retrieve` and hands the stock tool a one-entry store. Registered by [`tools/ops.rs`](../../tools/ops.rs) only while `repl_handle_active(config)`. |
+ | [`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`). |
-| `ml/` | Bridge from TinyJuice's optional ML callback into the shared `runtime::python_server` Kompress backend (ModernBERT token/sentence salience); opt-in via `config.tokenjuice.ml_compression_enabled` (default off), degrades gracefully when the flag is off or the runtime server is unavailable. |
+| Plain text | Compressed with TinyJuice's deterministic TextCrusher. |
| [`savings.rs`](./savings.rs) | OpenHuman model-pricing attribution and persisted dashboard stats. |
TinyJuice-owned engine pieces:
diff --cc crates/openhuman-core/src/inference/tokenjuice/mod.rs
index c0154be12a,d733b40d5c..c6d5ef281c
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@@ -1,7 -1,9 +1,8 @@@
//! OpenHuman host adapter for the separately released TinyJuice module.
pub mod config_patch;
- pub use tinyjuice::host::{focus, generate};
+ pub mod focus;
+ pub mod generate;
-pub mod ml;
pub mod repl_tools;
pub mod savings;
pub mod schemas;
diff --cc gitbooks/features/token-compression.md
index 45c5ba1bb0,d94f276bb5..eaff90b200
--- a/gitbooks/features/token-compression.md
+++ b/gitbooks/features/token-compression.md
@@@ -89,11 -91,20 +91,11 @@@ The model's tool catalogue is recorded
To turn off the whole feature, set `context.compaction_enabled = false` or `OPENHUMAN_COMPACTION=0`. To keep compaction but go back to one-blob compression and `juice_retrieve`, set `tokenjuice.repl_handle_enabled = false` (`OPENHUMAN_TOKENJUICE_REPL_HANDLE_ENABLED=0`). Set `tokenjuice.repl_save_enabled = true` to also write each stored original to `<workspace>/.tokenjuice/repl/<handle>.txt` (mode 0600) so an agent can script over it. That puts raw tool output on disk, and nothing prunes it.
-## ML compression (opt-in)
-
-Besides the deterministic compressors, TokenJuice can route plain text through a ModernBERT token-salience model that scores and drops low-information spans. TinyJuice exposes the optional ML slot, and OpenHuman connects it to Kompress in `crates/openhuman-core/src/inference/tokenjuice/ml/`.
-
-- Off by default. Enable it with `ml_compression_enabled = true` in `[tokenjuice]`.
-- It runs locally, as the `kompress` backend of the long-running Python host process OpenHuman keeps warm for Python-backed models (`crates/openhuman-core/src/runtime/python_server/`), reached over a private stdio protocol. No data leaves your machine.
-- Tunable keys: `ml_model_id` (default `answerdotai/ModernBERT-base`), `ml_target_ratio` (default `0.5`), `ml_max_input_chars` (default `200000`), `ml_device` (`cpu`/`auto`), `ml_sidecar_idle_timeout_secs`.
-- If that process is unavailable or an input exceeds the character cap, it falls back to the native compressors and never fails the agent loop.
-
## Nothing is lost: the CCR cache
- Lossy compression normally throws data away. TokenJuice instead stores the full original in the CCR store and leaves a breadcrumb (`vendor/tinyjuice/src/cache/`).
+ Lossy compression normally throws data away. TinyJuice instead stores the full original in the module-owned CCR store and leaves a breadcrumb.
- - **In-memory tier** (always on): a process-wide store keyed by SHA-256 hash, bounded by entry count (`max_cache_entries`, default 256) and total bytes (`max_cache_bytes`, default 64 MiB), with FIFO eviction.
+ - **In-memory tier** (always on): the module's store is keyed by SHA-256 hash and bounded by entry count (`max_cache_entries`, default 256) and total bytes (`max_cache_bytes`, default 64 MiB), with FIFO eviction.
- **On-disk tier** (optional): `<workspace>/.tokenjuice/ccr/`, enabled with `ccr_disk_enabled`. It survives memory eviction. Set an optional TTL with `ccr_ttl_secs`.
- **The marker:** compacted output ends with a footer like `[compacted tool output: PARTIAL view; full original available via juice_retrieve with token "…"]` carrying the `⟦tj:<hash>⟧` token.
- **Retrieval tool:** the agent calls the read-only `juice_retrieve` tool with that token (optionally a byte or line `range`) to get the full original or a slice. The token is an unguessable SHA-256 digest.