Fix Go module imports and add dynamic Ollama model selection with N8N integration

- Fixed module path from github.com/deepblackcloud/bzzz to github.com/anthonyrawlins/bzzz
- Added dynamic Ollama model detection via /api/tags endpoint
- Implemented intelligent model selection through N8N webhook integration
- Added BZZZ_MODEL_SELECTION_WEBHOOK environment variable support
- Fixed GitHub assignee issue by using valid username instead of peer ID
- Added comprehensive model fallback mechanisms
- Updated all import statements across the codebase
- Removed duplicate systemd service file
- Added sandbox execution environment and type definitions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-14 20:26:24 +10:00
parent 1d03d6539b
commit 054fb67767
24 changed files with 1013 additions and 234 deletions

View File

@@ -156,8 +156,10 @@ func (c *Client) ClaimTask(issueNumber int, agentID string) (*Task, error) {
}
// Attempt atomic assignment using GitHub's native assignment
// GitHub only accepts existing usernames, so we'll assign to the repo owner
githubAssignee := "anthonyrawlins"
issueRequest := &github.IssueRequest{
Assignee: &agentID,
Assignee: &githubAssignee,
}
// Add in-progress label
@@ -180,6 +182,23 @@ func (c *Client) ClaimTask(issueNumber int, agentID string) (*Task, error) {
return nil, fmt.Errorf("failed to claim task: %w", err)
}
// Add a comment to track which Bzzz agent claimed this task
claimComment := fmt.Sprintf("🐝 **Task claimed by Bzzz agent:** `%s`\n\nThis task has been automatically claimed by the Bzzz P2P task coordination system.", agentID)
commentRequest := &github.IssueComment{
Body: &claimComment,
}
_, _, err = c.client.Issues.CreateComment(
c.ctx,
c.config.Owner,
c.config.Repository,
issueNumber,
commentRequest,
)
if err != nil {
// Log error but don't fail the claim
fmt.Printf("⚠️ Failed to add claim comment: %v\n", err)
}
// Create a task branch
if err := c.createTaskBranch(issueNumber, agentID); err != nil {
// Log error but don't fail the claim
@@ -315,6 +334,28 @@ func (c *Client) createTaskBranch(issueNumber int, agentID string) error {
return nil
}
// CreatePullRequest creates a new pull request for a completed task.
func (c *Client) CreatePullRequest(issueNumber int, branchName, agentID string) (*github.PullRequest, error) {
title := fmt.Sprintf("fix: resolve issue #%d via bzzz agent %s", issueNumber, agentID)
body := fmt.Sprintf("This pull request resolves issue #%d, and was automatically generated by the Bzzz agent `%s`.", issueNumber, agentID)
head := branchName
base := c.config.BaseBranch
pr := &github.NewPullRequest{
Title: &title,
Body: &body,
Head: &head,
Base: &base,
}
newPR, _, err := c.client.PullRequests.Create(c.ctx, c.config.Owner, c.config.Repository, pr)
if err != nil {
return nil, fmt.Errorf("failed to create pull request: %w", err)
}
return newPR, nil
}
// formatTaskBody formats task details into GitHub issue body
func (c *Client) formatTaskBody(task *Task) string {
body := fmt.Sprintf("**Task Type:** %s\n", task.TaskType)