feat(app): performance stages move the LLM between the normal and the game placement

- while the services run, game mode decides the stage (perf.rs): a game means the game stage at
  once (or pause with game.pauseInGame); its end brings the normal stage back after
  game.revertSeconds (default 30)
- a change tells the voice worker the LLM switches (llm switching, with a notice), waits until
  the brain has written the answers in progress (llm_idle, at most 2 minutes), restarts the LLM in
  the stage and tells the worker it is ready or paused
- the game stage runs at 16K context, one request at a time, half the engine's CPU threads and
  the game placement (reserve game.reserveGb, default 8, else 2 GiB, else 0 GiB, else pause),
  measured once at that context; every placement of a run counts other programs' memory as it
  was when the services started
- the voice worker gates every LLM use: on switching new work waits (at most 180 s), the first
  spoken request that waits hears the notice once under its own id, on ready all go on, on
  paused nothing is answered
- dashboard: "성능 단계: 게임 중 · 게임에 X GB" / 일시정지; game mode screen: game VRAM, revert
  wait, pause in game

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-14 10:23:21 +09:00
parent b6bd1be6fb
commit 7e096b449e
18 changed files with 746 additions and 68 deletions

View File

@@ -192,8 +192,8 @@ reaches the screen.
percentage, or `X of Y GB` for the model download; none on a line without progress), also before
the services are up; a failure's reason in `note`.
- `game`: the game that game mode is on for, `{name, reason}` (below, "Game detection"), or null.
- `performance`: the performance stage (normal, gaming, paused, and why) comes next in M7; until
then `null`.
- `performance`: `{stage, gameRoomMib}` from the LLM: `normal`, `gaming` (with the graphics memory
the game gets) or `paused` (below, "Performance stages"); null before the services run.
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.
@@ -336,7 +336,34 @@ elsewhere it never sees a game). It never looks at the game's screen.
- `game` (new section): `detect` (게임 감지, on by default), `games` (programs that are games, as
file names, ".exe" may be left out) and `notGames` (programs that are never games); each list at
most 100 names, no folders; `otherRoomGb` (0-8, default 1), the graphics memory the normal
placement leaves for programs opened later (above, "LLM"). Read when the services start.
placement leaves for programs opened later (above, "LLM"); `reserveGb` (0-32, default 8), the
graphics memory a game gets; `revertSeconds` (0-600, default 30), how long after a game ends the
normal stage comes back; `pauseInGame` (default off), stop the LLM while a game runs. Read when
the services start.
## Performance stages (`app/src/perf.rs`, `app/src/services.rs`)
`docs/v2/pc-features.md`, "단계" and "전환 규칙". While the services run, the app moves the LLM
between the normal placement and the game placement as games come and go (not with `llm.url`).
- The stage wanted (checked every second): a game (game mode on) means the game stage at once, or
pause with `pauseInGame`; when it ends the normal stage comes back once `revertSeconds` have
passed with no game, so quitting and starting a game again does not move the model back and
forth.
- A change: the brain is told the LLM switches, with a notice for the first spoken request that
waits ("잠깐만요, 게임 모드로 바꾸는 중이에요", or "잠깐만요, 평소 모드로 돌아가는 중이에요" on the way
back; `voice_worker.spec.md`, "LLM switches"); the app waits until the brain has written the
answers in progress (at most 2 minutes), restarts the LLM in the new stage and tells the brain
it is ready (or paused). A restart that fails leaves the LLM `failed` on the dashboard and the
brain ready (its calls then fail); the stage is not tried again until the wanted stage changes.
- The game stage: context 16,384 (or the settings' smaller one), one request at a time, half the
engine's CPU threads (read from its log at the normal start, else a quarter of the logical CPUs),
and the game placement (`placement.rs`: the reserve beside more than 2 GiB of experts, else
2 GiB, else 0 GiB, else pause), measured once at that context like the normal one. Every
placement of a run counts other programs' memory as it was when the services started (before
the LLM and the STT worker), not from a card that then also holds the worker and the game.
- Pause: the LLM stops (`llm` off, "게임 중 일시정지"); the brain answers nothing until the stage
changes.
- The foreground program is a game, in this order: in `notGames`: no; in `games`: yes
(`registered`); a browser (also the bot's Chrome), video player, the desktop, Discord, a
launcher's own window or this app: no; under a launcher's game folder (the folder after
@@ -568,7 +595,11 @@ the bot's tab, the focus staying in the program the user types into, no taskbar
left after the stop, and the uninstall leaving no device, driver package, registry key or settings
folder. Game detection (`tests/game_watch.rs`): a program started from a Steam game folder (also under
a path with non-ASCII letters) or from a Battle.net game's install folder (a test uninstall entry)
turns game mode on with its name and off once it ends. On every system: game detection's rules
turns game mode on with its name and off once it ends. Performance stages (on every system, with a fake
Strata and card): a game moves the LLM to the game placement (measured once at 16K and one request,
2 GiB on the game PC's numbers, half the 16 engine threads) and back after the wait, pause stops
it, a card with no room for a game pauses, and the stage loop tells the brain switching (with the
notice), waits, restarts and tells it ready, also on the way back. On every system: game detection's rules
(a borderless game, a maximised program, a browser's full-screen video, exclusive full screen,
launcher folders and their own windows, Battle.net games by install folder and their uninstall
entries, non-ASCII paths, the person's lists first, staying on until the game ends,