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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Expand thinking blocks by default**, an off-by-default switch next to **Keep tool calls collapsed** in Settings → Interface & Behavior. Turn it on to read the model's reasoning without expanding every block; each block still collapses and expands by hand, and the choice applies to a block that is still streaming as well. Tool-call collapsing is unchanged.
- List every account omp stores for a subscription provider in Settings → API Keys & Providers and disconnect a single account with its **Disconnect** button; the other accounts stay connected and omp keeps choosing and rotating between them. The sign-in button of a connected provider now reads **Add account**: signing in with another account adds it, and signing in with a connected account refreshes it. Requires omp 18.7.0 or later ([can1357/oh-my-pi#14588](https://github.com/can1357/oh-my-pi/pull/14588)); older omp keeps the read-only account list from `omp usage` and explains how to disconnect from a terminal.
- Add **Settings → Notifications**: desktop and mobile notifications for a finished task (after the prompt and any background work it started are done; subagents never notify), a question or approval waiting for you, a run that failed after retries and fallbacks, and a model switch omp made on its own (for example Fable falling back to Opus after a refusal, or a usage-limit fallback). Each browser chooses its own events and whether to show an in-app toast or a system notification while you use omp-web in another tab. Nothing is shown for the session you are viewing, and clicking a notification opens its session; an in-app toast opens it from a click or tap anywhere on it, or Enter when it has keyboard focus. Over HTTPS (or on `localhost`) notifications arrive through Web Push even with no omp-web tab open, including the iPhone/iPad app added to the Home Screen; the push keys and device list live in `~/.omp/agent/omp-web/notifications.json`. Notifications are off until you turn them on. This replaces the previous completion notification for the open session, and the agent's `notify` tool now also works on Android.
- Skip the web password for clients your reverse proxy trusts: the proxy sends a secret in `X-Omp-Web-Auth` only for trusted address ranges, and omp-web holds only the secret's SHA-256 digest in `OMP_WEB_TRUSTED_HEADER_SHA256`. Other clients still sign in with the password. The README shows how to generate the secret without it reaching shell history, and an nginx setup, including how to trust the real client address behind Cloudflare, Cloudflare Tunnel or another proxy, and how to guard against DNS rebinding. The service installers preserve the setting, and the digest never reaches child processes.
- Choose **Classifier** or **Vendor default** in Settings → AI Model Defaults → **Auto Thinking Source** when Reasoning is `auto`. The choice is saved in omp's native config for newly started or restarted agents. Vendor mode prefers the publisher's effort, then omp's per-model default, then normal Auto fallback. Requires an omp release containing [can1357/oh-my-pi#14114](https://github.com/can1357/oh-my-pi/pull/14114).
- Show conflicting skill names and deduplicated installations when an OMP session starts, with resolution details, a **×** button that dismisses the notice for the session until the diagnostic report changes, and a persisted **Turn off** action that disables startup notices. Inspect a running session manually in **Settings → Extensions & Tools → Skills**, even when notices are off; inspection never resumes a stopped session. Requires an OMP runtime with the skill-diagnostics RPC commands; older runtimes report live diagnostics as unavailable.
- Ask a side question with `/btw <question>`: omp answers from the current conversation in a panel above the composer, even while the agent is working, and the question never enters the chat. Cancel a running answer, copy it, or ask follow-ups in the same topic. `/btw` on its own lists the session's past side questions, including ones asked in the terminal, each expandable to all its turns with **Copy** and **Follow up**. Side questions are text-only: with an attachment in the composer, `/btw` is refused and the draft is kept. An answer that omp lost (for example after its process restarted) shows as **Interrupted** instead of spinning. Requires an omp with the `btw` RPC commands; older omp shows "/btw requires a newer omp" instead of sending the text to the model.
Expand Down Expand Up @@ -49,6 +50,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- Submitting a message while the agent is working now queues it by default instead of steering, in Settings → Interface & Behavior → **Message during active run**: steering a long tool or shell command could abort the turn mid-task and left the new message undelivered. A previously saved choice is kept; only an empty setting changes meaning. Sending during omp-web's own `!!` shell command no longer fails with "Cannot send a prompt while a shell command is running": the message is handed to omp's queue instead of aborting anything, the optimistic bubble is withdrawn, and a notice says it was queued behind the running command.
- Keep omp-web's own secrets out of every child process it starts, not only the `omp` session processes: plugin install and upgrade, skill install/update/search, update checks and the self-update worker, agent unpack, and the Git commands the file panel runs. A session environment no longer contains the web password hash, so `env` inside an agent no longer prints anything that grants access to this server. `OMP_WEB_*` values that are configuration rather than secrets (the `omp` binary path, port, package dir) keep reaching the processes that need them.
- Sign web sessions with a per-installation random key (created on first start at `~/.omp/agent/omp-web/web-auth-secret.json`, mode `0600`) mixed with the password hash, instead of the hash itself. Anyone who reads the hash out of a service environment file can no longer forge a session cookie, and changing the password still signs every browser out.
- On Windows, changing or removing the web password hash with `setx` now takes effect at the next server restart. The tray (native and PowerShell) and the background service read `OMP_WEB_PASSWORD_HASH` from the user, then system, environment each time they start the server, instead of preferring the copy they captured at logon, so an old password no longer keeps working after you rotate it. The native tray previously did not pass the hash on at all.
- Word-completion ghost text in a scrolled composer now appears right after the caret. When the draft had text after the caret, it used to be drawn lines further down.
- Show a single plus sign on the **Add provider** buttons in Models settings, and none in the Add provider dialog title. The translated label no longer repeats the button's **+** icon.
- Links in a Markdown file preview no longer navigate omp-web away. A relative link the file panel cannot open, such as one in a Markdown file outside the workspace, shows as plain text with its target on hover; web links open in a new tab. An image the panel cannot load shows its alt text instead of a broken image.
Expand Down
7 changes: 6 additions & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,13 @@ Deploy the frontend and API support together; no native OMP upgrade is required.
the signing key is a per-installation random value mixed with the hash, so a
copied password hash cannot forge a session and changing the password still
invalidates existing sessions. Exposed deployments require HTTPS through a
trusted reverse proxy or VPN.
trusted reverse proxy or VPN. With `OMP_WEB_TRUSTED_HEADER_SHA256` set, a
request whose `X-Omp-Web-Auth` header hashes to that digest counts as signed
in; omp-web never holds the secret itself. Deciding which clients get the
header is the reverse proxy's job, because omp-web has no client address it
can trust.
- omp-web's own secrets (`OMP_WEB_PASSWORD`, `OMP_WEB_PASSWORD_HASH`,
`OMP_WEB_TRUSTED_HEADER_SHA256` and its legacy name
`OMP_WEB_TRUSTED_HEADER_SECRET`) are stripped from every child process
environment through `createChildProcessEnvironment`
(`lib/project-command-env.ts`). `OMP_WEB_*` values that are configuration
Expand Down
1 change: 1 addition & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Linux トレイ、Windows サービス)はインストール時に `OMP_WEB_PA
| `PORT` | サーバーポート | `30177` |
| `OMP_WEB_HOSTNAME` | バインドホスト | `127.0.0.1` |
| `OMP_WEB_PASSWORD_HASH` | Web ログイン用パスワードの scrypt ハッシュ(`ompweb hash-password` で生成)。非ループバックバインドには必須 | _なし(認証無効)_ |
| `OMP_WEB_TRUSTED_HEADER_SHA256` | 信頼できるリバースプロキシが `X-Omp-Web-Auth` ヘッダーで送るシークレットの SHA-256 ダイジェスト(16 進)。ヘッダーのハッシュが一致したリクエストはパスワードなしで通ります。omp-web はシークレット自体を保持しません。生成方法と nginx の設定例は英語版 README の「Skipping the password on trusted networks」を参照してください | _なし(無効)_ |
| `OMP_WEB_NO_OPEN` | `1` でブラウザ自動起動を無効化 | `0` |
| `OMP_WEB_DISABLE_AUTOUPDATE` | `1` で更新チェックとアプリ内更新を無効化(変更後は再起動) | `0` |
| `OMP_WEB_NAME` | ブラウザのタブとインストールしたアプリに表示する名前。`url`・`host`・`domain`(大文字小文字を区別しない)を指定すると、ブラウザが接続したホスト名(ポートなし)を使用します(localhost と IP アドレスは `omp web` のまま)。それ以外の値はそのまま使用します(変更後は再起動) | `omp web` |
Expand Down
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ Linux tray, and the Windows service) still accept `OMP_WEB_PASSWORD` at install
time and hash it before writing it to their configuration. Only the hash is
stored.

On Windows, the tray and background service read `OMP_WEB_PASSWORD_HASH` from
your user or system environment (for example `setx OMP_WEB_PASSWORD_HASH
"scrypt$…"`) each time they start the server, not from the environment they were
started with. Changing or removing the hash takes effect at the next server
restart, without signing out of Windows.

### Run as a Windows Service (System Tray)

Install ompweb as a Windows background service with a system tray icon and autostart at login:
Expand Down Expand Up @@ -318,6 +324,7 @@ host (KDE Plasma, and most Wayland/X11 desktops).
| `PORT` | Server port | `30177` |
| `OMP_WEB_HOSTNAME` | Server bind host | `127.0.0.1` |
| `OMP_WEB_PASSWORD_HASH` | Optional scrypt hash of the web login password, from `ompweb hash-password`. Required for a non-loopback bind | _None (auth disabled)_ |
| `OMP_WEB_TRUSTED_HEADER_SHA256` | SHA-256 hex digest of the secret a trusted reverse proxy sends in `X-Omp-Web-Auth` to skip the password for that request; see [Skipping the password on trusted networks](#skipping-the-password-on-trusted-networks) | _None (disabled)_ |
| `OMP_WEB_NO_OPEN` | Set to `1` to prevent auto-opening browser | `0` |
| `OMP_WEB_DISABLE_AUTOUPDATE` | Set to `1` to disable update checks and in-app updates; restart after changing | `0` |
| `OMP_WEB_NAME` | Name shown in browser tabs and installed-app names. `url`, `host` or `domain` (any case) uses the hostname the browser connected to, without port; localhost and IP addresses keep `omp web`. Any other value is used as-is. Restart after changing | `omp web` |
Expand All @@ -330,6 +337,115 @@ host (KDE Plasma, and most Wayland/X11 desktops).

**`OMP_WEB_NAME` and installed apps.** An installed app (PWA) is usually named after the page it was installed from. If you later change `OMP_WEB_NAME`, or reach omp-web through a different address while `OMP_WEB_NAME` is `url`, `host` or `domain`, your operating system may rename the installed app as well. Leave `OMP_WEB_NAME` empty, or set a name that identifies this omp-web server whatever domain name or address is used to reach it.

## Skipping the password on trusted networks

omp-web cannot see the client's address itself, so it leaves the decision to
your reverse proxy. The proxy sends a secret in the `X-Omp-Web-Auth` header,
and omp-web holds only that secret's SHA-256 digest in
`OMP_WEB_TRUSTED_HEADER_SHA256`. A request whose header hashes to that digest
is treated as signed in. Everyone else still signs in with the password whose
hash is in `OMP_WEB_PASSWORD_HASH`; without a password there is nothing to
skip, and the header is ignored. Keep omp-web bound to `127.0.0.1` so only the
proxy reaches it.

Generate the secret and its digest without typing the secret on a command line,
so it never lands in your shell history. This writes a random secret straight
into an nginx include file readable only by root and nginx, and prints only the
digest:

```bash
secret=$(openssl rand -hex 32)
printf 'map $ompweb_trusted $ompweb_auth {\n 1 "%s";\n default "";\n}\n' "$secret" \
| sudo install -m 0640 -o root -g www-data /dev/stdin /etc/nginx/ompweb-auth.conf
printf %s "$secret" | sha256sum | cut -d' ' -f1
unset secret
```

Use your nginx group in place of `www-data` (`nginx` on some distributions).
Set the printed digest as `OMP_WEB_TRUSTED_HEADER_SHA256`. The command history
holds only the commands, never the secret. On Windows, the tray and background
service read it from your user or system environment, like
`OMP_WEB_PASSWORD_HASH`.

Always generate the secret this way; do not reuse a password or another chosen
value. omp-web stores only a fast, unsalted SHA-256 digest, which is safe only
for a long random secret: anyone who reads the digest could recover a short or
guessable one with a dictionary attack.

With nginx, send the secret only to the address ranges you trust:

```nginx
# http {} context
geo $ompweb_trusted {
default 0;
10.0.0.0/16 1;
}
include /etc/nginx/ompweb-auth.conf; # the map written above

