Skip to content
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Never fold tool activity.** A new setting renders every turn flat, with no Process details rows at all. Long turns are paged, and jumping to a search match reveals its message even outside the current page.
- **Show hidden items in the Explorer.** A switch in the file panel's toolbar lists the folders the tree normally hides — `build/`, `dist/`, `node_modules/`, `target/` and the rest — so you can browse into them and open a file from there. It changes only the file tree; search and @-mentions keep ignoring those paths. It is off by default, and your choice is remembered.
- **Connection diagnostics.** Turn on **Settings → Interface & Behavior → Show connection diagnostics** to get a **Connection** tab in the right panel, on desktop and mobile. It shows the transport actually in use (WebSocket or server-sent events, including fallback), connection status, reconnects, and latency statistics over the last 30 minutes: mean, p50, p95, p99.9 and max. Successful commands and sampled live events are grouped by transport. One-way times are clock-corrected estimates; web app ↔ omp includes processing, with `get_state` shown separately as a delivery proxy. p99.9 needs at least 1,000 samples.
- **A message queued or steered during a run shows "Sending…" until it arrives.** It stays above the composer with a spinner until omp has taken it into its queue (then the queue chip replaces it) or refused it (then it goes back into the composer as before), instead of vanishing until an offline host refuses it seconds later. Pending indicators and refused-send recovery follow confirmed session-ID moves, including after navigating away and remounting the original composer; ordinary navigation remains isolated.
- **Updates belong to each host.** Settings → Hosts now shows the ompweb daemon and OMP runtime versions, available updates, and update actions for every machine, including This machine. Checks and installations run on that host. An incompatible or unverifiable daemon update stays visible but blocked, with a reason to update the web server first; OMP updates are independent of the link protocol. A daemon update is refused while session processes or subagents run on that host (close them, then start it again), and the host refuses new sessions while it installs. The host update retains a backup and reports progress after reconnect. **System & Updates** is now **System**, containing only the web server's controls; it no longer updates or restarts a host's OMP sessions globally.

### Fixes & Improvements
Expand Down
81 changes: 81 additions & 0 deletions components/ChatInput.queue-attachments.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,94 @@ test("a refused follow-up goes back whole to its draft, ahead of what was typed
const calls = await renderRunningWithAttachments({ queued: new Promise((resolve) => { refuse = () => resolve(false); }) });
fireEvent.click(screen.getByRole("button", { name: /queue/i }));
await waitFor(() => assert.equal(calls.length, 1));
assert.equal(screen.getByRole("status").textContent, "Sending…", "the in-flight message shows until omp answers");
fireEvent.change(screen.getByRole("textbox"), { target: { value: "typed meanwhile" } });
await act(async () => { refuse(); });
await waitFor(() => assert.equal(screen.queryByRole("status"), null, "the sending row goes once omp answered"));
await waitFor(() => assert.deepEqual(getDraft(KEY)?.images, [{ data: PNG, mimeType: "image/png" }]));
assert.equal(getDraft(KEY)?.value, `${calls[0].message}\n\ntyped meanwhile`, "the text, file contents included, comes back too");
assert.equal(screen.getByRole("textbox").value, `${calls[0].message}\n\ntyped meanwhile`);
});

test("a queued message shows Sending… only in its own chat, across the remount a chat switch causes, until omp takes it", async () => {
let accept;
const { calls, rerender } = await renderWithAttachments({ queued: new Promise((resolve) => { accept = () => resolve(true); }) });
fireEvent.click(screen.getByRole("button", { name: /queue/i }));
await waitFor(() => assert.equal(calls.length, 1));
assert.equal(screen.getByRole("status").textContent, "Sending…");
rerender({ draftKey: "another-chat" });
assert.equal(screen.queryByRole("status"), null, "another chat's composer does not show it");
// AppShell remounts ChatWindow on every chat switch: a fresh composer must still see the send.
cleanup();
const props = { draftKey: KEY, isStreaming: true, onSend: async () => ({ status: "accepted" }), onAbort() {}, onFollowUp: async () => true };
const remounted = render(React.createElement(ChatInput, props));
assert.equal(screen.getByRole("status").textContent, "Sending…", "back in its chat while still in flight");
await act(async () => { accept(); });
await waitFor(() => assert.equal(screen.queryByRole("status"), null, "omp's queue chip takes over"));
remounted.rerender(React.createElement(ChatInput, { ...props, queuedMessages: { followUp: [calls[0].message], steering: [] } }));
assert.match(screen.getByLabelText("Queued prompts").textContent, /notes\.txt/, "omp's accepted attachment is rendered in the queue");
assert.equal(getDraft(KEY), null, "nothing goes back into the composer");
});

