worker

package
v0.8.2-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentExecution

type AgentExecution interface {
	Wait(context.Context) (AgentResult, error)
	Kill(string) error
}

type AgentExecutionStartedFunc

type AgentExecutionStartedFunc func(context.Context, AgentExecutionStartedInput) error

type AgentExecutionStartedInput

type AgentExecutionStartedInput struct {
	ExecutionID string
	ProjectID   string
	LoopID      string
	RunID       string
	Subtitle    string
	Body        string
	DedupeKey   string
}

type AgentExecutor

type AgentExecutor interface {
	Start(context.Context, AgentRunInput) (AgentExecution, error)
}

type AgentResult

type AgentResult struct {
	Status                       string
	Summary                      string
	Stdout                       string
	Stderr                       string
	ParseStatus                  string
	ChangedFiles                 []string
	Commits                      []string
	Lifecycle                    *lifecycle.State
	TimeoutType                  string
	ConfiguredIdleTimeoutSeconds int64
	ConfiguredMaxRuntimeSeconds  int64
	ElapsedRuntimeSeconds        int64
	LastProgressAt               string
}

type AgentRunInput

type AgentRunInput struct {
	ExecutionID      string
	ProjectID        string
	LoopID           string
	RunID            string
	Prompt           string
	WorkingDirectory string
	Timeout          time.Duration
	HeartbeatTimeout time.Duration
	Metadata         map[string]any
	IdempotencyKey   string
}

type CommitInput

type CommitInput struct {
	RepoPath     string
	WorktreeRoot string
	WorktreePath string
	Message      string
}

type CommitResult

type CommitResult struct{ CommitSHA string }

type CompareBranchesInput added in v0.7.4

type CompareBranchesInput struct {
	Repo       string
	BaseBranch string
	HeadBranch string
	CWD        string
}

type CompareBranchesResult added in v0.7.4

type CompareBranchesResult struct {
	AheadBy      int
	BehindBy     int
	Status       string
	TotalCommits int
}

type CreatePullRequestInput

type CreatePullRequestInput struct {
	Repo       string
	HeadBranch string
	BaseBranch string
	Title      string
	Body       string
	CWD        string
}

type CreatePullRequestResult

type CreatePullRequestResult struct {
	Number int64
	URL    string
}

type CreateWorktreeInput

type CreateWorktreeInput struct {
	ProjectID         string
	RepoPath          string
	WorktreeRoot      string
	Branch            string
	BaseBranch        string
	PRNumber          int64
	ProtectedBranches []string
	CheckoutMode      string
}

type CreateWorktreeResult

type CreateWorktreeResult struct {
	WorktreePath string
	Branch       string
	BaseBranch   string
	HeadSHA      string
	WorktreeID   string
}

type DiscoveryInput

type DiscoveryInput struct {
	ProjectID string
	Repo      string
	Limit     int
	Snapshot  *githubinfra.DiscoverySnapshot
}

type DiscoveryPolicy

type DiscoveryPolicy struct {
	AutoDiscovery              bool
	Labels                     []string
	LabelMode                  config.LabelMode
	RequireAssigneeCurrentUser bool
	RoutedClaimPolicy          networkpolicy.ProjectPolicy
}

type DiscoveryResult

type DiscoveryResult struct {
	CreatedLoopIDs []string
	QueueItems     []storage.QueueItemRecord
	Skipped        int
}

type InspectHeadInput

type InspectHeadInput struct {
	RepoPath     string
	WorktreeRoot string
	WorktreePath string
	BaseRef      string
}

type InspectHeadResult

type InspectHeadResult struct {
	HeadSHA               string
	NewCommitSHAs         []string
	HasUncommittedChanges bool
	ChangedFiles          []string
}

type IssueAssigneesInput

type IssueAssigneesInput struct {
	Repo        string
	IssueNumber int64
	Assignees   []string
	CWD         string
}

type IssueCommentInput

type IssueCommentInput struct {
	Repo        string
	IssueNumber int64
	Body        string
	CWD         string
}

type IssueCommentResult

type IssueCommentResult struct {
	ID  int64
	URL string
}

type IssueDetail

type IssueDetail struct {
	Number        int64
	Title         string
	Body          string
	URL           string
	State         string
	IsPullRequest bool
	AssigneeUsers []networkpolicy.GitHubUser
	Labels        []string
}

type IssueSummary

type IssueSummary struct {
	Number        int64
	Title         string
	Body          string
	URL           string
	Assignees     []string
	AssigneeUsers []networkpolicy.GitHubUser
	Labels        []string
}

type ListOpenIssuesInput

type ListOpenIssuesInput struct {
	Repo     string
	CWD      string
	Limit    int
	Assignee string
	Label    string
	Labels   []string
}

type ListOpenPullRequestsInput

type ListOpenPullRequestsInput struct {
	Repo  string
	CWD   string
	Limit int
	Label string
}

type NetworkStatusGateway added in v0.9.0

type NetworkStatusGateway interface {
	Status(context.Context) (protocol.NodeStatusResponse, error)
}

type Options

