feat(app): features screen with tool switches and MCP servers; v2 drops host file and screen tools

- Settings `features` (weather, webSearch, meals) and `mcpServers` (name, command, args, env names,
  enabled), edited on the new 기능 screen. The tools of a feature that is off go into the brain's
  `disabled_tools`; only enabled MCP servers go into its `mcps`.
- MCP environment values (API keys) live only in the encrypted secrets (`mcp:<server>:<NAME>`),
  shown as stored or not, masked in logs, removed with their server, and reach the worker only in
  `JARVIS_MCP_ENV`, which the brain takes out of its environment before giving each server its own.
- `enabled_builtin_tools(cfg)` is the one list the router, toolSearchTool and the executor use, so
  a turned-off tool is neither offered nor run, also when the model names it.
- The v2 brain never offers v1's `localFiles` (home folder read/write/delete) and `screenshot`:
  anyone in the voice or chat channels could ask for them. Screen viewing comes in M7.
- The brain connects MCP servers on its own thread and logs each outcome without debug logging.
- Stored secrets are masked in the log hub as soon as the data folder is found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-13 09:56:17 +09:00
parent d4bd4acfe9
commit 3ef4281180
23 changed files with 717 additions and 39 deletions

View File

@@ -38,9 +38,9 @@ that is not absolute, or is a file, is refused with a message.
`config/settings.json` keeps the format of `discord_core.spec.md` and `conversation.spec.md`.
- `fields()` describes every key the screens edit: its dotted path (`call.mode`), screen
(`bot`, `channels`, `chat`, `memory`, `model`), kind (bool, integer with a range, number with a
(`bot`, `channels`, `chat`, `memory`, `model`, `features`), kind (bool, integer with a range, number with a
range, text, text list, choice with its values, Discord ID, Discord ID list, ID to number map,
chat channel list, free object), its default and a Korean label. The screens are built from this
chat channel list, MCP server list, free object), its default and a Korean label. The screens are built from this
list, so a key is added in one place.
- `view(dir)` returns every field's current value: the file's value, or the default when the file
does not set it. A file that does not parse is reported, not overwritten.
@@ -53,12 +53,39 @@ that is not absolute, or is a file, is refused with a message.
`chat`, `others`, `off`, `since_days`, `recent_minutes`, `recent_records`, `matches`,
`budget_tokens`), sent in the worker `hello` as `memory`. Default `{}` (the worker's defaults).
## Features and MCP servers (`app/src/features.rs`)
`docs/v2/desktop-app.md`, "기능". The 기능 screen turns the brain's built-in features on and off and
manages the MCP servers it connects.
- `features` (new section): `weather` (`getWeather`), `webSearch` (`webSearch`, `fetchWebPage`) and
`meals` (`logMeal`, `fetchMeals`, `deleteMeal`), each 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, background collection) come with their milestones (M6, 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
variables the server gets (each a letter or `_`, then letters, digits or `_`; not listed twice);
`enabled` on by default. Only enabled servers reach the brain's `mcps` (stdio).
- **Environment values are secrets** (API keys): never in the settings file or `config/brain.json`.
Each is stored in the secrets as `mcp:<server>:<NAME>` (`mcp_env_set`, only for a server and name
already saved; an empty value removes it), shown on the screen only as stored or not, and masked
in logs like every secret. Saving `mcpServers` removes the values of servers and names no longer
listed. On start the app passes the enabled servers' stored values to the worker in its
environment, `JARVIS_MCP_ENV` (`{server: {NAME: value}}`); the brain takes that variable out of
its own environment and gives each server only its own values.
- Each server's outcome (its tool count, or why it failed) is a worker line in the LLM log tab,
also without debug logging. MCP servers are programs the PC runs; the screen says to add only
trusted ones.
## Secrets (`app/src/secrets.rs`)
`config/secrets.dat` holds a JSON object of named secrets (`discordToken`). On Windows the bytes are
`config/secrets.dat` holds a JSON object of named secrets (`discordToken`, the MCP servers'
environment values `mcp:<server>:<NAME>`). On Windows the bytes are
encrypted with DPAPI for the current Windows user (`CryptProtectData`, no prompt), so the file is
useless copied to another account or PC. Elsewhere (development only) the file is plain JSON with
owner-only permissions (0600). Writes are atomic. `get`, `set`, `remove`; `masked(value)` shows only
owner-only permissions (0600). Writes are atomic. `get`, `set`, `remove`, `names`; `masked(value)` shows only
the last 4 characters for the screens (`••••abcd`).
The app's token comes from the secrets (`discordToken`), else from `JARVIS_DISCORD_TOKEN` (tests,
@@ -206,7 +233,7 @@ start it first, so nothing answers before the brain can, and stop it last.
(default 8080) on the model screen; `llm.url` (default none).
- **The brain's settings**: on every start the app writes `config/brain.json` (it owns the file):
`ollama_base_url` the LLM's `/v1`, `ollama_chat_model` the listed id, `db_path`
`memory/jarvis.db`; the worker gets it as `JARVIS_CONFIG_PATH`. Loading it writes nothing to the
`memory/jarvis.db`, `disabled_tools` and `mcps` (above, "Features and MCP servers"); the worker gets it as `JARVIS_CONFIG_PATH`. Loading it writes nothing to the
home folder.
## Chat channel names and topics (`app/src/channel_sync.rs`)
@@ -251,12 +278,14 @@ back as Korean messages for the screen. The Tauri shell passes the screens' `inv
| `settings_fields` / `settings_view` / `settings_apply` `{changes}` | the settings editor above; `restartNeeded` when the services run; `sync` with the chat channels sent to Discord (below) |
| `service_start` / `service_stop` / `service_restart` / `dashboard` | the controller and its snapshot; start and restart run in the background, stop also cancels a start |
| `discord_channel_info` `{id}` / `channel_sync_status` | a channel's Discord name and topic / each synced chat channel's last result (above) |
| `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 |
| `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 |
The invite link asks for: view channels, send messages, read history, add reactions, manage
messages, manage channels, connect, speak, voice activity, and the slash command scope; never
administrator. The log hub writes to the data folder's `logs/` as soon as a folder is chosen
administrator. Stored secrets are masked in the log hub from the moment the app finds or chooses
its data folder, and again after each one is saved. The log hub writes to the data folder's `logs/` as soon as a folder is chosen
(`folder_choose` points it there; before that, memory only).
## Screens (`app/ui/`)
@@ -274,10 +303,13 @@ Plain HTML, CSS and an ES module, no build step, dark theme after `DESIGN.md`. A
Strata's last line, and stop in the header; the header with start, restart and stop is rebuilt
only when the state changes, so a click is never lost to the refresh. Every screen change starts
a new generation: an answer that arrives after the user moved to another screen is dropped.
- **Settings screens** (봇, 채널·호출, 채팅 채널, 대화 기억, 모델): built from `settings_fields`; only
- **Settings screens** (봇, 채널·호출, 채팅 채널, 대화 기억, 모델, 기능): built from `settings_fields`; only
changed fields are sent; the server and voice channel are pickers (choosing another server clears
the voice channel and lists only that server's channels); the chat channels are a table
with their switches; the bot screen also changes the token.
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.
- **Logs**: tab, level and text filters, pause, live follow (lines after the last seen), "최근 오류
복사" (to the clipboard; over 2,000 characters it suggests the zip), and the zip export by days.
@@ -326,7 +358,11 @@ a stop right after a background start running no launch at all, and the next sta
closing the app (the controller's shutdown after a failed stop: clean-up failing keeps it failed,
succeeding stops it; an install in progress cancelled and waited for); command output that is not
UTF-8 read on to the end; the window data folder (data folder, or a scratch folder removed later);
the TTS speed reaching the worker's arguments; chat channel names and topics (only new or edited
the TTS speed reaching the worker's arguments; features and MCP servers (read and refused with
the key, the feature tools named as the brain names them, only enabled servers in the brain's
settings without values, stored values passed for enabled servers only, values of removed servers
and names deleted, a value refused for an unsaved server, kept out of the settings file and masked
in logs, also by a new app on the same folder); chat channel names and topics (only new or edited
syncing channels sent, the topic limit refused before saving, Discord's form of the name written
back, a missing permission failing with the reason and the text kept, a rate-limited edit pending
and retried once with the latest text, a new channel never clearing Discord (also on its retry), a