The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(tokenjuice): use released ccr_durable option and drop repl_save_dir
Steven Enamakelb5df54a86afd
diff --git a/crates/openhuman-core/src/inference/tokenjuice/README.md b/crates/openhuman-core/src/inference/tokenjuice/README.mdindex 76daf992f7..9cad1dc027 100644--- a/crates/openhuman-core/src/inference/tokenjuice/README.md+++ b/crates/openhuman-core/src/inference/tokenjuice/README.md@@ -69,8 +69,8 @@ behavior. There is no linked implementation fallback.the aliases stay registered for transcript replay but off the wire. It isadded when compaction is on or the agent's results can be summarized(`summarizes_tool_output`), since a summary's footer names it too.-- Handle mode: `install_request` sets `CompressOptions.repl_handle` (and- `repl_save_dir` when `repl_save_enabled`) from `repl_handle_active(config)`,+- Handle mode: `install_request` sets `CompressOptions.repl_handle` from+ `repl_handle_active(config)`,which needs `context.compaction_enabled`, `router_enabled`, `ccr_enabled` and`repl_handle_enabled`. `tools/ops.rs` registers the REPL tools under the sametest, `session_host/builder/mod.rs::ensure_repl_tools_visible` adds them to a@@ -78,6 +78,8 @@ behavior. There is no linked implementation fallback.their answers from being stored behind a second handle (their own`max_result_size_chars` still caps them). The additive `Query` member carries the typed operation; existing `Repl`arity is unchanged.+- Durable CCR uses the released `InstallRequest.ccr_durable` option; legacy+ files are imported from the workspace before module installation.- Contract crate: `tinyjuice-bus` ([`vendor/tinyjuice/crates/tinyjuice-bus`](../../../../../vendor/tinyjuice/crates/tinyjuice-bus/),path dependency in [`crates/openhuman-core/Cargo.toml`](../../../Cargo.toml)).diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rsindex 6b3b67342a..48d13e87cc 100644--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs@@ -115,12 +115,6 @@ pub fn companion_tool_names(agent_id: &str, config: &crate::config::Config) -> Vnames}-/// Where the module writes a plain-text copy of each stored original when-/// `[tokenjuice] repl_save_enabled` is on.-pub fn repl_save_dir(workspace_dir: &std::path::Path) -> std::path::PathBuf {- workspace_dir.join(".tokenjuice").join("repl")-}-/// What the module is told to do, from the resolved configuration.pub(crate) fn install_request(config: &crate::config::Config) -> InstallRequest {let tj = &config.tokenjuice;@@ -144,17 +138,12 @@ pub(crate) fn install_request(config: &crate::config::Config) -> InstallRequestllm_summary_threshold_tokens: config.context.summarizer_payload_threshold_tokens,llm_summary_max_input_tokens: config.context.summarizer_max_payload_tokens,repl_handle: repl_handle_active(config),- repl_save_dir: (repl_handle_active(config) && tj.repl_save_enabled)- .then(|| repl_save_dir(&config.workspace_dir)),..tinyjuice_bus::types::CompressOptions::default()},max_cache_entries: tj.max_cache_entries,max_cache_bytes: tj.max_cache_bytes,ccr_ttl_secs: tj.ccr_ttl_secs,- disk_tier_root: tj- .ccr_disk_enabled- .then(|| config.workspace_dir.join(".tokenjuice").join("ccr"))- .map(|path| path.to_string_lossy().into_owned()),+ ccr_durable: tj.ccr_disk_enabled,}}@@ -181,10 +170,11 @@ pub async fn install_from_config(config: &crate::config::Config) -> Result<(), Slet request = install_request(config);// The module keeps the durable tier on its blob storage; originals the old// disk tier wrote move across first (once per directory, best effort).- if let Some(root) = request.disk_tier_root.as_deref() {+ if config.tokenjuice.ccr_disk_enabled {+ let root = config.workspace_dir.join(".tokenjuice").join("ccr");crate::modules::import_legacy_tinyjuice(&crate::core::runtime::DispatchCtx::ambient(),- std::path::Path::new(root),+ &root,request.ccr_ttl_secs.map(std::time::Duration::from_secs),).await;diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rsindex 711f7c12d0..70ba642c41 100644--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs@@ -291,8 +291,7 @@ fn install_request_turns_on_the_handle_preview_by_default() {assert!(request.options.router_enabled);assert!(request.options.ccr_enabled);assert!(request.options.repl_handle);- // The plain-text copy on disk is opt-in.- assert_eq!(request.options.repl_save_dir, None);+ assert!(!request.ccr_durable);}#[test]@@ -309,23 +308,17 @@ fn install_request_handle_mode_follows_every_switch_it_needs() {config.tokenjuice.repl_save_enabled = true;let request = install_request(&config);assert!(!request.options.repl_handle);- assert_eq!(- request.options.repl_save_dir, None,- "no handle, so nothing to save a copy of"- );+ assert!(!request.ccr_durable);}}#[test]-fn install_request_saves_a_copy_under_the_workspace_when_asked() {+fn install_request_enables_durable_ccr_when_configured() {let mut config = crate::config::Config::default();config.workspace_dir = std::path::PathBuf::from("/ws");- config.tokenjuice.repl_save_enabled = true;+ config.tokenjuice.ccr_disk_enabled = true;let request = install_request(&config);- assert_eq!(- request.options.repl_save_dir,- Some(std::path::PathBuf::from("/ws/.tokenjuice/repl"))- );+ assert!(request.ccr_durable);}#[test]diff --git a/crates/openhuman-core/src/inference/tokenjuice/rpc_scope_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/rpc_scope_tests.rsindex e05792d7f8..88e26fe7f5 100644--- a/crates/openhuman-core/src/inference/tokenjuice/rpc_scope_tests.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/rpc_scope_tests.rs@@ -246,12 +246,9 @@ async fn tokenjuice_rpcs_use_their_derived_config_for_module_calls_and_install()drop(methods);let installs = calls.installs.lock().unwrap();for (index, config) in configs.iter().enumerate() {- let disk_root = config.workspace_dir.join(".tokenjuice/ccr");- let save_root = config.workspace_dir.join(".tokenjuice/repl");assert!(installs.iter().any(|request| {- request.disk_tier_root.as_deref() == Some(disk_root.to_string_lossy().as_ref())- && request.options.repl_save_dir.as_deref() == Some(save_root.as_path())+ request.ccr_durable == config.tokenjuice.ccr_disk_enabled&& request.options.min_bytes_to_compress== config.tokenjuice.min_bytes_to_compress}),diff --git a/crates/openhuman-core/src/storage/schema.rs b/crates/openhuman-core/src/storage/schema.rsindex 7d19424bf3..9aa0322117 100644--- a/crates/openhuman-core/src/storage/schema.rs+++ b/crates/openhuman-core/src/storage/schema.rs@@ -53,10 +53,9 @@ pub fn owner_schemas() -> Vec<Schema> {Schema::new(crate::storage::schema_support::owner("tinyjuice")).collection_with(1,- tinyjuice_bus::storage::collections()- .into_iter()- .next()- .expect("TinyJuice declares its savings collection"),+ tinystoragedrivers::CollectionSpec::new(+ tinyjuice_bus::storage::SAVINGS_COLLECTION,+ ),ScopeClass::Module,).blobs(tinyjuice_bus::storage::CCR_PREFIX, ScopeClass::Module),