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.

🐛 fix(app,agent-signal): for skills, target to skill document, and auto refresh (#14457)

Nekoc3530ad221ad
diff --git a/src/features/Conversation/ChatList/components/AgentSignalReceiptList.test.tsx b/src/features/Conversation/ChatList/components/AgentSignalReceiptList.test.tsx
index eef92a41bc1..a0a4d84cd35 100644
--- a/src/features/Conversation/ChatList/components/AgentSignalReceiptList.test.tsx
+++ b/src/features/Conversation/ChatList/components/AgentSignalReceiptList.test.tsx
@@ -137,6 +137,39 @@ describe('AgentSignalReceiptList', () => {
expect(mocks.openDocument).toHaveBeenCalledWith('document-1');
});
+ it('opens skill receipt document refs while keeping the bundle target id for display metadata', () => {
+ render(
+ <AgentSignalReceiptList
+ receipts={[
+ {
+ agentId: 'agent-1',
+ createdAt: 1,
+ detail: 'Improved how this assistant handles similar requests',
+ id: 'receipt-1',
+ kind: 'skill',
+ sourceId: 'source-1',
+ sourceType: 'client.gateway.runtime_end',
+ status: 'updated',
+ target: {
+ agentDocumentId: 'index-agent-document-1',
+ documentId: 'index-document-1',
+ id: 'bundle-document-1',
+ title: 'GitHub PR review workflow',
+ type: 'skill',
+ },
+ title: 'Skill updated',
+ topicId: 'topic-1',
+ userId: 'user-1',
+ },
+ ]}
+ />,
+ );
+
+ fireEvent.click(screen.getByRole('button', { name: /GitHub PR review workflow/ }));
+
+ expect(mocks.openDocument).toHaveBeenCalledWith('index-document-1');
+ });
+
it('navigates memory receipts to the memory surface', () => {
render(
<AgentSignalReceiptList
diff --git a/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsx b/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsx
index 23331f154e1..bfeb08126ad 100644
--- a/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsx
+++ b/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsx
@@ -119,17 +119,19 @@ const AgentSignalReceiptItem = memo<AgentSignalReceiptItemProps>(({ receipt }) =
return;
}
- if (target?.type !== 'skill' || !target.id) return;
+ if (target?.type !== 'skill') return;
+ const documentId = target.documentId ?? target.id;
+ if (!documentId) return;
const pathname = globalThis.location?.pathname ?? '';
const pageMatch = PAGE_ROUTE_PATTERN.exec(pathname);
if (pageMatch?.[1] && pageMatch[2]) {
- navigate(`/agent/${pageMatch[1]}/${pageMatch[2]}/page/${target.id}`);
+ navigate(`/agent/${pageMatch[1]}/${pageMatch[2]}/page/${documentId}`);
return;
}
- openDocument(target.id);
+ openDocument(documentId);
}, [navigate, openDocument, target]);
return (
diff --git a/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.test.ts b/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.test.ts
index 89a4f2e6572..b70ee53d5fe 100644
--- a/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.test.ts
+++ b/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.test.ts
@@ -1,27 +1,52 @@
-import { renderHook, waitFor } from '@testing-library/react';
+import { act, renderHook, waitFor } from '@testing-library/react';
+import type { PropsWithChildren } from 'react';
+import { createElement } from 'react';
+import { SWRConfig } from 'swr';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { agentSignalService } from '@/services/agentSignal';
import { useAgentSignalReceipts } from './useAgentSignalReceipts';
+const { receipt } = vi.hoisted(() => ({
+ receipt: {
+ agentId: 'agent-1',
+ anchorMessageId: 'assistant-1',
+ createdAt: 1_700_000,
+ detail: 'Saved this for future replies',
+ id: 'receipt-1',
+ kind: 'memory' as const,
+ sourceId: 'source-1',
+ sourceType: 'client.gateway.runtime_end',
+ status: 'applied' as const,
+ title: 'Memory saved',
+ topicId: 'topic-1',
+ userId: 'user-1',
+ },
+}));
+
vi.mock('@/services/agentSignal', () => ({
agentSignalService: {
listReceipts: vi.fn().mockResolvedValue({
cursor: undefined,
- receipts: [{ anchorMessageId: 'assistant-1', id: 'receipt-1', kind: 'memory' }],
+ receipts: [receipt],
}),
},
}));
describe('useAgentSignalReceipts', () => {
+ const wrapper = ({ children }: PropsWithChildren) =>
+ createElement(SWRConfig, { value: { provider: () => new Map() } }, children);
+
beforeEach(() => {
vi.clearAllMocks();
+ vi.useRealTimers();
});
it('groups receipts by anchor and keeps unanchored receipts separate', async () => {
- const { result } = renderHook(() =>
- useAgentSignalReceipts({ agentId: 'agent-1', enabled: true, topicId: 'topic-1' }),
+ const { result } = renderHook(
+ () => useAgentSignalReceipts({ agentId: 'agent-1', enabled: true, topicId: 'topic-1' }),
+ { wrapper },
);
await waitFor(() => {
@@ -37,10 +62,46 @@ describe('useAgentSignalReceipts', () => {
});
it('does not fetch receipts when the feature flag is disabled', async () => {
- renderHook(() =>
- useAgentSignalReceipts({ agentId: 'agent-1', enabled: false, topicId: 'topic-1' }),
+ renderHook(
+ () => useAgentSignalReceipts({ agentId: 'agent-1', enabled: false, topicId: 'topic-1' }),
+ { wrapper },
);
expect(agentSignalService.listReceipts).not.toHaveBeenCalled();
});
+
+ it('keeps refreshing receipts while the current topic is mounted', async () => {
+ vi.useFakeTimers();
+ vi.mocked(agentSignalService.listReceipts)
+ .mockResolvedValueOnce({
+ cursor: undefined,
+ receipts: [receipt],
+ })
+ .mockResolvedValueOnce({
+ cursor: undefined,
+ receipts: [],
+ });
+
+ renderHook(
+ () => useAgentSignalReceipts({ agentId: 'agent-1', enabled: true, topicId: 'topic-1' }),
+ { wrapper },
+ );
+
+ await act(async () => {
+ await Promise.resolve();
+ });
+ expect(agentSignalService.listReceipts).toHaveBeenCalledTimes(1);
+
+ await act(async () => {
+ await vi.advanceTimersByTimeAsync(3000);
+ });
+
+ expect(agentSignalService.listReceipts).toHaveBeenCalledTimes(2);
+ expect(agentSignalService.listReceipts).toHaveBeenLastCalledWith({
+ agentId: 'agent-1',
+ limit: 20,
+ sinceCreatedAt: 1_700_000,
+ topicId: 'topic-1',
+ });
+ });
});
diff --git a/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.ts b/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.ts
index 4634cba744c..5f18a46f679 100644
--- a/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.ts
+++ b/src/features/Conversation/ChatList/hooks/useAgentSignalReceipts.ts
@@ -1,7 +1,11 @@
+import { useRef } from 'react';
import useSWR from 'swr';
import { agentSignalService } from '@/services/agentSignal';
+/** Poll cadence for the active conversation's Agent Signal receipt surface. */
+const AGENT_SIGNAL_RECEIPT_REFRESH_INTERVAL_MS = 3000;
+
export type AgentSignalReceiptView = Awaited<
ReturnType<typeof agentSignalService.listReceipts>
>['receipts'][number];
@@ -13,15 +17,47 @@ export const useAgentSignalReceipts = (input: {
}) => {
// TODO: Migrate Agent Signal receipt visibility to a dedicated product capability flag.
const shouldFetch = input.enabled === true && Boolean(input.agentId && input.topicId);
+ const scopeKey = shouldFetch ? `${input.agentId}:${input.topicId}` : undefined;
+ const scopeKeyRef = useRef<string | undefined>(undefined);
+ const latestCreatedAtRef = useRef<number | undefined>(undefined);
+ const receiptsRef = useRef<AgentSignalReceiptView[]>([]);
+
+ if (scopeKeyRef.current !== scopeKey) {
+ scopeKeyRef.current = scopeKey;
+ latestCreatedAtRef.current = undefined;
+ receiptsRef.current = [];
+ }
+
const { data, isLoading } = useSWR(
shouldFetch ? ['agentSignalReceipts', input.agentId, input.topicId] : null,
- () =>
- agentSignalService.listReceipts({
+ async () => {
+ const result = await agentSignalService.listReceipts({
agentId: input.agentId!,
limit: 20,
+ ...(latestCreatedAtRef.current === undefined
+ ? {}
+ : { sinceCreatedAt: latestCreatedAtRef.current }),
topicId: input.topicId!,
- }),
+ });
+
+ const nextReceipts =
+ latestCreatedAtRef.current === undefined
+ ? result.receipts
+ : mergeReceiptRefresh(receiptsRef.current, result.receipts);
+ const latestCreatedAt = nextReceipts[0]?.createdAt;
+
+ receiptsRef.current = nextReceipts;
+ latestCreatedAtRef.current =
+ latestCreatedAt === undefined ? latestCreatedAtRef.current : latestCreatedAt;
+
+ return {
+ ...result,
+ receipts: nextReceipts,
+ };
+ },
{
+ refreshInterval: shouldFetch ? AGENT_SIGNAL_RECEIPT_REFRESH_INTERVAL_MS : 0,
+ refreshWhenHidden: false,
revalidateOnFocus: false,
},
);
@@ -49,3 +85,16 @@ export const useAgentSignalReceipts = (input: {
unanchoredReceipts,
};
};
+
+const mergeReceiptRefresh = (
+ currentReceipts: AgentSignalReceiptView[],
+ newReceipts: AgentSignalReceiptView[],
+) => {
+ if (newReceipts.length === 0) return currentReceipts;
+
+ const existingIds = new Set(currentReceipts.map((receipt) => receipt.id));
+
+ return [...newReceipts.filter((receipt) => !existingIds.has(receipt.id)), ...currentReceipts]
+ .sort((a, b) => b.createdAt - a.createdAt)
+ .slice(0, 20);
+};
diff --git a/src/server/routers/lambda/agentSignal.test.ts b/src/server/routers/lambda/agentSignal.test.ts
index 8a3ed32dda4..29395abc5dc 100644
--- a/src/server/routers/lambda/agentSignal.test.ts
+++ b/src/server/routers/lambda/agentSignal.test.ts
@@ -86,7 +86,12 @@ describe('agentSignalRouter', () => {
it('lists receipts for the current user topic', async () => {
await expect(
- router.listReceipts({ agentId: 'agent-1', limit: 20, topicId: 'topic-1' }),
+ router.listReceipts({
+ agentId: 'agent-1',
+ limit: 20,
+ sinceCreatedAt: 1_700_000,
+ topicId: 'topic-1',
+ }),
).resolves.toEqual({
cursor: undefined,
receipts: [
@@ -103,6 +108,7 @@ describe('agentSignalRouter', () => {
agentId: 'agent-1',
cursor: undefined,
limit: 20,
+ sinceCreatedAt: 1_700_000,
topicId: 'topic-1',
userId: 'user-1',
});
diff --git a/src/server/routers/lambda/agentSignal.ts b/src/server/routers/lambda/agentSignal.ts
index ebdd430b2fd..836b9069e72 100644
--- a/src/server/routers/lambda/agentSignal.ts
+++ b/src/server/routers/lambda/agentSignal.ts
@@ -50,6 +50,7 @@ export const agentSignalRouter = router({
agentId: z.string().min(1),
cursor: z.number().int().min(0).optional(),
limit: z.number().int().min(1).max(50).default(20),
+ sinceCreatedAt: z.number().int().min(0).optional(),
topicId: z.string().min(1),
}),
)
@@ -58,6 +59,7 @@ export const agentSignalRouter = router({
agentId: input.agentId,
cursor: input.cursor,
limit: input.limit,
+ sinceCreatedAt: input.sinceCreatedAt,
topicId: input.topicId,
userId: ctx.userId,
});
diff --git a/src/server/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts b/src/server/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts
index dd8dc3654d2..6c9d0dbe30e 100644
--- a/src/server/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts
+++ b/src/server/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts
@@ -119,6 +119,8 @@ export interface SkillManagementActionResult {
}
export interface SkillManagementActionTarget {
+ agentDocumentId?: string;
+ documentId?: string;
id: string;
summary?: string;
title: string;
@@ -1210,8 +1212,10 @@ const isMaintainerDecision = (
decision.action === 'refine' || decision.action === 'consolidate';
const toSkillActionTarget = (
- skill: Pick<SkillSummary, 'bundle' | 'description' | 'title'>,
+ skill: Pick<SkillSummary, 'bundle' | 'description' | 'index' | 'title'>,
): SkillManagementActionTarget => ({
+ agentDocumentId: skill.index.agentDocumentId,
+ documentId: skill.index.documentId,
id: skill.bundle.documentId,
summary: skill.description,
title: skill.title,
diff --git a/src/server/services/agentSignal/services/__tests__/receiptService.test.ts b/src/server/services/agentSignal/services/__tests__/receiptService.test.ts
index 0773a0de839..fe87856d2e3 100644
--- a/src/server/services/agentSignal/services/__tests__/receiptService.test.ts
+++ b/src/server/services/agentSignal/services/__tests__/receiptService.test.ts
@@ -121,6 +121,8 @@ describe('projectAgentSignalReceipts', () => {
actionId: 'action-skill-1',
output: {
target: {
+ agentDocumentId: 'index-agent-document-1',
+ documentId: 'index-document-1',
id: 'document-1',
summary: 'Review metadata before diff and produce a merge decision.',
title: 'GitHub PR review workflow',
@@ -137,6 +139,8 @@ describe('projectAgentSignalReceipts', () => {
{
kind: 'skill',
target: {
+ agentDocumentId: 'index-agent-document-1',
+ documentId: 'index-document-1',
id: 'document-1',
summary: 'Review metadata before diff and produce a merge decision.',
title: 'GitHub PR review workflow',
diff --git a/src/server/services/agentSignal/services/receiptService.ts b/src/server/services/agentSignal/services/receiptService.ts
index dc3cd13490d..2369746df51 100644
--- a/src/server/services/agentSignal/services/receiptService.ts
+++ b/src/server/services/agentSignal/services/receiptService.ts
@@ -69,6 +69,10 @@ export interface AgentSignalReceipt {
status: 'applied' | 'completed' | 'failed' | 'proposed' | 'skipped' | 'updated';
/** Snapshot of the resource affected when the receipt was produced. */
target?: {
+ /** Agent-document binding id for the concrete resource that should be opened. */
+ agentDocumentId?: string;
+ /** Backing document id for the concrete resource that should be opened in document UIs. */
+ documentId?: string;
/** Backing resource id for future navigation when still available. Skill ids use `documents.id`. */
id?: string;
/** Short summary captured at write time. */
@@ -94,6 +98,8 @@ export interface AgentSignalReceiptListInput {
cursor?: number;
/** Maximum receipt count to return. */
limit: number;
+ /** Exclusive lower createdAt boundary for polling only newer receipts. */
+ sinceCreatedAt?: number;
/** Topic whose receipts should be listed. */
topicId: string;
/** Current authenticated user. */
@@ -220,6 +226,12 @@ const getReceiptTarget = (
if (title) {
return {
+ ...(typeof payload.agentDocumentId === 'string' && payload.agentDocumentId.length > 0
+ ? { agentDocumentId: payload.agentDocumentId }
+ : {}),
+ ...(typeof payload.documentId === 'string' && payload.documentId.length > 0
+ ? { documentId: payload.documentId }
+ : {}),
...(typeof payload.id === 'string' && payload.id.length > 0 ? { id: payload.id } : {}),
...(typeof payload.summary === 'string' && payload.summary.length > 0
? { summary: payload.summary }
diff --git a/src/server/services/agentSignal/store/__tests__/redisReceiptStore.test.ts b/src/server/services/agentSignal/store/__tests__/redisReceiptStore.test.ts
index 20b00fe3106..ce15194819e 100644
--- a/src/server/services/agentSignal/store/__tests__/redisReceiptStore.test.ts
+++ b/src/server/services/agentSignal/store/__tests__/redisReceiptStore.test.ts
@@ -101,6 +101,76 @@ describe('redis receipt store', () => {
);
});
+ it('round-trips skill receipt target document refs', async () => {
+ const store = await loadStore();
+ const skillReceipt = {
+ ...receipt,
+ detail: 'Improved how this assistant handles similar requests',
+ id: 'receipt-skill-1',
+ kind: 'skill' as const,
+ status: 'updated' as const,
+ target: {
+ agentDocumentId: 'index-agent-document-1',
+ documentId: 'index-document-1',
+ id: 'bundle-document-1',
+ summary: 'Review metadata, diff, blockers, and merge status.',
+ title: 'GitHub PR review workflow',
+ type: 'skill' as const,
+ },
+ title: 'Skill updated',
+ };
+
+ await store.appendReceipt(skillReceipt, 259_200);
+
+ await expect(
+ store.listReceipts({ agentId: 'agent-1', limit: 10, topicId: 'topic-1', userId: 'user-1' }),
+ ).resolves.toMatchObject({
+ receipts: [
+ {
+ target: {
+ agentDocumentId: 'index-agent-document-1',
+ documentId: 'index-document-1',
+ id: 'bundle-document-1',
+ title: 'GitHub PR review workflow',
+ type: 'skill',
+ },
+ },
+ ],
+ });
+ });
+
+ it('lists receipts created after a known timestamp for refresh polling', async () => {
+ const store = await loadStore();
+
+ await store.appendReceipt(receipt, 259_200);
+ await store.appendReceipt({ ...receipt, createdAt: 1_700_010, id: 'receipt-2' }, 259_200);
+ await store.appendReceipt({ ...receipt, createdAt: 1_700_020, id: 'receipt-3' }, 259_200);
+
+ await expect(
+ store.listReceipts({
+ agentId: 'agent-1',
+ limit: 10,
+ sinceCreatedAt: 1_700_010,
+ topicId: 'topic-1',
+ userId: 'user-1',
+ }),
+ ).resolves.toEqual({
+ cursor: undefined,
+ receipts: [{ ...receipt, createdAt: 1_700_020, id: 'receipt-3' }],
+ });
+
+ expect(mockRedis.zrange).toHaveBeenCalledWith(
+ 'agent-signal:receipts:user:user-1:agent:agent-1:topic:topic-1',
+ '+inf',
+ '(1700010',
+ 'BYSCORE',
+ 'REV',
+ 'LIMIT',
+ 0,
+ 11,
+ );
+ });
+
it('dedupes repeated receipt appends', async () => {
const store = await loadStore();
diff --git a/src/server/services/agentSignal/store/__tests__/redisTestUtils.ts b/src/server/services/agentSignal/store/__tests__/redisTestUtils.ts
index f0a0842ffed..1d613c12ccc 100644
--- a/src/server/services/agentSignal/store/__tests__/redisTestUtils.ts
+++ b/src/server/services/agentSignal/store/__tests__/redisTestUtils.ts
@@ -56,6 +56,7 @@ const createMockRedisClient = () => {
unwatch: vi.fn(),
watch: vi.fn(),
zadd: vi.fn(),
+ zrange: vi.fn(),
zrem: vi.fn(),
zrevrange: vi.fn(),
};
@@ -124,6 +125,50 @@ const installRedisClientBehavior = (client: typeof mockRedis) => {
return 1;
});
+ client.zrange.mockImplementation(
+ async (
+ key: string,
+ min: number | string,
+ max: number | string,
+ ...args: Array<number | string>
+ ) => {
+ const entries = [...(sortedSets.get(key)?.entries() ?? [])];
+ const byScore = args.includes('BYSCORE');
+ const rev = args.includes('REV');
+ const limitIndex = args.indexOf('LIMIT');
+ const offset = typeof args[limitIndex + 1] === 'number' ? Number(args[limitIndex + 1]) : 0;
+ const count =
+ typeof args[limitIndex + 2] === 'number' ? Number(args[limitIndex + 2]) : entries.length;
+
+ if (!byScore) {
+ return entries.map(([member]) => member);
+ }
+
+ const parseBoundary = (value: number | string) => {
+ if (typeof value === 'number') return { exclusive: false, value };
+ if (value === '+inf') return { exclusive: false, value: Number.POSITIVE_INFINITY };
+ if (value === '-inf') return { exclusive: false, value: Number.NEGATIVE_INFINITY };
+ if (value.startsWith('(')) {
+ return { exclusive: true, value: Number(value.slice(1)) };
+ }
+
+ return { exclusive: false, value: Number(value) };
+ };
+
+ const lower = parseBoundary(rev ? max : min);
+ const upper = parseBoundary(rev ? min : max);
+ const filtered = entries
+ .filter(([, score]) => {
+ const aboveLower = lower.exclusive ? score > lower.value : score >= lower.value;
+ const belowUpper = upper.exclusive ? score < upper.value : score <= upper.value;
+
+ return aboveLower && belowUpper;
+ })
+ .sort((a, b) => (rev ? b[1] - a[1] : a[1] - b[1]));
+
+ return filtered.slice(offset, offset + count).map(([member]) => member);
+ },
+ );
client.zrem.mockImplementation(async (key: string, ...members: string[]) => {
const current = sortedSets.get(key) ?? new Map<string, number>();
let removed = 0;
diff --git a/src/server/services/agentSignal/store/adapters/redis/receiptStore.ts b/src/server/services/agentSignal/store/adapters/redis/receiptStore.ts
index 64edabed0c2..5bbb31f13be 100644
--- a/src/server/services/agentSignal/store/adapters/redis/receiptStore.ts
+++ b/src/server/services/agentSignal/store/adapters/redis/receiptStore.ts
@@ -31,6 +31,12 @@ const parseReceiptTarget = (value?: string): AgentSignalReceipt['target'] | unde
if (typeof target.title !== 'string' || target.title.length === 0) return;
return {
+ ...(typeof target.agentDocumentId === 'string' && target.agentDocumentId.length > 0
+ ? { agentDocumentId: target.agentDocumentId }
+ : {}),
+ ...(typeof target.documentId === 'string' && target.documentId.length > 0
+ ? { documentId: target.documentId }
+ : {}),
...(typeof target.id === 'string' && target.id.length > 0 ? { id: target.id } : {}),
...(typeof target.summary === 'string' && target.summary.length > 0
? { summary: target.summary }
@@ -134,7 +140,19 @@ export const listReceipts: AgentSignalReceiptStore['listReceipts'] = async (inpu
const indexKey = AGENT_SIGNAL_KEYS.receiptIndex(input);
const start = input.cursor ?? 0;
const stop = start + input.limit;
- const ids = await redis.zrevrange(indexKey, start, stop);
+ const ids =
+ input.sinceCreatedAt === undefined
+ ? await redis.zrevrange(indexKey, start, stop)
+ : await redis.zrange(
+ indexKey,
+ '+inf',
+ `(${input.sinceCreatedAt}`,
+ 'BYSCORE',
+ 'REV',
+ 'LIMIT',
+ 0,
+ input.limit + 1,
+ );
const receipts: AgentSignalReceipt[] = [];
const missingIds: string[] = [];
@@ -161,7 +179,10 @@ export const listReceipts: AgentSignalReceiptStore['listReceipts'] = async (inpu
}
return {
- cursor: ids.length > input.limit ? start + input.limit : undefined,
+ cursor:
+ input.sinceCreatedAt === undefined && ids.length > input.limit
+ ? start + input.limit
+ : undefined,
receipts,
};
};
diff --git a/src/services/agentSignal.ts b/src/services/agentSignal.ts
index a690c59ad8e..a6ff0365686 100644
--- a/src/services/agentSignal.ts
+++ b/src/services/agentSignal.ts
@@ -14,6 +14,7 @@ export interface ListAgentSignalReceiptsParams {
agentId: string;
cursor?: number;
limit?: number;
+ sinceCreatedAt?: number;
topicId: string;
}