# the location that proxies to omp-web
proxy_set_header X-Omp-Web-Auth $ompweb_auth;
```

Always set the header, as above: the empty value for other clients replaces any
`X-Omp-Web-Auth` a client sends itself. nginx only inherits `proxy_set_header`
from outer blocks when a block sets none of its own, so put this line next to
the location's other `proxy_set_header` lines.

Serve omp-web only for its own hostname: give its `server` block an explicit
`server_name`, and add a `default_server` block that answers every other
hostname with `return 444;`. Otherwise a web page that a trusted browser visits
can point its own domain name at your nginx (DNS rebinding) and have nginx add
the secret to its requests.

`geo` checks `$remote_addr`, the address that connected to nginx. When clients
reach nginx through another proxy, use the
[`realip` module](https://nginx.org/en/docs/http/ngx_http_realip_module.html) to
replace it with the real client address. It does so only for connections from
addresses you list in `set_real_ip_from`:

- **Cloudflare (proxied DNS):** trust `CF-Connecting-IP`, and only from
Cloudflare. List every range from <https://www.cloudflare.com/ips-v4/> and
<https://www.cloudflare.com/ips-v6/>, and keep them up to date. Use this only
when Cloudflare is really in front.

```nginx
set_real_ip_from 173.245.48.0/20; # ...one line per Cloudflare range
real_ip_header CF-Connecting-IP;
```

Also refuse connections that come neither from Cloudflare nor from your
trusted ranges. `$realip_remote_addr` is the address that actually
connected, before `realip` replaced it:

```nginx
geo $realip_remote_addr $ompweb_peer_allowed {
default 0;
173.245.48.0/20 1; # ...every Cloudflare range
10.0.0.0/16 1;
}
# in the server block
if ($ompweb_peer_allowed = 0) { return 403; }
```

- **Cloudflare Tunnel (`cloudflared`):** the tunnel connects to nginx from
`cloudflared`'s address (`127.0.0.1` when it runs on the same machine), so
trust `CF-Connecting-IP` from there: `set_real_ip_from 127.0.0.1;` and
`real_ip_header CF-Connecting-IP;`. Any local process can then send its own
`CF-Connecting-IP` to nginx and claim a trusted address, and a local
connection without that header keeps `127.0.0.1`, so listing `127.0.0.1` in
`$ompweb_trusted` trusts every local process that connects to nginx.
- **Any other proxy or load balancer:**

```nginx
set_real_ip_from <proxy address or range>;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
```

`real_ip_recursive on` reads `X-Forwarded-For` from the right and skips the
hops listed in `set_real_ip_from`. Addresses a client adds itself are
ignored.

## Development

```bash
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Windows 服务)仍在安装时接受 `OMP_WEB_PASSWORD`,但在写入配置
| `PORT` | 服务端口 | `30177` |
| `OMP_WEB_HOSTNAME` | 绑定主机名 | `127.0.0.1` |
| `OMP_WEB_PASSWORD_HASH` | Web 登录密码的 scrypt 哈希(由 `ompweb hash-password` 生成)。绑定非回环地址时必须设置 | _无(未启用验证)_ |
| `OMP_WEB_TRUSTED_HEADER_SHA256` | 受信任的反向代理在 `X-Omp-Web-Auth` 请求头中发送的密钥的 SHA-256 摘要(十六进制);请求头哈希匹配的请求无需密码。omp-web 不保存密钥本身。生成方法和 nginx 配置示例见英文 README 的 “Skipping the password on trusted networks” 一节 | _无(未启用)_ |
| `OMP_WEB_NO_OPEN` | 设为 `1` 时禁止自动打开浏览器 | `0` |
| `OMP_WEB_DISABLE_AUTOUPDATE` | 设为 `1` 时禁用更新检查和应用内更新;修改后需重启 | `0` |
| `OMP_WEB_NAME` | 浏览器标签页和已安装应用中显示的名称。设为 `url`、`host` 或 `domain`(不区分大小写)时使用浏览器所连接的主机名(不含端口),localhost 和 IP 地址仍显示 `omp web`;其他值按原样使用。修改后需重启 | `omp web` |
Expand Down
2 changes: 2 additions & 0 deletions bin/omp-web-launchd.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function install(pkgArg) {
} catch (error) {
fail(error instanceof Error ? error.message : String(error));
}
const trustedHeaderDigest = process.env.OMP_WEB_TRUSTED_HEADER_SHA256;
const agentDir = process.env.PI_CODING_AGENT_DIR?.replace(/^~(?=\/|$)/, HOME);

