From 8dd97a5a2de8207196da2b71dedbaf5557b7b995 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Wed, 4 Nov 2026 09:59:31 +0100 Subject: [PATCH] fix: truncate long ai chat tool labels and fold extra tool kinds into +N (#12185) Co-authored-by: Claude Opus 5.5 --- .../copilot/chat/ChatCollapsibleCard.svelte | 22 +++++++++++++--- .../copilot/chat/ToolExecutionDisplay.svelte | 2 +- .../copilot/chat/ToolGroupDisplay.svelte | 1 + .../copilot/chat/toolGroups.test.ts | 16 ++++++++++++ .../lib/components/copilot/chat/toolGroups.ts | 25 +++++++++++++------ 5 files changed, 54 insertions(+), 12 deletions(-) diff --git a/frontend/src/lib/components/copilot/chat/ChatCollapsibleCard.svelte b/frontend/src/lib/components/copilot/chat/ChatCollapsibleCard.svelte index 9bb2aacf2d..e5a9989365 100644 --- a/frontend/src/lib/components/copilot/chat/ChatCollapsibleCard.svelte +++ b/frontend/src/lib/components/copilot/chat/ChatCollapsibleCard.svelte @@ -4,6 +4,7 @@ import { fade, slide } from 'svelte/transition' import type { Snippet } from 'svelte' import { HeldValue, LABEL_MIN_MS } from './heldValue.svelte' + import Tooltip from '$lib/components/meltComponents/Tooltip.svelte' interface Props { label: string @@ -12,6 +13,8 @@ * label weight, because a caller emphasising the label is also setting a proportional * typeface, whose medium reads heavier than the mono one at this size. */ labelPrefix?: string + /** Parts left out of the label, shown as `+N` after it and listed on hover. */ + labelMore?: string[] expanded: boolean onToggle: () => void // A card with nothing to reveal keeps the header inert (no chevron, no @@ -43,6 +46,7 @@ let { label, labelPrefix, + labelMore, expanded, onToggle, toggleable = true, @@ -63,11 +67,11 @@ // right after its last status would show the running label, shimmer or line beside the // settled others. const held = new HeldValue( - () => ({ prefix: labelPrefix, label, shimmer, liveLine }), + () => ({ prefix: labelPrefix, label, more: labelMore, shimmer, liveLine }), () => (settleLabel ? LABEL_MIN_MS : 0) ) const shown = $derived( - settleLabel ? held.current : { prefix: labelPrefix, label, shimmer, liveLine } + settleLabel ? held.current : { prefix: labelPrefix, label, more: labelMore, shimmer, liveLine } ) @@ -88,7 +92,7 @@ {#snippet headerButton()}