Extend output-free transcript summaries to more tools (#60555)

## What changed

- Add summary labels for MCP and dynamic tools, computer activity, terminal interactions, file edits, images, plan updates, agent calls, and historical tool fallbacks.
- Keep tool output out of summaries and give summaries disclosure identities even when their cells have no activity IDs.
- Bring focused disclosure headers into view and show `expand` or `collapse` in the footer, including for search-expanded entries.

## Testing

Add assertions for tool labels, a transcript snapshot verifying that image-generation output stays hidden, and coverage for expanded and collapsed footer hints.

GitOrigin-RevId: 076b8d74c17f26b10aa8221c65b8b38dbb5ad5ea
This commit is contained in:
Eric Traut
2026-11-10 08:34:50 +00:00
committed by copyberry
parent fdb8be1485
commit 7539b0a856
22 changed files with 250 additions and 52 deletions
+25 -19
View File
@@ -17,7 +17,7 @@ use super::*;
pub(super) struct Disclosure {
pub(super) expanded: HashSet<String>,
pub(super) focused: Option<Vec<String>>,
pub(super) focused: Option<(EntryKey, Vec<String>)>,
pub(super) resume_after_approval: Option<(ThreadId, String)>,
// Resolve against the next layout, once a toggled live row has also been rebuilt.
pub(super) anchor_control: Option<EntryKey>,
@@ -95,7 +95,7 @@ impl TranscriptView {
pub(super) fn activity_ids(&self, cells: &[Arc<dyn HistoryCell>], index: usize) -> Vec<String> {
cells.get(index).map_or_else(
|| self.disclosure.live_ids.clone(),
|cell| match self.tool_summary(cell.as_ref()) {
|cell| match self.tool_summary(cell.as_ref(), EntryKey::cell(cell)) {
Some(row) if !self.is_search_expanded(EntryKey::cell(cell)) => row.ids,
_ => cell.activity_ids(),
},
@@ -130,7 +130,7 @@ impl TranscriptView {
.disclosure
.focused
.as_ref()
.is_some_and(|focused| ids.iter().any(|id| focused.contains(id)));
.is_some_and(|(_, focused)| ids.iter().any(|id| focused.contains(id)));
if !focused || !layout.disclosure {
return;
}
@@ -214,7 +214,7 @@ impl TranscriptView {
.disclosure
.focused
.as_ref()
.and_then(|ids| self.canonical_activity_index(cells, ids));
.and_then(|(_, ids)| self.canonical_activity_index(cells, ids));
let Some(focused) = focused else {
self.disclosure.focused = None;
return None;
@@ -313,21 +313,24 @@ impl TranscriptView {
}
fn focus_activity(&mut self, cells: &[Arc<dyn HistoryCell>], index: usize) -> bool {
if self
.current_layout(cells, index)
.is_none_or(|layout| !layout.disclosure)
{
let Some(layout) = self.layout(cells, index) else {
return false;
};
if !layout.disclosure {
return false;
}
let ids = self.activity_ids(cells, index);
let header_visible = self.visible.iter().any(|row| {
row.layout.disclosure
&& row.activity_ids.iter().any(|id| ids.contains(id))
&& row.row == usize::from(row.layout.separated)
let row = usize::from(layout.separated);
let visible = self.visible.iter().any(|visible| {
visible.row == row && visible.activity_ids.iter().any(|id| ids.contains(id))
});
self.disclosure.focused = Some(ids);
if !header_visible {
self.disclosure.focused = Some((self.entry_key(cells, index), ids));
if !visible {
self.jump_to_entry(cells, index);
if let Position::Reading(anchor) = &mut self.position {
anchor.offset = layout.position_at(row, /*column*/ 0);
anchor.row_bias = layout.row_for_offset(anchor.offset) as isize - row as isize;
}
}
true
}
@@ -389,7 +392,7 @@ impl TranscriptView {
} else {
self.disclosure.expanded.extend(ids.iter().cloned());
}
self.disclosure.focused = Some(ids);
self.disclosure.focused = Some((key, ids));
self.position = Position::Reading(anchor);
self.cache.clear();
self.live_key = None;
@@ -400,14 +403,17 @@ impl TranscriptView {
}
pub(super) fn disclosure_footer(&self, width: u16) -> Option<TranscriptFooter> {
if !self.is_activity_focused() {
return None;
}
let (key, ids) = self.disclosure.focused.as_ref()?;
let toggle = if self.disclosure.is_expanded(ids) || self.is_search_expanded(*key) {
"collapse"
} else {
"expand"
};
let keymap = &self.disclosure.keymap;
let hints: Vec<_> = [
(ListAction::MoveUp, "previous"),
(ListAction::MoveDown, "next"),
(ListAction::Accept, "details"),
(ListAction::Accept, toggle),
(ListAction::Cancel, "back"),
]
.into_iter()
@@ -522,6 +522,8 @@ fn activity_focus_keeps_controls_without_passive_hints() {
assert!(view.disclosure.is_expanded(&["sample-activity".to_owned()]));
let expanded = render_live(&mut view);
hints.push(format!("expanded\n{expanded:?}"));
let footer = view.footer(/*width*/ 80, MotionMode::Reduced).unwrap();
hints.push(format!("expanded, 80 columns: {}", footer.text));
let hidden = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 32, /*height*/ 0,
);
+4 -2
View File
@@ -238,7 +238,9 @@ impl TranscriptView {
}
let mode = self.mode;
let mut presentation = self.content_presentation(cell.as_ref(), full_content, mode);
if !full_content && let Some(summary) = self.tool_summary(cell.as_ref()) {
if !full_content
&& let Some(summary) = self.tool_summary(cell.as_ref(), EntryKey::cell(cell))
{
let expanded = self.disclosure.is_expanded(&summary.ids);
if expanded {
self.disclosure.expanded.extend(summary.ids.iter().cloned());
@@ -262,7 +264,7 @@ impl TranscriptView {
}) {
return layout.row_count() > 0;
}
if !full_content && self.tool_summary(previous.as_ref()).is_some() {
if !full_content && self.tool_summary(previous.as_ref(), key).is_some() {
return true;
}
let previous_presentation =
@@ -1149,7 +1149,7 @@ fn find_expands_only_the_match_and_preserves_manual_disclosures() {
insta::assert_snapshot!(hints.join("\n"), @"
↑ Loading earlier messages… · esc latest
Retry history: ⌥</⌃home. esc latest
↑ previous · ↓ next · enter details · esc back
↑ previous · ↓ next · enter expand · esc back
");
view.handle_key(KeyCode::Enter.into(), &cells);
view.handle_key(KeyCode::Esc.into(), &cells);
@@ -1163,6 +1163,13 @@ fn find_expands_only_the_match_and_preserves_manual_disclosures() {
view.handle_key(KeyCode::F(4).into(), &cells);
view.handle_key(KeyCode::End.into(), &cells);
view.handle_key(KeyCode::Up.into(), &cells);
assert!(
view.footer(/*width*/ 80, crate::motion::MotionMode::Reduced)
.unwrap()
.text
.to_string()
.contains("enter collapse")
);
for (key, expanded) in [
(KeyCode::Right, true),
(KeyCode::Left, false),
@@ -1,6 +1,5 @@
---
source: tui/src/transcript_view/footer_tests.rs
assertion_line: 515
expression: "hints.join(\"\\n\")"
---
collapsed
@@ -37,8 +36,8 @@ Buffer {
]
}
focused, 20 columns: esc back
focused, 32 columns: enter details · esc back
focused, 80 columns: ↑ previous · ↓ next · enter details · esc back
focused, 32 columns: ↓ next · enter expand · esc back
focused, 80 columns: ↑ previous · ↓ next · enter expand · esc back
expanded
Buffer {
area: Rect { x: 0, y: 0, width: 32, height: 3 },
@@ -55,6 +54,7 @@ Buffer {
x: 18, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
]
}
expanded, 80 columns: ↑ previous · ↓ next · enter collapse · esc back
"ctrl-x t": <composer hints>
["ctrl-x t","f4"]: <composer hints>
[]: <composer hints>
@@ -58,7 +58,11 @@ impl ToolSummary {
}
impl TranscriptView {
pub(super) fn tool_summary(&self, cell: &dyn HistoryCell) -> Option<ToolSummary> {
pub(super) fn tool_summary(
&self,
cell: &dyn HistoryCell,
key: EntryKey,
) -> Option<ToolSummary> {
if !self.collapse_turn_details || self.detailed || self.mode != HistoryRenderMode::Rich {
return None;
}
@@ -66,11 +70,14 @@ impl TranscriptView {
if calls.is_empty() {
return None;
}
let ids = cell
let mut ids: Vec<_> = cell
.activity_ids()
.into_iter()
.map(|id| format!("summary:{id}"))
.collect();
if key != EntryKey::Live || ids.is_empty() {
ids.push(format!("work:{key:?}"));
}
Some(ToolSummary { ids, calls })
}
@@ -90,7 +97,7 @@ impl TranscriptView {
self.cache.clear();
self.release_live_reading();
}
let summary = active.and_then(|cell| self.tool_summary(cell));
let summary = active.and_then(|cell| self.tool_summary(cell, EntryKey::Live));
let ids = summary.as_ref().map_or_else(
|| active.map_or_else(Vec::new, HistoryCell::activity_ids),
|summary| summary.ids.clone(),