Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: show thinking is a toggle of its own, apart from the developer details

This commit is contained in:
iris 2026-11-16 20:35:03 +01:00 • committed by mara
commit 857b175a74

View file

@ -15,7 +15,7 @@
//! `mcp__hyperhive__send`'s row say, which tools get an expandable body)
//! didn't change; only the shape it gets packed into did.
use crate::term_msg::{BodyFormat, ClassifyCtx, Level, TermMsg};
use crate::term_msg::{BodyFormat, ClassifyCtx, Kind, Level, TermMsg};
use hive_types::term_msg::{SEND_ICON, SEND_SUMMARY_PREFIX};
use serde_json::{Value, json};
@ -71,7 +71,8 @@ fn classify_system(v: &Value) -> Vec<TermMsg> {
summary.unwrap_or_else(|| "thinking…".to_owned()),
)
.icon("🧠")
.coalesce("thinking-tok"),
.coalesce("thinking-tok")
.kind(Kind::Thinking),
],
"details" => {
let mut m = TermMsg::new(Level::Debug, summary.unwrap_or_default());
@ -254,7 +255,11 @@ fn classify_assistant_content(content: &[Value], ctx: &mut ClassifyCtx) -> Vec<T
} else {
txt
};
rows.push(TermMsg::new(Level::Debug, summary).icon("💭"));
rows.push(
TermMsg::new(Level::Debug, summary)
.icon("💭")
.kind(Kind::Thinking),
);
}
Some("tool_use") => {
if let (Some(id), Some(name)) = (
@ -1043,6 +1048,23 @@ mod tests {
assert_eq!(bare.coalesce_key.as_deref(), Some("thinking-tok"));
}
/// A client shows or hides thinking apart from the other `debug` rows, so
/// both the thinking text and the live token count say what they are.
#[test]
fn the_thinking_rows_are_marked_and_the_other_debug_rows_are_not() {
let count = one(&json!({ "type": "system", "subtype": "thinking_tokens" }));
assert_eq!(count.kind, Some(Kind::Thinking));
assert_eq!(
serde_json::to_value(&count).unwrap()["kind"],
json!("thinking")
);
let tick = one(&json!({ "type": "system", "subtype": "status" }));
assert_eq!(tick.level, Level::Debug);
assert_eq!(tick.kind, None);
assert!(serde_json::to_value(&tick).unwrap().get("kind").is_none());
}
#[test]
fn commands_changed_expands_into_the_command_list() {
let m = one(&json!({
@ -1285,6 +1307,9 @@ mod tests {
assert_eq!(rows.len(), 3, "the unknown content block is skipped");
assert_eq!(rows[0].icon.as_deref(), Some("💬"));
assert_eq!(rows[1].icon.as_deref(), Some("💭"));
assert_eq!(rows[1].kind, Some(Kind::Thinking));
assert_eq!(rows[0].kind, None);
assert_eq!(rows[2].kind, None);
// The tool_use was recorded for later correlation as a side effect.
assert_eq!(ctx.tool_name("t1"), Some("Bash"));
}