Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): align rich answer primitives and renderer fixtures
Chris082c2dcce48e
diff --git a/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsx b/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsxindex 6862e2064e..2d1de91cc5 100644--- a/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsx+++ b/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsx@@ -26,6 +26,7 @@ vi.mock('react-native', async () => {};});vi.mock('lucide-react-native', () => ({+ Mail: () => null, CalendarDays: () => null, Folder: () => null, ChartColumn: () => null, Info: () => null, Clock: () => null, MapPin: () => null, Coffee: () => null, Users: () => null, Star: () => null,Image: () => null, ImageOff: () => null, Database: () => null, FileArchive: () => null, FileAudio: () => null, FileChartColumn: () => null,FileCode: () => null, FileImage: () => null, FileSpreadsheet: () => null, FileText: () => null, FileVideo: () => null,ArrowLeftRight: () => null, ArrowUp: () => null, Bot: () => null, Check: () => null, ChevronDown: () => null, ChevronRight: () => null, ChevronUp: () => null, Circle: () => null, CircleAlert: () => null, CircleCheck: () => null, CircleDashed: () => null, CircleStop: () => null, Copy: () => null, Ellipsis: () => null, ExternalLink: () => null, File: () => null, Ghost: () => null, Layers: () => null, ListTodo: () => null, LoaderCircle: () => null, PencilLine: () => null, RefreshCw: () => null, Send: () => null, Share: () => null, Sparkles: () => null, Split: () => null, Timer: () => null, Trash2: () => null, TriangleAlert: () => null, Undo2: () => null, X: () => null,diff --git a/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsx b/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsxindex 8d9dbda88e..334fd51f7f 100644--- a/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsx+++ b/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsx@@ -43,6 +43,7 @@ vi.mock('react-native', async () => {};});vi.mock('lucide-react-native', () => Object.fromEntries([+ 'Mail', 'CalendarDays', 'Folder', 'ChartColumn', 'Info', 'Clock', 'MapPin', 'Coffee', 'Image', 'Users', 'Star','Database', 'FileArchive', 'FileAudio', 'FileChartColumn', 'FileCode', 'FileImage', 'FileSpreadsheet', 'FileText', 'FileVideo','ArrowLeftRight', 'ArrowUp', 'Bot', 'Check', 'ChevronDown', 'ChevronRight', 'ChevronUp', 'Circle', 'CircleAlert', 'CircleCheck','CircleDashed', 'CircleStop', 'Copy', 'Ellipsis', 'ExternalLink', 'File', 'Ghost', 'Layers', 'ListTodo', 'LoaderCircle',diff --git a/apps/mobile/src/__tests__/chatActivityLocaleRefresh.test.ts b/apps/mobile/src/__tests__/chatActivityLocaleRefresh.test.tsindex e90a775a11..1d780a32e2 100644--- a/apps/mobile/src/__tests__/chatActivityLocaleRefresh.test.ts+++ b/apps/mobile/src/__tests__/chatActivityLocaleRefresh.test.ts@@ -83,7 +83,7 @@ describe('message activity wording refreshes with app language', () => {const Text = ({ children }: { children?: ReactNode }) => createElement('span', null, children);const Block = memo(({ render }: { render: (block: unknown, leadingGap: boolean) => ReturnType<typeof createElement> }) => createElement('output', null, render(block, false)));const code = component('renderInline').getText(source) + '; return function Harness() {'- + statements('MarkdownBody', ['renderInlines', 'renderTextRunBlock'])+ + statements('MarkdownBodyBase', ['renderInlines', 'renderTextRunBlock'])+ '; return createElement(Block, { render: renderTextRunBlock }); };';const Markdown = compile(code, { ...bindings, Block, i18n, Text, MessageBodyText: Text,styles: {}, layout: { markdownBodyGap: 0 }, selectable: false, spanFor: () => undefined,diff --git a/apps/mobile/src/__tests__/fileChipNameWidth.test.tsx b/apps/mobile/src/__tests__/fileChipNameWidth.test.tsxindex 8031f530c2..2951fac983 100644--- a/apps/mobile/src/__tests__/fileChipNameWidth.test.tsx+++ b/apps/mobile/src/__tests__/fileChipNameWidth.test.tsx@@ -38,6 +38,7 @@ vi.mock('react-i18next', async (importOriginal) => ({useTranslation: () => ({ t: (key: string) => key }),}));vi.mock('lucide-react-native', () => Object.fromEntries([+ 'Mail', 'CalendarDays', 'Folder', 'ChartColumn', 'Info', 'Clock', 'MapPin', 'Coffee', 'Image', 'Users', 'Star','Database', 'FileArchive', 'FileAudio', 'FileChartColumn', 'FileCode', 'FileImage', 'FileSpreadsheet', 'FileText', 'FileVideo','ArrowLeftRight', 'ArrowUp', 'Bot', 'Check', 'ChevronDown', 'ChevronRight', 'ChevronUp', 'Circle', 'CircleAlert', 'CircleCheck','CircleDashed', 'CircleStop', 'Copy', 'Ellipsis', 'ExternalLink', 'File', 'Ghost', 'Layers', 'ListTodo', 'LoaderCircle',diff --git a/apps/mobile/src/__tests__/messageSourceLabelsRender.test.tsx b/apps/mobile/src/__tests__/messageSourceLabelsRender.test.tsxindex ec8f5703cc..70763a21ea 100644--- a/apps/mobile/src/__tests__/messageSourceLabelsRender.test.tsx+++ b/apps/mobile/src/__tests__/messageSourceLabelsRender.test.tsx@@ -99,6 +99,7 @@ vi.mock("@legendapp/list/react-native", () => ({useViewability: () => {},}));vi.mock("lucide-react-native", () => ({+ Mail: () => null, CalendarDays: () => null, Folder: () => null, ChartColumn: () => null, Info: () => null, Clock: () => null, MapPin: () => null, Coffee: () => null, Image: () => null, Users: () => null, Star: () => null,Database: () => null,FileArchive: () => null,FileAudio: () => null,diff --git a/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx b/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsxindex 0ea49a1a28..b70ac4b116 100644--- a/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx+++ b/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx@@ -33,6 +33,7 @@ vi.mock('@legendapp/list/react-native', () => ({useRecyclingState: (initial: any) => useState(initial), useViewability: () => {},}));vi.mock('lucide-react-native', () => ({+ Mail: () => null, CalendarDays: () => null, Folder: () => null, ChartColumn: () => null, Info: () => null, Clock: () => null, MapPin: () => null, Coffee: () => null, Image: () => null, Users: () => null, Star: () => null,Database: () => null, FileArchive: () => null, FileAudio: () => null, FileChartColumn: () => null,FileCode: () => null, FileImage: () => null, FileSpreadsheet: () => null, FileText: () => null, FileVideo: () => null,ArrowLeftRight: () => null, ArrowUp: () => null, Bot: () => null, Check: () => null, ChevronDown: () => null, ChevronRight: () => null, ChevronUp: () => null, Circle: () => null, CircleAlert: () => null, CircleCheck: () => null, CircleDashed: () => null, CircleStop: () => null, Copy: () => null, Ellipsis: () => null, ExternalLink: () => null, File: () => null, Ghost: () => null, Layers: () => null, ListTodo: () => null, LoaderCircle: () => null, PencilLine: () => null, RefreshCw: () => null, Send: () => null, Share: () => null, Sparkles: () => null, Split: () => null, Timer: () => null, Trash2: () => null, TriangleAlert: () => null, Undo2: () => null, X: () => null,diff --git a/apps/mobile/src/__tests__/userMessageCollapse.test.ts b/apps/mobile/src/__tests__/userMessageCollapse.test.tsindex 5c77367f6a..c23bd58e52 100644--- a/apps/mobile/src/__tests__/userMessageCollapse.test.ts+++ b/apps/mobile/src/__tests__/userMessageCollapse.test.ts@@ -158,8 +158,8 @@ const collapseStart = bubbleStatements.indexOf(bodyStatement('automationOrigin',const collapseEnd = bubbleStatements.indexOf(bodyStatement('longMessageCollapsed', 'MessageBubble'));const collapseCode = bubbleStatements.slice(collapseStart, collapseEnd + 1).map(statement => statement.getText(rendererSource)).join(String.fromCharCode(10));const markdownStateCode = ['contentWidth', 'handleSettledWidthLayout', 'pinSettledWidth', 'settledTextStyle', 'renderSingleBlock']- .map(name => bodyStatement(name, 'MarkdownBody').getText(rendererSource)).join(String.fromCharCode(10));-const markdownReturn = rendererFunction('MarkdownBody').body!.statements.find(ts.isReturnStatement);+ .map(name => bodyStatement(name, 'MarkdownBodyBase').getText(rendererSource)).join(String.fromCharCode(10));+const markdownReturn = rendererFunction('MarkdownBodyBase').body!.statements.find(ts.isReturnStatement);if (!markdownReturn) throw new Error('MarkdownBody return was not found');let root: Root;@@ -202,7 +202,7 @@ const MarkdownBody = MarkdownHarness;function BubbleHarness({ body, kind = 'user', automationOrigin: origin }) {const styles = {};const isUser = kind === 'user';- const item = { message: { kind, body, automationOrigin: origin } };+ const item = { message: { key: "message", source: { clientId: "message" }, kind, body, automationOrigin: origin } };const displayBubbleBody = body;const bubbleBody = body;const hasPluginInvocations = false;diff --git a/apps/mobile/src/session/RichAnswer.tsx b/apps/mobile/src/session/RichAnswer.tsxindex 58773b4a63..26291b1eda 100644--- a/apps/mobile/src/session/RichAnswer.tsx+++ b/apps/mobile/src/session/RichAnswer.tsx@@ -25,13 +25,12 @@ import {import {View,AppState,- Text,Pressable,- TextInput,Switch,StyleSheet,type GestureResponderEvent,} from "react-native";+import { Text, TextInput } from "@/components/AppText";import Svg, { Polyline, Line, Circle, Text as SvgText } from "react-native-svg";import { useTranslation } from "react-i18next";import { useAuth } from "@/auth/AuthContext";@@ -42,6 +41,8 @@ import {radius,textStyles,fontWeight,+ iconSize,+ iconStroke,type ThemeColors,} from "@/theme";import {@@ -195,8 +196,8 @@ function RichDocumentView({return (<View style={styles.iconRow}><Icon- size={20}- strokeWidth={1.75}+ size={iconSize.action}+ strokeWidth={iconStroke.thin}color={colors.textPrimary}accessible={false}/>@@ -473,7 +474,7 @@ function AnswerLineChart({<Polylinefill="none"stroke={colors.textPrimary}- strokeWidth={2}+ strokeWidth={iconStroke.regular}points={plot.points.map((p) => `${p.x},${p.y}`).join(" ")}/>{plot.points.map((p, i) => (