feat(web): inline tool activity cards with auto-collapsing#376
feat(web): inline tool activity cards with auto-collapsing#376henrypark133 merged 2 commits intomainfrom
Conversation
Add Claude/Codex-style inline tool activity cards to the web UI that show tool execution progress directly in the chat conversation. While processing: - Animated thinking dots with message text (e.g. "Calling LLM...") - Individual tool cards with live spinner and elapsed timer - Cards show tool name, duration, and expandable output preview After response arrives: - Activity group auto-collapses to "Used N tools (Xs)" - Click summary to expand and see individual tool cards - Click card header to see tool output in monospace Also includes: - "Calling LLM..." thinking status from dispatcher (all channels) - 5-minute max timer guard to prevent leaks on dropped SSE - Handles parallel tools, same tool twice, failures, thread switching Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello @henrypark133, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience of the web UI by integrating dynamic, inline feedback for tool execution and LLM interactions. It moves away from a simple status bar to a more interactive and informative display, allowing users to track agent activity in real-time and review tool outputs directly within the chat, while maintaining a clean interface through auto-collapsing summaries. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant UI enhancement by adding inline tool activity cards, providing users with better visibility into tool execution. While this is an excellent feature addition that greatly improves the user experience, a minor correctness issue was identified in the JavaScript implementation where the total duration of tool activity could be miscalculated, leading to an inflated value in the summary.
| }, 100); | ||
|
|
||
| if (!_activeToolCards[name]) _activeToolCards[name] = []; | ||
| _activeToolCards[name].push({ card, startTime, timer: timerInterval, duration, icon }); |
There was a problem hiding this comment.
To accurately calculate the total duration of tool executions, it's helpful to store the final duration of each tool when it completes. Please initialize a finalDuration property here. This will be used by completeToolCard and finalizeActivityGroup.
| _activeToolCards[name].push({ card, startTime, timer: timerInterval, duration, icon }); | |
| _activeToolCards[name].push({ card, startTime, timer: timerInterval, duration, icon, finalDuration: null }); |
There was a problem hiding this comment.
Good catch — this is a real bug. When finalizeActivityGroup() fires, it was recalculating duration from Date.now() for tools that had already completed, inflating the summary. Fixed in e87c4b6: added finalDuration: null to the entry object, store the frozen elapsed time in completeToolCard(), and use it in finalizeActivityGroup().
| const elapsed = (Date.now() - entry.startTime) / 1000; | ||
| entry.duration.textContent = elapsed < 10 ? elapsed.toFixed(1) + 's' : Math.floor(elapsed) + 's'; |
There was a problem hiding this comment.
When a tool card is completed, please store its final duration on the entry object. This will allow finalizeActivityGroup to correctly sum up the durations of all completed tools, rather than using the time at which the group is finalized.
const elapsed = (Date.now() - entry.startTime) / 1000;
entry.finalDuration = elapsed;
entry.duration.textContent = elapsed < 10 ? elapsed.toFixed(1) + 's' : Math.floor(elapsed) + 's';There was a problem hiding this comment.
Done — entry.finalDuration = elapsed is now stored in completeToolCard(). See e87c4b6.
| let toolCount = 0; | ||
| let totalDuration = 0; | ||
| for (const tname in _activeToolCards) { | ||
| const tentries = _activeToolCards[tname]; | ||
| for (let j = 0; j < tentries.length; j++) { | ||
| toolCount++; | ||
| totalDuration += (Date.now() - tentries[j].startTime) / 1000; | ||
| } | ||
| } |
There was a problem hiding this comment.
The current calculation for totalDuration is incorrect for tools that have already completed, as it uses Date.now() at the time of finalization. To fix this, please use the finalDuration property (set in completeToolCard) for completed tools. For tools that are still running, you can continue to calculate the duration up to the current time.
let toolCount = 0;
let totalDuration = 0;
for (const tname in _activeToolCards) {
const tentries = _activeToolCards[tname];
for (let j = 0; j < tentries.length; j++) {
const entry = tentries[j];
toolCount++;
if (entry.finalDuration !== null) {
totalDuration += entry.finalDuration;
} else {
// Tool was still running when finalized.
totalDuration += (Date.now() - entry.startTime) / 1000;
}
}
}There was a problem hiding this comment.
Fixed — finalizeActivityGroup() now uses entry.finalDuration for completed tools and only falls back to Date.now() - startTime for tools still running at finalization time. See e87c4b6.
The collapsed activity summary was showing inflated total duration because finalizeActivityGroup() recalculated elapsed time from Date.now() for already-completed tools. Now each tool card stores its final duration at completion time and the summary uses that frozen value instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat(web): inline tool activity cards with auto-collapsing Add Claude/Codex-style inline tool activity cards to the web UI that show tool execution progress directly in the chat conversation. While processing: - Animated thinking dots with message text (e.g. "Calling LLM...") - Individual tool cards with live spinner and elapsed timer - Cards show tool name, duration, and expandable output preview After response arrives: - Activity group auto-collapses to "Used N tools (Xs)" - Click summary to expand and see individual tool cards - Click card header to see tool output in monospace Also includes: - "Calling LLM..." thinking status from dispatcher (all channels) - 5-minute max timer guard to prevent leaks on dropped SSE - Handles parallel tools, same tool twice, failures, thread switching Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(web): use frozen duration for completed tools in activity summary The collapsed activity summary was showing inflated total duration because finalizeActivityGroup() recalculated elapsed time from Date.now() for already-completed tools. Now each tool card stores its final duration at completion time and the summary uses that frozen value instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
▸ Used N tools (Xs)summary line to keep the conversation clean"Calling LLM..."thinking status from the dispatcher (benefits all channels)Changes
src/agent/dispatcher.rsThinking("Calling LLM...")before each LLM callsrc/channels/web/static/app.jssrc/channels/web/static/style.cssDetails
finalizeActivityGroup()is idempotent and called from all terminal events (response, stream_chunk, status Done, error, thread switch, SSE reconnect)showToolResult, spinner timer, related CSS)Test plan
cargo clippy --all --all-features— zero warningscargo test— all 1,597 tests pass🤖 Generated with Claude Code