Skip to content

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

feat(web_chat): add channel event type for web chat

Steven Enamakel4763f115b5f7
diff --git a/crates/openhuman-core/src/web_chat/channel_event.rs b/crates/openhuman-core/src/web_chat/channel_event.rs
index 05c815f499..be1c5a7c14 100644
--- a/crates/openhuman-core/src/web_chat/channel_event.rs
+++ b/crates/openhuman-core/src/web_chat/channel_event.rs
@@ -341,6 +341,12 @@ pub struct TurnUsagePayload {
pub cached_input_tokens: u64,
pub cost_usd: f64,
pub context_window: u64,
+ /// Tokens the parent's context held after the turn's final model call: the
+ /// context gauge's numerator. Unlike the totals above it is one request,
+ /// not a sum, and excludes sub-agents. `0` when the core did not record it;
+ /// the UI then falls back to its older estimate.
+ #[serde(default)]
+ pub context_tokens: u64,
/// Per-sub-agent spend, omitted from the wire when no sub-agents ran.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub subagents: Vec<SubagentUsagePayload>,