open-standards/smart-byte/smart-byte-rs/crates/smart-byte-atproto/src/lib.rs
Transaction Science 6ea90afbed ingest wave A4: 3 crates · smart-byte-atproto + op-openbanking + eoc-distributed
Smart Byte (1 crate, 2127 LOC, 35 tests)
  smart-byte-atproto    ATProto (Bluesky federation) adapter.
                        PLC + did:web resolution; XRPC client; CARv1 encode/decode
                        with CIDv1 (dag-cbor + raw, SHA-256); sketch MST with
                        order-independent BLAKE3 root; Repo + UnsignedCommit /
                        SignedCommit (Ed25519 over CBOR); firehose transport
                        trait + in-memory impl; AT URI ↔ smart-byte AID bridge
                        with SAID commitment.

OpenPay (1 crate, 2397 LOC, 44 tests)
  op-openbanking        UK OBIE R/W v3.1.10/3.1.11, Berlin Group NextGenPSD2
                        XS2A v1.3.13, STET PSD2 v1.7, Australia CDR Banking v1.31,
                        FDX v5/v6, SGFinDex shapes. AISP / PISP / PIIS / VRP
                        traits. FAPI 1.0 Advanced (PS256/ES256, mTLS, RFC 8705
                        certificate binding, JWK registration). Operators wire
                        their own JWS signer + HTTP transport — keeps the crate
                        KMS-agnostic.

EOC (1 crate, 2179 LOC, 32 tests)
  eoc-distributed       Distributed-inference scheduling. Worker trait with
                        Capability + Accelerator (CPU/GPU/TPU/NPU/Mixed) +
                        Load.busyness()/projected_micro_joules()/projected_g_co2e().
                        RoundRobin / LeastBusy / LatencyWeighted / JouleWeighted
                        (default) / CarbonWeighted routers. Work-stealing
                        scheduler. vLLM-style continuous batching with KV-block
                        budget. Ray-Serve-style auto-scaler with cooldown.
                        KV-cache-aware sticky-session routing.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 12:22:09 -04:00

60 lines
2.6 KiB
Rust

//! AT Protocol (Bluesky federation) adapter for Smart Byte.
//!
//! This crate ingests the deployed footprint of the AT Protocol — the
//! federation layer behind Bluesky — into the Smart Byte substrate. It is
//! a *pragmatic* adapter: enough of the protocol to talk to a Personal
//! Data Server (PDS), read and write IPLD CAR-encoded repositories, walk
//! Merkle Search Trees (MSTs), sign repo commits, and bridge AT URIs to
//! Smart Byte [`Aid`][bridge::Aid] / [`Said`][smart_byte_core::Said]
//! identifiers.
//!
//! ## What's covered
//!
//! * **Identity** — [`did_resolver`] delegates DID resolution to
//! [`smart_byte_did`]. `did:web` is fully resolved; `did:plc` resolution
//! is delegated to the operator-configured PLC directory.
//! * **Lexicon** — [`lexicon`] models the typed-JSON-RPC surface of AT
//! Protocol: records with `$type` discriminators, XRPC queries and
//! procedures, and a curated subset of the well-known schemas
//! (`com.atproto.{server,sync,repo}` and `app.bsky.feed.{post,like}`).
//! * **CAR + IPLD** — [`car`] reads and writes AT-style CARv1 files
//! carrying DAG-CBOR blocks with CIDv1/SHA-256.
//! * **MST** — [`mst`] sketches an in-memory Merkle Search Tree with
//! insert / delete / lookup and a stable root hash.
//! * **Repo + commits** — [`repo`] assembles a signed repo commit
//! (`did`, `version`, `data`, `prev`, `sig`) using an Ed25519 key.
//! * **PDS client** — [`pds_client`] is a thin XRPC client suitable for
//! `com.atproto.server.createSession` and friends.
//! * **Firehose** — [`firehose`] consumes `com.atproto.sync.subscribeRepos`
//! events from a mockable transport.
//! * **Bridge** — [`bridge`] maps `at://did:plc:.../collection/rkey`
//! to Smart Byte [`Aid`][bridge::Aid] and back.
//!
//! ## What's intentionally scoped out
//!
//! Full WebSocket firehose plumbing, full Lexicon catalogue, JetStream
//! relay support and on-chain `did:plc` operation auditing are not in
//! this crate. The surfaces are designed so an operator can layer them
//! in without re-shaping the public types.
#![forbid(unsafe_code)]
pub mod bridge;
pub mod car;
pub mod did_resolver;
pub mod error;
pub mod firehose;
pub mod lexicon;
pub mod mst;
pub mod pds_client;
pub mod repo;
pub use bridge::{Aid, AtUri};
pub use car::{CarBlock, CarFile, Cid};
pub use did_resolver::{AtprotoResolver, PlcResolver};
pub use error::AtprotoError;
pub use firehose::{FirehoseClient, FirehoseEvent};
pub use lexicon::{LexiconRecord, XrpcRequest, XrpcResponse};
pub use mst::{Mst, MstEntry};
pub use pds_client::PdsClient;
pub use repo::{Repo, SignedCommit};