English | 中文
nanobot channel plugin for PeerClaw — a P2P agent identity and trust platform.
Community Maintained: This plugin is maintained by the community. Bug reports and PRs are welcome — see CONTRIBUTING.md.
This plugin implements nanobot's BaseChannel interface, enabling PeerClaw P2P messaging within nanobot's AI agent loop via a local WebSocket bridge.
PeerClaw Agent (Go) nanobot
agent/platform/bridge/ this plugin
│ │
├── ws://localhost:19100 ───►│ (bridge WS server)
│ │
├── chat.send ──────────────►│──► MessageBus → AgentLoop → AI
│◄── chat.event ────────────│◄── AI response → OutboundMessage
├── chat.inject ────────────►│──► notification display
│ │
▼ ▼
P2P Network nanobot Agent
The plugin starts a local WebSocket server. The PeerClaw Go agent connects using the bridge adapter (agent/platform/bridge/). Messages flow bidirectionally:
- Inbound: PeerClaw agent sends
chat.send→ plugin calls_handle_message()→ nanobot AgentLoop processes → AI response - Outbound: nanobot calls
send()→ plugin sendschat.eventframe → PeerClaw agent routes to P2P peer
pip install nanobot-channel-peerclawOr install from source:
git clone https://github.com/peerclaw/nanobot-plugin.git
cd nanobot-plugin
pip install -e .The plugin is auto-discovered by nanobot via Python entry points.
After installation, run nanobot onboard to populate the configuration, or manually add to ~/.nanobot/config.json:
{
"channels": {
"peerclaw": {
"enabled": true,
"bridge_host": "localhost",
"bridge_port": 19100,
"allowFrom": []
}
}
}| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | false |
Enable/disable the PeerClaw channel |
bridge_host |
string | "localhost" |
Bridge WebSocket server bind address |
bridge_port |
integer | 19100 |
Bridge WebSocket server port |
allowFrom |
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/nanobot-plugin.git
cd nanobot-plugin
pip install -e ".[dev]"