Expand description
ternlang-runtime — Distributed actor runtime for ternlang
Phase 5.1: synchronous TCP transport for remote agent communication.
Protocol: newline-delimited JSON over TCP. Each message is a single JSON object followed by ‘\n’.
Message types: {“type”:“send”, “agent_id”: 0, “trit”: 1} → send trit to local agent {“type”:“await”, “agent_id”: 0} → run agent handler, return result {“type”:“reply”, “trit”: 1} → response to await {“type”:“error”, “msg”: “…”} → error response
Usage: let node = TernNode::new(“127.0.0.1:7373”); node.listen(); // spawns listener thread node.connect(“127.0.0.1:7374”); // connect to peer node.remote_send(“127.0.0.1:7374”, 0, 1); // send +1 to remote agent 0 let result = node.remote_await(“127.0.0.1:7374”, 0); // get reply
Structs§
- Remote
Agent Ref - A remote agent reference: identifies an agent on a specific node.
- Tern
Node - The ternlang distributed node. Manages local agent mailboxes and TCP connections to peer nodes.
- Wire
Trit - A trit value serialized over the wire: -1, 0, or +1.
Enums§
- Tern
Message - Wire protocol message.