🤯 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
✨ feat(task): include subtask topic activity (#16399)
Arvin Xu421a43bf5870
diff --git a/apps/server/src/services/task/index.test.ts b/apps/server/src/services/task/index.test.tsindex 002dbd28efd..ee2230d8f0d 100644--- a/apps/server/src/services/task/index.test.ts+++ b/apps/server/src/services/task/index.test.ts@@ -61,7 +61,7 @@ describe('TaskService', () => {getComments: vi.fn(),getCommentFileIdsMap: vi.fn().mockResolvedValue({}),getDependencies: vi.fn(),- getDependenciesByTaskIds: vi.fn(),+ getDependenciesByTaskIds: vi.fn().mockResolvedValue([]),getReviewConfig: vi.fn(),getVerifyConfig: vi.fn(),getTaskFileIds: vi.fn().mockResolvedValue([]),@@ -77,6 +77,7 @@ describe('TaskService', () => {cancelIfRunning: vi.fn(),findByTaskId: vi.fn(),findWithHandoff: vi.fn(),+ findWithHandoffByTaskIds: vi.fn().mockResolvedValue([]),timeoutRunning: vi.fn(),};@@ -679,6 +680,118 @@ describe('TaskService', () => {expect(result?.topicCount).toBe(2);});+ it('should include descendant task topics in parent activities with source task context', async () => {+ const task = {+ assigneeAgentId: 'agt_parent',+ assigneeUserId: null,+ createdAt: null,+ description: null,+ error: null,+ heartbeatInterval: null,+ heartbeatTimeout: null,+ id: 'task_parent',+ identifier: 'TASK-1',+ instruction: null,+ lastHeartbeatAt: null,+ name: 'Parent task',+ parentTaskId: null,+ priority: 'normal',+ status: 'todo',+ totalTopics: 0,+ };++ const descendants = [+ {+ assigneeAgentId: 'agt_child',+ automationMode: null,+ heartbeatInterval: null,+ id: 'task_child',+ identifier: 'TASK-2',+ name: 'Child task',+ parentTaskId: 'task_parent',+ priority: 'normal',+ schedulePattern: null,+ scheduleTimezone: null,+ seq: 2,+ sortOrder: 0,+ status: 'running',+ },+ ];++ const directTopics = [+ {+ agentId: null,+ completedAt: null,+ createdAt: new Date('2024-01-01T00:00:00Z'),+ handoff: { title: 'Parent run' },+ metadata: null,+ operationId: 'op-parent',+ seq: 1,+ status: 'completed',+ title: null,+ topicId: 'topic-parent',+ },+ ];++ const descendantTopics = [+ {+ agentId: null,+ completedAt: null,+ createdAt: new Date('2024-01-02T00:00:00Z'),+ handoff: { title: 'Child run' },+ metadata: null,+ operationId: 'op-child',+ seq: 1,+ sourceTaskAssigneeAgentId: null,+ sourceTaskId: 'task_child',+ sourceTaskIdentifier: null,+ sourceTaskName: null,+ status: 'running',+ title: null,+ topicId: 'topic-child',+ },+ ];++ mockTaskModel.resolve.mockResolvedValue(task);+ mockTaskModel.findAllDescendants.mockResolvedValue(descendants);+ mockTaskModel.getDependencies.mockResolvedValue([]);+ mockTaskTopicModel.findWithHandoff.mockResolvedValue(directTopics);+ mockTaskTopicModel.findWithHandoffByTaskIds.mockResolvedValue(descendantTopics);+ mockBriefModel.findByTaskId.mockResolvedValue([]);+ mockTaskModel.getComments.mockResolvedValue([]);+ mockTaskModel.getTreePinnedDocuments.mockResolvedValue({ nodeMap: {}, tree: [] });+ mockTaskModel.findByIds.mockResolvedValue([]);+ mockTaskModel.getCheckpointConfig.mockReturnValue({});+ mockTaskModel.getVerifyConfig.mockReturnValue(undefined);+ mockAgentModel.getAgentAvatarsByIds.mockResolvedValue([+ { avatar: null, id: 'agt_parent', title: 'Parent Agent' },+ { avatar: null, id: 'agt_child', title: 'Child Agent' },+ ]);++ const service = new TaskService(db, userId);+ const result = await service.getTaskDetail('TASK-1');++ expect(mockTaskTopicModel.findWithHandoffByTaskIds).toHaveBeenCalledWith(['task_child'], 300);++ const topicActivities = result?.activities?.filter((a) => a.type === 'topic') ?? [];+ expect(topicActivities).toHaveLength(2);++ const childTopic = topicActivities.find((a) => a.id === 'topic-child');+ expect(childTopic).toMatchObject({+ author: {+ id: 'agt_child',+ name: 'Child Agent',+ type: 'agent',+ },+ operationId: 'op-child',+ sourceTaskId: 'task_child',+ sourceTaskIdentifier: 'TASK-2',+ sourceTaskName: 'Child task',+ status: 'running',+ title: 'Child run',+ });+ });+it('should propagate topic completedAt to the topic activity', async () => {const task = {assigneeAgentId: null,diff --git a/apps/server/src/services/task/index.ts b/apps/server/src/services/task/index.tsindex 03cb4094011..05c3b4ceb41 100644--- a/apps/server/src/services/task/index.ts+++ b/apps/server/src/services/task/index.ts@@ -30,6 +30,20 @@ import { TaskRunnerService } from '../taskRunner';const emptyWorkspace: WorkspaceData = { nodeMap: {}, tree: [] };const UNTITLED_TOPIC_TITLE = 'Untitled';+const TASK_DETAIL_DIRECT_TOPIC_LIMIT = 100;+const TASK_DETAIL_DESCENDANT_TOPIC_LIMIT = 300;++type DirectTaskTopicActivityRow = Awaited<ReturnType<TaskTopicModel['findWithHandoff']>>[number];+type DescendantTaskTopicActivityRow = Awaited<+ ReturnType<TaskTopicModel['findWithHandoffByTaskIds']>+>[number];+type TaskTopicActivityRow = DirectTaskTopicActivityRow &+ Partial<+ Pick<+ DescendantTaskTopicActivityRow,+ 'sourceTaskAssigneeAgentId' | 'sourceTaskId' | 'sourceTaskIdentifier' | 'sourceTaskName'+ >+ >;export interface CreateTaskInput {assigneeAgentId?: string;@@ -419,14 +433,41 @@ export class TaskService {task = { ...task, error: null };}- const [allDescendants, dependencies, topics, briefs, comments, workspace] = await Promise.all([- this.taskModel.findAllDescendants(task.id),- this.taskModel.getDependencies(task.id),- this.taskTopicModel.findWithHandoff(task.id, 100).catch(() => []),- this.briefModel.findByTaskId(task.id).catch(() => []),- this.taskModel.getComments(task.id).catch(() => []),- this.taskModel.getTreePinnedDocuments(task.id).catch(() => emptyWorkspace),- ]);+ const [allDescendants, dependencies, directTopics, briefs, comments, workspace] =+ await Promise.all([+ this.taskModel.findAllDescendants(task.id),+ this.taskModel.getDependencies(task.id),+ this.taskTopicModel+ .findWithHandoff(task.id, TASK_DETAIL_DIRECT_TOPIC_LIMIT)+ .catch(() => []),+ this.briefModel.findByTaskId(task.id).catch(() => []),+ this.taskModel.getComments(task.id).catch(() => []),+ this.taskModel.getTreePinnedDocuments(task.id).catch(() => emptyWorkspace),+ ]);++ const allDescendantIds = allDescendants.map((s) => s.id);+ const descendantTaskMap = new Map(allDescendants.map((s) => [s.id, s]));+ const descendantTopics =+ allDescendantIds.length > 0+ ? await this.taskTopicModel+ .findWithHandoffByTaskIds(allDescendantIds, TASK_DETAIL_DESCENDANT_TOPIC_LIMIT)+ .catch(() => [])+ : [];++ const topics: TaskTopicActivityRow[] = [+ ...directTopics,+ ...descendantTopics.map((topic) => {+ const sourceTask = descendantTaskMap.get(topic.sourceTaskId);+ return {+ ...topic,+ sourceTaskAssigneeAgentId:+ topic.sourceTaskAssigneeAgentId ?? sourceTask?.assigneeAgentId ?? null,+ sourceTaskId: topic.sourceTaskId ?? sourceTask?.id ?? null,+ sourceTaskIdentifier: topic.sourceTaskIdentifier ?? sourceTask?.identifier ?? null,+ sourceTaskName: topic.sourceTaskName ?? sourceTask?.name ?? null,+ };+ }),+ ];// Derive fileIds from persisted editor_data (single source of truth).const extractCtx = { db: this.db, userId: this.userId, workspaceId: this.workspaceId };@@ -451,7 +492,6 @@ export class TaskService {const taskFiles = taskFileIds.map((id) => fileById.get(id)).filter((f) => !!f);// Build dependency map for all descendants- const allDescendantIds = allDescendants.map((s) => s.id);const allDescendantDeps =allDescendantIds.length > 0? await this.taskModel.getDependenciesByTaskIds(allDescendantIds).catch(() => [])@@ -566,9 +606,10 @@ export class TaskService {// Each topic keeps the agent that actually ran it (topics.agentId), so an// earlier run's avatar stays correct after the task is reassigned. Fall back- // to the current assignee only when a topic has no recorded agent.+ // to the source task assignee, then the current task assignee, only when a+ // topic has no recorded agent.for (const t of topics) {- const topicAgentId = t.agentId ?? task.assigneeAgentId;+ const topicAgentId = t.agentId ?? t.sourceTaskAssigneeAgentId ?? task.assigneeAgentId;if (topicAgentId) agentIds.add(topicAgentId);}// Briefs may have an agentId@@ -605,7 +646,7 @@ export class TaskService {...(createdActivity ? [createdActivity] : []),...topics.map((t) => {const handoff = t.handoff as TaskTopicHandoff | null;- const topicAgentId = t.agentId ?? task.assigneeAgentId;+ const topicAgentId = t.agentId ?? t.sourceTaskAssigneeAgentId ?? task.assigneeAgentId;return {author: topicAgentId ? authorMap.get(topicAgentId) : undefined,completedAt: toISO(t.completedAt),@@ -615,6 +656,9 @@ export class TaskService {seq: t.seq,status: t.status,summary: handoff?.summary,+ sourceTaskId: t.sourceTaskId,+ sourceTaskIdentifier: t.sourceTaskIdentifier,+ sourceTaskName: t.sourceTaskName,time: toISO(t.createdAt),title: handoff?.title || t.title || UNTITLED_TOPIC_TITLE,type: 'topic' as const,diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 05cc649d4ce..4c7563368f7 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -186,6 +186,11 @@"extendParams.urlContext.title": "Extract Webpage Link Content","floatingChatPanel.collapse": "Collapse chat","floatingChatPanel.expand": "Expand chat",+ "followUpPlaceholder": "Follow up.",+ "followUpPlaceholderHeterogeneous": "Follow up.",+ "gatewayMode.beta": "Beta",+ "gatewayMode.cardTitle": "Agent Gateway Mode",+ "gatewayMode.desc": "Run agents in the cloud through LobeHub's Agent Gateway. Tasks keep running even after you close the page.","globalApproval.collapse": "Collapse","globalApproval.goToConversation": "Open conversation","globalApproval.moreCount_one": "{{count}} more pending",@@ -195,11 +200,6 @@"globalApproval.subtitle": "Waiting for your approval","globalApproval.title": "Approval needed","globalApproval.userRequestLabel": "Request",- "followUpPlaceholder": "Follow up.",- "followUpPlaceholderHeterogeneous": "Follow up.",- "gatewayMode.beta": "Beta",- "gatewayMode.cardTitle": "Agent Gateway Mode",- "gatewayMode.desc": "Run agents in the cloud through LobeHub's Agent Gateway. Tasks keep running even after you close the page.","group.desc": "Move a task forward with multiple Agents in one shared space.","group.memberTooltip": "There are {{count}} members in the group","group.orchestratorThinking": "Orchestrator is thinking...",@@ -707,6 +707,7 @@"taskDetail.latestActivity.briefWithType": "Brief ({{type}}): {{title}}","taskDetail.latestActivity.briefWithTypeOnly": "Brief ({{type}})","taskDetail.latestActivity.topic": "Topic: {{title}}",+ "taskDetail.latestActivity.topicFromSubtask": "{{identifier}} · {{topic}}","taskDetail.latestActivity.topicWithSeq": "Topic #{{seq}}: {{title}}","taskDetail.latestActivity.untitledTopic": "Untitled topic","taskDetail.modelConfig": "Model Override",@@ -766,6 +767,7 @@"taskDetail.topicMenu.stop": "Stop Run","taskDetail.topicMenu.stopConfirm.content": "The current run will be canceled. Generated messages are kept and you can re-run the task later.","taskDetail.topicMenu.stopConfirm.title": "Stop Run?",+ "taskDetail.topicSource": "From {{identifier}}","taskDetail.untitled": "Untitled","taskDetail.updateFailed": "Failed to update task","taskList.activeTasks": "Active Tasks",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex b198891eaf9..00f9a56d152 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -186,20 +186,27 @@"extendParams.urlContext.title": "提取网页链接内容","floatingChatPanel.collapse": "收起聊天","floatingChatPanel.expand": "展开聊天",+ "followUpPlaceholder": "继续跟进。",+ "followUpPlaceholderHeterogeneous": "继续跟进。",+ "gatewayMode.beta": "Beta",+ "gatewayMode.cardTitle": "Agent Gateway 模式",+ "gatewayMode.desc": "通过 LobeHub 的 Agent Gateway 在云端执行 Agent,即使关闭网页,任务也会继续运行。",+ "globalApproval.collapse": "收起","globalApproval.collapse": "收起","globalApproval.goToConversation": "打开会话",+ "globalApproval.goToConversation": "打开会话","globalApproval.moreCount_one": "还有 {{count}} 个待审批","globalApproval.moreCount_other": "还有 {{count}} 个待审批","globalApproval.pendingCount_one": "{{count}} 项待审批",+ "globalApproval.pendingCount_one": "{{count}} 项待审批",+ "globalApproval.pendingCount_other": "{{count}} 项待审批","globalApproval.pendingCount_other": "{{count}} 项待审批","globalApproval.subtitle": "等待你的审批",+ "globalApproval.subtitle": "等待你的审批",+ "globalApproval.title": "需要审批","globalApproval.title": "需要审批","globalApproval.userRequestLabel": "用户请求",- "followUpPlaceholder": "继续跟进。",- "followUpPlaceholderHeterogeneous": "继续跟进。",- "gatewayMode.beta": "Beta",- "gatewayMode.cardTitle": "Agent Gateway 模式",- "gatewayMode.desc": "通过 LobeHub 的 Agent Gateway 在云端执行 Agent,即使关闭网页,任务也会继续运行。",+ "globalApproval.userRequestLabel": "用户请求","group.desc": "在同一对话空间,让多个助理一起推进任务","group.memberTooltip": "群组内有 {{count}} 名成员","group.orchestratorThinking": "主持人思考中…",@@ -707,6 +714,7 @@"taskDetail.latestActivity.briefWithType": "简要({{type}}):{{title}}","taskDetail.latestActivity.briefWithTypeOnly": "简要({{type}})","taskDetail.latestActivity.topic": "主题:{{title}}",+ "taskDetail.latestActivity.topicFromSubtask": "{{identifier}} · {{topic}}","taskDetail.latestActivity.topicWithSeq": "主题 #{{seq}}:{{title}}","taskDetail.latestActivity.untitledTopic": "未命名主题","taskDetail.modelConfig": "模型覆盖",@@ -766,6 +774,7 @@"taskDetail.topicMenu.stop": "停止运行","taskDetail.topicMenu.stopConfirm.content": "当前运行将被取消。已生成的消息会保留,你可以稍后重新运行任务。","taskDetail.topicMenu.stopConfirm.title": "停止运行?",+ "taskDetail.topicSource": "来自 {{identifier}}","taskDetail.untitled": "无标题","taskDetail.updateFailed": "任务更新失败","taskList.activeTasks": "进行中的任务",@@ -1251,12 +1260,5 @@"workingPanel.space": "空间","workingPanel.title": "工作面板","you": "你",- "zenMode": "专注模式",- "globalApproval.collapse": "收起",- "globalApproval.goToConversation": "打开会话",- "globalApproval.pendingCount_one": "{{count}} 项待审批",- "globalApproval.pendingCount_other": "{{count}} 项待审批",- "globalApproval.subtitle": "等待你的审批",- "globalApproval.title": "需要审批",- "globalApproval.userRequestLabel": "用户请求"-}\ No newline at end of file+ "zenMode": "专注模式"+}diff --git a/packages/database/src/models/__tests__/taskTopic.test.ts b/packages/database/src/models/__tests__/taskTopic.test.tsindex e122f4422ab..96c28037087 100644--- a/packages/database/src/models/__tests__/taskTopic.test.ts+++ b/packages/database/src/models/__tests__/taskTopic.test.ts@@ -3,7 +3,7 @@ import { eq } from 'drizzle-orm';import { afterEach, beforeEach, describe, expect, it } from 'vitest';import { getTestDB } from '../../core/getTestDB';-import { tasks, taskTopics, topics, users } from '../../schemas';+import { agents, tasks, taskTopics, topics, users } from '../../schemas';import type { LobeChatDatabase } from '../../type';import { TaskModel } from '../task';import { TaskTopicModel } from '../taskTopic';@@ -291,6 +291,40 @@ describe('TaskTopicModel', () => {expect(h1?.completedAt).toBeInstanceOf(Date);expect(h2?.completedAt).toBeNull();});++ it('should return source task metadata when querying multiple task ids', async () => {+ const taskModel = new TaskModel(serverDB, userId);+ const topicModel = new TaskTopicModel(serverDB, userId);+ await serverDB+ .insert(agents)+ .values({ id: 'agt_child', slug: 'agt_child', userId })+ .onConflictDoNothing();+ const parent = await taskModel.create({ instruction: 'Parent' });+ const child = await taskModel.create({+ assigneeAgentId: 'agt_child',+ instruction: 'Child',+ name: 'Child Task',+ parentTaskId: parent.id,+ });+ const sibling = await taskModel.create({ instruction: 'Sibling', parentTaskId: parent.id });+ await createTopic('tpc_child');+ await createTopic('tpc_sibling');++ await topicModel.add(child.id, 'tpc_child', { operationId: 'op_child', seq: 1 });+ await topicModel.add(sibling.id, 'tpc_sibling', { operationId: 'op_sibling', seq: 1 });++ const rows = await topicModel.findWithHandoffByTaskIds([child.id], 10);++ expect(rows).toHaveLength(1);+ expect(rows[0]).toMatchObject({+ operationId: 'op_child',+ sourceTaskAssigneeAgentId: 'agt_child',+ sourceTaskId: child.id,+ sourceTaskIdentifier: child.identifier,+ sourceTaskName: 'Child Task',+ topicId: 'tpc_child',+ });+ });});describe('updateHandoff', () => {diff --git a/packages/database/src/models/taskTopic.ts b/packages/database/src/models/taskTopic.tsindex 062a8c7b084..51e1af00535 100644--- a/packages/database/src/models/taskTopic.ts+++ b/packages/database/src/models/taskTopic.ts@@ -1,5 +1,5 @@import type { BriefDecision, TaskTopicHandoff } from '@lobechat/types';-import { and, count, desc, eq, gte, sql } from 'drizzle-orm';+import { and, count, desc, eq, gte, inArray, sql } from 'drizzle-orm';import type { TaskTopicItem } from '../schemas/task';import { tasks, taskTopics } from '../schemas/task';@@ -243,6 +243,37 @@ export class TaskTopicModel {.limit(limit);}+ async findWithHandoffByTaskIds(taskIds: string[], limit: number) {+ if (taskIds.length === 0) return [];++ return this.db+ .select({+ // The agent that actually ran this topic — used so each activity row+ // keeps its own avatar instead of inheriting the task's *current*+ // assignee (which changes when the task is reassigned).+ agentId: topics.agentId,+ completedAt: topics.completedAt,+ createdAt: taskTopics.createdAt,+ handoff: taskTopics.handoff,+ metadata: topics.metadata,+ operationId: taskTopics.operationId,+ seq: taskTopics.seq,+ sourceTaskAssigneeAgentId: tasks.assigneeAgentId,+ sourceTaskId: tasks.id,+ sourceTaskIdentifier: tasks.identifier,+ sourceTaskName: tasks.name,+ status: taskTopics.status,+ title: topics.title,+ topicId: taskTopics.topicId,+ })+ .from(taskTopics)+ .innerJoin(tasks, eq(taskTopics.taskId, tasks.id))+ .leftJoin(topics, eq(taskTopics.topicId, topics.id))+ .where(and(inArray(taskTopics.taskId, taskIds), this.ownership()))+ .orderBy(desc(taskTopics.createdAt), desc(taskTopics.seq))+ .limit(limit);+ }+async remove(taskId: string, topicId: string): Promise<boolean> {const result = await this.db.delete(taskTopics)diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 1e549685544..804a13dbb6f 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -838,6 +838,7 @@ export default {'taskDetail.latestActivity.briefWithType': 'Brief ({{type}}): {{title}}','taskDetail.latestActivity.briefWithTypeOnly': 'Brief ({{type}})','taskDetail.latestActivity.topic': 'Topic: {{title}}',+ 'taskDetail.latestActivity.topicFromSubtask': '{{identifier}} · {{topic}}','taskDetail.latestActivity.topicWithSeq': 'Topic #{{seq}}: {{title}}','taskDetail.latestActivity.untitledTopic': 'Untitled topic','taskDetail.cancelSchedule': 'Cancel schedule',@@ -902,6 +903,7 @@ export default {'taskDetail.topicMenu.stopConfirm.content':'The current run will be canceled. Generated messages are kept and you can re-run the task later.','taskDetail.topicMenu.stopConfirm.title': 'Stop Run?',+ 'taskDetail.topicSource': 'From {{identifier}}','taskDetail.updateFailed': 'Failed to update task','createTask.assignee': 'Assignee',diff --git a/packages/types/src/task/index.ts b/packages/types/src/task/index.tsindex be1227439ef..61b869cd677 100644--- a/packages/types/src/task/index.ts+++ b/packages/types/src/task/index.ts@@ -340,6 +340,12 @@ export interface TaskDetailActivity {threadId?: string | null;} | null;seq?: number | null;+ /** Topic-only: task that owns this run when a parent detail includes descendant topics. */+ sourceTaskId?: string | null;+ /** Topic-only: display identifier of the task that owns this run, e.g. T-12. */+ sourceTaskIdentifier?: string | null;+ /** Topic-only: display name of the task that owns this run. */+ sourceTaskName?: string | null;status?: string | null;summary?: string;taskId?: string | null;diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsxindex abb4339474d..08c881c240e 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx@@ -7,6 +7,7 @@ import {DropdownMenu,Flexbox,stopPropagation,+ Tag,Text,} from '@lobehub/ui';import { confirmModal } from '@lobehub/ui/base-ui';@@ -163,6 +164,15 @@ const TopicCard = memo<TopicCardProps>(({ activity }) => {avatarNode)}<TopicStatusIcon size={16} status={activity.status} />+ {activity.sourceTaskIdentifier && (+ <Tag+ size={'small'}+ style={{ flexShrink: 0 }}+ title={t('taskDetail.topicSource', { identifier: activity.sourceTaskIdentifier })}+ >+ {activity.sourceTaskIdentifier}+ </Tag>+ )}<Text ellipsis weight={500}>{activity.title}</Text>diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsxindex 6665d7a82ea..8958f715d8e 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx@@ -9,6 +9,7 @@ import {DropdownMenu,Flexbox,Freeze,+ Tag,Text,} from '@lobehub/ui';import { cssVar } from 'antd-style';@@ -169,6 +170,17 @@ const TopicChatDrawer = memo(() => {style={{ maxWidth: '100%', minWidth: 0, overflow: 'hidden' }}><TopicStatusIcon size={16} status={status} />+ {activity?.sourceTaskIdentifier && (+ <Tag+ size={'small'}+ style={{ flex: 'none' }}+ title={t('taskDetail.topicSource', {+ identifier: activity.sourceTaskIdentifier,+ })}+ >+ {activity.sourceTaskIdentifier}+ </Tag>+ )}<Text ellipsis style={{ flex: '0 1 auto', minWidth: 0 }} weight={500}>{activity?.title || t('taskDetail.topicDrawer.untitled')}</Text>diff --git a/src/features/AgentTasks/features/TaskLatestActivity.tsx b/src/features/AgentTasks/features/TaskLatestActivity.tsxindex 1e8a5495255..d310001abac 100644--- a/src/features/AgentTasks/features/TaskLatestActivity.tsx+++ b/src/features/AgentTasks/features/TaskLatestActivity.tsx@@ -12,9 +12,16 @@ const getActivityText = (activity: TaskDetailActivity | undefined, t: TFunction<if (activity.type === 'comment') return activity.content || undefined;if (activity.type === 'topic') {const title = activity.title || t('taskDetail.latestActivity.untitledTopic');- return activity.seq+ const topicText = activity.seq? t('taskDetail.latestActivity.topicWithSeq', { seq: activity.seq, title }): t('taskDetail.latestActivity.topic', { title });++ return activity.sourceTaskIdentifier+ ? t('taskDetail.latestActivity.topicFromSubtask', {+ identifier: activity.sourceTaskIdentifier,+ topic: topicText,+ })+ : topicText;}const briefTitle = activity.title || activity.summary;