Components and Dependencies
Components at a glance
Section titled “Components at a glance”| Component | Directory | Language and build | Deployment |
|---|---|---|---|
| fcitx5 frontend | frontends/fcitx5/ | C++, CMake, links gRPC C++. A separate directory, outside the Cargo workspace | Native, not containerised; built and tested inside a podman container |
| Gateway | gateway/ | Rust, tonic and prost | Container |
| Fake engine | backends/fake/ | Rust, can inject delays and failures, used by all automated tests | Container |
| Doubao engine | backends/doubao/ | Rust, one container that declares both pinyin and voice | Container, with the Wine-hosted Doubao engine inside |
| Generated protocol code | crates/pinshuo-proto/ | Rust, generated from protocol/ | Library, built with the Gateway and the engines |
| Latency probe | tools/probe/ | Rust | Development tool |
| Deployment files | deploy/ | Container images, compose examples, Gateway configuration example |
The Windows (TSF) and macOS frontends are planned and not part of this phase.
Dependencies
Section titled “Dependencies”| Who | Depends on | Through |
|---|---|---|
| Frontend | Gateway | protocol/client/ (gRPC) |
| Gateway | Engines | protocol/engine/ (gRPC); an engine declares in its capabilities whether it offers pinyin or voice |
| Gateway | A future Reducer | protocol/ingest/ (reserved, one-way, asynchronous) |
| Gateway and engines | pinshuo-proto | The same code generated from the .proto files |
| Doubao engine | The Wine-hosted Doubao engine | A bridge subprocess in one container; the engine is exclusive, so only one session uses it at a time |
Dependency rules
Section titled “Dependency rules”- The frontend talks only to the Gateway, never directly to an engine.
- An engine talks to the Gateway only through
protocol/engine/. A new engine is a new container plus an entry in the Gateway configuration. - Capabilities are what the engine declares. The Gateway routes by declared capability only, never by directory or container name.
- In this phase each capability is routed to exactly one engine. If two engines declare the same capability, the Gateway fails at start with a conflict instead of silently picking one.
- Contracts come before code: a change to a contract under
protocol/updates the components and notes that use it in the same commit.
Build toolchain
Section titled “Build toolchain”The Rust parts share one Cargo workspace and one Cargo.lock. The workspace uses protoc-bin-vendored to provide protoc, so neither a developer machine nor a container needs a separate protoc.