Skip to content

peerclaw/zeroclaw-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 中文

peerclaw-zeroclaw-plugin

License

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.

Architecture

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:

  1. Inbound: PeerClaw agent sends chat.send → plugin delivers ChannelMessage → ZeroClaw agent processes → AI response
  2. Outbound: ZeroClaw calls send() → plugin sends chat.event frame → PeerClaw agent routes to P2P peer

Installation

Add to your Cargo.toml:

[dependencies]
peerclaw-zeroclaw-plugin = { git = "https://github.com/peerclaw/zeroclaw-plugin.git" }

Usage

use peerclaw_zeroclaw_plugin::PeerClawChannel;

let channel = PeerClawChannel::new("ws://localhost:19100", "my-agent");
// Register with your ZeroClaw runtime...

Configuration

Configure the PeerClaw channel in your ZeroClaw config:

{
  "channels": {
    "peerclaw": {
      "enabled": true,
      "bridge_url": "ws://localhost:19100",
      "allow_from": []
    }
  }
}

Configuration Options

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

Agent-Side Setup

On the PeerClaw agent side, configure the bridge platform adapter in your peerclaw.yaml:

platform:
  type: bridge
  url: "ws://localhost:19100"

Bridge Protocol

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"}

Development

git clone https://github.com/peerclaw/zeroclaw-plugin.git
cd zeroclaw-plugin
cargo test

License

Apache-2.0

About

ZeroClaw channel plugin for PeerClaw P2P agent identity and trust

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages