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
31 changes: 31 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,37 @@ errors surface as failed RPC responses plus `notice` events.
New frame types (`turn_start/end`, `notice`, `todo_reminder`, ...) must be
handled or safely ignored.

### Slash commands are omp's (`lib/web-slash-commands.ts`)
Full behavior and rationale: `docs/specs/2026-10-29-native-slash-commands-and-goal-mode.md`.
- `get_available_commands` is authoritative. Every source it reports —
`builtin`, `extension`, `custom`, `mcp_prompt`, `file`, `skill` — runs
through `prompt`; never expand, hide, or shadow a name the catalog owns. The
palette shows all of them (`toSlashCommandInfo`), with `input.hint` as the
argument hint.
- Client-dispatched names are only the ones omp has no slash equivalent for:
`goal` (native `goal` RPC), `btw`, `reload`, `name`, `copy`. Web prompt
expansions (`plan`, `fix`, `test`, `explain`, `simplify`, `commit`, `loop`)
are used only when omp does not report the same name, so an extension or
skill command always wins. Catalog names and aliases always win over a
client entry, including the client-only names. Client-only commands refuse
attachments and keep the draft. `/compact`, `/session`, `/review`,
`/advisor` are omp commands; the top-bar compact button and context ring
remain the web entry points for those panels.
- `/goal` is native goal mode: `{type:"goal",op:"create",objective}` plus
`goal_updated`/`get_state.goal`; pause/resume/drop send the matching op. No
`sessionStorage` goal state. When idle, `/goal <objective>` also sends the
objective as the first prompt (TUI parity); while a run is active it only
creates the goal. Goal snapshots are sequenced so a slow
`get_state` cannot overwrite a newer `goal_updated` (same idea as the queue).
- TUI-only builtins (`guided-goal`, `vibe`, `budget`, and `/plan`/`/loop` when
absent from the catalog) have no RPC handler. `/plan`'s spec has only
`handleTui`, and `acp-builtins.ts` publishes only specs with a text-mode
`handle`. Hooks cannot call it either: hook `ctx` exposes a read-only
`sessionManager`, and extension `ctx.sessionModes` is undefined in
RPC/ACP. The hook warns once and still delivers the text. The only true
parity paths are an upstream text-mode `handle`/`set_mode` RPC or an embedded
PTY TUI.

### Queued messages are omp-owned
The queue panel renders omp's snapshot only: `get_state.queuedMessages` on
load/reconcile/stream open and live `queue_update` frames. Never track chips
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
### Fixes & Improvements

- **Anthropic stays visible when usage limits are unavailable.** The Provider Usage panel keeps accounts that omp reports without usage data and marks them as unavailable rather than unlimited.
- **Slash-command dispatch keeps the command catalog authoritative without losing drafts or attachments.** Dispatch refreshes even a non-empty roster before choosing between omp and a web command, so a missed catalog update cannot route a pasted, dictated or queued command to the wrong owner. A late catalog snapshot cannot overwrite a newer command update, failed discovery leaves the current roster and draft intact for retry, and typing while the lookup is pending is never cleared by the older command. Web prompt commands are expanded and size-checked once before text, image and uploaded-file attachments are sent, and remain visible in the palette while a run is active.
- **Goal and manual-compaction state stay fenced and synchronized across clients.** Goal mutations now respect a history edit held through a shared host daemon, malformed goal snapshots cannot hide a valid banner, and native `/compact` events update the server's live snapshot and session-list caches as well as the initiating tab.
- **A delayed archive restore cannot overwrite newer archived work.** Restore now pins the compressed source generation it staged and verifies an atomically captured archive entry before moving artifacts. If another server restored, updated and re-archived that session meanwhile, the stale restore is refused and the newer transcript and artifacts remain available. Captured archives remain discoverable by session ID before publication and after an interrupted restore, so held messages are not falsely failed as belonging to a missing session; orphaned restore claims report their manual-recovery path.
- **In-progress archive captures are evidence, not restore targets.** Captures have unique keys and disabled Restore controls, so a capture and a newer archive cannot select the wrong session. Archive discovery rechecks names and source generations after reading to avoid missing a capture during concurrent replacement; a capture encountered while pinning still reports its restore-claim recovery path.
- **Unreadable archive directories no longer look empty.** Access and disk I/O errors retain affected outbox messages instead of proving their session absent. A corrupt or unreadable local archive is reported as one unavailable host in the archive browser, without hiding healthy linked hosts.
Expand Down Expand Up @@ -105,6 +107,8 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **The service installers set up the host daemon too.** `ompweb systemd install`, `ompweb-launchd install` and the Windows tray install now register `ompweb host` as a second unit (`ompweb-host`) next to the web service, restarting it after a 10 s delay so it can wait for the web server to write its host link on first install. `uninstall` and `status` cover both, and the tray menus show the daemon state.
- **Forking a session or editing a message asks first.** The Fork button under a message and the Edit button under your own message now open a confirmation dialog, so a stray tap while scrolling no longer creates a new session or rewinds the current one.
- **Expanded thinking blocks no longer collapse when a step finishes.** With "Expand thinking blocks by default" on, a thinking block opened while streaming, then moved into a closed Process details row as soon as the step committed. Thinking now stays out of the fold while the setting is on.
- **Delayed goal commands preserve newer user intent.** A dictated command no longer clears text or attachments added while its reply is pending, including attachment reads still in progress. A delayed goal-create reply cannot restore a paused, dropped, cleared or replaced goal or start its objective after that newer state arrives.
- **All omp slash commands run natively, including extension and skill commands.** The composer used to hide omp's builtins and expand `/goal`, `/review`, `/advisor`, `/compact`, and `/session` into text prompts. Every command omp reports in `get_available_commands` (builtin, extension, custom, MCP prompt, file, skill) is now shown and sent through omp's own prompt pipeline; web-only prompt expansions (`/plan`, `/fix`, `/test`, `/explain`, `/simplify`, `/commit`, `/loop`) yield to an omp command of the same name. `/goal` now uses omp's native goal RPC (`goal_updated` / `get_state.goal`) with pause, resume and drop controls instead of a `sessionStorage` imitation. TUI-only commands that omp does not expose over RPC still warn and are sent as plain text.
- **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.
- **An update whose worker died is reported as failed.** A running update whose worker process is gone, or whose lease has expired, now becomes a failed attempt the dialog can show and clean up, instead of waiting forever.
- **Upgrade ompweb before its hosts.** The web server links a host daemon one link protocol version older than its own, so a host keeps running sessions until its `ompweb` is updated. After a web restart the server adopts that daemon's live runs, as it does a current daemon's, without resuming them; only a large message from such a host still arrives whole instead of in pieces, which can stall that host's link on a slow connection. A daemon older than that, or newer than the web server, is still asked to upgrade.
Expand Down
6 changes: 0 additions & 6 deletions components/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,6 @@ export function AppShell({ appName }: { appName: string }) {
});
}, [activeTopPanel, systemPrompt, systemPromptLoading, toggleTopPanel]);

