Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Shell mode matches what Send will do.** Inline text attachments remain prompt attachments even when the draft begins with `!` or `!!`; their contents are never interpreted as shell commands. Rejected sends restore the original text and file attachments separately, so retrying does not turn the prompt into a shell command. During an active run, unattached shell commands say **Run shell command** rather than Queue or Steer. Shell-mode font changes also resize the composer when attachments are added or removed, and the exclusion label explicitly states that output remains saved in the transcript.
- **Recovered prompts and attachment-backed drafts preserve their input mode.** Prompts remain model input even when their text starts with `!` or `!!`, including after navigation, session identity moves, rejection, and page reload. Drafts keep this provenance even when memory-only attachment payloads disappear on reload. Clearing the recovered content, including removing its final image from an otherwise empty composer, starts fresh input so a new shell command works normally. Empty recovery results never change newer input.
- **History prefills and unfinished uploads keep prompt intent.** History Edit, edit-and-resend Fork, and refused interrupt/reply prefills remain model input when their omitted attachments once prevented shell execution. Existing user drafts keep their own intent. Draft snapshots capture every live attachment before filtering unfinished upload payloads, so uploading or failed file chips cannot turn a prompt into a shell command after navigation or reload.
- **Side questions look different before you send.** Typing `/btw` tints the composer and shows **Send**, even during a run and when the usual submit action is Queue or Steer. Side questions are sent immediately, never queued.
- **Finished background tool calls no longer show up as running.** A `bash` or `task` call that omp moved to the background kept reporting progress after it returned, and ompweb counted each report as a running tool. Opening the chat mid-run then listed those long-finished calls as empty running rows below the transcript until the next event, and an open chat could briefly show a finished call as running again. Calls that returned before an ompweb server restart can still show this once.
- **Background Sync retains permanent rejection states.** A rejected held message, including one from a changed installation scope, is saved as **Not sent** rather than left as **Sending**. It is not rebound to new credentials, and a late refusal cannot recreate an entry another sender already accepted.
- **Pending messages protect newer drafts and delivery intent.** A delayed storage acknowledgement does not clear newer input, even if an edit restores identical text. Same-time submissions keep durable enqueue order; duplicate browser IDs and unrelated successful HTTP responses cannot overwrite or acknowledge a held message. Delete confirmations distinguish removing tracking from cancelling work omp may already have received.
Expand Down
44 changes: 44 additions & 0 deletions components/ChatInput.btw.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@ for (const isStreaming of [false, true]) {
});
}

for (const behavior of ["queue", "steer"]) {
test(`/btw offers Send during a run regardless of the ${behavior} preference`, async () => {
localStorage.setItem("omp-web:submit-during-run", behavior);
const user = userEvent.setup();
const { calls } = renderComposer({ isStreaming: true });
await user.type(screen.getByRole("textbox"), "/btw what is 2+2");
await user.click(screen.getByRole("button", { name: "Send", exact: true }));
await waitFor(() => assert.deepEqual(calls, [["onBuiltinCommand", "/btw what is 2+2"]]));
await waitFor(() => assert.equal(screen.getByRole("textbox").value, ""));
});
}

test("without builtin dispatch, /btw during a run keeps the Queue button and queues as ordinary text", async () => {
localStorage.setItem("omp-web:submit-during-run", "queue");
const user = userEvent.setup();
const { calls } = renderComposer({ isStreaming: true, onBuiltinCommand: undefined });
await user.type(screen.getByRole("textbox"), "/btw what is 2+2");
assert.equal(screen.queryByRole("button", { name: "Send", exact: true }), null);
await user.keyboard("{Enter}");
await waitFor(() => assert.deepEqual(calls, [["onFollowUp", "/btw what is 2+2"]]));
});

