Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 计划进行中步骤改用对齐空心圆的圆弧 spinner (#3492)
Dashc2ff1625679e
diff --git a/apps/desktop/src/renderer/__tests__/agentActionRowRendering.test.ts b/apps/desktop/src/renderer/__tests__/agentActionRowRendering.test.tsindex eb1c0f95c6..c69743f4d9 100644--- a/apps/desktop/src/renderer/__tests__/agentActionRowRendering.test.ts+++ b/apps/desktop/src/renderer/__tests__/agentActionRowRendering.test.ts@@ -448,7 +448,7 @@ describe('AgentActionsBlock — 状态判定与块头', () => {isSessionStreaming: true,}),);- expect(container.querySelector('.animate-spin')).toBeTruthy();+ expect(container.querySelector('.animate-spinner')).toBeTruthy();expandBlock();expect(screen.getAllByLabelText('chat.agentActionRow.status.done')).toHaveLength(1);expect(screen.getAllByLabelText('chat.agentActionRow.status.running')).toHaveLength(1);@@ -463,7 +463,7 @@ describe('AgentActionsBlock — 状态判定与块头', () => {isSessionStreaming: true,}),);- expect(container.querySelector('.animate-spin')).toBeNull();+ expect(container.querySelector('.animate-spinner')).toBeNull();expandBlock();expect(screen.getByLabelText('chat.agentActionRow.status.done')).toBeTruthy();});@@ -475,7 +475,7 @@ describe('AgentActionsBlock — 状态判定与块头', () => {resultMap: new Map(),}),);- expect(container.querySelector('.animate-spin')).toBeNull();+ expect(container.querySelector('.animate-spinner')).toBeNull();expandBlock();expect(screen.getByLabelText('chat.agentActionRow.status.done')).toBeTruthy();});diff --git a/apps/desktop/src/renderer/components/chat/TodoListCard.tsx b/apps/desktop/src/renderer/components/chat/TodoListCard.tsxindex 5055cbbefe..fd9edd818c 100644--- a/apps/desktop/src/renderer/components/chat/TodoListCard.tsx+++ b/apps/desktop/src/renderer/components/chat/TodoListCard.tsx@@ -8,10 +8,9 @@* - 鼠标悬停时临时展开,移开即收起;点击/Enter 后固定展开,再次触发立即收起。* 浮层绝对定位(bottom-full),不改变 composer overlay 的实测高度,* 消息流不会因 hover 抖动。- * - 浮层行:completed 灰(check 圆圈),in_progress 高亮(实心圆点呼吸,- * 复用侧栏运行态同款 session-status-breathing;按 DESIGN.md §SVG 常驻- * 动画红线,呼吸挂 HTML wrapper,SVG 本体静态;reduced-motion 静止),- * pending 正常前景色(空心圆圈)。+ * - 浮层行:completed 灰(check 圆圈),in_progress 高亮(「正在工作…」同款圆弧+ * spinner,半径对齐空心圆 r=10;旋转挂 HTML wrapper、SVG 本体静态;+ * reduced-motion 与会话空闲时静止),pending 正常前景色(空心圆圈)。* - 胶囊图标使用静态灰度进度圆环表达当前步骤位置(它表达"第几步",不是* loading 语义,不旋转);进度变化只通过圆环长度的短过渡反馈。*@@ -25,7 +24,6 @@ import {ChevronDown,ChevronRight,CircleCheck,- CircleDot,Circle,ListTodo,X,@@ -33,6 +31,7 @@ import {import { useTranslation } from 'react-i18next';import type { MessageRenderTodoItem } from '@cindy/maker-shared/message-render';+import { Spinner, type SpinnerIconComponent } from '@/components/ui/spinner';import { Tip } from '@/components/ui/tooltip';import { cn } from '@/lib/utils';@@ -103,6 +102,61 @@ function ProgressRing({);}+/**+ * lucide LoaderCircle 是 r=9 的开口弧;计划行 Circle / CircleDot 是 r=10。+ * 不能 CSS scale(会连线宽一起放大)。保持同一 72° 缺口,把弧径收到 r=10。+ */+const PlanLoaderArc: SpinnerIconComponent = function PlanLoaderArc({+ size = 18,+ strokeWidth = 1.5,+ className,+ ...props+}) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width={size}+ height={size}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth={strokeWidth}+ strokeLinecap="round"+ strokeLinejoin="round"+ className={className}+ data-plan-loader-arc="true"+ {...props}+ >+ <path d="M22 12a10 10 0 1 1-6.91-9.51" />+ </svg>+ );+}++/**+ * 进行中步骤:「正在工作…」同款圆弧,半径对齐旁边空心圆。+ * 旋转挂 HTML wrapper,SVG 本体静态(DESIGN.md 常驻动画红线);+ * 会话空闲或 reduced-motion 时停转,不谎报还在执行。+ */+function PlanInProgressIcon({+ animated,+ variant,+}: {+ animated: boolean;+ variant: 'flyout' | 'inline';+}) {+ return (+ <Spinner+ icon={PlanLoaderArc}+ size={18}+ strokeWidth={1.5}+ spinning={animated}+ className="text-[var(--msg-tool-card-text)]"+ data-plan-step-active={variant === 'flyout' ? 'true' : undefined}+ data-inline-plan-step-active={variant === 'inline' ? 'true' : undefined}+ />+ );+}+/*** InlinePlanCard —— 计划在聊天时间线里的主呈现。*@@ -115,7 +169,7 @@ export function InlinePlanCard({animated = false,}: {todos: TodoItem[];- /** 只有会话确实在跑时,进行中行才呼吸;失败/中断后的历史卡保持静止。 */+ /** 只有会话确实在跑时,进行中行才慢转;失败/中断后的历史卡保持静止。 */animated?: boolean;}) {const [expanded, setExpanded] = useState(true);@@ -189,17 +243,7 @@ export function InlinePlanCard({/>)}{todo.status === 'in_progress' && (- <span- data-inline-plan-step-active="true"- data-inline-plan-step-breathing={animated ? 'true' : 'false'}- className={cn('inline-flex shrink-0', animated && 'session-status-breathing')}- >- <CircleDot- size={18}- strokeWidth={1.5}- className="shrink-0 text-[var(--msg-tool-card-text)]"- />- </span>+ <PlanInProgressIcon animated={animated} variant="inline" />)}{todo.status === 'pending' && (<Circle@@ -242,9 +286,9 @@ export function TodoListCard({}: {todos: TodoItem[];/**- * 会话是否真的在跑(调用方传 isStreaming)。只有它为真时,in_progress 行才挂- * 呼吸动画——计划因停止/失败/中断留在屏幕上时会话已空闲,继续呼吸等于谎报- * "这步还在执行"。胶囊上的进度环与其它形态始终静态,不受此参数影响。+ * 会话是否真的在跑(调用方传 isStreaming)。只有它为真时,in_progress 行才慢转+ * ——计划因停止/失败/中断留在屏幕上时会话已空闲,继续转等于谎报"这步还在+ * 执行"。胶囊上的进度环与其它形态始终静态,不受此参数影响。*/animated?: boolean;/** Composer/chat column width. Keeps the flyout inside clipped compact panes. */@@ -428,24 +472,7 @@ export function TodoListCard({/>)}{todo.status === 'in_progress' && (- // 呼吸表达"正在干活":挂侧栏运行态同款动画。按 SVG 常驻- // 动画红线,动画在 span wrapper 上,SVG 本体保持静态。- // 会话空闲(停止/失败/中断后计划仍留屏)时静止:动画只在- // 确有 running 语义时挂载,否则等于谎报该步骤仍在执行。- <span- data-plan-step-active="true"- data-plan-step-breathing={animated ? 'true' : 'false'}- className={cn(- 'inline-flex shrink-0',- animated && 'session-status-breathing',- )}- >- <CircleDot- size={18}- strokeWidth={1.5}- className="shrink-0 text-[var(--msg-tool-card-text)]"- />- </span>+ <PlanInProgressIcon animated={animated} variant="flyout" />)}{todo.status === 'pending' && (<Circlediff --git a/apps/desktop/src/renderer/components/chat/__tests__/MessageActionBar.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/MessageActionBar.test.tsxindex 61bc997bb2..24ddb414d2 100644--- a/apps/desktop/src/renderer/components/chat/__tests__/MessageActionBar.test.tsx+++ b/apps/desktop/src/renderer/components/chat/__tests__/MessageActionBar.test.tsx@@ -179,7 +179,7 @@ describe('MessageActionBar', () => {});fireEvent.click(forkButton);- await waitFor(() => expect(forkButton.querySelector('.animate-spin')).toBeTruthy());+ await waitFor(() => expect(forkButton.querySelector('.animate-spinner')).toBeTruthy());expect(moreButton.querySelector('.lucide-ellipsis')).toBeTruthy();expect(moreButton.querySelector('.lucide-loader-circle')).toBeNull();expect((moreButton as HTMLButtonElement).disabled).toBe(false);@@ -189,7 +189,7 @@ describe('MessageActionBar', () => {resolveFork();await waitFor(() => {- expect(forkButton.querySelector('.animate-spin')).toBeNull();+ expect(forkButton.querySelector('.animate-spinner')).toBeNull();expect((editButton as HTMLButtonElement).disabled).toBe(false);});});diff --git a/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsxindex 701f014e2f..4bcdab27a8 100644--- a/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsx+++ b/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsx@@ -46,12 +46,12 @@ describe('TodoListCard flyout interaction', () => {expect(container.firstElementChild?.classList.contains('pointer-events-none')).toBe(true);expect(trigger.parentElement?.classList.contains('pointer-events-auto')).toBe(true);expect(trigger.querySelector('svg[data-plan-progress-ring="true"]')).not.toBeNull();- expect(container.querySelector('.animate-spin')).toBeNull();+ expect(container.querySelector('.animate-spinner')).toBeNull();expect(container.querySelector('.animate-pulse')).toBeNull();});it('keeps the active row static when the session is idle', () => {- // 计划因停止/失败/中断留在屏幕上时会话已空闲:继续呼吸等于谎报"这步还在跑"。+ // 计划因停止/失败/中断留在屏幕上时会话已空闲:继续转等于谎报"这步还在跑"。const { container } = render(<TodoListCard todos={TODOS} animated={false} />);const trigger = screen.getByRole('button', { name: 'Step 1 / 2' });@@ -59,27 +59,27 @@ describe('TodoListCard flyout interaction', () => {const wrapper = container.querySelector('span[data-plan-step-active="true"]');expect(wrapper).not.toBeNull();- expect(wrapper?.classList.contains('session-status-breathing')).toBe(false);- expect(wrapper?.getAttribute('data-plan-step-breathing')).toBe('false');+ expect(wrapper?.classList.contains('animate-spinner')).toBe(false);expect(wrapper?.querySelector('svg')).not.toBeNull();});- it('breathes the active row on an HTML wrapper when the flyout is open', () => {+ it('spins the active LoaderCircle on an HTML wrapper when the flyout is open', () => {const { container } = render(<TodoListCard todos={TODOS} animated />);const trigger = screen.getByRole('button', { name: 'Step 1 / 2' });fireEvent.mouseEnter(trigger.parentElement as HTMLElement);- // 正在执行的步骤用侧栏运行态同款呼吸(session-status-breathing,已在- // reduced-motion 白名单)。按 SVG 常驻动画红线,动画必须挂 span wrapper,- // SVG 本体静态;不用旋转,不用 Tailwind 硬编码 pulse/spin。- const wrapper = container.querySelector('span[data-plan-step-active="true"]');+ // 正在执行的步骤与「正在工作…」同款圆弧 spinner。按 SVG 常驻动画红线,+ // 旋转必须挂 span wrapper,SVG 本体静态;不用 pulse,不用侧栏呼吸。+ const wrapper = container.querySelector('span[data-plan-step-active="true"]') as HTMLElement;expect(wrapper?.tagName).toBe('SPAN');- expect(wrapper?.classList.contains('session-status-breathing')).toBe(true);- expect(wrapper?.querySelector('svg')).not.toBeNull();- expect(container.querySelector('svg.session-status-breathing')).toBeNull();- expect(container.querySelector('.animate-spin')).toBeNull();- expect(container.querySelector('.animate-spinner')).toBeNull();+ expect(wrapper?.classList.contains('animate-spinner')).toBe(true);+ expect(wrapper?.classList.contains('animate-spin')).toBe(false);+ const arc = wrapper?.querySelector('svg[data-plan-loader-arc="true"]');+ expect(arc).not.toBeNull();+ expect(arc?.querySelector('path')?.getAttribute('d')).toContain('a10 10');+ expect(container.querySelector('svg.animate-spinner')).toBeNull();+ expect(container.querySelector('.session-status-breathing')).toBeNull();expect(container.querySelector('.animate-pulse')).toBeNull();});@@ -253,16 +253,23 @@ describe('InlinePlanCard', () => {expect(container.querySelector('[data-inline-plan-step-active="true"]')).toBeNull();});- it('breathes the active inline step only while the session is running', () => {+ it('spins the active inline LoaderCircle only while the session is running', () => {const view = render(<InlinePlanCard todos={TODOS} animated />);- const active = view.container.querySelector('[data-inline-plan-step-active="true"]');+ const active = view.container.querySelector(+ '[data-inline-plan-step-active="true"]',+ ) as HTMLElement;- expect(active?.getAttribute('data-inline-plan-step-breathing')).toBe('true');- expect(active?.classList.contains('session-status-breathing')).toBe(true);+ expect(active?.classList.contains('animate-spinner')).toBe(true);+ expect(active?.classList.contains('animate-spin')).toBe(false);+ const arc = active?.querySelector('svg[data-plan-loader-arc="true"]');+ expect(arc).not.toBeNull();+ expect(arc?.querySelector('path')?.getAttribute('d')).toContain('a10 10');+ expect(active?.querySelector('svg.animate-spinner')).toBeNull();view.rerender(<InlinePlanCard todos={TODOS} animated={false} />);- const idle = view.container.querySelector('[data-inline-plan-step-active="true"]');- expect(idle?.getAttribute('data-inline-plan-step-breathing')).toBe('false');- expect(idle?.classList.contains('session-status-breathing')).toBe(false);+ const idle = view.container.querySelector(+ '[data-inline-plan-step-active="true"]',+ ) as HTMLElement;+ expect(idle?.classList.contains('animate-spinner')).toBe(false);});});diff --git a/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx b/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsxindex 7fd98bd88d..4f8889b4d1 100644--- a/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx+++ b/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx@@ -46,7 +46,7 @@ export function PinnedPlanPanel({messages: readonly ChatMessage[];/*** 会话是否真的在跑(调用方传 isStreaming)。胶囊上的进度环始终静态;该值只- * 透传给浮层里 in_progress 行的呼吸动画——空闲时静止,不谎报步骤仍在执行。+ * 透传给浮层里 in_progress 行的慢转——空闲时静止,不谎报步骤仍在执行。*/animated: boolean;/** 与 composer 同宽(inputWidth),胶囊在该宽度内居中,浮层不超出。 */diff --git a/apps/desktop/src/renderer/components/ui/spinner.tsx b/apps/desktop/src/renderer/components/ui/spinner.tsxindex e9a97846c1..f1af011fa8 100644--- a/apps/desktop/src/renderer/components/ui/spinner.tsx+++ b/apps/desktop/src/renderer/components/ui/spinner.tsx@@ -32,7 +32,8 @@ export interface SpinnerProps extends Omit<React.HTMLAttributes<HTMLSpanElement>* DESIGN.md 设计实现规范(常驻动画必须 compositor-only,SVG 一律静止):* CSS animation on SVG roots or SVG children wakes the renderer main thread every* frame. Keep the icon SVG static, and animate only this inline-flex wrapper with- * transform-based Tailwind `animate-spin`.+ * `animate-spinner` (`--motion-spinner-cycle`, DESIGN.md §14.4)。不复用 Tailwind+ * `animate-spin` 的硬编码 1s。** Usage notes:* - The wrapper hugs the icon, so pass `size` only — don't add h/w classes that@@ -40,7 +41,7 @@ export interface SpinnerProps extends Omit<React.HTMLAttributes<HTMLSpanElement>* - The svg sits one level deeper than a bare icon; parent `[&>svg]:` direct-child* selectors won't match it — use `[&_svg]` or style the Spinner wrapper instead.* - Don't put translate utilities on the Spinner itself: while spinning, the- * `animate-spin` keyframe overwrites `transform` every frame. Nudge an outer+ * `animate-spinner` keyframe overwrites `transform` every frame. Nudge an outer* static wrapper instead (never the svg inside — it would orbit off-center).*/const Spinner = React.forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner(@@ -59,7 +60,7 @@ const Spinner = React.forwardRef<HTMLSpanElement, SpinnerProps>(function Spinnerref={ref}className={cn('inline-flex shrink-0 items-center justify-center',- spinning && 'animate-spin motion-reduce:animate-none',+ spinning && 'animate-spinner motion-reduce:animate-none',className,)}{...props}diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsxindex 6ddf4988ce..b8b9ed6a9c 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx@@ -418,7 +418,7 @@ describe('GhostPluginCard', () => {name: 'settings.ghosts.page.updateAria',});expect(update.getAttribute('aria-busy')).toBe('true');- expect(update.querySelector('.animate-spin')).toBeTruthy();+ expect(update.querySelector('.animate-spinner')).toBeTruthy();expect(update.textContent).toBe('');});@@ -737,7 +737,7 @@ describe('MarketPluginCard', () => {name: 'settings.ghosts.page.installAria',});expect(install.getAttribute('aria-busy')).toBe('true');- expect(install.querySelector('.animate-spin')).toBeTruthy();+ expect(install.querySelector('.animate-spinner')).toBeTruthy();expect(install.textContent).toBe('');});});diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/MarketPluginDetailView.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/MarketPluginDetailView.test.tsxindex a08921f45d..7f684a0f8d 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/MarketPluginDetailView.test.tsx+++ b/apps/desktop/src/renderer/features/plugin/__tests__/MarketPluginDetailView.test.tsx@@ -121,7 +121,7 @@ describe('MarketPluginDetailView', () => {name: /settings\.ghosts\.market\.install/,});expect(action.getAttribute('aria-busy')).toBe('true');- expect(action.querySelector('.animate-spin')).toBeTruthy();+ expect(action.querySelector('.animate-spinner')).toBeTruthy();expect(action.textContent).toBe('');});});diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/__tests__/ReviewTabBody.helpers.test.ts b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/__tests__/ReviewTabBody.helpers.test.tsindex e691086392..42f2a0c4a2 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/__tests__/ReviewTabBody.helpers.test.ts+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/__tests__/ReviewTabBody.helpers.test.ts@@ -456,7 +456,7 @@ describe('ReviewTabBody refresh control', () => {);const button = screen.getByRole('button', { name: 'rightSidebar.review.refreshGitData' });- expect(button.querySelector('.animate-spin')).toBeTruthy();+ expect(button.querySelector('.animate-spinner')).toBeTruthy();button.click();expect(onRefresh).toHaveBeenCalledTimes(1);});@@ -830,7 +830,7 @@ describe('ReviewTabBody hover-reveal action affordance', () => {expect(stageButton.querySelector('.sr-only')?.textContent).toBe('rightSidebar.review.actions.stageAll',);- expect(stageButton.querySelector('.animate-spin')).toBeTruthy();+ expect(stageButton.querySelector('.animate-spinner')).toBeTruthy();});});