Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
📝 refactor: Move Text-Like Message Parts Into @librechat/chat (#17087)
Marco Beretta1e23b3545b51
diff --git a/client/src/Providers/MessagePartsHostContext.tsx b/client/src/Providers/MessagePartsHostContext.tsxindex b4fe17343f..694e067a47 100644--- a/client/src/Providers/MessagePartsHostContext.tsx+++ b/client/src/Providers/MessagePartsHostContext.tsx@@ -9,6 +9,7 @@ import {useResetRecoilState,useSetRecoilState,} from 'recoil';+import type { Agent } from 'librechat-data-provider';import type {MessagePartArtifactPanel,MessagePartsUserTextPreferences,@@ -22,7 +23,9 @@ import {escalatingSteerFamily,} from '~/store/steer';import store, { ptcTraceByToolCallId, ptcTraceKey, sandboxStartingByToolCallId } from '~/store';-import { useMessageContext, useFileMapContext } from '~/Providers';+import { useMessageContext, useFileMapContext, useAgentsMapContext } from '~/Providers';+import { getAppPartRenderers } from '~/components/Chat/Messages/Content/Parts/slots';+import useSmoothStreaming from '~/hooks/Messages/useSmoothStreaming';import { showThinkingAtom } from '~/store/showThinking';import { fontSizeAtom } from '~/store/fontSize';@@ -31,6 +34,11 @@ function useAppMessage(): MessagePartMessage {return { messageId, isSubmitting, isLatestMessage, nextType };}+function useAppAgent(agentId: string): Agent | undefined {+ const agentsMap = useAgentsMapContext();+ return useMemo(() => agentsMap?.[agentId], [agentsMap, agentId]);+}+function useAppUserTextPreferences(): MessagePartsUserTextPreferences {const usernameDisplay = useRecoilValue<boolean>(store.UsernameDisplay);const enableUserMsgMarkdown = useRecoilValue<boolean>(store.enableUserMsgMarkdown);@@ -96,6 +104,10 @@ function useAppLiveAppliedSteer(steerId: string): [boolean, (steerId: string) =>*/export const appMessagePartsHost: MessagePartsHost = {useMessage: useAppMessage,+ renderMarkdown: (props) => getAppPartRenderers().renderMarkdown(props),+ useSmoothStreaming,+ useAgent: useAppAgent,+ renderAgentIcon: (agent) => getAppPartRenderers().renderAgentIcon(agent),useFontSize: () => useAtomValue(fontSizeAtom),useShowThinking: () => useAtomValue(showThinkingAtom),useAutoExpandTools: () => useRecoilValue<boolean>(store.autoExpandTools),diff --git a/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx b/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsxindex 35efea91c0..bc26250e75 100644--- a/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx+++ b/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx@@ -1,4 +1,5 @@import { useCallback } from 'react';+import { EmptyText } from '@librechat/chat/components';import { MessageCircleQuestion, TriangleAlert } from 'lucide-react';import type { Agents, PartMetadata } from 'librechat-data-provider';import {@@ -10,7 +11,6 @@ import AskUserQuestionProgress from './AskUserQuestionProgress';import { useLocalize, useExpandCollapse } from '~/hooks';import { useToolExpansion } from './disclosure';import ProgressText from './ProgressText';-import EmptyText from './Parts/EmptyText';import { TOOL_ROW_CLASSES } from './rows';import Container from './Container';diff --git a/client/src/components/Chat/Messages/Content/MessageContent.tsx b/client/src/components/Chat/Messages/Content/MessageContent.tsxindex c6deffbadb..9bd350920c 100644--- a/client/src/components/Chat/Messages/Content/MessageContent.tsx+++ b/client/src/components/Chat/Messages/Content/MessageContent.tsx@@ -1,6 +1,7 @@import { memo, Suspense, useMemo } from 'react';import { useRecoilValue } from 'recoil';import { Alert, DelayedRender } from '@librechat/client';+import { EmptyText, CollapsibleText } from '@librechat/chat/components';import { Constants, parseThinkingContent } from 'librechat-data-provider';import type { TMessage } from 'librechat-data-provider';import type { TMessageContentProps, TDisplayProps } from '~/common';@@ -8,9 +9,7 @@ import AttachmentRecoveryActions from '~/components/Messages/Content/Error/recovimport useSmoothStreaming from '~/hooks/Messages/useSmoothStreaming';import Error from '~/components/Messages/Content/Error';import ToolCallLimitNotice from './ToolCallLimitNotice';-import CollapsibleText from './Parts/CollapsibleText';import { useMessageContext } from '~/Providers';-import EmptyText from './Parts/EmptyText';import MarkdownLite from './MarkdownLite';import EditMessage from './EditMessage';import Thinking from './Parts/Thinking';diff --git a/client/src/components/Chat/Messages/Content/Parts/AgentUpdate.tsx b/client/src/components/Chat/Messages/Content/Parts/AgentUpdate.tsxdeleted file mode 100644index 2346dec537..0000000000--- a/client/src/components/Chat/Messages/Content/Parts/AgentUpdate.tsx+++ /dev/null@@ -1,47 +0,0 @@-import React, { useMemo } from 'react';-import { EModelEndpoint } from 'librechat-data-provider';-import type { TMessage } from 'librechat-data-provider';-import MessageIcon from '~/components/Share/MessageIcon';-import { useAgentsMapContext } from '~/Providers';-import { useLocalize } from '~/hooks';--interface AgentUpdateProps {- currentAgentId: string;-}--const AgentUpdate: React.FC<AgentUpdateProps> = ({ currentAgentId }) => {- const localize = useLocalize();- const agentsMap = useAgentsMapContext();- const currentAgent = useMemo(() => agentsMap?.[currentAgentId], [agentsMap, currentAgentId]);- if (!currentAgentId) {- return null;- }- return (- <div className="relative">- <div className="absolute -left-6 flex h-full w-4 items-center justify-center">- <div className="relative h-full w-4">- <div className="absolute left-0 top-0 h-1/2 w-px border border-border-medium"></div>- <div className="absolute left-0 top-1/2 h-px w-3 border border-border-medium"></div>- </div>- </div>- <div className="my-4 flex items-center gap-2">- <div className="flex h-6 w-6 items-center justify-center overflow-hidden rounded-full">- <MessageIcon- message={- {- endpoint: EModelEndpoint.agents,- isCreatedByUser: false,- } as TMessage- }- agent={currentAgent}- />- </div>- <div className="text-base font-medium text-text-primary">- {currentAgent?.name || localize('com_ui_agent')}- </div>- </div>- </div>- );-};--export default AgentUpdate;diff --git a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsxindex 467e19b636..610dcf1f72 100644--- a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx@@ -1,4 +1,5 @@import { memo, useMemo, useState, useEffect, useCallback } from 'react';+import { CollapsibleText } from '@librechat/chat/components';import type { TFile, TMessage } from 'librechat-data-provider';import SteerReceipt, { type SteerReceiptState } from '~/components/Chat/Steering/Receipt';import FilePreviewDialog from '~/components/Chat/Messages/Content/FilePreviewDialog';@@ -9,7 +10,6 @@ import MarkdownLite from '~/components/Chat/Messages/Content/MarkdownLite';import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext';import FileContainer from '~/components/Chat/Input/Files/FileContainer';import Image from '~/components/Chat/Messages/Content/Image';-import CollapsibleText from './CollapsibleText';import { useShareContext } from '~/Providers';import { useLocalize } from '~/hooks';diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/host.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/host.test.tsxindex 15df2364d5..aaecc68dde 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/host.test.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/host.test.tsx@@ -10,8 +10,8 @@ import type { Artifact, PtcTrace } from '~/common';import { MessagePartsHostProvider, appMessagePartsHost } from '~/Providers/MessagePartsHostContext';import { SoleToolContext, useToolAutoExpand } from '../../disclosure';import ToolArtifactCard from '../ToolArtifactCard';+import { Text as TextPart } from '../index';import PtcToolTrace from '../PtcToolTrace';-import TextPart from '../Text';jest.mock('~/hooks', () => ({useLocalize: () => (key: string) => key,diff --git a/client/src/components/Chat/Messages/Content/Parts/index.ts b/client/src/components/Chat/Messages/Content/Parts/index.tsindex 7ef6fd25b9..1af9dddfa6 100644--- a/client/src/components/Chat/Messages/Content/Parts/index.ts+++ b/client/src/components/Chat/Messages/Content/Parts/index.ts@@ -1,19 +1,17 @@+import './renderers';+export * from './Attachment';export * from './OpenAIImageGen';-export { default as Text } from './Text';-export { default as CollapsibleText } from './CollapsibleText';+export { Text, Summary, EmptyText, AgentUpdate, CollapsibleText } from '@librechat/chat/components';export {default as Reasoning,ReasoningMarker,ReasoningCompact,StreamingThoughtPeek,} from './Reasoning';-export { default as EmptyText } from './EmptyText';export { default as LogContent } from './LogContent';export { default as ExecuteCode } from './ExecuteCode';-export { default as Summary } from './Summary';-export { default as AgentUpdate } from './AgentUpdate';export { default as SkillCall } from './SkillCall';export { default as MemoryCall } from './MemoryCall';export { default as ReadFileCall } from './ReadFileCall';diff --git a/client/src/components/Chat/Messages/Content/Parts/renderers.tsx b/client/src/components/Chat/Messages/Content/Parts/renderers.tsxnew file mode 100644index 0000000000..9671e69b55--- /dev/null+++ b/client/src/components/Chat/Messages/Content/Parts/renderers.tsx@@ -0,0 +1,21 @@+import { EModelEndpoint } from 'librechat-data-provider';+import type { Agent, TMessage } from 'librechat-data-provider';+import type { MessagePartsMarkdownProps } from '~/hooks/Chat/contract';+import MessageIcon from '~/components/Share/MessageIcon';+import { setAppPartRenderers } from './slots';+import MarkdownLite from '../MarkdownLite';+import Markdown from '../Markdown';++const agentMessage = { endpoint: EModelEndpoint.agents, isCreatedByUser: false } as TMessage;++setAppPartRenderers({+ renderMarkdown: ({ content, variant, isLatestMessage }: MessagePartsMarkdownProps) =>+ variant === 'lite' ? (+ <MarkdownLite content={content} />+ ) : (+ <Markdown content={content} isLatestMessage={isLatestMessage} />+ ),+ renderAgentIcon: (agent: Agent | undefined) => (+ <MessageIcon message={agentMessage} agent={agent} />+ ),+});diff --git a/client/src/components/Chat/Messages/Content/Parts/slots.ts b/client/src/components/Chat/Messages/Content/Parts/slots.tsnew file mode 100644index 0000000000..955d42a1a0--- /dev/null+++ b/client/src/components/Chat/Messages/Content/Parts/slots.ts@@ -0,0 +1,23 @@+import type { MessagePartsHost } from '~/hooks/Chat/contract';++/** The host slots drawn with app components that import the markdown stack. */+export type AppPartRenderers = Pick<MessagePartsHost, 'renderMarkdown' | 'renderAgentIcon'>;++let appPartRenderers: AppPartRenderers | null = null;++/**+ * Registers the app's slot renderers. The parts barrel registers them when it loads, so the app's+ * message parts host reads them without importing the markdown stack itself.+ */+export function setAppPartRenderers(renderers: AppPartRenderers): void {+ appPartRenderers = renderers;+}++export function getAppPartRenderers(): AppPartRenderers {+ if (appPartRenderers == null) {+ throw new Error(+ 'Message part renderers are registered by ~/components/Chat/Messages/Content/Parts.',+ );+ }+ return appPartRenderers;+}diff --git a/client/src/components/Chat/Subagents/SubagentActivity.test.tsx b/client/src/components/Chat/Subagents/SubagentActivity.test.tsxindex b3050ed5cb..45fcd6d145 100644--- a/client/src/components/Chat/Subagents/SubagentActivity.test.tsx+++ b/client/src/components/Chat/Subagents/SubagentActivity.test.tsx@@ -14,11 +14,6 @@ jest.mock('~/hooks', () => ({useLocalize: () => (key: string) => key,}));-jest.mock('~/components/Chat/Messages/Content/Parts/Text', () => ({- __esModule: true,- default: ({ text }: { text: string }) => <div>{text}</div>,-}));-jest.mock('~/components/Chat/Messages/Content/Parts', () => ({EmptyText: () => <div data-testid="thinking-cursor" />,}));diff --git a/client/src/hooks/Chat/contract.ts b/client/src/hooks/Chat/contract.tsindex e71f0a9053..313d89c07b 100644--- a/client/src/hooks/Chat/contract.ts+++ b/client/src/hooks/Chat/contract.ts@@ -281,6 +281,7 @@ export type {MessagePartsUser,MessagePartsToast,MessagePartMessage,+ MessagePartsMarkdownProps,MessagePartsUserTextPreferences,} from '@librechat/chat/react';diff --git a/e2e/specs/mock/scenarios/text-parts.spec.ts b/e2e/specs/mock/scenarios/text-parts.spec.tsnew file mode 100644index 0000000000..9934e55559--- /dev/null+++ b/e2e/specs/mock/scenarios/text-parts.spec.ts@@ -0,0 +1,132 @@+import { expect, test } from '@playwright/test';+import type { Page, Route } from '@playwright/test';+import { messagesView } from '../helpers';++/**+ * The text-like parts render from `@librechat/chat/components` and draw markdown through the+ * app's host slot. Each scenario loads a stored conversation and checks what the reader sees.+ */++const NO_PARENT = '00000000-0000-0000-0000-000000000000';+const unique = (prefix: string) => `${prefix}-${Date.now()}-${Math.floor(Math.random() * 1e6)}`;+const escapeRe = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');++type StoredMessage = {+ isCreatedByUser: boolean;+ text: string;+ content?: Array<Record<string, unknown>>;+};++/** Serves a conversation whose messages chain in the order given. */+async function openStoredConversation(page: Page, messages: StoredMessage[]): Promise<void> {+ const conversationId = unique('e2e-text-parts');+ const now = new Date(0).toISOString();+ const stored = messages.map((message, index) => ({+ messageId: `${conversationId}-${index}`,+ conversationId,+ parentMessageId: index === 0 ? NO_PARENT : `${conversationId}-${index - 1}`,+ sender: message.isCreatedByUser ? 'User' : 'Assistant',+ endpoint: 'Mock Provider A',+ model: 'mock-model-a',+ createdAt: now,+ updatedAt: now,+ ...message,+ }));+ const conversation = {+ conversationId,+ title: 'Text parts',+ endpoint: 'Mock Provider A',+ endpointType: 'custom',+ model: 'mock-model-a',+ createdAt: now,+ updatedAt: now,+ };+ const convoIdRe = escapeRe(conversationId);+ await page.route(new RegExp(`/api/convos/${convoIdRe}(?:\\?.*)?$`), (route: Route) =>+ route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify(conversation),+ }),+ );+ await page.route(new RegExp(`/api/messages/${convoIdRe}(?:\\?.*)?$`), (route: Route) =>+ route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(stored) }),+ );+ await page.goto(`/c/${conversationId}`, { timeout: 30000 });+}++test.describe('text-like message parts', () => {+ test.afterEach(async ({ page }) => {+ await page.unrouteAll();+ });++ test('assistant text renders as markdown through the host renderer @scenario:assistant-text-renders-markdown', async ({+ page,+ }) => {+ test.setTimeout(60000);+ const word = unique('strong');+ const source = `**${word}** and \`inline-code\``;+ await openStoredConversation(page, [+ { isCreatedByUser: true, text: 'question' },+ { isCreatedByUser: false, text: source, content: [{ type: 'text', text: source }] },+ ]);+ const view = messagesView(page);+ const text = view.locator('[data-message-text]').filter({ hasText: word });+ await expect(text.locator('strong', { hasText: word })).toBeVisible({ timeout: 15000 });+ await expect(text.locator('code', { hasText: 'inline-code' })).toBeVisible();+ });++ test('a stored summary opens to its text from its disclosure @scenario:summary-part-expands', async ({+ page,+ }) => {+ test.setTimeout(60000);+ const summary = unique('summary-body');+ await openStoredConversation(page, [+ { isCreatedByUser: true, text: 'question' },+ {+ isCreatedByUser: false,+ text: 'after the summary',+ content: [+ { type: 'summary', content: [{ type: 'text', text: summary }], tokenCount: 12 },+ { type: 'text', text: 'after the summary' },+ ],+ },+ ]);+ const view = messagesView(page);+ const disclosure = view.getByRole('button', { name: /Conversation summarized/ }).first();+ await expect(disclosure).toBeVisible({ timeout: 15000 });+ await expect(disclosure).toHaveAttribute('aria-expanded', 'false');+ await expect(view.getByRole('region', { name: 'Conversation summarized' })).toBeHidden();++ await disclosure.click();+ await expect(disclosure).toHaveAttribute('aria-expanded', 'true');+ await expect(view.getByText(summary)).toBeVisible();+ await expect(view.getByText('after the summary', { exact: true })).toBeVisible();+ });++ test('a long user message collapses behind show more @scenario:long-user-text-collapses', async ({+ page,+ }) => {+ test.setTimeout(60000);+ const tail = unique('tail');+ const long = `${Array.from({ length: 60 }, (_, i) => `line ${i}`).join('\n')}\n${tail}`;+ await openStoredConversation(page, [+ { isCreatedByUser: true, text: long },+ { isCreatedByUser: false, text: 'ok', content: [{ type: 'text', text: 'ok' }] },+ ]);+ const view = messagesView(page);+ const toggle = view.getByRole('button', { name: 'Show more' });+ await expect(toggle).toBeVisible({ timeout: 15000 });+ await expect(toggle).toHaveAttribute('aria-expanded', 'false');+ const regionId = await toggle.getAttribute('aria-controls');+ expect(regionId).toBeTruthy();+ const region = page.locator(`[id="${regionId}"]`);+ await expect(region).toHaveCSS('overflow-y', 'hidden');+ await expect(region).toContainText(tail);++ await toggle.click();+ const less = view.getByRole('button', { name: 'Show less' });+ await expect(less).toHaveAttribute('aria-expanded', 'true');+ await expect(region).not.toHaveCSS('overflow-y', 'hidden');+ });+});diff --git a/eslint-suppressions.json b/eslint-suppressions.jsonindex 96b54a023e..7ebadf29a4 100644--- a/eslint-suppressions.json+++ b/eslint-suppressions.json@@ -325,11 +325,6 @@"count": 1}},- "client/src/components/Chat/Messages/Content/Parts/CollapsibleText.tsx": {- "shadcn/no-restyle": {- "count": 2- }- },"client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx": {"shadcn/no-inline-styles": {"count": 1@@ -368,20 +363,6 @@"count": 1}},- "client/src/components/Chat/Messages/Content/Parts/Summary.tsx": {- "shadcn/no-arbitrary-values": {- "count": 1- },- "shadcn/no-inline-styles": {- "count": 1- },- "shadcn/no-restyle": {- "count": 9- },- "shadcn/require-static-classes": {- "count": 1- }- },"client/src/components/Chat/Messages/Content/Parts/Thinking.tsx": {"shadcn/no-inline-styles": {"count": 1@@ -1492,6 +1473,25 @@"count": 2}},+ "packages/chat/src/components/CollapsibleText.tsx": {+ "shadcn/no-restyle": {+ "count": 2+ }+ },+ "packages/chat/src/components/Summary.tsx": {+ "shadcn/no-arbitrary-values": {+ "count": 1+ },+ "shadcn/no-inline-styles": {+ "count": 1+ },+ "shadcn/no-restyle": {+ "count": 9+ },+ "shadcn/require-static-classes": {+ "count": 1+ }+ },"packages/client/src/components/Badge.tsx": {"design/disabled-recipe": {"count": 1diff --git a/eslint.config.mjs b/eslint.config.mjsindex bb55967c65..8f6a3fbe0d 100644--- a/eslint.config.mjs+++ b/eslint.config.mjs@@ -347,6 +347,14 @@ export default ['hover-button-active','open','split-parent',+ // Message-text markers the app's stylesheet paints; a @librechat/chat source cannot see+ // that stylesheet, so its lint has no Tailwind entry that declares them.+ 'markdown',+ 'prose',+ 'message-content',+ 'submitting',+ 'result-streaming',+ 'result-thinking',],},],diff --git a/package-lock.json b/package-lock.jsonindex f8a9c9a2fa..92fe411f9f 100644--- a/package-lock.json+++ b/package-lock.json@@ -41552,6 +41552,7 @@"@babel/preset-react": "^7.22.15","@babel/preset-typescript": "^7.21.0","@librechat/client": "*",+ "@testing-library/jest-dom": "^5.16.5","@testing-library/react": "^14.0.0","@types/jest": "^29.5.2","@types/react": "^18.2.11",@@ -41559,6 +41560,8 @@"jest": "^30.2.0","jest-environment-jsdom": "^30.2.0","librechat-data-provider": "*",+ "lucide": "^0.528.0",+ "lucide-react": "^0.528.0","react": "^18.2.0","react-dom": "^18.2.0","rimraf": "^6.1.3",@@ -41568,6 +41571,8 @@"peerDependencies": {"@librechat/client": "*","librechat-data-provider": "*",+ "lucide": "^0.528.0",+ "lucide-react": "^0.528.0","react": "^18.2.0 || ^19.1.0"}},diff --git a/packages/chat/jest.config.js b/packages/chat/jest.config.jsindex 333952fa2d..eae6f812d3 100644--- a/packages/chat/jest.config.js+++ b/packages/chat/jest.config.js@@ -6,8 +6,14 @@ module.exports = {coverageReporters: ['text', 'cobertura'],maxWorkers,restoreMocks: true,- // sse.js ships ES modules only, so jest transforms it like the app's own sources.- transformIgnorePatterns: ['/node_modules/(?!sse\\.js/)'],+ // sse.js and some of @librechat/client's dependencies ship ES modules only, so jest transforms+ // them like the package's own sources.+ transformIgnorePatterns: [+ '/node_modules/(?!(sse\\.js|@dicebear|lucide|lucide-react|morphicons|@ariakit/(react-components|react-utils|react-store|components|store|utils))/)',+ ],+ // The component library's resolver: its ESM-only @ariakit packages need the `import` condition.+ resolver: '<rootDir>/../client/jest.resolver.cjs',// The core runs without a DOM; a React spec opts into jsdom with a docblock.testEnvironment: 'node',+ setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],};diff --git a/packages/chat/package.json b/packages/chat/package.jsonindex 5df9e705b7..7a42df0e1a 100644--- a/packages/chat/package.json+++ b/packages/chat/package.json@@ -60,6 +60,8 @@"peerDependencies": {"@librechat/client": "*","librechat-data-provider": "*",+ "lucide": "^0.528.0",+ "lucide-react": "^0.528.0","react": "^18.2.0 || ^19.1.0"},"dependencies": {@@ -70,6 +72,7 @@"@babel/preset-react": "^7.22.15","@babel/preset-typescript": "^7.21.0","@librechat/client": "*",+ "@testing-library/jest-dom": "^5.16.5","@testing-library/react": "^14.0.0","@types/jest": "^29.5.2","@types/react": "^18.2.11",@@ -77,6 +80,8 @@"jest": "^30.2.0","jest-environment-jsdom": "^30.2.0","librechat-data-provider": "*",+ "lucide": "^0.528.0",+ "lucide-react": "^0.528.0","react": "^18.2.0","react-dom": "^18.2.0","rimraf": "^6.1.3",diff --git a/packages/chat/src/__tests__/locales.spec.ts b/packages/chat/src/__tests__/locales.spec.tsnew file mode 100644index 0000000000..52df4cf4e8--- /dev/null+++ b/packages/chat/src/__tests__/locales.spec.ts@@ -0,0 +1,31 @@+import fs from 'node:fs';+import path from 'node:path';++const SOURCE_ROOT = path.resolve(__dirname, '..');+const TRANSLATION = path.resolve(__dirname, '../../../../client/src/locales/en/translation.json');+const KEY = /['"`](com_[a-z0-9_]+)['"`]/g;++function sources(dir: string): string[] {+ return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {+ const full = path.join(dir, entry.name);+ if (entry.isDirectory()) {+ return entry.name === '__tests__' ? [] : sources(full);+ }+ return /\.tsx?$/.test(entry.name) ? [full] : [];+ });+}++/** `TranslationKeys` is `string` in the component library, so this is the type check for the keys+ * the package localizes through the app's shared i18next instance. */+describe('@librechat/chat localization keys', () => {+ it('names only keys the app defines in its English translations', () => {+ const translations: Record<string, string> = JSON.parse(fs.readFileSync(TRANSLATION, 'utf8'));+ const used = new Set(+ sources(SOURCE_ROOT).flatMap((file) =>+ Array.from(fs.readFileSync(file, 'utf8').matchAll(KEY), (match) => match[1]),+ ),+ );+ expect(used.size).toBeGreaterThan(0);+ expect([...used].filter((key) => !(key in translations))).toEqual([]);+ });+});diff --git a/packages/chat/src/components.ts b/packages/chat/src/components.tsindex f4d8e06be9..bf3296d2e9 100644--- a/packages/chat/src/components.ts+++ b/packages/chat/src/components.ts@@ -1,5 +1,10 @@/** Themed message and part components. Populated as the components move in. */export { Part } from './components/Part';+export { default as Text } from './components/Text';+export { default as Summary } from './components/Summary';+export { default as EmptyText } from './components/EmptyText';+export { default as AgentUpdate } from './components/AgentUpdate';+export { default as CollapsibleText } from './components/CollapsibleText';export type {PartProps,ContentPart,diff --git a/packages/chat/src/components/AgentUpdate.tsx b/packages/chat/src/components/AgentUpdate.tsxnew file mode 100644index 0000000000..fb7826d02a--- /dev/null+++ b/packages/chat/src/components/AgentUpdate.tsx@@ -0,0 +1,36 @@+import React from 'react';+import { useLocalize } from '@librechat/client';+import { useMessagePartsHost } from '../react/host';++interface AgentUpdateProps {+ currentAgentId: string;+}++const AgentUpdate: React.FC<AgentUpdateProps> = ({ currentAgentId }) => {+ const localize = useLocalize();+ const { useAgent, renderAgentIcon } = useMessagePartsHost();+ const currentAgent = useAgent(currentAgentId);+ if (!currentAgentId) {+ return null;+ }+ return (+ <div className="relative">+ <div className="absolute -left-6 flex h-full w-4 items-center justify-center">+ <div className="relative h-full w-4">+ <div className="border-border-medium absolute top-0 left-0 h-1/2 w-px border"></div>+ <div className="border-border-medium absolute top-1/2 left-0 h-px w-3 border"></div>+ </div>+ </div>+ <div className="my-4 flex items-center gap-2">+ <div className="flex h-6 w-6 items-center justify-center overflow-hidden rounded-full">+ {renderAgentIcon(currentAgent)}+ </div>+ <div className="text-text-primary text-base font-medium">+ {currentAgent?.name || localize('com_ui_agent')}+ </div>+ </div>+ </div>+ );+};++export default AgentUpdate;diff --git a/client/src/components/Chat/Messages/Content/Parts/CollapsibleText.tsx b/packages/chat/src/components/CollapsibleText.tsxsimilarity index 94%rename from client/src/components/Chat/Messages/Content/Parts/CollapsibleText.tsxrename to packages/chat/src/components/CollapsibleText.tsxindex ca283f0871..827697a5ee 100644--- a/client/src/components/Chat/Messages/Content/Parts/CollapsibleText.tsx+++ b/packages/chat/src/components/CollapsibleText.tsx@@ -1,9 +1,12 @@import { useLayoutEffect, memo, useId, useRef, useState } from 'react';import { ChevronDown, ChevronUp } from 'lucide-react';-import { Button, useRemScale } from '@librechat/client';-import type { ReactNode } from 'react';-import { useLocalize } from '~/hooks';-import { cn } from '~/utils';+import { cn, Button, useLocalize, useRemScale } from '@librechat/client';+import type { ReactNode, NamedExoticComponent } from 'react';++type CollapsibleTextProps = {+ enabled: boolean;+ children: ReactNode;+};/** Collapsed preview height (baseline px) for a long message before "Show more". The* tolerance below only decides whether the toggle appears: it absorbs the@@ -21,13 +24,10 @@ const OVERFLOW_TOLERANCE = 8;* in-page search. Renders children untouched while `enabled` is false, keeping* the DOM identical when the preference is off.*/-const CollapsibleText = memo(function CollapsibleText({+const CollapsibleText: NamedExoticComponent<CollapsibleTextProps> = memo(function CollapsibleText({enabled,children,-}: {- enabled: boolean;- children: ReactNode;-}) {+}: CollapsibleTextProps) {const localize = useLocalize();const remScale = useRemScale();const collapsedMaxHeight = COLLAPSED_MAX_HEIGHT * remScale;diff --git a/client/src/components/Chat/Messages/Content/Parts/EmptyText.tsx b/packages/chat/src/components/EmptyText.tsxsimilarity index 50%rename from client/src/components/Chat/Messages/Content/Parts/EmptyText.tsxrename to packages/chat/src/components/EmptyText.tsxindex 644bce9f92..3c90c1afa8 100644--- a/client/src/components/Chat/Messages/Content/Parts/EmptyText.tsx+++ b/packages/chat/src/components/EmptyText.tsx@@ -1,5 +1,6 @@import { memo } from 'react';-import { cn } from '~/utils';+import { cn } from '@librechat/client';+import type { NamedExoticComponent } from 'react';type EmptyTextPartProps = {/**@@ -14,21 +15,23 @@ type EmptyTextPartProps = {};/** Streaming cursor placeholder — no bottom margin to match Container's structure and prevent CLS */-const EmptyTextPart = memo(({ underHeaderIcon = false }: EmptyTextPartProps) => {- return (- <div- data-message-text- className="flex min-h-[1.25rem] flex-col items-start gap-3 overflow-visible"- >- <div className="markdown prose light w-full break-words">- <div className={cn('absolute', underHeaderIcon && 'ps-1.5')}>- <p className="submitting relative">- <span className="result-thinking" />- </p>+const EmptyTextPart: NamedExoticComponent<EmptyTextPartProps> = memo(+ ({ underHeaderIcon = false }: EmptyTextPartProps) => {+ return (+ <div+ data-message-text+ className="flex min-h-[1.25rem] flex-col items-start gap-3 overflow-visible"+ >+ <div className="markdown prose light w-full break-words">+ <div className={cn('absolute', underHeaderIcon && 'ps-1.5')}>+ <p className="submitting relative">+ <span className="result-thinking" />+ </p>+ </div></div></div>- </div>- );-});+ );+ },+);export default EmptyTextPart;diff --git a/client/src/components/Chat/Messages/Content/Parts/Summary.tsx b/packages/chat/src/components/Summary.tsxsimilarity index 97%rename from client/src/components/Chat/Messages/Content/Parts/Summary.tsxrename to packages/chat/src/components/Summary.tsxindex f0f72b85f5..47e89f7bed 100644--- a/client/src/components/Chat/Messages/Content/Parts/Summary.tsx+++ b/packages/chat/src/components/Summary.tsx@@ -1,12 +1,10 @@import { memo, useMemo, useState, useCallback, useRef, useId, useEffect } from 'react';import { Copy, Check } from 'lucide';import { ScrollText, ChevronDown, ChevronUp } from 'lucide-react';-import { Button, MorphIcon, TooltipAnchor } from '@librechat/client';+import { cn, Button, MorphIcon, useLocalize, TooltipAnchor } from '@librechat/client';+import type { MouseEvent, FocusEvent, NamedExoticComponent } from 'react';import type { SummaryContentPart } from 'librechat-data-provider';-import type { MouseEvent, FocusEvent } from 'react';-import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext';-import { useLocalize } from '~/hooks';-import { cn } from '~/utils';+import { useMessagePartsHost } from '../react/host';type SummaryProps = Pick<SummaryContentPart,@@ -200,7 +198,7 @@ const FloatingSummaryBar = memo(},);-const Summary = memo(+const Summary: NamedExoticComponent<SummaryProps> = memo(({ content, model, provider, tokenCount, summarizing, failed, initiatedBy }: SummaryProps) => {const contentId = useId();const localize = useLocalize();diff --git a/client/src/components/Chat/Messages/Content/Parts/Text.tsx b/packages/chat/src/components/Text.tsxsimilarity index 62%rename from client/src/components/Chat/Messages/Content/Parts/Text.tsxrename to packages/chat/src/components/Text.tsxindex f53743eb45..1fed55d75b 100644--- a/client/src/components/Chat/Messages/Content/Parts/Text.tsx+++ b/packages/chat/src/components/Text.tsx@@ -1,10 +1,8 @@-import { memo, useMemo, ReactElement } from 'react';-import MarkdownLite from '~/components/Chat/Messages/Content/MarkdownLite';-import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext';-import useSmoothStreaming from '~/hooks/Messages/useSmoothStreaming';-import Markdown from '~/components/Chat/Messages/Content/Markdown';+import { memo, useMemo } from 'react';+import { cn } from '@librechat/client';+import type { ReactNode, NamedExoticComponent } from 'react';+import { useMessagePartsHost } from '../react/host';import CollapsibleText from './CollapsibleText';-import { cn } from '~/utils';type TextPartProps = {text: string;@@ -12,13 +10,13 @@ type TextPartProps = {isCreatedByUser: boolean;};-type ContentType =- | ReactElement<React.ComponentProps<typeof Markdown>>- | ReactElement<React.ComponentProps<typeof MarkdownLite>>- | ReactElement;--const TextPart = memo(function TextPart({ text, isCreatedByUser, showCursor }: TextPartProps) {- const { useMessage, useUserTextPreferences } = useMessagePartsHost();+const TextPart: NamedExoticComponent<TextPartProps> = memo(function TextPart({+ text,+ isCreatedByUser,+ showCursor,+}: TextPartProps) {+ const { useMessage, useUserTextPreferences, useSmoothStreaming, renderMarkdown } =+ useMessagePartsHost();const { isSubmitting = false, isLatestMessage = false } = useMessage();const { enableUserMsgMarkdown, collapseLongUserMessages } = useUserTextPreferences();const smoothStreaming = useSmoothStreaming();@@ -29,15 +27,15 @@ const TextPart = memo(function TextPart({ text, isCreatedByUser, showCursor }: T[showCursor, isSubmitting, smoothStreaming, isCreatedByUser],);- const content: ContentType = useMemo(() => {+ const content: ReactNode = useMemo(() => {if (!isCreatedByUser) {- return <Markdown content={text} isLatestMessage={isLatestMessage} />;+ return renderMarkdown({ content: text, variant: 'full', isLatestMessage });} else if (enableUserMsgMarkdown) {- return <MarkdownLite content={text} />;+ return renderMarkdown({ content: text, variant: 'lite', isLatestMessage });} else {return <>{text}</>;}- }, [isCreatedByUser, enableUserMsgMarkdown, text, isLatestMessage]);+ }, [isCreatedByUser, enableUserMsgMarkdown, text, isLatestMessage, renderMarkdown]);return (<CollapsibleText enabled={isCreatedByUser && collapseLongUserMessages}>diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/CollapsibleText.test.tsx b/packages/chat/src/components/__tests__/CollapsibleText.spec.tsxsimilarity index 99%rename from client/src/components/Chat/Messages/Content/Parts/__tests__/CollapsibleText.test.tsxrename to packages/chat/src/components/__tests__/CollapsibleText.spec.tsxindex 09802e9655..6b9732677f 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/CollapsibleText.test.tsx+++ b/packages/chat/src/components/__tests__/CollapsibleText.spec.tsx@@ -1,3 +1,6 @@+/**+ * @jest-environment jsdom+ */import React from 'react';import { render, screen, fireEvent } from '@testing-library/react';import CollapsibleText from '../CollapsibleText';@@ -6,9 +9,6 @@ let mockRemScale = 1;jest.mock('@librechat/client', () => ({...jest.requireActual('@librechat/client'),useRemScale: () => mockRemScale,-}));--jest.mock('~/hooks', () => ({useLocalize: () => (key: string) => key,}));diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/EmptyText.spec.tsx b/packages/chat/src/components/__tests__/EmptyText.spec.tsxsimilarity index 96%rename from client/src/components/Chat/Messages/Content/Parts/__tests__/EmptyText.spec.tsxrename to packages/chat/src/components/__tests__/EmptyText.spec.tsxindex 4da847a4f9..4f4f1a189e 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/EmptyText.spec.tsx+++ b/packages/chat/src/components/__tests__/EmptyText.spec.tsx@@ -1,3 +1,6 @@+/**+ * @jest-environment jsdom+ */import React from 'react';import { render } from '@testing-library/react';import EmptyText from '../EmptyText';diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/Summary.test.tsx b/packages/chat/src/components/__tests__/Summary.spec.tsxsimilarity index 81%rename from client/src/components/Chat/Messages/Content/Parts/__tests__/Summary.test.tsxrename to packages/chat/src/components/__tests__/Summary.spec.tsxindex 828346c124..a38b7c5778 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/Summary.test.tsx+++ b/packages/chat/src/components/__tests__/Summary.spec.tsx@@ -1,16 +1,23 @@+/**+ * @jest-environment jsdom+ */import React from 'react';import { render, screen } from '@testing-library/react';+import type { MessagePartsHost } from '../../react/host';+import { setDefaultMessagePartsHost } from '../../react/host';import Summary from '../Summary';-jest.mock('~/hooks', () => ({+jest.mock('@librechat/client', () => ({+ ...jest.requireActual('@librechat/client'),useLocalize: () => (key: string) => key,}));const mockMessageContext = { current: { isSubmitting: false, isLatestMessage: false } };-jest.mock('~/Providers', () => ({- useMessageContext: () => mockMessageContext.current,-}));+setDefaultMessagePartsHost({+ useMessage: () => ({ messageId: 'msg-1', ...mockMessageContext.current }),+ useFontSize: () => 'text-base',+} as MessagePartsHost);const partialSummary = [{ type: 'text', text: 'Half a summary before the error' }] as never;diff --git a/packages/chat/src/components/__tests__/host.spec.tsx b/packages/chat/src/components/__tests__/host.spec.tsxnew file mode 100644index 0000000000..a6edf36735--- /dev/null+++ b/packages/chat/src/components/__tests__/host.spec.tsx@@ -0,0 +1,88 @@+/**+ * @jest-environment jsdom+ */+import { render, screen } from '@testing-library/react';+import type { Agent } from 'librechat-data-provider';+import type { MessagePartsHost, MessagePartsMarkdownProps } from '../../react/host';+import { MessagePartsHostProvider } from '../../react/host';+import AgentUpdate from '../AgentUpdate';+import Text from '../Text';++jest.mock('@librechat/client', () => ({+ ...jest.requireActual('@librechat/client'),+ useLocalize: () => (key: string) => key,+}));++const agent = { id: 'agent-1', name: 'Researcher' } as Agent;++function createHost(enableUserMsgMarkdown = false): MessagePartsHost {+ return {+ useMessage: () => ({ messageId: 'msg-1', isSubmitting: false, isLatestMessage: true }),+ renderMarkdown: ({ content, variant, isLatestMessage }: MessagePartsMarkdownProps) => (+ <div data-testid={`markdown-${variant}`} data-latest={String(isLatestMessage)}>+ {content}+ </div>+ ),+ useSmoothStreaming: () => false,+ useAgent: (agentId) => (agentId === agent.id ? agent : undefined),+ renderAgentIcon: (current) => <span data-testid="agent-icon">{current?.id ?? 'unknown'}</span>,+ useFontSize: () => 'text-base',+ useShowThinking: () => false,+ useAutoExpandTools: () => false,+ useUserTextPreferences: () => ({+ usernameDisplay: false,+ enableUserMsgMarkdown,+ collapseLongUserMessages: false,+ }),+ useUser: () => undefined,+ useFileMap: () => undefined,+ useToast: () => jest.fn(),+ useSandboxStarting: () => false,+ useToolArtifactClaim: () => [null, jest.fn()],+ useSteerEscalating: () => false,+ usePaneConversationId: () => null,+ useLiveAppliedSteer: () => [false, jest.fn()],+ };+}++const renderWith = (host: MessagePartsHost, ui: React.ReactElement) =>+ render(<MessagePartsHostProvider host={host}>{ui}</MessagePartsHostProvider>);++describe('text-like parts read the app through the host', () => {+ it('renders assistant text with the host markdown renderer', () => {+ renderWith(createHost(), <Text text="**hi**" isCreatedByUser={false} showCursor={false} />);+ const markdown = screen.getByTestId('markdown-full');+ expect(markdown).toHaveTextContent('**hi**');+ expect(markdown).toHaveAttribute('data-latest', 'true');+ });++ it('renders user text as lite markdown only when the viewer opted in', () => {+ const { unmount } = renderWith(+ createHost(true),+ <Text text="user *text*" isCreatedByUser showCursor={false} />,+ );+ expect(screen.getByTestId('markdown-lite')).toHaveTextContent('user *text*');+ unmount();++ renderWith(createHost(false), <Text text="user *text*" isCreatedByUser showCursor={false} />);+ expect(screen.queryByTestId('markdown-lite')).not.toBeInTheDocument();+ expect(screen.getByText('user *text*')).toBeInTheDocument();+ });++ it('labels an agent handoff with the host agent and its icon', () => {+ renderWith(createHost(), <AgentUpdate currentAgentId="agent-1" />);+ expect(screen.getByText('Researcher')).toBeInTheDocument();+ expect(screen.getByTestId('agent-icon')).toHaveTextContent('agent-1');+ });++ it('falls back to the generic agent label for an agent the host does not know', () => {+ renderWith(createHost(), <AgentUpdate currentAgentId="agent-2" />);+ expect(screen.getByText('com_ui_agent')).toBeInTheDocument();+ expect(screen.getByTestId('agent-icon')).toHaveTextContent('unknown');+ });++ it('renders nothing without an agent id', () => {+ const { container } = renderWith(createHost(), <AgentUpdate currentAgentId="" />);+ expect(container).toBeEmptyDOMElement();+ });+});diff --git a/packages/chat/src/react.ts b/packages/chat/src/react.tsindex a6053d3d41..81aa78c4e9 100644--- a/packages/chat/src/react.ts+++ b/packages/chat/src/react.ts@@ -10,5 +10,6 @@ export type {MessagePartsUser,MessagePartsToast,MessagePartMessage,+ MessagePartsMarkdownProps,MessagePartsUserTextPreferences,} from './react/host';diff --git a/packages/chat/src/react/__tests__/host.spec.tsx b/packages/chat/src/react/__tests__/host.spec.tsxindex cce9ac76dc..8865f9033c 100644--- a/packages/chat/src/react/__tests__/host.spec.tsx+++ b/packages/chat/src/react/__tests__/host.spec.tsx@@ -7,6 +7,10 @@ import { MessagePartsHostProvider, setDefaultMessagePartsHost, useMessagePartsHoconst createHost = (fontSize: string): MessagePartsHost => ({useMessage: () => ({ messageId: 'm1' }),+ renderMarkdown: ({ content }) => content,+ useSmoothStreaming: () => false,+ useAgent: () => undefined,+ renderAgentIcon: () => null,useFontSize: () => fontSize,useShowThinking: () => false,useAutoExpandTools: () => false,diff --git a/packages/chat/src/react/host.tsx b/packages/chat/src/react/host.tsxindex 79640d8828..0a9b64d950 100644--- a/packages/chat/src/react/host.tsx+++ b/packages/chat/src/react/host.tsx@@ -1,6 +1,6 @@import { createContext, useContext } from 'react';import type { Dispatch, ReactNode, SetStateAction } from 'react';-import type { TFile } from 'librechat-data-provider';+import type { Agent, TFile } from 'librechat-data-provider';import type { TShowToast } from '@librechat/client';/** The message a part renders in, as its host reports it. */@@ -31,10 +31,22 @@ export type MessagePartsUser = { name?: string; username?: string } | undefined;/** Shows a transient notification. */export type MessagePartsToast = (toast: TShowToast) => void;+/** What a part asks the host's markdown renderer to draw. */+export type MessagePartsMarkdownProps = {+ /** The markdown source. */+ content: string;+ /** `full` for assistant text, `lite` for user-authored text rendered as markdown. */+ variant: 'full' | 'lite';+ /** Whether the text belongs to the tail of the active branch. */+ isLatestMessage: boolean;+};+/*** Everything the message part components read from the app, supplied by the view that renders* them through `MessagePartsHostProvider`. Members are hooks, called unconditionally by the parts- * that need them, so keyed reads subscribe to one key only. A host must stay the same object for+ * that need them, so keyed reads subscribe to one key only; `render*` members are slots that return+ * the app's own elements, for renderers too large to move (markdown) or owned elsewhere (icons).+ * A host must stay the same object for* the life of the tree it wraps. Setters are typed as React dispatchers, so* the contract names no state library.*@@ -44,6 +56,14 @@ export type MessagePartsToast = (toast: TShowToast) => void;export interface MessagePartsHost {/** The message the calling part renders in. */useMessage: () => MessagePartMessage;+ /** Renders markdown with the app's renderer. */+ renderMarkdown: (props: MessagePartsMarkdownProps) => ReactNode;+ /** Whether streamed text fades in word by word: the viewer's setting, unless motion is reduced. */+ useSmoothStreaming: () => boolean;+ /** An agent the viewer can see, by id. */+ useAgent: (agentId: string) => Agent | undefined;+ /** Renders an agent's avatar; `undefined` when the agent is unknown. */+ renderAgentIcon: (agent: Agent | undefined) => ReactNode;/** The viewer's font size utility, applied to reasoning and summary text. */useFontSize: () => string;/** Whether the viewer wants reasoning expanded by default. */diff --git a/packages/chat/tsconfig.json b/packages/chat/tsconfig.jsonindex ff6ee0f3bb..936429fdfc 100644--- a/packages/chat/tsconfig.json+++ b/packages/chat/tsconfig.json@@ -17,7 +17,7 @@"outDir": "./dist","rootDir": "./src","lib": ["ES2020", "DOM", "DOM.Iterable"],- "types": ["jest"]+ "types": ["jest", "@testing-library/jest-dom"]},"include": ["src/**/*"],"exclude": ["dist", "node_modules"]diff --git a/scripts/static-checks.mts b/scripts/static-checks.mtsindex afeaace4b7..98959d98c7 100644--- a/scripts/static-checks.mts+++ b/scripts/static-checks.mts@@ -1487,11 +1487,16 @@ async function introducedWithinAllowance(return [`the base versions could not be linted: ${(error as Error).message}`];}+ /** A diagnostic is compared by its first sentence, the violation itself. What follows is the+ * remedy, and it depends on where the file sits: a client path is offered the app's own+ * compositions (`PanelContent`), a package path is not, so the same violation reads differently+ * on either side of a move. */+ const diagnosis = (message: string): string => /^.*?\.(?=\s|$)/.exec(message)?.[0] ?? message;const signatures = (reports: LintReport[]): string[] =>reports.flatMap((file) => [...file.messages, ...(file.suppressedMessages ?? [])]).filter((message) => isDesignRule(message.ruleId))- .map((message) => `${message.ruleId}: ${message.message ?? ''}`);+ .map((message) => `${message.ruleId}: ${diagnosis(message.message ?? '')}`);/** The record as the base held it: how much an entry grew between there and* here is what this change may add. A count that goes up is a line in the