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: Import Steer Queue and Recovery State from the Chat Package (#17162)
Marco Beretta2e16b234f610
diff --git a/client/src/components/Chat/Input/Composer/Queue.tsx b/client/src/components/Chat/Input/Composer/Queue.tsxindex ec219aa203..0565ef3705 100644--- a/client/src/components/Chat/Input/Composer/Queue.tsx+++ b/client/src/components/Chat/Input/Composer/Queue.tsx@@ -3,6 +3,7 @@ import { useAtomValue } from 'jotai';import { createPortal } from 'react-dom';import * as Ariakit from '@ariakit/react';import { useDrag, useDrop } from 'react-dnd';+import { queuedMessagesByConvoId } from '@librechat/chat/react';import { AnimatePresence, motion, useReducedMotion } from 'framer-motion';import { claimQueuedIntent, releaseQueuedIntent, hasQueuedIntent } from '@librechat/chat';import {@@ -32,11 +33,10 @@ import {} from 'lucide-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 type { QueuedMessage } from '~/hooks/Chat/queue';import { useQueuedTurnPortal } from '~/components/Chat/Steering/QueuedTurnPortal';import EscalateNowButton from '~/components/Chat/Input/EscalateNowButton';-import { queuedMessagesByConvoId } from '~/hooks/Chat/queue';import { useLocalize } from '~/hooks';import { cn } from '~/utils';diff --git a/client/src/components/Chat/Input/Composer/__tests__/Queue.spec.tsx b/client/src/components/Chat/Input/Composer/__tests__/Queue.spec.tsxindex ceeff9538a..9564a73576 100644--- a/client/src/components/Chat/Input/Composer/__tests__/Queue.spec.tsx+++ b/client/src/components/Chat/Input/Composer/__tests__/Queue.spec.tsx@@ -5,19 +5,15 @@ import { getDefaultStore, useSetAtom } from 'jotai';import { HTML5Backend } from 'react-dnd-html5-backend';import { ReasoningEffort } from 'librechat-data-provider';import { hasQueuedIntent, releaseQueuedIntent } from '@librechat/chat';+import { queuedMessagesByConvoId, resetQueueFamilies } from '@librechat/chat/react';+import { revealedQueuedTurnFamily, resetSteerFamilies } from '@librechat/chat/react';import { act, render, screen, within, waitFor, fireEvent } from '@testing-library/react';-import {- revealedQueuedTurnFamily,- resetSteerFamilies,- resetQueueFamilies,-} from '@librechat/chat/react';import type { SteeringControls } from '@librechat/chat/react';-import type { QueuedMessage } from '~/hooks/Chat/queue';+import type { QueuedMessage } from '@librechat/chat';import {QueuedTurnPortalProvider,useQueuedTurnPortal,} from '~/components/Chat/Steering/QueuedTurnPortal';-import { queuedMessagesByConvoId } from '~/hooks/Chat/queue';import Queue from '../Queue';jest.mock('~/hooks', () => ({useLocalize: () => (key: string, options?: Record<string, string | number>) => {diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsxindex 0e61497e18..fae6b488d6 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx@@ -8,7 +8,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';import { Constants, ContentTypes, QueryKeys } from 'librechat-data-provider';import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';import type { Agents, TConversation, TMessage } from 'librechat-data-provider';-import type { PendingSteer } from '~/hooks/Chat/queue';+import type { PendingSteer } from '@librechat/chat';import { siblingIdxFamily, siblingKey } from '~/components/Chat/Messages/Thread/state';import { applyPendingAction } from '~/utils/approval';import PendingSteers from '../PendingSteers';diff --git a/client/src/components/Chat/Steering/recovery.ts b/client/src/components/Chat/Steering/recovery.tsdeleted file mode 100644index 0cf3a81130..0000000000--- a/client/src/components/Chat/Steering/recovery.ts+++ /dev/null@@ -1,3 +0,0 @@-export { blockRecovery, canRestoreRecovery, recoveryDisposition } from '@librechat/chat';-export { recoveryDispositionsFamily } from '@librechat/chat/react';-export type { RecoveryDisposition, RecoveryDispositions } from '@librechat/chat';diff --git a/client/src/hooks/Chat/__tests__/abort.spec.tsx b/client/src/hooks/Chat/__tests__/abort.spec.tsxindex 9da3b708a2..5e2c063ca2 100644--- a/client/src/hooks/Chat/__tests__/abort.spec.tsx+++ b/client/src/hooks/Chat/__tests__/abort.spec.tsx@@ -4,17 +4,21 @@ import { Constants } from 'librechat-data-provider';import { useAtomValue, useSetAtom, getDefaultStore } from 'jotai';import { act, renderHook, waitFor } from '@testing-library/react';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';+import {+ stopRequestedByConvoId,+ drainAfterAbortByIndex,+ resetQueueFamilies,+ runEndByIndex,+} from '@librechat/chat/react';import {resetSteerFamilies,activeGenerationCreatedAtByConvoId,activeGenerationProtocolVersionByConvoId,submissionByIndex,clearSubmissions,- resetQueueFamilies,} from '@librechat/chat/react';import type { TSubmission, TConversation } from 'librechat-data-provider';-import type { DrainAfterAbort, RunEnd } from '~/hooks/Chat/queue';-import { stopRequestedByConvoId, drainAfterAbortByIndex, runEndByIndex } from '~/hooks/Chat/queue';+import type { DrainAfterAbort, RunEnd } from '@librechat/chat';import useChatHelpers from '../useChatHelpers';import { useAbortCleanup } from '../abort';import store from '~/store';diff --git a/client/src/hooks/Chat/__tests__/transport.spec.tsx b/client/src/hooks/Chat/__tests__/transport.spec.tsxindex edd7d192fe..84a9eaa279 100644--- a/client/src/hooks/Chat/__tests__/transport.spec.tsx+++ b/client/src/hooks/Chat/__tests__/transport.spec.tsx@@ -25,11 +25,11 @@ import type {ChatTransportOptions,ChatTransportRequest,} from 'librechat-data-provider';+import type { PendingSteer } from '@librechat/chat';import type { MutableSnapshot } from 'recoil';import type { StreamStatusResponse } from '~/data-provider';import type { ChatContract } from '~/hooks/Chat/contract';import type { Transport } from '~/hooks/Chat/contract';-import type { PendingSteer } from '~/hooks/Chat/queue';import { ChatTransportContext } from '~/Providers/ChatTransportContext';import { ChatContext, useChatContext } from '~/Providers/ChatContext';import { startupConfigKey } from '~/data-provider/Endpoints/queries';diff --git a/client/src/hooks/Chat/__tests__/useQueueDrain.spec.tsx b/client/src/hooks/Chat/__tests__/useQueueDrain.spec.tsxindex 70cfcfad06..9025130273 100644--- a/client/src/hooks/Chat/__tests__/useQueueDrain.spec.tsx+++ b/client/src/hooks/Chat/__tests__/useQueueDrain.spec.tsx@@ -5,33 +5,30 @@ import { act, renderHook, waitFor } from '@testing-library/react';import { Constants, ReasoningEffort } from 'librechat-data-provider';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';import { isSubmittingFamily, resetSubmitting } from '@librechat/chat/react';-import {- revealedQueuedTurnFamily,- resetSteerFamilies,- resetQueueFamilies,-} from '@librechat/chat/react';+import { revealedQueuedTurnFamily, resetSteerFamilies } from '@librechat/chat/react';import {claimQueuedIntent,releaseQueuedIntent,acquireQueueSendLock,releaseQueueSendLock,} from '@librechat/chat';-import type {- DrainAfterAbort,- RunEnd,- QueuedMessage,- SettledQueuedTurnReceipt,-} from '~/hooks/Chat/queue';+import useQueueDrain from '../useQueueDrain';+import '~/Providers/SteerHostContext';import {settledQueuedTurnReceiptsByConvoId,queuedMessagesByConvoId,pendingRunEndByConvoId,drainAfterAbortByIndex,runEndByIndex,-} from '~/hooks/Chat/queue';-import { recoveryDispositionsFamily } from '~/components/Chat/Steering/recovery';-import useQueueDrain from '../useQueueDrain';-import '~/Providers/SteerHostContext';+ resetQueueFamilies,+ recoveryDispositionsFamily,+} from '@librechat/chat/react';+import type {+ DrainAfterAbort,+ RunEnd,+ QueuedMessage,+ SettledQueuedTurnReceipt,+} from '@librechat/chat';const mockMarkFilesUsage = jest.fn();jest.mock('~/data-provider', () => ({diff --git a/client/src/hooks/Chat/__tests__/useQueuedTurnReveal.spec.tsx b/client/src/hooks/Chat/__tests__/useQueuedTurnReveal.spec.tsxindex 06e5256f04..6308864589 100644--- a/client/src/hooks/Chat/__tests__/useQueuedTurnReveal.spec.tsx+++ b/client/src/hooks/Chat/__tests__/useQueuedTurnReveal.spec.tsx@@ -11,7 +11,7 @@ import {} from '@librechat/chat/react';import type { TMessage, TAgentQueuedTurnReceipt } from 'librechat-data-provider';import type { RevealedQueuedTurn } from '@librechat/chat/react';-import type { QueuedMessage, RunEnd } from '~/hooks/Chat/queue';+import type { QueuedMessage, RunEnd } from '@librechat/chat';import useQueuedTurnReveal, {buildRevealedMessage,hasRevealSuccessor,diff --git a/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsx b/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsxindex db7e41b37f..55a81554ff 100644--- a/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsx+++ b/client/src/hooks/Chat/__tests__/useSteerCancel.spec.tsx@@ -7,17 +7,16 @@ import {activeGenerationCreatedAtByConvoId,pendingSteersByConvoId,resetSteerFamilies,- resetQueueFamilies,} from '@librechat/chat/react';import type { RestoreToComposer } from '~/Providers/ComposerRestoreContext';-import type { PendingSteer } from '~/hooks/Chat/queue';import {ComposerRestoreProvider,useComposerRestoreHost,} from '~/Providers/ComposerRestoreContext';-import { queuedMessagesByConvoId } from '~/hooks/Chat/queue';import '~/Providers/SteerHostContext';import { useSteerCancel, useSteerMoveToQueue } from '@librechat/chat/react';+import { queuedMessagesByConvoId, resetQueueFamilies } from '@librechat/chat/react';+import type { PendingSteer } from '@librechat/chat';const mockCancelAsync = jest.fn();diff --git a/client/src/hooks/Chat/__tests__/useSteerConvert.spec.tsx b/client/src/hooks/Chat/__tests__/useSteerConvert.spec.tsxindex 2a5562a758..227ffa997c 100644--- a/client/src/hooks/Chat/__tests__/useSteerConvert.spec.tsx+++ b/client/src/hooks/Chat/__tests__/useSteerConvert.spec.tsx@@ -7,12 +7,14 @@ import {appliedSteerIdsByConvoId,pendingSteersByConvoId,resetSteerFamilies,- resetQueueFamilies,} from '@librechat/chat/react';-import { recoveryDispositionsFamily } from '~/components/Chat/Steering/recovery';-import { queuedMessagesByConvoId } from '~/hooks/Chat/queue';import '~/Providers/SteerHostContext';import { useSteerConvert } from '@librechat/chat/react';+import {+ recoveryDispositionsFamily,+ queuedMessagesByConvoId,+ resetQueueFamilies,+} from '@librechat/chat/react';const mockFetchStreamStatus = jest.fn();let mockFileMap: Record<string, { llmDeliveryPath: 'text' }> = {};diff --git a/client/src/hooks/Chat/__tests__/useSteerEscalate.spec.tsx b/client/src/hooks/Chat/__tests__/useSteerEscalate.spec.tsxindex 2ea6d2011c..bc890aa4ec 100644--- a/client/src/hooks/Chat/__tests__/useSteerEscalate.spec.tsx+++ b/client/src/hooks/Chat/__tests__/useSteerEscalate.spec.tsx@@ -9,10 +9,10 @@ import {pendingSteersByConvoId,resetSteerFamilies,} from '@librechat/chat/react';-import type { PendingSteer } from '~/hooks/Chat/queue';import { ChatSettingsContext, defaultChatSettings } from '~/Providers/ChatSettingsContext';import '~/Providers/SteerHostContext';import { useSteerEscalate } from '@librechat/chat/react';+import type { PendingSteer } from '@librechat/chat';const mockArmMutateAsync = jest.fn();const mockShowToast = jest.fn();diff --git a/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsx b/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsxindex 01a5548e62..293b98d97e 100644--- a/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsx+++ b/client/src/hooks/Chat/__tests__/useSteerRecovery.spec.tsx@@ -10,7 +10,6 @@ import {appliedSteerIdsByConvoId,pendingSteersByConvoId,resetSteerFamilies,- resetQueueFamilies,} from '@librechat/chat/react';import type { RewakeDrain } from '~/Providers/ComposerRestoreContext';import {@@ -18,11 +17,11 @@ import {useComposerRestoreHost,} from '~/Providers/ComposerRestoreContext';import { ChatSettingsContext, defaultChatSettings } from '~/Providers/ChatSettingsContext';-import { queuedMessagesByConvoId } from '~/hooks/Chat/queue';import { usePaneConversations } from '~/routes/ChatSettings';import useSteerRecovery from '../useSteerRecovery';import store from '~/store';import '~/Providers/SteerHostContext';+import { queuedMessagesByConvoId, resetQueueFamilies } 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.tsxindex 72e47fdfa9..cfc48a5cab 100644--- a/client/src/hooks/Chat/__tests__/useSteering.spec.tsx+++ b/client/src/hooks/Chat/__tests__/useSteering.spec.tsx@@ -26,19 +26,9 @@ import {appliedSteerIdsByConvoId,pendingSteersByConvoId,resetSteerFamilies,- resetQueueFamilies,} from '@librechat/chat/react';import type { CodeApprovalMode, TConversation, TFile, TMessage } from 'librechat-data-provider';-import type { QueuedMessage } from '~/hooks/Chat/queue';import type { ExtendedFile } from '~/common';-import {- pendingQueuedTurnEnqueueIdsByConvoId,- settledQueuedTurnReceiptsByConvoId,- queuedMessagesByConvoId,- pendingRunEndByConvoId,- drainAfterAbortByIndex,- runEndByIndex,-} from '~/hooks/Chat/queue';import {getReasoningStateKey,pendingQuotesByConvoId,@@ -46,7 +36,6 @@ import {pendingReasoningOverrideFamily,} from '~/components/Chat/Input/Composer/state';import { clearAllDrafts, getPendingDraftId, getNewConversationDraftId } from '~/utils';-import { recoveryDispositionsFamily } from '~/components/Chat/Steering/recovery';import useUpdateFiles from '~/hooks/Files/useUpdateFiles';import ChatSettingsProvider from '~/routes/ChatSettings';import { duringRunActionAtom } from '~/store/duringRun';@@ -59,6 +48,17 @@ import {hasLiveRunPause,hydrateFileDeliveryMetadata as mergeQueuedTurnFileMetadata,} from '@librechat/chat';+import {+ pendingQueuedTurnEnqueueIdsByConvoId,+ settledQueuedTurnReceiptsByConvoId,+ queuedMessagesByConvoId,+ pendingRunEndByConvoId,+ drainAfterAbortByIndex,+ runEndByIndex,+ resetQueueFamilies,+ recoveryDispositionsFamily,+} from '@librechat/chat/react';+import type { QueuedMessage } from '@librechat/chat';const CONVO_ID = 'convo-steer-ui';const UUID_V4_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;diff --git a/client/src/hooks/Chat/contract.ts b/client/src/hooks/Chat/contract.tsindex f82fbb1ae2..78cf507d80 100644--- a/client/src/hooks/Chat/contract.ts+++ b/client/src/hooks/Chat/contract.ts@@ -11,6 +11,7 @@ import type {ChatTransportRequest,} from 'librechat-data-provider';import type { SetStateAction, Dispatch, MouseEvent } from 'react';+import type { PendingSteer } from '@librechat/chat';import type {ArmSteerParams,ArmSteerResponse,@@ -32,7 +33,6 @@ import type {PtcTrace,} from '~/common';import type { MessagesEditing } from '~/Providers/MessagesViewContext';-import type { PendingSteer } from './queue';/** Options accepted by {@link ChatConversationContract.newConversation}: the shared params plus* the two flags only the root pane's generator honors. */diff --git a/client/src/hooks/Chat/queue.ts b/client/src/hooks/Chat/queue.tsdeleted file mode 100644index 11e43d2f0e..0000000000--- a/client/src/hooks/Chat/queue.ts+++ /dev/null@@ -1,22 +0,0 @@-export { isStoppedRun, resolveDetachedRunEnd } from '@librechat/chat';-export {- runEndByIndex,- isDetachedRunManual,- detachedRunByConvoId,- drainAfterAbortByIndex,- pendingRunEndByConvoId,- stopRequestedByConvoId,- queuedMessagesByConvoId,- settledQueuedTurnReceiptsByConvoId,- pendingQueuedTurnEnqueueIdsByConvoId,-} from '@librechat/chat/react';-export type {- RunEnd,- StoppedRun,- DetachedRun,- PendingSteer,- QueuedMessage,- DrainAfterAbort,- QueuedMessageOrigin,- SettledQueuedTurnReceipt,-} from '@librechat/chat';diff --git a/client/src/hooks/Chat/useChatHelpers.ts b/client/src/hooks/Chat/useChatHelpers.tsindex 96299c167f..1b4f6fb383 100644--- a/client/src/hooks/Chat/useChatHelpers.ts+++ b/client/src/hooks/Chat/useChatHelpers.ts@@ -7,6 +7,9 @@ import {filesFamily,presetFamily,optionSettingsFamily,+ stopRequestedByConvoId,+ drainAfterAbortByIndex,+ runEndByIndex,activeGenerationCreatedAtByConvoId,activeGenerationProtocolVersionByConvoId,isSubmittingFamily,@@ -18,7 +21,6 @@ import {} from '@librechat/chat/react';import type { TMessage } from 'librechat-data-provider';import type { ChatContract } from './contract';-import { stopRequestedByConvoId, drainAfterAbortByIndex, runEndByIndex } from '~/hooks/Chat/queue';import { useLatestMessage, useLatestMessageId } from '~/hooks/Messages/useLatestMessage';import { useAbortStreamMutation, supportsGenerationProtocolV2 } from '~/data-provider';import { siblingIdxFamily, siblingKey } from '~/components/Chat/Messages/Thread/state';diff --git a/client/src/hooks/Chat/useQueueDrain.ts b/client/src/hooks/Chat/useQueueDrain.tsindex 17cb11df40..ed48077c27 100644--- a/client/src/hooks/Chat/useQueueDrain.ts+++ b/client/src/hooks/Chat/useQueueDrain.ts@@ -1,8 +1,18 @@import { useRef, useEffect, useMemo, useCallback } from 'react';import { useAtomValue, useStore } from 'jotai';+import { recoveryDisposition, canRestoreRecovery } from '@librechat/chat';import { revealedQueuedTurnFamily, useIsSubmitting } from '@librechat/chat/react';import { Constants, DEFAULT_QUEUED_SEND_LOCK_TIMEOUT_MS } from 'librechat-data-provider';import { acquireQueueSendLock, releaseQueueSendLock, hasQueuedIntent } from '@librechat/chat';+import {+ settledQueuedTurnReceiptsByConvoId,+ pendingQueuedTurnEnqueueIdsByConvoId,+ pendingRunEndByConvoId,+ queuedMessagesByConvoId,+ drainAfterAbortByIndex,+ runEndByIndex,+ recoveryDispositionsFamily,+} from '@librechat/chat/react';import {parkRunEnd,batchFileIds,@@ -15,22 +25,8 @@ import {consumeAdmittedBoundary,QUEUE_USAGE_RENEW_INTERVAL_MS,} from '@librechat/chat';-import type { QueueSendLock } from '@librechat/chat';-import type { QueuedMessage, QueuedMessageOrigin, RunEnd } from './queue';+import type { QueueSendLock, QueuedMessage, QueuedMessageOrigin, RunEnd } from '@librechat/chat';import type { TAskFunction } from '~/common';-import {- settledQueuedTurnReceiptsByConvoId,- pendingQueuedTurnEnqueueIdsByConvoId,- pendingRunEndByConvoId,- queuedMessagesByConvoId,- drainAfterAbortByIndex,- runEndByIndex,-} from '~/hooks/Chat/queue';-import {- recoveryDispositionsFamily,- recoveryDisposition,- canRestoreRecovery,-} from '~/components/Chat/Steering/recovery';import { useChatSettings } from '~/Providers/ChatSettingsContext';import { useMarkFilesUsageMutation } from '~/data-provider';import { mergeQueuedMessages } from '~/utils/queue';diff --git a/client/src/hooks/Chat/useQueuedTurnReveal.ts b/client/src/hooks/Chat/useQueuedTurnReveal.tsindex d53a5b3a54..cb9ffcd6fa 100644--- a/client/src/hooks/Chat/useQueuedTurnReveal.ts+++ b/client/src/hooks/Chat/useQueuedTurnReveal.ts@@ -11,8 +11,8 @@ import {} from '@librechat/chat/react';import type { TMessage, TAgentQueuedTurnReceipt } from 'librechat-data-provider';import type { RevealedQueuedTurn } from '@librechat/chat/react';+import type { QueuedMessage, RunEnd } from '@librechat/chat';import type { StreamStatusResponse } from '~/data-provider/SSE/queries';-import type { QueuedMessage, RunEnd } from '~/hooks/Chat/queue';import { agentQueuedTurnsQueryKey } from '~/data-provider/SSE/queuedTurns';import { streamStatusQueryKey } from '~/data-provider/SSE/queries';diff --git a/client/src/hooks/Chat/useSteerRecovery.ts b/client/src/hooks/Chat/useSteerRecovery.tsindex 0518332f4e..faa44c00fd 100644--- a/client/src/hooks/Chat/useSteerRecovery.ts+++ b/client/src/hooks/Chat/useSteerRecovery.ts@@ -9,7 +9,7 @@ import {resolveAcknowledgedSteer,pendingSteerCancelClientIdsFamily,} from '@librechat/chat/react';-import type { PendingSteer } from '~/hooks/Chat/queue';+import type { PendingSteer } from '@librechat/chat';import { useSteerMessageMutation, useCancelSteerMutation } from '~/data-provider';import { useComposerRestoreHost } from '~/Providers/ComposerRestoreContext';import { carriedSteerContext, isLegacyDeliveryUncertain } from '~/utils';diff --git a/client/src/hooks/SSE/__tests__/useResumableSSE.spec.ts b/client/src/hooks/SSE/__tests__/useResumableSSE.spec.tsindex 4dffcaf2c5..6a2c5538ba 100644--- a/client/src/hooks/SSE/__tests__/useResumableSSE.spec.ts+++ b/client/src/hooks/SSE/__tests__/useResumableSSE.spec.ts@@ -12,7 +12,6 @@ import {} from 'librechat-data-provider';import type { TMessage, TSubmission } from 'librechat-data-provider';import type { Query, QueryKey } from '@tanstack/react-query';-import type { PendingSteer } from '~/hooks/Chat/queue';import {activeUsageResponseIdFamily,liveTokensFamily,@@ -20,7 +19,6 @@ import {pendingUsageFamily,removeUsageAtoms,} from '~/components/Chat/Input/TokenUsage/store';-import { recoveryDispositionsFamily } from '~/components/Chat/Steering/recovery';import { pendingApprovalActionFamily } from '~/components/Chat/approval/state';type SSEEventListener = (e: Partial<MessageEvent> & { responseCode?: number }) => void;@@ -166,7 +164,7 @@ jest.mock('jotai', () => {return {...actual,useSetAtom: (atom: unknown) => {- const queue = jest.requireActual('~/hooks/Chat/queue');+ const queue = jest.requireActual('@librechat/chat/react');if (atom === queue.runEndByIndex(0)) {return mockSetRunEnd;}@@ -316,12 +314,14 @@ import useResumableSSE, {ABORT_SWEEP_STATUSES,} from '~/hooks/SSE/useResumableSSE';import useSSE from '~/hooks/SSE/useSSE';+import type { PendingSteer } from '@librechat/chat';import {+ recoveryDispositionsFamily,queuedMessagesByConvoId,stopRequestedByConvoId,detachedRunByConvoId,-} from '~/hooks/Chat/queue';-import { resetQueueFamilies } from '@librechat/chat/react';+ resetQueueFamilies,+} from '@librechat/chat/react';const CONV_ID = 'conv-abc-123';diff --git a/client/src/hooks/SSE/__tests__/useResumeOnLoad.spec.tsx b/client/src/hooks/SSE/__tests__/useResumeOnLoad.spec.tsxindex 1f6e8f68ed..05b48d6b19 100644--- a/client/src/hooks/SSE/__tests__/useResumeOnLoad.spec.tsx+++ b/client/src/hooks/SSE/__tests__/useResumeOnLoad.spec.tsx@@ -15,25 +15,25 @@ import {pendingSteersByConvoId,activeGenerationCreatedAtByConvoId,submissionStartFamily,- resetQueueFamilies,} from '@librechat/chat/react';import type { Agents, TMessage, TConversation, TSubmission } from 'librechat-data-provider';import type { MutableSnapshot } from 'recoil';import type { ReactNode } from 'react';-import type { QueuedMessage, PendingSteer, DetachedRun } from '~/hooks/Chat/queue';-import {- settledQueuedTurnReceiptsByConvoId,- queuedMessagesByConvoId,- stopRequestedByConvoId,- pendingRunEndByConvoId,- detachedRunByConvoId,-} from '~/hooks/Chat/queue';import { siblingIdxFamily, siblingKey } from '~/components/Chat/Messages/Thread/state';import { pendingApprovalActionFamily } from '~/components/Chat/approval/state';import { agentQueuedTurnsQueryKey } from '~/data-provider/SSE/queuedTurns';import useResumeOnLoad from '../useResumeOnLoad';import store from '~/store';import '~/Providers/SteerHostContext';+import {+ settledQueuedTurnReceiptsByConvoId,+ queuedMessagesByConvoId,+ stopRequestedByConvoId,+ pendingRunEndByConvoId,+ detachedRunByConvoId,+ resetQueueFamilies,+} from '@librechat/chat/react';+import type { QueuedMessage, PendingSteer, DetachedRun } from '@librechat/chat';const mockUseStreamStatus = jest.fn();const mockUseActiveJobs = jest.fn();diff --git a/client/src/hooks/SSE/steer.ts b/client/src/hooks/SSE/steer.tsindex c71a0709e7..5a6bdb0b63 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 { queuedMessagesByConvoId } from '@librechat/chat/react';import {pendingSteersByConvoId,appliedSteerIdsByConvoId,@@ -27,7 +28,6 @@ import {collectDroppedSteerQuotes,} from '~/utils';import { pendingQuotesByConvoId } from '~/components/Chat/Input/Composer/state';-import { queuedMessagesByConvoId } from '~/hooks/Chat/queue';import { useFileMapContext } from '~/Providers';/**diff --git a/client/src/hooks/SSE/useResumableSSE.ts b/client/src/hooks/SSE/useResumableSSE.tsindex 2ff2cbec06..d850b124c2 100644--- a/client/src/hooks/SSE/useResumableSSE.ts+++ b/client/src/hooks/SSE/useResumableSSE.ts@@ -4,6 +4,12 @@ import { useSetRecoilState } from 'recoil';import { useStore, useSetAtom } from 'jotai';import { useQueryClient } from '@tanstack/react-query';import { ABORT_SWEEP_STATUSES, selectLocalSteersForQueue } from '@librechat/chat';+import {+ resolveDetachedRunEnd,+ isStoppedRun,+ canRestoreRecovery,+ blockRecovery,+} from '@librechat/chat';import {Constants,QueryKeys,@@ -17,6 +23,15 @@ import {abortScrollFamily,showStopButtonByIndex,} from '@librechat/chat/react';+import {+ isDetachedRunManual,+ stopRequestedByConvoId,+ detachedRunByConvoId,+ drainAfterAbortByIndex,+ queuedMessagesByConvoId,+ runEndByIndex,+ recoveryDispositionsFamily,+} from '@librechat/chat/react';import {toStartGenerationError,waitForRetryDelay,@@ -62,7 +77,7 @@ import type {TPendingSteer,EventSubmission,} from 'librechat-data-provider';-import type { QueuedMessageOrigin, DrainAfterAbort, RunEnd } from '~/hooks/Chat/queue';+import type { QueuedMessageOrigin, DrainAfterAbort, RunEnd } from '@librechat/chat';import type { ActiveJobsResponse, StreamStatusResponse } from '~/data-provider';import type { EventHandlerParams } from './useEventHandlers';import type { TResData, TFinalResData } from '~/common';@@ -86,16 +101,6 @@ import {markStreamStartFailedMetadata,insertQueuedOrigin,} from '~/utils';-import {- resolveDetachedRunEnd,- isDetachedRunManual,- stopRequestedByConvoId,- detachedRunByConvoId,- isStoppedRun,- drainAfterAbortByIndex,- queuedMessagesByConvoId,- runEndByIndex,-} from '~/hooks/Chat/queue';import {useGetUserBalance,fetchStreamStatus,@@ -104,11 +109,6 @@ import {streamStatusQueryKey,fetchConversationMessages,} from '~/data-provider';-import {- recoveryDispositionsFamily,- canRestoreRecovery,- blockRecovery,-} from '~/components/Chat/Steering/recovery';import { pendingApprovalActionFamily } from '~/components/Chat/approval/state';import { useChatTransport } from '~/Providers/ChatTransportContext';import { reopenTermsOnRefusal } from '~/utils/terms';diff --git a/client/src/hooks/SSE/useResumeOnLoad.ts b/client/src/hooks/SSE/useResumeOnLoad.tsindex a286f64ee5..8558d7a63d 100644--- a/client/src/hooks/SSE/useResumeOnLoad.ts+++ b/client/src/hooks/SSE/useResumeOnLoad.ts@@ -1,7 +1,13 @@import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useRecoilValue } from 'recoil';import { useQueryClient } from '@tanstack/react-query';+import { resolveDetachedRunEnd } from '@librechat/chat';import { useStore, useAtom, useSetAtom, useAtomValue } from 'jotai';+import {+ isDetachedRunManual,+ pendingRunEndByConvoId,+ detachedRunByConvoId,+} from '@librechat/chat/react';import {Constants,QueryKeys,@@ -36,12 +42,6 @@ import {extendActiveJobsGrace,ACTIVE_JOBS_SUCCESSOR_GRACE_MS,} from '~/data-provider';-import {- isDetachedRunManual,- resolveDetachedRunEnd,- pendingRunEndByConvoId,- detachedRunByConvoId,-} from '~/hooks/Chat/queue';import { siblingIdxFamily, siblingKey } from '~/components/Chat/Messages/Thread/state';import { pendingApprovalActionFamily } from '~/components/Chat/approval/state';import { dedupeSteersById, getBranchSiblingIndexesForTarget } from '~/utils';