Skip to content

apomesh-protocol

apomesh-protocol is the wire layer: the prost-generated protobuf types and the ApomeshDaemon gRPC service definition, and nothing else. It is the lowest crate in the workspace — every other crate that touches the wire depends on it, and it depends on no workspace crate. Touch it when a message shape, an RPC, or the Payload event vocabulary changes on the wire; the domain-side conversion lives elsewhere.

  • Layer: wire / protocol. See Control & execution planes for how the wire connects the daemons.
  • Depends on: nothing in the workspace — it is the leaf. Its only dependencies are the codegen stack (prost, prost-types, tonic, tonic-prost).
  • Consumed by: essentially the whole workspace — the substrate runtime (apomesh-substrate), the orchestrator, the worker, the REST API, SmartChat, the state-store adapters, both verticals, the control-plane UI, and the Prometheus sample all mirror or decode its types.
  • The generated protobuf types — the proto module, compiled from proto/apomesh.proto at build time into the wire messages every transport frames.
  • The gRPC service contract — the ApomeshDaemon service trait plus the generated server and client stubs.
  • The Payload event vocabulary — the closed-enum oneof carried on every Envelope, with a stable per-variant tag.
  • Redaction of secret-bearing messages — a hand-written Debug that elides the cleartext credential/token on the five secret-carrying wire messages, so a stray {:?} can never print a secret.
  • What it deliberately does not own — the wire↔domain From impls live in apomesh-substrate (its *::wire modules), because Rust’s orphan rules place the conversion in the crate that owns the domain type. No serde derives ride the prost types.

Payload::variant_name gives you a stable tag for a payload without reaching into its inner shape — the pattern operator-facing projections and logging use:

use apomesh_protocol::Envelope;
// `Envelope.payload` is the closed-enum `oneof` (prost models it as an
// `Option`); `variant_name()` names it for a log line without exposing
// the inner message.
fn log_envelope(env: &Envelope) {
if let Some(payload) = &env.payload {
tracing::info!(variant = payload.variant_name(), "received envelope");
}
}