taskapi

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRepoRequest

type AddRepoRequest struct {
	FullName string `json:"full_name"`
}

AddRepoRequest is the request body for adding a repo.

type BulkDeleteTasksRequest

type BulkDeleteTasksRequest struct {
	TaskIDs []string `json:"task_ids"`
}

BulkDeleteTasksRequest is the request body for bulk-deleting tasks.

type CheckStatusResponse

type CheckStatusResponse struct {
	Status           string                   `json:"status"` // "pending", "success", "failure", "error"
	Summary          string                   `json:"summary,omitempty"`
	FailedNames      []string                 `json:"failed_names,omitempty"`
	CheckRunsSkipped bool                     `json:"check_runs_skipped,omitempty"` // True when GitHub Actions checks couldn't be read (fine-grained PAT)
	Checks           []github.IndividualCheck `json:"checks,omitempty"`
}

CheckStatusResponse is the response body for the task check status endpoint.

type CloseRequest

type CloseRequest struct {
	Reason string `json:"reason,omitempty"`
}

CloseRequest is the request body for closing a task.

type CompleteRequest

type CompleteRequest struct {
	Success        bool    `json:"success"`
	Error          string  `json:"error,omitempty"`
	PullRequestURL string  `json:"pull_request_url,omitempty"`
	PRNumber       int     `json:"pr_number,omitempty"`
	AgentStatus    string  `json:"agent_status,omitempty"`
	CostUSD        float64 `json:"cost_usd,omitempty"`
	PrereqFailed   string  `json:"prereq_failed,omitempty"`
	BranchName     string  `json:"branch_name,omitempty"`
	NoChanges      bool    `json:"no_changes,omitempty"`
	Retryable      bool    `json:"retryable,omitempty"`
}

CompleteRequest is the request body for completing a task.

type CreateTaskRequest

type CreateTaskRequest struct {
	Title              string   `json:"title"`
	Description        string   `json:"description"`
	DependsOn          []string `json:"depends_on,omitempty"`
	AcceptanceCriteria []string `json:"acceptance_criteria,omitempty"`
	MaxCostUSD         float64  `json:"max_cost_usd,omitempty"`
	SkipPR             bool     `json:"skip_pr,omitempty"`
	Model              string   `json:"model,omitempty"`
	NotReady           bool     `json:"not_ready,omitempty"`
}

CreateTaskRequest is the request body for creating a task.

type DefaultModelRequest

type DefaultModelRequest struct {
	Model string `json:"model"`
}

DefaultModelRequest is the request body for setting the default model.

type DefaultModelResponse

type DefaultModelResponse struct {
	Model      string `json:"model"`
	Configured bool   `json:"configured"`
}

DefaultModelResponse is the response for getting the default model.

type DiffResponse

type DiffResponse struct {
	Diff string `json:"diff"`
}

DiffResponse is the response body for the task diff endpoint.

type FeedbackRequest

type FeedbackRequest struct {
	Feedback string `json:"feedback"`
}

FeedbackRequest is the request body for providing feedback on a task in review. This re-prompts the agent to iterate on its solution using the user's feedback.

type GitHubTokenStatusResponse

type GitHubTokenStatusResponse struct {
	Configured  bool `json:"configured"`
	FineGrained bool `json:"fine_grained,omitempty"`
}

GitHubTokenStatusResponse indicates whether a GitHub token is configured.

type HTTPHandler

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

HTTPHandler handles task and repo HTTP requests.

func NewHTTPHandler

func NewHTTPHandler(store *task.Store, repoStore *repo.Store, epicStore *epic.Store, githubTokenService *githubtoken.Service, settingService *setting.Service, workerRegistry *workertracker.Registry, models []setting.ModelOption) *HTTPHandler

NewHTTPHandler creates a new HTTPHandler.

func (*HTTPHandler) AddRepo

func (h *HTTPHandler) AddRepo(c echo.Context) error

AddRepo handles POST /repos

func (*HTTPHandler) AppendLogs

func (h *HTTPHandler) AppendLogs(c echo.Context) error

AppendLogs handles POST /tasks/:id/logs

func (*HTTPHandler) BulkDeleteTasks

func (h *HTTPHandler) BulkDeleteTasks(c echo.Context) error

BulkDeleteTasks handles POST /tasks/bulk-delete Deletes multiple tasks by their IDs in a single operation.

func (*HTTPHandler) CloseTask

func (h *HTTPHandler) CloseTask(c echo.Context) error

CloseTask handles POST /tasks/:id/close

func (*HTTPHandler) CompleteTask

func (h *HTTPHandler) CompleteTask(c echo.Context) error

