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
✅ feat: Delivery Receipt Checkmarks for Steered Messages (#15376)
Danny Avila9ac801ee454f
diff --git a/client/src/components/Chat/Input/InFlightSteers.tsx b/client/src/components/Chat/Input/InFlightSteers.tsxindex e959b64693..135254c04c 100644--- a/client/src/components/Chat/Input/InFlightSteers.tsx+++ b/client/src/components/Chat/Input/InFlightSteers.tsx@@ -5,6 +5,7 @@ import { useRecoilValue, useRecoilCallback } from 'recoil';import { X, Zap, ZapOff, Clock, Pencil, ChevronUp, ChevronDown } from 'lucide-react';import type { TFile, TMessage } from 'librechat-data-provider';import type { SteeringControls, QueuedMessageContext } from '~/hooks/Chat/useSteering';+import type { SteerReceiptState } from '~/components/Chat/Steering/Receipt';import type { PendingSteer } from '~/store/families';import type { MenuEntry } from './SteerMenu';import {@@ -21,6 +22,7 @@ import MarkdownLite from '~/components/Chat/Messages/Content/MarkdownLite';import FileContainer from '~/components/Chat/Input/Files/FileContainer';import { useSteerCancel, useSteerReclaim, useLocalize } from '~/hooks';import ImagePreview from '~/components/Chat/Input/Files/ImagePreview';+import SteerReceipt from '~/components/Chat/Steering/Receipt';import { carriedSteerContext, cn } from '~/utils';import store from '~/store';@@ -53,6 +55,14 @@ const STEER_OVERFLOW_TOLERANCE = 8;* honest unknown outcome; the idempotent arm may still complete server-side. */const ARM_CONFIRM_TIMEOUT_MS = 10_000;+/** Live-region copy per receipt state, announced on transitions only. */+const RECEIPT_ANNOUNCEMENTS = {+ sending: 'com_ui_steer_sending',+ delivered: 'com_ui_steer_delivered',+ interrupting: 'com_ui_steer_in_flight_preempt',+ applied: 'com_ui_steer_applied_info',+} as const;+/** The control rail flanking a bubble. `py-3` reproduces the bubble's own* first-line band — its `py-2.5` padding, its 1px border, and half the gap* between the 24px control and the taller text line box — so a 24px control@@ -134,6 +144,35 @@ const InFlightSteer = memo(function InFlightSteer({const { images, others } = useMemo(() => splitFiles(steer.files), [steer.files]);const sending = steer.status === 'sending';const preempting = steer.preempt === true;+ /** This row's own arm request is in flight (the convo-scoped escalating flag+ * cannot say WHICH row asked). The receipt must react on the click, not the+ * ACK — the silent round trip is exactly what reads as broken. */+ const [arming, setArming] = useState(false);+ /** An interrupt shows as interrupting even before its confirmation (the+ * click must react instantly); `confirmed` withholds the check until the+ * server durably acknowledged the enqueue/arm. A relabelled chip+ * (`preempt` true past `sending`) IS that confirmation — the SSE+ * `steer_updated` can deliver it while the arm HTTP response is still in+ * flight, and the check must not wait out that round trip. */+ let receiptState: SteerReceiptState = 'delivered';+ if (preempting || arming) {+ receiptState = 'interrupting';+ } else if (sending) {+ receiptState = 'sending';+ }+ const receiptConfirmed = preempting ? !sending : !arming;++ /** Mirrors each receipt TRANSITION into the row's polite live region so+ * keyboard and screen-reader users get the same immediate confirmation the+ * visible marks give; the initial state is not replayed on mount. */+ const prevReceiptStateRef = useRef(receiptState);+ useEffect(() => {+ if (prevReceiptStateRef.current === receiptState) {+ return;+ }+ prevReceiptStateRef.current = receiptState;+ setEscalationAnnouncement(localize(RECEIPT_ANNOUNCEMENTS[receiptState]));+ }, [receiptState, localize]);/** Long steers (several paragraphs) collapse to a preview so the stack stays* scannable; the toggle is offered only once the content actually overflows@@ -199,6 +238,7 @@ const InFlightSteer = memo(function InFlightSteer({const trigger = event.currentTarget;setEscalationAnnouncement('');setEscalating(true);+ setArming(true);const params = {conversationId,steerId: steer.steerId,@@ -293,7 +333,10 @@ const InFlightSteer = memo(function InFlightSteer({clearTimeout(timeout);}};- void requestArm().finally(() => setEscalating(false));+ void requestArm().finally(() => {+ setEscalating(false);+ setArming(false);+ });},[armSteer,@@ -545,6 +588,17 @@ const InFlightSteer = memo(function InFlightSteer({</div>)}</div>+ {/* Delivery receipt under the bubble, iMessage-style: present from the+ * first frame so the status never flickers in from nothing, and every+ * advance (Sending → Delivered ✓ → Interrupting) is an event the server+ * actually confirmed. The margin re-aligns it under the bubble's right+ * edge when the outboard send-now rail (24px control + 6px gap) is+ * present; the rail hides while sending or already escalated. */}+ <SteerReceipt+ state={receiptState}+ confirmed={receiptConfirmed}+ className={!sending && !preempting ? 'mr-[30px]' : undefined}+ /><span role="status" aria-live="polite" aria-atomic="true" className="sr-only">{escalationAnnouncement}</span>diff --git a/client/src/components/Chat/Input/PendingSteerChips.tsx b/client/src/components/Chat/Input/PendingSteerChips.tsxindex 9de0802c88..a2d423886b 100644--- a/client/src/components/Chat/Input/PendingSteerChips.tsx+++ b/client/src/components/Chat/Input/PendingSteerChips.tsx@@ -406,31 +406,42 @@ function PendingSteerChips({}return (- <div- className="flex flex-col gap-1.5 px-2 pt-2"- role="list"- aria-label={localize('com_ui_queued_messages')}- data-testid="pending-steer-chips"- >- {failedSteers.map((steer) => (- <FailedSteerRow- key={steer.steerId}- steer={steer}- steering={steering}- onEditToComposer={onEditToComposer}- />- ))}- {queued.map((message) => (- <QueuedRow- key={message.id}- message={message}- steering={steering}- conversationId={conversationId}- interruptPending={interruptPending}- onEditToComposer={onEditToComposer}- onRestoreToComposer={onRestoreToComposer}- />- ))}+ <div className="flex flex-col gap-1.5 px-2 pt-2" data-testid="pending-steer-chips">+ {/* The list owns only listitem rows; the caption lives beside it so the+ * ARIA list structure stays valid for assistive tech. */}+ <div+ className="flex flex-col gap-1.5"+ role="list"+ aria-label={localize('com_ui_queued_messages')}+ >+ {failedSteers.map((steer) => (+ <FailedSteerRow+ key={steer.steerId}+ steer={steer}+ steering={steering}+ onEditToComposer={onEditToComposer}+ />+ ))}+ {queued.map((message) => (+ <QueuedRow+ key={message.id}+ message={message}+ steering={steering}+ conversationId={conversationId}+ interruptPending={interruptPending}+ onEditToComposer={onEditToComposer}+ onRestoreToComposer={onRestoreToComposer}+ />+ ))}+ </div>+ {/* One caption for the whole queued group: the single fact users need+ * ("did my message vanish?" it did not), shown only while a run is+ * actually pending — after it, rows drain or convert on their own. */}+ {queued.length > 0 && steering.duringRunActive && (+ <div className="px-3 text-xs text-text-secondary" data-testid="queued-caption">+ {localize('com_ui_steer_queued_info')}+ </div>+ )}</div>);}diff --git a/client/src/components/Chat/Input/__tests__/InFlightSteers.test.tsx b/client/src/components/Chat/Input/__tests__/InFlightSteers.test.tsxindex 97d228f48d..e057432e73 100644--- a/client/src/components/Chat/Input/__tests__/InFlightSteers.test.tsx+++ b/client/src/components/Chat/Input/__tests__/InFlightSteers.test.tsx@@ -1,6 +1,6 @@import React from 'react';import { getDefaultStore } from 'jotai';-import { RecoilRoot, useRecoilValue } from 'recoil';+import { RecoilRoot, useRecoilValue, useSetRecoilState } from 'recoil';import { render, screen, fireEvent, act } from '@testing-library/react';import type { PendingSteer, QueuedMessage } from '~/store/families';import type { SteeringControls } from '~/hooks/Chat/useSteering';@@ -19,6 +19,7 @@ const mockSetDefaultAction = jest.fn();const mockRestoreToComposer = jest.fn();let convertSteersForTest: ReturnType<typeof useSteerConvert>;let observedQueueForTest: QueuedMessage[];+let setSteersForTest: (updater: (prev: PendingSteer[]) => PendingSteer[]) => void;jest.mock('~/hooks', () => ({useLocalize: () => (key: string) => key,@@ -28,7 +29,14 @@ jest.mock('~/hooks', () => ({jest.mock('@librechat/client', () => ({useToastContext: () => ({ showToast: mockShowToast }),- InfoHoverCard: () => null,+ /** Trigger-only stand-in: the receipt renders its marks as the hover card's+ * custom trigger, so the mock must render children under the accessible+ * name rather than swallowing them. */+ InfoHoverCard: ({ text, children }: { text: string; children?: React.ReactNode }) => (+ <button type="button" aria-label={text}>+ {children}+ </button>+ ),ESide: { Top: 'top', Bottom: 'bottom' },}));@@ -108,6 +116,7 @@ function steersElement(steers: PendingSteer[], options?: RenderOptions) {const SteerRaceProbe = () => {convertSteersForTest = useSteerConvert();observedQueueForTest = useRecoilValue(store.queuedMessagesByConvoId(CONVO_ID));+ setSteersForTest = useSetRecoilState(store.pendingSteersByConvoId(CONVO_ID));return null;};return (@@ -806,6 +815,40 @@ describe('InFlightSteers — interrupt-now escalation', () => {expect(screen.getByRole('status')).toHaveTextContent('com_ui_steer_in_flight_preempt');});+ it('flips the receipt to interrupting on the click, confirming its check only on the ACK', async () => {+ let resolveArm: (value: unknown) => void = () => {};+ mockArmMutateAsync.mockReturnValue(+ new Promise((resolve) => {+ resolveArm = resolve;+ }),+ );+ renderSteers([{ steerId: 's1', text: 'hold on', status: 'pending', createdAt: 1 }]);+ expect(screen.getByTestId('steer-receipt')).toHaveAttribute('data-receipt-state', 'delivered');++ fireEvent.click(screen.getByTestId('steer-escalate-now'));+ // The silent round trip is what reads as broken: the label and pulse react+ // on the click, while the check waits for the confirmed durable arm.+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt).toHaveAttribute('data-receipt-state', 'interrupting');+ expect(receipt.querySelector('svg')).toBeNull();++ await act(async () => {+ resolveArm({ armed: true, generationProtocolVersion: 2, preemptRevision: 1 });+ });+ expect(receipt).toHaveAttribute('data-receipt-state', 'interrupting');+ expect(receipt.querySelector('svg')).not.toBeNull();+ });++ it('returns the receipt to delivered when the arm loses its race', async () => {+ mockArmMutateAsync.mockResolvedValue({ armed: false, generationProtocolVersion: 2 });+ renderSteers([{ steerId: 's1', text: 'hold on', status: 'pending', createdAt: 1 }]);++ await act(async () => {+ fireEvent.click(screen.getByTestId('steer-escalate-now'));+ });+ expect(screen.getByTestId('steer-receipt')).toHaveAttribute('data-receipt-state', 'delivered');+ });+it('names each escalation control with the message it will interrupt for', () => {renderSteers([{ steerId: 's1', text: 'correct the city', status: 'pending', createdAt: 1 },@@ -1137,3 +1180,76 @@ describe('InFlightSteers — menu structure', () => {expect(screen.queryByRole('menuitem', { name: 'com_ui_interrupt_steer_now' })).toBeNull();});});++describe('InFlightSteers delivery receipts', () => {+ beforeEach(() => {+ jest.clearAllMocks();+ });++ it('labels a sending steer with the muted in-progress state and no check', () => {+ renderSteers([{ steerId: 'local-1', text: 'still posting', status: 'sending', createdAt: 1 }]);+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt).toHaveAttribute('data-receipt-state', 'sending');+ expect(receipt).toHaveTextContent('com_ui_steer_sending');+ expect(receipt.querySelector('svg')).toBeNull();+ });++ it('shows the delivered check once the server durably queued the steer', () => {+ renderSteers([{ steerId: 's-ack', text: 'waiting', status: 'pending', createdAt: 1 }]);+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt).toHaveAttribute('data-receipt-state', 'delivered');+ expect(receipt.querySelector('svg')).not.toBeNull();+ expect(screen.getByLabelText('com_ui_steer_delivered_info')).toBeInTheDocument();+ });++ it('relabels to the interrupting state when the steer is armed to preempt', () => {+ renderSteers([+ { steerId: 's-armed', text: 'stop now', status: 'pending', createdAt: 1, preempt: true },+ ]);+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt).toHaveAttribute('data-receipt-state', 'interrupting');+ // A confirmed arm keeps its check alongside the pulsing dot.+ expect(receipt.querySelector('svg')).not.toBeNull();+ expect(screen.getByLabelText('com_ui_steer_interrupting_info')).toBeInTheDocument();+ });++ it('shows interrupting without a check while the preempting POST is unacknowledged', () => {+ renderSteers([+ { steerId: 'local-2', text: 'stop', status: 'sending', createdAt: 1, preempt: true },+ ]);+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt).toHaveAttribute('data-receipt-state', 'interrupting');+ // The label and pulse react instantly; the check waits for the 202.+ expect(receipt.querySelector('svg')).toBeNull();+ });++ it('honors an SSE-delivered preempt confirmation while the arm response is still pending', async () => {+ mockArmMutateAsync.mockReturnValue(new Promise(() => {}));+ renderSteers([{ steerId: 's1', text: 'hold on', status: 'pending', createdAt: 1 }]);+ fireEvent.click(screen.getByTestId('steer-escalate-now'));+ expect(screen.getByTestId('steer-receipt').querySelector('svg')).toBeNull();++ // steer_updated relabels the chip before the arm HTTP response returns:+ // that IS durable confirmation, and the check must not wait out the+ // round-trip timeout.+ await act(async () => {+ setSteersForTest((prev) =>+ prev.map((steer) => ({ ...steer, preempt: true, preemptRevision: 1 })),+ );+ });+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt).toHaveAttribute('data-receipt-state', 'interrupting');+ expect(receipt.querySelector('svg')).not.toBeNull();+ });++ it('announces receipt transitions through the polite live region', async () => {+ renderSteers([{ steerId: 's1', text: 'hold on', status: 'sending', createdAt: 1 }]);+ // Mount state is not replayed: the region starts empty.+ expect(screen.getByRole('status')).toHaveTextContent('');++ await act(async () => {+ setSteersForTest((prev) => prev.map((steer) => ({ ...steer, status: 'pending' as const })));+ });+ expect(screen.getByRole('status')).toHaveTextContent('com_ui_steer_delivered');+ });+});diff --git a/client/src/components/Chat/Input/__tests__/PendingSteerChips.test.tsx b/client/src/components/Chat/Input/__tests__/PendingSteerChips.test.tsxindex ff87b991b3..7765152de0 100644--- a/client/src/components/Chat/Input/__tests__/PendingSteerChips.test.tsx+++ b/client/src/components/Chat/Input/__tests__/PendingSteerChips.test.tsx@@ -541,3 +541,35 @@ describe('PendingSteerChips — queued interrupt-now', () => {},);});++describe('PendingSteerChips — queued caption', () => {+ beforeEach(() => {+ jest.clearAllMocks();+ });++ const queuedItem = { id: 'q1', text: 'follow up later', createdAt: 1 };++ it('explains when queued messages will send while a run is active', () => {+ renderChips([queuedItem], { steering: { duringRunActive: true } });+ expect(screen.getByTestId('queued-caption')).toHaveTextContent('com_ui_steer_queued_info');+ });++ it('renders one caption for the whole group, not one per row', () => {+ renderChips([queuedItem, { id: 'q2', text: 'and another', createdAt: 2 }], {+ steering: { duringRunActive: true },+ });+ expect(screen.getAllByTestId('queued-caption')).toHaveLength(1);+ });++ it('keeps the caption beside the ARIA list, never as a non-listitem child of it', () => {+ renderChips([queuedItem], { steering: { duringRunActive: true } });+ const list = screen.getByRole('list', { name: 'com_ui_queued_messages' });+ expect(list).not.toContainElement(screen.getByTestId('queued-caption'));+ expect(list).toContainElement(screen.getByTestId('queued-message-row'));+ });++ it('omits the caption once the run is over, when rows drain on their own terms', () => {+ renderChips([queuedItem], { steering: { duringRunActive: false } });+ expect(screen.queryByTestId('queued-caption')).toBeNull();+ });+});diff --git a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsxindex 1f02b793fb..5c5446fd3a 100644--- a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx@@ -1,12 +1,12 @@-import { memo, useMemo, useState, useCallback } from 'react';-import { useRecoilValue } from 'recoil';-import { InfoHoverCard, ESide } from '@librechat/client';+import { memo, useMemo, useState, useEffect, useCallback } from 'react';+import { useRecoilValue, useSetRecoilState } from 'recoil';import type { TFile, TMessage } from 'librechat-data-provider';import FilePreviewDialog from '~/components/Chat/Messages/Content/FilePreviewDialog';import MessageTimestamp from '~/components/Chat/Messages/ui/MessageTimestamp';import MessageQuotes from '~/components/Chat/Messages/Content/MessageQuotes';import MarkdownLite from '~/components/Chat/Messages/Content/MarkdownLite';import FileContainer from '~/components/Chat/Input/Files/FileContainer';+import SteerReceipt from '~/components/Chat/Steering/Receipt';import Image from '~/components/Chat/Messages/Content/Image';import CollapsibleText from './CollapsibleText';import { useShareContext } from '~/Providers';@@ -75,6 +75,35 @@ const SteerPart = memo(function SteerPart({}}, []);+ /** The receipt draw-in plays exactly once, at the live chip→inline hand-off:+ * the applied handler stamps the id as it commits the part, the render that+ * first sees each identity captures it, and the effect consumes it so a+ * remount (conversation revisit, reload, share view) renders the settled+ * checks without motion. Captured per IDENTITY, not per mount — a content+ * slot can be overwritten with a different steer (`applySteerPart` permits+ * replacement at an index) while React reuses this component — and every+ * identity consumes its id whether it animated or not, so nothing lingers.+ * The membership selector scopes the subscription to THIS id — stamping or+ * consuming one steer never re-renders the other mounted parts. */+ const isLiveApplied = useRecoilValue(store.liveAppliedSteerFamily(steerId ?? ''));+ const setLiveAppliedIds = useSetRecoilState(store.liveAppliedSteerIds);+ const [captured, setCaptured] = useState<{ id: string | undefined; animate: boolean }>({+ id: steerId,+ animate: isLiveApplied,+ });+ if (captured.id !== steerId) {+ setCaptured({ id: steerId, animate: isLiveApplied });+ }+ const animateIn = captured.id === steerId && captured.animate;+ useEffect(() => {+ if (steerId == null || steerId.length === 0) {+ return;+ }+ setLiveAppliedIds((prev) =>+ prev.includes(steerId) ? prev.filter((id) => id !== steerId) : prev,+ );+ }, [steerId, setLiveAppliedIds]);+if (typeof steer !== 'string' || steer.length === 0) {return null;}@@ -122,12 +151,7 @@ const SteerPart = memo(function SteerPart({</CollapsibleText></div><div className="mt-1 flex min-h-8 items-center justify-end text-text-secondary">- <span- data-testid="steer-info-affordance"- className="transition-opacity duration-theme-normal focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none [@media(hover:hover)]:opacity-0"- >- <InfoHoverCard side={ESide.Top} text={localize('com_ui_steered_info')} />- </span>+ <SteerReceipt state="applied" animateIn={animateIn} /><MessageTimestamp value={timestamp} /></div></div>diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsxindex 4f33780ea3..6fd7d30462 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx@@ -1,5 +1,5 @@import React from 'react';-import { RecoilRoot } from 'recoil';+import { RecoilRoot, useRecoilValue } from 'recoil';import { render, screen, fireEvent } from '@testing-library/react';import type { TMessage } from 'librechat-data-provider';import SteerPart from '../SteerPart';@@ -103,21 +103,21 @@ describe('SteerPart author label', () => {expect(screen.getByText('com_user_message')).toBeInTheDocument();});- it('shows a subtle info affordance explaining the mid-run message', () => {+ it('shows the applied receipt with its explanation as the accessible label', () => {renderPart();- // The "?" InfoHoverCard clarifies why a user message appears inside the- // assistant response (its text is the trigger's accessible label).- expect(screen.getByLabelText('com_ui_steered_info')).toBeInTheDocument();+ // The ✓✓ receipt replaces the old hover-only "?" affordance; the info text+ // is the trigger's accessible label so the marks never read as bare glyphs.+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt).toHaveAttribute('data-receipt-state', 'applied');+ expect(screen.getByLabelText('com_ui_steer_applied_info')).toBeInTheDocument();});- it('reveals on hover/focus on hover-capable pointers but stays visible on touch', () => {+ it('keeps the receipt visible at rest instead of gating it behind hover', () => {renderPart();- // Like the hover buttons: hidden-at-rest ONLY on hover-capable pointers- // ([@media(hover:hover)]:opacity-0), so touch devices keep it visible.- const wrapper = screen.getByTestId('steer-info-affordance');- expect(wrapper.className).toContain('[@media(hover:hover)]:opacity-0');- expect(wrapper.className).toContain('group-hover:opacity-100');- expect(wrapper.className).toContain('focus-within:opacity-100');+ // The whole point of the receipt is that "it landed" is visible without+ // hunting: no hover-capable-pointer opacity gate like the old "?" had.+ const receipt = screen.getByTestId('steer-receipt');+ expect(receipt.className).not.toContain('opacity-0');});});@@ -187,3 +187,76 @@ describe('SteerPart presentation', () => {expect(screen.queryByTestId('message-quotes')).toBeNull();});});++describe('SteerPart live receipt draw-in', () => {+ function LiveIdsProbe() {+ const ids = useRecoilValue(store.liveAppliedSteerIds);+ return <div data-testid="live-ids">{ids.join(',')}</div>;+ }++ function renderLive(liveIds: string[]) {+ return render(+ <RecoilRoot+ initializeState={({ set }) => {+ set(store.user, SEEDED_USER as never);+ set(store.liveAppliedSteerIds, liveIds);+ }}+ >+ <SteerPart steer="steered words" steerId="s1" createdAt={1} />+ <LiveIdsProbe />+ </RecoilRoot>,+ );+ }++ const appliedChecks = () =>+ screen.getByLabelText('com_ui_steer_applied_info').querySelector('svg');++ it('animates the checks once when its applied event landed this session, then consumes the id', () => {+ renderLive(['s1', 'other']);+ expect(appliedChecks()).toHaveClass('animate-in');+ // Consumed on mount so a remount (revisit, reload) renders without motion;+ // unrelated ids survive for their own parts.+ expect(screen.getByTestId('live-ids')).toHaveTextContent('other');+ });++ it('renders the settled checks without the draw-in when not applied live', () => {+ renderLive([]);+ expect(appliedChecks()).not.toHaveClass('animate-in');+ });++ it('re-derives and consumes per identity when a slot is overwritten with another steer', () => {+ // ContentParts keys by content index, and applySteerPart permits a+ // different steer to overwrite that index — React reuses this component.+ const partFor = (steerId: string) => (+ <>+ <SteerPart steer="steered words" steerId={steerId} createdAt={1} />+ <LiveIdsProbe />+ </>+ );+ const { rerender } = render(+ <RecoilRoot+ initializeState={({ set }) => {+ set(store.user, SEEDED_USER as never);+ set(store.liveAppliedSteerIds, ['s2']);+ }}+ >+ {partFor('s1')}+ </RecoilRoot>,+ );+ expect(appliedChecks()).not.toHaveClass('animate-in');+ expect(screen.getByTestId('live-ids')).toHaveTextContent('s2');++ rerender(+ <RecoilRoot+ initializeState={({ set }) => {+ set(store.user, SEEDED_USER as never);+ set(store.liveAppliedSteerIds, ['s2']);+ }}+ >+ {partFor('s2')}+ </RecoilRoot>,+ );+ expect(appliedChecks()).toHaveClass('animate-in');+ expect(screen.getByTestId('live-ids').textContent).toBe('');+ });+});diff --git a/client/src/components/Chat/Steering/Receipt.tsx b/client/src/components/Chat/Steering/Receipt.tsxnew file mode 100644index 0000000000..163ded1f66--- /dev/null+++ b/client/src/components/Chat/Steering/Receipt.tsx@@ -0,0 +1,122 @@+import { memo } from 'react';+import { Check, CheckCheck } from 'lucide-react';+import { InfoHoverCard, ESide } from '@librechat/client';+import { useLocalize } from '~/hooks';+import { cn } from '~/utils';++export type SteerReceiptState = 'sending' | 'delivered' | 'interrupting' | 'applied';++/** Amber-500 is the steering identity (the in-flight Zap), but it reads weak+ * on white; 600 carries the same identity at legible contrast in light. */+const AMBER_ICON = 'text-amber-600 dark:text-amber-500';+const AMBER_DOT = 'bg-amber-600 dark:bg-amber-500';++/**+ * Delivery receipt for a steered message: iMessage-style checkmarks whose+ * every state is driven by an event the protocol already emits, so a check+ * only ever asserts what the server confirmed.+ *+ * - `sending`: POST in flight, no check — a muted label so the status line+ * exists from the first frame instead of flickering in.+ * - `delivered`: the 202 durably queued it (one gray check).+ * - `interrupting`: asked to seal generation at the next safe boundary — the+ * amber label and pulsing dot say "working, not stuck". Until the arm is+ * server-confirmed (`confirmed` false) the label shows without its check.+ * - `applied`: the running response durably absorbed the words (amber double+ * check, persistent — it renders identically live, on reload, and in+ * shared/search views).+ *+ * The hover explanations render through the shared `InfoHoverCard` with the+ * receipt as the trigger, so the info text doubles as the accessible name.+ */+const SteerReceipt = memo(function SteerReceipt({+ state,+ confirmed = true,+ animateIn = false,+ className,+}: {+ state: SteerReceiptState;+ /** Server confirmation of the underlying enqueue/arm; an interrupt awaiting+ * its ACK shows the label and pulse without a check. */+ confirmed?: boolean;+ /** Plays the one-shot draw-in at the live chip→inline hand-off only. */+ animateIn?: boolean;+ className?: string;+}) {+ const localize = useLocalize();++ if (state === 'sending') {+ return (+ <span+ data-testid="steer-receipt"+ data-receipt-state="sending"+ className={cn('text-xs text-text-secondary', className)}+ >+ {localize('com_ui_steer_sending')}+ </span>+ );+ }++ if (state === 'applied') {+ return (+ <span+ data-testid="steer-receipt"+ data-receipt-state="applied"+ className={cn('flex items-center', className)}+ >+ <InfoHoverCard side={ESide.Top} text={localize('com_ui_steer_applied_info')}>+ <CheckCheck+ className={cn(+ 'h-4 w-4',+ AMBER_ICON,+ animateIn &&+ 'duration-theme-normal ease-out animate-in fade-in-0 zoom-in-50 motion-reduce:animate-none',+ )}+ aria-hidden="true"+ />+ </InfoHoverCard>+ </span>+ );+ }++ const interrupting = state === 'interrupting';+ return (+ <span+ data-testid="steer-receipt"+ data-receipt-state={state}+ className={cn('flex items-center', className)}+ >+ <InfoHoverCard+ side={ESide.Top}+ text={localize(+ interrupting ? 'com_ui_steer_interrupting_info' : 'com_ui_steer_delivered_info',+ )}+ >+ <span className="flex items-center gap-1.5">+ {interrupting && (+ <span+ className={cn('h-1.5 w-1.5 rounded-full motion-safe:animate-pulse', AMBER_DOT)}+ aria-hidden="true"+ />+ )}+ {(!interrupting || confirmed) && (+ <Check+ className={cn('h-4 w-4', interrupting ? AMBER_ICON : 'text-text-secondary')}+ aria-hidden="true"+ />+ )}+ <span+ className={cn(+ 'text-xs',+ interrupting ? cn('font-medium', AMBER_ICON) : 'text-text-secondary',+ )}+ >+ {localize(interrupting ? 'com_ui_steer_in_flight_preempt' : 'com_ui_steer_delivered')}+ </span>+ </span>+ </InfoHoverCard>+ </span>+ );+});++export default SteerReceipt;diff --git a/client/src/hooks/SSE/useResumableSSE.ts b/client/src/hooks/SSE/useResumableSSE.tsindex e76ea3d684..10379900ca 100644--- a/client/src/hooks/SSE/useResumableSSE.ts+++ b/client/src/hooks/SSE/useResumableSSE.ts@@ -798,6 +798,7 @@ export default function useResumableSSE(const setAbortScroll = useSetRecoilState(store.abortScrollFamily(runIndex));const setSubmission = useSetRecoilState(store.submissionByIndex(runIndex));const setShowStopButton = useSetRecoilState(store.showStopButtonByIndex(runIndex));+ const setLiveAppliedSteerIds = useSetRecoilState(store.liveAppliedSteerIds);const sseRef = useRef<SSE | null>(null);/** Removes the foreground re-attach listener owned by the newest@@ -865,7 +866,7 @@ export default function useResumableSSE(steerId: string,clientSteerId?: string,appliedPartQuotes?: string[],- ) => {+ ): string[] => {const settledIds = clientSteerId ? [steerId, clientSteerId] : [steerId];/** A part applied by a pre-quotes server carries no quotes while the* chip being settled may hold the only copy of the user's excerpts@@ -885,6 +886,15 @@ export default function useResumableSSE();}}+ /** Ids seen by the durable set for the first time — the caller stamps+ * these as live-applied only when it actually commits the inline+ * part, so an abandoned placement (navigation away, placeholder never+ * found) or a replayed event cannot arm a draw-in with no part+ * mounting to consume it. */+ const alreadyApplied = snapshot+ .getLoadable(store.appliedSteerIdsByConvoId(conversationId))+ .getValue();+ const firstApplication = settledIds.filter((id) => !alreadyApplied.includes(id));set(store.appliedSteerIdsByConvoId(conversationId), (prev) =>appendAppliedSteerIds(prev, settledIds),);@@ -914,6 +924,7 @@ export default function useResumableSSE(): prev,);+ return firstApplication;},[],);@@ -1417,7 +1428,11 @@ export default function useResumableSSE(* actions for the inject-before-render race (the assistant placeholder* can land a few frames after the created event under load).*/- const applySteerToMessages = (event: TSteerAppliedEvent, attempt = 0) => {+ const applySteerToMessages = (+ event: TSteerAppliedEvent,+ attempt = 0,+ liveSteerIds: string[] = [],+ ) => {if (!isCurrentSubscription()) {return;}@@ -1427,15 +1442,21 @@ export default function useResumableSSE(* the inline part can wait for React to mount the target, but leaving* the chip pending during that wait lets an intervening error/final* convert already-applied words into a duplicate queued message. */- if (attempt === 0) {- resolveSteerChip(chipConvoId, event.steerId, event.clientSteerId, event.part?.quotes);- }+ const firstApplicationIds =+ attempt === 0+ ? (resolveSteerChip(+ chipConvoId,+ event.steerId,+ event.clientSteerId,+ event.part?.quotes,+ ) ?? [])+ : liveSteerIds;const retryNextFrame = () => {if (attempt < PENDING_ACTION_MAX_RETRY_FRAMES) {const frameId = requestAnimationFrame(() => {steerRetryFramesRef.current.delete(frameId);if (isCurrentSubscription()) {- applySteerToMessages(event, attempt + 1);+ applySteerToMessages(event, attempt + 1, firstApplicationIds);}});steerRetryFramesRef.current.add(frameId);@@ -1452,6 +1473,19 @@ export default function useResumableSSE(}const updated = applySteerPart(messages[index], event);if (updated !== messages[index]) {+ /** Stamped only when the inline part is actually committed, in the+ * same batch, so its first render sees the flag and plays the+ * one-shot draw-in (`SteerPart` consumes the id on mount). A+ * replayed event is referentially stable here and an abandoned+ * placement never reaches this branch, so neither can strand a+ * stale id that would animate a historical part on a later visit.+ * Only the id the part RENDERS with (`part.steerId`) is stamped:+ * the part consumes exactly that id, so a client alias would sit+ * in the set forever as dead weight. */+ const renderedSteerId = event.part?.steerId ?? event.steerId;+ if (firstApplicationIds.includes(renderedSteerId)) {+ setLiveAppliedSteerIds((prev) => appendAppliedSteerIds(prev, [renderedSteerId]));+ }const nextMessages = [...messages];nextMessages[index] = updated;setMessages(nextMessages);@@ -3599,6 +3633,7 @@ export default function useResumableSSE(setRunEnd,clearDrainAfterAbort,resolveSteerChip,+ setLiveAppliedSteerIds,updateSteerChips,seedSteerChips,settleAppliedSteerParts,diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.jsonindex ec1ad9b2f6..791f2e3094 100644--- a/client/src/locales/en/translation.json+++ b/client/src/locales/en/translation.json@@ -2180,23 +2180,28 @@"com_ui_status_prefix": "Status:","com_ui_steer": "Steer","com_ui_steer_already_applied": "That steering message already reached the agent, so it was left in the response",+ "com_ui_steer_applied_info": "Applied. The agent received this message while it was responding.","com_ui_steer_arm_lost_race": "The interrupt could not be armed. The steering message may already have moved on or may still be waiting for the next tool step","com_ui_steer_arm_unconfirmed": "Couldn't confirm whether the interrupt was armed. The steering message may interrupt or may wait for the next tool step","com_ui_steer_cancel": "Cancel steering message","com_ui_steer_cancel_failed": "Could not cancel the steering message — it may still reach the agent",+ "com_ui_steer_delivered": "Delivered",+ "com_ui_steer_delivered_info": "Delivered. Your message will join the response at the next safe moment.","com_ui_steer_delivery_unconfirmed": "Delivery unconfirmed","com_ui_steer_edit_queued": "Your composer already has a draft, so that steering message was queued for after the response instead","com_ui_steer_failed": "Steering failed","com_ui_steer_in_flight": "Steering","com_ui_steer_in_flight_preempt": "Interrupting",+ "com_ui_steer_interrupting_info": "Interrupt requested. The response will stop at the next safe point, then your message takes over.","com_ui_steer_interrupts_default": "Steering interrupts generation","com_ui_steer_interrupts_default_info": "When on, Enter stops the response at the next safe point instead of waiting for the agent's next tool step. Either way the partial answer is kept and the response continues.","com_ui_steer_interrupts_enable_info": "Switches the during-run default to steering and stops the response at the next safe point. The partial answer is kept and the response continues.","com_ui_steer_paused_queued": "The agent is waiting for your review — your message was queued instead","com_ui_steer_preempt_unsupported": "This deployment can't interrupt mid-response, so that steering message stays queued for the next tool step",+ "com_ui_steer_queued_info": "Sends when this response finishes","com_ui_steer_retry": "Retry steering","com_ui_steer_send": "Steer the current response",- "com_ui_steered_info": "You added this message while the response was generating, so it was inserted into the response at this point.",+ "com_ui_steer_sending": "Sending…","com_ui_stop": "Stop","com_ui_storage": "Storage","com_ui_storage_filter_sort": "Filter and Sort by Storage",diff --git a/client/src/store/families.ts b/client/src/store/families.tsindex 40184b34a2..371d73971a 100644--- a/client/src/store/families.ts+++ b/client/src/store/families.ts@@ -540,6 +540,28 @@ const appliedSteerIdsByConvoId = atomFamily<string[], string>({default: [],});+/**+ * Steer ids whose applied event landed in THIS session, pending their one-shot+ * receipt draw-in. `SteerPart` consumes its id on mount so the animation plays+ * exactly once, at the live chip→inline hand-off — never on reload, share, or+ * a later revisit. Global rather than per-conversation: steer ids are unique,+ * and the applied part renders in surfaces that don't know their convo id. */+const liveAppliedSteerIds = atom<string[]>({+ key: 'liveAppliedSteerIds',+ default: [],+});++/** Membership view of `liveAppliedSteerIds` so each `SteerPart` subscribes to+ * its own id only: stamping/consuming one steer re-renders that part, not+ * every mounted historical part in a long conversation. */+const liveAppliedSteerFamily = selectorFamily<boolean, string>({+ key: 'liveAppliedSteerFamily',+ get:+ (steerId) =>+ ({ get }) =>+ steerId.length > 0 && get(liveAppliedSteerIds).includes(steerId),+});+/** Optimistic ids the server has proven accepted via ACK or SYNC. Separate* from `appliedSteerIdsByConvoId`: accepted-but-still-queued steers must not* be suppressed by terminal conversion, but a late POST error must not@@ -742,6 +764,8 @@ export default {pendingRunEndByConvoId,drainAfterAbortByIndex,appliedSteerIdsByConvoId,+ liveAppliedSteerIds,+ liveAppliedSteerFamily,acceptedSteerClientIdsByConvoId,activeGenerationCreatedAtByConvoId,activeGenerationProtocolVersionByConvoId,diff --git a/packages/client/src/components/InfoHoverCard.tsx b/packages/client/src/components/InfoHoverCard.tsxindex 6e753f6401..51a579bb85 100644--- a/packages/client/src/components/InfoHoverCard.tsx+++ b/packages/client/src/components/InfoHoverCard.tsx@@ -1,6 +1,7 @@import { useState } from 'react';import { JSX } from 'react/jsx-runtime';import { CircleHelpIcon, InfoIcon } from 'lucide-react';+import type { ReactNode } from 'react';import { HoverCard, HoverCardTrigger, HoverCardPortal, HoverCardContent } from './HoverCard';import { ESide } from '~/common';@@ -8,9 +9,17 @@ type InfoHoverCardProps = {side?: ESide;text: string;icon?: 'help' | 'info';+ /** Custom trigger content replacing the stock icon (e.g. a status glyph);+ * the hover text stays the trigger's accessible name either way. */+ children?: ReactNode;};-const InfoHoverCard = ({ side, text, icon = 'help' }: InfoHoverCardProps): JSX.Element => {+const InfoHoverCard = ({+ side,+ text,+ icon = 'help',+ children,+}: InfoHoverCardProps): JSX.Element => {const [isOpen, setIsOpen] = useState(false);const Icon = icon === 'info' ? InfoIcon : CircleHelpIcon;@@ -24,7 +33,7 @@ const InfoHoverCard = ({ side, text, icon = 'help' }: InfoHoverCardProps): JSX.EonBlur={() => setIsOpen(false)}aria-label={text}>- <Icon className="h-5 w-5 text-text-tertiary" aria-hidden="true" />+ {children ?? <Icon className="h-5 w-5 text-text-tertiary" aria-hidden="true" />}</button></HoverCardTrigger><HoverCardPortal>