Skip to main content

Crate ryu_hardware

Crate ryu_hardware 

Source
Expand description

Ryu Hardware Protocol (RHP v1) node backend — an extracted Core capability crate.

This crate is the node half of the Ryu Hardware Protocol defined in apps/hardware/PROTOCOL.md. Ryu hardware (watch / necklace / desk, all ESP32-S3) talks to a node over a WebSocket, either directly over WiFi (Mode B) or tunneled through the mobile app over BLE (Mode A — transparent to the node).

§Layout

  • protocol — serde structs/enums mirroring PROTOCOL.md §3 (the wire contract shared by the firmware and mobile relay mirrors).
  • store — the device registry (SQLite): paired devices, per-device revocable Bearer tokens, last-seen/battery presence.
  • pairing — pairing-nonce verification and token issuance.
  • codec — the Opus/WAV codec edge, so the rest of Core sees PCM/WAV.
  • session — the per-connection realtime session state machine (audio buffering + the ambient meetings bridge, via the ingest::MeetingIngest seam), the live device-sender registry, and session::SessionOutput/session::TurnInput.
  • ingest — the ingest::MeetingIngest seam inverting the ambient-audio coupling so this crate never links ryu_meetings.
  • feed — the feed::DashboardFeed seam inverting the device-dashboard render coupling so this crate never links ryu_dashboards.
  • nudge — the live display-nudge loop (dashboard change → device re-poll).
  • api — the device-registry CRUD + TRMNL display HTTP surface.

§What stays Core-side (consumers of this crate’s types)

The public ws/pair ingress route (a per-device Bearer/nonce the global RYU_TOKEN require_auth cannot gate, plus node-URL resolution welded to the mesh + the SSRF guard) and the chat-turn orchestration (welded to Core’s run_text_turn / voice ASR / OuteTTS session loop) stay in apps/core and consume this crate’s session::HardwareSession/session::TurnInput/ session::SessionOutput/protocol types — the documented kernel weld, exactly the teams @team-orchestration precedent.

Placement (Core vs Gateway): the device registry, token lifecycle, and the realtime session decide what runs, so they are Core-tier.

Re-exports§

pub use feed::DashboardFeed;
pub use feed::DeviceBinding;
pub use feed::DeviceManifest;
pub use feed::RenderedImage;
pub use feed::ScreenProfile;
pub use feed::SetDeviceResult;
pub use ingest::MeetingIngest;
pub use session::live;
pub use session::HardwareSession;
pub use session::SessionOutput;
pub use session::TurnInput;
pub use store::hash_token;
pub use store::DeviceRecord;
pub use store::DeviceStore;

Modules§

api
HTTP API for the hardware device registry (/api/hardware/*, PROTOCOL.md §6).
codec
Audio bridging for the hardware session: Opus <-> PCM and PCM <-> WAV.
feed
The dashboard feed seam: the minimal contract the hardware device-dashboard renderer + the display-nudge loop need from the Home-dashboards capability, inverted so this kernel crate has ZERO compile-time dependency on ryu_dashboards.
ingest
The meeting ingest seam: the minimal contract the hardware ambient-audio path needs from the meeting-notes capability, inverted so this kernel crate has ZERO compile-time dependency on ryu_meetings.
nudge
Live display nudge: tell a connected device “your dashboard changed, re-poll now” when its bound dashboard’s data updates (review gap #4).
pairing
Pairing: nonce verification + device-token issuance (PROTOCOL.md §5/§6).
protocol
Ryu Hardware Protocol (RHP) v1 — Rust mirror of the wire contract.
session
Per-connection realtime session: the bridge from RHP frames to existing Core seams (PROTOCOL.md §4).
store
Device registry (SQLite) — paired Ryu hardware and their tokens.