test("pending queued sends follow a confirmed session move and recover a refusal into its new draft", async (t) => {
let refuse;
const targetKey = `${KEY}-moved`;
t.after(() => clearDraft(targetKey));
const { calls, ref, rerender } = await renderWithAttachments({
queued: new Promise((resolve) => { refuse = () => resolve(false); }),
});
fireEvent.click(screen.getByRole("button", { name: /queue/i }));
await waitFor(() => assert.equal(calls.length, 1));
assert.equal(screen.getByRole("status").textContent, "Sending…");
try {
await act(async () => {
ref.current.retargetPendingRecovery(KEY, targetKey);
rerender({ draftKey: targetKey, draftIdentityMove: { from: KEY, to: targetKey } });
});
assert.equal(screen.getByRole("status").textContent, "Sending…", "the pending row belongs to the confirmed conversation");
} finally {
await act(async () => { refuse(); });
}
await waitFor(() => assert.equal(screen.queryByRole("status"), null, "the original reply still clears the moved row"));
assert.equal(getDraft(targetKey)?.value, calls[0].message, "a refusal follows the confirmed conversation too");
assert.deepEqual(getDraft(targetKey)?.images, [{ data: PNG, mimeType: "image/png" }]);
assert.equal(screen.getByRole("textbox").value, calls[0].message);
assert.equal(getDraft(KEY), null, "the old draft is not recreated");
});

test("a refusal after remount and confirmed identity move recovers into the moved conversation", async (t) => {
const targetKey = `${KEY}-remounted-moved`;
t.after(() => clearDraft(targetKey));
let refuse;
const { calls } = await renderWithAttachments({
queued: new Promise((resolve) => { refuse = () => resolve(false); }),
});
fireEvent.click(screen.getByRole("button", { name: /queue/i }));
await waitFor(() => assert.equal(calls.length, 1));
cleanup();
const props = { isStreaming: true, onSend: async () => ({ status: "accepted" }), onAbort() {}, onFollowUp: async () => true };
render(React.createElement(ChatInput, { ...props, draftKey: "unrelated-chat" }));
assert.equal(screen.queryByRole("status"), null);
cleanup();
const ref = React.createRef();
const remounted = render(React.createElement(ChatInput, { ...props, ref, draftKey: KEY }));
assert.equal(screen.getByRole("status").textContent, "Sending…");
try {
await act(() => {
ref.current.retargetPendingRecovery(KEY, targetKey);
remounted.rerender(React.createElement(ChatInput, { ...props, ref, draftKey: targetKey, draftIdentityMove: { from: KEY, to: targetKey } }));
});
assert.equal(screen.getByRole("status").textContent, "Sending…");
} finally {
await act(async () => { refuse(); });
}
await waitFor(() => assert.equal(screen.queryByRole("status"), null));
assert.equal(getDraft(KEY), null, "the original mount's callback cannot recreate the obsolete key");
assert.equal(getDraft(targetKey)?.value, calls[0].message);
assert.deepEqual(getDraft(targetKey)?.images, [{ data: PNG, mimeType: "image/png" }]);
assert.equal(screen.getByRole("textbox").value, calls[0].message);
});

for (const { label, fill, oversized } of [
{ label: "sendable composed request", fill: "x", oversized: false },
{ label: "oversized composed request", fill: '"', oversized: true },
Expand Down
49 changes: 34 additions & 15 deletions components/ChatInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import React, { useRef, useState, useCallback, useEffect, useLayoutEffect, useImperativeHandle, forwardRef, memo, KeyboardEvent } from "react";
import React, { useRef, useState, useCallback, useEffect, useLayoutEffect, useImperativeHandle, useSyncExternalStore, forwardRef, memo, KeyboardEvent } from "react";
import { createPortal } from "react-dom";
import { ChevronDown, ClipboardPaste, CornerDownRight, ListChecks, Loader2, Mic, Paperclip, Plus, RotateCw, Shrink, Snail, Sparkles, Wrench, X, Zap } from "lucide-react";
import { getSubmitDuringRunBehavior, isWordCompletionEnabled } from "@/lib/composer-prefs";
Expand All @@ -16,6 +16,7 @@ import { formatCompactNumber, formatPercent } from "@/lib/format";
import { ContextDetailPanel } from "./ComposerPanels";
import { RecordingDeck } from "./RecordingDeck";
import { clearDraft, getDraft, mergeRecoveredText, recoverDraft, setDraft, subscribeDraftRecovery, type ChatDraft, type ChatDraftImage } from "@/lib/draft-store";
import { getPendingSends, retargetPendingSends, subscribePendingSends, trackPendingSend } from "@/lib/pending-sends";
import { expandWebSlashCommand } from "@/lib/web-slash-commands";
import type { AttachedImage, AttachedTextFile } from "./ChatInput-draft-attachments";
import {
Expand Down Expand Up @@ -275,7 +276,7 @@ export interface ChatInputHandle {
prependText: (text: string) => void;
addFiles: (files: File[]) => void;
openContextPanel: () => void;
/** Retarget captured queue recoveries before a confirmed move can render. */
/** Retarget pending sends and captured queue recoveries before a confirmed move can render. */
retargetPendingRecovery: (from: string, to: string) => void;
}
const COMPOSITION_END_ENTER_GRACE_MS = 100;
Expand Down Expand Up @@ -499,7 +500,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
const fileIndexFetchingRef = useRef<string | null>(null);
const draftKeyRef = useRef(draftKey);
const consumedIdentityMoveRef = useRef<typeof draftIdentityMove>(undefined);
// Pending queue edits retain this identity across confirmed moves only.
// Pending queue recoveries retain this identity across confirmed moves only.
// Navigation starts a new identity, even when a draft key is later reused.
const draftRecoveryIdentityRef = useRef({ key: draftKey });
const persistedDraftRef = useRef<ChatDraft | null>(null);
Expand Down Expand Up @@ -599,6 +600,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
retargetPendingRecovery(from, to) {
const identity = draftRecoveryIdentityRef.current;
if (identity.key === from) identity.key = to;
retargetPendingSends(from, to);
},
}));

