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>
5.6 KiB
Bridge API, contract v1
These endpoints are Hermeven's own. They are not Hermes or Even APIs. Schemas live in
packages/contracts/src/schemas.ts and are enforced on every request; the client validates
every response against the same schemas.
All routes except /healthz and /v1/pairing/claim require Authorization: Bearer <device token>.
Every error has the shape:
{ "schema_version": 1, "error": { "code": "conversation_busy", "message": "...", "retryable": true } }
| Method and path | Purpose | Success |
|---|---|---|
GET /healthz |
Liveness only. Returns {"status":"ok","schema_version":1} and nothing else. |
200 |
POST /v1/pairing/claim |
Exchange a single-use pairing code for a device credential. | 201 |
GET /v1/device |
Pairing status, limits, whether the agent is reachable and STT is configured. | 200 |
POST /v1/device/renew |
Rotate the device token. The old token stops working at once. | 200 |
DELETE /v1/device |
Revoke this device and close its conversation. | 200 |
POST /v1/conversations |
Start a new conversation; closes the device's previous one. | 201 |
POST /v1/turns |
Create one turn (text or audio). | 202, or 200 for a duplicate |
GET /v1/turns/{request_id} |
Current state and result. | 200 |
POST /v1/turns/{request_id}/cancel |
Request cancellation. Idempotent. | 200 |
There is no SSE endpoint. Streaming through the Even WebView is undocumented and untested, so polling is the supported path.
Creating a turn
Typed text (Content-Type: application/json):
{
"schema_version": 1,
"request_id": "0b9f6c1e-3c1d-4b1e-9a51-2f6d0f4c8a11",
"conversation_id": "5d0c2c35-6a8f-4f0e-8f55-0d1f7c0b2a90",
"locale": "en-US",
"input": { "kind": "text", "text": "What is on my calendar tomorrow?" }
}
Audio (Content-Type: application/octet-stream): the body is the raw PCM, and the metadata is in
the query string. Audio is never placed in JSON.
POST /v1/turns?schema_version=1&request_id=...&conversation_id=...&locale=en-US
&input_kind=audio&encoding=pcm_s16le&sample_rate=16000&channels=1
| Rule | Value |
|---|---|
| Accepted audio | pcm_s16le, 16000 Hz, 1 channel. Anything else: 415 unsupported_media. |
| Maximum audio | capture cap + 1 second, 992,000 bytes at the default 30 s. Larger: 413. |
| Maximum text | 4,000 characters |
| Unknown fields | rejected (400). A client cannot name a Hermes session or profile. |
| Rate | 20 new turns per minute per device by default. Duplicates do not count. |
request_id is generated by the client and is the idempotency identity. Submitting the same id
with the same content returns the existing turn with "replayed": true. The same id with
different content, or from another device, returns 409 request_id_conflict.
Turn result
{
"schema_version": 1,
"request_id": "...",
"conversation_id": "...",
"state": "done",
"terminal": true,
"outcome": "succeeded",
"cancel_requested": false,
"input_text": "what is on my calendar tomorrow",
"answer_text": "...",
"error": null,
"replayed": false,
"created_at": "2026-11-18T18:00:00.000Z",
"updated_at": "2026-11-18T18:00:04.210Z",
"timings": { "transcribe_ms": 640, "agent_ms": 3410 }
}
state:accepted,transcribing,thinking,approval_required,cancelling,done.outcome(whenterminal):succeeded,incomplete,failed,cancelled,unknown.answer_textis the agent's complete answer. The bridge never shortens it.input_textandanswer_textbecomenullonce the retention window passes.- An HTTP 200 only means the bridge answered. Read
terminalandoutcome.
Error codes
Defined in packages/contracts/src/errors.ts. Codes are stable; a code is never repurposed.
| Code | Meaning | Retryable |
|---|---|---|
invalid_request, unsupported_schema_version, unsupported_media, payload_too_large |
The request was malformed. | no |
unauthorized, credential_expired, forbidden |
Credential missing, revoked or expired. | no |
pairing_invalid, pairing_locked |
Wrong code; too many wrong codes. | no |
not_found |
Unknown, or belongs to another device. | no |
request_id_conflict |
Request id reused for different content. | no |
conversation_busy |
A turn is still running in this conversation. | yes |
conversation_closed |
The conversation was replaced or the device was revoked. | no |
rate_limited |
Too many requests. | yes |
stt_unavailable, stt_failed, stt_timeout, stt_empty |
Transcription did not produce text. Nothing reached the agent. | yes |
interrupted_before_agent |
The bridge restarted before sending. Nothing ran. | yes |
agent_unreachable |
Hermes never received the request. Nothing ran. | yes |
agent_rejected |
Hermes refused the request. Nothing ran. | no |
agent_failed, agent_interrupted |
The agent ran and failed or was interrupted. Actions already taken are not undone. | no |
agent_timeout, approval_timeout |
The bridge stopped the run after a deadline. | no |
agent_incomplete |
The agent stopped short; the answer is partial. | no |
outcome_unknown |
The bridge cannot tell whether the turn ran. Check the agent first. | no |
Operating budgets
Defaults, all configurable. These are limits, not measured performance.
| Budget | Default |
|---|---|
| Capture | 30 s |
| Transcription deadline | 30 s |
| Agent deadline | 120 s, paused while an approval is pending |
| Approval wait | 300 s |
| Grace period to confirm a stop | 30 s |
No latency percentiles are published because none have been measured against a real STT provider, a real model or a real device.