feat(app): the bot browser's window on a virtual monitor to share in Discord

- features.browserShare (봇용 크롬창 화면공유 선택 표시, off by default) and a driver card on the
  features screen: the Virtual Display Driver 25.7.23 (MIT, SignPath-signed) ships in
  display-driver/ (hash-checked by package.sh); install and uninstall run jarvis.exe elevated
  once (--display-driver), settings in %ProgramData%\JarvisBot\display-driver, another
  program's copy of the driver is left alone
- the monitor is on the desktop only while the bot browser uses it, at the rightmost real
  monitor's bottom-right corner; the stop closes Chrome first, then takes the monitor off
- Chrome starts with no window and the app opens it over CDP in the background, so it never
  takes the focus; the window is a tool window (no Alt+Tab, no taskbar button), fills the
  monitor's work area and keeps drawing when covered; without a monitor it runs headless with
  the reason on the dashboard
- Chrome runs with --do-not-de-elevate on Windows: started by an app running as administrator
  it restarted itself as the user and the app lost hold of it
- checked on the win-ci Windows VM from install to uninstall (focus kept while typing, no
  taskbar button, no Chrome left, nothing left after uninstall) and on Linux with a real Chrome

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-14 02:43:32 +09:00
parent 56212c06dc
commit 1bd7defbb4
17 changed files with 884 additions and 43 deletions

View File

