FrankenTerm

Distributed Wire Protocol

196 words1 min read3 subsectionsFrom the README at ft 0.15.21

On this page3
Envelope schemaDefensesSafety review

Distributed mode lets remote hosts stream pane state into an aggregator. The wire protocol is designed defensively: every input is validated, dedup'd, and bounded.

Envelope schema

Every message is wrapped in a versioned envelope (crates/frankenterm-core/src/wire_protocol.rs):

rust
pub const PROTOCOL_VERSION: u32 = 1;

pub struct WireEnvelope {
    pub version: u32,        // protocol version for compat checking
    pub seq: u64,            // monotonically increasing per sender (ordering + dedup)
    pub sender: String,      // sender identity (hostname or agent id)
    pub sent_at_ms: i64,     // epoch-ms timestamp; informational only
    pub payload: WirePayload,// typed variants: pane meta, deltas, gaps, detections, …
}

Defenses

  • Versioning — version is the first field; mismatch is a typed rejection.
  • Sender identity validation — at session start, the agent authenticates (token or mTLS); subsequent envelopes are rejected if sender doesn't match the authenticated identity.
  • Per-sender sequence-number dedup — if seq is repeated or arrives out of order, the envelope is rejected. Prevents replay attacks and accidental double-delivery.
  • Bounded message size — enforced at the codec layer via WireProtocolTuning::DEFAULT_MAX_MESSAGE_SIZE. Larger payloads are rejected before allocation.
  • Stale-session pruning — sessions with no activity for DEFAULT_AGENT_STALE_AFTER_MS (5 min default) are pruned by the aggregator.
  • Local receipt-clock decisions — the aggregator never uses remote clocks for liveness or ordering decisions. The sent_at_ms field is informational only; capacity eviction and stale-session pruning are local decisions.
  • TLS recommended for non-loopback binds — [distributed] config supports TLS; tokens from files / env vars (avoid inline). ft doctor --json verifies effective security state.

Safety review

The full safety review and diff-fuzz coverage live in docs/security/distributed-threat-model.md, the producer for the security/distributed-threat-model attestation slot.