Expand Down Expand Up @@ -1601,6 +1603,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
el.style.height = `${Math.min(el.scrollHeight, 200)}px`;
});
}, [slashMatch, value]);
const sendingQueued = useSyncExternalStore(subscribePendingSends, getPendingSends, getPendingSends);

const sendQueued = useCallback((mode: "steer" | "followup", overrideText?: string) => {
if (submissionBlockedRef.current) return;
Expand All @@ -1618,12 +1621,15 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
// The queue callbacks resolve false when omp refused the message: it goes
// back, text and attachments together, to the draft it was sent from, even
// if the user has typed or switched sessions since.
const key = draftKeyRef.current;
const recoveryIdentity = draftRecoveryIdentityRef.current;
const kept = { images: images?.map(imageToDraftImage), ...uploadRecovery(attachedUploadsRef.current) };
const recoverOnFailure = (queued: Promise<boolean>, text: string) => {
void Promise.resolve(queued).then((ok) => {
if (ok === false && key) recoverDraft(key, { text, ...kept });
// Until omp answers, the message shows as "Sending…" above the composer:
// it is neither in the composer nor in omp's queue yet.
const trackSend = (queued: Promise<boolean>, text: string) => {
const reply = Promise.resolve(queued).then((ok) => {
if (ok === false && recoveryIdentity.key) recoverDraft(recoveryIdentity.key, { text, ...kept });
});
trackPendingSend(recoveryIdentity, text, reply);
};
const files = attachedTextFilesRef.current;
onAudioUnlock?.();
Expand All @@ -1644,7 +1650,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
if (expansion.kind === "expand") {
const prompt = composeMessageWithTextAttachments(expansion.prompt, files);
if (rejectsOversizedPrompt(prompt, attachedImagesRef.current)) return;
recoverOnFailure(onPromptWithStreamingBehavior(prompt, streamingBehavior, images, ...uploads), prompt);
trackSend(onPromptWithStreamingBehavior(prompt, streamingBehavior, images, ...uploads), prompt);
clearInput();
return;
}
Expand All @@ -1657,16 +1663,16 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
}
const prompt = composeMessageWithTextAttachments(msg, files);
if (rejectsOversizedPrompt(prompt, attachedImagesRef.current)) return;
recoverOnFailure(onPromptWithStreamingBehavior(prompt, streamingBehavior, images, ...uploads), prompt);
trackSend(onPromptWithStreamingBehavior(prompt, streamingBehavior, images, ...uploads), prompt);
clearInput();
return;
}
const composedMessage = composeMessageWithTextAttachments(msg, files);
if (rejectsOversizedPrompt(composedMessage, attachedImagesRef.current)) return;
if (mode === "steer" && onSteer) {
recoverOnFailure(onSteer(composedMessage, images, ...uploads), composedMessage);
trackSend(onSteer(composedMessage, images, ...uploads), composedMessage);
} else if (mode === "followup" && onFollowUp) {
recoverOnFailure(onFollowUp(composedMessage, images, ...uploads), composedMessage);
trackSend(onFollowUp(composedMessage, images, ...uploads), composedMessage);
}
clearInput();
}, [value, handleSend, onPromptWithStreamingBehavior, onSteer, onFollowUp, clearInput, onAudioUnlock, t, advisorEnabled, rejectsOversizedPrompt, rejectsPendingUploads, sendSideQuestion]);
Expand Down Expand Up @@ -1697,6 +1703,8 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
];
const firstQueued = queuedEntries[0] ?? null;
const queuedCount = queuedEntries.length;
const sendingEntries = sendingQueued.filter((entry) => entry.key === draftKey);
const queueBarShown = queuedCount > 0 || sendingEntries.length > 0;

