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,87 @@
import type { HudFrame } from '../core/hud.ts';
import type { DeviceEvent } from './events.ts';
import type { DevicePort } from './port.ts';
/**
* Stand-in for the glasses when the page runs in a plain browser (no Even host).
* Draws the two HUD text areas in the page and offers buttons for the gestures.
* It has NO microphone: a tap that would start recording reports the mic as
* unavailable. Nothing shown here is evidence about real hardware.
*/
export class BrowserPreviewDevice implements DevicePort {
private readonly body = document.createElement('pre');
private readonly status = document.createElement('pre');
private readonly listeners = new Set<(event: DeviceEvent) => void>();
constructor(container: HTMLElement) {
this.body.className = 'hud-body';
this.status.className = 'hud-status';
const label = document.createElement('p');
label.className = 'hint';
label.textContent = 'Browser preview of the HUD text. Not the glasses, not the simulator; fonts and wrapping differ.';
const controls = document.createElement('div');
controls.className = 'row';
const gestures: Array<[string, DeviceEvent]> = [
['Tap', { type: 'tap' }],
['Double-tap', { type: 'double_tap' }],
['Swipe up', { type: 'swipe_up' }],
['Swipe down', { type: 'swipe_down' }],
];
for (const [text, event] of gestures) {
const button = document.createElement('button');
button.type = 'button';
button.className = 'secondary';
button.textContent = text;
button.addEventListener('click', () => this.listeners.forEach((l) => l(event)));
controls.append(button);
}
const screen = document.createElement('div');
screen.className = 'hud';
screen.append(this.body, this.status);
container.append(label, screen, controls);
}
async init(frame: HudFrame): Promise<boolean> {
this.show(frame);
return true;
}
show(frame: HudFrame): void {
this.body.textContent = frame.body;
this.status.textContent = frame.status;
}
async startMic(): Promise<boolean> {
return false;
}
async stopMic(): Promise<void> {}
onEvent(listener: (event: DeviceEvent) => void): () => void {
this.listeners.add(listener);
return () => this.listeners.delete(listener);
}
onConnection(): () => void {
return () => undefined;
}
async requestExit(): Promise<void> {}
async storageGet(key: string): Promise<string> {
try {
return localStorage.getItem(key) ?? '';
} catch {
return '';
}
}
async storageSet(key: string, value: string): Promise<void> {
try {
if (value) localStorage.setItem(key, value);
else localStorage.removeItem(key);
} catch {
/* preview only */
}
}
}