feat(app): M5 step 3, the management app's screens and their commands

- admin_api: the one entry point of the screens (app status, data folder,
  PC check, Discord token check and pickers, settings, service control and
  the dashboard, logs query, error report and zip export).
- discord_setup: token, Message Content and invite link checks over REST.
- app/ui: first-run wizard, dashboard, five settings screens and the log
  screen in plain HTML/CSS/JS (dark theme after DESIGN.md, Korean text).
- jarvis-admin-dev: a loopback, token-guarded development server so the
  screens run in a browser against the real commands.

Checked in a browser with the real test bot and voice worker: wizard
steps, start/restart/stop, settings save, chat channels, logs and export.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 14:15:58 +09:00
parent e8ddde5be6
commit 20300c017e
11 changed files with 1654 additions and 2 deletions

View File

@@ -127,6 +127,49 @@ reaches the screen.
The dashboard's state is built from the core's events alone (`Dashboard::on_event` with the time),
so it is tested with made-up events.
## Admin commands (`app/src/admin_api.rs`)
`AdminApi::call(command, args)` is the one entry point of the screens, JSON in and out; errors come
back as Korean messages for the screen. The Tauri shell passes the screens' `invoke("admin",
{command, args})` to it; the development server (below) does the same over loopback HTTP.
| Command | Does |
|---|---|
| `app_status` | version, data folder, whether a token is stored; `firstRun` while either is missing |
| `folder_check` `{path}` / `folder_choose` `{path}` | free space against the recommendation / create the folder and remember it |
| `pc_check` | OS, CPU threads, RAM, NVIDIA GPUs, the driver version and whether it is 580 or newer, free disk |
| `token_check` `{token}` | the bot's tag and IDs, whether the Message Content intent is on, the invite link (REST only, nothing stored) |
| `token_save` `{token}` / `token_status` | store it (masked from then on in logs) / `set` and the masked form, never the token |
| `discord_guilds` / `discord_channels` `{guildId}` | the bot's servers / a server's voice and text channels, for the pickers |
| `settings_fields` / `settings_view` / `settings_apply` `{changes}` | the settings editor above; `restartNeeded` when the services run |
| `service_start` / `service_stop` / `service_restart` / `dashboard` | the controller and its snapshot |
| `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/` from the first start after a
folder is chosen (before that, memory only).
## Screens (`app/ui/`)
Plain HTML, CSS and an ES module, no build step, dark theme after `DESIGN.md`. All text is Korean.
- **First-run wizard** (while `firstRun`): data folder (free space, warning under 200 GB), PC check,
the model to download (the download itself is step 4 of M5), Discord bot (token check with the
Message Content state and the invite link, then save), server and auto-join voice channel
pickers, wake words, then start. It resumes at the bot step when a folder is already chosen.
- **Dashboard**: the snapshot every second; the header with start, restart and stop is rebuilt
only when the state changes, so a click is never lost to the refresh.
- **Settings screens** (봇, 채널·호출, 채팅 채널, 대화 기억, 모델): built from `settings_fields`; only
changed fields are sent; the server and voice channel are pickers; the chat channels are a table
with their switches; the bot screen also changes the token.
- **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.
`jarvis-admin-dev [--port N] [--ui DIR] [--location FILE]` (development only) serves `app/ui` and
the commands on 127.0.0.1; every command needs the random token it prints (`#token=` in the page
URL), so other local programs cannot drive it.
## Tests
`cargo test`: data folder layout, location file and the environment override, a refused relative
@@ -136,5 +179,9 @@ without touching the file; secrets round trip, file permissions on Unix, masking
categories, query filters and follow, files per day and retention, error report bounds, zip size
cap, redaction of stored secrets and token-shaped text; the controller's state rules with a fake
service starter; the dashboard from made-up events (captions replaced and cleared, latency stages
and medians, an answer matched to its asker's final, missed requests without text). Windows-only paths (DPAPI, `%APPDATA%`) are
and medians, an answer matched to its asker's final, missed requests without text); the admin
commands (first run: folder then token, the token never returned whole, settings and logs through
their modules, the dashboard before anything runs), the invite link's permissions and the Message
Content flags. The screens are checked in a browser against the development server with the real
services (wizard, dashboard start, restart and stop, settings save, chat channels, logs, export). Windows-only paths (DPAPI, `%APPDATA%`) are
checked on the Windows VM in the Windows build step.