Skip to main content

Crate zerox1_client

Crate zerox1_client 

Source
Expand description

§zerox1-client

Official client SDK for building agents and services on the 0x01 mesh network.

§Quick start

use zerox1_client::{NodeClient, ConversationId};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = NodeClient::new("http://127.0.0.1:9090", None)?;

    // Discover own identity
    let me = client.identity().await?;
    println!("agent_id: {me}");

    // Listen for inbound envelopes
    client.listen_inbox(|env| async move {
        println!("{} from {}", env.msg_type, env.sender);
        Ok(())
    }).await?;

    Ok(())
}

Structs§

ActivityEvent
Activity event broadcast on the aggregator’s GET /ws/activity stream.
AgentId
A 32-byte Ed25519 agent identity, hex-encoded on the wire.
ConversationId
A 16-byte conversation identifier, hex-encoded on the wire.
HostedSendRequest
Request body for POST /hosted/send (hosted-agent mode).
IdentityResponse
Identity response from GET /identity.
InboundEnvelope
Inbound envelope received from GET /ws/inbox.
NodeClient
HTTP client for the local zerox1-node REST API.
SendEnvelopeRequest
Request body for POST /envelopes/send.
SendEnvelopeResponse
Response from POST /envelopes/send.