🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(lobe-agent): align todo tool rendering style (#17787)
Arvin Xu3d4c2631eed8
diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.mdindex ff86e174600..549e2d38a4a 100644--- a/.agents/acceptance/probe-mock-patterns.md+++ b/.agents/acceptance/probe-mock-patterns.md@@ -284,6 +284,48 @@ Measured this way, still-hidden slots produced **0** mutations in 6/6 switches:changes (visible/hidden, active/inactive, mounted/unmounted), capture the classification on both sidesand use the intersection. Otherwise the action's own effect lands in the wrong bucket.+### Agent Mock playback leaves `pluginState` empty — backfill it before capturing pluginState-driven renders++**Situation:** verifying a builtin-tool Render/Inspector (lobe-agent todos, plans —+anything reading `message.pluginState`) with DevDock → Agent Mock case playback as+the deterministic driver (no LLM).++**Doesn't work:** capturing right after playback. The mock pipeline writes each+tool step's `result` into the tool message `content` only and never sets+`pluginState`, so a Render keyed off `pluginState` mounts empty (expanded rows+show nothing) and inspectors fall to their no-data fallback. Reads as "the new+rendering is broken" when the components are fine. Also note: consecutive todo+tool rows are folded into the latest by the conversation UI, so early-state rows+may never mount.++**Works:** after playback completes, backfill in-memory from each message's own+result JSON, at the layer the Render actually reads:++```js+const c = window.__LOBE_STORES.chat();+const msgs = c.dbMessagesMap['main_<agentId>_<topicId>'];+for (const m of msgs.filter((m) => m.role === 'tool' && m.plugin)) {+ const parsed = JSON.parse(m.content);+ if (parsed?.todos)+ c.internal_dispatchMessage({+ type: 'updatePluginState',+ id: m.id,+ key: 'todos',+ value: parsed.todos,+ });+}+```++To render a payload the case doesn't cover (another builtin tool, a specific+state), payload-swap an already-MOUNTED mock row in place — update BOTH the+assistant's `tools[]` entry (`updateMessageTools`, keyed by `tool_call_id`; this+is what selects the Render component) and the tool message (`updateMessagePlugin`++- `replaceMessagePluginState`). Dispatching brand-new messages at the end of the+ list may never mount. Claude Code builtin payloads use `identifier: 'claude-code'`+ (NOT `lobe-claude-code`) and PascalCase `apiName` (`TodoWrite`). All of this is+ in-memory only — a reload clears it; delete the temp topic at teardown.+### `eval` declarations persist in the page global scope**Situation:** running several `agent-browser eval` payloads against one renderer.diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.jsonindex cffae1517dd..19e361da6b4 100644--- a/locales/en-US/plugin.json+++ b/locales/en-US/plugin.json@@ -136,6 +136,10 @@"builtins.lobe-agent.subAgent.stats.tokens": "{{count}} tokens","builtins.lobe-agent.subAgent.stats.tools": "{{count}} tools","builtins.lobe-agent.title": "Lobe Agent",+ "builtins.lobe-agent.todos.allDone": "All tasks completed",+ "builtins.lobe-agent.todos.completedStep": "Completed",+ "builtins.lobe-agent.todos.currentStep": "Current step",+ "builtins.lobe-agent.todos.todos": "Todos","builtins.lobe-claude-code.agent.instruction": "Instruction","builtins.lobe-claude-code.agent.result": "Result","builtins.lobe-claude-code.askUserQuestion.noAnswer": "No answer received — model continued without their input.",@@ -156,6 +160,7 @@"builtins.lobe-claude-code.task.updateSubject.completed": "Task updated","builtins.lobe-claude-code.task.updateSubject.loading": "Updating task","builtins.lobe-claude-code.todoWrite.allDone": "All tasks completed",+ "builtins.lobe-claude-code.todoWrite.completedStep": "Completed","builtins.lobe-claude-code.todoWrite.currentStep": "Current step","builtins.lobe-claude-code.todoWrite.todos": "Todos","builtins.lobe-claude-code.worktree.create.completed": "Worktree created",diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.jsonindex aef04b448b5..b164b3f9898 100644--- a/locales/zh-CN/plugin.json+++ b/locales/zh-CN/plugin.json@@ -136,6 +136,10 @@"builtins.lobe-agent.subAgent.stats.tokens": "{{count}} tokens","builtins.lobe-agent.subAgent.stats.tools": "{{count}} 个工具","builtins.lobe-agent.title": "Lobe Agent",+ "builtins.lobe-agent.todos.allDone": "全部任务已完成",+ "builtins.lobe-agent.todos.completedStep": "已完成",+ "builtins.lobe-agent.todos.currentStep": "当前步骤",+ "builtins.lobe-agent.todos.todos": "待办","builtins.lobe-claude-code.agent.instruction": "指令","builtins.lobe-claude-code.agent.result": "结果","builtins.lobe-claude-code.askUserQuestion.noAnswer": "未收到回答——模型在没有用户输入的情况下继续。",@@ -156,6 +160,7 @@"builtins.lobe-claude-code.task.updateSubject.completed": "已更新任务","builtins.lobe-claude-code.task.updateSubject.loading": "正在更新任务","builtins.lobe-claude-code.todoWrite.allDone": "全部任务已完成",+ "builtins.lobe-claude-code.todoWrite.completedStep": "已完成","builtins.lobe-claude-code.todoWrite.currentStep": "当前步骤","builtins.lobe-claude-code.todoWrite.todos": "待办","builtins.lobe-claude-code.worktree.create.completed": "已创建工作树",diff --git a/packages/builtin-tool-claude-code/src/client/Inspector/TodoWrite.tsx b/packages/builtin-tool-claude-code/src/client/Inspector/TodoWrite.tsxindex a229bbd0402..6eda6218162 100644--- a/packages/builtin-tool-claude-code/src/client/Inspector/TodoWrite.tsx+++ b/packages/builtin-tool-claude-code/src/client/Inspector/TodoWrite.tsx@@ -1,123 +1,23 @@'use client';+import { TodoInspectorSummary } from '@lobechat/shared-tool-ui/components';import { inspectorTextStyles, shinyTextStyles } from '@lobechat/shared-tool-ui/styles';import type { BuiltinInspectorProps } from '@lobechat/types';-import { createStaticStyles, cssVar, cx } from 'antd-style';+import { cx } from 'antd-style';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';-import { type ClaudeCodeTodoItem, type TodoWriteArgs } from '../../types';--const RING_SIZE = 14;-const RING_STROKE = 2;-const RING_RADIUS = (RING_SIZE - RING_STROKE) / 2;-const RING_CIRCUM = 2 * Math.PI * RING_RADIUS;--const styles = createStaticStyles(({ css, cssVar }) => ({- ring: css`- transform: rotate(-90deg);- flex-shrink: 0;- margin-inline-end: 6px;- `,- ringTrack: css`- stroke: ${cssVar.colorFillSecondary};- `,- ringProgress: css`- transition:- stroke-dashoffset 240ms ease,- stroke 240ms ease;- `,- chip: css`- overflow: hidden;- flex-shrink: 1;-- min-width: 0;- margin-inline-start: 4px;- padding-block: 1px;- padding-inline: 8px;- border-radius: 999px;-- color: ${cssVar.colorText};- text-overflow: ellipsis;- white-space: nowrap;-- background: ${cssVar.colorFillSecondary};- `,-}));--interface TodoStats {- completed: number;- inProgress?: ClaudeCodeTodoItem;- total: number;-}--interface ProgressRingProps {- stats: TodoStats;-}--const ProgressRing = memo<ProgressRingProps>(({ stats }) => {- const { completed, total } = stats;- const ratio = total > 0 ? completed / total : 0;- const allDone = total > 0 && completed === total;- const color = allDone ? cssVar.colorSuccess : cssVar.colorInfo;-- return (- <svg className={styles.ring} height={RING_SIZE} width={RING_SIZE}>- <circle- className={styles.ringTrack}- cx={RING_SIZE / 2}- cy={RING_SIZE / 2}- fill="none"- r={RING_RADIUS}- strokeWidth={RING_STROKE}- />- <circle- className={styles.ringProgress}- cx={RING_SIZE / 2}- cy={RING_SIZE / 2}- fill="none"- r={RING_RADIUS}- stroke={color}- strokeDasharray={RING_CIRCUM}- strokeDashoffset={RING_CIRCUM * (1 - ratio)}- strokeLinecap="round"- strokeWidth={RING_STROKE}- />- </svg>- );-});--ProgressRing.displayName = 'ClaudeCodeTodoProgressRing';--const computeStats = (args?: TodoWriteArgs): TodoStats => {- const todos = args?.todos ?? [];- return {- completed: todos.filter((t) => t?.status === 'completed').length,- inProgress: todos.find((t) => t?.status === 'in_progress'),- total: todos.length,- };-};+import { type TodoWriteArgs } from '../../types';+import { computeTodoSummary, TODO_SUMMARY_LABEL_KEYS } from '../todoSummary';export const TodoWriteInspector = memo<BuiltinInspectorProps<TodoWriteArgs>>(({ args, partialArgs, isArgumentsStreaming, isLoading }) => {const { t } = useTranslation('plugin');- const stats = useMemo(() => computeStats(args || partialArgs), [args, partialArgs]);- const allDone = stats.total > 0 && stats.completed === stats.total;+ const summary = useMemo(() => computeTodoSummary(args || partialArgs), [args, partialArgs]);+ const label = t(TODO_SUMMARY_LABEL_KEYS[summary.state]);- const label = stats.inProgress- ? t('builtins.lobe-claude-code.todoWrite.currentStep')- : allDone- ? t('builtins.lobe-claude-code.todoWrite.allDone')- : t('builtins.lobe-claude-code.todoWrite.todos');-- const detail = stats.inProgress- ? stats.inProgress.activeForm || stats.inProgress.content- : stats.total > 0 && !allDone- ? `${stats.completed}/${stats.total}`- : undefined;-- if (isArgumentsStreaming && stats.total === 0) {+ if (isArgumentsStreaming && summary.total === 0) {return <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>{label}</div>;}@@ -128,14 +28,7 @@ export const TodoWriteInspector = memo<BuiltinInspectorProps<TodoWriteArgs>>((isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,)}>- {stats.total > 0 && <ProgressRing stats={stats} />}- <span>{label}</span>- {detail && (- <>- <span>:</span>- <span className={styles.chip}>{detail}</span>- </>- )}+ <TodoInspectorSummary label={label} summary={summary} /></div>);},diff --git a/packages/builtin-tool-claude-code/src/client/Render/TodoWrite/index.tsx b/packages/builtin-tool-claude-code/src/client/Render/TodoWrite/index.tsxindex 0926cc98da6..a6cbdb52005 100644--- a/packages/builtin-tool-claude-code/src/client/Render/TodoWrite/index.tsx+++ b/packages/builtin-tool-claude-code/src/client/Render/TodoWrite/index.tsx@@ -1,58 +1,17 @@'use client';+import { TodoPanelHeader } from '@lobechat/shared-tool-ui/components';import type { BuiltinRenderProps } from '@lobechat/types';import { Block, Checkbox, Icon } from '@lobehub/ui';import { createStaticStyles, cssVar, cx } from 'antd-style';-import { CircleArrowRight, CircleCheckBig, ListTodo } from 'lucide-react';+import { CircleArrowRight } from 'lucide-react';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';import type { ClaudeCodeTodoItem, TodoWriteArgs } from '../../../types';+import { computeTodoSummary, TODO_SUMMARY_LABEL_KEYS } from '../../todoSummary';const styles = createStaticStyles(({ css, cssVar }) => ({- header: css`- display: flex;- gap: 8px;- align-items: center;-- padding-block: 10px;- padding-inline: 12px;- border-block-end: 1px solid ${cssVar.colorBorderSecondary};-- background: ${cssVar.colorFillQuaternary};- `,- headerLabel: css`- overflow: hidden;- display: flex;- flex: 1;- gap: 0;- align-items: center;-- min-width: 0;-- color: ${cssVar.colorTextSecondary};- text-overflow: ellipsis;- white-space: nowrap;- `,- headerDetail: css`- overflow: hidden;- min-width: 0;- color: ${cssVar.colorText};- text-overflow: ellipsis;- `,- headerCount: css`- flex-shrink: 0;-- padding-block: 2px;- padding-inline: 8px;- border-radius: 999px;-- font-family: ${cssVar.fontFamilyCode};- font-size: 12px;- color: ${cssVar.colorTextSecondary};-- background: ${cssVar.colorFillTertiary};- `,itemRow: css`width: 100%;padding-block: 10px;@@ -119,68 +78,17 @@ const TodoRow = memo<TodoRowProps>(({ item }) => {TodoRow.displayName = 'ClaudeCodeTodoRow';-interface TodoHeaderProps {- completed: number;- inProgress?: ClaudeCodeTodoItem;- total: number;-}--const TodoHeader = memo<TodoHeaderProps>(({ completed, total, inProgress }) => {- const { t } = useTranslation('plugin');- const allDone = total > 0 && completed === total;-- const icon = inProgress ? CircleArrowRight : allDone ? CircleCheckBig : ListTodo;- const color = inProgress- ? cssVar.colorInfo- : allDone- ? cssVar.colorSuccess- : cssVar.colorTextSecondary;-- const label = inProgress- ? t('builtins.lobe-claude-code.todoWrite.currentStep')- : allDone- ? t('builtins.lobe-claude-code.todoWrite.allDone')- : t('builtins.lobe-claude-code.todoWrite.todos');- const detail = inProgress ? inProgress.activeForm || inProgress.content : undefined;-- return (- <div className={styles.header}>- <Icon icon={icon} size={16} style={{ color, flexShrink: 0 }} />- <div className={styles.headerLabel}>- <span>{label}</span>- {detail && (- <>- <span>: </span>- <span className={styles.headerDetail}>{detail}</span>- </>- )}- </div>- <span className={styles.headerCount}>- {completed}/{total}- </span>- </div>- );-});--TodoHeader.displayName = 'ClaudeCodeTodoHeader';-const TodoWrite = memo<BuiltinRenderProps<TodoWriteArgs>>(({ args }) => {+ const { t } = useTranslation('plugin');const todos = args?.todos;- const stats = useMemo(() => {- const items = todos ?? [];- return {- completed: items.filter((t) => t?.status === 'completed').length,- inProgress: items.find((t) => t?.status === 'in_progress'),- total: items.length,- };- }, [todos]);+ const summary = useMemo(() => computeTodoSummary(args), [args]);if (!todos || todos.length === 0) return null;return (<Block variant={'outlined'} width="100%">- <TodoHeader completed={stats.completed} inProgress={stats.inProgress} total={stats.total} />+ <TodoPanelHeader label={t(TODO_SUMMARY_LABEL_KEYS[summary.state])} summary={summary} />{todos.map((item, index) => (<TodoRow item={item} key={index} />))}diff --git a/packages/builtin-tool-claude-code/src/client/todoSummary.test.ts b/packages/builtin-tool-claude-code/src/client/todoSummary.test.tsnew file mode 100644index 00000000000..8f4581ca291--- /dev/null+++ b/packages/builtin-tool-claude-code/src/client/todoSummary.test.ts@@ -0,0 +1,66 @@+import { describe, expect, it } from 'vitest';++import type { ClaudeCodeTodoItem } from '../types';+import { computeTodoSummary } from './todoSummary';++const item = (+ status: ClaudeCodeTodoItem['status'],+ content: string,+ activeForm = `${content} (active)`,+): ClaudeCodeTodoItem => ({ activeForm, content, status });++describe('computeTodoSummary', () => {+ it('returns idle when args are missing or the list is empty', () => {+ expect(computeTodoSummary()).toEqual({ completed: 0, state: 'idle', total: 0 });+ expect(computeTodoSummary({ todos: [] })).toEqual({ completed: 0, state: 'idle', total: 0 });+ });++ it('returns idle when nothing is completed or in progress', () => {+ expect(computeTodoSummary({ todos: [item('pending', 'a'), item('pending', 'b')] })).toEqual({+ completed: 0,+ state: 'idle',+ total: 2,+ });+ });++ it('prefers the in-progress item, using its activeForm as detail', () => {+ expect(+ computeTodoSummary({+ todos: [item('completed', 'a'), item('in_progress', 'b'), item('pending', 'c')],+ }),+ ).toEqual({ completed: 1, detail: 'b (active)', state: 'inProgress', total: 3 });+ });++ it('falls back to content when the in-progress item has no activeForm', () => {+ expect(+ computeTodoSummary({ todos: [{ activeForm: '', content: 'b', status: 'in_progress' }] }),+ ).toEqual({ completed: 0, detail: 'b', state: 'inProgress', total: 1 });+ });++ // Regression: completed items + pending work with nothing in progress used to+ // fall through to the plain "Todos" (idle) label instead of surfacing the+ // most recently completed step.+ it('shows the last completed item when work remains and nothing is in progress', () => {+ expect(+ computeTodoSummary({+ todos: [item('completed', 'a'), item('completed', 'b'), item('pending', 'c')],+ }),+ ).toEqual({ completed: 2, detail: 'b', state: 'completedStep', total: 3 });+ });++ it('returns allDone when every item is completed', () => {+ expect(computeTodoSummary({ todos: [item('completed', 'a'), item('completed', 'b')] })).toEqual(+ { completed: 2, state: 'allDone', total: 2 },+ );+ });++ it('ignores null-ish entries from partially streamed args', () => {+ const todos = [item('completed', 'a'), null, item('pending', 'b')] as ClaudeCodeTodoItem[];+ expect(computeTodoSummary({ todos })).toEqual({+ completed: 1,+ detail: 'a',+ state: 'completedStep',+ total: 2,+ });+ });+});diff --git a/packages/builtin-tool-claude-code/src/client/todoSummary.ts b/packages/builtin-tool-claude-code/src/client/todoSummary.tsnew file mode 100644index 00000000000..0d45639b28a--- /dev/null+++ b/packages/builtin-tool-claude-code/src/client/todoSummary.ts@@ -0,0 +1,35 @@+import type { TodoSummary } from '@lobechat/shared-tool-ui/components';++import type { ClaudeCodeTodoItem, TodoWriteArgs } from '../types';++/**+ * Compute the summary shown in the TodoWrite inspector / panel header.+ */+export const computeTodoSummary = (args?: TodoWriteArgs): TodoSummary => {+ const items = (args?.todos ?? []).filter(Boolean) as ClaudeCodeTodoItem[];+ const total = items.length;+ const completed = items.filter((item) => item.status === 'completed').length;+ const inProgress = items.find((item) => item.status === 'in_progress');++ if (inProgress)+ return {+ completed,+ detail: inProgress.activeForm || inProgress.content,+ state: 'inProgress',+ total,+ };+ if (total > 0 && completed === total) return { completed, state: 'allDone', total };++ const lastCompleted = [...items].reverse().find((item) => item.status === 'completed');+ if (lastCompleted)+ return { completed, detail: lastCompleted.content, state: 'completedStep', total };++ return { completed, state: 'idle', total };+};++export const TODO_SUMMARY_LABEL_KEYS = {+ allDone: 'builtins.lobe-claude-code.todoWrite.allDone',+ completedStep: 'builtins.lobe-claude-code.todoWrite.completedStep',+ idle: 'builtins.lobe-claude-code.todoWrite.todos',+ inProgress: 'builtins.lobe-claude-code.todoWrite.currentStep',+} as const;diff --git a/packages/builtin-tool-lobe-agent/package.json b/packages/builtin-tool-lobe-agent/package.jsonindex cbfcc10ade2..4e072fd4e0d 100644--- a/packages/builtin-tool-lobe-agent/package.json+++ b/packages/builtin-tool-lobe-agent/package.json@@ -18,6 +18,7 @@"@lobechat/builtin-tool-user-interaction": "workspace:*","@lobechat/const": "workspace:*","@lobechat/prompts": "workspace:*",+ "@lobechat/shared-tool-ui": "workspace:*","@lobechat/utils": "workspace:*"},"devDependencies": {diff --git a/packages/builtin-tool-lobe-agent/src/client/Inspector/CreateTodos/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/CreateTodos/index.tsxindex 8dbcfea93cc..dbd1b019275 100644--- a/packages/builtin-tool-lobe-agent/src/client/Inspector/CreateTodos/index.tsx+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/CreateTodos/index.tsx@@ -1,49 +1,53 @@'use client';+import { TodoInspectorSummary } from '@lobechat/shared-tool-ui/components';import type { BuiltinInspectorProps } from '@lobechat/types';-import { Icon, Text } from '@lobehub/ui';-import { createStaticStyles, cssVar, cx } from 'antd-style';-import { Plus } from 'lucide-react';-import { memo } from 'react';+import { cx } from 'antd-style';+import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';-import { oneLineEllipsis, shinyTextStyles } from '@/styles';+import { inspectorTextStyles, shinyTextStyles } from '@/styles';import type { CreateTodosParams, CreateTodosState } from '../../../types';--const styles = createStaticStyles(({ css, cssVar }) => ({- title: css`- margin-inline-end: 8px;- color: ${cssVar.colorText};- `,-}));+import {+ computeTodoSummary,+ normalizeTodoItems,+ TODO_SUMMARY_LABEL_KEYS,+} from '../../components/todoSummary';export const CreateTodosInspector = memo<BuiltinInspectorProps<CreateTodosParams, CreateTodosState>->(({ args, partialArgs, isArgumentsStreaming }) => {+>(({ args, partialArgs, pluginState, isArgumentsStreaming, isLoading }) => {const { t } = useTranslation('plugin');- const adds = args?.adds || partialArgs?.adds || [];- const items = args?.items || [];- const count = adds.length || items.length;+ const summary = useMemo(() => {+ // Prefer the executed result state, then saved items, then streaming adds+ const stateItems = normalizeTodoItems(pluginState?.todos);+ if (stateItems.length > 0) return computeTodoSummary(stateItems);++ const items = args?.items || [];+ if (items.length > 0) return computeTodoSummary(items);++ const adds = args?.adds || partialArgs?.adds || [];+ return computeTodoSummary(adds.map((text) => ({ status: 'todo' as const, text })));+ }, [args, partialArgs, pluginState]);- if (isArgumentsStreaming && count === 0) {+ if (isArgumentsStreaming && summary.total === 0) {return (- <div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}><span>{t('builtins.lobe-agent.apiName.createTodos')}</span></div>);}return (- <div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>- <span className={styles.title}>{t('builtins.lobe-agent.apiName.createTodos')}</span>- {count > 0 && (- <Text code as={'span'} color={cssVar.colorSuccess} fontSize={12}>- <Icon icon={Plus} size={12} />- {count}- </Text>+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,)}+ >+ <TodoInspectorSummary label={t(TODO_SUMMARY_LABEL_KEYS[summary.state])} summary={summary} /></div>);});diff --git a/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdateTodos/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdateTodos/index.tsxindex b1914662167..dca90197d78 100644--- a/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdateTodos/index.tsx+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdateTodos/index.tsx@@ -1,119 +1,45 @@'use client';+import { TodoInspectorSummary } from '@lobechat/shared-tool-ui/components';import type { BuiltinInspectorProps } from '@lobechat/types';-import { Icon, Text } from '@lobehub/ui';-import { createStaticStyles, cssVar, cx } from 'antd-style';-import { CheckCircle, DiffIcon, Minus, Plus } from 'lucide-react';-import type { ReactNode } from 'react';+import { cx } from 'antd-style';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';-import { oneLineEllipsis, shinyTextStyles } from '@/styles';+import { inspectorTextStyles, shinyTextStyles } from '@/styles';import type { UpdateTodosParams, UpdateTodosState } from '../../../types';--const styles = createStaticStyles(({ css, cssVar }) => ({- separator: css`- margin-inline: 2px;- color: ${cssVar.colorTextQuaternary};- `,- title: css`- margin-inline-end: 8px;- color: ${cssVar.colorText};- `,-}));+import {+ computeTodoSummary,+ normalizeTodoItems,+ TODO_SUMMARY_LABEL_KEYS,+} from '../../components/todoSummary';export const UpdateTodosInspector = memo<BuiltinInspectorProps<UpdateTodosParams, UpdateTodosState>->(({ args, partialArgs, isArgumentsStreaming }) => {+>(({ isArgumentsStreaming, isLoading, pluginState }) => {const { t } = useTranslation('plugin');- const counts = useMemo(() => {- const operations = args?.operations || partialArgs?.operations || [];- return operations.reduce(- (acc, op) => {- switch (op.type) {- case 'add': {- acc.add++;- break;- }- case 'update': {- acc.update++;- break;- }- case 'remove': {- acc.remove++;- break;- }- case 'complete': {- acc.complete++;- break;- }- }- return acc;- },- { add: 0, complete: 0, remove: 0, update: 0 },- );- }, [args?.operations, partialArgs?.operations]);+ // The full todo list only exists after execution (pluginState.todos);+ // while arguments stream in we just show the tool name.+ const summary = useMemo(+ () => computeTodoSummary(normalizeTodoItems(pluginState?.todos)),+ [pluginState?.todos],+ );- const hasOperations =- counts.add > 0 || counts.update > 0 || counts.remove > 0 || counts.complete > 0;+ const shiny = (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText;- if (isArgumentsStreaming && !hasOperations) {+ if (summary.total === 0) {return (- <div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>+ <div className={cx(inspectorTextStyles.root, shiny)}><span>{t('builtins.lobe-agent.apiName.updateTodos')}</span></div>);}- const statsParts: ReactNode[] = [];- if (counts.add > 0) {- statsParts.push(- <Text code as={'span'} color={cssVar.colorSuccess} fontSize={12} key="add">- <Icon icon={Plus} size={12} />- {counts.add}- </Text>,- );- }- if (counts.update > 0) {- statsParts.push(- <Text code as={'span'} color={cssVar.colorWarning} fontSize={12} key="update">- <Icon icon={DiffIcon} size={12} />- {counts.update}- </Text>,- );- }- if (counts.complete > 0) {- statsParts.push(- <Text code as={'span'} color={cssVar.colorPrimary} fontSize={12} key="complete">- <Icon icon={CheckCircle} size={12} />- {counts.complete}- </Text>,- );- }- if (counts.remove > 0) {- statsParts.push(- <Text code as={'span'} color={cssVar.colorError} fontSize={12} key="remove">- <Icon icon={Minus} size={12} />- {counts.remove}- </Text>,- );- }-return (- <div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>- <span className={styles.title}>{t('builtins.lobe-agent.apiName.updateTodos')}</span>- {statsParts.length > 0 && (- <>- {statsParts.map((part, index) => (- <span key={index}>- {index > 0 && <span className={styles.separator}> / </span>}- {part}- </span>- ))}- </>- )}+ <div className={cx(inspectorTextStyles.root, shiny)}>+ <TodoInspectorSummary label={t(TODO_SUMMARY_LABEL_KEYS[summary.state])} summary={summary} /></div>);});diff --git a/packages/builtin-tool-lobe-agent/src/client/Render/TodoList/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Render/TodoList/index.tsxindex e01fa742293..2d15249fa95 100644--- a/packages/builtin-tool-lobe-agent/src/client/Render/TodoList/index.tsx+++ b/packages/builtin-tool-lobe-agent/src/client/Render/TodoList/index.tsx@@ -1,12 +1,19 @@'use client';+import { TodoPanelHeader } from '@lobechat/shared-tool-ui/components';import type { BuiltinRenderProps } from '@lobechat/types';import { Block, Checkbox, Icon } from '@lobehub/ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import { CircleArrowRight } from 'lucide-react';-import { memo } from 'react';+import { memo, useMemo } from 'react';+import { useTranslation } from 'react-i18next';import type { TodoItem, TodoList as TodoListType, TodoStatus } from '../../../types';+import {+ computeTodoSummary,+ normalizeTodoItems,+ TODO_SUMMARY_LABEL_KEYS,+} from '../../components/todoSummary';export interface TodoListRenderState {todos?: TodoListType;@@ -57,7 +64,7 @@ const ReadOnlyTodoItem = memo<ReadOnlyTodoItemProps>(({ text, status }) => {if (isProcessing) {return (<div className={cx(styles.itemRow, styles.processingRow)}>- <Icon icon={CircleArrowRight} size={17} style={{ color: cssVar.colorTextSecondary }} />+ <Icon icon={CircleArrowRight} size={17} style={{ color: cssVar.colorInfo }} /><span className={styles.textProcessing}>{text}</span></div>);@@ -90,10 +97,13 @@ interface TodoListUIProps {}/**- * Read-only TodoList UI component- * Displays todo items in a style matching the editable SortableTodoList+ * Read-only TodoList UI component, matching the Claude Code todo rendering:+ * a status header (current step + progress badge) above the item rows.*/const TodoListUI = memo<TodoListUIProps>(({ items }) => {+ const { t } = useTranslation('plugin');+ const summary = useMemo(() => computeTodoSummary(items), [items]);+if (items.length === 0) {return null;}@@ -101,6 +111,7 @@ const TodoListUI = memo<TodoListUIProps>(({ items }) => {return (// Outer container with background - matches AddTodoIntervention<Block variant={'outlined'} width="100%">+ <TodoPanelHeader label={t(TODO_SUMMARY_LABEL_KEYS[summary.state])} summary={summary} />{items.map((item, index) => (<ReadOnlyTodoItem key={index} status={item.status} text={item.text} />))}@@ -115,8 +126,7 @@ TodoListUI.displayName = 'TodoListUI';* Read-only display of todo items matching the style of AddTodoIntervention*/const TodoListRender = memo<BuiltinRenderProps<unknown, TodoListRenderState>>(({ pluginState }) => {- const todos = pluginState?.todos;- const items: TodoItem[] = todos?.items || [];+ const items = normalizeTodoItems(pluginState?.todos);return <TodoListUI items={items} />;});diff --git a/packages/builtin-tool-lobe-agent/src/client/components/todoSummary.test.ts b/packages/builtin-tool-lobe-agent/src/client/components/todoSummary.test.tsnew file mode 100644index 00000000000..42701b3a9fc--- /dev/null+++ b/packages/builtin-tool-lobe-agent/src/client/components/todoSummary.test.ts@@ -0,0 +1,56 @@+import { describe, expect, it } from 'vitest';++import type { TodoItem } from '../../types';+import { computeTodoSummary, normalizeTodoItems } from './todoSummary';++const item = (status: TodoItem['status'], text: string): TodoItem => ({ status, text });++describe('normalizeTodoItems', () => {+ it('returns empty array when todos is undefined', () => {+ expect(normalizeTodoItems()).toEqual([]);+ });++ it('handles the new format ({ items })', () => {+ const items = [item('todo', 'a')];+ expect(normalizeTodoItems({ items, updatedAt: '2026-01-01' })).toEqual(items);+ });++ it('handles the legacy bare-array format', () => {+ const items = [item('todo', 'a')];+ expect(normalizeTodoItems(items)).toEqual(items);+ });+});++describe('computeTodoSummary', () => {+ it('returns idle for an empty list', () => {+ expect(computeTodoSummary([])).toEqual({ completed: 0, state: 'idle', total: 0 });+ });++ it('returns idle when nothing is completed or processing', () => {+ expect(computeTodoSummary([item('todo', 'a'), item('todo', 'b')])).toEqual({+ completed: 0,+ state: 'idle',+ total: 2,+ });+ });++ it('prefers the processing item as current step', () => {+ expect(+ computeTodoSummary([item('completed', 'a'), item('processing', 'b'), item('todo', 'c')]),+ ).toEqual({ completed: 1, detail: 'b', state: 'inProgress', total: 3 });+ });++ it('shows the last completed item when nothing is processing', () => {+ expect(+ computeTodoSummary([item('completed', 'a'), item('completed', 'b'), item('todo', 'c')]),+ ).toEqual({ completed: 2, detail: 'b', state: 'completedStep', total: 3 });+ });++ it('returns allDone when every item is completed', () => {+ expect(computeTodoSummary([item('completed', 'a'), item('completed', 'b')])).toEqual({+ completed: 2,+ state: 'allDone',+ total: 2,+ });+ });+});diff --git a/packages/builtin-tool-lobe-agent/src/client/components/todoSummary.ts b/packages/builtin-tool-lobe-agent/src/client/components/todoSummary.tsnew file mode 100644index 00000000000..565e5f7a43e--- /dev/null+++ b/packages/builtin-tool-lobe-agent/src/client/components/todoSummary.ts@@ -0,0 +1,40 @@+import type { TodoSummary } from '@lobechat/shared-tool-ui/components';++import type { TodoItem, TodoList } from '../../types';++/**+ * Normalize pluginState todos into a TodoItem array.+ * Handles both the new format ({ items: TodoItem[] }) and the+ * legacy format where todos was stored as a bare TodoItem[].+ */+export const normalizeTodoItems = (todos?: TodoList | TodoItem[]): TodoItem[] => {+ if (!todos) return [];+ if (Array.isArray(todos)) return todos;+ return todos.items || [];+};++/**+ * Compute the summary shown in the todo inspector / panel header,+ * matching the Claude Code todo rendering states.+ */+export const computeTodoSummary = (items: TodoItem[]): TodoSummary => {+ const total = items.length;+ const completed = items.filter((item) => item.status === 'completed').length;+ const processing = items.find((item) => item.status === 'processing');++ if (processing) return { completed, detail: processing.text, state: 'inProgress', total };+ if (total > 0 && completed === total) return { completed, state: 'allDone', total };++ const lastCompleted = [...items].reverse().find((item) => item.status === 'completed');+ if (lastCompleted)+ return { completed, detail: lastCompleted.text, state: 'completedStep', total };++ return { completed, state: 'idle', total };+};++export const TODO_SUMMARY_LABEL_KEYS = {+ allDone: 'builtins.lobe-agent.todos.allDone',+ completedStep: 'builtins.lobe-agent.todos.completedStep',+ idle: 'builtins.lobe-agent.todos.todos',+ inProgress: 'builtins.lobe-agent.todos.currentStep',+} as const;diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.tsindex 06aaed926c1..7c4a46d181a 100644--- a/packages/locales/src/default/plugin.ts+++ b/packages/locales/src/default/plugin.ts@@ -80,6 +80,7 @@ export default {'builtins.lobe-claude-code.task.updateSubject.completed': 'Task updated','builtins.lobe-claude-code.task.updateSubject.loading': 'Updating task','builtins.lobe-claude-code.todoWrite.allDone': 'All tasks completed',+ 'builtins.lobe-claude-code.todoWrite.completedStep': 'Completed','builtins.lobe-claude-code.todoWrite.currentStep': 'Current step','builtins.lobe-claude-code.todoWrite.todos': 'Todos','builtins.lobe-claude-code.worktree.create.completed': 'Worktree created',@@ -249,6 +250,10 @@ export default {'builtins.lobe-agent.apiName.updatePlan.completed': 'Completed','builtins.lobe-agent.apiName.updatePlan.modified': 'Modified','builtins.lobe-agent.apiName.updateTodos': 'Update todos',+ 'builtins.lobe-agent.todos.allDone': 'All tasks completed',+ 'builtins.lobe-agent.todos.completedStep': 'Completed',+ 'builtins.lobe-agent.todos.currentStep': 'Current step',+ 'builtins.lobe-agent.todos.todos': 'Todos','builtins.lobe-delivery-checker.apiName.generateVerifyPlan': 'Create automated checks','builtins.lobe-delivery-checker.verifyPlan.optional': 'Optional','builtins.lobe-delivery-checker.verifyPlan.portal.fields.description': 'Summary',diff --git a/packages/shared-tool-ui/src/components/TodoProgress/index.tsx b/packages/shared-tool-ui/src/components/TodoProgress/index.tsxnew file mode 100644index 00000000000..b4b6d835f3b--- /dev/null+++ b/packages/shared-tool-ui/src/components/TodoProgress/index.tsx@@ -0,0 +1,236 @@+'use client';++import { Icon } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { CircleArrowRight, CircleCheckBig, ListTodo } from 'lucide-react';+import { memo } from 'react';++/**+ * Visual state of a todo summary:+ * - inProgress: a step is currently running+ * - completedStep: no running step, show the most recently completed one+ * - allDone: every step is completed+ * - idle: nothing completed or running yet+ */+export type TodoSummaryState = 'allDone' | 'completedStep' | 'idle' | 'inProgress';++export interface TodoSummary {+ completed: number;+ /** Step text shown after the label (current step or last completed step) */+ detail?: string;+ state: TodoSummaryState;+ total: number;+}++const RING_SIZE = 14;+const RING_STROKE = 2;+const RING_RADIUS = (RING_SIZE - RING_STROKE) / 2;+const RING_CIRCUM = 2 * Math.PI * RING_RADIUS;++const styles = createStaticStyles(({ css, cssVar }) => ({+ countChip: css`+ flex-shrink: 0;++ margin-inline-end: 8px;+ padding-block: 1px;+ padding-inline: 8px;+ border-radius: 999px;++ font-family: ${cssVar.fontFamilyCode};+ font-size: 12px;+ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillTertiary};+ `,+ header: css`+ display: flex;+ gap: 8px;+ align-items: center;++ padding-block: 10px;+ padding-inline: 12px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};++ background: ${cssVar.colorFillQuaternary};+ `,+ headerCount: css`+ flex-shrink: 0;++ padding-block: 2px;+ padding-inline: 8px;+ border-radius: 999px;++ font-family: ${cssVar.fontFamilyCode};+ font-size: 12px;+ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillTertiary};+ `,+ headerDetail: css`+ overflow: hidden;+ min-width: 0;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ `,+ headerLabel: css`+ overflow: hidden;+ display: flex;+ flex: 1;+ gap: 0;+ align-items: center;++ min-width: 0;++ color: ${cssVar.colorTextSecondary};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ ring: css`+ transform: rotate(-90deg);+ flex-shrink: 0;+ margin-inline-end: 6px;+ `,+ ringProgress: css`+ transition:+ stroke-dashoffset 240ms ease,+ stroke 240ms ease;+ `,+ ringTrack: css`+ stroke: ${cssVar.colorFillSecondary};+ `,+ summaryDetail: css`+ color: ${cssVar.colorText};+ `,+ summaryText: css`+ overflow: hidden;+ min-width: 0;+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+}));++const STATE_ICONS = {+ allDone: CircleCheckBig,+ completedStep: CircleCheckBig,+ idle: ListTodo,+ inProgress: CircleArrowRight,+} as const;++const stateColor = (state: TodoSummaryState) => {+ switch (state) {+ case 'inProgress': {+ return cssVar.colorInfo;+ }+ case 'idle': {+ return cssVar.colorTextSecondary;+ }+ default: {+ return cssVar.colorSuccess;+ }+ }+};++interface TodoProgressRingProps {+ completed: number;+ total: number;+}++export const TodoProgressRing = memo<TodoProgressRingProps>(({ completed, total }) => {+ const ratio = total > 0 ? completed / total : 0;+ const allDone = total > 0 && completed === total;+ const color = allDone ? cssVar.colorSuccess : cssVar.colorInfo;++ return (+ <svg className={styles.ring} height={RING_SIZE} width={RING_SIZE}>+ <circle+ className={styles.ringTrack}+ cx={RING_SIZE / 2}+ cy={RING_SIZE / 2}+ fill="none"+ r={RING_RADIUS}+ strokeWidth={RING_STROKE}+ />+ <circle+ className={styles.ringProgress}+ cx={RING_SIZE / 2}+ cy={RING_SIZE / 2}+ fill="none"+ r={RING_RADIUS}+ stroke={color}+ strokeDasharray={RING_CIRCUM}+ strokeDashoffset={RING_CIRCUM * (1 - ratio)}+ strokeLinecap="round"+ strokeWidth={RING_STROKE}+ />+ </svg>+ );+});++TodoProgressRing.displayName = 'TodoProgressRing';++interface TodoSummaryContentProps {+ label: string;+ summary: TodoSummary;+}++/**+ * Inline inspector summary: progress ring + count chip + "label: detail".+ * Render it inside an `inspectorTextStyles.root` flex container.+ */+export const TodoInspectorSummary = memo<TodoSummaryContentProps>(({ label, summary }) => {+ const { completed, detail, state, total } = summary;++ return (+ <>+ {total > 0 && <TodoProgressRing completed={completed} total={total} />}+ {total > 0 && state !== 'allDone' && (+ <span className={styles.countChip}>+ {completed}/{total}+ </span>+ )}+ <span className={styles.summaryText}>+ {label}+ {detail && (+ <>+ {': '}+ <span className={styles.summaryDetail}>{detail}</span>+ </>+ )}+ </span>+ </>+ );+});++TodoInspectorSummary.displayName = 'TodoInspectorSummary';++/**+ * Header row for the expanded todo list panel:+ * state icon + "label: detail" + count badge on the right.+ */+export const TodoPanelHeader = memo<TodoSummaryContentProps>(({ label, summary }) => {+ const { completed, detail, state, total } = summary;++ return (+ <div className={styles.header}>+ <Icon+ icon={STATE_ICONS[state]}+ size={16}+ style={{ color: stateColor(state), flexShrink: 0 }}+ />+ <div className={styles.headerLabel}>+ <span>{label}</span>+ {detail && (+ <>+ <span>{': '}</span>+ <span className={styles.headerDetail}>{detail}</span>+ </>+ )}+ </div>+ <span className={styles.headerCount}>+ {completed}/{total}+ </span>+ </div>+ );+});++TodoPanelHeader.displayName = 'TodoPanelHeader';diff --git a/packages/shared-tool-ui/src/components/index.ts b/packages/shared-tool-ui/src/components/index.tsindex 11fc7a9618c..5c2c85ad4fe 100644--- a/packages/shared-tool-ui/src/components/index.ts+++ b/packages/shared-tool-ui/src/components/index.ts@@ -8,3 +8,10 @@ export {} from './FileChangeStats';export { FilePathDisplay, getFilePathDisplayInfo } from './FilePathDisplay';export { OptionCard, type OptionCardProps } from './OptionCard';+export {+ TodoInspectorSummary,+ TodoPanelHeader,+ TodoProgressRing,+ type TodoSummary,+ type TodoSummaryState,+} from './TodoProgress';diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsxindex 7344de61478..d92377ad5b0 100644--- a/src/features/Verify/Acceptance/CheckList.tsx+++ b/src/features/Verify/Acceptance/CheckList.tsx@@ -271,6 +271,13 @@ const styles = createStaticStyles(({ css }) => ({`,row: css`border-block-start: 1px solid ${cssVar.colorBorderSecondary};++ /* The card already draws the outer border — a first row's separator would+ stack on it and read as a 2px top edge. Grouped lists are unaffected:+ their first child is the group header, so rows are never first. */+ &:first-child {+ border-block-start: none;+ }`,/** Stable check label ("C3") — referenced by feedback and annotations. */seqChip: css`