Integrate BACKBEAT SDK and resolve KACHING license validation
Major integrations and fixes: - Added BACKBEAT SDK integration for P2P operation timing - Implemented beat-aware status tracking for distributed operations - Added Docker secrets support for secure license management - Resolved KACHING license validation via HTTPS/TLS - Updated docker-compose configuration for clean stack deployment - Disabled rollback policies to prevent deployment failures - Added license credential storage (CHORUS-DEV-MULTI-001) Technical improvements: - BACKBEAT P2P operation tracking with phase management - Enhanced configuration system with file-based secrets - Improved error handling for license validation - Clean separation of KACHING and CHORUS deployment stacks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,13 +7,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"chorus.services/bzzz/pkg/config"
|
||||
"chorus.services/bzzz/pkg/dht"
|
||||
"chorus.services/bzzz/p2p"
|
||||
"chorus/pkg/config"
|
||||
"chorus/pkg/dht"
|
||||
"chorus/p2p"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// ProtocolManager manages the BZZZ v2 protocol components
|
||||
// ProtocolManager manages the CHORUS v2 protocol components
|
||||
type ProtocolManager struct {
|
||||
config *config.Config
|
||||
node *p2p.Node
|
||||
@@ -97,7 +97,7 @@ func (pm *ProtocolManager) IsEnabled() bool {
|
||||
return pm.enabled
|
||||
}
|
||||
|
||||
// ResolveURI resolves a bzzz:// URI to peer addresses
|
||||
// ResolveURI resolves a CHORUS:// URI to peer addresses
|
||||
func (pm *ProtocolManager) ResolveURI(ctx context.Context, uriStr string) (*ResolutionResult, error) {
|
||||
if !pm.enabled {
|
||||
return nil, fmt.Errorf("v2 protocol not enabled")
|
||||
@@ -205,7 +205,7 @@ func (pm *ProtocolManager) announcePeerToDHT(ctx context.Context, capability *Pe
|
||||
}
|
||||
|
||||
// Announce general peer presence
|
||||
if err := dht.Provide(ctx, "bzzz:peer"); err != nil {
|
||||
if err := dht.Provide(ctx, "CHORUS:peer"); err != nil {
|
||||
// Log error but don't fail
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ func (pm *ProtocolManager) FindPeersByRole(ctx context.Context, role string) ([]
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ValidateURI validates a bzzz:// URI
|
||||
// ValidateURI validates a CHORUS:// URI
|
||||
func (pm *ProtocolManager) ValidateURI(uriStr string) error {
|
||||
if !pm.enabled {
|
||||
return fmt.Errorf("v2 protocol not enabled")
|
||||
@@ -259,7 +259,7 @@ func (pm *ProtocolManager) ValidateURI(uriStr string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// CreateURI creates a bzzz:// URI with the given components
|
||||
// CreateURI creates a CHORUS:// URI with the given components
|
||||
func (pm *ProtocolManager) CreateURI(agent, role, project, task, path string) (*BzzzURI, error) {
|
||||
if !pm.enabled {
|
||||
return nil, fmt.Errorf("v2 protocol not enabled")
|
||||
@@ -313,7 +313,7 @@ func (pm *ProtocolManager) getProjectFromConfig() string {
|
||||
}
|
||||
|
||||
// Default project if none can be inferred
|
||||
return "bzzz"
|
||||
return "CHORUS"
|
||||
}
|
||||
|
||||
// GetStats returns protocol statistics
|
||||
|
||||
@@ -151,7 +151,7 @@ func (r *Resolver) UpdatePeerStatus(peerID peer.ID, status string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve resolves a bzzz:// URI to peer addresses
|
||||
// Resolve resolves a CHORUS:// URI to peer addresses
|
||||
func (r *Resolver) Resolve(ctx context.Context, uri *BzzzURI, strategy ...ResolutionStrategy) (*ResolutionResult, error) {
|
||||
if uri == nil {
|
||||
return nil, fmt.Errorf("nil URI")
|
||||
@@ -181,7 +181,7 @@ func (r *Resolver) Resolve(ctx context.Context, uri *BzzzURI, strategy ...Resolu
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ResolveString resolves a bzzz:// URI string to peer addresses
|
||||
// ResolveString resolves a CHORUS:// URI string to peer addresses
|
||||
func (r *Resolver) ResolveString(ctx context.Context, uriStr string, strategy ...ResolutionStrategy) (*ResolutionResult, error) {
|
||||
uri, err := ParseBzzzURI(uriStr)
|
||||
if err != nil {
|
||||
|
||||
@@ -155,7 +155,7 @@ func TestResolveURI(t *testing.T) {
|
||||
})
|
||||
|
||||
// Test exact match
|
||||
uri, err := ParseBzzzURI("bzzz://claude:frontend@chorus:react")
|
||||
uri, err := ParseBzzzURI("CHORUS://claude:frontend@chorus:react")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to parse URI: %v", err)
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func TestResolveURIWithWildcards(t *testing.T) {
|
||||
})
|
||||
|
||||
// Test wildcard match
|
||||
uri, err := ParseBzzzURI("bzzz://claude:*@*:*")
|
||||
uri, err := ParseBzzzURI("CHORUS://claude:*@*:*")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to parse URI: %v", err)
|
||||
}
|
||||
@@ -223,7 +223,7 @@ func TestResolveURIWithOfflinePeers(t *testing.T) {
|
||||
Status: "offline", // This peer should be filtered out
|
||||
})
|
||||
|
||||
uri, err := ParseBzzzURI("bzzz://claude:frontend@*:*")
|
||||
uri, err := ParseBzzzURI("CHORUS://claude:frontend@*:*")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to parse URI: %v", err)
|
||||
}
|
||||
@@ -250,7 +250,7 @@ func TestResolveString(t *testing.T) {
|
||||
})
|
||||
|
||||
ctx := context.Background()
|
||||
result, err := resolver.ResolveString(ctx, "bzzz://claude:frontend@*:*")
|
||||
result, err := resolver.ResolveString(ctx, "CHORUS://claude:frontend@*:*")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to resolve string: %v", err)
|
||||
}
|
||||
@@ -271,7 +271,7 @@ func TestResolverCaching(t *testing.T) {
|
||||
})
|
||||
|
||||
ctx := context.Background()
|
||||
uri := "bzzz://claude:frontend@*:*"
|
||||
uri := "CHORUS://claude:frontend@*:*"
|
||||
|
||||
// First resolution should hit the resolver
|
||||
result1, err := resolver.ResolveString(ctx, uri)
|
||||
@@ -324,7 +324,7 @@ func TestResolutionStrategies(t *testing.T) {
|
||||
})
|
||||
|
||||
ctx := context.Background()
|
||||
uri, _ := ParseBzzzURI("bzzz://claude:frontend@*:*")
|
||||
uri, _ := ParseBzzzURI("CHORUS://claude:frontend@*:*")
|
||||
|
||||
// Test different strategies
|
||||
strategies := []ResolutionStrategy{
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BzzzURI represents a parsed bzzz:// URI with semantic addressing
|
||||
// Grammar: bzzz://[agent]:[role]@[project]:[task]/[path][?query][#fragment]
|
||||
// BzzzURI represents a parsed CHORUS:// URI with semantic addressing
|
||||
// Grammar: CHORUS://[agent]:[role]@[project]:[task]/[path][?query][#fragment]
|
||||
type BzzzURI struct {
|
||||
// Core addressing components
|
||||
Agent string // Agent identifier (e.g., "claude", "any", "*")
|
||||
Role string // Agent role (e.g., "frontend", "backend", "architect")
|
||||
Project string // Project context (e.g., "chorus", "bzzz")
|
||||
Project string // Project context (e.g., "chorus", "CHORUS")
|
||||
Task string // Task identifier (e.g., "implement", "review", "test", "*")
|
||||
|
||||
// Resource path
|
||||
@@ -29,7 +29,7 @@ type BzzzURI struct {
|
||||
|
||||
// URI grammar constants
|
||||
const (
|
||||
BzzzScheme = "bzzz"
|
||||
BzzzScheme = "CHORUS"
|
||||
|
||||
// Special identifiers
|
||||
AnyAgent = "any"
|
||||
@@ -49,10 +49,10 @@ var (
|
||||
pathPattern = regexp.MustCompile(`^/[a-zA-Z0-9\-_/\.]*$|^$`)
|
||||
|
||||
// Full URI pattern for validation
|
||||
bzzzURIPattern = regexp.MustCompile(`^bzzz://([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)@([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)(/[a-zA-Z0-9\-_/\.]*)?(\?[^#]*)?(\#.*)?$`)
|
||||
bzzzURIPattern = regexp.MustCompile(`^CHORUS://([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)@([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)(/[a-zA-Z0-9\-_/\.]*)?(\?[^#]*)?(\#.*)?$`)
|
||||
)
|
||||
|
||||
// ParseBzzzURI parses a bzzz:// URI string into a BzzzURI struct
|
||||
// ParseBzzzURI parses a CHORUS:// URI string into a BzzzURI struct
|
||||
func ParseBzzzURI(uri string) (*BzzzURI, error) {
|
||||
if uri == "" {
|
||||
return nil, fmt.Errorf("empty URI")
|
||||
@@ -292,14 +292,14 @@ func (u *BzzzURI) ToAddress() string {
|
||||
return fmt.Sprintf("%s:%s@%s:%s", u.Agent, u.Role, u.Project, u.Task)
|
||||
}
|
||||
|
||||
// ValidateBzzzURIString validates a bzzz:// URI string without parsing
|
||||
// ValidateBzzzURIString validates a CHORUS:// URI string without parsing
|
||||
func ValidateBzzzURIString(uri string) error {
|
||||
if uri == "" {
|
||||
return fmt.Errorf("empty URI")
|
||||
}
|
||||
|
||||
if !bzzzURIPattern.MatchString(uri) {
|
||||
return fmt.Errorf("invalid bzzz:// URI format")
|
||||
return fmt.Errorf("invalid CHORUS:// URI format")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -13,50 +13,50 @@ func TestParseBzzzURI(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "valid basic URI",
|
||||
uri: "bzzz://claude:frontend@chorus:implement/src/main.go",
|
||||
uri: "CHORUS://claude:frontend@chorus:implement/src/main.go",
|
||||
expected: &BzzzURI{
|
||||
Agent: "claude",
|
||||
Role: "frontend",
|
||||
Project: "chorus",
|
||||
Task: "implement",
|
||||
Path: "/src/main.go",
|
||||
Raw: "bzzz://claude:frontend@chorus:implement/src/main.go",
|
||||
Raw: "CHORUS://claude:frontend@chorus:implement/src/main.go",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "URI with wildcards",
|
||||
uri: "bzzz://any:*@*:test",
|
||||
uri: "CHORUS://any:*@*:test",
|
||||
expected: &BzzzURI{
|
||||
Agent: "any",
|
||||
Role: "*",
|
||||
Project: "*",
|
||||
Task: "test",
|
||||
Raw: "bzzz://any:*@*:test",
|
||||
Raw: "CHORUS://any:*@*:test",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "URI with query and fragment",
|
||||
uri: "bzzz://claude:backend@bzzz:debug/api/handler.go?type=error#line123",
|
||||
uri: "CHORUS://claude:backend@CHORUS:debug/api/handler.go?type=error#line123",
|
||||
expected: &BzzzURI{
|
||||
Agent: "claude",
|
||||
Role: "backend",
|
||||
Project: "bzzz",
|
||||
Project: "CHORUS",
|
||||
Task: "debug",
|
||||
Path: "/api/handler.go",
|
||||
Query: "type=error",
|
||||
Fragment: "line123",
|
||||
Raw: "bzzz://claude:backend@bzzz:debug/api/handler.go?type=error#line123",
|
||||
Raw: "CHORUS://claude:backend@CHORUS:debug/api/handler.go?type=error#line123",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "URI without path",
|
||||
uri: "bzzz://any:architect@project:review",
|
||||
uri: "CHORUS://any:architect@project:review",
|
||||
expected: &BzzzURI{
|
||||
Agent: "any",
|
||||
Role: "architect",
|
||||
Project: "project",
|
||||
Task: "review",
|
||||
Raw: "bzzz://any:architect@project:review",
|
||||
Raw: "CHORUS://any:architect@project:review",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -66,12 +66,12 @@ func TestParseBzzzURI(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "missing role",
|
||||
uri: "bzzz://claude@chorus:implement",
|
||||
uri: "CHORUS://claude@chorus:implement",
|
||||
expectError: true,
|
||||
},
|
||||
{
|
||||
name: "missing task",
|
||||
uri: "bzzz://claude:frontend@chorus",
|
||||
uri: "CHORUS://claude:frontend@chorus",
|
||||
expectError: true,
|
||||
},
|
||||
{
|
||||
@@ -81,7 +81,7 @@ func TestParseBzzzURI(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid format",
|
||||
uri: "bzzz://invalid",
|
||||
uri: "CHORUS://invalid",
|
||||
expectError: true,
|
||||
},
|
||||
}
|
||||
@@ -307,20 +307,20 @@ func TestBzzzURIString(t *testing.T) {
|
||||
Task: "implement",
|
||||
Path: "/src/main.go",
|
||||
},
|
||||
expected: "bzzz://claude:frontend@chorus:implement/src/main.go",
|
||||
expected: "CHORUS://claude:frontend@chorus:implement/src/main.go",
|
||||
},
|
||||
{
|
||||
name: "URI with query and fragment",
|
||||
uri: &BzzzURI{
|
||||
Agent: "claude",
|
||||
Role: "backend",
|
||||
Project: "bzzz",
|
||||
Project: "CHORUS",
|
||||
Task: "debug",
|
||||
Path: "/api/handler.go",
|
||||
Query: "type=error",
|
||||
Fragment: "line123",
|
||||
},
|
||||
expected: "bzzz://claude:backend@bzzz:debug/api/handler.go?type=error#line123",
|
||||
expected: "CHORUS://claude:backend@CHORUS:debug/api/handler.go?type=error#line123",
|
||||
},
|
||||
{
|
||||
name: "URI without path",
|
||||
@@ -330,7 +330,7 @@ func TestBzzzURIString(t *testing.T) {
|
||||
Project: "project",
|
||||
Task: "review",
|
||||
},
|
||||
expected: "bzzz://any:architect@project:review",
|
||||
expected: "CHORUS://any:architect@project:review",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ func TestValidateBzzzURIString(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "valid URI",
|
||||
uri: "bzzz://claude:frontend@chorus:implement/src/main.go",
|
||||
uri: "CHORUS://claude:frontend@chorus:implement/src/main.go",
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user