Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(im): 保留飞书原生查询遗漏的本地图片引用
Dash3fa458ef1dfa
diff --git a/apps/desktop/src/main/mcp-integrations/__tests__/groupHistoryMcpServer.test.ts b/apps/desktop/src/main/mcp-integrations/__tests__/groupHistoryMcpServer.test.tsindex 5674e362bc..8ec9554a22 100644--- a/apps/desktop/src/main/mcp-integrations/__tests__/groupHistoryMcpServer.test.ts+++ b/apps/desktop/src/main/mcp-integrations/__tests__/groupHistoryMcpServer.test.ts@@ -220,6 +220,31 @@ describe('cindy_group_history search permission boundary', () => {// Test value: real MCP call must return image blocks, not a filename/path, and must not// publish images after the turn's lease ends. Existing search tests cover text only. Tier: unit.describe('get_images tool', () => {+ // #7756 review: native Feishu lookup filters file names before MIME is known.+ // Unit MCP entry: two already verified local images must survive empty/partial+ // native results; overlapping managed URLs must not return duplicate images.+ it.each([false, true])('keeps local images when native lookup is incomplete: %s', async (partial) => {+ const lane = { provider: 'feishu-personal:bot', chatId: 'oc_chat', threadId: 'omt_topic' };+ const localRefs = ['a', 'b'].map((hash) => ({+ fileId: `cindy-media://blobs/${hash.repeat(64)}.png`,+ name: 'screenshot',+ mimeType: 'image/png',+ }));+ const readMessageImages = async () => partial ? [{+ kind: 'image' as const, absPath: '/unused', url: localRefs[0].fileId,+ originalName: 'screenshot', mimeType: 'image/png',+ }] : [];+ const readImage = vi.fn(async () => ({ data: 'aW1hZ2U=', mimeType: 'image/png' }));+ const { result } = await callSearch({ message_id: 'om_file' }, {+ access: 'lane', provider: lane.provider, lane, readMessageImages,+ }, {+ tool: 'get_images', getImages: async () => ({ imageRefs: localRefs }), readImage,+ });+ expect(result.isError).toBeUndefined();+ expect((result.content as Array<{ type: string }>).filter(block => block.type === 'image')).toHaveLength(2);+ expect(readImage).toHaveBeenNthCalledWith(1, expect.objectContaining({ ref: localRefs[0] }));+ expect(readImage).toHaveBeenNthCalledWith(2, expect.objectContaining({ ref: localRefs[1] }));+ });// #7756 review: exact-bot reader cannot serve a different bot's uncached file ID.// Unit MCP boundary; search tests cover cross-bot text, not image retrieval.it('rejects another bot before looking up even a cached image', async () => {diff --git a/apps/desktop/src/main/mcp-integrations/groupHistoryMcpServer.ts b/apps/desktop/src/main/mcp-integrations/groupHistoryMcpServer.tsindex 14170ae2bb..c1b5ed6471 100644--- a/apps/desktop/src/main/mcp-integrations/groupHistoryMcpServer.ts+++ b/apps/desktop/src/main/mcp-integrations/groupHistoryMcpServer.ts@@ -268,7 +268,11 @@ export function createGroupHistoryMcpServer(deps: GroupHistoryMcpDeps): McpServeif (scope.readMessageImages && scope.lane && sameLane(scope.lane, target)) {const attachments = await scope.readMessageImages(message_id);if (!isCurrent()) return expired();- row = { imageRefs: receivedImageRefs(attachments) };+ // Native history may omit an extensionless file that was verified as+ // an image on receipt. Keep those account/lane-bound local references.+ const refs = new Map((row?.imageRefs ?? []).map((ref) => [ref.fileId, ref]));+ for (const ref of receivedImageRefs(attachments)) refs.set(ref.fileId, ref);+ row = { imageRefs: [...refs.values()].slice(0, 4) };}if (!row)return result(