feat: add environment configuration and SQLite migration support

This commit is contained in:
Zoe
2026-09-19 15:00:32 -05:00
parent 75b3a01aee
commit 118a5387cb
10 changed files with 193 additions and 2 deletions
+13 -1
View File
@@ -4,7 +4,7 @@ Manual SSH and X11 controls. There is **no model loop, persistent conversation,
## On berlin (or your development computer)
Requires Node.js 22+ and an SSH client. Configure an SSH alias `home` for the VM's desktop user, with key authentication. Connect manually first to verify and save its host key:
Requires Node.js 22.13+ (for built-in SQLite) and an SSH client. Configure an SSH alias `home` for the VM's desktop user, with key authentication. Connect manually first to verify and save its host key:
```sh
ssh home
@@ -99,6 +99,18 @@ python3 -m unittest discover -s test -p 'test_*.py'
Desktop dependencies are imported only when operating the display, so validation tests can run without X11 or Pillow.
## Configuration and SQLite
```sh
cp .env.example .env
npm run build
npm run setup:check
```
`.env.example` contains berlin's llama.cpp origin and model ID. Edit `.env` for your installation. The origin excludes `/v1`; future model requests will append the API path. `DATABASE_PATH` defaults to `./data/token.sqlite`, relative to the process working directory. `.env` and database files are ignored by Git. The check validates configuration and opens/checks SQLite; it does not contact the model or operate the desktop.
`src/database.ts` exports a general `openDatabase()` connection using Node's built-in SQLite, with foreign keys, WAL, and a five-second busy timeout. The caller owns the connection and must close it. Use one connection in the eventual supervisor and pass it to domain modules; it is not tied to conversations or logs. Append numbered SQL migrations to `migrations` as actual schemas are introduced (projects, schedules, messages, etc.). Applied migration SQL is recorded and checked against subsequent builds. Pending migrations run transactionally; incompatible history fails rather than silently changing existing data. There is intentionally no speculative domain schema or ORM yet. Back up live databases using a SQLite-aware backup mechanism, not by copying only the main file while WAL is active.
## Next milestone
Once capture, Unicode insertion, key combinations, and shell timeout work on the real VM, add the llama.cpp adapter, durable tool-call records, and a single model/tool loop. Wake/sleep and restart recovery follow. No SSH connection or real graphical session is available in the development sandbox, so those checks must be run on your setup.