task

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package task defines the unified Task model and loaders for both Redis (K8s agents) and local filesystem (Claude Code teams). This is a core package — it must not import bubbletea, lipgloss, or any TUI package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFullResult

func GetFullResult(ctx context.Context, rdb *redis.Client, teamID, taskID string) (string, error)

GetFullResult retrieves the full result for a task. The result_ref field contains either a git branch reference or OTEL span ID pointing to the complete output, while result_summary is truncated to 500 chars.

Types

type Location

type Location string

Location indicates where a task originates from.

const (
	LocationLocal Location = "local"
	LocationK8s   Location = "k8s"
)

type Status

type Status string

Status represents the lifecycle state of a task.

const (
	StatusPending    Status = "pending"
	StatusClaimed    Status = "claimed"
	StatusInProgress Status = "in_progress"
	StatusCompleted  Status = "completed"
	StatusFailed     Status = "failed"
	StatusDead       Status = "dead"
)

type Task

type Task struct {
	ID            string
	Status        Status
	Prompt        string
	RequiredRole  string
	Assignee      string
	DependsOn     []string
	ResultSummary string
	ResultRef     string
	SourceBranch  string
	Error         string
	RetryCount    int
	CreatedAt     time.Time
	CompletedAt   time.Time
	Location      Location
}

Task is the unified task model shared across local and K8s sources.

func LoadFromLocalFiles

func LoadFromLocalFiles(tasksDir string) ([]Task, error)

LoadFromLocalFiles reads all task JSON files from a team's task directory. The directory is typically ~/.claude/tasks/{teamID}/. It reads both task-*.json and *.json files (Claude Code uses both patterns).

func LoadFromRedis

func LoadFromRedis(ctx context.Context, rdb *redis.Client, teamID string) ([]Task, error)

LoadFromRedis loads all tasks for a team by scanning Redis for task hash keys. It uses SCAN (not KEYS) to avoid blocking Redis on large datasets.

func (*Task) IsActive

func (t *Task) IsActive() bool

IsActive returns true if the task is currently being worked on.

func (*Task) IsTerminal

func (t *Task) IsTerminal() bool

IsTerminal returns true if the task is in a final state.

Jump to

Keyboard shortcuts

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