CompleteTask handles POST /tasks/:id/complete

func (*HTTPHandler) CreateTask

func (h *HTTPHandler) CreateTask(c echo.Context) error

CreateTask handles POST /repos/:repo_id/tasks

func (*HTTPHandler) DeleteDefaultModel

func (h *HTTPHandler) DeleteDefaultModel(c echo.Context) error

DeleteDefaultModel handles DELETE /settings/default-model

func (*HTTPHandler) DeleteGitHubToken

func (h *HTTPHandler) DeleteGitHubToken(c echo.Context) error

DeleteGitHubToken handles DELETE /settings/github-token

func (*HTTPHandler) DeleteTask

func (h *HTTPHandler) DeleteTask(c echo.Context) error

DeleteTask handles DELETE /tasks/:id

func (*HTTPHandler) Events

func (h *HTTPHandler) Events(c echo.Context) error

Events handles GET /events as a Server-Sent Events stream. Optionally filtered by ?repo_id=xxx.

func (*HTTPHandler) FeedbackTask

func (h *HTTPHandler) FeedbackTask(c echo.Context) error

FeedbackTask handles POST /tasks/:id/feedback Re-prompts the agent to iterate on a task in review based on user feedback.

func (*HTTPHandler) GetAgentMetrics

func (h *HTTPHandler) GetAgentMetrics(c echo.Context) error

GetAgentMetrics handles GET /agents/metrics Returns a snapshot of current agent activity and performance metrics.

func (*HTTPHandler) GetDefaultModel

func (h *HTTPHandler) GetDefaultModel(c echo.Context) error

GetDefaultModel handles GET /settings/default-model

func (*HTTPHandler) GetGitHubTokenStatus

func (h *HTTPHandler) GetGitHubTokenStatus(c echo.Context) error

GetGitHubTokenStatus handles GET /settings/github-token

func (*HTTPHandler) GetTask

func (h *HTTPHandler) GetTask(c echo.Context) error

GetTask handles GET /tasks/:id

func (*HTTPHandler) GetTaskChecks

func (h *HTTPHandler) GetTaskChecks(c echo.Context) error

GetTaskChecks handles GET /tasks/:id/checks Returns the CI check status for a task's PR from GitHub.

func (*HTTPHandler) GetTaskDiff

func (h *HTTPHandler) GetTaskDiff(c echo.Context) error

GetTaskDiff handles GET /tasks/:id/diff Returns the PR diff for a task from GitHub.

func (*HTTPHandler) Heartbeat

func (h *HTTPHandler) Heartbeat(c echo.Context) error

Heartbeat handles POST /tasks/:id/heartbeat. Returns {"stopped": true} when the task is no longer running — either because it was explicitly stopped, closed, or deleted — so the worker can cancel the agent container immediately and avoid wasting resources.

func (*HTTPHandler) ListAvailableRepos

func (h *HTTPHandler) ListAvailableRepos(c echo.Context) error

ListAvailableRepos handles GET /repos/available

func (*HTTPHandler) ListModels

func (h *HTTPHandler) ListModels(c echo.Context) error

ListModels handles GET /settings/models

func (*HTTPHandler) ListRepos

func (h *HTTPHandler) ListRepos(c echo.Context) error

ListRepos handles GET /repos

func (*HTTPHandler) ListTasksByRepo

func (h *HTTPHandler) ListTasksByRepo(c echo.Context) error

ListTasksByRepo handles GET /repos/:repo_id/tasks

func (*HTTPHandler) MoveToReview

func (h *HTTPHandler) MoveToReview(c echo.Context) error

MoveToReview handles POST /tasks/:id/move-to-review Transitions a failed task back to review status when it has an existing PR or branch. This lets the user treat the existing PR as reviewable despite the agent failure.

func (*HTTPHandler) PollTask

func (h *HTTPHandler) PollTask(c echo.Context) error

PollTask handles GET /tasks/poll Long-polls for a pending task, claiming it atomically. Returns a PollTaskResponse with the task, GitHub token, and repo full name.

func (*HTTPHandler) Register

func (h *HTTPHandler) Register(g *echo.Group)

Register adds the endpoints to the provided Echo router group.

func (*HTTPHandler) RemoveDependency

func (h *HTTPHandler) RemoveDependency(c echo.Context) error

RemoveDependency handles DELETE /tasks/:id/dependency

func (*HTTPHandler) RemoveRepo

func (h *HTTPHandler) RemoveRepo(c echo.Context) error

RemoveRepo handles DELETE /repos/:repo_id

func (*HTTPHandler) RetryTask

func (h *HTTPHandler) RetryTask(c echo.Context) error

