feat(web): choose queue or steer for follow-up messages (#11964)
This commit is contained in:
1 parent
96bddf8125
commit
719a76ca1d
10 files changed
+117
-7
No files matched your search
@@ -6781,6 +6781,17 @@ export default function ChatView(props: ChatViewProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (command === "thread.steerQueuedMessage") {
|
||||
const message = activeThreadKey
|
||||
? useQueuedMessageStore.getState().queuesByThreadKey[activeThreadKey]?.[0]
|
||||
: undefined;
|
||||
if (!message) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (!event.repeat) queuedMessageActionsRef.current.steer(message.id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (command === "thread.stop") {
|
||||
// An unavailable command should not shadow contextual shortcuts such as Escape to close a dialog.
|
||||
if (!canInterruptRunningThread) return;
|
||||
@@ -6810,6 +6821,7 @@ export default function ChatView(props: ChatViewProps) {
|
||||
activeThreadPinned,
|
||||
activeThreadSettled,
|
||||
canInterruptRunningThread,
|
||||
activeThreadKey,
|
||||
terminalUiState.terminalOpen,
|
||||
terminalUiState.activeTerminalId,
|
||||
activeThreadId,
|
||||
@@ -7497,11 +7509,13 @@ export default function ChatView(props: ChatViewProps) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
// A send during a running turn waits in the queue. It leaves on the next
|
||||
// tool boundary, when the turn ends, or when the user clicks Steer. The
|
||||
// provider treats a mid-turn send as a steer of the active turn, so the
|
||||
// dispatch below is the same either way.
|
||||
if (!queuedMessage && !directAnnotation && phase === "running" && activeThreadKey) {
|
||||
if (
|
||||
!queuedMessage &&
|
||||
!directAnnotation &&
|
||||
phase === "running" &&
|
||||
activeThreadKey &&
|
||||
settings.followUpBehavior === "queue"
|
||||
) {
|
||||
if (composerRef.current?.validateProviderInput(promptForSend) === false) {
|
||||
return;
|
||||
}
|
||||
@@ -9501,6 +9515,11 @@ export default function ChatView(props: ChatViewProps) {
|
||||
loadEarlier={paintOnlyDisplayedTimeline ? null : loadEarlierTurns}
|
||||
queuedMessages={paintOnlyDisplayedTimeline ? EMPTY_QUEUED_MESSAGES : queuedMessages}
|
||||
onSteerQueuedMessage={onSteerQueuedMessage}
|
||||
steerQueuedMessageShortcutLabel={shortcutLabelForCommand(
|
||||
keybindings,
|
||||
"thread.steerQueuedMessage",
|
||||
{ context: { terminalFocus: false } },
|
||||
)}
|
||||
onRemoveQueuedMessage={onRemoveQueuedMessage}
|
||||
/>
|
||||
|
||||
|
||||
@@ -285,6 +285,7 @@ interface TimelineRowSharedState {
|
||||
onWorktreeSetupWorkLocally: (() => void) | null;
|
||||
onOpenWorktreeSetupTerminal: ((terminalId: string) => void) | null;
|
||||
onSteerQueuedMessage: (id: string) => void;
|
||||
steerQueuedMessageShortcutLabel: string | null;
|
||||
onRemoveQueuedMessage: (id: string) => void;
|
||||
}
|
||||
|
||||
@@ -441,6 +442,7 @@ interface MessagesTimelineProps {
|
||||
/** Messages sent during the running turn. They render as ghost bubbles after the live rows. */
|
||||
queuedMessages?: ReadonlyArray<QueuedComposerMessage>;
|
||||
onSteerQueuedMessage?: (id: string) => void;
|
||||
steerQueuedMessageShortcutLabel?: string | null;
|
||||
onRemoveQueuedMessage?: (id: string) => void;
|
||||
}
|
||||
|
||||
@@ -496,6 +498,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
|
||||
loadEarlier = null,
|
||||
queuedMessages = EMPTY_QUEUED_MESSAGES,
|
||||
onSteerQueuedMessage = NOOP_QUEUED_MESSAGE_ACTION,
|
||||
steerQueuedMessageShortcutLabel = null,
|
||||
onRemoveQueuedMessage = NOOP_QUEUED_MESSAGE_ACTION,
|
||||
}: MessagesTimelineProps) {
|
||||
const [expandedTurnIds, setExpandedTurnIds] = useState<ReadonlySet<TurnId>>(new Set());
|
||||
@@ -940,6 +943,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
|
||||
onWorktreeSetupWorkLocally: onWorktreeSetupWorkLocally ?? null,
|
||||
onOpenWorktreeSetupTerminal: onOpenWorktreeSetupTerminal ?? null,
|
||||
onSteerQueuedMessage,
|
||||
steerQueuedMessageShortcutLabel,
|
||||
onRemoveQueuedMessage,
|
||||
}),
|
||||
[
|
||||
@@ -972,6 +976,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
|
||||
onWorktreeSetupWorkLocally,
|
||||
onOpenWorktreeSetupTerminal,
|
||||
onSteerQueuedMessage,
|
||||
steerQueuedMessageShortcutLabel,
|
||||
onRemoveQueuedMessage,
|
||||
],
|
||||
);
|
||||
@@ -1564,7 +1569,12 @@ function QueuedMessageTimelineRow({
|
||||
>
|
||||
<ArrowUpIcon className="size-3.5" aria-hidden />
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side="bottom">Send now</TooltipPopup>
|
||||
<TooltipPopup side="bottom">
|
||||
Send now
|
||||
{row.isNext && ctx.steerQueuedMessageShortcutLabel
|
||||
? ` (${ctx.steerQueuedMessageShortcutLabel})`
|
||||
: null}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
|
||||
@@ -578,6 +578,9 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
...(settings.composerCollapseOnScroll !== DEFAULT_UNIFIED_SETTINGS.composerCollapseOnScroll
|
||||
? ["Collapse composer on scroll"]
|
||||
: []),
|
||||
...(settings.followUpBehavior !== DEFAULT_UNIFIED_SETTINGS.followUpBehavior
|
||||
? ["Follow-up behavior"]
|
||||
: []),
|
||||
...(settings.contextWindowMeterEnabled !== DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled
|
||||
? ["Context window indicator"]
|
||||
: []),
|
||||
@@ -636,6 +639,7 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
settings.confirmThreadDelete,
|
||||
settings.confirmThreadUnpin,
|
||||
settings.composerCollapseOnScroll,
|
||||
settings.followUpBehavior,
|
||||
settings.addProjectBaseDirectory,
|
||||
settings.defaultThreadEnvMode,
|
||||
settings.newWorktreesStartFromOrigin,
|
||||
@@ -748,6 +752,7 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
proactivePanelsEnabled: DEFAULT_UNIFIED_SETTINGS.proactivePanelsEnabled,
|
||||
showSkillsInSlashMenu: DEFAULT_UNIFIED_SETTINGS.showSkillsInSlashMenu,
|
||||
composerCollapseOnScroll: DEFAULT_UNIFIED_SETTINGS.composerCollapseOnScroll,
|
||||
followUpBehavior: DEFAULT_UNIFIED_SETTINGS.followUpBehavior,
|
||||
contextWindowMeterEnabled: DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled,
|
||||
environmentIdentificationMode: DEFAULT_UNIFIED_SETTINGS.environmentIdentificationMode,
|
||||
glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity,
|
||||
@@ -2589,6 +2594,47 @@ export function GeneralSettingsPanel() {
|
||||
}
|
||||
/>
|
||||
|
||||
<SettingsRow
|
||||
{...searchableSetting("follow-up-behavior")}
|
||||
description="Queue follow-ups while the agent runs or steer the current turn."
|
||||
resetAction={
|
||||
settings.followUpBehavior !== DEFAULT_UNIFIED_SETTINGS.followUpBehavior ? (
|
||||
<SettingResetButton
|
||||
label="follow-up behavior"
|
||||
onClick={() =>
|
||||
updateSettings({
|
||||
followUpBehavior: DEFAULT_UNIFIED_SETTINGS.followUpBehavior,
|
||||
})
|
||||
}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
control={
|
||||
<Select
|
||||
value={settings.followUpBehavior}
|
||||
onValueChange={(value) => {
|
||||
if (value === "queue" || value === "steer") {
|
||||
updateSettings({ followUpBehavior: value });
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full sm:w-40" aria-label="Follow-up behavior">
|
||||
<SelectValue>
|
||||
{settings.followUpBehavior === "queue" ? "Queue" : "Steer"}
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectPopup align="end" alignItemWithTrigger={false}>
|
||||
<SelectItem hideIndicator value="queue">
|
||||
Queue
|
||||
</SelectItem>
|
||||
<SelectItem hideIndicator value="steer">
|
||||
Steer
|
||||
</SelectItem>
|
||||
</SelectPopup>
|
||||
</Select>
|
||||
}
|
||||
/>
|
||||
|
||||
<SettingsRow
|
||||
serverScoped
|
||||
settingKeys={["enableProviderUpdateChecks"]}
|
||||
|
||||
@@ -298,6 +298,12 @@ export const SETTINGS_SEARCH_ITEMS = [
|
||||
to: "/settings/general",
|
||||
searchTerms: ["composer rest resting scroll wheel conversation timeline shrink minimize"],
|
||||
},
|
||||
{
|
||||
id: "follow-up-behavior",
|
||||
title: "Follow-up behavior",
|
||||
to: "/settings/general",
|
||||
searchTerms: ["queue steer running turn send default behavior composer"],
|
||||
},
|
||||
{
|
||||
id: "provider-update-checks",
|
||||
title: "Provider update checks",
|
||||
|
||||
@@ -1119,6 +1119,7 @@ describe("composer and pull request shortcuts", () => {
|
||||
["l", "composer.previousWorktree"],
|
||||
["c", "thread.copyReference"],
|
||||
["k", "pullRequest.copyNumber"],
|
||||
["Enter", "thread.steerQueuedMessage"],
|
||||
] as const;
|
||||
|
||||
for (const platform of ["MacIntel", "Win32", "Linux"]) {
|
||||
|
||||
+10
-1
@@ -31,12 +31,21 @@ See [images and videos](#images-and-videos-in-messages) for previewing and savin
|
||||
|
||||
## Send while the agent is working
|
||||
|
||||
A message sent during a running turn waits at the end of the conversation as a
|
||||
On web and desktop, a message sent during a running turn waits at the end of the conversation as a
|
||||
dashed bubble. It goes out on its own when the agent finishes its next tool
|
||||
call, or when the turn ends. Use the arrow under the bubble to send it right
|
||||
away, or the X to move it back into the composer. Stop returns every queued
|
||||
message to the composer.
|
||||
|
||||
In **Settings → General → Follow-up behavior**, choose **Queue** to keep this
|
||||
behavior or **Steer** to send new messages immediately. This setting applies to
|
||||
the current client. Messages already queued keep their place.
|
||||
|
||||
Use `Cmd+Shift+Enter` on macOS or `Ctrl+Shift+Enter` on Windows and Linux to send
|
||||
the oldest queued message now. Change `thread.steerQueuedMessage` in
|
||||
**Settings → Keybindings** to use another shortcut. It leaves the current draft
|
||||
in the composer and waits if the agent needs an approval or an answer.
|
||||
|
||||
## Queue messages offline on mobile
|
||||
|
||||
Mobile keeps local copies of draft attachments, so you can preview them and queue
|
||||
|
||||
@@ -36,6 +36,7 @@ export type ModelPickerJumpKeybindingCommand =
|
||||
|
||||
const THREAD_KEYBINDING_COMMANDS = [
|
||||
"thread.stop",
|
||||
"thread.steerQueuedMessage",
|
||||
"thread.previous",
|
||||
"thread.next",
|
||||
"thread.copyReference",
|
||||
|
||||
@@ -529,6 +529,19 @@ describe("ClientSettings context window meter", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("ClientSettings follow-up behavior", () => {
|
||||
it("defaults to queue and accepts either behavior", () => {
|
||||
expect(decodeClientSettings({}).followUpBehavior).toBe("queue");
|
||||
for (const followUpBehavior of ["queue", "steer"]) {
|
||||
expect(decodeClientSettings({ followUpBehavior }).followUpBehavior).toBe(followUpBehavior);
|
||||
expect(decodeClientSettingsPatch({ followUpBehavior }).followUpBehavior).toBe(
|
||||
followUpBehavior,
|
||||
);
|
||||
}
|
||||
expect(() => decodeClientSettingsPatch({ followUpBehavior: "invalid" })).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("ClientSettings composer collapse", () => {
|
||||
it("collapses on scroll by default and accepts opting out", () => {
|
||||
expect(decodeClientSettings({}).composerCollapseOnScroll).toBe(true);
|
||||
|
||||
@@ -430,6 +430,9 @@ export const ClientSettingsSchema = Schema.Struct({
|
||||
// Desktop resting composer: scrolling an existing thread's conversation
|
||||
// settles the composer into its single-line layout. Losing focus never does.
|
||||
composerCollapseOnScroll: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
|
||||
followUpBehavior: Schema.Literals(["queue", "steer"]).pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed("queue")),
|
||||
),
|
||||
proactivePanelsEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
showSkillsInSlashMenu: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
|
||||
// Legacy sidebar (the original per-project tree). Deliberately a fresh key
|
||||
@@ -1499,6 +1502,7 @@ export const ClientSettingsPatch = Schema.Struct({
|
||||
planModeEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
contextWindowMeterEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
composerCollapseOnScroll: Schema.optionalKey(Schema.Boolean),
|
||||
followUpBehavior: Schema.optionalKey(Schema.Literals(["queue", "steer"])),
|
||||
proactivePanelsEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),
|
||||
legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
|
||||
@@ -40,6 +40,7 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
|
||||
{ key: "mod+shift+f", command: "projectSearch.toggle", when: "!terminalFocus" },
|
||||
{ key: "mod+alt+shift+t", command: "themeEditor.toggle" },
|
||||
{ key: "mod+s", command: "composer.stash", when: "!terminalFocus" },
|
||||
{ key: "mod+shift+enter", command: "thread.steerQueuedMessage", when: "!terminalFocus" },
|
||||
{ key: "mod+n", command: "chat.new", when: "!terminalFocus" },
|
||||
{ key: "mod+shift+o", command: "chat.new", when: "!terminalFocus" },
|
||||
{ key: "mod+shift+n", command: "chat.newLocal", when: "!terminalFocus" },
|
||||
|
||||
Reference in new issue
Block a user