Skip to main content

Crate agent_rooms

Crate agent_rooms 

Source
Expand description

Rust port of the parley protocol core (@p-vbordei/agent-rooms).

This crate ships only the protocol pieces: canonical JSON encoding, Ed25519 keypair / signing / verification, the four signed-payload builders, freshness checks, turn rotation, invite dedup, and an in-memory replay-detection store. No HTTP server, no database, no MCP integration — for those, use the Python packages.

See SPEC.md for the wire protocol. Conformance vectors copied verbatim from the reference repo live in vectors/ and are exercised by tests/conformance.rs.

§Example

use agent_rooms::{canonical, keys, protocol};
use chrono::{TimeZone, Utc};

let sk = [1u8; 32];
let (sk_arr, pk) = (sk, {
    use ed25519_dalek::SigningKey;
    SigningKey::from_bytes(&sk).verifying_key().to_bytes()
});
let created_at = Utc.timestamp_opt(1_777_000_000, 0).unwrap();
let payload = protocol::post_message_payload(
    "00000000-0000-0000-0000-000000000001",
    &keys::to_hex(&pk),
    1,
    "hello",
    &created_at,
);
let sig = keys::sign(&sk_arr, &payload);
assert!(keys::verify(&pk, &payload, &sig));

Re-exports§

pub use error::Error;

Modules§

canonical
Parley simplified canonical JSON — SPEC §4.
error
Parley protocol errors. Mirrors parley/errors.py.
keys
Ed25519 keypair generation, signing, and verification.
models
Parley data model — pure serde structs.
protocol
Pure protocol logic — signed-payload builders, freshness check, turn rotation, replay dedup. Mirrors the non-DB parts of parley/services/{rooms,messages,participants,dedup}.py.