const [queueExpanded, setQueueExpanded] = useState(false);
const [queueActionPending, setQueueActionPending] = useState(false);
Expand Down Expand Up @@ -2773,7 +2781,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
})()}
{/* Queued prompts panel / bar — attached to composer's top edge.
When 1 item: compact single row. When multiple items: compact row with expand toggle, or full list when expanded. */}
{queuedCount > 0 && (
{queueBarShown && (
<div
aria-label={t("chatInput.queuedPrompts")}
style={{
Expand All @@ -2784,7 +2792,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
overflow: "hidden",
}}
>
{queuedCount === 1 ? (
{queuedCount === 0 ? null : queuedCount === 1 ? (
<div style={{
padding: "5px 8px 5px 12px",
display: "flex",
Expand Down Expand Up @@ -2975,6 +2983,17 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
)}
</div>
)}
{sendingEntries.length > 0 && <div style={{ maxHeight: 120, overflowY: "auto" }}>{sendingEntries.map((entry) => (
<div key={entry.id} style={{ padding: "5px 8px 5px 12px", display: "flex", alignItems: "center", gap: 8, minWidth: 0 }}>
<Loader2 size={12} strokeWidth={2} aria-hidden="true" style={{ flexShrink: 0, color: "var(--text-muted)", animation: "spin 0.8s linear infinite" }} />
<span role="status" style={{ flexShrink: 0, fontSize: 10, fontWeight: 600, letterSpacing: "0.06em", textTransform: "uppercase", color: "var(--text-muted)" }}>
{t("chatInput.queuedSending")}
</span>
<span title={entry.text} style={{ flex: 1, minWidth: 0, fontSize: 12, color: "var(--text-muted)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{entry.text}
</span>
</div>
))}</div>}
</div>
)}
{/* Live agent status bar — attached to composer's top edge */}
Expand All @@ -2985,7 +3004,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
style={{
border: `1px solid ${bashMode ? "var(--tool-bg)" : "color-mix(in srgb, var(--border) 70%, transparent)"}`,
borderBottom: "none",
borderRadius: queuedCount > 0 ? 0 : "var(--radius-card) var(--radius-card) 0 0",
borderRadius: queueBarShown ? 0 : "var(--radius-card) var(--radius-card) 0 0",
background: "var(--bg-panel)",
padding: "6px 14px",
display: "flex",
Expand All @@ -3009,7 +3028,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
flexDirection: "column",
background: "var(--bg)",
border: `1px solid ${bashMode ? "var(--tool-bg)" : "color-mix(in srgb, var(--border) 70%, transparent)"}`,
borderRadius: (queuedCount > 0 || Boolean(statusText)) ? "0 0 var(--radius-card) var(--radius-card)" : "var(--radius-card)",
borderRadius: (queueBarShown || Boolean(statusText)) ? "0 0 var(--radius-card) var(--radius-card)" : "var(--radius-card)",
padding: "12px 12px 10px",
boxShadow: "var(--shadow-card)",
} as React.CSSProperties}
Expand Down
2 changes: 1 addition & 1 deletion graphify-out/graph.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@
"chatInput.queuedEdit": "Edit",
"chatInput.queuedEditTitle": "Edit this queued message",
"chatInput.queuedFollowUp": "Queued follow-up",
"chatInput.queuedSending": "Sending…",
"chatInput.queuedSteer": "Queued steer",
"chatInput.queuedSteerAction": "Steer",
"chatInput.queuedSteerTitle": "Deliver this message as a steer",
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@
"chatInput.queuedEdit": "編集",
"chatInput.queuedEditTitle": "このキューされたメッセージを編集",
"chatInput.queuedFollowUp": "キューされたフォローアップ",
"chatInput.queuedSending": "送信中…",
"chatInput.queuedSteer": "キューされたステア",
"chatInput.queuedSteerAction": "ステア",
"chatInput.queuedSteerTitle": "このメッセージをステアとして送信",
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@
"chatInput.queuedEdit": "编辑",
"chatInput.queuedEditTitle": "编辑这条已排队消息",
"chatInput.queuedFollowUp": "已排队的后续消息",
"chatInput.queuedSending": "发送中…",
"chatInput.queuedSteer": "已排队的引导消息",
"chatInput.queuedSteerAction": "引导",
"chatInput.queuedSteerTitle": "将此消息作为引导发送",
Expand Down
Loading
Loading