Documentation
¶
Index ¶
- func ResolveAll(ctx context.Context, repo Repository, ids []string) (titles map[string]string, projectIDs map[string]string)
- func ResolveProjectIDs(ctx context.Context, repo Repository, ids []string) map[string]string
- func ResolveTitles(ctx context.Context, repo Repository, ids []string) map[string]string
- type AssignmentStatus
- type CascadeArchiver
- type CascadeDeleter
- type Repository
- type Server
- func (s *Server) ArchiveTask(ctx context.Context, req *connect.Request[taskguildv1.ArchiveTaskRequest]) (*connect.Response[taskguildv1.ArchiveTaskResponse], error)
- func (s *Server) ArchiveTerminalTasks(ctx context.Context, ...) (*connect.Response[taskguildv1.ArchiveTerminalTasksResponse], error)
- func (s *Server) CreateTask(ctx context.Context, req *connect.Request[taskguildv1.CreateTaskRequest]) (*connect.Response[taskguildv1.CreateTaskResponse], error)
- func (s *Server) DeleteTask(ctx context.Context, req *connect.Request[taskguildv1.DeleteTaskRequest]) (*connect.Response[taskguildv1.DeleteTaskResponse], error)
- func (s *Server) GetTask(ctx context.Context, req *connect.Request[taskguildv1.GetTaskRequest]) (*connect.Response[taskguildv1.GetTaskResponse], error)
- func (s *Server) ListArchivedTasks(ctx context.Context, ...) (*connect.Response[taskguildv1.ListArchivedTasksResponse], error)
- func (s *Server) ListTasks(ctx context.Context, req *connect.Request[taskguildv1.ListTasksRequest]) (*connect.Response[taskguildv1.ListTasksResponse], error)
- func (s *Server) ResumeTask(ctx context.Context, req *connect.Request[taskguildv1.ResumeTaskRequest]) (*connect.Response[taskguildv1.ResumeTaskResponse], error)
- func (s *Server) StopTask(ctx context.Context, req *connect.Request[taskguildv1.StopTaskRequest]) (*connect.Response[taskguildv1.StopTaskResponse], error)
- func (s *Server) UnarchiveTask(ctx context.Context, req *connect.Request[taskguildv1.UnarchiveTaskRequest]) (*connect.Response[taskguildv1.UnarchiveTaskResponse], error)
- func (s *Server) UpdateTask(ctx context.Context, req *connect.Request[taskguildv1.UpdateTaskRequest]) (*connect.Response[taskguildv1.UpdateTaskResponse], error)
- func (s *Server) UpdateTaskStatus(ctx context.Context, req *connect.Request[taskguildv1.UpdateTaskStatusRequest]) (*connect.Response[taskguildv1.UpdateTaskStatusResponse], error)
- type Task
- type TaskResumer
- type TaskStopper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveAll ¶
func ResolveAll(ctx context.Context, repo Repository, ids []string) (titles map[string]string, projectIDs map[string]string)
ResolveAll returns both taskID → title and taskID → projectID maps with a single pass over the task IDs (avoiding duplicate lookups).
func ResolveProjectIDs ¶
ResolveProjectIDs returns a map of taskID → projectID for the given IDs. It checks active tasks first, then falls back to archived tasks. Tasks that cannot be found are silently skipped.
func ResolveTitles ¶
ResolveTitles returns a map of taskID → title for the given IDs. It checks active tasks first, then falls back to archived tasks. Tasks that cannot be found are silently skipped.
Types ¶
type AssignmentStatus ¶
type AssignmentStatus string
const ( AssignmentStatusUnassigned AssignmentStatus = "unassigned" AssignmentStatusPending AssignmentStatus = "pending" AssignmentStatusAssigned AssignmentStatus = "assigned" )
type CascadeArchiver ¶ added in v0.0.46
type CascadeArchiver interface {
NotifyTaskArchived(ctx context.Context, projectID, taskID string) error
NotifyTaskUnarchived(ctx context.Context, projectID, taskID string) error
}
CascadeArchiver updates related records when a task is archived or unarchived. Implemented by repositories that store data keyed by task directory path.
type CascadeDeleter ¶
CascadeDeleter deletes all records belonging to a given task. Implemented by tasklog and interaction repositories.
type Repository ¶
type Repository interface {
Create(ctx context.Context, t *Task) error
Get(ctx context.Context, id string) (*Task, error)
List(ctx context.Context, projectID, workflowID, statusID string, limit, offset int) ([]*Task, int, error)
Update(ctx context.Context, t *Task) error
Delete(ctx context.Context, id string) error
Claim(ctx context.Context, taskID string, agentID string) (*Task, error)
// ReleaseByAgent unassigns all tasks currently assigned to the given agent,
// resetting them to Pending so other agents can claim them.
ReleaseByAgent(ctx context.Context, agentID string) ([]*Task, error)
// ReleaseByAgentExcept is like ReleaseByAgent but keeps tasks whose IDs
// are in the keepSet. This is used during reconnection to avoid disrupting
// tasks that are still actively running on the agent.
ReleaseByAgentExcept(ctx context.Context, agentID string, keepSet map[string]struct{}) ([]*Task, error)
// Archive moves a task from tasks/ to tasks/archived/.
Archive(ctx context.Context, id string) error
// Unarchive moves a task from tasks/archived/ back to tasks/.
Unarchive(ctx context.Context, id string) error
// GetArchived retrieves a single archived task by ID.
GetArchived(ctx context.Context, id string) (*Task, error)
// ListArchived lists archived tasks, optionally filtered by project and workflow.
ListArchived(ctx context.Context, projectID, workflowID string, limit, offset int) ([]*Task, int, error)
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(repo Repository, workflowRepo workflow.Repository, eventBus *eventbus.Bus, stopper TaskStopper, resumer TaskResumer, cascadeArchivers []CascadeArchiver, cascadeDeleters ...CascadeDeleter) *Server
func (*Server) ArchiveTask ¶
func (s *Server) ArchiveTask(ctx context.Context, req *connect.Request[taskguildv1.ArchiveTaskRequest]) (*connect.Response[taskguildv1.ArchiveTaskResponse], error)
func (*Server) ArchiveTerminalTasks ¶
func (s *Server) ArchiveTerminalTasks(ctx context.Context, req *connect.Request[taskguildv1.ArchiveTerminalTasksRequest]) (*connect.Response[taskguildv1.ArchiveTerminalTasksResponse], error)
func (*Server) CreateTask ¶
func (s *Server) CreateTask(ctx context.Context, req *connect.Request[taskguildv1.CreateTaskRequest]) (*connect.Response[taskguildv1.CreateTaskResponse], error)
func (*Server) DeleteTask ¶
func (s *Server) DeleteTask(ctx context.Context, req *connect.Request[taskguildv1.DeleteTaskRequest]) (*connect.Response[taskguildv1.DeleteTaskResponse], error)
func (*Server) GetTask ¶
func (s *Server) GetTask(ctx context.Context, req *connect.Request[taskguildv1.GetTaskRequest]) (*connect.Response[taskguildv1.GetTaskResponse], error)
func (*Server) ListArchivedTasks ¶
func (s *Server) ListArchivedTasks(ctx context.Context, req *connect.Request[taskguildv1.ListArchivedTasksRequest]) (*connect.Response[taskguildv1.ListArchivedTasksResponse], error)
func (*Server) ListTasks ¶
func (s *Server) ListTasks(ctx context.Context, req *connect.Request[taskguildv1.ListTasksRequest]) (*connect.Response[taskguildv1.ListTasksResponse], error)
func (*Server) ResumeTask ¶
func (s *Server) ResumeTask(ctx context.Context, req *connect.Request[taskguildv1.ResumeTaskRequest]) (*connect.Response[taskguildv1.ResumeTaskResponse], error)
func (*Server) StopTask ¶
func (s *Server) StopTask(ctx context.Context, req *connect.Request[taskguildv1.StopTaskRequest]) (*connect.Response[taskguildv1.StopTaskResponse], error)
func (*Server) UnarchiveTask ¶
func (s *Server) UnarchiveTask(ctx context.Context, req *connect.Request[taskguildv1.UnarchiveTaskRequest]) (*connect.Response[taskguildv1.UnarchiveTaskResponse], error)
func (*Server) UpdateTask ¶
func (s *Server) UpdateTask(ctx context.Context, req *connect.Request[taskguildv1.UpdateTaskRequest]) (*connect.Response[taskguildv1.UpdateTaskResponse], error)
func (*Server) UpdateTaskStatus ¶
func (s *Server) UpdateTaskStatus(ctx context.Context, req *connect.Request[taskguildv1.UpdateTaskStatusRequest]) (*connect.Response[taskguildv1.UpdateTaskStatusResponse], error)
type Task ¶
type Task struct {
ID string `yaml:"id"`
ProjectID string `yaml:"project_id"`
WorkflowID string `yaml:"workflow_id"`
Title string `yaml:"title"`
Description string `yaml:"description"`
StatusID string `yaml:"status_id"`
AssignedAgentID string `yaml:"assigned_agent_id"`
AssignmentStatus AssignmentStatus `yaml:"assignment_status"`
Metadata map[string]string `yaml:"metadata"`
UseWorktree bool `yaml:"use_worktree"`
CreatedAt time.Time `yaml:"created_at"`
UpdatedAt time.Time `yaml:"updated_at"`
}
type TaskResumer ¶
TaskResumer re-triggers orchestration for a stopped task.
type TaskStopper ¶
TaskStopper sends a cancel command to the agent running a task.