feat(app): chat channel name/topic sync, TTS speed, safe window close

Review follow-ups to M5.

- Chat channel names and topics (app/src/channel_sync.rs): a channel with
  syncDiscord (default on) gets its name and description as its Discord
  name and topic when saved; registering fills them from Discord;
  Discord's form of the name is written back; a topic over 1,024
  characters is refused before saving; a rate-limited edit is pending and
  retried once by itself with the latest text; a missing permission fails
  with the reason and the app keeps the text. Commands
  discord_channel_info and channel_sync_status. Checked on real Discord
  with a temporary channel (fill, edit, rate limit, automatic retry).
- voice.tts.speed (0.5-2.0) on the model screen, passed to the worker as
  --melo-speed. MeloTTS's Korean model has one voice, so no voice choice.
- Closing the window runs AdminApi::shutdown first: an install in
  progress is cancelled and waited for, the services stop, a failed run's
  leftovers (Strata) are cleared (Controller::shutdown). If that fails the
  window stays open with the reason; closing again quits.
- WebView2 data goes in the data folder (cache/webview), or a temp scratch
  folder before one is chosen, removed at the next start: %APPDATA%\JarvisBot
  holds only the location file.
- Command output that is not UTF-8 (CP949 on a PC without the UTF-8
  option) is decoded in the OEM code page instead of ending the reading.

Verified on the win-ci VM: closing during the install leaves no process,
no --location keeps only location.json under %APPDATA%, the unit tests on
Windows 168/168.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 19:23:26 +09:00
parent 76144fb19b
commit 91d0109139
18 changed files with 895 additions and 65 deletions

View File

@@ -165,7 +165,9 @@ The LLM itself (Qwen3.6-35B-A3B, about 23 GB) is downloaded by Strata on its fir
- Every command runs with the layout's environment: `uv`'s cache and Pythons, `HF_HOME`
(`models/hf`), `NLTK_DATA` (`models/nltk`), temp files (`cache/tmp`) and Strata's folders (on
Windows also `APPDATA` and `LOCALAPPDATA`, where Strata and the NVIDIA shader cache write
whatever `STRATA_*` says), all inside the data folder. Python comes from `uv` only. Output lines go to the `install` log tab.
whatever `STRATA_*` says), all inside the data folder. Python comes from `uv` only. Output lines go to the `install` log tab. A line that is not UTF-8 (a
Windows PC without the UTF-8 option prints in its code page, CP949 for Korean) is read in the
PC's OEM code page, never ending the reading.
- Downloads go to `<file>.part`, continue with an HTTP range after a break (a server without ranges
starts over), and are checked against the pinned SHA-256; a wrong checksum deletes the part.
- When every step is done, `uv`'s download cache is cleaned (the venvs hold copies).
@@ -207,6 +209,28 @@ start it first, so nothing answers before the brain can, and stop it last.
`memory/jarvis.db`; 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`)
`docs/v2/conversation.md`, "채널 이름·주제 반영". A chat channel with `syncDiscord` (on by default)
keeps its Discord name and topic in step with its `name` and `description`:
- Registering a channel fills empty name and description with the channel's Discord name and topic
(`discord_channel_info`).
- `settings_apply` with `chatChannels` first refuses a description over Discord's topic limit
(1,024 characters) of a syncing channel, saving nothing. After saving, each syncing channel that
is new, or whose name or description changed, is compared with Discord and edited where they
differ (a new channel never clears a Discord name or topic with an empty field). Discord's form of
the name (spaces become `-`) is written back to the settings so the screen shows it. The results
come back in `sync` (`applied` with the name, `pending` with the wait, `failed` with the reason)
and stay readable with `channel_sync_status`.
- Discord allows about two name or topic edits per channel in ten minutes. A refused edit is
`pending` and tried again by itself after the wait Discord names, with what the settings hold
then; saving again while waiting adds no second retry.
- Without the Manage Channels permission (or any other refusal) the edit is `failed` with the
reason; the app keeps what the user wrote.
- The two calls go to Discord's REST API directly with the stored token (serenity's client would
wait out the rate limit itself, up to ten minutes).
## 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
@@ -222,8 +246,9 @@ back as Korean messages for the screen. The Tauri shell passes the screens' `inv
| `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 |
| `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) |
| `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 |
@@ -263,9 +288,17 @@ URL), so other local programs cannot drive it.
- `jarvis.exe` (crate `jarvis-shell`, Tauri 2 on the WebView2 Windows already has) opens one window
with the screens (`app/ui`) and passes `invoke("admin", {command, args})` to `AdminApi::call`.
`--location FILE` replaces the default location file (`%APPDATA%\JarvisBot\location.json`).
The window's own browser data goes next to the location file (`webview/`), nothing under
`%LOCALAPPDATA%`. Closing the window stops the services and waits until a start in progress is
cancelled (`AdminApi::shutdown`), so nothing the app started keeps running.
The window's own browser data (WebView2) goes in the data folder (`cache/webview`); before the
first-run wizard chose one it is a scratch folder in the system temp folder
(`JarvisBot-webview-<process id>`), which WebView2 holds until the process ends, so the next start
removes it. Nothing goes under `%LOCALAPPDATA%`, and `%APPDATA%\JarvisBot` holds only the
location file.
- Closing the window first runs `AdminApi::shutdown` and closes only when it succeeds: an install in
progress is cancelled and waited for (its commands and their children end), the services stop (a
start in progress is cancelled and waited for, up to 150 s), and after a failed run what may be
left is cleared (`Controller::shutdown`: the LLM's server stopped and confirmed gone). While that
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
@@ -287,7 +320,15 @@ used without Strata, Strata missing, a fake Strata that reports progress, return
stopped, is cancelled during its download and cleared, or fails with its last line, a stop that
fails or hangs while the server still answers, holds connections silently or answers 503 (failed,
not off, also through the controller) and one that fails while the port refuses connections (off);
a stop right after a background start running no launch at all, and the next start not cancelled; a background start that is starting at once, so a stop right after it cancels it
a stop right after a background start running no launch at all, and the next start not cancelled;
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
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, unchanged ones not
edited; through `settings_apply` too); a background start that is starting at once, so a stop right after it cancels it
and a second start is refused, also through the admin commands; a failed stop reported as failed; the brain's
config loaded without writing to the home folder, `tests/test_config_db_path.py`); 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); the admin