Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix: address review — Unicode spaces and real fullwidth punct
Chris9d70eb3456d4
diff --git a/apps/desktop/src/renderer/__tests__/userMessageLinkify.test.ts b/apps/desktop/src/renderer/__tests__/userMessageLinkify.test.tsindex f384656ea8..37bd12db90 100644--- a/apps/desktop/src/renderer/__tests__/userMessageLinkify.test.ts+++ b/apps/desktop/src/renderer/__tests__/userMessageLinkify.test.ts@@ -96,6 +96,13 @@ describe('userMessageLinkify', () => {expect(urls('打开 https://www.例子.com/2024年报告')).toEqual(['https://www.例子.com/2024年报告',]);+ expect(urls('打开 https://example.com/ABC 与 https://example.com/カタカナ')).toEqual([+ 'https://example.com/ABC',+ 'https://example.com/カタカナ',+ ]);+ expect(urls('看 https://example.com/path\u00A0然后')).toEqual([+ 'https://example.com/path',+ ]);});it('keeps apostrophes inside URL paths and at URL endings', () => {diff --git a/apps/mobile/src/__tests__/messageMarkdown.test.ts b/apps/mobile/src/__tests__/messageMarkdown.test.tsindex 22b6f52db9..0bb354e486 100644--- a/apps/mobile/src/__tests__/messageMarkdown.test.ts+++ b/apps/mobile/src/__tests__/messageMarkdown.test.ts@@ -293,6 +293,17 @@ describe('messageMarkdown', () => {{ type: 'text', text: ' 与 ' },{ type: 'link', text: 'https://例子.测试/path', url: 'https://例子.测试/path' },]);+ expect(parseMobileMarkdownInlines('打开 https://example.com/ABC 与 https://example.com/abc々def')).toEqual([+ { type: 'text', text: '打开 ' },+ { type: 'link', text: 'https://example.com/ABC', url: 'https://example.com/ABC' },+ { type: 'text', text: ' 与 ' },+ { type: 'link', text: 'https://example.com/abc々def', url: 'https://example.com/abc々def' },+ ]);+ expect(parseMobileMarkdownInlines('看 https://example.com/path\u00A0然后')).toEqual([+ { type: 'text', text: '看 ' },+ { type: 'link', text: 'https://example.com/path', url: 'https://example.com/path' },+ { type: 'text', text: '\u00A0然后' },+ ]);});it('parses common inline formatting tokens', () => {diff --git a/packages/maker-shared/src/__tests__/urlTextBoundary.test.ts b/packages/maker-shared/src/__tests__/urlTextBoundary.test.tsindex 769ff2a529..178a2c1359 100644--- a/packages/maker-shared/src/__tests__/urlTextBoundary.test.ts+++ b/packages/maker-shared/src/__tests__/urlTextBoundary.test.ts@@ -64,6 +64,15 @@ describe('clipBareHttpAutolinkText', () => {expect(clipBareHttpAutolinkText('https://例子123.测试/path')).toBe('https://例子123.测试/path',);+ expect(clipBareHttpAutolinkText('https://example.com/ABC')).toBe(+ 'https://example.com/ABC',+ );+ expect(clipBareHttpAutolinkText('https://example.com/カタカナ')).toBe(+ 'https://example.com/カタカナ',+ );+ expect(clipBareHttpAutolinkText('https://example.com/abc々def')).toBe(+ 'https://example.com/abc々def',+ );});});@@ -83,6 +92,15 @@ describe('BARE_HTTP_URL_RE_SOURCE', () => {expect(matchBareHttp('打开 https://例子.测试/path 看')).toBe('https://例子.测试/path',);+ expect(matchBareHttp('打开 https://example.com/ABC 看')).toBe(+ 'https://example.com/ABC',+ );+ expect(matchBareHttp('看 https://example.com/path\u00A0然后')).toBe(+ 'https://example.com/path',+ );+ expect(matchBareHttp('看 https://example.com/path\u202F然后')).toBe(+ 'https://example.com/path',+ );});it('includes balanced ASCII parentheses for later clip', () => {diff --git a/packages/maker-shared/src/urlTextBoundary.ts b/packages/maker-shared/src/urlTextBoundary.tsindex 3631167bb3..2c3e4ac1d6 100644--- a/packages/maker-shared/src/urlTextBoundary.ts+++ b/packages/maker-shared/src/urlTextBoundary.ts@@ -341,25 +341,28 @@ export function shrinkAutolinkTrailingJunk(}/**- * 扫描器用的裸 http(s) 源。空白 / 尖括号 / ASCII 引号 / 弯引号 /- * CJK 与全角标点处结束。汉字、假名、谚文可以出现在域名和路径里;- * 半角括号留给 `clipBareHttpAutolink` 按配对/包裹处理。+ * 扫描器用的裸 http(s) 源。任意 Unicode 空白 / 尖括号 / 引号 / 省略号 /+ * 真正的 CJK·全角标点处结束。全角字母、半角片假名、々 等字母+ * 留在地址里;半角括号留给 `clipBareHttpAutolink` 按配对处理。+ * 标点范围与 `isAutolinkPunctuationBoundary` 的 P/Z 判定对齐,不是整块 Unicode block。*/export const BARE_HTTP_URL_RE_SOURCE =- 'https?://[^ \t\r\n<>"\u2018-\u201F\u2026\u3000-\u303F\uFF00-\uFFEF]+';+ String.raw`https?://[^\s<>"\u2018-\u201F\u2026\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\uFF01-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65]+`;const MARKDOWN_FORMATTING_STRIP_BOUNDARY =/[\u3000-\u303F\u3040-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uFF00-\uFFEF]/;+const CJK_OR_FULLWIDTH_PUNCT_BLOCK =+ /(?:[\u3000-\u303F\uFF00-\uFFEF])/u;+function isAutolinkPunctuationBoundary(ch: string): boolean {const code = ch.codePointAt(0);if (code == null) return false;if (ch === '"' || ch === '`') return true;if (code >= 0x2018 && code <= 0x201f) return true;if (code === 0x2026) return true;- if (code >= 0x3000 && code <= 0x303f) return true;- if (code >= 0xff00 && code <= 0xffef) return true;- return false;+ if (!CJK_OR_FULLWIDTH_PUNCT_BLOCK.test(ch)) return false;+ return /^\p{P}$/u.test(ch) || /^\p{Z}$/u.test(ch);}/**