Skip to content

🤯 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.

✨ feat(task): show run last message on the run card (#16724)

Arvin Xu33b7c5d644d7
diff --git a/DESIGN.md b/DESIGN.md
index 2c33ee8841a..f367ccb61ce 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -165,6 +165,33 @@ Default control height is 36px (`controlHeight`); use `controlHeightSM` 28px and
Style components with lobe-ui's styling layer: prefer `createStaticStyles` with `cssVar.*` (zero-runtime) and fall back to `createStyles` + `token` only when styles need runtime computation.
+## Status Icons
+
+Topic and task surfaces speak **one status-icon language**. There is a single source of truth — `STATUS_META` in `src/components/StatusIcon` — and every surface (sidebar group headers, list rows, kanban, tags, detail) maps its own status enum onto a canonical `StatusKind` and reads icon + color from there. Never redefine a local status→icon map.
+
+The vocabulary is built on the lucide `Circle-*` family so all states read as one set:
+
+| Kind | Icon | Color token | Meaning |
+| ---------------- | -------------- | ---------------------- | --------------------------------------------------------------------------------- |
+| `running` | `CircleDot` | `colorWarning` | actively executing (static glyph) |
+| `scheduled` | `Clock` | `colorWarning` | queued for a future run |
+| `needsAttention` | `Hand` | `colorInfo` | a human is needed (topic `pending`/`waitingForHuman`, task `paused`/`needsInput`) |
+| `paused` | `PauseCircle` | `colorTextDescription` | genuinely suspended |
+| `completed` | `CircleCheck` | `colorSuccess` | finished successfully |
+| `failed` | `CircleX` | `colorError` | errored |
+| `backlog` | `CircleDashed` | `colorTextQuaternary` | not started / idle |
+| `active` | `CircleDot` | `colorTextTertiary` | open topic, not running |
+| `canceled` | `CircleSlash` | `colorTextSecondary` | canceled |
+| `archived` | `Archive` | `colorTextDescription` | archived |
+| `timeout` | `CircleAlert` | `colorWarning` | timed out |
+
+Two rules the map encodes:
+
+- **`running` is two-tier.** Group headers / summaries / count-badges show the **static** `CircleDot`. A row that is executing **right now** shows the **animated** `RingLoadingIcon` (the same CircleDot, spinning) — the one canonical live spinner; don't hand-roll another.
+- **`Hand` means "needs you", never "paused".** `needsAttention` (blue hand) and `paused` (grey pause) are distinct concepts and must not be merged, even though task-land historically labeled the attention state `paused`.
+
+> Migration note: a few topic surfaces still render legacy grey `CheckCircle2` (`completed`) / `TriangleAlert` (`failed`) locally instead of the canonical green-check / red-cross. Converging those two is a deferred follow-up — new code should use `STATUS_META`.
+
## Voice & Content
Copy is part of the design — precise, calm, and free of filler. The voice is youthful, friendly, and modern on the surface; professional, reliable, and control-first underneath (reference points: Notion, Figma, Apple, Discord, OpenAI).
diff --git a/apps/server/src/services/task/index.test.ts b/apps/server/src/services/task/index.test.ts
index 3a8cbbba82f..7260f274b03 100644
--- a/apps/server/src/services/task/index.test.ts
+++ b/apps/server/src/services/task/index.test.ts
@@ -630,6 +630,61 @@ describe('TaskService', () => {
expect(result?.activities?.[1].type).toBe('topic');
});
+ it('exposes the run last message (handoff.content) alongside the summary (LOBE-11396)', async () => {
+ const task = {
+ assigneeAgentId: null,
+ assigneeUserId: null,
+ createdAt: null,
+ description: null,
+ error: null,
+ heartbeatInterval: null,
+ heartbeatTimeout: null,
+ id: 'task_001',
+ identifier: 'TASK-1',
+ instruction: null,
+ lastHeartbeatAt: null,
+ name: 'Task 1',
+ parentTaskId: null,
+ priority: 'normal',
+ status: 'todo',
+ totalTopics: 0,
+ };
+
+ const topics = [
+ {
+ createdAt: new Date('2024-01-03T00:00:00Z'),
+ handoff: {
+ content: 'The raw last assistant message shown as the run result.',
+ summary: 'A short synthesized summary.',
+ title: 'Topic A',
+ },
+ seq: 1,
+ status: 'completed',
+ topicId: 'topic-1',
+ },
+ ];
+
+ mockTaskModel.resolve.mockResolvedValue(task);
+ mockTaskModel.findAllDescendants.mockResolvedValue([]);
+ mockTaskModel.getDependencies.mockResolvedValue([]);
+ mockTaskTopicModel.findWithHandoff.mockResolvedValue(topics);
+ mockBriefModel.findByTaskId.mockResolvedValue([]);
+ mockTaskModel.getComments.mockResolvedValue([]);
+ mockTaskModel.getTreePinnedDocuments.mockResolvedValue({ nodeMap: {}, tree: [] });
+ mockTaskModel.findByIds.mockResolvedValue([]);
+ mockTaskModel.getCheckpointConfig.mockReturnValue({});
+ mockTaskModel.getVerifyConfig.mockReturnValue(undefined);
+
+ const service = new TaskService(db, userId);
+ const result = await service.getTaskDetail('TASK-1');
+
+ const topicActivity = result?.activities?.find((a) => a.type === 'topic');
+ expect(topicActivity?.summary).toBe('A short synthesized summary.');
+ expect(topicActivity?.content).toBe(
+ 'The raw last assistant message shown as the run result.',
+ );
+ });
+
it('should resolve author info for activities', async () => {
const task = {
assigneeAgentId: 'agt_assignee',
diff --git a/apps/server/src/services/task/index.ts b/apps/server/src/services/task/index.ts
index 67a3733cc6e..8b827942d09 100644
--- a/apps/server/src/services/task/index.ts
+++ b/apps/server/src/services/task/index.ts
@@ -736,6 +736,9 @@ export class TaskService {
return {
author: topicAgentId ? authorMap.get(topicAgentId) : undefined,
completedAt: toISO(t.completedAt),
+ // Raw last assistant message of the run (LOBE-11396), shown alongside
+ // the synthesized summary on the run card.
+ content: handoff?.content,
id: t.topicId ?? undefined,
operationId: t.operationId ?? null,
runningOperation: t.metadata?.runningOperation ?? null,
diff --git a/apps/server/src/services/taskLifecycle/index.ts b/apps/server/src/services/taskLifecycle/index.ts
index 1ae0e81c422..8d6f0c466ff 100644
--- a/apps/server/src/services/taskLifecycle/index.ts
+++ b/apps/server/src/services/taskLifecycle/index.ts
@@ -125,7 +125,7 @@ export class TaskLifecycleService {
// 1. Update topic status
if (topicId) await this.taskTopicModel.updateStatus(taskId, topicId, 'completed');
- // 2. Generate handoff summary + topic title
+ // 2. Generate handoff summary + topic title (best-effort LLM synthesis).
if (topicId && lastAssistantContent) {
await this.generateHandoff(
taskId,
@@ -136,6 +136,18 @@ export class TaskLifecycleService {
);
}
+ // 2b. Persist the raw last message as the run card's result (LOBE-11396).
+ // Done independently of (and after) generateHandoff via a jsonb_set
+ // patch, so `handoff.content` is written even when the summary LLM in
+ // step 2 throws — otherwise a completed run would show no result.
+ if (topicId && lastAssistantContent) {
+ try {
+ await this.taskTopicModel.updateHandoffContent(taskId, topicId, lastAssistantContent);
+ } catch (e) {
+ console.warn('[TaskLifecycle] persisting run last message failed:', e);
+ }
+ }
+
// 3. Delivery acceptance now runs through Verify: the verify
// run settles asynchronously (agent verifier) and drives the task to its
// terminal state via `driveTaskFromVerify`. The legacy eval-rubric
@@ -440,7 +452,9 @@ export class TaskLifecycleService {
await this.topicModel.update(topicId, { title: handoff.title });
}
- // Store handoff in task_topics dedicated fields
+ // Store handoff in task_topics dedicated fields. `handoff.content` (the raw
+ // last message) is persisted separately in onTopicComplete so it survives
+ // even when this LLM synthesis throws.
await this.taskTopicModel.updateHandoff(taskId, topicId, handoff);
log('handoff generated for topic %s: title=%s', topicId, handoff.title);
diff --git a/apps/server/src/services/taskLifecycle/onTopicComplete.test.ts b/apps/server/src/services/taskLifecycle/onTopicComplete.test.ts
index 5a7d671ebe2..bcf41b8176b 100644
--- a/apps/server/src/services/taskLifecycle/onTopicComplete.test.ts
+++ b/apps/server/src/services/taskLifecycle/onTopicComplete.test.ts
@@ -67,6 +67,7 @@ describe('TaskLifecycleService.onTopicComplete', () => {
taskModel.shouldPauseOnTopicComplete = vi.fn().mockReturnValue(true);
// Avoid generateHandoff side effects by skipping when lastAssistantContent is undefined
(service as any).taskTopicModel.updateStatus = updateTopicStatus;
+ (service as any).taskTopicModel.updateHandoffContent = vi.fn().mockResolvedValue(undefined);
(service as any).briefModel.create = createBrief;
(service as any).briefModel.hasUnresolvedUrgentByTask = vi.fn().mockResolvedValue(false);
});
@@ -92,6 +93,30 @@ describe('TaskLifecycleService.onTopicComplete', () => {
expect(updateStatus).not.toHaveBeenCalledWith('task-1', 'paused', expect.anything());
});
+ it('persists the run last message independently of handoff summary (LOBE-11396)', async () => {
+ const task = baseTask({ automationMode: 'heartbeat' });
+ findById.mockResolvedValue(task);
+ // Model the summary path as a no-op (e.g. its LLM call failed and was
+ // swallowed) — the raw last message must still be persisted for the card.
+ vi.spyOn(service as any, 'generateHandoff').mockResolvedValue(undefined);
+ const updateHandoffContent = (service as any).taskTopicModel.updateHandoffContent;
+
+ await service.onTopicComplete({
+ lastAssistantContent: 'the raw last assistant message',
+ operationId: 'op-1',
+ reason: 'done',
+ taskId: 'task-1',
+ taskIdentifier: 'TASK-1',
+ topicId: 'topic-1',
+ });
+
+ expect(updateHandoffContent).toHaveBeenCalledWith(
+ 'task-1',
+ 'topic-1',
+ 'the raw last assistant message',
+ );
+ });
+
it('schedule-mode task → status="scheduled"', async () => {
const task = baseTask({ automationMode: 'schedule' });
findById.mockResolvedValue(task);
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index a86236f2c5a..e46b606d114 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -854,6 +854,8 @@
"taskDetail.runAll.skipped.blockedExternally": "{{count}} task(s) waiting on a blocker outside this batch — will run automatically when unblocked",
"taskDetail.runAll.skipped.ineligible": "{{count}} task(s) running or scheduled — skipped",
"taskDetail.runAll.title": "Run subtasks in dependency order",
+ "taskDetail.runFollowUp": "Ask a follow-up",
+ "taskDetail.runFollowUpPlaceholder": "Ask a follow-up about this run...",
"taskDetail.runNow": "Run now",
"taskDetail.runTask": "Run",
"taskDetail.saveModelConfig": "Save",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 510a01fafd6..964edd42460 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -854,6 +854,8 @@
"taskDetail.runAll.skipped.blockedExternally": "{{count}} 个任务被本批次外的依赖阻塞 —— 解除阻塞后将自动运行",
"taskDetail.runAll.skipped.ineligible": "{{count}} 个任务正在运行或已排期 —— 已跳过",
"taskDetail.runAll.title": "按依赖顺序运行子任务",
+ "taskDetail.runFollowUp": "追问",
+ "taskDetail.runFollowUpPlaceholder": "对这次运行追问...",
"taskDetail.runNow": "立即运行",
"taskDetail.runTask": "运行",
"taskDetail.saveModelConfig": "保存",
diff --git a/packages/database/src/models/taskTopic.ts b/packages/database/src/models/taskTopic.ts
index 75e21bf430b..5f3552c6d9b 100644
--- a/packages/database/src/models/taskTopic.ts
+++ b/packages/database/src/models/taskTopic.ts
@@ -147,6 +147,22 @@ export class TaskTopicModel {
.where(and(eq(taskTopics.taskId, taskId), eq(taskTopics.topicId, topicId), this.ownership()));
}
+ /**
+ * Patch the raw run output into `handoff.content` (LOBE-11396) without
+ * disturbing other handoff keys. Uses `jsonb_set` so it is order-independent
+ * with respect to `updateHandoff` — critically, this lets the caller persist
+ * the last message even when the (separate) handoff-summary LLM call fails, so
+ * the run card always has a result to show.
+ */
+ async updateHandoffContent(taskId: string, topicId: string, content: string): Promise<void> {
+ await this.db
+ .update(taskTopics)
+ .set({
+ handoff: sql`jsonb_set(COALESCE(${taskTopics.handoff}, '{}'::jsonb), '{content}', ${JSON.stringify(content)}::jsonb)`,
+ })
+ .where(and(eq(taskTopics.taskId, taskId), eq(taskTopics.topicId, topicId), this.ownership()));
+ }
+
async updateReview(
taskId: string,
topicId: string,
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index ee93ab9530c..da9b2b22c4b 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -928,6 +928,8 @@ export default {
'taskDetail.comment.save': 'Save',
'taskDetail.commentPlaceholder':
'Leave feedback to guide the agent — your comments shape the next run...',
+ 'taskDetail.runFollowUp': 'Ask a follow-up',
+ 'taskDetail.runFollowUpPlaceholder': 'Ask a follow-up about this run...',
'taskDetail.collapseReply': 'Collapse',
'taskDetail.replyInThread': 'Reply in this thread',
'taskDetail.replyPlaceholder': 'Reply in this thread...',
diff --git a/packages/types/src/task/index.ts b/packages/types/src/task/index.ts
index bab8c14b4e9..6121f65f15f 100644
--- a/packages/types/src/task/index.ts
+++ b/packages/types/src/task/index.ts
@@ -111,6 +111,12 @@ export interface TaskTopicHandoff {
* about the brief delivery itself, written by the lifecycle service.
*/
briefDecision?: BriefDecision;
+ /**
+ * Raw last assistant message of the run, captured on completion (LOBE-11396).
+ * Shown on the run card alongside the LLM-synthesized `summary` so the feed
+ * surfaces the actual run output, not only the summary.
+ */
+ content?: string;
keyFindings?: string[];
nextAction?: string;
summary?: string;
diff --git a/src/components/StatusIcon/const.ts b/src/components/StatusIcon/const.ts
new file mode 100644
index 00000000000..fa24e20e510
--- /dev/null
+++ b/src/components/StatusIcon/const.ts
@@ -0,0 +1,87 @@
+import type { TaskStatus } from '@lobechat/types';
+import { cssVar } from 'antd-style';
+import {
+ Archive,
+ CircleAlert,
+ CircleCheck,
+ CircleDashed,
+ CircleDot,
+ CircleSlash,
+ CircleX,
+ Clock,
+ Hand,
+ type LucideIcon,
+ PauseCircle,
+} from 'lucide-react';
+
+/**
+ * Canonical status vocabulary shared by BOTH topic and task surfaces. Each
+ * concrete status enum (ChatTopicStatus, TaskStatus, topic status-buckets, …)
+ * maps onto one of these kinds so the whole app speaks one visual language.
+ */
+export type StatusKind =
+ | 'running'
+ | 'scheduled'
+ | 'needsAttention'
+ | 'paused'
+ | 'completed'
+ | 'failed'
+ | 'backlog'
+ | 'active'
+ | 'canceled'
+ | 'archived'
+ | 'timeout';
+
+export interface StatusMeta {
+ color: string;
+ icon: LucideIcon;
+}
+
+/**
+ * THE single source of truth for status → icon + color across topic & task.
+ *
+ * Built on the `Circle-*` family so every status reads as one coherent set.
+ * `running` is the STATIC glyph used by group headers / summaries / badges; a
+ * row that is *actively executing right now* renders the animated
+ * {@link RingLoadingIcon} instead — the live variant of this same `CircleDot`.
+ *
+ * `needsAttention` is the "a human is needed" state (topic `pending` /
+ * `waitingForHuman`, task `paused` / `needsInput`); `paused` is a genuinely
+ * suspended item. They are different concepts and must not be merged.
+ *
+ * NOTE: `completed` and `failed` are the canonical target (green check / red
+ * cross). Task surfaces already match; a few TOPIC surfaces still render their
+ * legacy grey `CheckCircle2` / `TriangleAlert` locally and are intentionally
+ * NOT yet wired here — that convergence is deferred to a follow-up.
+ */
+export const STATUS_META: Record<StatusKind, StatusMeta> = {
+ active: { color: cssVar.colorTextTertiary, icon: CircleDot },
+ archived: { color: cssVar.colorTextDescription, icon: Archive },
+ backlog: { color: cssVar.colorTextQuaternary, icon: CircleDashed },
+ canceled: { color: cssVar.colorTextSecondary, icon: CircleSlash },
+ completed: { color: cssVar.colorSuccess, icon: CircleCheck },
+ failed: { color: cssVar.colorError, icon: CircleX },
+ needsAttention: { color: cssVar.colorInfo, icon: Hand },
+ paused: { color: cssVar.colorTextDescription, icon: PauseCircle },
+ running: { color: cssVar.colorWarning, icon: CircleDot },
+ scheduled: { color: cssVar.colorWarning, icon: Clock },
+ timeout: { color: cssVar.colorWarning, icon: CircleAlert },
+};
+
+const TASK_STATUS_KIND: Record<TaskStatus, StatusKind> = {
+ backlog: 'backlog',
+ canceled: 'canceled',
+ completed: 'completed',
+ failed: 'failed',
+ paused: 'needsAttention',
+ running: 'running',
+ scheduled: 'scheduled',
+};
+
+/** Map a `TaskStatus` onto the canonical status kind. */
+export const getTaskStatusKind = (status: TaskStatus): StatusKind =>
+ TASK_STATUS_KIND[status] ?? 'backlog';
+
+/** Convenience: canonical meta for a task status. */
+export const getTaskStatusMeta = (status: TaskStatus): StatusMeta =>
+ STATUS_META[getTaskStatusKind(status)];
diff --git a/src/components/StatusIcon/index.ts b/src/components/StatusIcon/index.ts
new file mode 100644
index 00000000000..78f761f462b
--- /dev/null
+++ b/src/components/StatusIcon/index.ts
@@ -0,0 +1,8 @@
+export {
+ getTaskStatusKind,
+ getTaskStatusMeta,
+ STATUS_META,
+ type StatusKind,
+ type StatusMeta,
+} from './const';
+export { default as RingLoadingIcon } from '@/components/RingLoading';
diff --git a/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx b/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx
index 51f11d85631..e690eb4795a 100644
--- a/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx
@@ -17,7 +17,16 @@ import { useTaskStore } from '@/store/task';
import { styles } from '../shared/style';
-const CommentInput = memo<{ taskId: string }>(({ taskId }) => {
+interface CommentInputProps {
+ /** Called after a comment is successfully submitted (e.g. to collapse an inline input). */
+ onSent?: () => void;
+ placeholder?: string;
+ taskId: string;
+ /** Scope the comment to a specific run (topic) — e.g. a follow-up on a run card. */
+ topicId?: string;
+}
+
+const CommentInput = memo<CommentInputProps>(({ taskId, topicId, placeholder, onSent }) => {
const { t } = useTranslation('chat');
const { allowed: canEditTask } = usePermission('create_content');
const editor = useEditor();
@@ -56,14 +65,15 @@ const CommentInput = memo<{ taskId: string }>(({ taskId }) => {
setSubmitting(true);
try {
- await addComment(taskId, markdown, { editorData: json });
+ await addComment(taskId, markdown, { editorData: json, topicId });
editor?.cleanDocument?.();
setHasContent(false);
setHasAttachments(false);
+ onSent?.();
} finally {
setSubmitting(false);
}
- }, [canEditTask, taskId, editor, addComment, submitting]);
+ }, [canEditTask, taskId, topicId, editor, addComment, submitting, onSent]);
return (
<Flexbox className={styles.commentInputCard} gap={6}>
@@ -73,7 +83,7 @@ const CommentInput = memo<{ taskId: string }>(({ taskId }) => {
<EditorCanvas
editor={editor}
floatingToolbar={false}
- placeholder={t('taskDetail.commentPlaceholder')}
+ placeholder={placeholder ?? t('taskDetail.commentPlaceholder')}
style={{
fontSize: 14,
maxWidth: '100%',
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
index 08c881c240e..7c8d3619d62 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
@@ -6,21 +6,26 @@ import {
type DropdownItem,
DropdownMenu,
Flexbox,
+ Markdown,
+ MaskShadow,
stopPropagation,
Tag,
Text,
} from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
+import { useSize } from 'ahooks';
import { cssVar } from 'antd-style';
-import { CircleDot, CircleStop, Copy, ExternalLink, MoreHorizontal } from 'lucide-react';
-import { memo, useCallback, useEffect, useState } from 'react';
+import { CircleDot, CircleStop, Copy, ExternalLink, MoreHorizontal, SquarePen } from 'lucide-react';
+import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AgentProfilePopup from '@/features/AgentProfileCard/AgentProfilePopup';
import { useActivityTime } from '@/hooks/useActivityTime';
import { useTaskStore } from '@/store/task';
+import { taskDetailSelectors } from '@/store/task/selectors';
import { styles } from '../shared/style';
+import CommentInput from './CommentInput';
import TopicStatusIcon from './TopicStatusIcon';
const formatDuration = (ms: number): string => {
@@ -32,6 +37,33 @@ const formatDuration = (ms: number): string => {
return `${hours}h ${minutes % 60}m`;
};
+// The run's last message (`content`) is the raw assistant output — markdown, and
+// often long. Render it as rich text, but keep it a bounded preview in the feed:
+// clamp overflow with a fade and let the whole card open the run drawer for the
+// full message (progressive disclosure). `pointerEvents: none` keeps every click
+// — including on links/code inside the markdown — falling through to the card.
+const RUN_CONTENT_MAX_HEIGHT = 160;
+
+const RunContent = memo<{ content: string }>(({ content }) => {
+ const ref = useRef<HTMLDivElement>(null);
+ const size = useSize(ref);
+ const isOverflow = !!size && size.height > RUN_CONTENT_MAX_HEIGHT;
+
+ const markdown = (
+ <Markdown ref={ref} style={{ overflow: 'unset', pointerEvents: 'none' }} variant={'chat'}>
+ {content}
+ </Markdown>
+ );
+
+ return isOverflow ? (
+ <MaskShadow size={32} style={{ maxHeight: RUN_CONTENT_MAX_HEIGHT }}>
+ {markdown}
+ </MaskShadow>
+ ) : (
+ markdown
+ );
+});
+
interface TopicCardProps {
activity: TaskDetailActivity;
}
@@ -40,6 +72,8 @@ const TopicCard = memo<TopicCardProps>(({ activity }) => {
const { t } = useTranslation('chat');
const openTopicDrawer = useTaskStore((s) => s.openTopicDrawer);
const cancelTopic = useTaskStore((s) => s.cancelTopic);
+ const activeTaskId = useTaskStore(taskDetailSelectors.activeTaskId);
+ const [commenting, setCommenting] = useState(false);
const isRunning = activity.status === 'running';
const finalDuration =
@@ -144,8 +178,8 @@ const TopicCard = memo<TopicCardProps>(({ activity }) => {
<Block
clickable={!!activity.id}
gap={8}
- paddingBlock={8}
- paddingInline={8}
+ paddingBlock={12}
+ paddingInline={12}
style={{ borderRadius: cssVar.borderRadiusLG }}
variant={'outlined'}
onClick={activity.id ? handleOpen : undefined}
@@ -203,10 +237,32 @@ const TopicCard = memo<TopicCardProps>(({ activity }) => {
</Flexbox>
{activity.summary && (
- <Text fontSize={13} style={{ color: cssVar.colorTextSecondary, whiteSpace: 'pre-wrap' }}>
+ <Text fontSize={13} style={{ color: cssVar.colorTextDescription, whiteSpace: 'pre-wrap' }}>
{activity.summary}
</Text>
)}
+ {activity.content && <RunContent content={activity.content} />}
+ {activeTaskId && (
+ <Flexbox horizontal justify={'flex-end'} onClick={stopPropagation}>
+ {commenting ? (
+ <Flexbox style={{ width: '100%' }}>
+ <CommentInput
+ placeholder={t('taskDetail.runFollowUpPlaceholder')}
+ taskId={activeTaskId}
+ topicId={activity.id}
+ onSent={() => setCommenting(false)}
+ />
+ </Flexbox>
+ ) : (
+ <ActionIcon
+ icon={SquarePen}
+ size={'small'}
+ title={t('taskDetail.runFollowUp')}
+ onClick={() => setCommenting(true)}
+ />
+ )}
+ </Flexbox>
+ )}
</Block>
);
});
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicStatusIcon.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicStatusIcon.tsx
index a20e66a328f..4713d92a34c 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicStatusIcon.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicStatusIcon.tsx
@@ -1,64 +1,37 @@
import { Icon } from '@lobehub/ui';
import { cssVar } from 'antd-style';
-import {
- CircleAlert,
- CircleCheck,
- CircleDashed,
- CircleSlash,
- CircleX,
- type LucideIcon,
-} from 'lucide-react';
import { memo } from 'react';
+import { RingLoadingIcon, STATUS_META, type StatusKind } from '@/components/StatusIcon';
+
type TopicRunStatus = 'canceled' | 'completed' | 'failed' | 'pending' | 'running' | 'timeout';
-const STATIC_META: Record<
- Exclude<TopicRunStatus, 'running'>,
- { color: string; icon: LucideIcon }
-> = {
- canceled: { color: cssVar.colorTextSecondary, icon: CircleSlash },
- completed: { color: cssVar.colorSuccess, icon: CircleCheck },
- failed: { color: cssVar.colorError, icon: CircleX },
- pending: { color: cssVar.colorTextQuaternary, icon: CircleDashed },
- timeout: { color: cssVar.colorWarning, icon: CircleAlert },
+// A subtask topic's run status → canonical status kind. `pending` (not yet
+// started) reads as `backlog`; `running` is handled separately by the live
+// spinner below.
+const RUN_STATUS_KIND: Record<Exclude<TopicRunStatus, 'running'>, StatusKind> = {
+ canceled: 'canceled',
+ completed: 'completed',
+ failed: 'failed',
+ pending: 'backlog',
+ timeout: 'timeout',
};
-const RunningIcon = memo<{ size: number }>(({ size }) => {
- const mainColor = cssVar.colorWarning;
- const ringColor = `color-mix(in srgb, ${cssVar.colorWarning} 35%, transparent)`;
- return (
- <svg aria-hidden fill="none" height={size} viewBox="0 0 16 16" width={size}>
- <circle cx="8" cy="8" r="6.5" stroke={ringColor} strokeWidth="1.5" />
- <path
- d="M14.5 8 A 6.5 6.5 0 0 1 8 14.5"
- fill="none"
- stroke={mainColor}
- strokeLinecap="round"
- strokeWidth="1.5"
- >
- <animateTransform
- attributeName="transform"
- dur="1s"
- from="0 8 8"
- repeatCount="indefinite"
- to="360 8 8"
- type="rotate"
- />
- </path>
- <circle cx="8" cy="8" fill={mainColor} r="2.5" stroke={ringColor} strokeWidth="1" />
- </svg>
- );
-});
-
interface TopicStatusIconProps {
size?: number;
status?: string | null;
}
const TopicStatusIcon = memo<TopicStatusIconProps>(({ size = 16, status }) => {
- if (status === 'running') return <RunningIcon size={size} />;
- const key = (status ?? 'pending') as keyof typeof STATIC_META;
- const meta = STATIC_META[key] ?? STATIC_META.pending;
+ // Live variant of the canonical `running` CircleDot: the animated ring.
+ if (status === 'running') {
+ const ringColor = `color-mix(in srgb, ${cssVar.colorWarning} 35%, transparent)`;
+ return (
+ <RingLoadingIcon ringColor={ringColor} size={size} style={{ color: cssVar.colorWarning }} />
+ );
+ }
+ const kind = RUN_STATUS_KIND[(status ?? 'pending') as keyof typeof RUN_STATUS_KIND] ?? 'backlog';
+ const meta = STATUS_META[kind];
return <Icon color={meta.color} icon={meta.icon} size={size} />;
});
diff --git a/src/features/AgentTasks/features/TaskStatusIcon.tsx b/src/features/AgentTasks/features/TaskStatusIcon.tsx
index ae5cac5d376..8ec144e3139 100644
--- a/src/features/AgentTasks/features/TaskStatusIcon.tsx
+++ b/src/features/AgentTasks/features/TaskStatusIcon.tsx
@@ -1,35 +1,10 @@
import type { TaskStatus } from '@lobechat/types';
import { ActionIcon } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import type { LucideIcon } from 'lucide-react';
-import {
- CircleCheck,
- CircleDashed,
- CircleDot,
- CircleSlash,
- CircleX,
- Clock,
- HandIcon,
-} from 'lucide-react';
import { memo } from 'react';
+import { getTaskStatusMeta } from '@/components/StatusIcon';
import { taskListSelectors } from '@/store/task/selectors';
-interface StatusMeta {
- color: string;
- icon: LucideIcon;
-}
-
-const STATUS_META: Record<TaskStatus, StatusMeta> = {
- backlog: { color: cssVar.colorTextQuaternary, icon: CircleDashed },
- canceled: { color: cssVar.colorTextSecondary, icon: CircleSlash },
- completed: { color: cssVar.colorSuccess, icon: CircleCheck },
- failed: { color: cssVar.colorError, icon: CircleX },
- paused: { color: cssVar.colorInfo, icon: HandIcon },
- running: { color: cssVar.colorWarning, icon: CircleDot },
- scheduled: { color: cssVar.colorWarning, icon: Clock },
-};
-
interface TaskStatusIconProps {
size?: number;
status: TaskStatus;
@@ -37,7 +12,7 @@ interface TaskStatusIconProps {
const TaskStatusIcon = memo<TaskStatusIconProps>(({ size = 16, status }) => {
const displayStatus = taskListSelectors.getDisplayStatus(status);
- const meta = STATUS_META[status as TaskStatus] ?? STATUS_META.backlog;
+ const meta = getTaskStatusMeta(status);
return (
<ActionIcon
diff --git a/src/features/AgentTasks/features/TaskStatusTag.tsx b/src/features/AgentTasks/features/TaskStatusTag.tsx
index 1d09b260798..90c36349c83 100644
--- a/src/features/AgentTasks/features/TaskStatusTag.tsx
+++ b/src/features/AgentTasks/features/TaskStatusTag.tsx
@@ -2,20 +2,12 @@ import type { TaskStatus } from '@lobechat/types';
import { type DropdownItem, DropdownMenu, Icon, type MenuInfo, Tooltip } from '@lobehub/ui';
import { createStaticStyles, cssVar } from 'antd-style';
import type { LucideIcon } from 'lucide-react';
-import {
- CircleCheck,
- CircleDashed,
- CircleDot,
- CircleSlash,
- CircleX,
- Clock,
- HandIcon,
- Loader2Icon,
-} from 'lucide-react';
+import { Loader2Icon } from 'lucide-react';
import type { ReactNode } from 'react';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { getTaskStatusMeta } from '@/components/StatusIcon';
import { usePermission } from '@/hooks/usePermission';
import { useTaskStore } from '@/store/task';
@@ -28,51 +20,25 @@ interface StatusMeta {
labelKey: string;
}
-export const STATUS_META: Record<TaskStatus, StatusMeta> = {
- backlog: {
- color: cssVar.colorTextQuaternary,
- icon: CircleDashed,
- label: 'Backlog',
- labelKey: 'status.backlog',
- },
- canceled: {
- color: cssVar.colorTextSecondary,
- icon: CircleSlash,
- label: 'Canceled',
- labelKey: 'status.canceled',
- },
- completed: {
- color: cssVar.colorSuccess,
- icon: CircleCheck,
- label: 'Completed',
- labelKey: 'status.completed',
- },
- failed: {
- color: cssVar.colorError,
- icon: CircleX,
- label: 'Failed',
- labelKey: 'status.failed',
- },
- paused: {
- color: cssVar.colorInfo,
- icon: HandIcon,
- label: 'Pending review',
- labelKey: 'status.paused',
- },
- running: {
- color: cssVar.colorWarning,
- icon: CircleDot,
- label: 'Running',
- labelKey: 'status.running',
- },
- scheduled: {
- color: cssVar.colorWarning,
- icon: Clock,
- label: 'Scheduled',
- labelKey: 'status.scheduled',
- },
+// Labels stay local; icon + color come from the shared canonical status map so
+// the tag can never drift from the sidebar / kanban glyphs.
+const STATUS_LABELS: Record<TaskStatus, { label: string; labelKey: string }> = {
+ backlog: { label: 'Backlog', labelKey: 'status.backlog' },
+ canceled: { label: 'Canceled', labelKey: 'status.canceled' },
+ completed: { label: 'Completed', labelKey: 'status.completed' },
+ failed: { label: 'Failed', labelKey: 'status.failed' },
+ paused: { label: 'Pending review', labelKey: 'status.paused' },
+ running: { label: 'Running', labelKey: 'status.running' },
+ scheduled: { label: 'Scheduled', labelKey: 'status.scheduled' },
};
+export const STATUS_META: Record<TaskStatus, StatusMeta> = Object.fromEntries(
+ (Object.keys(STATUS_LABELS) as TaskStatus[]).map((status) => [
+ status,
+ { ...getTaskStatusMeta(status), ...STATUS_LABELS[status] },
+ ]),
+) as Record<TaskStatus, StatusMeta>;
+
export const USER_SELECTABLE_STATUSES: TaskStatus[] = [
'backlog',
'paused',
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Task/StatusGroup.tsx b/src/routes/(main)/agent/_layout/Sidebar/Task/StatusGroup.tsx
index 3b322f8aafd..c6582f02327 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Task/StatusGroup.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Task/StatusGroup.tsx
@@ -2,31 +2,21 @@
import { AccordionItem, Center, Flexbox, Icon, Text } from '@lobehub/ui';
import { cssVar } from 'antd-style';
-import { CircleDashed, CircleDot, HandIcon, type LucideIcon } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router';
+import { STATUS_META as STATUS_ICON, type StatusKind } from '@/components/StatusIcon';
import type { TaskGroupItem } from '@/store/task/slices/list/initialState';
import TaskItem from './TaskItem';
-const STATUS_META: Record<string, { color: string; icon: LucideIcon; titleKey: string }> = {
- backlog: {
- color: cssVar.colorTextQuaternary,
- icon: CircleDashed,
- titleKey: 'taskList.kanban.backlog',
- },
- needsInput: {
- color: cssVar.colorInfo,
- icon: HandIcon,
- titleKey: 'taskList.kanban.needsInput',
- },
- running: {
- color: cssVar.colorWarning,
- icon: CircleDot,
- titleKey: 'taskList.kanban.running',
- },
+// Task sidebar group keys → canonical status kind + i18n title. `needsInput`
+// (paused + failed tasks awaiting a human) is the `needsAttention` kind.
+const GROUP_META: Record<string, { kind: StatusKind; titleKey: string }> = {
+ backlog: { kind: 'backlog', titleKey: 'taskList.kanban.backlog' },
+ needsInput: { kind: 'needsAttention', titleKey: 'taskList.kanban.needsInput' },
+ running: { kind: 'running', titleKey: 'taskList.kanban.running' },
};
interface StatusGroupProps {
@@ -36,8 +26,9 @@ interface StatusGroupProps {
const StatusGroup = memo<StatusGroupProps>(({ group }) => {
const { t } = useTranslation('chat');
const { taskId } = useParams<{ taskId?: string }>();
- const meta = STATUS_META[group.key];
- if (!meta) return null;
+ const groupMeta = GROUP_META[group.key];
+ if (!groupMeta) return null;
+ const meta = STATUS_ICON[groupMeta.kind];
return (
<AccordionItem
@@ -50,7 +41,7 @@ const StatusGroup = memo<StatusGroupProps>(({ group }) => {
<Icon color={meta.color} icon={meta.icon} size={{ size: 14, strokeWidth: 1.75 }} />
</Center>
<Text ellipsis fontSize={13} style={{ color: cssVar.colorTextSecondary, flex: 1 }}>
- {t(meta.titleKey as 'taskList.kanban.backlog')}
+ {t(groupMeta.titleKey as 'taskList.kanban.backlog')}
</Text>
<Text fontSize={11} type="secondary">
{group.tasks.length}
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
index ebc37ca98f3..cc2858a69d2 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
@@ -3,13 +3,14 @@ import type { ChatTopicMetadata, ChatTopicStatus } from '@lobechat/types';
import { formatElapsedClockTime } from '@lobechat/utils';
import { Flexbox, Icon, Skeleton, Tag, Text, Tooltip } from '@lobehub/ui';
import { createStaticStyles, cssVar, keyframes, useTheme } from 'antd-style';
-import { CheckCircle2, Hand, HashIcon, MessageSquareDashed, TriangleAlert } from 'lucide-react';
+import { CheckCircle2, HashIcon, MessageSquareDashed, TriangleAlert } from 'lucide-react';
import { memo, Suspense, useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import DotsLoading from '@/components/DotsLoading';
import RingLoadingIcon from '@/components/RingLoading';
+import { STATUS_META } from '@/components/StatusIcon';
import { isDesktop } from '@/const/version';
import DirIcon from '@/features/ChatInput/ControlBar/DirIcon';
import { useHasDraft } from '@/features/ChatInput/draftStorage';
@@ -344,7 +345,13 @@ const TopicItem = memo<TopicItemProps>(
titleColor={cssVar.colorText}
icon={(() => {
if (isWaitingForHuman) {
- return <Icon icon={Hand} size={'small'} style={{ color: cssVar.colorInfo }} />;
+ return (
+ <Icon
+ icon={STATUS_META.needsAttention.icon}
+ size={'small'}
+ style={{ color: STATUS_META.needsAttention.color }}
+ />
+ );
}
if (shouldShowRunningIcon) {
return (
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx
index cb685bb7730..c558cedf975 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx
@@ -4,7 +4,6 @@ import { createStaticStyles, cssVar, cx, keyframes } from 'antd-style';
import {
FolderClosedIcon,
FolderOpenIcon,
- HandIcon,
type LucideIcon,
PlusIcon,
TriangleAlertIcon,
@@ -15,6 +14,7 @@ import { useParams } from 'react-router';
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import RingLoadingIcon from '@/components/RingLoading';
+import { STATUS_META } from '@/components/StatusIcon';
import { isDesktop } from '@/const/version';
import { useCommitWorkingDirectory } from '@/features/ChatInput/ControlBar/useCommitWorkingDirectory';
import { resolveExecutionTarget } from '@/helpers/executionTarget';
@@ -153,7 +153,7 @@ const CollapsedStatusBadges = memo<{ counts: ProjectTopicStatusCounts }>(({ coun
{
className: styles.statusBadgeWaiting,
count: counts.waitingForHuman,
- icon: HandIcon,
+ icon: STATUS_META.needsAttention.icon,
label: t('projectStatus.waitingForHuman', { count: counts.waitingForHuman }),
},
{
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx
index b48cb68c6b1..b3e5ddb8724 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx
@@ -1,32 +1,31 @@
import { AccordionItem, Center, Flexbox, Icon, Text } from '@lobehub/ui';
import { cssVar } from 'antd-style';
-import {
- Archive,
- CheckCircle2,
- CircleAlert,
- CircleDot,
- Loader,
- type LucideIcon,
- PauseCircle,
- Star,
-} from 'lucide-react';
+import { CheckCircle2, Star } from 'lucide-react';
import { memo } from 'react';
+import { STATUS_META, type StatusMeta } from '@/components/StatusIcon';
+
import TopicItem from '../../List/Item';
import { type GroupItemComponentProps } from '../GroupedAccordion';
-// Map each status-group id to its icon + color, mirroring the per-topic status
-// glyphs in `List/Item`. `pending` collapses the attention-needing states
-// (awaiting input / failed / unread completion) into one group; `favorite` is
-// the synthetic group split out by `buildGroupedTopics`, so it gets a star.
-const STATUS_ICON: Record<string, { color: string; icon: LucideIcon }> = {
- active: { color: cssVar.colorTextTertiary, icon: CircleDot },
- archived: { color: cssVar.colorTextDescription, icon: Archive },
+// Topic status-group id → icon + color, drawn from the shared canonical status
+// map so headers stay in lockstep with task glyphs and per-topic rows. The
+// `pending` bucket (awaiting input / failed / unread completion) is the
+// `needsAttention` kind (blue hand). Two entries stay local: `favorite` is a
+// marker, not a status; `completed` still renders its legacy grey check until
+// the deferred completed/failed convergence lands.
+const LOCAL: Record<string, StatusMeta> = {
completed: { color: cssVar.colorTextDescription, icon: CheckCircle2 },
- favorite: { color: cssVar.colorWarning, icon: Star },
- paused: { color: cssVar.colorTextDescription, icon: PauseCircle },
- pending: { color: cssVar.colorWarning, icon: CircleAlert },
- running: { color: cssVar.colorWarning, icon: Loader },
+ favorite: { color: cssVar.colorTextTertiary, icon: Star },
+};
+
+const STATUS_ICON: Record<string, StatusMeta> = {
+ active: STATUS_META.active,
+ archived: STATUS_META.archived,
+ paused: STATUS_META.paused,
+ pending: STATUS_META.needsAttention,
+ running: STATUS_META.running,
+ ...LOCAL,
};
const GroupItem = memo<GroupItemComponentProps>(({ group, activeTopicId, activeThreadId }) => {