Complete BZZZ functionality port to CHORUS
🎭 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>
This commit is contained in:
54
pkg/agentid/ucxl.go
Normal file
54
pkg/agentid/ucxl.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package agentid
|
||||
|
||||
// Define a publisher interface for UCXL
|
||||
type Publisher interface {
|
||||
Publish(address string, data []byte) error
|
||||
}
|
||||
|
||||
// Define a subscriber interface for UCXL messages
|
||||
type Subscriber interface {
|
||||
Subscribe(address string, handler func(data []byte)) error
|
||||
}
|
||||
|
||||
func AnnounceAgentRecord(
|
||||
pub Publisher,
|
||||
agent *AgentRecord,
|
||||
leaderPubKey string,
|
||||
) error {
|
||||
jsonPayload, err := agent.ToJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
encryptedPayload, err := EncryptPayload(jsonPayload, leaderPubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ucxlAddress := "ucxl://any:admin@COOEE:enrol/#/agentid/" +
|
||||
fmt.Sprintf("%d", agent.AssignedID)
|
||||
|
||||
return pub.Publish(ucxlAddress, encryptedPayload)
|
||||
}
|
||||
|
||||
func SetupAgentIDListener(
|
||||
sub Subscriber,
|
||||
privateKey string,
|
||||
handle func(*AgentRecord) error,
|
||||
) error {
|
||||
ucxlAddress := "ucxl://any:admin@COOEE:enrol/#/agentid/*" // wildcard or prefix
|
||||
|
||||
return sub.Subscribe(ucxlAddress, func(data []byte) {
|
||||
decrypted, err := DecryptPayload(data, privateKey)
|
||||
if err != nil {
|
||||
// handle error, log etc.
|
||||
return
|
||||
}
|
||||
agent, err := FromJSON(decrypted)
|
||||
if err != nil {
|
||||
// handle error, log etc.
|
||||
return
|
||||
}
|
||||
_ = handle(agent) // your context store merge or validation
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user