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
Merge utility ownership migration with current pricing contracts
Steven Enamakel56af5c904d33
diff --cc crates/openhuman-core/src/agent/cost.rsindex 5cfdb9dc53,11860250d9..166b14143c--- a/crates/openhuman-core/src/agent/cost.rs+++ b/crates/openhuman-core/src/agent/cost.rs@@@ -23,30 -44,36 +23,30 @@@ pub(crate) fn is_free_model(model: &strmodel.trim().to_ascii_lowercase().ends_with(":free")}-pub(crate) fn lookup_pricing(model: &str) -> Option<ModelPricing> {+/// Supply product catalog rates as data to the harness accounting API.+pub(crate) fn lookup_pricing(model: &str) -> Option<tinyagents_harness::cost::ModelPricing> {if is_free_model(model) {- return Some(ModelPricing {- model: "<free>",- input_per_mtok_usd: 0.0,- cached_input_per_mtok_usd: 0.0,- output_per_mtok_usd: 0.0,+ return Some(tinyagents_harness::cost::ModelPricing {+ input_per_token: Some(0.0),+ cache_read_input_per_token: Some(0.0),+ output_per_token: Some(0.0),+ ..Default::default()});}- let price = crate::platform::cost::catalog::lookup(model.trim())?;- Some(crate::platform::cost::catalog::tinyagents_pricing(price))+ let price = tinyagents_registry::pricing::lookup(model.trim())?;- Some(ModelPricing {- model: price.model_id,- input_per_mtok_usd: price.input_per_mtok_usd,- cached_input_per_mtok_usd: price.cached_input_per_mtok_usd,- output_per_mtok_usd: price.output_per_mtok_usd,- })++ Some(tinyagents_registry::pricing::flat_catalog_entry(price, "openhuman-cost-catalog").pricing)}-/// List-price estimate of one call, or `None` when the model is not-/// catalogued. Used only when the provider reported no charge.+/// Estimate a call from product list prices when no provider charge was reported.pub fn estimate_call_cost_usd(model: &str, usage: &BilledUsage) -> Option<f64> {let pricing = lookup_pricing(model)?;- let cached = usage.cached_input_tokens().min(usage.input_tokens);- let standard_input = usage.input_tokens.saturating_sub(cached);- let m = 1_000_000.0_f64;- Some(- (standard_input as f64) / m * pricing.input_per_mtok_usd- + (cached as f64) / m * pricing.cached_input_per_mtok_usd- + (usage.output_tokens as f64) / m * pricing.output_per_mtok_usd,- )+ let usage = tinyinference_llm::usage::Usage {+ input_tokens: usage.input_tokens,+ output_tokens: usage.output_tokens,+ cache_read_tokens: usage.cached_input_tokens().min(usage.input_tokens),+ ..Default::default()+ };+ Some(tinyagents_harness::cost::estimate_cost(&pricing, &usage).total_cost)}/// Where a cost figure came from. Ordered from most to least certain, so thediff --cc crates/openhuman-core/src/cron/scheduler_gate/README.mdindex 497578190f,866db368f1..fe7687623a--- a/crates/openhuman-core/src/cron/scheduler_gate/README.md+++ b/crates/openhuman-core/src/cron/scheduler_gate/README.md@@@ -19,7 -19,7 +19,7 @@@ Gates background AI work (embeddings, s| [`crates/openhuman-core/src/cron/scheduler_gate/gate.rs`](./gate.rs) | The process-wide wiring: the `SharedCore`, the signed-out override, the resume `Notify`, the single-slot LLM semaphore, `init_global(SchedulerGateConfig)`/`update_config`/`current_policy`/`wait_for_capacity`, and the per-tokio-runtime test-state scaffolding. || [`crates/openhuman-core/src/cron/scheduler_gate/throttle.rs`](./throttle.rs) | The machinery: `GateCore` (config + signals + policy), the 30s `spawn_sampler` task, `wait_for_capacity` over a caller-owned semaphore, and the `LlmPermit` RAII guard. || [`crates/openhuman-core/src/cron/scheduler_gate/signals.rs`](./signals.rs) | `sample(&SignalEnv)`: battery (via `starship_battery`, behind the `scheduler-gate` feature), CPU usage (via `sysinfo`, two-refresh delta), and server/container detection. |- | [`crates/openhuman-core/src/cron/scheduler_gate/decide.rs`](./decide.rs) | Pure decision logic: `decide(signals, cfg) -> Policy` over the `Signals` snapshot; `Policy` / `PauseReason` live beside `SchedulerGateConfig` in `config::schema::scheduler_gate`. Evaluation order: user mode override → server mode → power-aware stand-down → hard CPU ceiling → battery/CPU headroom. |-| [`crates/openhuman-core/src/cron/scheduler_gate/decide.rs (config/policy adapter; pure decision in `platform/resource_admission`)`](./decide.rs (config/policy adapter; pure decision in `platform/resource_admission`)) | Pure decision logic: `decide(signals, cfg) -> Policy` over the `Signals` snapshot; `Policy` / `PauseReason` live beside `SchedulerGateConfig` in `config::schema::scheduler_gate`. Evaluation order: user mode override → server mode → power-aware stand-down → hard CPU ceiling → battery/CPU headroom. |++| [`crates/openhuman-core/src/cron/scheduler_gate/decide.rs`](./decide.rs) | Config/policy adapter: `decide(signals, cfg) -> Policy` maps `SchedulerGateConfig` to `platform::resource_admission::Limits` and maps `Admission` to `Policy`. The pure decision lives in [`platform/resource_admission`](../../platform/resource_admission/mod.rs). `Policy` / `PauseReason` live beside `SchedulerGateConfig` in `config::schema::scheduler_gate`. Evaluation order: user mode override → server mode → power-aware stand-down → hard CPU ceiling → battery/CPU headroom. || `SIGNAL_ENV` in `gate.rs` | The env-override names: `OPENHUMAN_ON_AC_POWER`, `OPENHUMAN_BATTERY_CHARGE`, `OPENHUMAN_DEPLOYMENT` (plus the Kubernetes / `/.dockerenv` heuristics). |## Public surface