Files
DanandClaude Fable 5.2 e1c02d5266 Address Cody review round 2: all ten findings (CODY-001 to CODY-010)
CODY-001 Bridge URL must be HTTPS (HTTP only to loopback), in the client and
         in manifest generation.
CODY-002 Even host calls stay serialised until the SDK call really settles;
         a microphone start that completes after its timeout is followed by
         a stop.
CODY-003 Request id is stored before the first submit and cleared only on a
         definitive answer; lost replies are treated as ambiguous and
         reconciled under the same id; HUD no longer claims "not sent".
CODY-004 Revoking a device cancels its in-flight turns, aborts
         transcription and asks Hermes to stop, from HTTP and CLI paths.
CODY-005 Speech model pinned to a commit with per-file SHA-256; fetched and
         verified ahead of time; verified on every load; never downloaded
         at run time; no unpinned configuration.
CODY-006 State directory 0700, database/WAL/SHM 0600 regardless of umask.
CODY-007 credential_expired handled like unauthorized on every path.
CODY-008 Approval wait start and paused agent deadline persisted and
         restored across restarts (schema v2).
CODY-009 Exactly one conversation create per epoch, sent in sequence, with
         stale results dropped before persistence.
CODY-010 Wrong pairing guesses no longer consume the outstanding code;
         failures are indistinguishable.

Checks: typecheck clean; npm test 182 passed; client build ok;
test:real-stt 11 passed (including with no network); test:real-hermes 9
passed; test:simulator 6 passed; git diff --check clean.

Not reviewed. No physical-device, droplet or production evidence.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-18 19:49:14 -08:00

108 lines
3.6 KiB
Markdown

# Setup
Requirements: Node.js 22.13 or later and a Hermes install with the API server enabled. Speech
recognition is built into the bridge (Whisper on the CPU, about 0.8 GB of memory). The model is
pinned and verified, and the bridge never downloads it by itself: fetch it once (79 MB).
```sh
npm ci
cp .env.example .env # then edit: HERMES_API_KEY at minimum
npm run bridge:cli -- fetch-model # downloads and verifies the pinned speech model
```
The bridge address entered in the app must be `https://`. Plain `http://` is accepted only for
this machine (`localhost`, `127.x.x.x`), which is what the simulator and browser preview use.
## 1. Hermes
Enable the API server for the profile you want to use (see Hermes's "API Server" docs):
```sh
# in that profile's .env
API_SERVER_ENABLED=true
API_SERVER_KEY=<a long random value>
```
Start the gateway, then put the same key in Hermeven's `.env` as `HERMES_API_KEY`. Use a
read-only or test profile first.
## 2. Bridge
```sh
npm run bridge # listens on 127.0.0.1:8787 by default
curl http://127.0.0.1:8787/healthz
```
The phone must reach the bridge over HTTPS. Two workable arrangements:
- a reverse proxy with a certificate in front of the loopback listener, or
- a private network such as Tailscale with its HTTPS certificates.
Then set `HERMEVEN_ALLOWED_ORIGINS` to the origin of the page that calls the bridge. For a
packaged app that value is not documented by Even: open the phone page, expand Diagnostics, read
"Page origin", put that in `.env` and restart the bridge.
## 3. Try it without glasses
```sh
npm run client:dev # http://localhost:5173
```
Add `HERMEVEN_ALLOWED_ORIGINS=http://localhost:5173` to `.env`, restart the bridge, then:
```sh
npm run bridge:cli -- pair # prints a one-time code
```
Open the page, enter the bridge address and the code, and use "Typed question". This browser
preview has no microphone and is not the glasses.
## 4. Simulator
```sh
npm run client:dev
npm run simulate -- http://localhost:5173
```
`npm run simulate` calls the simulator package directly, because with npm 10.9 workspaces the
`evenhub-simulator` command link was not created by `npm ci` on the development machine
(`npm rebuild @evenrealities/evenhub-simulator` also restores it).
The simulator uses your computer's default audio input as the microphone. Add `--aid alsa:null`
on Linux if you do not want it to open one.
## 5. On the glasses
The Even app only allows network requests to origins listed in the app's manifest, so the bridge
origin is supplied when you build:
```sh
export HERMEVEN_BRIDGE_ORIGIN=https://your-bridge.example
npm run -w @hermeven/even-client pack # writes hermeven.ehpk
```
For a first look, sideload the dev server instead: `npm run client:dev`, then
`npx evenhub qr --url http://<your-lan-ip>:5173` and scan it from the Even app (developer mode).
Even's docs say sideloaded apps stop when the phone locks, so lock-screen behaviour has to be
tested with a beta-channel build (`evenhub create`, `evenhub promote --to beta`). Uploading
anything to Even's portal is Dan's call.
Then follow `docs/device-test-plan.md`.
## Operating
```sh
npm run bridge:cli -- devices # list
npm run bridge:cli -- revoke <device-id> # revoke now
```
## Tests
```sh
npm run typecheck
npm test # unit + integration, fakes only
npm run test:simulator # needs a desktop session; opens the simulator window
npm run test:real-hermes # needs the hermes CLI; uses a throwaway HERMES_HOME and a stub model
npm run test:real-stt # runs the built-in Whisper model; first run downloads it
```