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>
5.7 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 |
The pairing code was wrong, expired or already used. The answer is identical in all three cases. (pairing_locked is reserved and no longer returned.) |
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.