test("/btw with an attachment is refused and keeps the draft and the attachment", async () => {
const user = userEvent.setup();
const { calls, ref } = renderComposer({ isStreaming: false });
Expand All @@ -64,3 +86,25 @@ test("/btw with an attachment is refused and keeps the draft and the attachment"
assert.equal(screen.getByRole("textbox").value, "/btw what is this");
assert.equal(getDraft("btw-draft")?.files.length, 1);
});

test("slash palette keeps /btw available during a streaming run", async () => {
const user = userEvent.setup();
renderComposer({ isStreaming: true });
await user.type(screen.getByRole("textbox"), "/bt");
await waitFor(() => assert.ok(screen.getByText("/btw")));
});

test("/btw Send button refuses pending uploads immediately with the attachment error", async () => {
const user = userEvent.setup();
const { calls, ref } = renderComposer({ isStreaming: true });
// Attach an uploading file (20 MB exceeds inline text limit -> staged upload).
await act(async () => {
ref.current.addFiles([new File([new Uint8Array(6 * 1024 * 1024)], "big.bin", { type: "application/octet-stream" })]);
});
await user.type(screen.getByRole("textbox"), "/btw what is this");
const sendBtn = screen.getByRole("button", { name: "Send", exact: true });
assert.equal(sendBtn.disabled, false);
await user.click(sendBtn);
assert.deepEqual(calls, []);
assert.equal(screen.getByRole("textbox").value, "/btw what is this");
});
33 changes: 20 additions & 13 deletions components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
const bashExcluded = bashMode && trimmedValue.startsWith("!!");
// "!" shares output with the model (riskier, root-style warning); "!!" stays local (plain terminal).
const shellMode = bashMode ? (bashExcluded ? "local" : "model") : undefined;
// Side questions stay separate from the main run's queue and Stop action. Without builtin dispatch `/btw` is
// ordinary text, so the composer keeps its Queue fallback.
const btwMode = Boolean(onBuiltinCommand) && /^\/btw(\s|$)/.test(trimmedValue);
const [slashMenuOpen, setSlashMenuOpen] = useState(false);
const [slashActiveIndex, setSlashActiveIndex] = useState(0);
const [slashMatch, setSlashMatch] = useState<SlashQueryMatch | null>(null);
Expand Down Expand Up @@ -1283,9 +1286,10 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
if (!msg && !attachedImagesRef.current.length && !attachedTextFilesRef.current.length && !attachedUploadsRef.current.length) return;
// `!cmd` runs right away during a run too, as in omp's terminal; it is never queued as text.
const shellCommand = !promptOnlyRef.current && msg.startsWith("!") && !attachedImagesRef.current.length && !attachedTextFilesRef.current.length && !attachedUploadsRef.current.length;
if (submissionBlockedRef.current || holdingRef.current || (isStreaming && !shellCommand)) return;
if (submissionBlockedRef.current || holdingRef.current) return;
onAudioUnlock?.();
if (sendSideQuestion(msg, overrideText)) return;
if (isStreaming && !shellCommand) return;
if (rejectsPendingUploads()) return;
const files = attachedTextFilesRef.current;
const composedMessage = composeMessageWithTextAttachments(msg, files);
Expand Down Expand Up @@ -1370,7 +1374,9 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
toast.success(t("chatInput.dictationSuccess"));
return;
}
if (after && onFollowUp) {
if (after && sendSideQuestion(finalText.trim(), finalText)) {
Comment thread
andrebrait marked this conversation as resolved.
Resolved
Comment thread
andrebrait marked this conversation as resolved.
Resolved
return;
} else if (after && onFollowUp) {
sendQueued(after === "send" ? "followup" : after, finalText);
} else if (after && !isStreaming) {
void handleSend(finalText);
Expand Down Expand Up @@ -1502,7 +1508,8 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
return modelCollator.compare(a.name, b.name);
});
}
const commands = [...(isStreaming ? [] : builtinSlashCommands), ...externalSlashCommands];
// During a run the other builtins would only be queued as text; /btw runs beside the main run.
const commands = [...(isStreaming ? builtinSlashCommands.filter((command) => command.name === "btw") : builtinSlashCommands), ...externalSlashCommands];
Comment thread
andrebrait marked this conversation as resolved.
Resolved
Comment thread
andrebrait marked this conversation as resolved.
Resolved
return [...commands]
.filter((command) => {
const name = command.name.toLowerCase();
Expand Down Expand Up @@ -1859,7 +1866,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
const imageUploads = attachedUploads.filter((upload) => upload.previewUrl !== null);
const fileUploads = attachedUploads.filter((upload) => upload.previewUrl === null);
const primaryActionQueuesMessage =
isStreaming
isStreaming && !btwMode
&& (Boolean(value.trim()) || hasAttachments || dictationCapturing)
&& Boolean(onFollowUp);
// The button follows the same Settings choice as Enter: soft keyboards have no
Expand Down Expand Up @@ -3180,7 +3187,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
aria-live="polite"
data-shell={shellMode}
style={{
border: "1px solid var(--shell-border, color-mix(in srgb, var(--border) 70%, transparent))",
border: btwMode ? "1px solid var(--accent)" : "1px solid var(--shell-border, color-mix(in srgb, var(--border) 70%, transparent))",
borderBottom: "none",
borderRadius: queuedCount > 0 ? 0 : "var(--radius-card) var(--radius-card) 0 0",
background: "var(--bg-panel)",
Expand All @@ -3205,8 +3212,8 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
style={{
display: "flex",
flexDirection: "column",
background: "var(--shell-bg, var(--bg))",
border: "1px solid var(--shell-border, color-mix(in srgb, var(--border) 70%, transparent))",
background: btwMode ? "color-mix(in srgb, var(--accent) 8%, var(--bg))" : "var(--shell-bg, var(--bg))",
border: btwMode ? "1px solid var(--accent)" : "1px solid var(--shell-border, color-mix(in srgb, var(--border) 70%, transparent))",
borderRadius: (queuedCount > 0 || Boolean(statusText)) ? "0 0 var(--radius-card) var(--radius-card)" : "var(--radius-card)",
padding: "12px 12px 10px",
boxShadow: "var(--shadow-card)",
Expand Down Expand Up @@ -3960,7 +3967,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
: <ListChecks size={13} strokeWidth={2} aria-hidden="true" />}
{t(primaryActionRunsShell ? "chatInput.runShell" : primaryActionMode === "steer" ? "chatInput.steer" : "chatInput.queue")}
</button>
) : isStreaming ? (
) : isStreaming && !btwMode ? (
<button
type="button"
className="composer-primary-action"
Expand Down Expand Up @@ -3988,8 +3995,8 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
type="button"
className="composer-primary-action"
onClick={isRecording || isPaused || isReviewing ? () => stopAndFinishDictation("send") : () => void handleSend()}
disabled={submissionBlocked || isTranscribing || uploadsBlockSend || !(isRecording || isPaused || isReviewing || value.trim() || hasAttachments)}
title={uploadsBlockSend
disabled={submissionBlocked || isTranscribing || (!btwMode && uploadsBlockSend) || !(isRecording || isPaused || isReviewing || value.trim() || hasAttachments)}
Comment thread
andrebrait marked this conversation as resolved.
Resolved
Comment thread
andrebrait marked this conversation as resolved.
Resolved
title={!btwMode && uploadsBlockSend
? (failedUploadCount > 0 ? t("chatInput.uploadsFailedBlock", { count: failedUploadCount }) : t("chatInput.uploadsWaiting", { count: uploadingCount }))
: isRecording || isPaused || isReviewing ? t("chatInput.sendDictation") : t("chatInput.send")}
style={{
Expand All @@ -3998,22 +4005,22 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
border: "none",
borderRadius: 8,
color: (isRecording || isPaused || isReviewing || isTranscribing || value.trim() || hasAttachments) ? "var(--on-accent)" : "var(--text-dim)",
cursor: submissionBlocked || uploadsBlockSend ? "not-allowed" : isTranscribing ? "wait" : (isRecording || isPaused || isReviewing || value.trim() || hasAttachments) ? "pointer" : "not-allowed",
cursor: submissionBlocked || (!btwMode && uploadsBlockSend) ? "not-allowed" : isTranscribing ? "wait" : (isRecording || isPaused || isReviewing || value.trim() || hasAttachments) ? "pointer" : "not-allowed",
fontSize: 12,
fontWeight: 600,
boxShadow: (isRecording || isPaused || isReviewing || isTranscribing || value.trim() || hasAttachments) ? "var(--shadow-card)" : "none",
transition: "background var(--dur-fast) var(--ease-out-warm), box-shadow var(--dur-fast) var(--ease-out-warm)",
}}
>
{isTranscribing || uploadingCount > 0 ? (
{isTranscribing || (!btwMode && uploadingCount > 0) ? (
<Loader2 size={12} strokeWidth={2} className="animate-spin" aria-hidden="true" />
) : (
<svg width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<line x1="2" y1="7" x2="11" y2="7" />
<polyline points="7.5 3 12 7 7.5 11" />
</svg>
)}
{uploadingCount > 0 ? t("chatInput.uploadsPending", { count: uploadingCount }) : t("chatInput.send")}
{!btwMode && uploadingCount > 0 ? t("chatInput.uploadsPending", { count: uploadingCount }) : t("chatInput.send")}
Comment thread
andrebrait marked this conversation as resolved.
Resolved
Comment thread
andrebrait marked this conversation as resolved.
Resolved
</button>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion graphify-out/graph.json

Large diffs are not rendered by default.

Loading