49d514c050
Forgebot is a K8s operator + API service for dispatching AI agent jobs from git forge commands. Includes: - CRDs: AgentPool, AgentTask, ProviderQueue, RepositoryBinding - API server with webhook handler, task queue, and comment proxy - Operator controllers for task scheduling and job management - Gitea provider with webhook parsing and signature verification - PostgreSQL database with auto-migration - Woodpecker CI pipelines and multi-stage Dockerfiles
63 lines
2.1 KiB
Go
63 lines
2.1 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type TaskStatus string
|
|
|
|
const (
|
|
StatusPending TaskStatus = "pending"
|
|
StatusRunning TaskStatus = "running"
|
|
StatusSucceeded TaskStatus = "succeeded"
|
|
StatusFailed TaskStatus = "failed"
|
|
StatusCancelled TaskStatus = "cancelled"
|
|
)
|
|
|
|
type Task struct {
|
|
ID string `json:"id"`
|
|
ParentTaskID string `json:"parentTaskId,omitempty"`
|
|
Command string `json:"command"`
|
|
Skill string `json:"skill,omitempty"`
|
|
Repository string `json:"repository"`
|
|
Ref string `json:"ref"`
|
|
IssueNumber int `json:"issueNumber,omitempty"`
|
|
PRNumber int `json:"prNumber,omitempty"`
|
|
CommentID int64 `json:"commentId,omitempty"`
|
|
Body string `json:"body,omitempty"`
|
|
Author string `json:"author"`
|
|
ExtraTools []string `json:"extraTools,omitempty"`
|
|
Status TaskStatus `json:"status"`
|
|
PoolRef string `json:"poolRef,omitempty"`
|
|
JobName string `json:"jobName,omitempty"`
|
|
Result string `json:"result,omitempty"`
|
|
ErrorMessage string `json:"errorMessage,omitempty"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
StartedAt *time.Time `json:"startedAt,omitempty"`
|
|
CompletedAt *time.Time `json:"completedAt,omitempty"`
|
|
}
|
|
|
|
type CreateTaskRequest struct {
|
|
Command string `json:"command"`
|
|
Skill string `json:"skill,omitempty"`
|
|
Repository string `json:"repository"`
|
|
Ref string `json:"ref"`
|
|
IssueNumber int `json:"issueNumber,omitempty"`
|
|
PRNumber int `json:"prNumber,omitempty"`
|
|
CommentID int64 `json:"commentId,omitempty"`
|
|
Body string `json:"body,omitempty"`
|
|
Author string `json:"author"`
|
|
ExtraTools []string `json:"extraTools,omitempty"`
|
|
ParentTaskID string `json:"parentTaskId,omitempty"`
|
|
PoolRef string `json:"poolRef,omitempty"`
|
|
}
|
|
|
|
type UpdateTaskRequest struct {
|
|
Status TaskStatus `json:"status,omitempty"`
|
|
Message string `json:"message,omitempty"`
|
|
JobName string `json:"jobName,omitempty"`
|
|
ErrorMessage string `json:"errorMessage,omitempty"`
|
|
}
|
|
|
|
type CommentRequest struct {
|
|
Body string `json:"body"`
|
|
}
|