RetryTask handles POST /tasks/:id/retry

func (*HTTPHandler) SaveDefaultModel

func (h *HTTPHandler) SaveDefaultModel(c echo.Context) error

SaveDefaultModel handles PUT /settings/default-model

func (*HTTPHandler) SaveGitHubToken

func (h *HTTPHandler) SaveGitHubToken(c echo.Context) error

SaveGitHubToken handles PUT /settings/github-token

func (*HTTPHandler) SetReady

func (h *HTTPHandler) SetReady(c echo.Context) error

SetReady handles PUT /tasks/:id/ready Toggles whether a task is ready to be picked up by workers.

func (*HTTPHandler) StartOverTask

func (h *HTTPHandler) StartOverTask(c echo.Context) error

StartOverTask handles POST /tasks/:id/start-over Resets a task in review or failed status back to pending with fresh metadata. Clears all logs, PR info, agent status, cost, and retry state. Optionally updates title, description, and acceptance criteria. If the task had an open PR, it is closed on GitHub and the branch deleted.

func (*HTTPHandler) StopTask

func (h *HTTPHandler) StopTask(c echo.Context) error

StopTask handles POST /tasks/:id/stop — interrupts a running task. The task transitions from running → pending with ready=false so the worker stops execution and the task won't be picked up until manually retried.

func (*HTTPHandler) StreamLogs

func (h *HTTPHandler) StreamLogs(c echo.Context) error

StreamLogs handles GET /tasks/:id/logs as a Server-Sent Events stream. It streams historical log batches from the database one at a time, then subscribes to the broker for live log events.

func (*HTTPHandler) SyncRepoTasks

func (h *HTTPHandler) SyncRepoTasks(c echo.Context) error

SyncRepoTasks handles POST /repos/:repo_id/tasks/sync

func (*HTTPHandler) SyncTaskStatus

func (h *HTTPHandler) SyncTaskStatus(c echo.Context) error

SyncTaskStatus handles POST /tasks/:id/sync

func (*HTTPHandler) UpdateTask

func (h *HTTPHandler) UpdateTask(c echo.Context) error

UpdateTask handles PATCH /tasks/:id Updates a task that is still in pending status. Rejects updates if the task has transitioned to any other status.

type LogsRequest

type LogsRequest struct {
	Logs    []string `json:"logs"`
	Attempt int      `json:"attempt,omitempty"`
}

LogsRequest is the request body for appending logs.

type PollTaskResponse

type PollTaskResponse struct {
	Task         *task.Task `json:"task"`
	GitHubToken  string     `json:"github_token"`
	RepoFullName string     `json:"repo_full_name"`
}

PollTaskResponse wraps a claimed task with the credentials and repo info needed by the worker to execute it. The GitHub token is included so that workers don't need their own token configuration.

type RemoveDependencyRequest

type RemoveDependencyRequest struct {
	DependsOn string `json:"depends_on"`
}

RemoveDependencyRequest is the request body for removing a dependency from a task.

type RetryTaskRequest

type RetryTaskRequest struct {
	Instructions string `json:"instructions,omitempty"`
}

RetryTaskRequest is the request body for retrying a failed task.

type SaveGitHubTokenRequest

type SaveGitHubTokenRequest struct {
	Token string `json:"token"`
}

SaveGitHubTokenRequest is the request body for saving a GitHub token.

type SetReadyRequest

type SetReadyRequest struct {
	Ready bool `json:"ready"`
}

SetReadyRequest is the request body for toggling a task's ready state.

type StartOverRequest

type StartOverRequest struct {
	Title              *string  `json:"title,omitempty"`
	Description        *string  `json:"description,omitempty"`
	AcceptanceCriteria []string `json:"acceptance_criteria,omitempty"`
}

StartOverRequest is the request body for starting a task over from scratch. All fields are optional — only provided fields are updated; others keep their current values.

type UpdateTaskRequest

type UpdateTaskRequest struct {
	Title              *string  `json:"title,omitempty"`
	Description        *string  `json:"description,omitempty"`
	DependsOn          []string `json:"depends_on,omitempty"`
	AcceptanceCriteria []string `json:"acceptance_criteria,omitempty"`
	MaxCostUSD         *float64 `json:"max_cost_usd,omitempty"`
	SkipPR             *bool    `json:"skip_pr,omitempty"`
	Model              *string  `json:"model,omitempty"`
	NotReady           *bool    `json:"not_ready,omitempty"`
}

UpdateTaskRequest is the request body for updating a pending task. All fields are optional — only provided fields are updated.

Jump to

Keyboard shortcuts

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