Skip to content

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

🧽 refactor: Import Composer State and Restore from the Chat Package (#17163)

Marco Berettab06224bf60f0
diff --git a/client/src/Providers/ComposerRestoreContext.tsx b/client/src/Providers/ComposerRestoreContext.tsx
deleted file mode 100644
index 07bd5164f9..0000000000
--- a/client/src/Providers/ComposerRestoreContext.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-export { ComposerRestoreProvider, useComposerRestoreHost } from '@librechat/chat/react';
-export type { RestoreToComposer, RewakeDrain, ComposerRestoreHost } from '@librechat/chat/react';
diff --git a/client/src/Providers/index.ts b/client/src/Providers/index.ts
index 3403d017df..d905124956 100644
--- a/client/src/Providers/index.ts
+++ b/client/src/Providers/index.ts
@@ -24,6 +24,5 @@ export * from './ArtifactsContext';
export * from './PromptGroupsContext';
export * from './MessagesViewContext';
export * from './MCPAppsPolicyContext';
-export * from './ComposerRestoreContext';
export * from './MediaContext';
export { default as BadgeRowProvider } from './BadgeRowContext';
diff --git a/client/src/components/Chat/ChatView.tsx b/client/src/components/Chat/ChatView.tsx
index 93506c6d69..f680255f50 100644
--- a/client/src/components/Chat/ChatView.tsx
+++ b/client/src/components/Chat/ChatView.tsx
@@ -5,7 +5,7 @@ import { useForm } from 'react-hook-form';
import { Spinner } from '@librechat/client';
import { useParams } from 'react-router-dom';
import { Constants, buildTree } from 'librechat-data-provider';
-import { useIsSubmitting, submissionByIndex } from '@librechat/chat/react';
+import { useIsSubmitting, submissionByIndex, ComposerRestoreProvider } from '@librechat/chat/react';
import type { TChatProject } from 'librechat-data-provider';
import type { ChatFormValues } from '~/common';
import {
@@ -18,13 +18,7 @@ import {
useQueuedTurnReveal,
useLocalize,
} from '~/hooks';
-import {
- ChatContext,
- AddedChatContext,
- ChatFormProvider,
- useFileMapContext,
- ComposerRestoreProvider,
-} from '~/Providers';
+import { ChatContext, AddedChatContext, ChatFormProvider, useFileMapContext } from '~/Providers';
import Footer, { useLandingFooter, useConfiguredFooter } from './Footer';
import { QueuedTurnPortalProvider } from './Steering/QueuedTurnPortal';
import { useChatSettings } from '~/Providers/ChatSettingsContext';
diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx
index 5df46cc66c..b77001066b 100644
--- a/client/src/components/Chat/Input/ChatForm.tsx
+++ b/client/src/components/Chat/Input/ChatForm.tsx
@@ -3,7 +3,7 @@ import { useAtom } from 'jotai';
import { useRecoilValue } from 'recoil';
import { useWatch } from 'react-hook-form';
import { useNavigate } from 'react-router-dom';
-import { useSteering, showStopButtonByIndex } from '@librechat/chat/react';
+import { useSteering, showStopButtonByIndex, useComposerRestoreHost } from '@librechat/chat/react';
import {
composerSurfaceClasses,
composerSurfaceShadow,
@@ -48,7 +48,6 @@ import {
useChatFormContext,
useAddedChatContext,
useAssistantsMapContext,
- useComposerRestoreHost,
BadgeRowProvider,
} from '~/Providers';
import {
diff --git a/client/src/components/Chat/Input/Composer/Queue.tsx b/client/src/components/Chat/Input/Composer/Queue.tsx
index 0565ef3705..53dbacec89 100644
--- a/client/src/components/Chat/Input/Composer/Queue.tsx
+++ b/client/src/components/Chat/Input/Composer/Queue.tsx
@@ -31,10 +31,10 @@ import {
TriangleAlert,
MessageSquarePlus,
} from 'lucide-react';
+import type { RestoreToComposer } from '@librechat/chat/react';
import type { SteeringControls } from '@librechat/chat/react';
import type { MenuItemProps } from '@librechat/client';
import type { QueuedMessage } from '@librechat/chat';
-import type { RestoreToComposer } from '~/Providers/ComposerRestoreContext';
import { useQueuedTurnPortal } from '~/components/Chat/Steering/QueuedTurnPortal';
import EscalateNowButton from '~/components/Chat/Input/EscalateNowButton';
import { useLocalize } from '~/hooks';
diff --git a/client/src/components/Chat/Input/Composer/state.ts b/client/src/components/Chat/Input/Composer/state.ts
index 2c7ab707dd..58d07dd9c7 100644
--- a/client/src/components/Chat/Input/Composer/state.ts
+++ b/client/src/components/Chat/Input/Composer/state.ts
@@ -1,14 +1,5 @@
import { atom } from 'jotai';
import { atomFamily } from 'jotai/utils';
-export {
- getReasoningStateKey,
- pendingQuotesByConvoId,
- pendingManualSkillsByConvoId,
- clearPendingComposerContext,
- pendingReasoningOverrideFamily,
- clearPendingReasoningOverrides,
-} from '@librechat/chat/react';
-
/** Landing-page lift is composer-owned UI state, scoped to its split pane. */
export const composerLiftFamily = atomFamily((_index: number) => atom(0));
diff --git a/client/src/components/Chat/Input/QuoteButton.tsx b/client/src/components/Chat/Input/QuoteButton.tsx
index 83d524a7fd..9d7eda9d90 100644
--- a/client/src/components/Chat/Input/QuoteButton.tsx
+++ b/client/src/components/Chat/Input/QuoteButton.tsx
@@ -2,7 +2,7 @@ import { memo, useRef, useEffect, useCallback, useLayoutEffect } from 'react';
import { useSetAtom } from 'jotai';
import { createPortal } from 'react-dom';
import { TextQuote } from 'lucide-react';
-import { pendingQuotesByConvoId } from '~/components/Chat/Input/Composer/state';
+import { pendingQuotesByConvoId } from '@librechat/chat/react';
import { cn, MAX_QUOTE_COUNT } from '~/utils';
import { mainTextareaId } from '~/common';
import { useLocalize } from '~/hooks';
diff --git a/client/src/components/Chat/Input/Reasoning.tsx b/client/src/components/Chat/Input/Reasoning.tsx
index a5373f292c..d98cca286a 100644
--- a/client/src/components/Chat/Input/Reasoning.tsx
+++ b/client/src/components/Chat/Input/Reasoning.tsx
@@ -4,6 +4,7 @@ import { useAtom, useStore, useAtomValue } from 'jotai';
import { submissionByIndex } from '@librechat/chat/react';
import { Button, Input, Slider } from '@librechat/client';
import { BrainCircuit, ChevronDown, X } from 'lucide-react';
+import { getReasoningStateKey, pendingReasoningOverrideFamily } from '@librechat/chat/react';
import {
Constants,
ReasoningParameterFormat,
@@ -22,7 +23,6 @@ import type {
TReasoningOverride,
} from 'librechat-data-provider';
import type { TranslationKeys } from '~/hooks';
-import { getReasoningStateKey, pendingReasoningOverrideFamily } from './Composer/state';
import { useGetAgentByIdQuery, useGetEndpointsQuery } from '~/data-provider';
import { useModelReasoning } from '~/hooks/Endpoint/useModelReasoning';
import { formatTokens, resolveAgentTarget } from '~/utils';
diff --git a/client/src/components/Chat/Input/SkillsCommand.tsx b/client/src/components/Chat/Input/SkillsCommand.tsx
index bc8ead6dbd..86143a749b 100644
--- a/client/src/components/Chat/Input/SkillsCommand.tsx
+++ b/client/src/components/Chat/Input/SkillsCommand.tsx
@@ -3,11 +3,11 @@ import { ScrollText } from 'lucide-react';
import { useSetRecoilState } from 'recoil';
import { useSetAtom, useAtomValue } from 'jotai';
import { AutoSizer, List } from 'react-virtualized';
+import { pendingManualSkillsByConvoId } from '@librechat/chat/react';
import { Input, Spinner, useCombobox, useRemScale } from '@librechat/client';
import { SkillsScope, resolveAgentSkillsScope } from 'librechat-data-provider';
import type { TSkillSummary } from 'librechat-data-provider';
import type { MentionOption } from '~/common';
-import { pendingManualSkillsByConvoId } from '~/components/Chat/Input/Composer/state';
import useInitPopoverInput from '~/hooks/Input/useInitPopoverInput';
import { useLocalize, useSkillActiveState } from '~/hooks';
import { useSkillsInfiniteQuery } from '~/data-provider';
diff --git a/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx b/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx
index 2c2be111f7..b9b9d1d85a 100644
--- a/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx
+++ b/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx
@@ -14,7 +14,6 @@ import { render, screen, within, waitFor, fireEvent } from '@testing-library/rea
import type { TFile, TFileUpload, TConversation } from 'librechat-data-provider';
import type { ChatFormValues, TAskFunction } from '~/common';
import type { TranslationKeys } from '~/hooks/useLocalize';
-import { pendingQuotesByConvoId } from '~/components/Chat/Input/Composer/state';
import { getDraft, getPendingDraftId, setDraft } from '~/utils';
import { ChatContext, ChatFormProvider } from '~/Providers';
import { AuthContextProvider } from '~/hooks/AuthContext';
@@ -22,6 +21,7 @@ import * as FileContainer from '../Files/FileContainer';
import ChatForm from '../ChatForm';
import store from '~/store';
import '~/Providers/SteerHostContext';
+import { pendingQuotesByConvoId } from '@librechat/chat/react';
const mockUpload = jest.fn();
const mockAsk = jest.fn();
diff --git a/client/src/components/Chat/Input/__tests__/QuoteButton.test.tsx b/client/src/components/Chat/Input/__tests__/QuoteButton.test.tsx
index c329efc322..203c185d1d 100644
--- a/client/src/components/Chat/Input/__tests__/QuoteButton.test.tsx
+++ b/client/src/components/Chat/Input/__tests__/QuoteButton.test.tsx
@@ -7,8 +7,8 @@ jest.mock('~/hooks', () => ({
}));
import QuoteButton from '../QuoteButton';
-import { pendingQuotesByConvoId } from '~/components/Chat/Input/Composer/state';
import { mainTextareaId } from '~/common';
+import { pendingQuotesByConvoId } from '@librechat/chat/react';
const CONVO_ID = 'convo-1';
const SELECTED_TEXT = 'Selected assistant text';
diff --git a/client/src/components/Chat/Input/__tests__/Reasoning.spec.tsx b/client/src/components/Chat/Input/__tests__/Reasoning.spec.tsx
index de4e873332..adaafa4e66 100644
--- a/client/src/components/Chat/Input/__tests__/Reasoning.spec.tsx
+++ b/client/src/components/Chat/Input/__tests__/Reasoning.spec.tsx
@@ -3,6 +3,7 @@ import { Constants, ReasoningEffort } from 'librechat-data-provider';
import { submissionByIndex, clearSubmissions } from '@librechat/chat/react';
import { Provider as JotaiProvider, createStore, getDefaultStore } from 'jotai';
import { act, fireEvent, render, renderHook, screen, waitFor } from '@testing-library/react';
+import { getReasoningStateKey, pendingReasoningOverrideFamily } from '@librechat/chat/react';
import type {
SettingDefinition,
TConversation,
@@ -11,7 +12,6 @@ import type {
TReasoningCapabilityMap,
} from 'librechat-data-provider';
import type { ReactNode } from 'react';
-import { getReasoningStateKey, pendingReasoningOverrideFamily } from '../Composer/state';
import { ReasoningControl, useComposerReasoning } from '../Reasoning';
type MockEndpointConfig = {
diff --git a/client/src/components/Chat/Input/__tests__/SkillsCommand.spec.tsx b/client/src/components/Chat/Input/__tests__/SkillsCommand.spec.tsx
index 0e2ad10d68..68c9590271 100644
--- a/client/src/components/Chat/Input/__tests__/SkillsCommand.spec.tsx
+++ b/client/src/components/Chat/Input/__tests__/SkillsCommand.spec.tsx
@@ -40,7 +40,8 @@ jest.mock('jotai', () => ({
}),
}));
-jest.mock('~/components/Chat/Input/Composer/state', () => ({
+jest.mock('@librechat/chat/react', () => ({
+ ...jest.requireActual('@librechat/chat/react'),
pendingManualSkillsByConvoId: () => 'pending-manual-skills',
}));
diff --git a/client/src/components/Messages/Content/Error/recovery.tsx b/client/src/components/Messages/Content/Error/recovery.tsx
index eed80a25a9..2219a4ad5b 100644
--- a/client/src/components/Messages/Content/Error/recovery.tsx
+++ b/client/src/components/Messages/Content/Error/recovery.tsx
@@ -9,6 +9,12 @@ import {
messageCarriesFiles,
isAssistantsEndpoint,
} from 'librechat-data-provider';
+import {
+ pendingQuotesByConvoId,
+ getReasoningStateKey,
+ pendingManualSkillsByConvoId,
+ pendingReasoningOverrideFamily,
+} from '@librechat/chat/react';
import type { TMessage } from 'librechat-data-provider';
import type { AttachmentRecovery } from './attachments';
import type { TranslationKeys } from '~/hooks';
@@ -18,12 +24,6 @@ import {
useOptionalMessagesOperations,
useOptionalMessagesConversation,
} from '~/Providers/MessagesViewContext';
-import {
- pendingQuotesByConvoId,
- getReasoningStateKey,
- pendingManualSkillsByConvoId,
- pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
import { findAttachmentRecovery, isAttachmentError, mayBeAttachmentError } from './attachments';
import useGetAddedConvo from '~/hooks/Conversations/useGetAddedConvo';
import { useMessageContext } from '~/Providers/MessageContext';
diff --git a/client/src/components/Messages/Content/__tests__/recovery.spec.tsx b/client/src/components/Messages/Content/__tests__/recovery.spec.tsx
index a9a0202a82..ab14292285 100644
--- a/client/src/components/Messages/Content/__tests__/recovery.spec.tsx
+++ b/client/src/components/Messages/Content/__tests__/recovery.spec.tsx
@@ -4,15 +4,15 @@ import { RecoilRoot, useRecoilValue } from 'recoil';
import { getDefaultStore, useAtomValue } from 'jotai';
import { act, render, screen } from '@testing-library/react';
import { Constants, ContentTypes, ForkOptions } from 'librechat-data-provider';
-import type { TConversation, TMessage } from 'librechat-data-provider';
-import type { MessagesViewContextValue } from '~/Providers/MessagesViewContext';
-import type { ChatContract } from '~/hooks/Chat/contract';
import {
getReasoningStateKey,
pendingQuotesByConvoId,
pendingManualSkillsByConvoId,
pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
+} from '@librechat/chat/react';
+import type { TConversation, TMessage } from 'librechat-data-provider';
+import type { MessagesViewContextValue } from '~/Providers/MessagesViewContext';
+import type { ChatContract } from '~/hooks/Chat/contract';
import {
MessagesViewContext,
MessagesSubmittingContext,
diff --git a/client/src/hooks/Chat/__tests__/useChatFunctions.regenerate.spec.tsx b/client/src/hooks/Chat/__tests__/useChatFunctions.regenerate.spec.tsx
index e40ea39e64..f234cda103 100644
--- a/client/src/hooks/Chat/__tests__/useChatFunctions.regenerate.spec.tsx
+++ b/client/src/hooks/Chat/__tests__/useChatFunctions.regenerate.spec.tsx
@@ -1,5 +1,6 @@
import { renderHook, act } from '@testing-library/react';
import { Provider as JotaiProvider, createStore } from 'jotai';
+import { pendingReasoningOverrideFamily } from '@librechat/chat/react';
import {
Constants,
ContentTypes,
@@ -29,7 +30,6 @@ import {
pendingUsageFamily,
} from '~/components/Chat/Input/TokenUsage/store';
import { ChatSettingsContext, defaultChatSettings } from '~/Providers/ChatSettingsContext';
-import { pendingReasoningOverrideFamily } from '~/components/Chat/Input/Composer/state';
import useChatFunctions from '../useChatFunctions';
import { isPasteSubmitted } from '~/utils';
diff --git a/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsx b/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsx
index 55a81554ff..b3ad973fb3 100644
--- a/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsx
+++ b/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsx
@@ -8,14 +8,11 @@ import {
pendingSteersByConvoId,
resetSteerFamilies,
} from '@librechat/chat/react';
-import type { RestoreToComposer } from '~/Providers/ComposerRestoreContext';
-import {
- ComposerRestoreProvider,
- useComposerRestoreHost,
-} from '~/Providers/ComposerRestoreContext';
import '~/Providers/SteerHostContext';
import { useSteerCancel, useSteerMoveToQueue } from '@librechat/chat/react';
import { queuedMessagesByConvoId, resetQueueFamilies } from '@librechat/chat/react';
+import { ComposerRestoreProvider, useComposerRestoreHost } from '@librechat/chat/react';
+import type { RestoreToComposer } from '@librechat/chat/react';
import type { PendingSteer } from '@librechat/chat';
const mockCancelAsync = jest.fn();
diff --git a/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsx b/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsx
index 293b98d97e..75bd70ea5e 100644
--- a/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsx
+++ b/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsx
@@ -11,17 +11,14 @@ import {
pendingSteersByConvoId,
resetSteerFamilies,
} from '@librechat/chat/react';
-import type { RewakeDrain } from '~/Providers/ComposerRestoreContext';
-import {
- ComposerRestoreProvider,
- useComposerRestoreHost,
-} from '~/Providers/ComposerRestoreContext';
import { ChatSettingsContext, defaultChatSettings } from '~/Providers/ChatSettingsContext';
import { usePaneConversations } from '~/routes/ChatSettings';
import useSteerRecovery from '../useSteerRecovery';
import store from '~/store';
import '~/Providers/SteerHostContext';
import { queuedMessagesByConvoId, resetQueueFamilies } from '@librechat/chat/react';
+import { ComposerRestoreProvider, useComposerRestoreHost } from '@librechat/chat/react';
+import type { RewakeDrain } from '@librechat/chat/react';
const mockMutateAsync = jest.fn();
const mockCancelSteer = jest.fn();
diff --git a/client/src/hooks/Chat/__tests__/useSteering.spec.tsx b/client/src/hooks/Chat/__tests__/useSteering.spec.tsx
index cfc48a5cab..b87b04be5e 100644
--- a/client/src/hooks/Chat/__tests__/useSteering.spec.tsx
+++ b/client/src/hooks/Chat/__tests__/useSteering.spec.tsx
@@ -29,12 +29,6 @@ import {
} from '@librechat/chat/react';
import type { CodeApprovalMode, TConversation, TFile, TMessage } from 'librechat-data-provider';
import type { ExtendedFile } from '~/common';
-import {
- getReasoningStateKey,
- pendingQuotesByConvoId,
- pendingManualSkillsByConvoId,
- pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
import { clearAllDrafts, getPendingDraftId, getNewConversationDraftId } from '~/utils';
import useUpdateFiles from '~/hooks/Files/useUpdateFiles';
import ChatSettingsProvider from '~/routes/ChatSettings';
@@ -48,6 +42,12 @@ import {
hasLiveRunPause,
hydrateFileDeliveryMetadata as mergeQueuedTurnFileMetadata,
} from '@librechat/chat';
+import {
+ getReasoningStateKey,
+ pendingQuotesByConvoId,
+ pendingManualSkillsByConvoId,
+ pendingReasoningOverrideFamily,
+} from '@librechat/chat/react';
import {
pendingQueuedTurnEnqueueIdsByConvoId,
settledQueuedTurnReceiptsByConvoId,
diff --git a/client/src/hooks/Chat/useChatFunctions.ts b/client/src/hooks/Chat/useChatFunctions.ts
index ece1cb0a1d..168badea82 100644
--- a/client/src/hooks/Chat/useChatFunctions.ts
+++ b/client/src/hooks/Chat/useChatFunctions.ts
@@ -16,6 +16,12 @@ import {
showStopButtonByIndex,
revealedQueuedTurnFamily,
} from '@librechat/chat/react';
+import {
+ getReasoningStateKey,
+ pendingQuotesByConvoId,
+ pendingManualSkillsByConvoId,
+ pendingReasoningOverrideFamily,
+} from '@librechat/chat/react';
import type {
TMessage,
TSubmission,
@@ -24,12 +30,6 @@ import type {
} from 'librechat-data-provider';
import type { SetterOrUpdater } from 'recoil';
import type { TAskFunction, ExtendedFile } from '~/common';
-import {
- getReasoningStateKey,
- pendingQuotesByConvoId,
- pendingManualSkillsByConvoId,
- pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
import {
withSubmittedCodeDecision,
resolveSubmittedCodeApprovalMode,
diff --git a/client/src/hooks/Chat/useSteerRecovery.ts b/client/src/hooks/Chat/useSteerRecovery.ts
index faa44c00fd..82ba229fe2 100644
--- a/client/src/hooks/Chat/useSteerRecovery.ts
+++ b/client/src/hooks/Chat/useSteerRecovery.ts
@@ -1,5 +1,6 @@
import { useCallback } from 'react';
import { useStore } from 'jotai';
+import { useComposerRestoreHost } from '@librechat/chat/react';
import { getSteerErrorCode, isDefiniteSteerRejection } from '@librechat/chat';
import {
useSteerRehome,
@@ -11,7 +12,6 @@ import {
} from '@librechat/chat/react';
import type { PendingSteer } from '@librechat/chat';
import { useSteerMessageMutation, useCancelSteerMutation } from '~/data-provider';
-import { useComposerRestoreHost } from '~/Providers/ComposerRestoreContext';
import { carriedSteerContext, isLegacyDeliveryUncertain } from '~/utils';
import { useChatSettings } from '~/Providers/ChatSettingsContext';
diff --git a/client/src/hooks/Config/__tests__/useClearStates.spec.tsx b/client/src/hooks/Config/__tests__/useClearStates.spec.tsx
index f2da70325c..d27f1877a0 100644
--- a/client/src/hooks/Config/__tests__/useClearStates.spec.tsx
+++ b/client/src/hooks/Config/__tests__/useClearStates.spec.tsx
@@ -4,6 +4,9 @@ import { act, renderHook } from '@testing-library/react';
import { createStore, Provider as JotaiProvider } from 'jotai';
import { Constants, ReasoningEffort } from 'librechat-data-provider';
import {
+ pendingQuotesByConvoId,
+ pendingManualSkillsByConvoId,
+ pendingReasoningOverrideFamily,
filesFamily,
presetFamily,
abortScrollFamily,
@@ -13,11 +16,6 @@ import {
} from '@librechat/chat/react';
import type { TPreset } from 'librechat-data-provider';
import type { ExtendedFile } from '~/common';
-import {
- pendingQuotesByConvoId,
- pendingManualSkillsByConvoId,
- pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
import { filesDialogTriggerAtom, showFilesDialogAtom } from '~/store/filesDialog';
import useClearStates from '../useClearStates';
import store from '~/store';
diff --git a/client/src/hooks/Config/useClearStates.ts b/client/src/hooks/Config/useClearStates.ts
index e2de38e778..4cf9dafa6d 100644
--- a/client/src/hooks/Config/useClearStates.ts
+++ b/client/src/hooks/Config/useClearStates.ts
@@ -2,6 +2,9 @@ import { useStore } from 'jotai';
import { useRecoilCallback } from 'recoil';
import { Constants } from 'librechat-data-provider';
import {
+ getReasoningStateKey,
+ clearPendingComposerContext,
+ clearPendingReasoningOverrides,
filesFamily,
presetFamily,
abortScrollFamily,
@@ -11,11 +14,6 @@ import {
submissionStartFamily,
useClearSubmissions,
} from '@librechat/chat/react';
-import {
- getReasoningStateKey,
- clearPendingComposerContext,
- clearPendingReasoningOverrides,
-} from '~/components/Chat/Input/Composer/state';
import { siblingIdxFamily, siblingKey } from '~/components/Chat/Messages/Thread/state';
import { showFilesDialogAtom, filesDialogTriggerAtom } from '~/store/filesDialog';
import { showSkillsPopoverFamily } from '~/components/Chat/Input/skillsState';
diff --git a/client/src/hooks/Files/useUpdateFiles.ts b/client/src/hooks/Files/useUpdateFiles.ts
index a773dca919..d33ad527a1 100644
--- a/client/src/hooks/Files/useUpdateFiles.ts
+++ b/client/src/hooks/Files/useUpdateFiles.ts
@@ -1,5 +1,5 @@
+import { isComposerFileTaken, releaseComposerFile } from '@librechat/chat';
import type { ExtendedFile, FileSetter } from '~/common';
-import { isComposerFileTaken, releaseComposerFile } from '~/utils/composerFiles';
import useSetFilesToDelete from './useSetFilesToDelete';
export default function useUpdateFiles(setFiles: FileSetter) {
diff --git a/client/src/hooks/Input/__tests__/useComposerItems.spec.tsx b/client/src/hooks/Input/__tests__/useComposerItems.spec.tsx
index 42552aa9a5..28e0ea9ef5 100644
--- a/client/src/hooks/Input/__tests__/useComposerItems.spec.tsx
+++ b/client/src/hooks/Input/__tests__/useComposerItems.spec.tsx
@@ -1,10 +1,7 @@
import React from 'react';
import { act, renderHook } from '@testing-library/react';
import { Provider as JotaiProvider, createStore, useAtomValue } from 'jotai';
-import {
- pendingQuotesByConvoId,
- pendingManualSkillsByConvoId,
-} from '~/components/Chat/Input/Composer/state';
+import { pendingQuotesByConvoId, pendingManualSkillsByConvoId } from '@librechat/chat/react';
import useComposerItems from '../useComposerItems';
/**
diff --git a/client/src/hooks/Input/__tests__/useComposerRestore.spec.tsx b/client/src/hooks/Input/__tests__/useComposerRestore.spec.tsx
index e643049147..27efbf5925 100644
--- a/client/src/hooks/Input/__tests__/useComposerRestore.spec.tsx
+++ b/client/src/hooks/Input/__tests__/useComposerRestore.spec.tsx
@@ -2,13 +2,13 @@ import React from 'react';
import { act, renderHook } from '@testing-library/react';
import { ReasoningEffort } from 'librechat-data-provider';
import { Provider as JotaiProvider, createStore } from 'jotai';
-import type { TMessage } from 'librechat-data-provider';
-import type { ExtendedFile } from '~/common';
import {
pendingQuotesByConvoId,
pendingManualSkillsByConvoId,
pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
+} from '@librechat/chat/react';
+import type { TMessage } from 'librechat-data-provider';
+import type { ExtendedFile } from '~/common';
import useComposerRestore from '../useComposerRestore';
/**
diff --git a/client/src/hooks/Input/__tests__/usePaletteEntries.spec.tsx b/client/src/hooks/Input/__tests__/usePaletteEntries.spec.tsx
index a8930b216e..7c5a8a49b2 100644
--- a/client/src/hooks/Input/__tests__/usePaletteEntries.spec.tsx
+++ b/client/src/hooks/Input/__tests__/usePaletteEntries.spec.tsx
@@ -2,8 +2,8 @@ import React from 'react';
import { RecoilRoot } from 'recoil';
import { renderHook, act } from '@testing-library/react';
import { Provider as JotaiProvider, createStore } from 'jotai';
+import { pendingManualSkillsByConvoId } from '@librechat/chat/react';
import { ArtifactModes, PermissionTypes } from 'librechat-data-provider';
-import { pendingManualSkillsByConvoId } from '~/components/Chat/Input/Composer/state';
import usePaletteEntries from '../usePaletteEntries';
/**
diff --git a/client/src/hooks/Input/useComposerItems.ts b/client/src/hooks/Input/useComposerItems.ts
index 24e3aa4946..bee6223cc7 100644
--- a/client/src/hooks/Input/useComposerItems.ts
+++ b/client/src/hooks/Input/useComposerItems.ts
@@ -1,9 +1,6 @@
import { useMemo, useCallback } from 'react';
import { useAtom } from 'jotai';
-import {
- pendingQuotesByConvoId,
- pendingManualSkillsByConvoId,
-} from '~/components/Chat/Input/Composer/state';
+import { pendingQuotesByConvoId, pendingManualSkillsByConvoId } from '@librechat/chat/react';
export type ComposerItemKind = 'quote' | 'skill';
diff --git a/client/src/hooks/Input/useComposerRestore.ts b/client/src/hooks/Input/useComposerRestore.ts
index a01a9182fb..b56c5104d1 100644
--- a/client/src/hooks/Input/useComposerRestore.ts
+++ b/client/src/hooks/Input/useComposerRestore.ts
@@ -1,15 +1,15 @@
import { useRef, useEffect, useCallback } from 'react';
import { useStore } from 'jotai';
-import type { QueuedMessageContext } from '@librechat/chat';
-import type { TMessage } from 'librechat-data-provider';
-import type { ExtendedFile, FileSetter } from '~/common';
-import type { useChatFormContext } from '~/Providers';
import {
getReasoningStateKey,
pendingQuotesByConvoId,
pendingManualSkillsByConvoId,
pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
+} from '@librechat/chat/react';
+import type { QueuedMessageContext } from '@librechat/chat';
+import type { TMessage } from 'librechat-data-provider';
+import type { ExtendedFile, FileSetter } from '~/common';
+import type { useChatFormContext } from '~/Providers';
export interface ComposerRestore {
/** Chip "Edit message": replaces the draft outright, since the caller has
diff --git a/client/src/hooks/Input/usePaletteEntries.tsx b/client/src/hooks/Input/usePaletteEntries.tsx
index 539984694c..bdd6a23b58 100644
--- a/client/src/hooks/Input/usePaletteEntries.tsx
+++ b/client/src/hooks/Input/usePaletteEntries.tsx
@@ -2,6 +2,7 @@ import React, { useMemo, useEffect, useRef, useCallback } from 'react';
import { useAtom } from 'jotai';
import { useSetRecoilState } from 'recoil';
import { MCPIcon } from '@librechat/client';
+import { pendingManualSkillsByConvoId } from '@librechat/chat/react';
import {
Brain,
Globe,
@@ -34,7 +35,6 @@ import {
useAgentCapabilities,
useSkillActiveState,
} from '~/hooks';
-import { pendingManualSkillsByConvoId } from '~/components/Chat/Input/Composer/state';
import { getStatusColor, getStatusTextKey } from '~/components/MCP/mcpServerUtils';
import { filterSkillsForPopover } from '~/components/Chat/Input/SkillsCommand';
import { useAgentsMapContext, useBadgeRowContext } from '~/Providers';
diff --git a/client/src/hooks/SSE/steer.ts b/client/src/hooks/SSE/steer.ts
index 5a6bdb0b63..c597c48009 100644
--- a/client/src/hooks/SSE/steer.ts
+++ b/client/src/hooks/SSE/steer.ts
@@ -1,6 +1,7 @@
import { useCallback, useMemo, useRef } from 'react';
import { useStore } from 'jotai';
import { useSteerConvert } from '@librechat/chat/react';
+import { pendingQuotesByConvoId } from '@librechat/chat/react';
import { queuedMessagesByConvoId } from '@librechat/chat/react';
import {
pendingSteersByConvoId,
@@ -27,7 +28,6 @@ import {
collectAppliedSteerIds,
collectDroppedSteerQuotes,
} from '~/utils';
-import { pendingQuotesByConvoId } from '~/components/Chat/Input/Composer/state';
import { useFileMapContext } from '~/Providers';
/**
diff --git a/client/src/hooks/SSE/useEventHandlers.ts b/client/src/hooks/SSE/useEventHandlers.ts
index 0b905a0c8c..4a4728439e 100644
--- a/client/src/hooks/SSE/useEventHandlers.ts
+++ b/client/src/hooks/SSE/useEventHandlers.ts
@@ -5,6 +5,11 @@ import { useStore, useSetAtom } from 'jotai';
import { useQueryClient } from '@tanstack/react-query';
import { submissionStartFamily } from '@librechat/chat/react';
import { useParams, useNavigate, useLocation } from 'react-router-dom';
+import {
+ getReasoningStateKey,
+ pendingQuotesByConvoId,
+ pendingReasoningOverrideFamily,
+} from '@librechat/chat/react';
import {
QueryKeys,
Constants,
@@ -61,11 +66,6 @@ import {
markTitleGenerationProcessed,
useReconcileConversationCodeEnvironmentMutation,
} from '~/data-provider';
-import {
- getReasoningStateKey,
- pendingQuotesByConvoId,
- pendingReasoningOverrideFamily,
-} from '~/components/Chat/Input/Composer/state';
import useFocusRegeneratedResponse from '~/hooks/Chat/useFocusRegeneratedResponse';
import { getFailedCodeDecisionRequest } from '~/hooks/Agents/codeDecision';
import { shouldResetSubagentAtomsOnConversationChange } from './cleanup';
diff --git a/client/src/utils/composerFiles.ts b/client/src/utils/composerFiles.ts
deleted file mode 100644
index 0bb3f58c1e..0000000000
--- a/client/src/utils/composerFiles.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { markComposerFilesTaken, isComposerFileTaken, releaseComposerFile } from '@librechat/chat';
diff --git a/client/src/components/Chat/Input/Composer/__tests__/state.spec.ts b/packages/chat/src/react/__tests__/composer.spec.ts
similarity index 97%
rename from client/src/components/Chat/Input/Composer/__tests__/state.spec.ts
rename to packages/chat/src/react/__tests__/composer.spec.ts
index 996d6797d3..38f6385f6c 100644
--- a/client/src/components/Chat/Input/Composer/__tests__/state.spec.ts
+++ b/packages/chat/src/react/__tests__/composer.spec.ts
@@ -1,6 +1,6 @@
import { createStore } from 'jotai';
import { Constants, ReasoningEffort } from 'librechat-data-provider';
-import { getReasoningStateKey, pendingReasoningOverrideFamily } from '../state';
+import { getReasoningStateKey, pendingReasoningOverrideFamily } from '../composer';
describe('composer reasoning state', () => {
it('isolates unsaved split panes that share the new-conversation sentinel', () => {