opencode-webui 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abdelftah Zowail
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # opencode-webui
2
+
3
+ Web frontend for the OpenCode v2 engine — same engine, same sessions as the `opencode` TUI.
4
+ The browser never holds service credentials: a Bun proxy fronts the engine and owns the auth.
5
+
6
+ ## Install
7
+
8
+ Requires [Bun](https://bun.sh):
9
+
10
+ ```sh
11
+ bunx opencode-webui
12
+ ```
13
+
14
+ The opencode engine is started automatically if it isn't already running.
15
+ First boot prints the URL and a generated password — **shown once**:
16
+
17
+ ```text
18
+ opencode-webui
19
+ → http://localhost:4097
20
+
21
+ password patch-orbit-vault-glare
22
+ generated for this install — shown once
23
+ set WEBUI_PASSWORD to choose your own
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
27
+ skill agent skill synced to ~/.config/opencode/skills/webui/ — your agent knows this UI exists
28
+ ```
29
+
30
+ Options:
31
+
32
+ | Variable | Default | |
33
+ | --- | --- | --- |
34
+ | `WEBUI_PASSWORD` | generated on first boot | Log in with this passphrase. Set it to pin your own instead of the generated one. |
35
+ | `WEBUI_HOST` | `127.0.0.1` | Bind address. A wildcard (`0.0.0.0` / `::`) is refused without a password. |
36
+ | `WEBUI_PROXY_PORT` | `4097` | Port for the UI and `/api/*`. |
37
+
38
+ Sessions are shared with the `opencode` TUI — open a session in the TUI, continue it in the browser.
39
+
40
+ ## Install (no Bun)
41
+
42
+ Binaries are attached by CI on each version tag — grab one for your platform from
43
+ [GitHub Releases](https://github.com/AbdelftahZowail/opencode-webui/releases),
44
+ `chmod +x`, run. Same env vars, same first boot.
45
+
46
+ ```sh
47
+ chmod +x opencode-webui-linux-x64
48
+ ./opencode-webui-linux-x64
49
+ ```
50
+
51
+ ## Security
52
+
53
+ - One shared passphrase for the whole UI. Generated on first boot if `WEBUI_PASSWORD` is unset, printed once.
54
+ - Login sets a signed **HttpOnly `SameSite=Strict`** cookie — `Secure` too when the request arrived over https (`X-Forwarded-Proto`).
55
+ - Login is rate-limited per IP with constant-time comparison; `Host`/`Origin` headers are validated.
56
+ - Wildcard bind is refused unless a password is set — the refusal names the env var.
57
+
58
+ Behind a reverse proxy (Caddy / nginx samples, incl. websocket + SSE timeouts):
59
+ [docs/reverse-proxy.md](docs/reverse-proxy.md).
60
+
61
+ ## The agent skill
62
+
63
+ On every boot the webui syncs its skill to `~/.config/opencode/skills/webui/SKILL.md` —
64
+ no opt-in. That skill is how your agent learns the webui exists, what its extension
65
+ system can do, and how to file reports for it. `--install-skill` runs the same sync
66
+ manually.
67
+
68
+ ## Extensions
69
+
70
+ Plain React, dropped in a folder, loaded at runtime — no rebuild, no restart:
71
+
72
+ - `~/.config/opencode/webui-extensions/<name>/main.tsx` — per-user
73
+ - `<project>/.opencode/webui-extensions/<name>/main.tsx` — per-project
74
+
75
+ Toggle any extension in Settings › Extensions. The full authoring guide — the kind
76
+ contract, hooks, region markers, the `window.__opencodeUI` bridge — is
77
+ [ui-extensions/README.md](ui-extensions/README.md).
78
+
79
+ The built-in `/report` command files a prefilled GitHub issue with a diagnostics
80
+ bundle (build version, enabled extensions, error ring); `--agent` hands it to the
81
+ session agent instead, so it can file it via `gh`.
82
+
83
+ ## Development
84
+
85
+ ```sh
86
+ bun install
87
+ bun run dev # proxy (4097) + Vite (5173), HMR
88
+ bun run preview # isolated second instance (5174 / 4098) for WIP edits
89
+ bun run typecheck
90
+ bun run build && bun start # production: dist/ + API on 4097
91
+ ```
92
+
93
+ - Extension authoring guide: [ui-extensions/README.md](ui-extensions/README.md)
94
+ - Extension contract check: `bun run scripts/uitest/extensions-check.ts`
95
+ - Architecture, editing rules, roadmap: [AGENTS.md](AGENTS.md)
96
+
97
+ ## License
98
+
99
+ MIT (add LICENSE before publishing).
Binary file