feat(app): M5 step 2, service control and the dashboard data
- control: one Controller starts, stops and restarts the services (stopped, starting, running, stopping, failed); a failed start leaves nothing running and keeps its error with secrets masked. The app binary uses it. - dashboard: built from the core's events alone: the bot's tag, the voice channel, live captions (screen only, cleared on leaving or stopping), the last 20 voice answers split into stages with medians (matched by the new AnswerAsked event), and missed requests without text. - system: memory in use and per NVIDIA GPU its use and VRAM (nvidia-smi). - DiscordCore::voice_members, WorkerClient::hello, the conversation's missed requests shared with the dashboard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,39 @@ STT, LLM and TTS lines go to `stt`, `llm`, `tts` by their worker category), `bro
|
||||
- Errors the voice worker reports to the app (`error` messages: code and request id) are always
|
||||
logged, debug logging or not, so the log screen and the error report show them.
|
||||
|
||||
## Service control (`app/src/control.rs`)
|
||||
|
||||
The dashboard's start and stop buttons, and the app binary itself, run the services through one
|
||||
`Controller` for the data folder: states `stopped`, `starting`, `running`, `stopping`, `failed`
|
||||
(with the error, secrets masked). `start` from stopped or failed only, `stop` from running only;
|
||||
`restart` is stop then start. A start that fails leaves nothing running. Starting reads the
|
||||
settings and the stored token again, so saved changes take effect on the next start.
|
||||
|
||||
## Dashboard data (`app/src/dashboard.rs`)
|
||||
|
||||
`Controller::snapshot()` is everything the dashboard shows, as one JSON-ready value:
|
||||
|
||||
- `state` and `error` (above); `discord`: the bot's tag once connected; `worker`: connected, STT
|
||||
and TTS ready (from the worker's `hello_ok`), restarts of its process.
|
||||
- `voice`: the voice channel Jarvis is in and the people there (ID and display name), as the core
|
||||
reports them to the worker.
|
||||
- `captions`: live captions, the last 30 lines: a speaker's partial transcript is replaced by
|
||||
their next partial and then by the final. On the screen only: never logged, never written,
|
||||
cleared when Jarvis leaves the voice channel or the services stop.
|
||||
- `latency`: the last 20 voice answers, each split into its stages: speech end to final transcript,
|
||||
the brain (answer asked to answer text), the voice (answer text to the first sound) and the
|
||||
total; with the median of each. An answer is matched to its question by the core's
|
||||
`AnswerAsked { id, user }` event (the speech id and the asker) and that user's latest final.
|
||||
- `missed`: the conversation's missed requests (`conversation.spec.md`), newest first, at most 20:
|
||||
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.
|
||||
- `performance`: the performance stage (normal, gaming, paused, and why) comes with game
|
||||
detection in M7; until then `null`.
|
||||
|
||||
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.
|
||||
|
||||
## Tests
|
||||
|
||||
`cargo test`: data folder layout, location file and the environment override, a refused relative
|
||||
@@ -95,5 +128,7 @@ path, free space; settings view with defaults, apply writing only non-defaults,
|
||||
back to its default, keeping unknown keys, refusing a bad value or a result `parse_settings` refuses
|
||||
without touching the file; secrets round trip, file permissions on Unix, masking; log tabs from
|
||||
categories, query filters and follow, files per day and retention, error report bounds, zip size
|
||||
cap, redaction of stored secrets and token-shaped text. Windows-only paths (DPAPI, `%APPDATA%`) are
|
||||
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
|
||||
checked on the Windows VM in the Windows build step.
|
||||
|
||||
Reference in New Issue
Block a user