Force queued messages, wrap long terminal input and questions, Ctrl+J newline in the web UI

A further Enter on the empty input (terminal client, web UI) or Ctrl+Enter with text (web UI)
interrupts the running step and delivers the queued messages at once (POST /api/sessions/{id}/queue/force).
The terminal client shows queued messages above the input, wraps the input field and the question dialog.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Sonnet 5.5 committed 2026-11-27 09:27:38 +01:00
1 parent 679151defc
commit e64328aa98
13 files changed
+437 -42

No files matched your search

+27 -5
View File
@@ -5,6 +5,8 @@ import { uploadBatch } from "../uploads";
import { useEffect, useMemo, useRef, useState } from "react";
import { useAgents, useFetch, useModels } from "../hooks";
import { useT, type Key } from "../i18n";
import { useStore } from "../store";
import { post } from "../api";
import type { ImageData, Session } from "../types";
import { ModelSelect } from "./ModelSelect";
import { EffortSelect } from "./Regenerate";
@@ -55,7 +57,7 @@ export function Composer({
busy: boolean;
text: string;
setText: (s: string) => void;
onSend: (text: string, images: ImageData[], effort?: string) => void;
onSend: (text: string, images: ImageData[], effort?: string) => void | Promise<void>;
onAbort: () => void;
onUpdate: (patch: Partial<Session>) => void;
}) {
@@ -145,11 +147,20 @@ export function Composer({
return [...mine, ...cmds].slice(0, 12);
}, [text, cmdData, snippets, t, mention, mentionHits]);
const send = () => {
// Messages waiting for the agent: a further Enter on the empty field (or Ctrl+Enter with text) delivers them at once.
const queued = useStore((s) => (s.queue[session.id] ?? []).length);
const force = () => post(`/sessions/${session.id}/queue/force`).catch((e) => toast(e.message));
const send = (thenForce = false) => {
if (!text.trim() && images.length === 0 && files.length === 0 && busy && queued > 0) {
void force();
return;
}
if ((!text.trim() && images.length === 0 && files.length === 0) || uploading > 0) return;
// Files are referenced by path; the agent reads them with its tools.
const refs = files.length ? `\n\n${t("composer.attachedFiles")}\n${files.map((f) => `- ${f.path} (${formatSize(f.size)})`).join("\n")}` : "";
onSend(`${text}${refs}`, images, effort);
const sent = onSend(`${text}${refs}`, images, effort);
if (thenForce && busy) void Promise.resolve(sent).then(force);
setEffort("");
setImages([]);
setFiles([]);
@@ -174,11 +185,22 @@ export function Composer({
return;
}
}
// Ctrl+J inserts a new line (like Shift+Enter, and like Ctrl+J / Shift+Enter in the terminal client).
if (e.key.toLowerCase() === "j" && e.ctrlKey && !e.altKey && !e.metaKey && !e.nativeEvent.isComposing) {
e.preventDefault();
const el = e.currentTarget as HTMLTextAreaElement;
const a = el.selectionStart ?? text.length;
const b = el.selectionEnd ?? a;
setText(`${text.slice(0, a)}\n${text.slice(b)}`);
requestAnimationFrame(() => ref.current?.setSelectionRange(a + 1, a + 1));
return;
}
// Enter sends on desktop; on touch devices Enter inserts a newline.
const touch = matchMedia("(pointer: coarse)").matches;
if (e.key === "Enter" && !e.shiftKey && !touch && !e.nativeEvent.isComposing) {
e.preventDefault();
send();
// Ctrl/Cmd+Enter while the agent works: queue the message and interrupt the step so it is read at once.
send(e.ctrlKey || e.metaKey);
}
if (e.key === "Escape" && busy) onAbort();
};
@@ -400,7 +422,7 @@ export function Composer({
<Icon name="stop" /> {t("composer.stop")}
</button>
)}
<button className="primary" onClick={send} disabled={uploading > 0 || (!text.trim() && images.length === 0 && files.length === 0)}>
<button className="primary" onClick={() => send()} disabled={uploading > 0 || (!text.trim() && images.length === 0 && files.length === 0)}>
{busy ? t("composer.queue") : t("composer.send")}
</button>
</div>
+7 -5
View File
@@ -17,11 +17,13 @@ export function QueueList({ sessionId, busy }: { sessionId: string; busy: boolea
<div className="queue">
<div className="queue-head">
<span>{busy ? t("queue.pending", { n: items.length }) : t("queue.stopped", { n: items.length })}</span>
{!busy && (
<button className="small primary" onClick={() => post(`/sessions/${sessionId}/queue/flush`).catch((e) => toast(e.message))}>
{t("queue.sendNow")}
</button>
)}
<button
className="small primary"
title={busy ? t("queue.forceHint") : undefined}
onClick={() => post(`/sessions/${sessionId}/queue/force`).catch((e) => toast(e.message))}
>
{busy ? t("queue.force") : t("queue.sendNow")}
</button>
</div>
{items.map((it) => {
const text = it.parts.map((p) => (p.type === "text" ? p.text : "")).join(" ").trim();
+5 -3
View File
@@ -69,9 +69,11 @@ export const de: Messages = {
"settings.pricesFetched": "Preise für {n} Modelle aktualisiert – zum Übernehmen speichern.",
"stats.perMillion": "pro 1 Mio. Tok.",
"stats.perMillionHint": "Effektive Kosten pro Million Tokens (Input inkl. Cache + Output)",
"queue.pending": "{n} Nachricht(en) in der Warteschlange – werden beim nächsten Schritt übergeben",
"queue.pending": "{n} Nachricht(en) in der Warteschlange – werden beim nächsten Schritt übergeben (Enter im leeren Feld erzwingt sofort)",
"queue.stopped": "{n} Nachricht(en) in der Warteschlange",
"queue.sendNow": "Jetzt senden",
"queue.force": "Jetzt erzwingen",
"queue.forceHint": "Unterbricht den laufenden Schritt, das Modell liest die Nachricht sofort (Enter im leeren Feld oder Strg+Enter)",
"queue.remove": "Aus der Warteschlange entfernen",
"queue.backgroundResult": "Ergebnis einer Hintergrundaufgabe",
"permissionMode.auto": "Automatisch (fragt einmal, Sicheres läuft)",
@@ -819,8 +821,8 @@ export const de: Messages = {
"chat.delete": "Session löschen",
"chat.deleteConfirm": "Diese Session inklusive Subagenten löschen? Die Statistik bleibt erhalten.",
"composer.placeholder": "Nachricht… (/ für Befehle, @ für Dateien, Dateien anhängen oder einfügen)",
"composer.placeholderBusy": "Nachricht wird eingereiht und beim nächsten Schritt gesendet…",
"composer.placeholder": "Nachricht… (/ für Befehle, @ für Dateien, Shift+Enter oder Strg+J für neue Zeile)",
"composer.placeholderBusy": "Nachricht wird eingereiht und beim nächsten Schritt gesendet… (Strg+Enter sendet sofort)",
"composer.send": "Senden",
"composer.queue": "Einreihen",
"composer.stop": "Stopp",
+5 -3
View File
@@ -68,9 +68,11 @@ export const en = {
"settings.pricesFetched": "Prices updated for {n} models – save to keep them.",
"stats.perMillion": "per 1M tok",
"stats.perMillionHint": "Effective cost per million tokens (input incl. cache + output)",
"queue.pending": "{n} message(s) waiting – delivered at the agent's next step",
"queue.pending": "{n} message(s) waiting – delivered at the agent's next step (Enter on an empty field forces it now)",
"queue.stopped": "{n} message(s) waiting",
"queue.sendNow": "Send now",
"queue.force": "Force now",
"queue.forceHint": "Interrupts the running step so the model reads the message at once (Enter on an empty field or Ctrl+Enter)",
"queue.remove": "Remove from queue",
"queue.backgroundResult": "Result of a background task",
"permissionMode.auto": "Automatic (asks once, safe steps run)",
@@ -818,8 +820,8 @@ export const en = {
"chat.delete": "Delete session",
"chat.deleteConfirm": "Delete this session including its subagents? Statistics are kept.",
"composer.placeholder": "Message… (/ for commands, @ for files, attach or paste files)",
"composer.placeholderBusy": "Message is queued and sent at the next step…",
"composer.placeholder": "Message… (/ for commands, @ for files, Shift+Enter or Ctrl+J for a new line)",
"composer.placeholderBusy": "Message is queued and sent at the next step… (Ctrl+Enter sends it now)",
"composer.send": "Send",
"composer.queue": "Queue",
"composer.stop": "Stop",
+4
View File
@@ -3,6 +3,10 @@
* under "unreleased"; scripts/release.sh renames the key to the release version.
*/
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
unreleased: {
en: ["Queued messages can be forced: Enter on the empty input, Ctrl+Enter with text or the \"Force now\" button interrupts the running step so the model reads the message at once (also in the terminal client)", "Terminal client: long input and long questions wrap instead of being cut off; queued messages are shown above the input"],
de: ["Eingereihte Nachrichten lassen sich erzwingen: Enter im leeren Feld, Strg+Enter mit Text oder der Button „Jetzt erzwingen“ unterbricht den laufenden Schritt, sodass das Modell die Nachricht sofort liest (auch im Terminal-Client)", "Terminal-Client: lange Eingaben und lange Fragen werden umbrochen statt abgeschnitten; wartende Nachrichten stehen über dem Eingabefeld"],
},
"202611-00080": {
en: ["Fixed: the Factory page no longer makes the server stall (504 errors, high CPU)"],
de: ["Behoben: die Factory-Seite lässt den Server nicht mehr hängen (504-Fehler, hohe CPU-Last)"],