type Options struct {
	DB                              *sql.DB
	Repos                           *storage.Repositories
	GitHub                          GitHubGateway
	GitHubCLIAvailable              *bool
	GitHubCLIAutoPROpeningAvailable func(context.Context, string, string) bool
	Git                             GitGateway
	AgentExecutor                   AgentExecutor
	Logger                          bootstrap.Logger
	Now                             func() time.Time
	AgentTimeout                    time.Duration
	AgentIdleTimeout                time.Duration
	ClaimTTL                        time.Duration
	ValidationCommands              []string
	ValidationRunner                ValidationRunner
	AllowAutoCommit                 bool
	AllowAutoPush                   bool
	OpenPRStrategy                  config.OpenPRStrategy
	Disclosure                      *config.DisclosureConfig
	AgentRuntime                    string
	CustomInstructions              *config.Config
	AgentModel                      *string
	RetryBaseDelay                  time.Duration
	RetryMaxAttempts                int64
	OnAgentExecutionStarted         AgentExecutionStartedFunc
	OnRunCompleted                  RunCompletedFunc
	DiscoveryPolicy                 DiscoveryPolicy
	OnQueueItemEnqueued             func()
	Network                         NetworkStatusGateway
}

type PrepareWorktreeInput

type PrepareWorktreeInput struct {
	RepoPath        string
	WorktreeRoot    string
	WorktreePath    string
	Branch          string
	ExpectedHeadSHA string
	Remote          string
}

type PrepareWorktreeResult

type PrepareWorktreeResult struct {
	HeadSHA string
	Clean   bool
}

type ProcessResult

type ProcessResult struct {
	LoopID            string
	RunID             string
	QueueItemID       string
	Status            string
	Summary           string
	FailureKind       QueueFailureKind
	PullRequestNumber int64
}

type PullRequestDetail

type PullRequestDetail struct {
	Number             int64
	Title              string
	Body               string
	URL                string
	State              string
	HeadRefName        string
	BaseRefName        string
	HeadSHA            string
	ReviewRequests     []string
	ReviewRequestUsers []networkpolicy.GitHubUser
}

type PullRequestLabelsInput

type PullRequestLabelsInput struct {
	Repo     string
	PRNumber int64
	Labels   []string
	CWD      string
}

type PullRequestReviewersInput

type PullRequestReviewersInput struct {
	Repo      string
	PRNumber  int64
	Reviewers []string
	CWD       string
}

type PullRequestSummary

type PullRequestSummary struct {
	Number      int64
	URL         string
	State       string
	HeadRefName string
	BaseRefName string
}

type PushInput

type PushInput struct {
	RepoPath          string
	WorktreeRoot      string
	WorktreePath      string
	Branch            string
	Remote            string
	ProtectedBranches []string
}

type QueueFailureKind

type QueueFailureKind string
const (
	FailureRetryableTransient   QueueFailureKind = "retryable_transient"
	FailureRetryableAfterResume QueueFailureKind = "retryable_after_resume"
	FailureNonRetryable         QueueFailureKind = "non_retryable"
	FailureManualIntervention   QueueFailureKind = "manual_intervention"
)

type RestoreWorktreeInput

type RestoreWorktreeInput struct {
	ProjectID            string
	RepoPath             string
	Branch               string
	WorktreeRoot         string
	CheckoutMode         string
	ExpectedWorktreePath string
}

type RestoreWorktreeResult

type RestoreWorktreeResult struct {
	WorktreePath string
	Branch       string
	BaseBranch   string
	HeadSHA      string
	WorktreeID   string
}

type RunCompletedFunc

type RunCompletedFunc func(context.Context, RunCompletedInput) error

type RunCompletedInput

type RunCompletedInput struct {
	ProjectID         string
	LoopID            string
	RunID             string
	Subtitle          string
	Status            string
	Summary           string
	FailureKind       QueueFailureKind
	PullRequestNumber int64
	PullRequestURL    string
}

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func New

func New(options Options) *Runner

func (*Runner) DiscoverIssues

func (r *Runner) DiscoverIssues(ctx context.Context, input DiscoveryInput) (DiscoveryResult, error)

func (*Runner) ProcessClaimedItem

func (r *Runner) ProcessClaimedItem(ctx context.Context, queueItem storage.QueueItemRecord) (ProcessResult, error)

func (*Runner) ProcessClaimedQueueItem

func (r *Runner) ProcessClaimedQueueItem(ctx context.Context, queueItem storage.QueueItemRecord) (*ProcessResult, error)

func (*Runner) ProcessNext

func (r *Runner) ProcessNext(ctx context.Context, claimedBy string) (*ProcessResult, error)

type UpdateIssueCommentInput

type UpdateIssueCommentInput struct {
	Repo      string
	CommentID int64
	Body      string
	CWD       string
}

type UpdatePullRequestBodyInput added in v0.7.1

type UpdatePullRequestBodyInput struct {
	Repo     string
	PRNumber int64
	Body     string
	CWD      string
}

type UpdatePullRequestTitleInput

type UpdatePullRequestTitleInput struct {
	Repo     string
	PRNumber int64
	Title    string
	CWD      string
}

type ValidationInput

type ValidationInput struct {
	CWD      string
	Commands []string
}

type ValidationResult

type ValidationResult struct {
	Passed  bool   `json:"passed"`
	Summary string `json:"summary,omitempty"`
	Output  string `json:"output,omitempty"`
}

type ViewIssueInput

type ViewIssueInput struct {
	Repo        string
	IssueNumber int64
	CWD         string
}

type ViewPullRequestInput

type ViewPullRequestInput struct {
	Repo     string
	PRNumber int64
	CWD      string
}

type WorkerStep

type WorkerStep string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL