🎭 CHORUS now contains full BZZZ functionality adapted for containers Core systems ported: - P2P networking (libp2p with DHT and PubSub) - Task coordination (COOEE protocol) - HMMM collaborative reasoning - SHHH encryption and security - SLURP admin election system - UCXL content addressing - UCXI server integration - Hypercore logging system - Health monitoring and graceful shutdown - License validation with KACHING Container adaptations: - Environment variable configuration (no YAML files) - Container-optimized logging to stdout/stderr - Auto-generated agent IDs for container deployments - Docker-first architecture All proven BZZZ P2P protocols, AI integration, and collaboration features are now available in containerized form. Next: Build and test container deployment. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
package pubsub
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// GossipPublisher is a thin wrapper around the BZZZ PubSub system that
|
|
// satisfies the hmmm.PubSubAdapter interface. It ensures that HMMM messages
|
|
// are published as raw JSON payloads to dynamic, per-issue topics.
|
|
type GossipPublisher struct {
|
|
ps *PubSub
|
|
}
|
|
|
|
// NewGossipPublisher creates a new HMMM adapter for the BZZZ pubsub system.
|
|
func NewGossipPublisher(ps *PubSub) *GossipPublisher {
|
|
return &GossipPublisher{ps: ps}
|
|
}
|
|
|
|
// Publish ensures the agent is subscribed to the per-issue topic and then
|
|
// publishes the raw payload. This method is the primary bridge between HMMM's
|
|
// routing logic and BZZZ's underlying gossipsub network.
|
|
//
|
|
// It performs two key actions:
|
|
// 1. Joins the dynamic topic (e.g., "bzzz/meta/issue/42") to ensure message delivery.
|
|
// 2. Publishes the byte payload directly, bypassing the standard BZZZ message envelope.
|
|
func (g *GossipPublisher) Publish(ctx context.Context, topic string, payload []byte) error {
|
|
// 1. Ensure the node is subscribed to the dynamic topic.
|
|
// This is idempotent and safe to call multiple times.
|
|
if err := g.ps.JoinDynamicTopic(topic); err != nil {
|
|
return fmt.Errorf("hmmm adapter failed to join dynamic topic %s: %w", topic, err)
|
|
}
|
|
|
|
// 2. Publish the raw message payload to the topic.
|
|
if err := g.ps.PublishRaw(topic, payload); err != nil {
|
|
return fmt.Errorf("hmmm adapter failed to publish raw message to topic %s: %w", topic, err)
|
|
}
|
|
|
|
return nil
|
|
}
|