@@ -61,7 +61,9 @@ 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) and `browser` (the bot browser, below "Bot browser", and its
brain tool `botBrowser`, `src/jarvis/tools/builtin/bot_browser.spec.md`), also on by default. The tools of a feature that
brain tool `botBrowser`, `src/jarvis/tools/builtin/bot_browser.spec.md`), also on by default;
`browserShare` (봇용 크롬창 화면공유 선택 표시, the bot browser on the virtual monitor, below
"Virtual monitor"), off 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 (PC control, screen
viewing) come with their milestone (M7).
@@ -236,8 +238,8 @@ 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).
bot's own Chrome, in the data folder, driven over the Chrome DevTools Protocol (CDP). It runs in the
background (headless), or with `features.browserShare` in a window on the virtual monitor (below).
- `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
@@ -265,7 +267,48 @@ it in the background (headless); the virtual monitor for screen sharing comes ne
- 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.
in the app's environment adds `--no-sandbox`. Windows always runs it sandboxed, with
`--do-not-de-elevate`: started by an app running as administrator, Chrome would otherwise start
again as the user and end the process the app holds, so the app could neither see nor stop it.
## Virtual monitor (`app/src/vdisplay.rs`)
`docs/v2/pc-features.md`, "봇용 크롬창과 디스코드 화면공유". With `features.browserShare` the bot
browser's window sits on a monitor that exists only for it, so the user can pick that monitor in
Discord's screen share ("화면" tab) while no real monitor shows the window. Windows only; elsewhere
the browser runs headless with a note.
- **Driver**: the open-source Virtual Display Driver 25.7.23 (MIT, signed by the SignPath
Foundation), its `MttVDD.inf`, `mttvdd.cat` and `MttVDD.dll` in `display-driver/` next to
`jarvis.exe` (`package.sh` downloads the release zip and checks its SHA-256). Installing and
removing need the administrator once: the app starts itself elevated (`jarvis.exe
--display-driver install|uninstall --result FILE`, Windows asks), waits, and reads why it failed
from FILE. Install writes the driver's settings to `%ProgramData%\JarvisBot\display-driver\vdd_settings.xml`
(the driver runs as a system service that cannot read the data folder, so this is the one place
outside it; readable by users and LOCAL SERVICE, writable only by the system and administrators),
points the driver at it (`HKLM\SOFTWARE\MikeTheTech\VirtualDisplayDriver` `VDDPATH`), creates the
device (`Root\MttVDD`, display class) and installs the driver; Windows then asks once whether to
install software from the SignPath Foundation. The new monitor is taken off the desktop at once.
The settings: one monitor, one mode (1280x720 at 30 Hz), no custom EDID. When another program's
copy of the same driver is installed (its `VDDPATH` is not ours) the app refuses to install or
remove and never touches its monitors. Uninstall removes the device, the driver package, the
registry key and the settings folder.
- **On only while used**: a service start first takes the monitor off the desktop (left over from a
run that ended badly). With `browserShare` it then attaches the monitor (no administrator needed)
right of and below the rightmost real monitor, touching it only at that monitor's bottom-right
corner, so the mouse hardly reaches it and no real monitor overlaps it. The stop closes the
browser first and then takes the monitor off, so Windows never moves the window onto a real
monitor.
- **The window**: Chrome starts with `--no-startup-window` (no headless), and the app opens its one
window over CDP in the background (`Target.createTarget` with a new window at the monitor's place
and size), so it never takes the focus from the game or program the user is in. The window
then becomes a tool window (not in Alt+Tab, Win+Tab or the taskbar), fills the monitor's work
area (Windows may give the monitor a taskbar of its own) and goes behind all other windows, all
without activating it. It keeps drawing when covered (`--disable-backgrounding-occluded-windows`,
`--disable-renderer-backgrounding`, `--disable-background-timer-throttling`). The window holds
the first tab, which the bot never closes; the bot's tabs open in it, the newest in front.
- If the monitor or the window cannot be made, the browser runs headless and the dashboard's
`browser` note says why ("가상 모니터 없이 실행: ...").
## LLM (`app/src/strata.rs`)
@@ -344,6 +387,7 @@ back as Korean messages for the screen. The Tauri shell passes the screens' `inv
| `discord_channel_info` `{id}` / `channel_sync_status` | a channel's Discord name and topic / each synced chat channel's last result (above) |
| `collect_results` `{target, limit}` | `{targets, items}`: every target folder with results, and the collected items newest first (`target` null: every target; `limit` 1-500, default 100) |
| `mcp_env_status` / `mcp_env_set` `{server, name, value}` | which MCP environment values are stored (`{server: {NAME: bool}}`, never the values) / store one (an empty value removes it); only for a saved server and name |
| `display_driver_status` / `display_driver_install` / `display_driver_uninstall` | the virtual monitor's driver: `{supported, installed, other}` (Windows only; `other`: another program's copy) / install or remove it elevated (above), then its status |
| `install_status` / `install_start` / `install_cancel` | the install steps and their state, bytes and last line / run what is not done in the background / stop it |
| `logs_query` `{tab, level, find, after, limit}` / `logs_error_report` / `logs_export` `{from, to}` | the log hub; the zip goes to `logs/` and its path comes back |
@@ -374,7 +418,8 @@ Plain HTML, CSS and an ES module, no build step, dark theme after `DESIGN.md`. A
with their switches; the bot screen also changes the token; the 기능 screen has the feature
switches and one card per MCP server (name, command, arguments and environment variable names
one per line, on/off, delete), and for a saved server a password box per environment variable
that stores its value on its own. The 백그라운드 수집 screen has the targets (a table: name, kind,
that stores its value on its own; on Windows also a card for the virtual monitor's driver (its
state and an install or remove button). The 백그라운드 수집 screen has the targets (a table: name, kind,
address or words, interval in minutes, on/off, delete), the keep days, and the results (the
newest 100, filtered by any target that has results, each with its time, title, link and the start of its text shown
as plain text).
@@ -402,8 +447,8 @@ URL), so other local programs cannot drive it.
runs the window says so; if it fails the window stays open with the reason, and closing it again
quits anyway. Quitting another way (the system shutting down) runs the same shutdown.
- `app/shell/package.sh <folder>` builds it on Linux (`x86_64-pc-windows-gnu`, mingw-w64) and lays
out `Jarvis/`: `jarvis.exe`, `WebView2Loader.dll` and `python-src/` (the `voice_worker` and
`jarvis` packages, no caches or specs). The worker's default sources are `python-src` next to the
out `Jarvis/`: `jarvis.exe`, `WebView2Loader.dll`, `python-src/` (the `voice_worker` and
`jarvis` packages, no caches or specs) and `display-driver/` (the virtual monitor's driver). The worker's default sources are `python-src` next to the
executable when it is there, else the repository's `src/`; the install reads its requirement
files from the same place. The installer (NSIS) comes later; the folder runs as it is.
@@ -449,4 +494,12 @@ downloads, install steps, logs; the Unix-only process tests excepted), and the w
wizard's folder, PC check and install (`uv` and the worker venv installed, a cancel leaving no
`uv` or Python process), the token stored DPAPI-encrypted, a start failing with its reason, the
log screen, error copy, zip export, and closing the window ending the process with nothing written
to `%APPDATA%` or `%LOCALAPPDATA%`.
to `%APPDATA%` or `%LOCALAPPDATA%`. The virtual monitor (`tests/vdisplay_elevated.rs`, no harness:
started elevated, the same program is the elevated half; `tests/bot_browser.rs` with a screen): the
driver installed through the elevated start (Windows' SignPath question answered once) with the
settings folder's permissions, the monitor off after install, on at the rightmost monitor's corner
while the bot browser runs and off after, one Chrome window there filling the work area and holding
the bot's tab, the focus staying in the program the user types into, no taskbar button, no Chrome
left after the stop, and the uninstall leaving no device, driver package, registry key or settings
folder. On Linux the same window test runs on an X display (one window at the given place and
size, the bot's tab in it).