opencode-webui 2.4.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,8 +22,8 @@ First boot prints the URL and a generated password — **shown once**:
22
22
  generated for this install — shown once
23
23
  set WEBUI_PASSWORD to choose your own
24
24
  sessions the same ones as your opencode TUI — same engine, same history
25
- extensions ~/.config/opencode/webui-extensions/<name>/main.tsx per-user
26
- <project>/.opencode/webui-extensions/<name>/main.tsx per-project
25
+ extensions ~/.config/opencode/webui-extensions/<name>/index.tsx per-user
26
+ <project>/.opencode/webui-extensions/<name>/index.tsx per-project
27
27
  skill agent skill synced to ~/.config/opencode/skills/webui/ — your agent knows this UI exists
28
28
  ```
29
29
 
@@ -37,9 +37,63 @@ Options:
37
37
  | `WEBUI_TRUST_PROXY` | unset | Set to `1` when a trusted reverse proxy sits in front, so `X-Forwarded-Host`/`Proto` are honored. Without it those headers are ignored. |
38
38
  | `WEBUI_PROXY_PORT` | `4097` | Port for the UI and `/api/*`. |
39
39
  | `WEBUI_EXTENSION_DIR` | the global + project dirs | Adds a higher-precedence source shadowing both (the sandbox uses this to keep WIP isolated; shipped extensions still load underneath). |
40
+ | `WEBUI_NO_SETUP` | unset | `1` skips first-run setup for this run (CI, one-offs). |
41
+ | `WEBUI_NO_PLUGIN` | unset | `1` installs the global command but not the OpenCode lifecycle plugin. |
42
+ | `WEBUI_SETUP` | unset | `1` forces setup even in a repo checkout (testing). |
43
+
44
+ The serve/security vars above can also be set **durably** — no shell needed —
45
+ in `~/.config/opencode/webui/config.json`, edited from **Settings › Access** in
46
+ the UI or `opencode-webui config` on the CLI. Precedence per key is
47
+ **explicit env var → config file → default**; changes apply after a restart
48
+ (the Access tab has a "Restart now" button). The file is `0600`; a password set
49
+ there is stored as a SHA-256 hash, never plaintext. Setting a reachable bind or
50
+ `allowedHosts: ["*"]` is allowed but warned about, and a *reachable* instance
51
+ with **no password** needs an explicit confirmation.
40
52
 
41
53
  Sessions are shared with the `opencode` TUI — open a session in the TUI, continue it in the browser.
42
54
 
55
+ ### Setup (run once) — the `opencode-webui` command + OpenCode plugin
56
+
57
+ First boot self-installs two things, so you don't pay for `bunx` on every
58
+ start and the webui comes up with OpenCode:
59
+
60
+ 1. **A global `opencode-webui` command** (`~/.local/bin/opencode-webui`, or
61
+ `WEBUI_BIN_DIR`) that execs the installed entry directly — fast, no bunx
62
+ resolution. The first-boot banner tells you if that directory isn't on
63
+ `PATH`.
64
+ 2. **A built-in OpenCode lifecycle plugin** written to
65
+ `~/.config/opencode/plugins/opencode-webui/`, which the engine
66
+ auto-discovers. It starts the webui in the background as soon as OpenCode
67
+ activates its plugins (i.e. when you use OpenCode) — detached,
68
+ fire-and-forget, and it never starts a second copy (a running webui answers
69
+ on its port and wins).
70
+
71
+ ```sh
72
+ opencode-webui # start (starts the opencode service first if needed)
73
+ opencode-webui update # update to the latest version and restart
74
+ opencode-webui status # command, plugin, launch command, running pid
75
+ opencode-webui restart # restart the background webui
76
+ opencode-webui stop # stop it
77
+ opencode-webui uninstall # remove the command + plugin (remembered; no auto-reinstall)
78
+ ```
79
+
80
+ A repo checkout (`bun run dev` / `bun run start`) never self-installs, so
81
+ development cannot fight your installed command. `WEBUI_NO_SETUP=1` skips
82
+ setup for one run, `WEBUI_NO_PLUGIN=1` installs the command but not the plugin,
83
+ and `autostart: false` in the config (the **Startup** toggle in Settings ›
84
+ Access) turns it off persistently. The plugin only ever starts a webui that is
85
+ already installed; it installs only its own folder and removes it cleanly on
86
+ `uninstall`.
87
+
88
+ ```sh
89
+ opencode-webui config # show effective serve settings + source
90
+ opencode-webui config set host 0.0.0.0
91
+ opencode-webui config set allowed-hosts 192.168.1.5,myserver.lan
92
+ opencode-webui config set password # read from stdin
93
+ opencode-webui config set auth none --confirm # no login (warned)
94
+ opencode-webui restart # apply
95
+ ```
96
+
43
97
  ## Install (no Bun)
44
98
 
45
99
  Binaries are attached by CI on each version tag — grab one for your platform from
@@ -62,6 +116,13 @@ chmod +x opencode-webui-linux-x64
62
116
  Behind a reverse proxy (Caddy / nginx samples, incl. websocket + SSE timeouts):
63
117
  [docs/reverse-proxy.md](docs/reverse-proxy.md).
64
118
 
119
+ ## Install as app (PWA)
120
+
121
+ Over HTTPS (e.g. Tailscale serve) Chrome offers install — standalone window, splash, home-screen icon.
122
+ Settings → App shows install state plus the **live activity tile**: one silent notification following
123
+ active sessions (dense strip text, tap opens that session, clears itself when idle). Needs notification
124
+ permission; plain-LAN HTTP stays a browser tab (secure context required).
125
+
65
126
  ## Sandbox
66
127
 
67
128
  A second, private instance for agents (or you) to test extensions and settings
@@ -98,8 +159,8 @@ One extension = one folder, dropped in — no rebuild, no restart:
98
159
 
99
160
  ```
100
161
  my-extension/
101
- manifest.json id, version, description, disabled?
102
- index.tsx browser stratum (wrap / replace / contribute / hook / service)
162
+ manifest.json id, version, description; optional disabled, settings, requires
163
+ index.tsx browser stratum: register() and/or activate(ctx)
103
164
  dom.ts DOM stratum (portals, canvas, post-render tweaks)
104
165
  server.ts proxy stratum (routes, middleware, event tap, pollers)
105
166
  engine/ opencode plugin payload (model tools, prompt hints)
@@ -109,9 +170,10 @@ Presence = installed, `disabled: true` = paused, delete = uninstalled; a
109
170
  higher-precedence folder with the same id shadows the shipped one, so user
110
171
  customizations survive core updates with no forks. Hot reload everywhere:
111
172
  browser edits repaint live via the manifest SSE push, proxy edits reload
112
- with no restart. The full authoring guide — the five kinds, hook catalog,
113
- DOM kit, `server.ts` mounts, precedence, and the timestamp worked example
114
- is [webui-extensions/README.md](webui-extensions/README.md).
173
+ with no restart. The full authoring guide — the five kinds, the activation
174
+ context, the event bus, declared settings + `requires`, slots, peer
175
+ composition, the DOM kit, `server.ts` mounts, precedence, and the timestamp
176
+ worked example — is [webui-extensions/README.md](webui-extensions/README.md).
115
177
 
116
178
  The built-in `/report` command files a prefilled GitHub issue with a diagnostics
117
179
  bundle (build version, enabled extensions, error ring); `--agent` hands it to the
@@ -121,14 +183,20 @@ session agent instead, so it can file it via `gh`.
121
183
 
122
184
  ```sh
123
185
  bun install
124
- bun run dev # proxy (4097) + Vite (5173), HMR
186
+ bun run dev # proxy (config port, default 4097) + Vite (5173), HMR
125
187
  bun run sandbox # isolated second instance (4099 / 5175, Vite in dev) — see Sandbox above
126
188
  bun run typecheck
127
189
  bun run build && bun start # production: dist/ + API on 4097
128
190
  ```
129
191
 
192
+ To open the dev UI from a phone/Tailscale, set the bind address to `0.0.0.0`
193
+ and add your host under **Settings › Access** — Vite honors the same values, so
194
+ `http://<this-machine>:5173` works (the proxy stays on its own port).
195
+
130
196
  - Extension authoring guide: [webui-extensions/README.md](webui-extensions/README.md)
131
197
  - Extension contract check: `bun run scripts/uitest/extensions-check.ts`
198
+ - Setup check: `bun run check:setup` (global command + lifecycle plugin + CLI, isolated HOME/XDG)
199
+ - Config check: `bun run check:config` (resolution/precedence, validation, exposure, `config` CLI)
132
200
  - Architecture, editing rules, roadmap: [AGENTS.md](AGENTS.md)
133
201
 
134
202
  ## License