Skip to content
Open
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
41 changes: 41 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ lib/
notification-store.ts server: SQLite store for VAPID keys, devices and the notification history
notification-history.ts browser: mirror of the server's notification history (Notifications tab)
notification-client.ts browser: device id, prefs store, service worker + push subscription
queue-progress.ts pure ledger of queued prompts (queued/running/done/failed/cancelled) fed by omp frames
rpc-manager.ts session registry + startRpcSession over RpcProcess
session-reader.ts session .jsonl parsing + path cache + buildSessionContext
session-search.ts shared fuzzy/phrase query scorer for sidebar search (title weights ≫ transcript)
Expand All @@ -146,6 +147,7 @@ components/
ChatWindow.tsx chat composition + completion sound wrapper
ChatInput.tsx input bar + model/thinking/tools/compact controls
ComposerPanels.tsx composer-attached /btw + todo + subagent panels (collapsible, live states)
QueueProgressPanel.tsx composer queue panel: ledger batch, "N of M done", per-item status/actions, dismissible summary
BtwPanel.tsx /btw side-question panel (stream, cancel, copy, follow-up) + history dialog
TodoList.tsx todo phase grid with preview/show-all (used by ComposerPanels)
SubagentTranscriptDialog.tsx task + final output summary dialog (wide, screen-adaptive)
Expand Down Expand Up @@ -366,6 +368,45 @@ during the wait.
reason:"shellRunning"}`), which the hook surfaces as a notice while rolling
the phantom optimistic turn back. The chip still comes from omp's snapshot.

### Queued-prompt progress (`lib/queue-progress.ts`, `components/QueueProgressPanel.tsx`)
- omp's snapshots only list what is still waiting, so `AgentSessionWrapper`
keeps a per-process ledger (`queueProgress`) and feeds it frames omp already
sends: `queue_update` (and `get_state.queuedMessages`) → queued; an item that
leaves the snapshot and then arrives as a user `message_start` → running;
a later follow-up delivery in a new `turn_start` finishes earlier items
(follow-ups start only when the agent would stop; a steer joins the running
turn and finishes nothing); a terminal `agent_end` → done, or failed when its
last assistant message stopped with `error`/`aborted` (a failed prompt
`response` too); `remove_queued_message` `removed: true` and
`abort_and_restore_queue` → cancelled. A confirmed removal also overrides a
status the ledger only inferred (started alongside a later delivery, or
settled by the run's end) when the reply is handled after those frames. An
abort settles only entries that existed when it was sent (`boundary()`).
Verified frame order (omp 18.12.6): every follow-up of one prompt runs in
ONE agent run (no `agent_end` between them), and the `queue_update` that
drops an item precedes its user message.
- Items are matched by text and order. Snapshot diffs use an LCS that marks
the EARLIEST duplicate as the one that left (omp delivers from the front and
removes the first match); a departed item whose text never shows up (slash
command or template rewrite) takes the run's outcome at the end of the run,
or cancelled when the run was aborted. A plain `abort` keeps omp's pending
queue, so those items stay queued.
- Exposure: `get_state.queueProgress` (`{ epoch, revision, items }`) and a
`queue_progress` frame after every change, so every tab shows the same list.
The hook applies a snapshot only when its revision is newer within the same
epoch; an HTTP snapshot with another epoch (or none, which clears it when the
session has no live process) is dropped if a `queue_progress` frame arrived
while it was in flight. The panel merges the ledger with omp's snapshot
(`buildQueuePanelItems`): only items omp still holds get Edit/Delete/Steer,
and of identical ones only the first (omp acts on the first match); a
departed item (`departed: true`, taken but not yet in the transcript) claims
no chip. A new batch starts once nothing is pending;
Dismiss sends omp-web's own `dismiss_queue_progress` (never reaches omp,
never spawns it). The ledger is in memory only: it starts empty when omp is
respawned (`reload`, crash) or omp-web restarts, and resets when the wrapper
switches to another conversation. There is no scroll-to-message helper, so
rows do not jump to the transcript.

### Live event stream: one socket per browser (`/api/events`)
- Browsers cap HTTP/1.1 at **6 connections per host across all tabs**, and an
SSE response pins one for its lifetime. Per-stream SSE (sidebar + host
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f

## [Unreleased]

### Added

- **Queued prompts show their progress.** The composer's queue panel now keeps every prompt of the current batch after omp takes it: a "1 of 3 done" header, a check and duration for finished prompts, a spinner for the one running now, pending prompts (still editable), and failed or cancelled ones. Of several identical pending prompts only the first offers Edit, Delete and Steer, because omp acts on the first match. Once all have finished it folds into a summary you can dismiss; queueing a new batch clears it too. omp-web derives the status from omp's queue snapshots and transcript events, so every tab and device on the session sees the same list. The record lives in omp-web's memory and starts empty after omp or omp-web restarts.

### Fixes & Improvements

- **In-app updates work when ompweb runs as a systemd service.** The update worker ran inside the service's cgroup, so stopping the server killed the worker too: nothing was installed, the service could stay down (`Restart=on-failure` does not restart a clean SIGTERM exit), and every page load reopened the update dialog at "Stop ompweb-managed sessions". The worker now runs in its own transient scope (`systemd-run --scope`) and stops, updates and starts the unit through `systemctl`, starting it again if the install fails.
Expand Down
10 changes: 6 additions & 4 deletions app/api/agent/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import { parseJsonWithinLimit, RequestBodyTooLargeError } from "@/lib/bounded-fo
import { MAX_AGENT_COMMAND_REQUEST_BYTES } from "@/lib/image-attachments";

// Commands that ride whatever child is alive and never spawn or replace one:
// keystroke predictions, and the side-question reads/cancel omp-web sends in
// the background (SSE connect, reconcile). Without a live process there is no
// ghost text, no running side question and nothing to cancel, so the reply is
// known without omp. Asking (`btw`) and opening the history start omp first.
// keystroke predictions, the side-question reads/cancel omp-web sends in
// the background (SSE connect, reconcile), and dismissing the queue-progress
// summary. Without a live process there is no ghost text, no running side
// question, nothing to cancel and no queue ledger, so the reply is known
// without omp. Asking (`btw`) and opening the history start omp first.
const NO_SPAWN_REPLIES: Record<string, unknown> = {
predict_word: { suffix: null },
predict_word_feedback: null,
get_btw_history: { records: [] },
btw_cancel: { cancelled: false },
dismiss_queue_progress: null,
};

// Live diagnostics of a skill-resolving omp. A saved or exited session has none,
Expand Down
31 changes: 28 additions & 3 deletions components/ChatInput.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ test("keeps editing and deletion but hides Steer for a single queued steer", ()
assert.doesNotMatch(html, />(Steer|chatInput\.queuedSteerAction)</);
});

test("renders multiple queued prompts with count and expand action", () => {
test("renders multiple queued prompts with progress count and expand action", () => {
const html = renderToStaticMarkup(
React.createElement(ChatInput, {
async onSend() { return { status: "accepted" }; },
Expand All @@ -292,9 +292,34 @@ test("renders multiple queued prompts with count and expand action", () => {
}),
);

assert.match(html, /\(3\)/);
assert.match(html, />(0 of 3 done|chatInput\.queueProgress)</);
assert.match(html, />(Show all queued prompts|Show all|chatInput\.expandQueued)</);
assert.match(html, /First task/);
// omp drains steering before follow-ups, so the steer is next.
assert.match(html, /Priority steer/);
});

test("the queue panel lists the server ledger's batch: done, running and pending", () => {
const html = renderToStaticMarkup(
React.createElement(ChatInput, {
async onSend() { return { status: "accepted" }; },
onAbort() {},
isStreaming: true,
queuedMessages: { followUp: ["reply four"], steering: [] },
queueProgress: {
epoch: "e",
revision: 3,
items: [
{ id: "1", text: "reply two", queue: "followUp", status: "done", queuedAt: 1, startedAt: 2, finishedAt: 3 },
{ id: "2", text: "reply three", queue: "followUp", status: "running", queuedAt: 1, startedAt: 3 },
{ id: "3", text: "reply four", queue: "followUp", status: "queued", queuedAt: 1 },
],
},
}),
);

assert.match(html, />(1 of 3 done|chatInput\.queueProgress)</);
assert.match(html, /reply three/, "the collapsed header previews the running item");
assert.match(html, /animate-spin/);
});


Expand Down
Loading
Loading