// /session opens the same information panel as the top-bar control.
const openSessionStatsPanel = useCallback(() => {
chatInputRef.current?.openContextPanel();
}, []);

const handleSidebarToggle = useCallback(() => {
if (isMobile) {
setActiveTopPanel(null);
Expand Down Expand Up @@ -2596,7 +2591,6 @@ export function AppShell({ appName }: { appName: string }) {
onSystemPromptChange={handleSystemPromptChange}
onSystemPromptLoaderChange={handleSystemPromptLoaderChange}
onSessionStatsChange={handleSessionStatsChange}
onSessionStatsPanelOpen={openSessionStatsPanel}
sessionInfoContainer={sessionInfoContainer}
onGenerationSpeedChange={handleGenerationSpeedChange}
onOpenProviders={() => setSettingsTab("providers")}
Expand Down
97 changes: 97 additions & 0 deletions components/ChatInput-banners.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import "../tests/setup-dom.mjs";
import assert from "node:assert/strict";
import test, { afterEach } from "node:test";
import React from "react";

// Imported after the jsdom globals exist: Testing Library binds its queries at
// module evaluation, and a static import can run before `setup-dom.mjs`.
const { act, cleanup, fireEvent, render, screen } = await import("@testing-library/react/pure.js");

const { ComposerModeStatus } = await import("./ChatInput-banners.tsx");

const goal = (overrides = {}) => ({
id: "g1",
objective: "ship the export",
status: "active",
tokensUsed: 1234,
timeUsedSeconds: 90,
createdAt: 1000,
updatedAt: Date.now(),
...overrides,
});
const state = (value) => ({ enabled: value.status === "active", mode: "active", goal: value });
const flush = () => act(async () => { await Promise.resolve(); });

afterEach(async () => {
cleanup();
await flush();
});

test("an active goal shows its status, objective, tokens and pause/drop actions", async () => {
const actions = [];
render(React.createElement(ComposerModeStatus, {
goal: state(goal()),
onGoalAction: (op) => actions.push(op),
}));

assert.match(screen.getByText(/ship the export/).textContent, /ship the export/);
assert.match(screen.getByText(/Goal active/).textContent, /1m/);
fireEvent.click(screen.getByRole("button", { name: /ship the export/ }));

assert.match(screen.getByText(/1,234 tokens/).textContent, /1,234 tokens/);
fireEvent.click(screen.getByRole("button", { name: /^Pause$/ }));
await flush();
fireEvent.click(screen.getByRole("button", { name: /^Drop$/ }));
await flush();
assert.deepEqual(actions, ["pause", "drop"]);
});

test("goal controls stay disabled until a pending action settles", async () => {
const actions = [];
let release;
render(React.createElement(ComposerModeStatus, {
goal: state(goal()),
onGoalAction: (op) => {
actions.push(op);
return new Promise((resolve) => { release = resolve; });
},
}));

fireEvent.click(screen.getByRole("button", { name: /ship the export/ }));
fireEvent.click(screen.getByRole("button", { name: /^Pause$/ }));
const pause = screen.getByRole("button", { name: /^Pause$/ });
const drop = screen.getByRole("button", { name: /^Drop$/ });
assert.equal(pause.disabled, true);
assert.equal(drop.disabled, true);

fireEvent.click(drop);
assert.deepEqual(actions, ["pause"]);

await act(async () => {
release();
await Promise.resolve();
});
assert.equal(pause.disabled, false);
assert.equal(drop.disabled, false);
});

test("a paused goal offers resume, and a finished goal offers no actions", async () => {
const actions = [];
const view = render(React.createElement(ComposerModeStatus, {
goal: state(goal({ status: "paused" })),
onGoalAction: (op) => actions.push(op),
}));
assert.match(screen.getByText(/Goal paused/).textContent, /Goal paused/);
fireEvent.click(screen.getByRole("button", { name: /ship the export/ }));
fireEvent.click(screen.getByRole("button", { name: /^Resume$/ }));
await flush();
assert.deepEqual(actions, ["resume"]);

view.rerender(React.createElement(ComposerModeStatus, {
goal: state(goal({ status: "completed" })),
onGoalAction: (op) => actions.push(op),
}));
fireEvent.click(screen.getByRole("button", { name: /ship the export/ }));
assert.match(screen.getByText(/Goal completed/).textContent, /Goal completed/);
assert.equal(screen.queryByRole("button", { name: /^(Pause|Resume|Drop)$/ }), null);
});
Loading