Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat(chat): animate active timeline icons (#4535)
lyingbug9fba40d6914f
diff --git a/frontend/src/components/ChatTimelineIcon.motion.test.ts b/frontend/src/components/ChatTimelineIcon.motion.test.tsnew file mode 100644index 000000000..05de30302--- /dev/null+++ b/frontend/src/components/ChatTimelineIcon.motion.test.ts@@ -0,0 +1,171 @@+import assert from 'node:assert/strict'+import { readFileSync } from 'node:fs'+import { fileURLToPath } from 'node:url'+import { after, before, test } from 'node:test'+import { createSSRApp, h, type Component } from 'vue'+import { renderToString } from 'vue/server-renderer'+import { compileStyleAsync, parse } from '@vue/compiler-sfc'+import vue from '@vitejs/plugin-vue'+import { createServer, type ViteDevServer } from 'vite'+import { getAgentToolIconName } from '../utils/agent-tool-icons'++const iconNames = [+ 'lightbulb', 'ai-search', 'bookmark', 'search', 'internet', 'data-search', 'file-search',+ 'file', 'file-paste', 'task', 'folder', 'edit', 'attach', 'terminal', 'code', 'chat',+ 'agent', 'browser', 'jump', 'compaction', 'ellipsis', 'check-circle', 'play-circle',+ 'time', 'minus-circle', 'close-circle', 'help-circle', 'secured', 'lock-on',+]+const filename = fileURLToPath(new URL('./ChatTimelineIcon.vue', import.meta.url))+const source = readFileSync(filename, 'utf8')+let server: ViteDevServer+let Icon: Component+let css: string++before(async () => {+ server = await createServer({+ configFile: false, optimizeDeps: { noDiscovery: true, entries: [] }, plugins: [vue()],+ server: { middlewareMode: true, hmr: false }, appType: 'custom',+ })+ Icon = (await server.ssrLoadModule('/src/components/ChatTimelineIcon.vue')).default+ const { descriptor } = parse(source)+ const result = await compileStyleAsync({+ filename, source: descriptor.styles[0].content,+ id: 'data-v-motion', scoped: true, preprocessLang: 'less',+ })+ assert.deepEqual(result.errors, [])+ css = result.code+})+after(async () => { await server?.close() })++async function render(name: string, active?: boolean) {+ return renderToString(createSSRApp({ render: () => h(Icon, { name, active }) }))+}++test('active icons keep their viewport and stroke, while completed and historical records contain no animation', async () => {+ for (const name of iconNames) {+ const active = await render(name, true)+ const complete = await render(name, false)+ const historical = await render(name)+ assert.match(active, /class="chat-timeline-icon is-active"/)+ assert.doesNotMatch(complete, /is-active|icon-motion|<animate/i)+ assert.doesNotMatch(historical, /is-active|icon-motion|<animate/i)+ for (const html of [active, complete, historical]) {+ assert.match(html, /width="18" height="18" viewbox="0 0 24 24"/i)+ assert.match(html, /stroke-width="1.65"/)+ assert.match(html, /aria-hidden="true"/)+ }+ }+})++test('every tool icon family has a semantic motion, including the unknown-tool fallback', async () => {+ const tools = [+ 'thinking', 'search_knowledge', 'wiki_search', 'web_search', 'web_fetch', 'read_document',+ 'todo_write', 'attachment_parsing', 'call_mcp_tool', 'shell_exec', 'list_sandbox_files',+ 'read_file', 'write_sandbox_file', 'execute_skill_script', 'spawn_agent', 'local_browser',+ 'open_page', 'unknown_tool',+ ]+ const names = new Set([...tools.map(tool => getAgentToolIconName(tool)), ...iconNames])+ for (const name of names) {+ const html = await render(name, true)+ assert.ok(html.includes(`data-icon="${name}"`), `${name} must use its own glyph`)+ assert.match(html, /<animate(?:Transform)?\s/i, `${name} must have a motion on its working part`)+ }+ assert.match(await render('unknown_tool', true), /data-icon="file-paste"/)+ for (const name of ['chevron-right', 'chevron-down']) {+ assert.doesNotMatch(await render(name, true), /<animate/i, 'disclosure controls remain still')+ }+})++test('reduced motion keeps the exact static glyph and movement is opt-in', async () => {+ const mediaStart = css.indexOf('@media (prefers-reduced-motion: no-preference)')+ assert.ok(mediaStart >= 0)+ assert.match(css.slice(0, mediaStart), /\.icon-motion[^{}]*\{\s*display: none/)+ assert.doesNotMatch(css.slice(0, mediaStart), /icon-still/)+ assert.match(css.slice(mediaStart), /\.is-active[^{}]*> .icon-still[^{}]*\{\s*display: none/)+ assert.match(css.slice(mediaStart), /\.icon-motion[^{}]*\{\s*display: inline/)+ assert.doesNotMatch(css, /\bscale(?:X|Y)?\(|\bfilter:|will-change/)+ for (const name of iconNames) {+ const still = (html: string) => html.match(/<g class="icon-still"[^>]*>([\s\S]*?)<\/g>/)?.[1]+ const active = still(await render(name, true))+ assert.ok(active)+ assert.equal(active, still(await render(name, false)), name)+ }+})++test('native timelines have valid spline segments, compatible path morphs and a seamless repeat', async () => {+ // Validate the emitted SVG, not just the descriptors: malformed SMIL silently+ // stops animating in browsers even when the Vue template compiles successfully.+ for (const name of iconNames) {+ const html = await render(name, true)+ for (const [tag] of html.matchAll(/<animate(?:Transform)?\s[^>]*>/gi)) {+ const attr = (key: string) => tag.match(new RegExp(`\\b${key}="([^"]*)"`, 'i'))?.[1]+ const values = attr('values')!.split(';')+ const times = attr('keyTimes')!.split(';').map(Number)+ const splines = attr('keySplines')!.split(';')+ assert.equal(values.length, times.length, name)+ assert.equal(splines.length, times.length - 1, name)+ assert.equal(times[0], 0)+ assert.equal(times.at(-1), 1)+ assert.ok(times.every((time, index) => Number.isFinite(time) && (!index || time > times[index - 1])))+ for (const spline of splines) {+ const points = spline.split(' ').map(Number)+ assert.equal(points.length, 4)+ assert.ok(points.every(point => Number.isFinite(point) && point >= 0 && point <= 1))+ }+ if (attr('type') === 'rotate') {+ const first = values[0].split(' ').map(Number)+ const last = values.at(-1)!.split(' ').map(Number)+ assert.equal(Math.abs(last[0] - first[0]) % 360, 0, `${name} must not jump on repeat`)+ assert.deepEqual(first.slice(1), last.slice(1))+ } else {+ assert.equal(values[0], values.at(-1), `${name} must not jump on repeat`)+ }+ assert.equal(attr('calcMode'), 'spline')+ assert.equal(attr('repeatCount'), 'indefinite')+ assert.equal(attr('dur'), '2.8s')+ if (attr('attributeName') === 'd') {+ const commands = (path: string) => path.match(/[a-z]/gi)+ for (const value of values) assert.deepEqual(commands(value), commands(values[0]), name)+ } else if (attr('attributeName') === 'transform') {+ assert.ok(['translate', 'rotate'].includes(attr('type')!), 'strokes must never be scaled')+ } else {+ assert.ok(['opacity', 'stroke-dashoffset'].includes(attr('attributeName')!))+ assert.ok(values.every(value => Number(value) >= 0 && Number(value) <= 1))+ }+ }+ }+})++test('drawing strokes have a normalized length and reset only after fading out', async () => {+ for (const name of ['lightbulb', 'file', 'task', 'terminal', 'chat', 'check-circle']) {+ const html = await render(name, true)+ const strokes = [...html.matchAll(/<path[^>]*pathLength="1"[^>]*>[\s\S]*?<\/path>/gi)]+ assert.ok(strokes.length, name)+ for (const [path] of strokes) {+ assert.match(path, /stroke-dasharray="1"/)+ assert.match(path, /stroke-dashoffset="1"/)+ assert.match(path, /opacity="0"/)+ const values = (attribute: string) => path.match(new RegExp(`attributeName="${attribute}" values="([^"]+)"`, 'i'))![1].split(';')+ const offset = values('stroke-dashoffset')+ const opacity = values('opacity')+ for (let index = 1; index < offset.length; index++) {+ if (offset[index] > offset[index - 1]) {+ assert.equal(opacity[index - 1], '0')+ assert.equal(opacity[index], '0')+ }+ }+ }+ }+})++test('both agent timeline branches gate tools and reasoning on the live segment', () => {+ const agent = readFileSync(new URL('../views/chat/components/AgentStreamDisplay.vue', import.meta.url), 'utf8')+ assert.equal((agent.match(/:name="getToolIconName\(event.tool_name\)" :active="!isSegmentDone && event.pending"/g) || []).length, 2)+ assert.equal((agent.match(/:active="!isSegmentDone && isThinkingActive\(event.event_id\)"/g) || []).length, 2)+ assert.equal((agent.match(/:active="!isSegmentDone && \(event.pending \|\| isThinkingActive\(event.tool_call_id\)\)"/g) || []).length, 2)+ assert.equal((agent.match(/:motion-paused="isSegmentDone"/g) || []).length, 2)+ const rag = readFileSync(new URL('../views/chat/components/RagPipelineProgress.vue', import.meta.url), 'utf8')+ assert.equal((rag.match(/:active="step.pending && !hasAnswer && !session\?\.is_completed"/g) || []).length, 2)+ assert.equal((rag.match(/:active="thinkingActive"/g) || []).length, 2)+ assert.match(rag, /:active="!waitStepStalled"/)+})diff --git a/frontend/src/components/ChatTimelineIcon.vue b/frontend/src/components/ChatTimelineIcon.vueindex 876a9076e..a8f7e85ad 100644--- a/frontend/src/components/ChatTimelineIcon.vue+++ b/frontend/src/components/ChatTimelineIcon.vue@@ -1,15 +1,35 @@<template>- <svg class="chat-timeline-icon" width="18" height="18" viewBox="0 0 24 24" fill="none"+ <svg :key="`${iconName}-${!!active}`" class="chat-timeline-icon" :class="{ 'is-active': active }" :data-icon="iconName"+ width="18" height="18" viewBox="0 0 24 24" fill="none"stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"aria-hidden="true" focusable="false">- <path v-for="(path, index) in paths" :key="index" :d="path" />+ <g class="icon-still">+ <path v-for="(path, index) in paths" :key="index" :d="path" />+ </g>+ <g v-if="active" class="icon-motion">+ <g v-for="(part, index) in motionParts" :key="index">+ <animateTransform v-if="part.transform" attributeName="transform" :type="part.transform.type"+ :values="part.transform.values.join(';')" :keyTimes="part.transform.times"+ :keySplines="part.transform.splines" calcMode="spline"+ :dur="TIMELINE_ICON_CYCLE" :begin="`${part.delay || 0}s`" repeatCount="indefinite" />+ <path :d="part.path" :pathLength="part.draw ? 1 : undefined"+ :stroke-dasharray="part.draw ? 1 : undefined" :stroke-dashoffset="part.draw ? 1 : undefined"+ :opacity="part.animations?.find(animation => animation.attribute === 'opacity')?.values[0]">+ <animate v-for="animation in part.animations" :key="animation.attribute"+ :attributeName="animation.attribute" :values="animation.values.join(';')"+ :keyTimes="animation.times" :keySplines="animation.splines" calcMode="spline"+ :dur="TIMELINE_ICON_CYCLE" :begin="`${part.delay || 0}s`" repeatCount="indefinite" />+ </path>+ </g>+ </g></svg></template><script setup lang="ts">import { computed } from 'vue'+import { getTimelineIconMotion, TIMELINE_ICON_CYCLE } from '../utils/chatTimelineIconMotion'-const props = defineProps<{ name: string }>()+const props = defineProps<{ name: string; active?: boolean }>()// One stroke and viewport for every timeline mark, including browser, agent// and approval rows. Closed shapes use a 16-unit keyline; open symbols are@@ -26,7 +46,7 @@ const icons: Record<string, string[]> = {'ai-search': bulb,bookmark: ['M18 20l-6-3-6 3V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v14Z'],search: ['M16 10a6 6 0 1 1-12 0 6 6 0 0 1 12 0Zm-1.5 4.5L20 20'],- internet: [circle, 'M4 12h16M12 4c-4 4-4 12 0 16 4-4 4-12 0-16Z'],+ internet: [circle, 'M4 12h16', 'M12 4c-4 4-4 12 0 16 4-4 4-12 0-16Z'],'data-search': ['M4 7c0-4 13-4 13 0S4 11 4 7Zm0 0v10c0 2 3 3 6 3M4 12c0 2 3 3 6 3m7-8v3','M19 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm-1 2 2 2',@@ -36,17 +56,17 @@ const icons: Record<string, string[]> = {'M19 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm-1 2 2 2',],file: [file],- 'file-paste': [file, 'M8 15h8m-8 3h5'],+ 'file-paste': [file, 'M8 15h8', 'M8 18h5'],task: ['M9 5H7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2',- 'M9 3h6v4H9V3Zm-1 9 1 1 2-2m2 1h3m-8 5h8',+ 'M9 3h6v4H9V3Z', 'm8 12 1 1 2-2', 'M13 12h3m-8 5h8',],folder: ['M4 8V6a2 2 0 0 1 2-2h3l2 3h7a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8Z'],edit: ['m14 5 5 5M5 19l4-1L19 8a2.8 2.8 0 0 0-4-4L5 14v5Z'],attach: ['m9 12 5-5a2.8 2.8 0 0 1 4 4l-7 7a4.2 4.2 0 0 1-6-6l8-8m-4 8a1.4 1.4 0 0 0 2 2l4-4'],- terminal: ['m5 6 6 6-6 6m9 0h5'],- code: ['m8 7-4 5 4 5m8-10 4 5-4 5m-3-13-2 16'],- chat: ['M20 11a8 7 0 0 1-8 7H9l-5 3 1-6a7 7 0 0 1-1-4 8 7 0 0 1 16 0ZM8 11h8'],+ terminal: ['m5 6 6 6-6 6', 'M14 18h5'],+ code: ['m8 7-4 5 4 5', 'm16 7 4 5-4 5', 'm13 4-2 16'],+ chat: ['M20 11a8 7 0 0 1-8 7H9l-5 3 1-6a7 7 0 0 1-1-4 8 7 0 0 1 16 0Z', 'M8 11h8'],agent: ['M15 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM6 20v-2a6 6 0 0 1 12 0v2','M18 5a3 3 0 0 1 0 6m3 7v-1a5 5 0 0 0-2-4',@@ -55,16 +75,16 @@ const icons: Record<string, string[]> = {'M9 19H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v5M4 9h16M7 6.5h.01M10 6.5h.01','m12 12 3 8 1.5-3.5L20 15l-8-3Z',],- jump: ['M14 5h5v5m0-5-8 8M10 5H7a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3'],- compaction: ['M5 4h14M5 20h14M8 7l4 4 4-4M8 17l4-4 4 4'],- ellipsis: ['M6 12h.01M12 12h.01M18 12h.01'],+ jump: ['M14 5h5v5m0-5-8 8', 'M10 5H7a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3'],+ compaction: ['M5 4h14M5 20h14', 'M8 7l4 4 4-4', 'M8 17l4-4 4 4'],+ ellipsis: ['M6 12h.01', 'M12 12h.01', 'M18 12h.01'],'check-circle': [circle, 'm8.5 12 2.5 2.5 4.5-5'],'play-circle': [circle, 'm10 8.5 5 3.5-5 3.5v-7Z'],time: [circle, 'M12 7v5l3 2'],'minus-circle': [circle, 'M8.5 12h7'],'close-circle': [circle, 'm9 9 6 6m-6 0 6-6'],'help-circle': [circle, 'M9.5 9a2.5 2.5 0 0 1 5 0c0 2-2.5 2-2.5 4m0 3h.01'],- secured: ['M12 4 5 7v5c0 4 7 8 7 8s7-4 7-8V7l-7-3Zm-3.5 8 2.5 2.5 4.5-5'],+ secured: ['M12 4 5 7v5c0 4 7 8 7 8s7-4 7-8V7l-7-3Z', 'm8.5 12 2.5 2.5 4.5-5'],'lock-on': ['M8 10V8a4 4 0 0 1 8 0v2M7 10h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2Z','M12 14v3',@@ -72,5 +92,20 @@ const icons: Record<string, string[]> = {'chevron-right': ['m9 6 6 6-6 6'],'chevron-down': ['m6 9 6 6 6-6'],}-const paths = computed(() => icons[props.name] ?? icons['file-paste'])+const iconName = computed(() => Object.hasOwn(icons, props.name) ? props.name : 'file-paste')+const paths = computed(() => icons[iconName.value])+// A new SVG time container starts each run from its first frame. Completed+// records render only the original glyph; no animation survives in history.+const motionParts = computed(() => props.active ? getTimelineIconMotion(iconName.value, paths.value) : [])</script>++<style scoped lang="less">+.icon-motion { display: none; }++// Opt in to movement. Reduced-motion users (and older media-query engines)+// see the exact static glyph, including its full checkmarks and text strokes.+@media (prefers-reduced-motion: no-preference) {+ .is-active > .icon-still { display: none; }+ .icon-motion { display: inline; }+}+</style>diff --git a/frontend/src/utils/chatTimelineIconMotion.ts b/frontend/src/utils/chatTimelineIconMotion.tsnew file mode 100644index 000000000..9981bd26b--- /dev/null+++ b/frontend/src/utils/chatTimelineIconMotion.ts@@ -0,0 +1,190 @@+// Each glyph performs one readable gesture, settles, then rests before repeating.+// The phases borrow the anticipation/settling approach of open-claude-ui's+// motion examples, implemented here with our own SVG geometry (no icon font).+export interface TimelineIconAnimation {+ attribute: 'd' | 'opacity' | 'stroke-dashoffset'+ values: string[]+ times: string+ splines: string+}++export interface TimelineIconPart {+ path: string+ animations?: TimelineIconAnimation[]+ transform?: {+ type: 'translate' | 'rotate'+ values: string[]+ times: string+ splines: string+ }+ draw?: boolean+ delay?: number+}++export const TIMELINE_ICON_CYCLE = '2.8s'+const gestureTimes = '0;.12;.3;.4;.56;.78;1'+const ease = '.22 .7 .3 1'+const settle = '.2 0 .2 1'+const gestureSplines = [ease, ease, settle, ease, settle, ease].join(';')+const traceTimes = '0;.12;.36;.6;.76;.82;1'+const traceSplines = Array(6).fill(ease).join(';')++const gesture = (rest: string, overshoot: string, target: string) => ({+ values: [rest, rest, overshoot, target, target, rest, rest],+ times: gestureTimes,+ splines: gestureSplines,+})++function move(+ part: TimelineIconPart, type: 'translate' | 'rotate',+ rest: string, overshoot: string, target: string,+): TimelineIconPart {+ return { ...part, transform: { type, ...gesture(rest, overshoot, target) } }+}++function morph(path: string, target: string, overshoot = target): TimelineIconPart {+ return { path, animations: [{ attribute: 'd', ...gesture(path, overshoot, target) }] }+}++// Draw once, hold, fade, then reset while invisible. Never erase a visible line+// backwards, flash the whole icon, or change the line weight.+function trace(path: string, delay = 0): TimelineIconPart {+ return {+ path, draw: true, delay,+ animations: [+ { attribute: 'stroke-dashoffset', values: ['1', '1', '0', '0', '0', '1', '1'], times: traceTimes, splines: traceSplines },+ { attribute: 'opacity', values: ['0', '1', '1', '1', '0', '0', '0'], times: traceTimes, splines: traceSplines },+ ],+ }+}++function reveal(path: string, delay = 0): TimelineIconPart {+ return {+ path, delay,+ animations: [{+ attribute: 'opacity', values: ['0', '0', '1', '1', '0', '0', '0'],+ times: traceTimes, splines: traceSplines,+ }],+ }+}++export function getTimelineIconMotion(name: string, paths: string[]): TimelineIconPart[] {+ const parts: TimelineIconPart[] = paths.map(path => ({ path }))+ switch (name) {+ case 'lightbulb':+ case 'ai-search':+ // Keep every lit stroke inside the glass, with space above the neck.+ // External rays can read as stray filament at the actual 18px size.+ return [...parts, trace('M9.5 9.5 12 12l2.5-2.5M12 12v2')]+ case 'search':+ return [...parts, trace('M6 10a4 4 0 0 1 4-4')]+ case 'data-search':+ case 'file-search':+ // One deliberate lens pass, followed by a small settle at the destination.+ return [parts[0], move(parts[1], 'translate', '0 0', '-2.5 -1.5', '-2 -1')]+ case 'internet':+ // Meridian bends across the globe instead of rocking the entire world.+ return [+ parts[0], parts[1],+ morph('M12 4C7 7 7 17 12 20', 'M12 4C17 7 17 17 12 20'),+ morph('M12 4C17 7 17 17 12 20', 'M12 4C7 7 7 17 12 20'),+ ]+ case 'file':+ case 'file-paste':+ return [parts[0], trace('M8 14h8'), trace('M8 17h5', .18)]+ case 'folder':+ // The front opens while the back and tab stay anchored.+ return [+ { path: 'M4 17V6a2 2 0 0 1 2-2h3l2 3h7a2 2 0 0 1 2 2v8' },+ morph(+ 'M4 10h16l-1 8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z',+ 'M6 11h16l-3 7a3 3 0 0 1-3 2H6a2 2 0 0 1-2-2Z',+ 'M6.5 11h16l-3.5 7a3 3 0 0 1-3 2H6a2 2 0 0 1-2-2Z',+ ),+ ]+ case 'task':+ return [parts[0], parts[1], trace(parts[2].path), trace(parts[3].path, .2)]+ case 'bookmark':+ return [...parts, trace('M9 10h6'), trace('M9 13h4', .16)]+ case 'edit':+ return [move(parts[0], 'translate', '0 0', '2 -2', '1.5 -1.5'), trace('M5 21h8', .2)]+ case 'attach':+ return [move(parts[0], 'rotate', '0 12 12', '-16 12 12', '-12 12 12')]+ case 'terminal':+ return [+ move(parts[0], 'translate', '0 0', '2.5 0', '2 0'),+ trace('M15 18h5', .16),+ ]+ case 'code':+ return [+ move(parts[0], 'translate', '0 0', '-1.5 0', '-1 0'),+ move(parts[1], 'translate', '0 0', '1.5 0', '1 0'),+ trace(parts[2].path, .18),+ ]+ case 'chat':+ return [parts[0], trace('M8 10h8'), trace('M8 13h5', .18)]+ case 'agent':+ return [+ move(parts[0], 'translate', '0 0', '-1.2 0', '-.8 0'),+ { ...move(parts[1], 'translate', '0 0', '1.2 0', '.8 0'), delay: .14 },+ ]+ case 'browser':+ return [+ parts[0],+ move(parts[1], 'translate', '0 0', '-2 -1.5', '-1.5 -1'),+ reveal('M7.5 11.5h-2m3-2-1-1.5', .25),+ ]+ case 'jump':+ return [+ move(parts[0], 'translate', '0 0', '2 -2', '1.5 -1.5'),+ parts[1],+ ]+ case 'compaction':+ return [+ parts[0],+ // Keep the arrow tips apart, including at the overshoot, so their+ // strokes never collide into a heavier mark.+ morph('M8 7l4 4 4-4', 'M10 8l2 3 2-3', 'M10.5 8.2l1.5 2.8 1.5-2.8'),+ morph('M8 17l4-4 4 4', 'M10 16l2-3 2 3', 'M10.5 15.8l1.5-2.8 1.5 2.8'),+ ]+ case 'ellipsis':+ return parts.map((part, index) => ({+ ...move(part, 'translate', '0 0', '0 -2.5', '0 -2'), delay: index * .12,+ }))+ case 'secured':+ case 'check-circle':+ return [parts[0], trace(parts[1].path)]+ case 'lock-on':+ return [+ { path: 'M8 10V8a4 4 0 0 1 8 0v2' },+ { path: 'M7 10h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2Z' },+ trace(parts[1].path),+ ]+ case 'help-circle':+ return [parts[0], trace(parts[1].path)]+ case 'time':+ return [+ parts[0], { path: 'M12 12l3 2' },+ {+ path: 'M12 12V7',+ transform: {+ type: 'rotate',+ values: [0, 0, 96, 90, 186, 180, 276, 270, 366, 360, 360].map(angle => `${angle} 12 12`),+ times: '0;.06;.18;.24;.38;.44;.58;.64;.78;.84;1',+ splines: Array(10).fill(ease).join(';'),+ },+ },+ ]+ case 'play-circle':+ return [parts[0], move(parts[1], 'translate', '0 0', '1.5 0', '1 0')]+ case 'minus-circle':+ case 'close-circle':+ return [parts[0], trace(parts[1].path)]+ case 'chevron-right':+ case 'chevron-down':+ return parts+ default:+ // Unknown tools keep the generic file glyph and its reading gesture.+ return [parts[0], trace('M8 14h8'), trace('M8 17h5', .18)]+ }+}diff --git a/frontend/src/views/chat/components/AgentStreamDisplay.vue b/frontend/src/views/chat/components/AgentStreamDisplay.vueindex 068bd93ac..2f1ba26dc 100644--- a/frontend/src/views/chat/components/AgentStreamDisplay.vue+++ b/frontend/src/views/chat/components/AgentStreamDisplay.vue@@ -35,7 +35,7 @@:class="{ 'tree-child-last': !isSegmentDone && index === visibleIntermediateEvents.length - 1, 'tree-child-progress': event.type === 'child_task' }"><div class="tree-branch"></div><div class="tree-child-content">- <CollaborationTasks v-if="event.type === 'child_task'" :task="event.task" :disabled="!!embedToken" :tool-label="getLocalizedToolName" @open="openChildTask" />+ <CollaborationTasks v-if="event.type === 'child_task'" :task="event.task" :motion-paused="isSegmentDone" :disabled="!!embedToken" :tool-label="getLocalizedToolName" @open="openChildTask" /><!-- Plan Task Change Event --><div v-if="event.type === 'plan_task_change'" class="plan-task-change-event">@@ -77,7 +77,7 @@<div class="action-title" :class="{'thinking-inline-title': !event.title && isEventExpanded(event.event_id),}">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="!isSegmentDone && isThinkingActive(event.event_id)" /><span v-if="event.title" class="action-name action-preamble-title">{{ event.title }}</span><div v-else-if="event.content && isEventExpanded(event.event_id)"class="thinking-inline-content markdown-content"@@ -103,7 +103,7 @@:class="{ 'action-pending': event.pending || isThinkingActive(event.tool_call_id) }"><div class="action-header" @click="toggleEvent(event.tool_call_id)"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="!isSegmentDone && (event.pending || isThinkingActive(event.tool_call_id))" /><span class="action-name">{{ $t('agent.think') }}</span><span v-if="event.tool_data?.thought_number" class="action-badge">{{event.tool_data.thought_number }}/{{ event.tool_data.total_thoughts }}</span>@@ -167,7 +167,7 @@:class="{ 'no-results': !hasActionResult(event) }"><div class="action-title"><ChatTimelineIcon v-if="event.tool_name" class="action-title-icon"- :name="getToolIconName(event.tool_name)" />+ :name="getToolIconName(event.tool_name)" :active="!isSegmentDone && event.pending" /><t-tooltip v-if="event.tool_name === 'todo_write' && event.tool_data?.steps":content="t('agent.updatePlan')" placement="top"><span class="action-name">{{ $t('agent.updatePlan') }}</span>@@ -336,7 +336,7 @@<div v-if="isStreamingTimelineEvent(event)" class="tree-branch"></div><div :class="{ 'tree-child-content': isStreamingTimelineEvent(event) }">- <CollaborationTasks v-if="event.type === 'child_task'" :task="event.task" :disabled="!!embedToken" :tool-label="getLocalizedToolName" @open="openChildTask" />+ <CollaborationTasks v-if="event.type === 'child_task'" :task="event.task" :motion-paused="isSegmentDone" :disabled="!!embedToken" :tool-label="getLocalizedToolName" @open="openChildTask" /><!-- Plan Task Change Event --><div v-if="event.type === 'plan_task_change'" class="plan-task-change-event">@@ -378,7 +378,7 @@<div class="action-title" :class="{'thinking-inline-title': !event.title && isEventExpanded(event.event_id),}">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="!isSegmentDone && isThinkingActive(event.event_id)" /><span v-if="event.title" class="action-name action-preamble-title">{{ event.title }}</span><div v-else-if="event.content && isEventExpanded(event.event_id)"class="thinking-inline-content markdown-content"@@ -433,7 +433,7 @@:class="{ 'action-pending': event.pending || isThinkingActive(event.tool_call_id) }"><div class="action-header" @click="toggleEvent(event.tool_call_id)"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="!isSegmentDone && (event.pending || isThinkingActive(event.tool_call_id))" /><span class="action-name">{{ $t('agent.think') }}</span><span v-if="event.tool_data?.thought_number" class="action-badge">{{ event.tool_data.thought_number}}/{{ event.tool_data.total_thoughts }}</span>@@ -550,7 +550,7 @@<div class="action-header" @click.stop="handleActionHeaderClick(event)":class="{ 'no-results': !hasActionResult(event) }"><div class="action-title">- <ChatTimelineIcon v-if="event.tool_name" class="action-title-icon" :name="getToolIconName(event.tool_name)" />+ <ChatTimelineIcon v-if="event.tool_name" class="action-title-icon" :name="getToolIconName(event.tool_name)" :active="!isSegmentDone && event.pending" /><t-tooltip v-if="event.tool_name === 'todo_write' && event.tool_data?.steps":content="t('agent.updatePlan')" placement="top"><span class="action-name">@@ -670,7 +670,7 @@<div class="action-card action-pending"><div class="action-header no-results"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="!isSegmentDone" /><span class="action-name">{{ t(childActivity === 'approval' ? 'agentStream.collaboration.status.waiting' : childActivity ? 'agentStream.collaboration.waiting' : 'chat.thinkingAlt') }}</span></div></div>diff --git a/frontend/src/views/chat/components/AskUserCard.vue b/frontend/src/views/chat/components/AskUserCard.vueindex a15f6ea02..2347545b6 100644--- a/frontend/src/views/chat/components/AskUserCard.vue+++ b/frontend/src/views/chat/components/AskUserCard.vue@@ -60,7 +60,7 @@<div v-else class="action-card interaction-inline ask-inline" :class="{ 'action-pending': open }"><div class="action-header no-results"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" :name="headerIcon" />+ <ChatTimelineIcon class="action-title-icon" :name="headerIcon" :active="open" /><span class="action-name">{{ $t('agentStream.askUser.title') }}</span><span class="ask-status" role="status">{{ awaitingInDock ? $t('agentStream.promptDock.waiting') : statusLine }}diff --git a/frontend/src/views/chat/components/CollaborationTasks.test.ts b/frontend/src/views/chat/components/CollaborationTasks.test.tsindex 5757e6f7d..0d73f8411 100644--- a/frontend/src/views/chat/components/CollaborationTasks.test.ts+++ b/frontend/src/views/chat/components/CollaborationTasks.test.ts@@ -40,3 +40,19 @@ test('completed child rows hide obsolete running tool progress', async () => {assert.match(html, /已完成/)assert.doesNotMatch(html, /正在使用工具/)})++test('only a running child animates its icon, and a sealed parent pauses it', async () => {+ for (const status of ['running', 'queued', 'waiting', 'succeeded', 'failed', 'cancelled', 'interrupted']) {+ const html = await render({ task: { id: 'a', displayName: '检索', sessionId: 's', status } })+ const icon = html.match(/<svg[^>]*data-icon="agent"[^>]*>/)?.[0]+ assert.ok(icon)+ assert.equal(icon.includes('is-active'), status === 'running')+ const disclosure = html.match(/<svg[^>]*data-icon="chevron-right"[^>]*>/)?.[0]+ assert.ok(disclosure)+ assert.doesNotMatch(disclosure, /is-active/)+ }+ const sealed = await render({+ task: { id: 'a', displayName: '检索', sessionId: 's', status: 'running' }, motionPaused: true,+ })+ assert.doesNotMatch(sealed, /is-active/)+})diff --git a/frontend/src/views/chat/components/CollaborationTasks.vue b/frontend/src/views/chat/components/CollaborationTasks.vueindex e4ddc455e..a3b1d4947 100644--- a/frontend/src/views/chat/components/CollaborationTasks.vue+++ b/frontend/src/views/chat/components/CollaborationTasks.vue@@ -1,6 +1,6 @@<template><button class="child-task-row" :class="{ 'is-running': task.status === 'running' }" type="button" :disabled="!task.sessionId || disabled" @click="$emit('open', task)">- <ChatTimelineIcon class="child-task-icon" name="agent" />+ <ChatTimelineIcon class="child-task-icon" name="agent" :active="task.status === 'running' && !motionPaused" /><span class="child-task-name" :class="{ 'is-running': task.status === 'running' }">{{ task.displayName || t('agentStream.collaboration.unnamed') }}</span><span class="child-task-activity" :class="task.status">{{ activity }}</span><ChatTimelineIcon class="child-task-chevron" name="chevron-right" width="14" height="14" />@@ -11,7 +11,7 @@ import { computed } from 'vue'import { useI18n } from 'vue-i18n'import ChatTimelineIcon from '@/components/ChatTimelineIcon.vue'import type { CollaborationTaskView } from '@/utils/collaborationDisplay'-const props = defineProps<{ task: CollaborationTaskView; disabled?: boolean; toolLabel: (name: string) => string }>()+const props = defineProps<{ task: CollaborationTaskView; disabled?: boolean; motionPaused?: boolean; toolLabel: (name: string) => string }>()defineEmits<{ open: [task: CollaborationTaskView] }>()const { t } = useI18n()const activity = computed(() => {diff --git a/frontend/src/views/chat/components/McpOAuthCard.vue b/frontend/src/views/chat/components/McpOAuthCard.vueindex 9ce713036..72a562383 100644--- a/frontend/src/views/chat/components/McpOAuthCard.vue+++ b/frontend/src/views/chat/components/McpOAuthCard.vue@@ -21,7 +21,7 @@<div v-else class="action-card interaction-inline" :class="{ 'action-pending': !resolved }"><div class="action-header no-results"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" :name="headerIcon" />+ <ChatTimelineIcon class="action-title-icon" :name="headerIcon" :active="open" /><span class="action-name">{{ mainTitle }}</span></div></div>diff --git a/frontend/src/views/chat/components/RagPipelineProgress.vue b/frontend/src/views/chat/components/RagPipelineProgress.vueindex be3bf2399..0b41c215b 100644--- a/frontend/src/views/chat/components/RagPipelineProgress.vue+++ b/frontend/src/views/chat/components/RagPipelineProgress.vue@@ -26,7 +26,7 @@<div class="action-card action-pending"><div class="action-header no-results"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="true" /><span class="action-name">{{ t('chat.preparingAnswer') }}</span></div></div>@@ -71,7 +71,7 @@:class="{ 'no-results': !step.canOpenReferences }"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" :name="step.iconName" />+ <ChatTimelineIcon class="action-title-icon" :name="step.iconName" :active="step.pending && !hasAnswer && !session?.is_completed" /><span class="action-name" :class="{ 'is-running': step.pending }">{{ step.title }}</span></div></div>@@ -93,7 +93,7 @@<div class="action-card" :class="{ 'action-pending': !waitStepStalled }"><div class="action-header no-results"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="!waitStepStalled" /><span class="action-name">{{ waitStepText }}</span></div></div>@@ -110,7 +110,7 @@<div class="action-card" :class="{ 'action-pending': thinkingPending }"><div class="action-header" :class="{ 'no-results': !thinkingContent }" @click="toggleThinking"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="thinkingActive" /><span class="action-name">{{ t('agent.think') }}</span></div></div>@@ -196,7 +196,7 @@:class="{ 'no-results': !step.canOpenReferences }"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" :name="step.iconName" />+ <ChatTimelineIcon class="action-title-icon" :name="step.iconName" :active="step.pending && !hasAnswer && !session?.is_completed" /><span class="action-name" :class="{ 'is-running': step.pending }">{{ step.title }}</span></div></div>@@ -215,7 +215,7 @@<div class="action-card" :class="{ 'action-pending': thinkingPending }"><div class="action-header" :class="{ 'no-results': !thinkingContent }" @click="toggleThinking"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" name="lightbulb" />+ <ChatTimelineIcon class="action-title-icon" name="lightbulb" :active="thinkingActive" /><span class="action-name">{{ t('agent.think') }}</span></div></div>@@ -456,6 +456,10 @@ const showPrePipelineWait = computed(() => {// Do not pre-empt during the model phase — that flashes "思考" even when thinking is disabled.const showThinkingStep = computed(() => hasThinkingEvent.value)+const thinkingActive = computed(+ () => showThinkingStep.value && !hasAnswer.value && !props.session?.is_completed,+)+const thinkingPending = computed(() =>showThinkingStep.value &&diff --git a/frontend/src/views/chat/components/ToolApprovalCard.vue b/frontend/src/views/chat/components/ToolApprovalCard.vueindex ae49ee9ae..9910369c5 100644--- a/frontend/src/views/chat/components/ToolApprovalCard.vue+++ b/frontend/src/views/chat/components/ToolApprovalCard.vue@@ -63,7 +63,7 @@<div v-else class="action-card interaction-inline approval-inline" :class="{ 'action-pending': open }"><div class="action-header no-results"><div class="action-title">- <ChatTimelineIcon class="action-title-icon" :name="headerIcon" />+ <ChatTimelineIcon class="action-title-icon" :name="headerIcon" :active="open" /><component :is="hasArgs ? 'button' : 'span'" class="approval-heading":type="hasArgs ? 'button' : undefined" :aria-expanded="hasArgs ? argsExpanded : undefined"@click.stop="hasArgs && toggleArgs()">