WIP: Save agent roles integration work before CHORUS rebrand
- Agent roles and coordination features - Chat API integration testing - New configuration and workspace management 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ type Config struct {
|
||||
GitHub GitHubConfig `yaml:"github"`
|
||||
P2P P2PConfig `yaml:"p2p"`
|
||||
Logging LoggingConfig `yaml:"logging"`
|
||||
HCFS HCFSConfig `yaml:"hcfs"`
|
||||
}
|
||||
|
||||
// HiveAPIConfig holds Hive system integration settings
|
||||
@@ -91,6 +92,32 @@ type LoggingConfig struct {
|
||||
Structured bool `yaml:"structured"`
|
||||
}
|
||||
|
||||
// HCFSConfig holds HCFS integration configuration
|
||||
type HCFSConfig struct {
|
||||
// API settings
|
||||
APIURL string `yaml:"api_url" json:"api_url"`
|
||||
APITimeout time.Duration `yaml:"api_timeout" json:"api_timeout"`
|
||||
|
||||
// Workspace settings
|
||||
MountPath string `yaml:"mount_path" json:"mount_path"`
|
||||
WorkspaceTimeout time.Duration `yaml:"workspace_timeout" json:"workspace_timeout"`
|
||||
|
||||
// FUSE settings
|
||||
FUSEEnabled bool `yaml:"fuse_enabled" json:"fuse_enabled"`
|
||||
FUSEMountPoint string `yaml:"fuse_mount_point" json:"fuse_mount_point"`
|
||||
|
||||
// Cleanup settings
|
||||
IdleCleanupInterval time.Duration `yaml:"idle_cleanup_interval" json:"idle_cleanup_interval"`
|
||||
MaxIdleTime time.Duration `yaml:"max_idle_time" json:"max_idle_time"`
|
||||
|
||||
// Storage settings
|
||||
StoreArtifacts bool `yaml:"store_artifacts" json:"store_artifacts"`
|
||||
CompressArtifacts bool `yaml:"compress_artifacts" json:"compress_artifacts"`
|
||||
|
||||
// Enable/disable HCFS integration
|
||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||
}
|
||||
|
||||
// LoadConfig loads configuration from file, environment variables, and defaults
|
||||
func LoadConfig(configPath string) (*Config, error) {
|
||||
// Start with defaults
|
||||
@@ -156,6 +183,19 @@ func getDefaultConfig() *Config {
|
||||
Output: "stdout",
|
||||
Structured: false,
|
||||
},
|
||||
HCFS: HCFSConfig{
|
||||
APIURL: "http://localhost:8000",
|
||||
APITimeout: 30 * time.Second,
|
||||
MountPath: "/tmp/hcfs-workspaces",
|
||||
WorkspaceTimeout: 2 * time.Hour,
|
||||
FUSEEnabled: false,
|
||||
FUSEMountPoint: "/mnt/hcfs",
|
||||
IdleCleanupInterval: 15 * time.Minute,
|
||||
MaxIdleTime: 1 * time.Hour,
|
||||
StoreArtifacts: true,
|
||||
CompressArtifacts: false,
|
||||
Enabled: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,22 @@ type Repository struct {
|
||||
GitHubTokenRequired bool `json:"github_token_required"`
|
||||
}
|
||||
|
||||
// MonitoredRepository represents a repository being monitored for tasks
|
||||
type MonitoredRepository struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Provider string `json:"provider"` // github, gitea
|
||||
ProviderBaseURL string `json:"provider_base_url"`
|
||||
GitOwner string `json:"git_owner"`
|
||||
GitRepository string `json:"git_repository"`
|
||||
GitBranch string `json:"git_branch"`
|
||||
BzzzEnabled bool `json:"bzzz_enabled"`
|
||||
AutoAssignment bool `json:"auto_assignment"`
|
||||
AccessToken string `json:"access_token,omitempty"`
|
||||
SSHPort int `json:"ssh_port,omitempty"`
|
||||
}
|
||||
|
||||
// ActiveRepositoriesResponse represents the response from /api/bzzz/active-repos
|
||||
type ActiveRepositoriesResponse struct {
|
||||
Repositories []Repository `json:"repositories"`
|
||||
@@ -206,6 +222,78 @@ func (c *HiveClient) UpdateTaskStatus(ctx context.Context, projectID, taskID int
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMonitoredRepositories fetches repositories configured for bzzz monitoring
|
||||
func (c *HiveClient) GetMonitoredRepositories(ctx context.Context) ([]*MonitoredRepository, error) {
|
||||
url := fmt.Sprintf("%s/api/repositories", c.BaseURL)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
|
||||
// Add authentication if API key is provided
|
||||
if c.APIKey != "" {
|
||||
req.Header.Set("Authorization", "Bearer "+c.APIKey)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := c.HTTPClient.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to execute request: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return nil, fmt.Errorf("API request failed with status %d: %s", resp.StatusCode, string(body))
|
||||
}
|
||||
|
||||
var repositories []struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Provider string `json:"provider"`
|
||||
ProviderBaseURL string `json:"provider_base_url"`
|
||||
Owner string `json:"owner"`
|
||||
Repository string `json:"repository"`
|
||||
Branch string `json:"branch"`
|
||||
BzzzEnabled bool `json:"bzzz_enabled"`
|
||||
AutoAssignment bool `json:"auto_assignment"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&repositories); err != nil {
|
||||
return nil, fmt.Errorf("failed to decode response: %w", err)
|
||||
}
|
||||
|
||||
// Convert to MonitoredRepository format
|
||||
var monitoredRepos []*MonitoredRepository
|
||||
for _, repo := range repositories {
|
||||
if repo.BzzzEnabled {
|
||||
monitoredRepo := &MonitoredRepository{
|
||||
ID: repo.ID,
|
||||
Name: repo.Name,
|
||||
Description: repo.Description,
|
||||
Provider: repo.Provider,
|
||||
ProviderBaseURL: repo.ProviderBaseURL,
|
||||
GitOwner: repo.Owner,
|
||||
GitRepository: repo.Repository,
|
||||
GitBranch: repo.Branch,
|
||||
BzzzEnabled: repo.BzzzEnabled,
|
||||
AutoAssignment: repo.AutoAssignment,
|
||||
}
|
||||
|
||||
// Set SSH port for Gitea
|
||||
if repo.Provider == "gitea" {
|
||||
monitoredRepo.SSHPort = 2222
|
||||
}
|
||||
|
||||
monitoredRepos = append(monitoredRepos, monitoredRepo)
|
||||
}
|
||||
}
|
||||
|
||||
return monitoredRepos, nil
|
||||
}
|
||||
|
||||
// HealthCheck verifies connectivity to the Hive API
|
||||
func (c *HiveClient) HealthCheck(ctx context.Context) error {
|
||||
url := fmt.Sprintf("%s/health", c.BaseURL)
|
||||
|
||||
Reference in New Issue
Block a user