Files
CHORUS/pkg/agentid/ucxl.go
anthonyrawlins 543ab216f9 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>
2025-09-02 20:02:37 +10:00

55 lines
1.3 KiB
Go

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