feat(app): the bot's own Chrome in the data folder, reaching only public addresses

- install step browser: Chrome for Testing 157 (pinned SHA-256) into runtime/chrome
- services start it headless with its own profile when features.browser is on; CDP on a free
  loopback port passed to the worker as JARVIS_BROWSER_CDP; a failure leaves the services running
- every Chrome connection goes through the app's loopback egress proxy: one lookup, public
  addresses only (403 otherwise, no host logged), QUIC off, WebRTC only through the proxy
- stop: Browser.close, then kill after 5 s; dashboard shows the browser's state
- the worker's runtime environment follows the settings step, not every step being installed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-13 22:01:04 +09:00
parent 69f1bf4fa9
commit 24d0798bae
12 changed files with 724 additions and 16 deletions

View File

@@ -60,10 +60,11 @@ manages the MCP servers it connects.
- `features` (new section): `weather` (`getWeather`), `webSearch` (`webSearch`, `fetchWebPage`) and
`meals` (`logMeal`, `fetchMeals`, `deleteMeal`), each on by default; `collect` (background
collection, below; no brain tool), also on by default. The tools of a feature that
collection, below; no brain tool) and `browser` (the bot browser, below "Bot browser"; its brain
tool comes with it), also on by default. The tools of a feature that
is off go into the brain's `disabled_tools`: they are neither offered nor run
(`voice_worker.spec.md`, "Tools"). The other features of the 기능 screen (browser control, PC
control, screen viewing) come with their milestones (M6, M7).
(`voice_worker.spec.md`, "Tools"). The other features of the 기능 screen (PC control, screen
viewing) come with their milestone (M7).
- `mcpServers` (new list): each `{name, command, args, env, enabled}`. `name` is 1-32 letters,
digits, `-` or `_` without `__` (the brain names a server's tools `<name>__<tool>`), not listed
twice; `command` is not empty; `args` a list of strings; `env` the names of the environment
@@ -183,6 +184,7 @@ reaches the screen.
who, why and how long ago, never the text.
- `system`: memory in use and total, and per NVIDIA GPU its use and VRAM (from `nvidia-smi`,
missing when there is none); sampled when the snapshot is taken, at most once a second.
- `browser`: the bot browser's `{state, note}` ("Bot browser").
- `llm`: the LLM's state (`off`, `starting`, `ready`, `failed`), whether the app runs it
(`managed`), and while starting Strata's last line and how far that line says it got (its
percentage, or `X of Y GB` for the model download; none on a line without progress), also before
@@ -206,6 +208,7 @@ on the game PC (`scripts/m0`). The steps, in order:
| `stt_model` | Whisper `large-v3-turbo` (faster-whisper) |
| `tts_model` | the NLTK data MeloTTS's English g2p reads, then the worker's own `melo_child.py` loads the Korean voice once (downloading it) and must say its warm-up sentence |
| `strata` | Strata's own installer (`install.ps1`, `install.sh` elsewhere) with Strata's state, engine and components under `runtime/strata` and no PATH change |
| `browser` | the bot's Chrome: Chrome for Testing 157.0.8103.78 (win64, linux64), downloaded with resume and checked against its pinned SHA-256, unpacked into `runtime/chrome` (below, "Bot browser") |
| `settings` | `voiceWorker` in the settings pointed at the worker venv's Python with `--melo-python <melo venv> --history memory/history.sqlite --brain` (other settings kept); the install is done only once this is written |
The LLM itself (Qwen3.6-35B-A3B, about 23 GB) is downloaded by Strata on its first start (below).
@@ -230,6 +233,37 @@ The LLM itself (Qwen3.6-35B-A3B, about 23 GB) is downloaded by Strata on its fir
## Bot browser (`app/src/browser.rs`)
`docs/v2/pc-features.md`, "백그라운드 크로미움으로 정보 수집" and "봇용 크롬창과 디스코드 화면공유". The
bot's own Chrome, in the data folder, driven over the Chrome DevTools Protocol (CDP). This part runs
it in the background (headless); the virtual monitor for screen sharing comes next (M6).
- `features.browser` (브라우저 제어, on by default). With it on and the `browser` step installed,
the services start the bot browser after the LLM and before the worker, and stop it after the
worker. Without it (off, or not installed) nothing starts. A browser that does not start is a
warning on the dashboard and in the `browser` log tab; the services run on without it.
- Chrome runs with its own profile `browser/profile` (`--user-data-dir`), headless, no first-run,
sync, component updates, translation or background networking, and CDP on a free loopback port
(`--remote-debugging-port=0`; the port is read from the profile's `DevToolsActivePort`, which is
removed before each start, and `/json/version` must answer within 30 s). The worker gets
`JARVIS_BROWSER_CDP` = `http://127.0.0.1:<port>`.
- **Egress proxy**: every Chrome connection goes through the app's proxy on a free loopback port
(`--proxy-server`, and `--proxy-bypass-list=<-loopback>` so not even loopback is direct; QUIC off,
WebRTC only through the proxy). The proxy takes `CONNECT host:port` (HTTPS, WebSocket) and plain
HTTP requests with an absolute `http://` address. It resolves the name once (at most 10 s), refuses
with 403 unless every address is public (not loopback, private, link-local, CGNAT, documentation,
benchmarking, multicast, reserved or unspecified, also inside IPv4-mapped IPv6), and connects
only to those addresses, so Chrome can never reach the PC or the local network. Plain HTTP goes
on with `Connection: close` and without proxy headers. A request it cannot read is a 400. It logs
no host or address, only that it refused one.
- Stop: CDP `Browser.close`, then up to 5 s for the process to end, else it and the processes it
started are killed. The services' stop ends the proxy too.
- Dashboard `browser`: `{state, note}` with `state` off, ready, failed (the note says why) or exited
(it ended on its own).
- Linux (development only): Ubuntu's AppArmor refuses Chrome's sandbox; `JARVIS_CHROME_NO_SANDBOX=1`
in the app's environment adds `--no-sandbox`. Windows always runs it sandboxed.
## LLM (`app/src/strata.rs`)
The brain answers with one model, Qwen3.6-35B-A3B UD-Q4_K_XL through Strata (M0). The services