Skip to content

Protocols and Contracts

The contracts are independent of any language, and the implementations live in the component directories.

DirectoryBetweenNotes
protocol/client/Native frontend ↔ GatewayContains client.proto. Service state (available, degraded, unavailable) is reported per capability
protocol/engine/Gateway ↔ pinyin and voice enginesContains engine.proto. An engine declares capabilities with GetCapabilities and reports health with GetHealth. This contract decides whether an engine can be replaced
protocol/ingest/Gateway → a future ReducerReserved, notes only

client and engine are proposed to use gRPC, with the contracts described in Protocol Buffers. The reasons are that bidirectional streaming suits keystrokes and audio, that .proto is language-independent, and that the HTTP/2 connection is persistent. The decision is still a proposal: it becomes accepted only after a minimal prototype has measured the latency from the frontend to the Gateway and checked how the Windows frontend integrates. See the decision records.

ingest has no transport yet; it will be chosen when the Reducer is built.

When writing .proto files, follow protobuf’s evolution rules: never reuse a field number, and keep new fields optional. A change to a contract updates the components and notes that use it in the same commit.

The Gateway and the engines carry a protocol version. An engine with an incompatible version is marked unavailable with the reason protocol mismatch; the Gateway still starts and retries discovery with backoff.