Skip to content

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

refactor(tui): build demo transcript from typed web channel events

Steven Enamakel00d311edfca9
diff --git a/crates/openhuman-tui/src/demo.rs b/crates/openhuman-tui/src/demo.rs
index 260820c222..7f49a7653c 100644
--- a/crates/openhuman-tui/src/demo.rs
+++ b/crates/openhuman-tui/src/demo.rs
@@ -5,41 +5,88 @@ use super::state::TranscriptState;
use super::ui_state::{AppTab, UiState};
use crossterm::event::{self, Event, KeyCode, KeyModifiers};
use openhuman_rpc::embed::chat_surface::WebChannelEvent;
+use tinychannels_bus::web::WebEventContext;
pub fn sample() -> TranscriptState {
let mut state = TranscriptState::new("preview");
state.set_thread("preview");
state.begin_user_turn("Make the terminal UI simpler, with mouse controls.");
- let ev = |name: &str| WebChannelEvent {
- event: name.into(),
+ let context = || WebEventContext {
client_id: "preview".into(),
thread_id: "preview".into(),
request_id: "sample-turn".into(),
..Default::default()
};
- state.apply_event(&WebChannelEvent {
+ state.apply_event(&WebChannelEvent::TextDelta {
+ context: context(),
delta: Some("I’ll keep the conversation central and make the work easy to inspect.".into()),
- ..ev("text_delta")
+ delta_kind: None,
+ round: None,
});
- state.apply_event(&WebChannelEvent {
+ state.apply_event(&WebChannelEvent::ToolCall {
+ context: context(),
tool_name: Some("Read source".into()),
- tool_call_id: Some("read-1".into()),
+ skill_id: None,
args: Some(serde_json::json!({"path":"src/render.rs"})),
- ..ev("tool_call")
+ round: None,
+ tool_call_id: Some("read-1".into()),
+ tool_display_label: None,
+ tool_display_detail: None,
+ });
+ state.apply_event(&WebChannelEvent::ToolResult {
+ context: context(),
+ tool_name: Some("Read source".into()),
+ skill_id: None,
+ output: Some("Header → conversation → composer → status\nCached viewport rendering\nShared mouse and keyboard actions".into()),
+ args: None,
+ success: Some(true),
+ round: None,
+ tool_call_id: Some("read-1".into()),
+ failure: None,
+ elapsed_ms: Some(12),
+ tool_display_label: None,
+ tool_display_detail: None,
+ structured: None,
});
- state.apply_event(&WebChannelEvent {tool_name:Some("Read source".into()),tool_call_id:Some("read-1".into()),success:Some(true),elapsed_ms:Some(12),output:Some("Header → conversation → composer → status\nCached viewport rendering\nShared mouse and keyboard actions".into()),..ev("tool_result")});
- state.apply_event(&WebChannelEvent {
+ state.apply_event(&WebChannelEvent::SubagentSpawned {
+ context: context(),
+ message: None,
tool_name: Some("Explore".into()),
skill_id: Some("child-1".into()),
- ..ev("subagent_spawned")
+ round: None,
+ subagent: None,
+ });
+ state.apply_event(&WebChannelEvent::SubagentTextDelta {
+ context: context(),
+ delta: Some("Checked the command, login, and tool-call surfaces.\nMouse targets use the displayed layout.".into()),
+ delta_kind: None,
+ tool_call_id: None,
+ tool_name: None,
+ skill_id: Some("child-1".into()),
+ round: None,
});
- state.apply_event(&WebChannelEvent {skill_id:Some("child-1".into()),delta:Some("Checked the command, login, and tool-call surfaces.\nMouse targets use the displayed layout.".into()),..ev("subagent_text_delta")});
- state.apply_event(&WebChannelEvent {
+ state.apply_event(&WebChannelEvent::SubagentCompleted {
+ context: context(),
+ message: None,
+ tool_name: None,
skill_id: Some("child-1".into()),
- elapsed_ms: Some(840),
- ..ev("subagent_completed")
+ success: Some(true),
+ round: None,
+ subagent: Some(tinychannels_bus::web::WebSubagentProgressDetail {
+ task_id: Some("child-1".into()),
+ display_name: Some("Explore".into()),
+ elapsed_ms: Some(840),
+ ..Default::default()
+ }),
+ });
+ state.apply_event(&WebChannelEvent::ChatDone {
+ context: context(),
+ full_response: Some("Ready to inspect. Click a tool row to expand it, use Tools or /subagents for details, and choose a theme in Settings.\n\nThis is an offline preview; no model or account calls are made.".into()),
+ citations: None,
+ usage: None,
+ timing: None,
+ parts: None,
});
- state.apply_event(&WebChannelEvent {full_response:Some("Ready to inspect. Click a tool row to expand it, use Tools or /subagents for details, and choose a theme in Settings.\n\nThis is an offline preview; no model or account calls are made.".into()),..ev("chat_done")});
state
}