task

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveAll added in v0.0.7

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 added in v0.0.7

func ResolveProjectIDs(ctx context.Context, repo Repository, ids []string) map[string]string

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 added in v0.0.6

func ResolveTitles(ctx context.Context, repo Repository, ids []string) map[string]string

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 CascadeDeleter added in v0.0.7

type CascadeDeleter interface {
	DeleteByTaskID(ctx context.Context, taskID string) (int, error)
}

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, cascadeDeleters ...CascadeDeleter) *Server

func (*Server) ArchiveTask added in v0.0.2

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"`
	PermissionMode   string            `yaml:"permission_mode"`
	CreatedAt        time.Time         `yaml:"created_at"`
	UpdatedAt        time.Time         `yaml:"updated_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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