First vertical slice: Even client, bridge, contract v1, tests, docs

Client (apps/even-client): pure interaction reducer with generation-based
stale-result rejection, HUD renderer, measured pagination, Even Hub SDK
0.0.16 adapter, bridge HTTP client, phone pairing/status/diagnostics page.

Bridge (services/bridge): device pairing and revocable expiring credentials,
turn engine with idempotent submit, cancel, deadlines and restart recovery,
Hermes Runs API adapter, OpenAI-compatible STT adapter, operator CLI.

Contract (packages/contracts): versioned schemas, types and error codes.

Tests: 122 unit/integration (fakes), 6 simulator scenarios (Even Hub
simulator 0.9.5), 9 scenarios against a real Hermes v0.23.1 gateway with a
stub model. No real STT, real model or physical device has been exercised;
see docs/test-evidence.md and docs/device-test-plan.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-18 18:21:49 -08:00
co-authored by Claude Fable 5.2
commit 4687cc0114
79 changed files with 11685 additions and 0 deletions
@@ -0,0 +1,18 @@
# 0001: TypeScript monorepo, SQLite, no new services
Status: accepted for the first slice. Date: 2026-11-18.
The repository was empty, so the layout proposed in the specification was adopted as written:
`apps/even-client`, `services/bridge`, `packages/contracts`, `tests`, `docs`.
- One language end to end, so the client and the bridge compile against the same contract types
and JSON Schemas (`@hermeven/contracts`, TypeBox).
- npm workspaces, no build step for the bridge (run with `tsx`). A compiled build can come with
packaging.
- SQLite (better-sqlite3, WAL) for devices, conversation bindings and turn records. Single user,
single process; no database service or queue.
- The operator CLI writes to the SQLite file directly, so the bridge exposes no administrative
endpoint at all.
Consequence: rate limits and in-flight turn workers are in-process. Running two bridge processes
on one database is not supported.
+51
View File
@@ -0,0 +1,51 @@
# 0002: Use the Hermes Runs API, not `/v1/responses`
Status: accepted for the first slice; revisit if the target Hermes differs. Date: 2026-11-18.
## Context
The specification says to use the supported authenticated Hermes API, "normally
`/v1/responses`", and to verify cancellation, idempotency and continuity before relying on it.
Both were checked against hermes-agent v0.23.1 (docs and source), then against a running gateway.
| Need | `/v1/responses` | `/v1/runs` |
|---|---|---|
| Start a turn without holding a connection for its whole duration | No. Non-streaming blocks until the turn ends; streaming holds an SSE connection. | Yes. Returns 202 and a `run_id` at once. |
| Read status later, including after a bridge restart | Only the finished response by id. | `GET /v1/runs/{id}`. |
| Cancel | No endpoint. Only dropping a streaming connection interrupts the agent. | `POST /v1/runs/{id}/stop`; status settles as `cancelled`. |
| Idempotent create | Yes, with replay rules that depend on the response store. | Yes: durable reservation, 24-hour retention, identical retry returns the same `run_id`. |
| Approval-required visible | Not as a pollable state. | `waiting_for_approval`. |
| "Outcome unknown" visible | 409 `unknown_execution` on retry. | `unknown` status. |
| Continuity | `previous_response_id` or `conversation`. | `session_id` (loads that session's transcript). |
## Decision
One adapter (`services/bridge/src/hermes/runsAdapter.ts`) using `POST /v1/runs`,
`GET /v1/runs/{id}` and `POST /v1/runs/{id}/stop`.
- Continuity: each Hermeven conversation owns one bridge-generated Hermes `session_id`
(`hermeven-<uuid>`). It is never accepted from, or shown to, a client.
- Idempotency: `Idempotency-Key: hermeven-turn-<request id>`. The exact request body is persisted
before the first attempt so a retry is byte-identical, and erased once the run id is stored.
- The bridge never calls the approval endpoint.
## Verified
Against a real gateway with a stub model: admission, identical replay
(`Idempotency-Replayed: true`), 409 on a changed body, session continuity (the model received
both user turns), stop settling as `cancelled`, and re-attachment after a bridge restart.
## Not verified
`waiting_for_approval`, `unknown`, `interrupted` and the stopped-short (`completed: false`) shape
are implemented from the source and exercised only against the test fake, because the stub model
calls no tools. They need a run against a real model with a tool that requires approval.
## Consequences
- Polling adds up to one poll interval (500 ms by default) of latency to every answer.
- No token streaming to the HUD. Acceptable: the HUD shows whole pages, and streaming through the
Even WebView is undocumented.
- If the target Hermes runs without the durable run ledger, the idempotency guarantee weakens.
The bridge should check `/v1/capabilities` `runs_idempotency.durable` at startup; that check is
not implemented yet.
+22
View File
@@ -0,0 +1,22 @@
# 0003: Gesture binding for the first slice
Status: provisional until device-tested. Date: 2026-11-18.
The product contract is the set of semantic actions (activate, stop/submit, cancel/back,
next/previous page, new conversation). Gestures are a replaceable binding.
| Action | Binding | Why |
|---|---|---|
| activate, stop/submit | tap | The only gesture every source agrees reaches the app. Tap to start and tap to stop makes the end of capture explicit and deterministic. |
| cancel / back | double tap | Even's submission rules require double tap on the root page to open the OS exit dialog. Treating double tap as "back one level" everywhere makes that the natural end of the same gesture. |
| next / previous page | swipe down / swipe up | Matches Even's text-heavy template. |
| new conversation, cancel request | OS contextual menu items | Keeps a destructive-feeling action off a single accidental gesture. |
Rejected for now:
- **Hold to talk** (long press, release to send). Attractive, but the OS claims tap-then-long-press
for its menu, and the two official sources disagree about how long-press events are routed.
- **End-of-speech detection.** Not attempted. Capture ends on tap, cancel, or the visible cap.
Open for device testing: whether Even treats a double tap that cancels a request (not on the root
page) as acceptable under its exit rule, accidental double-tap rate, and ring behaviour.