From d55dbc3bd8bc25dd75df991fceea359d21173edc Mon Sep 17 00:00:00 2001 From: "lia-by-librechat[bot]" <328778573+lia-by-librechat[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2026 06:46:59 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=B1=20feat:=20Simplify=20Steering=20Co?= =?UTF-8?q?ntrols=20to=20Three=20Modes=20(#16759)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * πŸ”± feat: Simplify Steering Controls to Three Modes * Preserve Admitted Artifacts During Interrupts * Preserve Result Admission Across Interrupts * Gate Interrupt for Provider-Hosted Tools * Match Interrupt Hints to Availability --------- Co-authored-by: Lia --- client/src/Providers/ChatSettingsContext.tsx | 1 - client/src/components/Chat/Input/ChatForm.tsx | 9 +- .../Chat/Input/DuringRunSendButton.tsx | 61 +-- .../__tests__/DuringRunSendButton.test.tsx | 73 ++- .../src/components/Nav/Settings/registry.tsx | 13 - .../Chat/DuringRunAction.spec.tsx | 28 ++ .../Nav/SettingsTabs/Chat/DuringRunAction.tsx | 58 +-- .../hooks/Chat/__tests__/useSteering.spec.tsx | 69 +-- client/src/hooks/Chat/contract.ts | 4 +- client/src/hooks/Chat/useSteering.ts | 68 +-- .../Input/__tests__/useComposerHint.spec.ts | 32 ++ client/src/hooks/Input/useComposerHint.ts | 26 +- client/src/locales/en/translation.json | 22 +- client/src/routes/ChatSettings.tsx | 9 +- .../routes/__tests__/ChatSettings.spec.tsx | 13 +- client/src/store/duringRun.spec.ts | 28 ++ client/src/store/duringRun.ts | 23 + client/src/store/settings.ts | 13 - e2e/setup/fake-model.js | 49 +- .../mock/scenarios/composer-redesign.spec.ts | 1 + e2e/specs/mock/scenarios/queue-owners.spec.ts | 16 +- e2e/specs/mock/steering-escalation.spec.ts | 125 ++++- e2e/specs/mock/steering.spec.ts | 135 ++++-- .../__tests__/run-summarization.test.ts | 41 ++ packages/api/src/agents/handlers.ts | 32 +- packages/api/src/agents/run.ts | 26 +- .../agents/steering/__tests__/runtime.spec.ts | 41 ++ .../agents/steering/__tests__/tools.spec.ts | 431 ++++++++++++++++++ packages/api/src/agents/steering/runtime.ts | 17 +- packages/api/src/agents/steering/tools.ts | 133 ++++++ 30 files changed, 1248 insertions(+), 349 deletions(-) create mode 100644 client/src/components/Nav/SettingsTabs/Chat/DuringRunAction.spec.tsx create mode 100644 client/src/store/duringRun.spec.ts create mode 100644 client/src/store/duringRun.ts create mode 100644 packages/api/src/agents/steering/__tests__/tools.spec.ts create mode 100644 packages/api/src/agents/steering/tools.ts diff --git a/client/src/Providers/ChatSettingsContext.tsx b/client/src/Providers/ChatSettingsContext.tsx index bc3e781e7b..aceb093287 100644 --- a/client/src/Providers/ChatSettingsContext.tsx +++ b/client/src/Providers/ChatSettingsContext.tsx @@ -5,7 +5,6 @@ import type { ChatSettings } from '~/hooks/Chat/contract'; export const defaultChatSettings: ChatSettings = { duringRunDefaultAction: 'steer', setDuringRunDefaultAction: () => undefined, - steerInterruptsByDefault: false, resetVisibleArtifacts: () => undefined, saveDrafts: true, isTemporary: false, diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx index f522314eeb..3b1ccc7996 100644 --- a/client/src/components/Chat/Input/ChatForm.tsx +++ b/client/src/components/Chat/Input/ChatForm.tsx @@ -448,18 +448,16 @@ const ChatForm = memo(function ChatForm({ return () => publishRewake(null); }, [publishRewake, steeringRewakeDrain]); - /** ⌘/Ctrl+Enter = the non-default during-run action, βŒ₯/Alt+Enter = - * interrupt & send (discards the answer), ⌘/Ctrl+Shift+Enter = interrupt & - * steer (keeps it): all counterparts of Enter's `submitDuringRun`. */ + /** Ctrl/Cmd+Enter selects the alternate; both interrupt chords use the same mode. */ const handleDuringRunModifier = useCallback( (kind: 'other' | 'interrupt' | 'preempt') => { const text = methods.getValues('text'); let consumed = false; if (kind === 'interrupt') { - consumed = steering.interruptAndSend(text); + consumed = steering.interruptSteer(text); } else if (kind === 'preempt') { consumed = steering.interruptSteer(text); - } else if (steering.effectiveAction === 'steer') { + } else if (steering.effectiveAction !== 'queue') { consumed = steering.queueFromComposer(text); } else { consumed = steering.steerFromComposer(text); @@ -1052,7 +1050,6 @@ const ChatForm = memo(function ChatForm({ isSubmitting={isSubmitting} duringRunActive={steering.duringRunActive} canControlGeneration={steering.canControlGeneration} - steerInterruptsByDefault={steering.steerInterruptsByDefault} duringRunAction={steering.effectiveAction} /* A staged reasoning choice forces the message to queue, and the send-now chord then queues too; do not advertise it. */ diff --git a/client/src/components/Chat/Input/DuringRunSendButton.tsx b/client/src/components/Chat/Input/DuringRunSendButton.tsx index a3865f7983..69bc175e05 100644 --- a/client/src/components/Chat/Input/DuringRunSendButton.tsx +++ b/client/src/components/Chat/Input/DuringRunSendButton.tsx @@ -1,6 +1,6 @@ import React, { forwardRef, useMemo, useRef } from 'react'; import { useWatch } from 'react-hook-form'; -import { Zap, Clock, OctagonPause, ZapOff } from 'lucide-react'; +import { Zap, Clock, ZapOff } from 'lucide-react'; import { composerSubmitClasses, SendActions, SendIcon } from '@librechat/client'; import type { SendAction } from '@librechat/client'; import type { Control } from 'react-hook-form'; @@ -14,6 +14,12 @@ import { useLocalize } from '~/hooks'; * surface that can submit more than one way β€” see `SendActions`. */ type ActionRow = SendAction; +const ACTION_LABELS = { + steer: 'com_ui_steer_send', + interrupt: 'com_ui_interrupt_steer', + queue: 'com_ui_queue_send', +} as const; + type DuringRunSendButtonProps = { control: Control<{ text: string }>; steering: SteeringControls; @@ -26,17 +32,7 @@ type DuringRunSendButtonProps = { enterToSend: boolean; }; -/** - * The send button while a run is generating: it takes over the send/stop slot - * (and `submitButtonRef`, so Enter's synthetic click routes here) whenever the - * composer holds text: submitting steers or queues per the effective action. - * Hovering it reveals the full action list with its shortcuts: steer, queue - * (⌘/Ctrl+Enter routes to the non-default action), interrupt & steer - * (⌘/Ctrl+Shift+Enter β€” requests an earlier safe point when a conversation - * exists, otherwise stops and sends a new turn), and - * interrupt & send (βŒ₯/Alt+Enter β€” discards the answer and starts over). - * Clearing the composer restores the Stop button. - */ +/** The active mode owns submission; the menu overrides it for one message. */ const DuringRunSendButton = React.memo( forwardRef((props: DuringRunSendButtonProps, ref: React.ForwardedRef) => { const localize = useLocalize(); @@ -44,7 +40,6 @@ const DuringRunSendButton = React.memo( const { steering, enterToSend } = props; const disabledRef = useRef(props.disabled); disabledRef.current = props.disabled; - const { steerInterruptsByDefault } = steering; const data = useWatch({ control: props.control }); const content = data?.text?.trim(); const primary = steering.effectiveAction; @@ -85,14 +80,6 @@ const DuringRunSendButton = React.memo( }; }, [enterToSend, shortcutsEnabled, submitOverride, yieldedChords]); - /** - * With the preference on, plain Enter routes through `submitDuringRun`, - * which preempts. The hint has to follow it: leaving ⏎ on the ordinary - * Steer row would advertise a key that does something else, and that row - * deliberately stays non-preempting when CLICKED. No key reaches it in - * this mode, so it shows none. - */ - const enterInterrupts = primary === 'steer' && steerInterruptsByDefault; /** The chord that submits the default action, if any still does. */ let submitHint: string | undefined; if (verdicts.plainEnter === 'submit') { @@ -102,7 +89,7 @@ const DuringRunSendButton = React.memo( } const alternateHint = verdicts.modEnter === 'other' ? modEnter : undefined; let interruptSteerKbd: string | undefined; - if (enterInterrupts && submitHint != null) { + if (primary === 'interrupt' && submitHint != null) { interruptSteerKbd = submitHint; } else if (verdicts.modShiftEnter === 'preempt') { interruptSteerKbd = modShiftEnter; @@ -121,9 +108,9 @@ const DuringRunSendButton = React.memo( } }; - let steerKbd: string | undefined = alternateHint; + let steerKbd: string | undefined = primary === 'queue' ? alternateHint : undefined; if (primary === 'steer') { - steerKbd = enterInterrupts ? undefined : submitHint; + steerKbd = submitHint; } const steerRow: ActionRow = { @@ -143,34 +130,24 @@ const DuringRunSendButton = React.memo( disabled: props.disabled, onClick: () => runAction((text) => steering.queueFromComposer(text)), }; - /** When steering is available, keeps visible text; a new chat instead hard-stops. */ + /** Interrupt never becomes a stop-and-send fallback. */ const interruptSteerRow: ActionRow = { key: 'interrupt-steer', - label: localize( - props.isNewConversation ? 'com_ui_steer_first_turn_stop' : 'com_ui_interrupt_steer', - ), + label: localize('com_ui_interrupt_steer'), kbd: interruptSteerKbd, icon: