Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(chat): retain public media links in group replies
ylliuuu66beb2d53e823c
diff --git a/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx b/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsxindex 39f3f40e8b..5b9d88cbd5 100644--- a/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx+++ b/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx@@ -58,6 +58,7 @@ function bodyMessages() {{ seq: 3, op: 'create', id: 'list', kind: 'markdown', props: { text: '- 正文可以阅读\n- **重点**保持格式' } },{ seq: 4, op: 'create', id: 'image', kind: 'image', props: { src: 'cindy-media://blobs/fixture-image.png', alt: '图片说明保留', caption: '图片标题保留' } },{ seq: 5, op: 'create', id: 'unnamed-image', kind: 'image', props: { src: '/private/tmp/fixture-image.png' } },+ ...['image', 'video', 'audio'].map((kind, index) => ({ seq: index + 6, op: 'create', id: `public-${kind}`, kind, props: { src: `https://example.test/public-${kind}` } })),].map(item => JSON.stringify(item)).join('\n') + '\n```';return [message({ id: 'body-user', sequence: 1, content: '请整理发布前检查', createdAt: T0 }),diff --git a/apps/desktop/scripts/fixtures/group-control/ui-page.mjs b/apps/desktop/scripts/fixtures/group-control/ui-page.mjsindex 11f75d8e29..2af1772b33 100644--- a/apps/desktop/scripts/fixtures/group-control/ui-page.mjs+++ b/apps/desktop/scripts/fixtures/group-control/ui-page.mjs@@ -148,6 +148,12 @@ export default {assert.ok(text.includes('图片说明保留') && text.includes('图片标题保留'));assert.ok(text.includes('🖼'), 'an undescribed image has a neutral placeholder');assert.ok(!text.includes('cindy-media://') && !text.includes('/private/tmp/fixture-image.png'));+ for (const kind of ['image', 'video', 'audio']) {+ const url = `https://example.test/public-${kind}`;+ const link = timeline.getByRole('link', { name: url, exact: true });+ assert.equal(await link.count(), 1, 'public media keep an actionable web link');+ assert.equal(await link.getAttribute('href'), url);+ }return;}const input = page.locator('textarea');diff --git a/apps/mobile/src/__tests__/BotGroupMarkdownText.test.tsx b/apps/mobile/src/__tests__/BotGroupMarkdownText.test.tsxindex 7bbcfb6e50..6260f1c305 100644--- a/apps/mobile/src/__tests__/BotGroupMarkdownText.test.tsx+++ b/apps/mobile/src/__tests__/BotGroupMarkdownText.test.tsx@@ -107,6 +107,19 @@ it('keeps component literal punctuation and Markdown formatting distinct', asyncexpect(node.textContent).not.toContain('"op":"create"');});+// #7492: media src filtering removed the only visible access path for public URLs.+it('keeps public component media URLs readable without exposing internal sources', async () => {+ const sources = ['https://example.test/image.png', 'https://example.test/video.mp4', 'https://example.test/audio.mp3'];+ const content = '```cindy-ui\n' + [+ ...sources.map((src, i) => ({ seq: i + 1, version: 1, op: 'create', id: `public${i}`, kind: ['image', 'video', 'audio'][i], props: { src } })),+ { seq: 4, op: 'create', id: 'local', kind: 'image', props: { src: 'cindy-media://blobs/private.png', alt: 'Local description' } },+ ].map(item => JSON.stringify(item)).join('\n') + '\n```';+ await act(async () => root.render(createElement(BotGroupMarkdownText, { content, authorKind: 'bot' })));+ for (const src of sources) expect(node.textContent).toContain(src);+ expect(node.textContent).toContain('Local description');+ expect(node.textContent).not.toContain('cindy-media://');+});+// #6716 review: group images render as alt text, not 150px native previews.it.each([['x', ''], ['a long image description that wraps inside its column', 'y']])('measures image cells like their visible fallback text (%s / %s)', async (alt, otherAlt) => {diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 05ccadafb6..5e618019d9 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -527,6 +527,7 @@ Chat Server 声明 `capabilities.groupSingleSpeaker: 1` 时,服务器群按下文件交付在读取、上传和封存前复验群成员、伙伴归属、授权版本及执行租约;工具调用结束时的授权不能替代交付时的授权。明确撤权则停止交付,临时校验失败保留同一执行结果重试,不重新运行 Agent。Markdown 图片与 `cindy-ui` 的图片节点遵守同一规则;修改或删除图片节点后,只交付最终保留的图片,同一张图不重复交付。群正文保留媒体的说明、替代文字与图注,不展示内部媒体地址;没有说明时保留类型占位,不凭媒体地址宣称附件已送达。+公开 HTTP(S) 媒体来源保留网页链接,避免未走附件交付的图片、视频或音频丢失访问入口;说明文字仍按字面显示,不因来源是公网链接而扩大本机媒体读取权限。Chris 已明确扩展到多人各带伙伴,并选择「主人按群预先授权」。正式群聊统一使用 Chat Server;已有本地群及消息自动迁移,不保留并行本地群入口。Agent 工作目录与私人资料仍留在执行端,外部成员的访问继续受下述授权边界约束。服务端群历史与 Agent 本机/云端执行分离,人和伙伴共用成员、群角色和消息合同,国内与国际账号可以互邀。diff --git a/docs/verification/issue-6892/README.md b/docs/verification/issue-6892/README.mdindex fae43d6ffc..4bc940d054 100644--- a/docs/verification/issue-6892/README.md+++ b/docs/verification/issue-6892/README.md@@ -6,7 +6,7 @@伙伴回复中的 `cindy-ui` 图片节点现在复用现有图片附件交付通道。按组件最终树提取图片,应用 patch / move / remove 后再与 Markdown 图片统一去重;继续执行任务读取授权、-MIME、大小、数量及执行状态检查。群正文保留说明、替代文字与图注,隐藏媒体地址,+MIME、大小、数量及执行状态检查。群正文保留说明、替代文字与图注,隐藏内部媒体地址,没有说明时显示类型占位,不凭地址宣称图片已送达。本轮 macOS Desktop 双账号核心验收通过,用户已确认验收完成。图片通过真实伙伴回复@@ -125,3 +125,20 @@ Node `fileURLToPath` 转换为本机绝对路径,再复用原图片导入、图片、文件、群服务及媒体上传定向回归 **4 个文件 507 项通过**,总耗时 4.48 秒。Desktop 完整类型检查通过。本次没有重做双账号实机、Mobile 或 Windows 实机验收,不将此前结果当作本次补丁的实机结果。++## 2026-10-27:公开媒体链接评审修复++维护者指出,正文不应把尚未作为附件交付的公开图片、视频与音频链接一并删除。+现在仅为 HTTP(S) 来源增加独立网页链接;说明文字继续按字面显示,内部协议、本机路径、+脚本及 data 来源不生成链接。URL 分隔符编码后进入单个 Markdown 自动链接,避免注入额外正文。+不增加视频/音频上传或任务媒体读取能力。++- 共享正文回归先复现 4 失败 / 62 通过,修复后单文件 66 项通过,总耗时 0.241 秒。+- maker-shared 全套 104 个文件 1,927 项通过,总耗时 11.37 秒,类型检查通过。+- Mobile 群正文与附件 2 个文件 19 项通过,总耗时 3.76 秒;正文单文件 7 项总耗时 1.03 秒。+- Desktop `body-answer` Light / Dark 共 2 项通过,总耗时 5.0 秒,截图已目检,+ 并通过真实群正文组件确认图片、视频及音频三个公开地址各保留一个网页链接。+- Mobile 保留既有群正文只读规则:公开 URL 文字可复制,不把单测当作原生点击或真机结果。++Desktop、Mobile 完整类型检查均通过。+本次未重做双账号、Mobile 或 Windows 实机验收;历史实机证据的构建范围不变。diff --git a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts b/packages/maker-shared/src/__tests__/botGroupPresentation.test.tsindex 42dd4e503f..f0fc2d039c 100644--- a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts+++ b/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts@@ -231,12 +231,30 @@ describe('group body component display', () => {it.each([rich({ kind: 'text', props: { text: '' } }), rich({ kind: 'range' }), '```cindy-ui\ninvalid\n```'])('retains unreadable source %s', content => {expect(botGroupBodyParts(content, 'bot')).toEqual([{ kind: 'markdown', content }]);});- it.each(['image', 'video', 'audio', 'svg'])('keeps %s descriptions but never the media source or an attachment promise', kind => {- for (const src of ['cindy-media://blobs/example.png', 'file:///private/image.png', 'xdt-file:///image.png', '/private/image.png', 'https://example.test/image.png']) {+ it.each(['image', 'video', 'audio', 'svg'])('keeps %s descriptions but never an internal source or an attachment promise', kind => {+ for (const src of ['cindy-media://blobs/example.png', 'file:///private/image.png', 'xdt-file:///image.png', '/private/image.png', 'javascript:alert(1)', 'data:image/png;base64,AA==']) {expect(botGroupBodyParts(rich({ kind, props: { label: 'Title', alt: 'Description', caption: 'Caption', src } }), 'bot')).toEqual([{ kind: 'text', content: 'Title\nDescription\nCaption' }]);}});+ // #7492 review: public media are not uploaded as attachments. Removing their+ // source erases the only access path; keep descriptions literal and emit a web link.+ it.each(['image', 'video', 'audio'])('preserves a public %s link with and without a description', kind => {+ const src = `https://example.test/public-${kind}`;+ expect(botGroupBodyParts(rich({ kind, props: { src, caption: '*literal* [caption]' } }), 'bot')).toEqual([+ { kind: 'text', content: '*literal* [caption]' },+ { kind: 'markdown', content: `<${src}>` },+ ]);+ expect(botGroupBodyParts(rich({ kind, props: { src } }), 'bot').at(-1))+ .toEqual({ kind: 'markdown', content: `<${src}>` });+ });+ it('encodes public media URL delimiters without creating additional Markdown content', () => {+ const src = 'http://example.test/image>';+ expect(botGroupBodyParts(rich({ kind: 'image', props: { src } }), 'bot')).toEqual([+ { kind: 'text', content: '🖼' },+ { kind: 'markdown', content: '<http://example.test/image%3E>' },+ ]);+ });it('keeps an undescribed image visible as a placeholder without exposing protocol source', () => {expect(botGroupBodyParts(rich({ kind: 'image', props: { src: 'cindy-media://blobs/example.png' } }), 'bot')).toEqual([{ kind: 'text', content: '🖼' }]);diff --git a/packages/maker-shared/src/botGroupPresentation.ts b/packages/maker-shared/src/botGroupPresentation.tsindex 1afed9de6f..594d27346f 100644--- a/packages/maker-shared/src/botGroupPresentation.ts+++ b/packages/maker-shared/src/botGroupPresentation.ts@@ -382,6 +382,18 @@ export function botGroupPathBasename(path: string): string {return parts[parts.length - 1] ?? path;}+/** Public media stay accessible without granting group bodies local media authority. */+function publicMediaLink(src: string): string | null {+ try {+ const url = new URL(src);+ if (url.protocol !== 'https:' && url.protocol !== 'http:') return null;+ // Keep the URL inside one autolink; descriptions continue through literal text.+ return `<${url.href.replace(/[<>\\]/g, char => encodeURIComponent(char))}>`;+ } catch {+ return null;+ }+}+/** Display-only body fragments. Literal component text never becomes Markdown syntax. */export function botGroupBodyParts(content: string, authorKind?: BotGroupMessageView['authorKind']): Array<{ kind: 'text' | 'markdown'; content: string }> {if (authorKind !== 'bot') return [{ kind: 'markdown', content }];@@ -408,6 +420,8 @@ export function botGroupBodyParts(content: string, authorKind?: BotGroupMessageV// A neutral type marker is not a promise that an attachment was delivered.const placeholder = node.kind === 'image' ? '🖼' : node.kind === 'video' ? '🎞' : node.kind === 'audio' ? '♪' : '◇';add(description || placeholder);+ const link = publicMediaLink(richString(node, 'src'));+ if (link) add(link, 'markdown');} else {const markdown = richMarkdown(node);if (markdown !== null) {