MCPcopy Index your code
hub / github.com/cabal-club/cable.rs

github.com/cabal-club/cable.rs @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
356 symbols 889 edges 44 files 143 documented · 40%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

cable.rs

Experimental cable protocol implementation in Rust.

Status: alpha (under active construction; expect changes).

Introduction

The cable.rs implementation is organised as a workspace and includes all of the code required to successfully create cable peers and perform peer-to-peer communication. The workspace is divided into the following four crates:

  • cable : Cable binary payload encoding and decoding (plus post and message types)
  • cable_core : Manager, in-memory store and stream implementations for creating cable peers
  • desert : Serialization and deserialization traits (vendored version; authored by substack)
  • handshake : Cryptographic handshake and message exchange
  • length_prefixed_stream : Decoder to convert a byte stream of varint length-encoded messages into a stream of chunks (vendored version; authored by substack)

There is currently a single cable.rs chat client in the form of cabin; a text-user interface (TUI) written in Rust.

Limitations

The peer-to-peer networking layer of cable has not yet been designed nor implemented. An approach using simple TCP connections between peers is illustrated in the cabin TUI client.

cable.rs currently lacks a persistent data storage solution with keypair management; only an in-memory data store and indexes are available at present.

Getting Started

If you are a developer interested in building or maintaining a chat application using cable.rs, the cable_core library is your best starting point. It provides the higher-level methods for listening and responding to cable messages, database stores and indexes, as well as convenient methods for opening and closing channels.

If you are a developer interested in contributing to cable.rs, the cable protocol specification and the developer / contributor guide below should provide a good starting point.

Developer / Contributor Guide

Wherever possible, idiomatic Rust conventions have been followed regarding code formatting and style. Doc and code comments can be found throughout the codebase and will guide you in any contribution efforts. In addition, there are examples and tests to read and learn from. With all that being said, there is still much room for improvement and contributions are welcome.

Before beginning work on any contributions, please open an issue introducing what you wish to work on. A project maintainer will respond and help to ensure that the intended contribution is a good fit for the project and that you are supported in your efforts. The issue can later be referenced in any subsequent pull-requests.

When it comes to code styling, it's recommended to refer to the codebase and follow the established stylistic conventions. This is not a hard requirement but a consistent codebase helps to facilitate clarity and ease of understanding. When in doubt, open an issue to ask for guidance.

There are many code comments throughout the codebase labelled with TODO; these may provide some inspiration for initial contributions.

Documentation

Compile the documentation and open it in a browser:

cargo doc --open

Additional documentation can be found as code comments in the source.

Tests

Run the test suite:

cargo test

Contact

glyph (glyph@mycelial.technology).

Extension points exported contracts — how you extend this code

State (Interface)
The `State` trait is used to implement the typestate pattern for the `Handshake`. The state machine is as follows: Cli [15 …
handshake/src/lib.rs
ToBytes (Interface)
Serialize a type into a sequence of bytes with unspecified endianness. The implementations for the built-in types are in [8 …
desert/src/lib.rs
Store (Interface)
Storage trait with methods for storing and retrieving cryptographic keypairs, hashes and posts. [1 implementers]
cable_core/src/store.rs
FromBytes (Interface)
Deserialize a sequence of bytes into a type. The implementations for the built-in types are in big endian for this trait [7 …
desert/src/lib.rs
CountBytes (Interface)
Count how many bytes to read from a byte slice for a type and calculate how many bytes the serialization would contain. [6 …
desert/src/lib.rs
ToBytesBE (Interface)
Serialize a type into a sequence of bytes in big endian. [4 implementers]
desert/src/lib.rs
ToBytesLE (Interface)
Serialize a type into a sequence of bytes in little endian. [4 implementers]
desert/src/lib.rs

Core symbols most depended-on inside this repo

length
called by 48
desert/src/varint.rs
encode
called by 45
desert/src/varint.rs
to_bytes
called by 43
cable/src/post.rs
decode
called by 42
desert/src/varint.rs
raise
called by 21
cable/src/error.rs
read_message_from_stream
called by 18
handshake/src/post_handshake.rs
raise
called by 16
desert/src/error.rs
new_req_id
called by 14
cable_core/src/manager.rs

Shape

Method 188
Function 112
Class 33
Enum 12
Interface 11

Languages

Rust100%

Modules by API surface

cable_core/src/store.rs43 symbols
handshake/src/lib.rs41 symbols
cable/src/post.rs40 symbols
cable/src/message.rs38 symbols
cable_core/src/manager.rs32 symbols
desert/src/lib.rs30 symbols
handshake/src/post_handshake.rs11 symbols
handshake/src/version.rs8 symbols
length_prefixed_stream/src/lib.rs7 symbols
length_prefixed_stream/src/error.rs6 symbols
handshake/examples/cli.rs6 symbols
desert/tests/builtins.rs6 symbols

For agents

$ claude mcp add cable.rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact