Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(bot-groups): reuse receipts across regenerated image names
Chrisab1db0804770
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.tsindex 6337100c80..3329986898 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts@@ -134,15 +134,16 @@ describe('Chat Server result delivery and refresh', () => {if (route.endsWith('/messages') && method === 'POST') return { body: { id: 'saved-message' } };return response(route);});- const input = { groupId: roomId, text: 'photo', clientId: 'phone-send-1', mentions: { all: false, botIds: [] }, attachments: [{}] };+ const input = { groupId: roomId, text: 'photo', clientId: 'phone-send-1', mentions: { all: false, botIds: [] }, attachments: [{ id: 'annotated-photo', name: 'annotated-100.png', originalName: 'annotated-100.png' }] };const first = service.sendMessage(input, { controllerDeviceId: 'phone' });await vi.advanceTimersByTimeAsync(16_000);expect(release).toBeTypeOf('function');- const retry = service.sendMessage(input, { controllerDeviceId: 'phone' });+ const regenerated = { ...input, attachments: [{ id: 'annotated-photo', name: 'annotated-200.png', originalName: 'annotated-200.png' }] };+ const retry = service.sendMessage(regenerated, { controllerDeviceId: 'phone' });release();expect(await first).toEqual({ ok: true, messageId: 'saved-message' });expect(await retry).toEqual(await first);- expect(await service.sendMessage(input, { controllerDeviceId: 'phone' })).toEqual(await first);+ expect(await service.sendMessage(regenerated, { controllerDeviceId: 'phone' })).toEqual(await first);expect(deps.prepareAttachments).toHaveBeenCalledTimes(1);expect(commit).toHaveBeenCalledTimes(1);expect(fixture.handle.mock.calls.filter(([route, method]) => route.endsWith('/messages') && method === 'POST')).toHaveLength(1);diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.tsindex 55197cfbd8..47048c85d5 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServerParity.test.ts@@ -133,9 +133,10 @@ describe('server group feature parity', () => {it.each(['mention', 'stop', 'dismiss', 'start', 'edit'])('invalidates a pending decision on %s', async action => {arrange(proposed);let finish!: (value: { needsPlan: true; steps: typeof steps }) => void;- deps.decidePlan = vi.fn(() => new Promise(resolve => { finish = resolve; }));+ const decide = vi.fn<NonNullable<BotGroupChatServiceDeps['decidePlan']>>(() => new Promise(resolve => { finish = resolve; }));+ deps.decidePlan = decide;await send(); await flush();- const signal = vi.mocked(deps.decidePlan).mock.calls[0][1];+ const signal = decide.mock.calls[0]![1];if (action === 'mention') await send({ clientId: 'parity:message:2', mentions: { all: false, botIds: [botId] } });else if (action === 'stop') await service.stopRound(roomId);else if (action === 'dismiss') await service.dismissPlan({ groupId: roomId, planId });diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.tsindex 5bb776cf96..1e5e430cfe 100644--- a/apps/desktop/src/main/maker-ipc/chatServer.ts+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts@@ -938,7 +938,12 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD}),sendMessage: (input, origin) => {if (!current()) return Promise.resolve(chatGroupFailure(new Error('OWNER_CHANGED')));- const key = createHash('sha256').update(JSON.stringify([input, origin?.controllerDeviceId ?? null])).digest('hex');+ // clientId identifies one immutable send; annotation burn-in can regenerate+ // attachment names/URLs while the controller is retrying its lost receipt.+ const identity = z.object({ groupId: id, clientId: z.string().min(1).max(200), text: z.string(),+ mentions: z.object({ all: z.boolean(), botIds: z.array(z.string()) }), division: z.boolean().optional() }).safeParse(input);+ if (!identity.success) return sendMessage(input, origin);+ const key = createHash('sha256').update(JSON.stringify([identity.data, origin?.controllerDeviceId ?? null])).digest('hex');const receipt = sendReceipts.get(key);if (receipt) return Promise.resolve(receipt);const pending = pendingSends.get(key);