Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 呼吸只在会话真的在跑时挂载,空闲计划静止

Kafeifeiaecbf1fe8ffd
diff --git a/apps/desktop/src/renderer/components/chat/TodoListCard.tsx b/apps/desktop/src/renderer/components/chat/TodoListCard.tsx
index 246ef7a980..4024740206 100644
--- a/apps/desktop/src/renderer/components/chat/TodoListCard.tsx
+++ b/apps/desktop/src/renderer/components/chat/TodoListCard.tsx
@@ -100,12 +100,14 @@ function ProgressRing({
export function TodoListCard({
todos,
+ animated = false,
maxWidth,
}: {
todos: TodoItem[];
/**
- * Kept for source compatibility with older callers. Plan progress is intentionally
- * static now, so this flag no longer enables an infinite animation.
+ * 会话是否真的在跑(调用方传 isStreaming)。只有它为真时,in_progress 行才挂
+ * 呼吸动画——计划因停止/失败/中断留在屏幕上时会话已空闲,继续呼吸等于谎报
+ * "这步还在执行"。胶囊上的进度环与其它形态始终静态,不受此参数影响。
*/
animated?: boolean;
/** Composer/chat column width. Keeps the flyout inside clipped compact panes. */
@@ -264,9 +266,15 @@ export function TodoListCard({
{todo.status === 'in_progress' && (
// 呼吸表达"正在干活":挂侧栏运行态同款动画。按 SVG 常驻
// 动画红线,动画在 span wrapper 上,SVG 本体保持静态。
+ // 会话空闲(停止/失败/中断后计划仍留屏)时静止:动画只在
+ // 确有 running 语义时挂载,否则等于谎报该步骤仍在执行。
<span
data-plan-step-active="true"
- className="session-status-breathing inline-flex shrink-0"
+ data-plan-step-breathing={animated ? 'true' : 'false'}
+ className={cn(
+ 'inline-flex shrink-0',
+ animated && 'session-status-breathing',
+ )}
>
<CircleDot
size={18}
diff --git a/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsx
index 660fb6bfc2..f40da073b9 100644
--- a/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsx
+++ b/apps/desktop/src/renderer/components/chat/__tests__/TodoListCard.test.tsx
@@ -50,6 +50,20 @@ describe('TodoListCard flyout interaction', () => {
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' });
+ fireEvent.mouseEnter(trigger.parentElement as HTMLElement);
+
+ 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?.querySelector('svg')).not.toBeNull();
+ });
+
it('breathes the active row on an HTML wrapper when the flyout is open', () => {
const { container } = render(<TodoListCard todos={TODOS} animated />);
diff --git a/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx b/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx
index 7eb98d1c22..8d196b7530 100644
--- a/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx
@@ -40,7 +40,10 @@ export function PinnedPlanPanel({
}: {
sessionId: string | null;
messages: readonly ChatMessage[];
- /** 保留旧调用方的兼容参数;计划胶囊现在始终使用静态灰度进度环。 */
+ /**
+ * 会话是否真的在跑(调用方传 isStreaming)。胶囊上的进度环始终静态;该值只
+ * 透传给浮层里 in_progress 行的呼吸动画——空闲时静止,不谎报步骤仍在执行。
+ */
animated: boolean;
/** 与 composer 同宽(inputWidth),胶囊在该宽度内居中,浮层不超出。 */
width: number;