Skip to content

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

feat(tui): show voice note duration in transcript

Steven Enamakeld9d73a6832a6
diff --git a/crates/openhuman-tui/src/state.rs b/crates/openhuman-tui/src/state.rs
index 07e2481bb1..cac6e8a70e 100644
--- a/crates/openhuman-tui/src/state.rs
+++ b/crates/openhuman-tui/src/state.rs
@@ -469,13 +469,20 @@ impl TranscriptState {
fn push_projected_item(&mut self, item: &serde_json::Value) {
match item.get("kind").and_then(serde_json::Value::as_str) {
- Some("userMessage") => self.entries.push(Entry::new(
- EntryKind::User,
- item.get("displayContent")
+ Some("userMessage") => {
+ let content = item
+ .get("displayContent")
.or_else(|| item.get("content"))
.and_then(serde_json::Value::as_str)
- .unwrap_or_default(),
- )),
+ .unwrap_or_default();
+ let duration_ms = item
+ .pointer("/extraMetadata/voiceNote/durationMs")
+ .and_then(serde_json::Value::as_u64);
+ let text = duration_ms
+ .map(|ms| format!("[voice note {}] {content}", format_short_duration(ms)))
+ .unwrap_or_else(|| content.to_string());
+ self.entries.push(Entry::new(EntryKind::User, text));
+ }
Some("assistantMessage") => self.entries.push(Entry::new(
EntryKind::Assistant,
item.get("content")
@@ -597,6 +604,11 @@ impl TranscriptState {
}
}
+fn format_short_duration(ms: u64) -> String {
+ let seconds = ms.saturating_add(500) / 1000;
+ format!("{}:{:02}", seconds / 60, seconds % 60)
+}
+
/// Collapse to a single line and cap length so a rogue tool output can't blow
/// up the transcript width.
fn truncate_line(s: &str) -> String {