π€― 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(brief-card): mute icon for resolved briefs on home page (#14452)
Arvin Xucc1e0d29d3bd
diff --git a/packages/builtin-tool-page-agent/src/client/Render/ModifyNodes/index.tsx b/packages/builtin-tool-page-agent/src/client/Render/ModifyNodes/index.tsxnew file mode 100644index 00000000000..199bcef24a3--- /dev/null+++ b/packages/builtin-tool-page-agent/src/client/Render/ModifyNodes/index.tsx@@ -0,0 +1,133 @@+'use client';++import type { ModifyNodesArgs, ModifyOperation } from '@lobechat/editor-runtime';+import type { BuiltinRenderProps } from '@lobechat/types';+import { Block, Icon, Text } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { Check, DiffIcon, Minus, Plus, X } from 'lucide-react';+import { memo } from 'react';++import type { ModifyNodesState } from '../../../types';++const styles = createStaticStyles(({ css, cssVar }) => ({+ content: css`+ overflow: hidden;+ flex: 1;++ min-width: 0;++ font-family: ${cssVar.fontFamilyCode};+ font-size: 12px;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ index: css`+ flex-shrink: 0;++ width: 18px;++ font-size: 12px;+ color: ${cssVar.colorTextQuaternary};+ text-align: end;+ `,+ position: css`+ flex-shrink: 0;++ padding-block: 1px;+ padding-inline: 6px;+ border-radius: 4px;++ font-family: ${cssVar.fontFamilyCode};+ font-size: 11px;+ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillTertiary};+ `,+ row: css`+ display: flex;+ gap: 8px;+ align-items: center;++ padding-block: 8px;+ padding-inline: 12px;+ border-block-end: 1px dashed ${cssVar.colorBorderSecondary};++ &:last-child {+ border-block-end: none;+ }+ `,+}));++const actionMeta = {+ insert: { color: cssVar.colorSuccess, icon: Plus },+ modify: { color: cssVar.colorWarning, icon: DiffIcon },+ remove: { color: cssVar.colorError, icon: Minus },+} as const;++const getOperationDetails = (op: ModifyOperation) => {+ switch (op.action) {+ case 'insert': {+ const position = 'afterId' in op ? `after #${op.afterId}` : `before #${op.beforeId}`;+ return { content: op.litexml, position };+ }+ case 'modify': {+ const litexml = Array.isArray(op.litexml) ? op.litexml.join('\n') : op.litexml;+ return { content: litexml };+ }+ case 'remove': {+ return { position: `#${op.id}` };+ }+ }+};++export const ModifyNodesRender = memo<BuiltinRenderProps<ModifyNodesArgs, ModifyNodesState>>(+ ({ args, pluginState }) => {+ const operations = args?.operations;+ if (!Array.isArray(operations) || operations.length === 0) return null;++ const results = pluginState?.results ?? [];++ return (+ <Block variant={'outlined'} width={'100%'}>+ {operations.map((op, index) => {+ const meta = actionMeta[op.action];+ const details = getOperationDetails(op);+ const result = results[index];+ const success = result?.success === true;+ const failed = result?.success === false;++ return (+ <div className={styles.row} key={index}>+ <span className={styles.index}>{index + 1}.</span>+ <Icon icon={meta.icon} size={14} style={{ color: meta.color, flexShrink: 0 }} />+ {details.position && <span className={styles.position}>{details.position}</span>}+ {details.content && <span className={styles.content}>{details.content}</span>}+ {success && (+ <Icon+ icon={Check}+ size={14}+ style={{ color: cssVar.colorSuccess, flexShrink: 0 }}+ />+ )}+ {failed && (+ <>+ <Icon icon={X} size={14} style={{ color: cssVar.colorError, flexShrink: 0 }} />+ {result?.error && (+ <Text as={'span'} fontSize={11} type={'danger'}>+ {result.error}+ </Text>+ )}+ </>+ )}+ </div>+ );+ })}+ </Block>+ );+ },+);++ModifyNodesRender.displayName = 'ModifyNodesRender';++export default ModifyNodesRender;diff --git a/packages/builtin-tool-page-agent/src/client/Render/index.ts b/packages/builtin-tool-page-agent/src/client/Render/index.tsindex 8de43cd7679..7da87391cde 100644--- a/packages/builtin-tool-page-agent/src/client/Render/index.ts+++ b/packages/builtin-tool-page-agent/src/client/Render/index.ts@@ -1,10 +1,14 @@+import type { BuiltinRender } from '@lobechat/types';+import { DocumentApiName } from '../../types';+import ModifyNodesRender from './ModifyNodes';/*** Page Agent Render Components Registry** Render components customize how tool results are displayed to users.*/-export const PageAgentRenders: Record<string, null> = {+export const PageAgentRenders: Record<string, BuiltinRender | null> = {[DocumentApiName.initPage]: null,+ [DocumentApiName.modifyNodes]: ModifyNodesRender as BuiltinRender,};diff --git a/packages/builtin-tools/src/renders.ts b/packages/builtin-tools/src/renders.tsindex d45071ee81d..92addbf7e29 100644--- a/packages/builtin-tools/src/renders.ts+++ b/packages/builtin-tools/src/renders.ts@@ -26,6 +26,7 @@ import {} from '@lobechat/builtin-tool-local-system/client';import { MemoryManifest, MemoryRenders } from '@lobechat/builtin-tool-memory/client';import { MessageManifest, MessageRenders } from '@lobechat/builtin-tool-message/client';+import { PageAgentManifest, PageAgentRenders } from '@lobechat/builtin-tool-page-agent/client';import { SkillStoreManifest, SkillStoreRenders } from '@lobechat/builtin-tool-skill-store/client';import { SkillsManifest, SkillsRenders } from '@lobechat/builtin-tool-skills/client';import { TaskManifest, TaskRenders } from '@lobechat/builtin-tool-task/client';@@ -64,6 +65,7 @@ const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {[MemoryManifest.identifier]: MemoryRenders as Record<string, BuiltinRender>,[MessageManifest.identifier]: MessageRenders as Record<string, BuiltinRender>,[NotebookIdentifier]: NotebookRenders,+ [PageAgentManifest.identifier]: PageAgentRenders as Record<string, BuiltinRender>,[SkillStoreManifest.identifier]: SkillStoreRenders as Record<string, BuiltinRender>,[SkillsManifest.identifier]: SkillsRenders as Record<string, BuiltinRender>,[TaskManifest.identifier]: TaskRenders as Record<string, BuiltinRender>,diff --git a/packages/types/src/task/index.ts b/packages/types/src/task/index.tsindex 0e284e81219..dbee11296aa 100644--- a/packages/types/src/task/index.ts+++ b/packages/types/src/task/index.ts@@ -236,8 +236,9 @@ export interface TaskDetailActivityAgent {export interface TaskDetailActivity {actions?: unknown;+ /** Brief-only: avatar of the agent that produced this brief; `null` when the agent is unknown or has been deleted. */+ agent?: TaskDetailActivityAgent | null;agentId?: string | null;- agents?: TaskDetailActivityAgent[];artifacts?: BriefArtifacts | null;author?: TaskDetailActivityAuthor;briefType?: string;diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskActivities.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskActivities.tsxindex 9cf51415bfc..bbb59b17a4a 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskActivities.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskActivities.tsx@@ -29,13 +29,15 @@ const toBriefItem = (act: TaskDetailActivity): BriefItem | null => {if (!act.id || !act.briefType) return null;return {actions: (act.actions ?? null) as BriefItem['actions'],+ agent: act.agent+ ? {+ avatar: act.agent.avatar,+ backgroundColor: act.agent.backgroundColor,+ id: act.agent.id,+ title: act.agent.title,+ }+ : null,agentId: act.agentId ?? null,- agents: (act.agents ?? []).map((a) => ({- avatar: a.avatar,- backgroundColor: a.backgroundColor,- id: a.id,- title: a.title,- })),artifacts: act.artifacts ?? null,createdAt: act.createdAt ?? act.time ?? new Date().toISOString(),cronJobId: act.cronJobId ?? null,diff --git a/src/features/DailyBrief/BriefCard.tsx b/src/features/DailyBrief/BriefCard.tsxindex 1fb4740dda4..67ae50a0df6 100644--- a/src/features/DailyBrief/BriefCard.tsx+++ b/src/features/DailyBrief/BriefCard.tsx@@ -17,27 +17,20 @@ import BriefIcon from './BriefIcon';import { styles } from './style';import { type AgentAvatarInfo, type BriefItem } from './types';-interface AgentAvatarsProps {- agents: AgentAvatarInfo[];+interface ProducingAgentAvatarProps {+ agent: AgentAvatarInfo;}-const AgentAvatars = memo<AgentAvatarsProps>(({ agents }) => {+const ProducingAgentAvatar = memo<ProducingAgentAvatarProps>(({ agent }) => {const { t } = useTranslation('common');- if (agents.length === 0) return null;-+ const isInbox = agent.id === INBOX_SESSION_ID;return (- <Avatar.Group- shadow+ <Avatar+ avatar={agent.avatar || (isInbox ? DEFAULT_INBOX_AVATAR : DEFAULT_AVATAR)}+ background={agent.backgroundColor || cssVar.colorBgContainer}+ shape={'circle'}size={28}- items={agents.map((agent, index) => {- const isInbox = agent?.id === INBOX_SESSION_ID;- return {- avatar: agent?.avatar || (isInbox ? DEFAULT_INBOX_AVATAR : DEFAULT_AVATAR),- background: agent.backgroundColor || cssVar.colorBgContainer,- key: agent.id || index.toString(),- title: agent?.title || (isInbox ? t('inbox.title', { ns: 'chat' }) : t('defaultSession')),- };- })}+ title={agent.title || (isInbox ? t('inbox.title', { ns: 'chat' }) : t('defaultSession'))}/>);});@@ -79,7 +72,7 @@ const BriefCard = memo<BriefCardProps>(onClick={canNavigate ? () => navigate(`/task/${brief.taskId}`) : undefined}><Flexbox horizontal align={'center'} gap={8} style={{ overflow: 'hidden' }}>- <BriefIcon type={brief.type} />+ <BriefIcon muted={isResolved} type={brief.type} /><Text ellipsis fontSize={16} style={{ flex: 1 }} weight={500}>{brief.title}</Text>@@ -92,7 +85,7 @@ const BriefCard = memo<BriefCardProps>(<Text className={styles.resolvedTag}>{t('brief.resolved')}</Text></Flexbox>)}- {brief.agents.length > 0 && <AgentAvatars agents={brief.agents} />}+ {brief.agent && <ProducingAgentAvatar agent={brief.agent} />}{isResolved && (<ActionIconicon={expanded ? ChevronUpIcon : ChevronDownIcon}diff --git a/src/server/routers/lambda/task.ts b/src/server/routers/lambda/task.tsindex 1b2fc360a6d..c5ffc863aef 100644--- a/src/server/routers/lambda/task.ts+++ b/src/server/routers/lambda/task.ts@@ -546,6 +546,7 @@ export const taskRouter = router({summary: `Task has been running without heartbeat update for more than ${task.heartbeatTimeout} seconds.`,taskId: task.id,title: `${task.identifier} heartbeat timeout`,+ trigger: 'task',type: 'error',});diff --git a/src/server/services/brief/index.test.ts b/src/server/services/brief/index.test.tsindex a23b223e4f8..7537a9e1310 100644--- a/src/server/services/brief/index.test.ts+++ b/src/server/services/brief/index.test.ts@@ -63,37 +63,33 @@ describe('BriefService', () => {mockTaskModel.findByIds.mockResolvedValue([]);});- it('should return briefs with empty agents when no taskIds', async () => {+ it('should return briefs with null agent when no taskIds and no agentIds', async () => {const service = new BriefService(db, userId);const briefs = [- { id: 'b1', taskId: null, title: 'Brief 1' },- { id: 'b2', taskId: null, title: 'Brief 2' },+ { agentId: null, id: 'b1', taskId: null, title: 'Brief 1' },+ { agentId: null, id: 'b2', taskId: null, title: 'Brief 2' },] as any[];const result = await service.enrichBriefsWithAgents(briefs);expect(result).toHaveLength(2);- expect(result[0].agents).toEqual([]);+ expect(result[0].agent).toBeNull();expect(result[0].taskStatus).toBeNull();- expect(result[1].agents).toEqual([]);+ expect(result[1].agent).toBeNull();expect(result[1].taskStatus).toBeNull();- expect(mockTaskModel.getTreeAgentIdsForTaskIds).not.toHaveBeenCalled();expect(mockTaskModel.findByIds).not.toHaveBeenCalled();+ expect(mockAgentModel.getAgentAvatarsByIds).not.toHaveBeenCalled();});- it('should enrich briefs with agent data and taskStatus from the parent task', async () => {+ it('should attach the producing agent and taskStatus from the parent task', async () => {const service = new BriefService(db, userId);const briefs = [- { id: 'b1', taskId: 'task-1', title: 'Brief 1' },- { id: 'b2', taskId: 'task-2', title: 'Brief 2' },+ { agentId: 'agent-a', id: 'b1', taskId: 'task-1', title: 'Brief 1' },+ { agentId: 'agent-c', id: 'b2', taskId: 'task-2', title: 'Brief 2' },] as any[];- mockTaskModel.getTreeAgentIdsForTaskIds.mockResolvedValue({- 'task-1': ['agent-a', 'agent-b'],- 'task-2': ['agent-b', 'agent-c'],- });mockTaskModel.findByIds.mockResolvedValue([{ id: 'task-1', status: 'scheduled' },{ id: 'task-2', status: 'paused' },@@ -101,35 +97,41 @@ describe('BriefService', () => {mockAgentModel.getAgentAvatarsByIds.mockResolvedValue([{ avatar: 'π€', backgroundColor: null, id: 'agent-a', title: 'Agent A' },- { avatar: 'π§ ', backgroundColor: '#fff', id: 'agent-b', title: 'Agent B' },{ avatar: 'π§', backgroundColor: null, id: 'agent-c', title: 'Agent C' },]);const result = await service.enrichBriefsWithAgents(briefs);- expect(result[0].agents).toHaveLength(2);+ expect(result[0].agent).toEqual({+ avatar: 'π€',+ backgroundColor: null,+ id: 'agent-a',+ title: 'Agent A',+ });expect(result[0].taskStatus).toBe('scheduled');- expect(result[1].agents).toHaveLength(2);+ expect(result[1].agent).toEqual({+ avatar: 'π§',+ backgroundColor: null,+ id: 'agent-c',+ title: 'Agent C',+ });expect(result[1].taskStatus).toBe('paused');- expect(mockTaskModel.getTreeAgentIdsForTaskIds).toHaveBeenCalledWith(['task-1', 'task-2']);+ expect(mockTaskModel.getTreeAgentIdsForTaskIds).not.toHaveBeenCalled();expect(mockTaskModel.findByIds).toHaveBeenCalledWith(['task-1', 'task-2']);expect(mockAgentModel.getAgentAvatarsByIds).toHaveBeenCalledWith(- expect.arrayContaining(['agent-a', 'agent-b', 'agent-c']),+ expect.arrayContaining(['agent-a', 'agent-c']),);});- it('should handle briefs with mixed null and non-null taskIds', async () => {+ it('should handle briefs with mixed null and non-null agentIds and taskIds', async () => {const service = new BriefService(db, userId);const briefs = [- { id: 'b1', taskId: 'task-1', title: 'With task' },- { id: 'b2', taskId: null, title: 'No task' },+ { agentId: 'agent-a', id: 'b1', taskId: 'task-1', title: 'With task' },+ { agentId: null, id: 'b2', taskId: null, title: 'No task' },] as any[];- mockTaskModel.getTreeAgentIdsForTaskIds.mockResolvedValue({- 'task-1': ['agent-a'],- });mockTaskModel.findByIds.mockResolvedValue([{ id: 'task-1', status: 'scheduled' }]);mockAgentModel.getAgentAvatarsByIds.mockResolvedValue([@@ -138,25 +140,32 @@ describe('BriefService', () => {const result = await service.enrichBriefsWithAgents(briefs);- expect(result[0].agents).toHaveLength(1);+ expect(result[0].agent).toEqual({+ avatar: 'π€',+ backgroundColor: null,+ id: 'agent-a',+ title: 'Agent A',+ });expect(result[0].taskStatus).toBe('scheduled');- expect(result[1].agents).toEqual([]);+ expect(result[1].agent).toBeNull();expect(result[1].taskStatus).toBeNull();});- it('should handle task with no agents in tree', async () => {+ it('should leave agent null when the producing agent has been deleted', async () => {const service = new BriefService(db, userId);- const briefs = [{ id: 'b1', taskId: 'task-1', title: 'Brief' }] as any[];+ const briefs = [+ { agentId: 'agent-gone', id: 'b1', taskId: 'task-1', title: 'Brief' },+ ] as any[];- mockTaskModel.getTreeAgentIdsForTaskIds.mockResolvedValue({});mockTaskModel.findByIds.mockResolvedValue([{ id: 'task-1', status: 'paused' }]);+ mockAgentModel.getAgentAvatarsByIds.mockResolvedValue([]);const result = await service.enrichBriefsWithAgents(briefs);- expect(result[0].agents).toEqual([]);+ expect(result[0].agent).toBeNull();expect(result[0].taskStatus).toBe('paused');- expect(mockAgentModel.getAgentAvatarsByIds).not.toHaveBeenCalled();+ expect(mockAgentModel.getAgentAvatarsByIds).toHaveBeenCalledWith(['agent-gone']);});});@@ -165,7 +174,7 @@ describe('BriefService', () => {const service = new BriefService(db, userId);mockBriefModel.list.mockResolvedValue({- briefs: [{ id: 'b1', taskId: null, title: 'Brief' }],+ briefs: [{ agentId: null, id: 'b1', taskId: null, title: 'Brief' }],total: 1,});@@ -173,7 +182,7 @@ describe('BriefService', () => {expect(result.total).toBe(1);expect(result.briefs).toHaveLength(1);- expect(result.briefs[0].agents).toEqual([]);+ expect(result.briefs[0].agent).toBeNull();expect(mockBriefModel.list).toHaveBeenCalledWith({ limit: 10, offset: 0 });});});@@ -183,13 +192,13 @@ describe('BriefService', () => {const service = new BriefService(db, userId);mockBriefModel.listUnresolved.mockResolvedValue([- { id: 'b1', taskId: null, title: 'Unresolved' },+ { agentId: null, id: 'b1', taskId: null, title: 'Unresolved' },]);const result = await service.listUnresolved();expect(result).toHaveLength(1);- expect(result[0].agents).toEqual([]);+ expect(result[0].agent).toBeNull();expect(mockBriefModel.listUnresolved).toHaveBeenCalled();});});diff --git a/src/server/services/brief/index.ts b/src/server/services/brief/index.tsindex 526637a58d5..b442e875800 100644--- a/src/server/services/brief/index.ts+++ b/src/server/services/brief/index.ts@@ -13,8 +13,9 @@ export interface AgentAvatarInfo {title: string | null;}-export type BriefWithAgents = BriefItem & {- agents: AgentAvatarInfo[];+export type BriefWithAgent = BriefItem & {+ /** Avatar of the agent that produced this brief; `null` when the brief has no `agentId` or the agent has been deleted. */+ agent: AgentAvatarInfo | null;/** Parent task's runtime status β `scheduled` marks a task parked between automated runs. */taskStatus: TaskStatus | null;};@@ -34,34 +35,30 @@ export class BriefService {this.taskModel = new TaskModel(db, userId);}- async enrichBriefsWithAgents(briefs: BriefItem[]): Promise<BriefWithAgents[]> {+ async enrichBriefsWithAgents(briefs: BriefItem[]): Promise<BriefWithAgent[]> {const taskIds = briefs.map((b) => b.taskId).filter((id): id is string => id !== null);+ const agentIds = [+ ...new Set(briefs.map((b) => b.agentId).filter((id): id is string => Boolean(id))),+ ];- if (taskIds.length === 0) {- return briefs.map((brief) => ({ ...brief, agents: [], taskStatus: null }));+ if (taskIds.length === 0 && agentIds.length === 0) {+ return briefs.map((brief) => ({ ...brief, agent: null, taskStatus: null }));}- const [taskAgentIdsMap, taskRows] = await Promise.all([- this.taskModel.getTreeAgentIdsForTaskIds(taskIds),- this.taskModel.findByIds(taskIds),+ const [taskRows, agentList] = await Promise.all([+ taskIds.length > 0 ? this.taskModel.findByIds(taskIds) : Promise.resolve([]),+ agentIds.length > 0 ? this.agentModel.getAgentAvatarsByIds(agentIds) : Promise.resolve([]),]);const taskStatusMap = Object.fromEntries(taskRows.map((t) => [t.id, (t.status as TaskStatus) ?? null]),);-- const allAgentIds = [...new Set(Object.values(taskAgentIdsMap).flat())];- let agentMap: Record<string, AgentAvatarInfo> = {};-- if (allAgentIds.length > 0) {- const agentList = await this.agentModel.getAgentAvatarsByIds(allAgentIds);- agentMap = Object.fromEntries(agentList.map((a) => [a.id, a]));- }+ const agentMap: Record<string, AgentAvatarInfo> = Object.fromEntries(+ agentList.map((a) => [a.id, a]),+ );return briefs.map((brief) => ({...brief,- agents: (brief.taskId ? taskAgentIdsMap[brief.taskId] || [] : [])- .map((id) => agentMap[id])- .filter(Boolean),+ agent: brief.agentId ? (agentMap[brief.agentId] ?? null) : null,taskStatus: brief.taskId ? (taskStatusMap[brief.taskId] ?? null) : null,}));}diff --git a/src/server/services/task/index.test.ts b/src/server/services/task/index.test.tsindex a3cf819cb9d..29ad725b565 100644--- a/src/server/services/task/index.test.ts+++ b/src/server/services/task/index.test.ts@@ -7,6 +7,7 @@ import { TaskModel } from '@/database/models/task';import { TaskTopicModel } from '@/database/models/taskTopic';import { UserModel } from '@/database/models/user';import type { LobeChatDatabase } from '@/database/type';+import { BriefService } from '@/server/services/brief';import { TaskService } from './index';@@ -992,7 +993,6 @@ describe('TaskService', () => {mockTaskModel.findByIds.mockResolvedValue([]);mockTaskModel.getCheckpointConfig.mockReturnValue({});mockTaskModel.getReviewConfig.mockReturnValue(undefined);- mockTaskModel.getTreeAgentIdsForTaskIds.mockResolvedValue({ task_001: ['agent-1'] });mockAgentModel.getAgentAvatarsByIds.mockResolvedValue([{ avatar: 'avatar.png', backgroundColor: '#fff', id: 'agent-1', title: 'Agent One' },]);@@ -1002,10 +1002,8 @@ describe('TaskService', () => {expect(result?.activities?.[0]).toMatchObject({actions: [{ key: 'approve', label: 'β ', type: 'resolve' }],+ agent: { avatar: 'avatar.png', backgroundColor: '#fff', id: 'agent-1', title: 'Agent One' },agentId: 'agent-1',- agents: [- { avatar: 'avatar.png', backgroundColor: '#fff', id: 'agent-1', title: 'Agent One' },- ],artifacts: ['doc_1'],briefType: 'decision',createdAt: '2024-01-01T00:00:00.000Z',@@ -1122,7 +1120,11 @@ describe('TaskService', () => {mockTaskModel.findByIds.mockResolvedValue([]);mockTaskModel.getCheckpointConfig.mockReturnValue({});mockTaskModel.getReviewConfig.mockReturnValue(undefined);- mockTaskModel.getTreeAgentIdsForTaskIds.mockRejectedValue(new Error('DB error'));+ // Force the brief enrichment path to reject without breaking the+ // sibling resolveAuthors call (which shares the agent model mock).+ const enrichSpy = vi+ .spyOn(BriefService.prototype, 'enrichBriefsWithAgents')+ .mockRejectedValueOnce(new Error('DB error'));const service = new TaskService(db, userId);const result = await service.getTaskDetail('TASK-1');@@ -1130,10 +1132,11 @@ describe('TaskService', () => {expect(result).not.toBeNull();expect(result?.activities).toHaveLength(1);expect(result?.activities?.[0]).toMatchObject({- agents: [],+ agent: null,id: 'brief-1',type: 'brief',});+ enrichSpy.mockRestore();});it('should use topic handoff title with fallback to Untitled', async () => {diff --git a/src/server/services/task/index.ts b/src/server/services/task/index.tsindex 8a78a9ef580..87f55c89358 100644--- a/src/server/services/task/index.ts+++ b/src/server/services/task/index.ts@@ -196,7 +196,7 @@ export class TaskService {this.resolveAuthors(agentIds, userIds),this.briefService.enrichBriefsWithAgents(briefs)- .catch(() => briefs.map((b) => ({ ...b, agents: [] }))),+ .catch(() => briefs.map((b) => ({ ...b, agent: null }))),]);const creatorId = task.createdByAgentId ?? task.createdByUserId;@@ -229,8 +229,8 @@ export class TaskService {}),...enrichedBriefs.map((b) => ({actions: b.actions ?? undefined,+ agent: b.agent,agentId: b.agentId,- agents: b.agents,artifacts: b.artifacts ?? undefined,author: b.agentId ? authorMap.get(b.agentId) : undefined,briefType: b.type,diff --git a/src/server/services/taskLifecycle/index.ts b/src/server/services/taskLifecycle/index.tsindex 64e5a567f17..b8daa52eb71 100644--- a/src/server/services/taskLifecycle/index.ts+++ b/src/server/services/taskLifecycle/index.ts@@ -176,6 +176,7 @@ export class TaskLifecycleService {summary: `Execution failed: ${errorMessage || 'Unknown error'}`,taskId,title: `${taskIdentifier} topic${topicRef} error`,+ trigger: 'task',type: 'error',});@@ -477,6 +478,7 @@ export class TaskLifecycleService {taskId,title: generated.title,topicId,+ trigger: 'task',type: briefType,});@@ -549,6 +551,7 @@ export class TaskLifecycleService {summary: `Review passed (score: ${reviewResult.overallScore}%, iteration: ${iteration}). ${content.slice(0, 150)}`,taskId,title: `${taskIdentifier} review passed`,+ trigger: 'task',type: 'result',});await this.taskModel.updateStatus(taskId, 'completed', { error: null });@@ -562,6 +565,7 @@ export class TaskLifecycleService {summary: `Review failed (score: ${reviewResult.overallScore}%, iteration ${iteration}/${reviewConfig.maxIterations}). Auto-retrying...`,taskId,title: `${taskIdentifier} review failed, retrying`,+ trigger: 'task',type: 'insight',});@@ -579,6 +583,7 @@ export class TaskLifecycleService {summary: `Review failed after ${iteration} iteration(s) (score: ${reviewResult.overallScore}%). Suggestions: ${reviewResult.suggestions?.join('; ') || 'none'}`,taskId,title: `${taskIdentifier} review failed β needs attention`,+ trigger: 'task',type: 'result',});await this.taskModel.updateStatus(taskId, 'paused', { error: null });diff --git a/src/server/workflows-hono/task/handlers/watchdog.ts b/src/server/workflows-hono/task/handlers/watchdog.tsindex e2c161af892..b86c84b908b 100644--- a/src/server/workflows-hono/task/handlers/watchdog.ts+++ b/src/server/workflows-hono/task/handlers/watchdog.ts@@ -36,6 +36,7 @@ export async function watchdog(c: Context) {summary: `Task has been running without heartbeat update for more than ${task.heartbeatTimeout} seconds.`,taskId: task.id,title: `${task.identifier} heartbeat timeout`,+ trigger: 'task',type: 'error',});diff --git a/src/store/brief/types.ts b/src/store/brief/types.tsindex 3d16bfad31d..f877376ae98 100644--- a/src/store/brief/types.ts+++ b/src/store/brief/types.ts@@ -14,8 +14,8 @@ export interface AgentAvatarInfo {export interface BriefItem {actions: BriefAction[] | null;+ agent: AgentAvatarInfo | null;agentId: string | null;- agents: AgentAvatarInfo[];artifacts: BriefArtifacts | null;createdAt: Date | string;cronJobId: string | null;