Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(bots): simplify refreshes of loaded thread shares

Dash1501aaf8c772
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
index 66e2f97edb..9b6f71d444 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
@@ -1578,6 +1578,31 @@ describe('Chat Server result delivery and refresh', () => {
fixture.handle.mockImplementation(threadResponse);
});
+ it.each([undefined, ' '])('uses the ordinary attachment name for caption %s in previews and share fallback', async caption => {
+ const source = msg(botReply, 2, botId, { threadRootId: rootId, content: [{ type: 'media', mediaId: '80000000-0000-4000-8000-000000000001', caption }] });
+ fixture.handle.mockImplementation((route, method, body) => {
+ if (route.endsWith('/snapshot')) return { body: { room: room(roomId), members, messages: [source, root], cursor: '8' } };
+ if (route.endsWith(`/messages/${botReply}`)) return { body: source };
+ return threadResponse(route, method, body);
+ });
+ const result = await service.getGroup(roomId);
+ if (!result.ok) throw new Error('Expected group');
+ expect(result.group.messages.find(m => m.id === rootId)!.threadPreview!.replies[0]!.attachments)
+ .toEqual([{ name: 'Attachment', category: 'file' }]);
+ expect((await service.chatServer!.shareToMain({ groupId: roomId, messageId: botReply })).ok).toBe(true);
+ const posted = fixture.handle.mock.calls.find(([route, method]) => route === `/conversations/${roomId}/messages` && method === 'POST')![2];
+ expect(posted).toMatchObject({ content: [{ fallback: '↪ Bot (Me): Attachment' }] });
+ });
+
+ it('resolves every loaded old reference without a 200-card cutoff', async () => {
+ const shownShares = Array.from({ length: 201 }, (_, i) => ({ id: `90000000-0000-4000-8000-${String(i + 100).padStart(12, '0')}`, messageId: botReply, threadRootId: rootId }));
+ const result = await service.getGroup(roomId, { shownShares });
+ expect(result.ok).toBe(true);
+ if (!result.ok) return;
+ expect(Object.keys(result.group.threadShareUpdates!)).toHaveLength(201);
+ expect(Object.values(result.group.threadShareUpdates!).every(share => share.status === 'available')).toBe(true);
+ });
+
it('previews the newest replies and resolves each share from the server copy, not the card', async () => {
const result = await service.getGroup(roomId);
if (!result.ok) throw new Error('Expected group');
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServerThreads.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServerThreads.test.ts
index b2a1bad8a0..8887a97548 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServerThreads.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServerThreads.test.ts
@@ -270,7 +270,7 @@ describe('reply summaries', () => {
it('summarizes text separately from files and refuses system or deleted replies', () => {
const files = reply('f', rootA, { content: [{ type: 'text', text: ' 第一行\n第二行 ' }, { type: 'media', mediaId: 'm1', caption: 'shot.PNG' }, { type: 'media', mediaId: 'm2', caption: 'notes.pdf' }] });
expect(threadPreviewText(files)).toBe('第一行 第二行');
- expect(threadPreviewAttachments(files)).toEqual([{ name: 'shot.PNG', category: 'image' }, { name: 'notes.pdf', category: 'file' }]);
+ expect(threadPreviewAttachments(files, block => block.caption!)).toEqual([{ name: 'shot.PNG', category: 'image' }, { name: 'notes.pdf', category: 'file' }]);
expect(threadPreviewText(reply('long', rootA, { content: [{ type: 'text', text: 'x'.repeat(400) }] }))).toHaveLength(280);
expect(isShareableThreadReply(files)).toBe(true);
expect(isShareableThreadReply(message({ id: 'root' }))).toBe(false);
diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.ts
index 82893f60d1..dbddf14e13 100644
--- a/apps/desktop/src/main/maker-ipc/chatServer.ts
+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts
@@ -32,7 +32,7 @@ import {
isBotGroupRuntimeFailureCode, type BotGroupRuntimeFailureCode,
readImportedBotGroupRuntimeFailureCode,
readBotGroupExecutionFailure, type BotGroupExecutionFailureView,
- buildBotGroupThreadShareCard, botGroupThreadShareOperationId, readBotGroupThreadShareCard, BOT_GROUP_SHOWN_SHARES_MAX,
+ buildBotGroupThreadShareCard, botGroupThreadShareOperationId, readBotGroupThreadShareCard,
type BotGroupThreadShareView,
type BotGroupDetail, type BotGroupPlanView, type BotGroupFailure, type BotGroupMessageView, type BotGroupAttachment, type ChatServerApi,
botGroupQuoteAttachmentName, botGroupQuoteExcerpt, botGroupQuoteFromMessage, buildBotGroupQuoteCard, readBotGroupQuote, readBotGroupQuoteCard, type BotGroupQuoteView,
@@ -783,7 +783,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD
const replyView = messageView(reply, members);
return replyView.kind === 'message' ? [{ id: reply.id, authorKind: replyView.authorKind, authorBotId: replyView.authorBotId,
authorName: replyView.authorName, isSelf: replyView.isSelf, text: threadPreviewText(reply),
- attachments: threadPreviewAttachments(reply), createdAt: replyView.createdAt }] : [];
+ attachments: threadPreviewAttachments(reply, attachmentName), createdAt: replyView.createdAt }] : [];
});
if (replies?.length) view.threadPreview = { replies };
const card = readBotGroupThreadShareCard(message);
@@ -797,7 +797,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD
id.parse(roomId);
const o = z.object({ beforeSequence: z.number().int().positive().optional(), limit: z.number().int().min(1).max(100).optional(),
sourceMessageIds: z.array(id).optional(),
- shownShares: z.array(z.object({ id, messageId: id, threadRootId: id, sharerId: z.string().min(1).max(200).optional() })).max(BOT_GROUP_SHOWN_SHARES_MAX).optional() }).parse(options ?? {});
+ shownShares: z.array(z.object({ id, messageId: id, threadRootId: id, sharerId: z.string().min(1).max(200).optional() })).optional() }).parse(options ?? {});
const query = new URLSearchParams({ limit: String(o.limit ?? 100) });
if (o.beforeSequence) query.set('before', String(o.beforeSequence));
// Independent reads share a round trip. Each is awaited in the former serial order, so the
@@ -1459,7 +1459,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD
const author = members.find(member => member.id === source.authorId);
const card = buildBotGroupThreadShareCard({ messageId: source.id, threadRootId: source.threadRootId!,
authorName: author ? memberName(author) : source.author.name,
- text: threadPreviewText(source) || threadPreviewAttachments(source).map(file => file.name).join(', ') });
+ text: threadPreviewText(source) || threadPreviewAttachments(source, attachmentName).map(file => file.name).join(', ') });
try {
const posted = await api<{ id: string }>(`/conversations/${room}/messages`, 'POST', {
operationId: botGroupThreadShareOperationId(source.id), content: [card],
diff --git a/apps/desktop/src/main/maker-ipc/chatServerThreads.ts b/apps/desktop/src/main/maker-ipc/chatServerThreads.ts
index 2ea97719bc..b277eb865d 100644
--- a/apps/desktop/src/main/maker-ipc/chatServerThreads.ts
+++ b/apps/desktop/src/main/maker-ipc/chatServerThreads.ts
@@ -234,9 +234,9 @@ export function threadPreviewText(message: ThreadMessage): string {
.replace(/\s+/g, ' ').trim().slice(0, 280);
}
-export function threadPreviewAttachments(message: ThreadMessage) {
+export function threadPreviewAttachments(message: ThreadMessage, attachmentName: (block: ThreadMessage['content'][number]) => string) {
return message.content.flatMap(block => block.type === 'media' && block.mediaId ? [{
- name: block.caption ?? '',
+ name: attachmentName(block),
category: /\.(png|jpe?g|gif|webp|heic|heif|bmp|svg)$/i.test(block.caption ?? '') ? 'image' as const : 'file' as const,
}] : []);
}
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
index 538ac00e50..7186eb0119 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
@@ -79,7 +79,7 @@ import { animateThreadPanelWidth, ChatThreadPanel } from './ChatThreadPanel';
import { BotGroupThreadPreview, BotGroupThreadShareQuote, botGroupThreadShareLabel, findThreadMessageElement, flashThreadTarget } from './BotGroupThreadViews';
import { BotGroupPendingInteraction } from './BotGroupPendingInteraction';
import { BotGroupRuntimeFailureNotice } from './BotGroupRuntimeFailureNotice';
-import { BOT_GROUP_SHOWN_SHARES_MAX, isBotGroupRuntimeFailureCode } from '../../../shared/botGroupChat';
+import { isBotGroupRuntimeFailureCode } from '../../../shared/botGroupChat';
import {
BotGroupHandoffFiles,
BotGroupOrganizerTag,
@@ -213,8 +213,6 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {
const [planPending, setPlanPending] = useState<PlanPending | null>(null);
const planPendingRef = useRef(false);
const loadRef = useRef<(additionalSources?: string[]) => void>(() => {});
- /** Refresh results applied so far; share follow-ups wait for the next one. */
- const loadResults = useRef(0);
const scrollRef = useRef<HTMLDivElement>(null);
const contentRef = useRef<HTMLDivElement>(null);
const stickToBottomRef = useRef(true);
@@ -259,7 +257,7 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {
const sourceMessageIds = [...new Set([...(shown
? mergeBotGroupMessages(displayed.older, displayed.group.messages).map(message => message.id) : []), ...additionalSources])];
// Older pages are not re-read, so their shares ask for the reply's current state.
- const shownShares = shown ? botGroupShownShares(displayed.older, displayed.group.threadShareVersion) : [];
+ const shownShares = shown ? botGroupShownShares(displayed.older) : [];
const result = sourceMessageIds.length || shownShares.length
? await api.getBotGroup(groupId, { sourceMessageIds, ...(shownShares.length ? { shownShares } : {}) })
: await api.getBotGroup(groupId);
@@ -278,7 +276,6 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {
readToken,
},
);
- loadResults.current += 1;
const shown = stateRef.current;
if (shown.kind === 'ready') {
const targets = quotedOlderOriginals(shown.older, result.group.messages);
@@ -371,24 +368,14 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {
};
}, [groupId, reloadVersion]);
- // Older shares checked before the latest edit, deletion or reset are re-checked from the
- // committed timeline, whichever of a refresh and an older page landed last. One refresh
- // checks up to the per-read cap, so a bounded number of follow-ups reaches all of them.
- // Each version gets its own budget: an edit mid-way makes every card stale again. One
- // follow-up at a time: other commits (an older page, a quote check) wait until a refresh
- // result lands instead of spending the budget on reads that would replace it.
- const shareFollowUps = useRef<{ version: number | undefined; count: number; awaiting: number | null }>({ version: undefined, count: 0, awaiting: null });
+ // An older page may land across a refresh. Recheck that set once per version; source
+ // and attachment completion pushes then refresh every displayed share together.
+ // The derived key stays unchanged if a read cannot confirm a source, avoiding a loop.
+ const staleSharesKey = state.kind === 'ready' && staleBotGroupShares(state.older, state.group.threadShareVersion).length
+ ? JSON.stringify([state.group.threadShareVersion, staleBotGroupShares(state.older, state.group.threadShareVersion).map(message => message.id)]) : '';
useEffect(() => {
- const version = state.kind === 'ready' ? state.group.threadShareVersion : undefined;
- if (shareFollowUps.current.version !== version) shareFollowUps.current = { version, count: 0, awaiting: null };
- if (state.kind !== 'ready' || !staleBotGroupShares(state.older, version).length) { shareFollowUps.current.count = 0; return; }
- if (shareFollowUps.current.awaiting === loadResults.current) return;
- const total = state.older.filter(message => message.threadShare).length;
- if (shareFollowUps.current.count >= Math.ceil(total / BOT_GROUP_SHOWN_SHARES_MAX) + 1) return;
- shareFollowUps.current.count += 1;
- shareFollowUps.current.awaiting = loadResults.current;
- loadRef.current();
- }, [state]);
+ if (staleSharesKey) loadRef.current();
+ }, [staleSharesKey]);
const group = state.kind === 'ready' ? state.group : null;
// Until the timeline arrives, the header comes from the group's sidebar row (same account).
@@ -1099,16 +1086,9 @@ function staleBotGroupShares(older: readonly BotGroupMessageView[], version: num
return older.filter(message => message.threadShare && version !== undefined && (message.threadShare.version ?? 0) < version);
}
-/**
- * Which older shares one refresh re-checks, up to the per-read cap: stale ones first, so
- * every capped batch advances; then still-loading ones, which the main process is already
- * retrying; then the newest. The rest are checked by later refreshes.
- */
-function botGroupShownShares(older: readonly BotGroupMessageView[], version: number | undefined) {
- const withShares = older.filter(message => message.threadShare).reverse();
- const stale = staleBotGroupShares(withShares, version);
- const first = new Set([...stale, ...withShares.filter(message => message.threadShare!.status === 'loading')]);
- return [...first, ...withShares.filter(message => !first.has(message))].slice(0, BOT_GROUP_SHOWN_SHARES_MAX).map(message => ({
+/** One refresh covers all loaded references, including pending sources and attachments. */
+function botGroupShownShares(older: readonly BotGroupMessageView[]) {
+ return older.filter(message => message.threadShare).map(message => ({
id: message.id, messageId: message.threadShare!.messageId, threadRootId: message.threadShare!.threadRootId,
...(message.authorBotId ? { sharerId: message.authorBotId } : {}) }));
}
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
index 90649c6f45..5b594bfa19 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
@@ -3055,7 +3055,7 @@ describe('shares on older pages', () => {
expect(screen.queryByText('编辑前的原文')).toBeNull();
});
- it('gives each new version its own follow-up budget', async () => {
+ it('checks each new version once without looping when a source cannot be confirmed', async () => {
const share = { messageId: 'old-reply', threadRootId: 'old-root', status: 'available' as const, authorKind: 'bot' as const, authorBotId: 'xiaoman', authorName: '小满',
sharedByAuthor: false, content: '原文', attachments: [], createdAt: 1, edited: false, version: 1 };
const oldShare = msg({ id: 'old-share', sequence: 1, authorKind: 'user', isSelf: false, authorBotId: 'alice-actor', authorName: 'Alice', content: '↪ 卡片文字', threadShare: share });
@@ -3071,11 +3071,13 @@ describe('shares on older pages', () => {
await act(async () => mocks.pushes.forEach(push => push({ groupId: 'g1', change: 'messages' })));
await settle();
const afterFirstEdit = mocks.getBotGroup.mock.calls.length;
- // A later edit: the stale card is re-checked again, not left on the first edit's spent budget.
+ // A later edit is checked again; unchanged stale data never causes a refresh loop.
version = 3;
await act(async () => mocks.pushes.forEach(push => push({ groupId: 'g1', change: 'messages' })));
await settle();
- expect(mocks.getBotGroup.mock.calls.length - afterFirstEdit).toBeGreaterThan(1);
+ expect(mocks.getBotGroup.mock.calls.length - afterFirstEdit).toBe(2);
+ await settle();
+ expect(mocks.getBotGroup.mock.calls.length - afterFirstEdit).toBe(2);
});
it('waits for a follow-up before another, whatever else commits meanwhile', async () => {
@@ -3106,8 +3108,39 @@ describe('more older shares than one refresh re-reads', () => {
const t = (name: string) => `bots.groupChat.server.thread.${name}`;
beforeEach(() => { vi.stubGlobal('ResizeObserver', class { observe() {} disconnect() {} }); });
- // Crossing the per-read cap takes more cards than a shared CI runner renders within the default.
- it('never keeps showing a share the refresh could not check, and gets to it within a few refreshes', { timeout: 20_000 }, async () => {
+ it.each(['source', 'attachment'] as const)('settles every older %s after overlapping completion pushes', { timeout: 20_000 }, async (pending) => {
+ const older = Array.from({ length: 201 }, (_, i) => msg({ id: `share-${i}`, sequence: i + 1, content: 'card fallback',
+ threadShare: { messageId: `reply-${i}`, threadRootId: 'root', status: pending === 'source' ? 'loading' : 'available',
+ authorKind: 'user', authorBotId: null, authorName: 'Alice', sharedByAuthor: true, content: pending === 'source' ? '' : `原文 ${i}`,
+ attachments: pending === 'attachment' ? [{ id: `file-${i}`, name: `pending-${i}.pdf`, category: 'file', mimeType: 'application/pdf', size: 0, url: null, path: null, state: 'loading' }] : [],
+ createdAt: 1, edited: false, version: 2 } }));
+ const latest = detail({ serverBacked: true, hasMoreBefore: true, threadShareVersion: 2, messages: [msg({ id: 'new', sequence: 500, content: '最新' })] });
+ const finish: Array<() => void> = [];
+ mocks.getBotGroup.mockImplementation((_groupId: string, options?: { beforeSequence?: number; shownShares?: Array<{ id: string }> }) => {
+ if (options?.beforeSequence) return Promise.resolve({ ok: true, group: { ...latest, hasMoreBefore: false, messages: older } });
+ if (!options?.shownShares?.length) return Promise.resolve({ ok: true, group: latest });
+ const updates = Object.fromEntries(options.shownShares.map(ref => {
+ const i = Number(ref.id.slice(6));
+ return [ref.id, { ...older[i]!.threadShare!, status: 'available', content: `核对 ${i}`, attachments: [] }];
+ }));
+ return new Promise(resolve => finish.push(() => resolve({ ok: true, group: { ...latest, threadShareUpdates: updates } })));
+ });
+ renderView();
+ fireEvent.click(await screen.findByRole('button', { name: 'bots.groupChat.timeline.loadEarlier' }));
+ await waitFor(() => expect(document.querySelectorAll('[data-share-message-id]').length).toBeGreaterThan(200));
+ await act(async () => mocks.pushes.forEach(push => push({ groupId: 'g1', change: 'messages' })));
+ await act(async () => mocks.pushes.forEach(push => push({ groupId: 'g1', change: 'messages' })));
+ expect(finish).toHaveLength(2);
+ await act(async () => finish[1]!());
+ await act(async () => finish[0]!());
+ expect(await screen.findByText('核对 0')).toBeTruthy();
+ expect(screen.getByText('核对 200')).toBeTruthy();
+ expect(screen.queryByText(t('loadingSource'))).toBeNull();
+ expect(screen.queryByText('pending-0.pdf')).toBeNull();
+ expect(finish).toHaveLength(2);
+ });
+
+ it('checks all loaded shares in one refresh, including the oldest deleted source', { timeout: 20_000 }, async () => {
type Share = NonNullable<BotGroupMessageView['threadShare']>;
const shareOf = (i: number, extra: Partial<Share> = {}): Share => ({ messageId: `reply-${i}`, threadRootId: 'root', status: 'available', authorKind: 'bot',
authorBotId: 'xiaoman', authorName: '小满', sharedByAuthor: false, content: `原文 ${i}`, attachments: [], createdAt: 1, edited: false, version: 1, ...extra });
@@ -3116,13 +3149,9 @@ describe('more older shares than one refresh re-reads', () => {
const latest = detail({ serverBacked: true, hasMoreBefore: true, threadShareVersion: 1, messages: [msg({ id: 'new', sequence: 500, content: '最新' })] });
let version = 1;
const refreshes: Array<string[]> = [];
- let release!: () => void;
- const followUp = new Promise<void>(resolve => { release = resolve; });
mocks.getBotGroup.mockImplementation(async (_groupId: string, options?: { beforeSequence?: number; shownShares?: Array<{ id: string; messageId: string }> }) => {
if (options?.beforeSequence) return { ok: true, group: { ...latest, hasMoreBefore: false, messages: older } };
refreshes.push((options?.shownShares ?? []).map(share => share.id));
- // Hold the read that finally checks the oldest share, to see what shows meanwhile.
- if (version > 1 && options?.shownShares?.some(share => share.id === 'share-0')) await followUp;
// The oldest share's reply has been deleted on the server since it was shown.
const threadShareUpdates = Object.fromEntries((options?.shownShares ?? []).map(share => [share.id, share.messageId === 'reply-0'
? shareOf(0, { status: 'unavailable', authorName: '', content: '', version }) : shareOf(Number(share.messageId.slice(6)), { version })]));
@@ -3134,16 +3163,13 @@ describe('more older shares than one refresh re-reads', () => {
expect(await screen.findByText('原文 0')).toBeTruthy();
version = 2;
act(() => { for (const push of mocks.pushes) push({ groupId: 'g1', change: 'messages' }); });
- // Not checked by the first refresh: its old text goes away before anything confirms it.
- await waitFor(() => expect(refreshes.some(ids => ids.includes('share-0'))).toBe(true));
- expect(screen.queryByText('原文 0')).toBeNull();
- expect(screen.getAllByText(t('loadingSource')).length).toBe(1);
- act(() => release());
+ await screen.findByText(t('sourceUnavailable'));
await waitFor(() => expect(screen.queryByText(t('loadingSource'))).toBeNull());
+ expect(screen.queryByText('原文 0')).toBeNull();
expect(screen.getAllByText(t('sourceUnavailable')).length).toBe(1);
- // Bounded: the push plus at most a couple of follow-ups, each within the per-read cap.
- expect(refreshes.length).toBeLessThanOrEqual(3);
- expect(refreshes.every(ids => ids.length <= 200)).toBe(true);
+ // Initial load and one push refresh: no per-batch follow-ups.
+ expect(refreshes).toHaveLength(2);
+ expect(refreshes[1]).toHaveLength(201);
expect(screen.queryByText('↪ 卡片 0')).toBeNull();
});
@@ -3169,7 +3195,7 @@ describe('more older shares than one refresh re-reads', () => {
expect(await screen.findByText('核对后的原文')).toBeTruthy();
// The first refresh that checks older shares already takes the stale one.
expect(refreshes.find(ids => ids.length)).toContain('share-0');
- expect(refreshes.every(ids => ids.length <= 200)).toBe(true);
+ expect(refreshes.find(ids => ids.length)).toHaveLength(201);
});
});
diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.md
index 516165aee4..87544c3583 100644
--- a/docs/product-rules/bot-group-chat.md
+++ b/docs/product-rules/bot-group-chat.md
@@ -582,10 +582,10 @@ Desktop 主聊天直接展示话题里的最新回复,并能把话题回复贴
- **不重复唤起伙伴**:贴回消息的 `mentions` 只含分享者本人。服务端定向消息从不放宽到其他人,所以不会启动伙伴回合,引用里的 @ 也不会再点名任何人;
新回复本身的 @ 按原规则只在话题里生效一次。「继续讨论」不会把贴回消息当作新请求。伙伴读到群历史时,贴回消息带 `sharedReplyId`,并被说明为引用、不是新请求。
普通回复、话题背景与分工判断共用的模型文本投影不带贴回卡片的 fallback,只保留引用标识;原回复如在所读历史中,仍按原消息独立提供。
-- **更早页面上的贴回**:「查看更早的消息」加载出的贴回卡片会跟着原回复变化。每次刷新时,客户端把已显示的旧卡片(最多 200 张)
+- **更早页面上的贴回**:「查看更早的消息」加载出的贴回卡片会跟着原回复变化。每次刷新时,客户端把已显示的全部旧卡片引用
交给主进程,按同一套缓存、失效和权限判定重新解析;原回复被编辑后显示新内容,删除或失去查看权限后显示无法查看,不需要点击或重新打开群聊。
- 超过 200 张时,过期或仍在读取的卡片优先,其余取最新的;这次没核对、而在最近一次编辑/删除/重置之前核对过的卡片,
- 先改为「正在读取原回复…」,不再显示旧正文,随后有界地追加刷新(最多「卡片数 ÷ 200 + 1」次)把它们核对完。
+ 来源和附件完成推送都核对全部已加载引用,不按数量或 loading 状态截断;缺失来源继续由既有后台读取并发限制处理。
+ 旧页跨刷新到达时,过期引用先改为「正在读取原回复…」,同一组过期引用在同一代次只追加一次核对;不循环刷新未完成来源。
旧页面上普通消息的编辑、删除、表情和回复数仍不随推送刷新,这是现有限制,不在本功能范围内。
- **侧栏**:群的最新一条是贴回时,侧栏只显示「谁贴回了一条话题回复」,不引用卡片里的文字,也不为此读取原回复。
- **兼容与边界**:只新增可选字段 `threadPreview`、`threadShare` 与 Desktop 专用 IPC `maker:chat-server:shareToMain`,不进入设备互联白名单。
diff --git a/packages/maker-shared/src/botGroupChat.ts b/packages/maker-shared/src/botGroupChat.ts
index e68959ed3f..bbd6694444 100644
--- a/packages/maker-shared/src/botGroupChat.ts
+++ b/packages/maker-shared/src/botGroupChat.ts
@@ -537,9 +537,6 @@ export interface BotGroupGetOptions {
shownShares?: Array<{ id: string; messageId: string; threadRootId: string; sharerId?: string }>;
}
-/** Older-page shares re-resolved per refresh; later ones wait for a reload. */
-export const BOT_GROUP_SHOWN_SHARES_MAX = 200;
-
export type BotGroupChange = 'created' | 'updated' | 'deleted' | 'messages' | 'round' | 'plan';
export interface BotGroupChangedPayload {