English | 中文
ZeroClaw channel plugin for PeerClaw — a P2P agent identity and trust platform.
This plugin implements ZeroClaw's Channel trait, enabling PeerClaw P2P messaging within ZeroClaw's agent runtime via a local WebSocket bridge.
PeerClaw Agent (Go) ZeroClaw
agent/platform/bridge/ this plugin
│ │
├── ws://localhost:19100 ───►│ (bridge WS client)
│ │
├── chat.send ──────────────►│──► ChannelMessage → Agent
│◄── chat.event ────────────│◄── Agent response → SendMessage
├── chat.inject ────────────►│──► notification
│ │
▼ ▼
P2P Network ZeroClaw Agent
The plugin connects as a WebSocket client to the PeerClaw agent's bridge server. Messages flow bidirectionally:
- Inbound: PeerClaw agent sends
chat.send→ plugin deliversChannelMessage→ ZeroClaw agent processes → AI response - Outbound: ZeroClaw calls
send()→ plugin sendschat.eventframe → PeerClaw agent routes to P2P peer
Add to your Cargo.toml:
[dependencies]
peerclaw-zeroclaw-plugin = { git = "https://github.com/peerclaw/zeroclaw-plugin.git" }use peerclaw_zeroclaw_plugin::PeerClawChannel;
let channel = PeerClawChannel::new("ws://localhost:19100", "my-agent");
// Register with your ZeroClaw runtime...Configure the PeerClaw channel in your ZeroClaw config:
{
"channels": {
"peerclaw": {
"enabled": true,
"bridge_url": "ws://localhost:19100",
"allow_from": []
}
}
}| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | false |
Enable/disable the PeerClaw channel |
bridge_url |
string | "ws://localhost:19100" |
Bridge WebSocket URL |
allow_from |
string[] | [] |
Allowed PeerClaw agent IDs |
On the PeerClaw agent side, configure the bridge platform adapter in your peerclaw.yaml:
platform:
type: bridge
url: "ws://localhost:19100"Simple JSON frames over WebSocket:
Agent → Plugin:
{"type": "chat.send", "data": {"sessionKey": "peerclaw:dm:<peer_id>", "message": "Hello"}}
{"type": "chat.inject", "data": {"sessionKey": "peerclaw:notifications", "message": "[INFO] ...", "label": "notification"}}
{"type": "ping"}Plugin → Agent:
{"type": "chat.event", "data": {"sessionKey": "peerclaw:dm:<peer_id>", "state": "final", "message": "AI response"}}
{"type": "pong"}git clone https://github.com/peerclaw/zeroclaw-plugin.git
cd zeroclaw-plugin
cargo test