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
18 changes: 11 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ lib/
pending-requests.ts daemon side: `PendingRequests`, a channel's still-open blocking requests and current session id for the hello
registry.ts `<agent dir>/omp-web/hosts.json`: create/update/revoke, token hashing and lookup; the `local` record (`rotateLocalHostToken`, `customLocalLabel`)
session-index.ts sessions and projects across hosts, cached per host; `hostForSessionId`, `sessionSpawnTarget`, `invalidateLocalSessionLists`
update-types.ts shared per-host software status and operation contract
updates.ts daemon-side version checks, compatibility gate and durable update state
update-worker.ts host-only install/restart helper; never starts or stops the web-server service
provider-accounts.ts distinct omp accounts per provider from `omp usage` reports (Models → provider detail)
agent-client.ts agent commands from the tab: POST /api/agent/[id], or the worker's browser link in the `ws` transport; records each command's `action` sample
agent-command.ts `runAgentCommand`: the one command path behind POST /api/agent/[id] and a browser link's `cmd`
Expand Down Expand Up @@ -217,6 +220,7 @@ components/
ModelsConfig.tsx modal for models/auth configuration
McpConfig.tsx project MCP server editor (Settings → MCP tab)
HostsConfig.tsx linked hosts: add (token shown once), rename, revoke, allowAgentStart (Settings → Hosts tab)
HostUpdates.tsx per-host ompweb/OMP versions, update checks, blocked reasons and update actions
LocalDaemonBanner.tsx production-only hint with the install command while no local daemon has linked (90 s grace)
host-status.ts host name, status text and dot colour shared by Settings → Hosts and the sidebar
PluginsConfig.tsx modal for installed plugins
Expand Down Expand Up @@ -281,7 +285,7 @@ The table is static imports, not a runtime glob, so `bun build --compile` (`scri
- `OMP_WEB_PACKAGE_DIR` (set by the launcher) is the root for `dist/`, `public/` and KaTeX; `process.cwd()` is the fallback for dev and tests. The compiled binary sets it to its own directory (unless set) before any server module loads, so every runtime file must come from that root: a module's `import.meta.url` in the binary is Bun's virtual `/$bunfs/`, which no other process can read. A new file the server or daemon reads at runtime also goes into `scripts/build-binary.ts`'s copy list.
- The binary needs `process.env.NODE_ENV` defined as `"production"` at build time (`scripts/build-binary.ts`): a plain `bun build --compile` inlines `"development"`, and the server then never writes the daemon's link. `npm run smoke -- --binary` catches that (no session lists).
- `Bun.serve` turns on `SO_REUSEPORT` when `development` is false, so a second omp-web would share the port instead of failing; `startServer` passes `reusePort: false`, and `startProduction` (`server/app.ts`) reports an `EADDRINUSE` in one line.
- The in-app update worker runs on Node (`OMP_WEB_NODE_BIN`, the launcher's `process.execPath`), not Bun. The compiled binary has no in-app update: `Bun.isStandaloneExecutable` turns it off (`lib/self-update.ts`) and `/api/app-update` names the release page (`installMethod: "binary"`).
- The web-server in-app update worker runs on Node (`OMP_WEB_NODE_BIN`, the launcher's `process.execPath`), not Bun. The compiled web server updates by download (`lib/self-update.ts`). Host-daemon updates use their own helper in `lib/hosts/update-worker.ts`, including for binary hosts; never reuse the web-server worker to restart a host.
- Bun's `fs.watch` drops an event that follows the previous one within ~2 ms, so the file channel (`openFileChannel`, `lib/event-stream-hub.ts`) re-stats the file ~50 ms after every event.
- `bun:sqlite` `.get()` returns `null` for no row (not `undefined`).
- `bun:sqlite` `close()` keeps the database file open while prepared statements are alive (until GC), so Windows cannot remove or replace it: the stores close with `close(true)`, which finalizes them (`closeNotificationStore`, `closeUsageDatabase`).
Expand Down Expand Up @@ -1110,12 +1114,12 @@ during the wait.
- Only user-owned skills are togglable: `getSkillToggleRoots()` (allowed file roots — workspaces the user opened — plus replica scan roots) is the single allowlist for both PATCH and the `togglable` flag GET returns; it is `main`'s pre-CLI allowlist, unchanged. Skills omp lists from anywhere else (the plugin cache, registry installs, custom directories outside a workspace) render a disabled toggle — their files belong to an installer and an update would discard the edit. Never widen PATCH to whatever omp lists.
- `/api/skills/install` shells through `npx skills add ... --agent universal`, which installs into the ecosystem-standard `.agents/skills` dirs omp reads; project installs run with the selected cwd.

### Update notifications (`/api/omp-update`, `/api/app-update`)
- Automatic in-app self-updating has been removed in favor of explicit user notifications and manual terminal commands.
- `GET /api/app-update` queries the npm registry for `@kahme247/ompweb` updates, detects the install (`installMethod`: `bun` vs `npm` via `detectInstallMethod`, `binary` for the compiled release), and returns `updateAvailable` plus the exact terminal command (e.g. `npm install -g @kahme247/ompweb` or `bun add -g @kahme247/ompweb`; for `binary`, the release page, which Settings shows under a download message).
- `POST /api/omp-update` (`action: "check"`) runs `omp update --check` and returns `updateAvailable` plus `updateCommand: "omp update"`.
- `POST /api/omp-update` (`action: "restart"`) restarts active OMP sessions after a manual CLI update.
- Notifications in `AppShell` and settings cards in `SettingsConfig` present the update notification alongside copyable terminal update commands.
### Updates: web server versus host software
- **Settings → System** owns the web server's settings and application update. `GET /api/app-update` and its prepare/commit flow remain web-server-only; a compiled web server still links to the release download page.
- **Settings → Hosts** owns each machine's ompweb daemon and OMP runtime, including **This machine**. `GET /api/hosts/[id]/updates` checks on that daemon; `POST {target, version}` starts its update. Offline and older daemons return explicit failures, never fall back to checking or updating the web server.
- The hub supplies its supported protocol range to `checkUpdates`/`updateSoftware` host ops. Both the hub and the daemon reject an unknown or incompatible candidate protocol before installing ompweb. The update stays visible with a blocked reason. OMP runtime updates do not change the link protocol.
- A daemon update is refused while it owns session processes (subagents included); the daemon also refuses new spawns while an update is running. Check completion through the durable operation state after reconnect, not the POST's acceptance alone. An OMP update leaves already-running sessions on their loaded runtime.
- `/api/omp-update` remains an explicit server-side maintenance API for existing callers. The settings UI and AppShell no longer use it as a global update control or send a server-wide session restart after a host update.

### Auth and model config
- Auth flows go through RPC commands (`get_login_providers`, `login`, `get_logout_accounts`, `logout`) against the omp child process; credentials live in omp's `agent.db` (SQLite) which omp-web never touches directly. `/api/auth/accounts/[provider]` lists stored accounts and removes one by `credentialId`; omp without those commands reports `supported: false` and the UI falls back to the read-only `omp usage` account list.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Session search shows where each session matched.** While searching the sidebar, the arrow beside a session lists its matches one per line, best match first and newest first among equals, ten at a time with **Load more…**. Matches in the messages of the open conversation are highlighted, typos and partial words included (thinking, tool output and math are not searched; link addresses and image descriptions do not count), and clicking a match opens its session, scrolls to it and marks it as the current one, like the browser's find. Closing or clearing the search removes the highlights. Browsers without the CSS Custom Highlight API (before Chrome 105, Safari 17.2 or Firefox 140) still jump to the match but do not paint it.
- **Show tool calls outside Process details.** A new setting keeps each tool call's row in the transcript instead of folding it; whether the row opens still follows "Keep tool calls collapsed".
- **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.
- **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
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Install ompweb as a Windows background service with a system tray icon and autos
ompweb --install-tray
```

Manage it from **Settings → System & Updates → Windows Background Service**, or via CLI:
Manage it from **Settings → System → Windows Background Service**, or via CLI:

```bash
ompweb --tray # Start the tray manager
Expand Down Expand Up @@ -455,6 +455,33 @@ HTTP(S). It dials out, so it can sit behind NAT.
The host shows **online** in Settings → Hosts, the sidebar gets a group for it,
and the new-session screen gets a host picker.

**Settings → Hosts** also shows each machine's ompweb daemon and OMP runtime
versions, available updates and update actions, including **This machine**.
Checks and installations run on the selected host, not on the web server. A host
update whose link protocol is incompatible with the current web app stays visible
but is blocked with a reason; update the web server first. An unverifiable target
protocol is blocked too. OMP updates are independent of the link protocol.
Before updating a daemon, close its session processes: the updater refuses to
interrupt sessions or subagents. Updating OMP leaves existing processes on their
loaded version until they restart. **Settings → System** keeps the web server's
own application update and service settings.
Hosts need a daemon build that supports these update operations; older builds
show an unsupported message and need one manual update first. If the daemon
shares its installation with the web server, update the server first, then use
the host's restart-only update. Unsupported service wrappers and detected restart
scripts show a manual-update reason. Stop external restart loops before updating
a foreground daemon.

A daemon update is carried out by a separate updater process on the host. It
stops the daemon, swaps in the new release and starts it again, and on a failure
it restores the previous release. If that updater is itself killed after stopping
the daemon (a reboot, an out-of-memory kill), nothing restarts the host, which
stays offline. Recover on the host: in the folder containing the installation,
`.ompweb-backup-<id>` is the previous release. If it is there, move the
installation aside and rename the backup back to the installation's name; then
start `ompweb host` (or its service) again. Settings → Hosts reports the update
as interrupted.

`https://` is required. Plain `http://` is accepted only for loopback addresses, or
with `--allow-http` (for example on a tailnet):

Expand Down Expand Up @@ -635,7 +662,7 @@ Stop it with `Stop-ScheduledTask ompweb-host`, then end the running host with
- **macOS launchd Service**: LaunchAgent that starts at login, restarts on crash, and logs under `~/Library/Logs/ompweb`.
- **Linux systemd Service & Tray**: User service that starts at login and restarts on crash, plus a StatusNotifierItem tray icon with service controls (KDE Plasma and compatible desktops).
- **Notifications**: Desktop and mobile (PWA) notifications for finished tasks, questions waiting for an answer, failed runs, and automatic model switches, with Web Push when served over HTTPS. See [Notifications](#notifications).
- **Web-based Settings** (11 tabs): Interface & Behavior, Safety & Approvals, AI Model Defaults, API Keys & Providers, Usage, Agent & Intelligence (advisor, memory, compaction), Agents, Extensions & Tools (MCP, skills, plugins), Hosts, Notifications, System & Updates.
- **Web-based Settings** (11 tabs): Interface & Behavior, Safety & Approvals, AI Model Defaults, API Keys & Providers, Usage, Agent & Intelligence (advisor, memory, compaction), Agents, Extensions & Tools (MCP, skills, plugins), Hosts, Notifications, System.
- **Slash Commands & Shortcuts**: Quick prompts (`/plan`, `/review`, `/fix`, `/test`, etc.), `⌘K` / `Ctrl+K` palette, and model/reasoning cycling.
- **UI Themes & Localization**: Warm paper light/dark themes plus an omp.sh-inspired midnight (`omp`) theme, chat font size & interface scale, with full English, Chinese (简体中文), and Japanese (日本語) translations.

Expand Down
39 changes: 39 additions & 0 deletions app/api/hosts/[id]/updates/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { parseJsonWithinLimit, RequestBodyTooLargeError } from "@/lib/bounded-form-data";
import { getHostSoftwareUpdates, updateHostSoftware } from "@/lib/hosts/hub";
import { HostOpError } from "@/lib/hosts/link-protocol";
import { isApiRequestOriginAllowed, shouldCheckApiRequestOrigin } from "@/lib/request-security";
import { isRecord } from "@/lib/type-guards";

type Context = { params: Promise<{ id: string }> };
const noStore = { "cache-control": "no-store" };
const fail = (error: string, code: string, status: number) => Response.json({ error, code }, { status, headers: noStore });
function errorResponse(error: unknown): Response {
if (error instanceof HostOpError) return fail(error.message, error.code, error.status);
if (error instanceof RequestBodyTooLargeError) return fail(error.message, "body_too_large", 413);
if (error instanceof SyntaxError) return fail("Request body must be valid JSON", "invalid_json", 400);
return fail("The host update request failed", "host_update_failed", 500);
}

export async function GET(request: Request, { params }: Context) {
try {
const { id } = await params;
return Response.json(await getHostSoftwareUpdates(id, new URL(request.url).searchParams.get("force") === "1"), { headers: noStore });
} catch (error) {
return errorResponse(error);
}
}

export async function POST(request: Request, { params }: Context) {
if (shouldCheckApiRequestOrigin(request) && !isApiRequestOriginAllowed(request)) return fail("Cross-origin API requests are not allowed", "cross_origin_forbidden", 403);
if (request.headers.get("content-type")?.split(";", 1)[0].trim().toLowerCase() !== "application/json") return fail("Content-Type must be application/json", "unsupported_media_type", 415);
try {
const body = await parseJsonWithinLimit<unknown>(request, 4096);
if (!isRecord(body) || Object.keys(body).length !== 2 || !(body.target === "ompweb" || body.target === "omp")
|| typeof body.version !== "string" || body.version.length > 100 || !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(body.version)) {
return fail("target and a release version are required", "invalid_host_update", 400);
}
return Response.json(await updateHostSoftware((await params).id, body.target, body.version), { status: 202, headers: noStore });
} catch (error) {
return errorResponse(error);
}
}
1 change: 0 additions & 1 deletion components/AppShell-app-update.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { AppUpdateInfo } from "./AppUpdateDialog";

export const DISMISSED_APP_UPDATE_KEY = "omp-web:dismissed-app-update";
export const DISMISSED_OMP_UPDATE_KEY = "omp-web:dismissed-omp-update";
export const COMPLETED_APP_UPDATE_KEY = "omp-web:completed-app-update";
export const APP_UPDATE_POLL_MS = 500;
export const APP_UPDATE_STOPPING_POLL_MS = 200;
Expand Down
Loading
Loading