feat(app): start Strata from the data folder and point the brain at it

M5 step 4, second part. The services start the LLM first: the installed
Strata with the M0 kit's model and normal placement (models in
models/llm, parallel 1, or 2 when a chat channel answers every message,
pictures off, --restart), wait until /v1/models lists the model, and stop
it last. The first start downloads the model; the dashboard shows
Strata's last line and percentage, and stop also cancels a start (the
server is cleared). llm.url uses a server the app does not start.

On every start the app writes config/brain.json (Strata's /v1, the
listed model id, memory/jarvis.db) and hands it to the worker as
JARVIS_CONFIG_PATH. Loading a config with its own db_path no longer
creates ~/.local/share/jarvis.

service_start/service_restart run in the background. Settings gain
llm.context and llm.port (model screen) and llm.url (file only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 17:45:38 +09:00
parent 1a6d6447f6
commit 5c510bb602
16 changed files with 741 additions and 62 deletions

View File

@@ -92,8 +92,12 @@ STT, LLM and TTS lines go to `stt`, `llm`, `tts` by their worker category), `bro
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
(with the error, secrets masked). `start` from stopped or failed only, `stop` from running or
starting; `restart` is stop then start. A start that fails leaves nothing running. A stop while
starting cancels the start (the LLM's model download or load stops and its server is cleared) and
ends in `stopped` without an error; if the start finished anyway, what came up is stopped again.
The screens' `service_start` and `service_restart` return at once and the start runs in the
background (the first start downloads the model); the dashboard shows how it goes. Starting reads the
settings and the stored token again, so saved changes take effect on the next start. Each start
gets a new dashboard fed by that run's events; `stop` ends the feeding (and waits for it) before
the dashboard is forgotten, so an event queued before the stop, or sent by an earlier run, never
@@ -121,6 +125,9 @@ reaches the screen.
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.
- `llm`: the LLM's state (`off`, `starting`, `ready`, `failed`), whether the app runs it
(`managed`), and while starting Strata's last line and last percentage (the model download),
also before the services are up; a failure's reason in `note`.
- `performance`: the performance stage (normal, gaming, paused, and why) comes with game
detection in M7; until then `null`.
@@ -142,8 +149,7 @@ on the game PC (`scripts/m0`). The steps, in order:
| `strata` | Strata's own installer (`install.ps1`, `install.sh` elsewhere) with Strata's state, engine and components under `runtime/strata` and no PATH change |
| `settings` | `voiceWorker` in the settings pointed at the worker venv's Python with `--melo-python <melo venv> --history memory/history.sqlite --brain` (other settings kept); the install is done only once this is written |
The LLM itself (Qwen3.6-35B-A3B, about 23 GB) is downloaded by Strata on its first start, which the
app runs next (M5, later step).
The LLM itself (Qwen3.6-35B-A3B, about 23 GB) is downloaded by Strata on its first start (below).
- A finished step leaves `runtime/.done/<id>` holding its version (the pin; for `worker_env` a hash
of its requirement files), so later runs skip it and a new pin runs it again. Steps run one at a
@@ -162,6 +168,33 @@ app runs next (M5, later step).
## LLM (`app/src/strata.rs`)
The brain answers with one model, Qwen3.6-35B-A3B UD-Q4_K_XL through Strata (M0). The services
start it first, so nothing answers before the brain can, and stop it last.
- **Strata from the data folder** (the default): `strata launch --family qwen36 --model ud-q4_k_xl
--data-dir models/llm --context <llm.context> --vision off --parallel <n> --access local --port
<llm.port> --no-api-key --restart --yes --no-tui`, run like an install command (the layout's
environment, `runtime/strata` as the working folder, one process group, lines to the `llm` log
tab). It downloads the model on the first start, starts the engine and returns; the app then
waits (up to 30 minutes) until `/v1/models` lists the model and takes its id. `--restart`
replaces a server left with other choices; the same choices are reused. `--parallel` is 1 (faster
on a 16 GB card, M0) and 2 when a chat channel answers every message, so its answers do not wait
behind voice answers. Pictures are off until something in v2 sends one. Stopping the services
runs `strata launch --stop`; so does a failed or cancelled start, so nothing half-started keeps
graphics memory. Not installed: the start fails and says to run the install.
- **A server the app does not start**: with `llm.url` (an OpenAI-compatible `/v1` address, in the
settings file only) the app starts nothing; that server must list a model within 30 seconds.
- **Settings**: `llm.context` (default 32768 tokens per request, 4096-262144) and `llm.port`
(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
home folder.
## 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.
@@ -176,7 +209,7 @@ back as Korean messages for the screen. The Tauri shell passes the screens' `inv
| `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 |
| `service_start` / `service_stop` / `service_restart` / `dashboard` | the controller and its snapshot; start and restart run in the background, stop also cancels a start |
| `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 |
@@ -190,13 +223,14 @@ administrator. The log hub writes to the data folder's `logs/` as soon as a fold
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
the model to download, 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. The model step shows the install (each step's state, download
pickers, wake words, then start (which says the first start downloads the LLM). The model step shows the install (each step's state, download
bytes and last line; start, cancel, retry) and goes on only once everything is installed. Each step reached is saved, so a reload or a restart resumes at
that step; only the last step's start finishes it. A stored token lets the bot step go on
without entering it again.
- **Dashboard**: the snapshot every second; the header with start, restart and stop is rebuilt
- **Dashboard**: the snapshot every second; while the LLM starts, a card with its percentage and
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
@@ -218,7 +252,12 @@ back to its default, keeping unknown keys, refusing a bad value or a result `par
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; the controller's state rules with a fake
service starter; the dashboard from made-up events (captions replaced and cleared, latency stages
service starter, a stop while starting (cancelled, or finished and stopped again); the LLM
(launch arguments from the settings and inside the data folder, the second request slot for a chat
channel answering everything, the download percentage, the brain's settings file, a given server
used without Strata, Strata missing, a fake Strata that reports progress, returns, serves and is
stopped, is cancelled during its download and cleared, or fails with its last line; 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
commands (first run: folder then token, the token never returned whole, the wizard resumed at its
step until finished, log files and the zip from the folder choice on, settings and logs through