const asdfBin = which("asdf");
Expand All @@ -110,6 +111,7 @@ function install(pkgArg) {
...(disableAutoUpdate ? { OMP_WEB_DISABLE_AUTOUPDATE: disableAutoUpdate } : {}),
...(installName ? { OMP_WEB_NAME: installName } : {}),
...(passwordHash ? { OMP_WEB_PASSWORD_HASH: passwordHash } : {}),
...(trustedHeaderDigest ? { OMP_WEB_TRUSTED_HEADER_SHA256: trustedHeaderDigest } : {}),
...(ompBin ? { OMP_WEB_OMP_BIN: ompBin } : {}),
...(agentDir ? { PI_CODING_AGENT_DIR: agentDir } : {}),
};
Expand Down
1 change: 1 addition & 0 deletions bin/omp-web-systemd.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ function install(options = {}) {
...(process.env.OMP_WEB_DISABLE_AUTOUPDATE ? { OMP_WEB_DISABLE_AUTOUPDATE: process.env.OMP_WEB_DISABLE_AUTOUPDATE } : {}),
...(process.env.OMP_WEB_NAME ? { OMP_WEB_NAME: process.env.OMP_WEB_NAME } : {}),
...(passwordHash ? { OMP_WEB_PASSWORD_HASH: passwordHash } : {}),
...(process.env.OMP_WEB_TRUSTED_HEADER_SHA256 ? { OMP_WEB_TRUSTED_HEADER_SHA256: process.env.OMP_WEB_TRUSTED_HEADER_SHA256 } : {}),
...(ompBin ? { OMP_WEB_OMP_BIN: ompBin } : {}),
...(agentDir ? { PI_CODING_AGENT_DIR: agentDir } : {}),
}, envPath);
Expand Down
2 changes: 2 additions & 0 deletions bin/omp-web-systemd.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ test("install creates the env file and unit with LAN settings", { skip: process.
OMP_WEB_HOSTNAME: "0.0.0.0",
OMP_WEB_PASSWORD: "test-password",
OMP_WEB_NO_OPEN: "0",
OMP_WEB_TRUSTED_HEADER_SHA256: "a".repeat(64),
OMP_WEB_DISABLE_AUTOUPDATE: "1",
OMP_WEB_NAME: "My Box",
PORT: "40123",
Expand Down Expand Up @@ -193,6 +194,7 @@ test("install creates the env file and unit with LAN settings", { skip: process.
OMP_WEB_NO_OPEN: "0",
OMP_WEB_DISABLE_AUTOUPDATE: "1",
OMP_WEB_NAME: "My Box",
OMP_WEB_TRUSTED_HEADER_SHA256: "a".repeat(64),
});
assert.match(readFileSync(unitPath, "utf8"), /EnvironmentFile=.*web-service\.env/);
assert.match(result.stdout, /config:.*web-service\.env/);
Expand Down
Binary file modified bin/omp-web-tray.exe
Binary file not shown.
Loading
Loading