Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateRunID() string
- func IsValidStatus(s TaskStatus) bool
- type AddParentLink
- type BurndownPoint
- type Comment
- type Dispatcher
- func (d *Dispatcher) IsCircuitBroken() bool
- func (d *Dispatcher) ResetFailures()
- func (d *Dispatcher) SetMaxConsecutiveFailures(max int)
- func (d *Dispatcher) SetMaxRetries(max int)
- func (d *Dispatcher) SetTickInterval(interval time.Duration)
- func (d *Dispatcher) Start()
- func (d *Dispatcher) Stop()
- func (d *Dispatcher) Tick() error
- type Event
- type KanbanDB
- func (kdb *KanbanDB) AddComment(comment *Comment) error
- func (kdb *KanbanDB) AddEvent(event *Event) error
- func (kdb *KanbanDB) AddLink(parentID, childID string) error
- func (kdb *KanbanDB) AreAllParentsDone(taskID string) (bool, error)
- func (kdb *KanbanDB) ClaimTask(taskID, assignee, runID string) (bool, error)
- func (kdb *KanbanDB) Close() error
- func (kdb *KanbanDB) CreateRun(run *Run) error
- func (kdb *KanbanDB) CreateTask(task *Task) error
- func (kdb *KanbanDB) DeleteTask(id string) error
- func (kdb *KanbanDB) GetBoard(tenant string) (map[TaskStatus][]*Task, error)
- func (kdb *KanbanDB) GetBurndownData(tenant string, days int) ([]BurndownPoint, error)
- func (kdb *KanbanDB) GetChildren(taskID string) ([]*Task, error)
- func (kdb *KanbanDB) GetCurrentRun(taskID string) (*Run, error)
- func (kdb *KanbanDB) GetParents(taskID string) ([]*Task, error)
- func (kdb *KanbanDB) GetReadyTasks() ([]*Task, error)
- func (kdb *KanbanDB) GetRunningTasks() ([]*Task, error)
- func (kdb *KanbanDB) GetStats(tenant string) (map[TaskStatus]int, error)
- func (kdb *KanbanDB) GetTask(id string) (*Task, error)
- func (kdb *KanbanDB) GetTaskWithMeta(id string) (*Task, error)
- func (kdb *KanbanDB) GetThroughputStats(tenant string, days int) (*ThroughputStats, error)
- func (kdb *KanbanDB) GetTodoTasks() ([]*Task, error)
- func (kdb *KanbanDB) Init() error
- func (kdb *KanbanDB) ListComments(taskID string) ([]*Comment, error)
- func (kdb *KanbanDB) ListEvents(taskID string, since time.Time) ([]*Event, error)
- func (kdb *KanbanDB) ListRuns(taskID string) ([]*Run, error)
- func (kdb *KanbanDB) ListTasks(filter TaskFilter) ([]*Task, error)
- func (kdb *KanbanDB) RemoveLink(parentID, childID string) error
- func (kdb *KanbanDB) UpdateRun(run *Run) error
- func (kdb *KanbanDB) UpdateTask(task *Task) error
- func (kdb *KanbanDB) UpdateTaskStatus(id, newStatus, summary string) error
- type Manager
- func (m *Manager) AddComment(taskID, author, body string) (*Comment, error)
- func (m *Manager) AddLink(parentID, childID string) error
- func (m *Manager) ArchiveTask(id string) (*Task, error)
- func (m *Manager) BlockTask(id, reason string) (*Task, error)
- func (m *Manager) ClaimTask(id, assignee string) (*Task, error)
- func (m *Manager) Close() error
- func (m *Manager) CompleteTask(id, summary string) (*Task, error)
- func (m *Manager) CreateTask(title, body, assignee string, opts ...TaskOption) (*Task, error)
- func (m *Manager) CreateTaskWithParent(title, body, assignee, parentID string, opts ...TaskOption) (*Task, error)
- func (m *Manager) DecomposeGoal(ctx context.Context, goalID, goalTitle, goalDescription string, ...) ([]*Task, error)
- func (m *Manager) DeleteTask(id string) error
- func (m *Manager) GetBoard(tenant string) (map[TaskStatus][]*Task, error)
- func (m *Manager) GetBurndownData(tenant string, days int) ([]BurndownPoint, error)
- func (m *Manager) GetChildren(taskID string) ([]*Task, error)
- func (m *Manager) GetDB() *KanbanDB
- func (m *Manager) GetDispatcher() *Dispatcher
- func (m *Manager) GetParents(taskID string) ([]*Task, error)
- func (m *Manager) GetStats(tenant string) (map[TaskStatus]int, error)
- func (m *Manager) GetTask(id string) (*Task, error)
- func (m *Manager) GetThroughputStats(tenant string, days int) (*ThroughputStats, error)
- func (m *Manager) Heartbeat(id string) error
- func (m *Manager) Init() error
- func (m *Manager) ListComments(taskID string) ([]*Comment, error)
- func (m *Manager) ListRuns(taskID string) ([]*Run, error)
- func (m *Manager) ListTasks(filter TaskFilter) ([]*Task, error)
- func (m *Manager) RemoveLink(parentID, childID string) error
- func (m *Manager) SplitTask(ctx context.Context, id string, prov provider.Provider) ([]*Task, error)
- func (m *Manager) StartTask(id string) (*Task, error)
- func (m *Manager) TriageTask(ctx context.Context, id string, prov provider.Provider) (*Task, error)
- func (m *Manager) UnblockTask(id string) (*Task, error)
- func (m *Manager) UpdateTask(id string, updates map[string]interface{}) (*Task, error)
- func (m *Manager) UpdateTaskWithPID(id string, runID string, pid int) error
- type Run
- type Task
- type TaskFilter
- type TaskOption
- func WithAssignee(a string) TaskOption
- func WithBody(b string) TaskOption
- func WithIdempotencyKey(k string) TaskOption
- func WithMaxRuntime(sec int) TaskOption
- func WithParentID(parentID string) TaskOption
- func WithPriority(p int) TaskOption
- func WithSkills(s []string) TaskOption
- func WithTenant(t string) TaskOption
- func WithWorkspace(w string) TaskOption
- type TaskStatus
- type ThroughputStats
Constants ¶
const ( EventCreated = "created" EventStatusChange = "status_changed" EventCommented = "commented" EventCompleted = "completed" EventBlocked = "blocked" EventUnblocked = "unblocked" EventClaimed = "claimed" EventHeartbeat = "heartbeat" EventTimeout = "timeout" EventCrash = "crash" )
EventType constants
const ( RunStatusRunning = "running" RunStatusCompleted = "completed" RunStatusFailed = "failed" RunStatusCrashed = "crashed" RunStatusTimedOut = "timed_out" )
RunStatus constants
Variables ¶
var ValidStatuses = []TaskStatus{ StatusTriage, StatusTodo, StatusReady, StatusRunning, StatusBlocked, StatusDone, StatusArchived, }
ValidStatuses contains all valid task statuses
Functions ¶
func IsValidStatus ¶
func IsValidStatus(s TaskStatus) bool
IsValidStatus checks if a status is valid
Types ¶
type AddParentLink ¶
type AddParentLink struct {
ParentID string
}
AddParentLink is a helper to add a parent link during task creation
type BurndownPoint ¶ added in v0.4.8
type BurndownPoint struct {
Date string `json:"date"`
Total int `json:"total"` // Total tasks at start of day
Remaining int `json:"remaining"` // Tasks not done
Completed int `json:"completed"` // Tasks completed that day
Added int `json:"added"` // Tasks added that day
}
BurndownPoint represents a point in the burndown chart
type Comment ¶
type Comment struct {
ID string `json:"id"`
TaskID string `json:"task_id"`
Author string `json:"author"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
}
Comment represents a task comment
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher manages task dispatch and lifecycle
func NewDispatcher ¶
func NewDispatcher(db *KanbanDB) *Dispatcher
NewDispatcher creates a new dispatcher
func (*Dispatcher) IsCircuitBroken ¶
func (d *Dispatcher) IsCircuitBroken() bool
IsCircuitBroken returns true if the dispatcher has too many consecutive failures
func (*Dispatcher) ResetFailures ¶
func (d *Dispatcher) ResetFailures()
ResetFailures resets the consecutive failure counter
func (*Dispatcher) SetMaxConsecutiveFailures ¶
func (d *Dispatcher) SetMaxConsecutiveFailures(max int)
SetMaxConsecutiveFailures sets the maximum consecutive failures before circuit break
func (*Dispatcher) SetMaxRetries ¶
func (d *Dispatcher) SetMaxRetries(max int)
SetMaxRetries sets the maximum retries
func (*Dispatcher) SetTickInterval ¶
func (d *Dispatcher) SetTickInterval(interval time.Duration)
SetTickInterval sets the tick interval
type Event ¶
type Event struct {
ID string `json:"id"`
TaskID string `json:"task_id"`
EventType string `json:"event_type"` // created/status_changed/commented/completed/blocked/unblocked
Payload string `json:"payload"` // JSON
CreatedAt time.Time `json:"created_at"`
}
Event represents a task event for notifications
type KanbanDB ¶
type KanbanDB struct {
// contains filtered or unexported fields
}
KanbanDB manages the kanban SQLite database
func NewKanbanDB ¶
NewKanbanDB creates a new KanbanDB instance
func (*KanbanDB) AddComment ¶
AddComment adds a comment to a task
func (*KanbanDB) AreAllParentsDone ¶
AreAllParentsDone checks if all parent tasks are done
func (*KanbanDB) CreateTask ¶
CreateTask creates a new task
func (*KanbanDB) DeleteTask ¶
DeleteTask deletes a task by ID
func (*KanbanDB) GetBoard ¶
func (kdb *KanbanDB) GetBoard(tenant string) (map[TaskStatus][]*Task, error)
GetBoard returns tasks grouped by status for board view
func (*KanbanDB) GetBurndownData ¶ added in v0.4.8
func (kdb *KanbanDB) GetBurndownData(tenant string, days int) ([]BurndownPoint, error)
GetBurndownData returns burndown chart data for the last N days
func (*KanbanDB) GetChildren ¶
GetChildren gets all child tasks of a task
func (*KanbanDB) GetCurrentRun ¶
GetCurrentRun gets the current running task for a task
func (*KanbanDB) GetParents ¶
GetParents gets all parent tasks of a task
func (*KanbanDB) GetReadyTasks ¶
GetReadyTasks gets all ready tasks (for dispatcher)
func (*KanbanDB) GetRunningTasks ¶
GetRunningTasks gets all running tasks (for dispatcher)
func (*KanbanDB) GetStats ¶
func (kdb *KanbanDB) GetStats(tenant string) (map[TaskStatus]int, error)
GetStats returns task counts by status
func (*KanbanDB) GetTaskWithMeta ¶
GetTaskWithMeta gets a task with metadata (parent count, comment count, etc.)
func (*KanbanDB) GetThroughputStats ¶ added in v0.4.8
func (kdb *KanbanDB) GetThroughputStats(tenant string, days int) (*ThroughputStats, error)
GetThroughputStats returns task throughput statistics
func (*KanbanDB) GetTodoTasks ¶
GetTodoTasks gets all todo tasks (for dispatcher)
func (*KanbanDB) ListComments ¶
ListComments lists comments for a task
func (*KanbanDB) ListEvents ¶
ListEvents lists events for a task since a given time
func (*KanbanDB) ListTasks ¶
func (kdb *KanbanDB) ListTasks(filter TaskFilter) ([]*Task, error)
ListTasks lists tasks with optional filters
func (*KanbanDB) RemoveLink ¶
RemoveLink removes a parent-child link
func (*KanbanDB) UpdateTask ¶
UpdateTask updates a task
func (*KanbanDB) UpdateTaskStatus ¶
UpdateTaskStatus updates a task's status
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides high-level kanban operations
func NewManager ¶
NewManager creates a new kanban manager
func (*Manager) AddComment ¶
AddComment adds a comment to a task
func (*Manager) ArchiveTask ¶
ArchiveTask moves a done task to archived
func (*Manager) CompleteTask ¶
CompleteTask marks a running task as done
func (*Manager) CreateTask ¶
func (m *Manager) CreateTask(title, body, assignee string, opts ...TaskOption) (*Task, error)
CreateTask creates a new task
func (*Manager) CreateTaskWithParent ¶
func (m *Manager) CreateTaskWithParent(title, body, assignee, parentID string, opts ...TaskOption) (*Task, error)
CreateTaskWithParent creates a task and links it to a parent
func (*Manager) DecomposeGoal ¶ added in v0.4.13
func (m *Manager) DecomposeGoal(ctx context.Context, goalID, goalTitle, goalDescription string, prov provider.Provider) ([]*Task, error)
DecomposeGoal uses LLM to break down a goal into a set of actionable kanban tasks
func (*Manager) DeleteTask ¶
DeleteTask deletes a task
func (*Manager) GetBoard ¶
func (m *Manager) GetBoard(tenant string) (map[TaskStatus][]*Task, error)
GetBoard returns the kanban board view
func (*Manager) GetBurndownData ¶ added in v0.4.8
func (m *Manager) GetBurndownData(tenant string, days int) ([]BurndownPoint, error)
GetBurndownData returns burndown chart data for a time period
func (*Manager) GetChildren ¶
GetChildren gets all child tasks
func (*Manager) GetDispatcher ¶
func (m *Manager) GetDispatcher() *Dispatcher
GetDispatcher returns the dispatcher (for testing)
func (*Manager) GetParents ¶
GetParents gets all parent tasks
func (*Manager) GetStats ¶
func (m *Manager) GetStats(tenant string) (map[TaskStatus]int, error)
GetStats returns task statistics
func (*Manager) GetThroughputStats ¶ added in v0.4.8
func (m *Manager) GetThroughputStats(tenant string, days int) (*ThroughputStats, error)
GetThroughputStats returns task throughput statistics
func (*Manager) Heartbeat ¶
Heartbeat updates the task's updated_at timestamp (indicating the agent is alive)
func (*Manager) ListComments ¶
ListComments lists comments for a task
func (*Manager) ListTasks ¶
func (m *Manager) ListTasks(filter TaskFilter) ([]*Task, error)
ListTasks lists tasks with filters
func (*Manager) RemoveLink ¶
RemoveLink removes a parent-child dependency
func (*Manager) SplitTask ¶ added in v0.4.8
func (m *Manager) SplitTask(ctx context.Context, id string, prov provider.Provider) ([]*Task, error)
SplitTask uses LLM to split a task into subtasks
func (*Manager) TriageTask ¶
TriageTask uses LLM to refine a triage task into detailed requirements
func (*Manager) UnblockTask ¶
UnblockTask moves a blocked task back to ready
func (*Manager) UpdateTask ¶
UpdateTask updates a task
type Run ¶
type Run struct {
ID string `json:"id"`
TaskID string `json:"task_id"`
Status string `json:"status"` // running/completed/failed/crashed/timed_out
PID int `json:"pid"`
RetryCount int `json:"retry_count"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Summary string `json:"summary"`
Result string `json:"result"`
}
Run represents a task execution run
type Task ¶
type Task struct {
ID string `json:"id"`
Title string `json:"title"`
Body string `json:"body"`
Assignee string `json:"assignee"`
Status TaskStatus `json:"status"`
Priority int `json:"priority"` // 0=low, 1=medium, 2=high, 3=critical
Tenant string `json:"tenant"`
Workspace string `json:"workspace"`
Skills []string `json:"skills"`
MaxRuntimeSeconds int `json:"max_runtime_seconds"`
IdempotencyKey string `json:"idempotency_key"`
CurrentRunID string `json:"current_run_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Time tracking fields
DueDate *time.Time `json:"due_date,omitempty"` // Deadline
EstimatedHours float64 `json:"estimated_hours,omitempty"` // Estimated work hours
ActualHours float64 `json:"actual_hours,omitempty"` // Actual work hours
StartedAt *time.Time `json:"started_at,omitempty"` // When task was started
CompletedAt *time.Time `json:"completed_at,omitempty"` // When task was completed
// Goal association
GoalID string `json:"goal_id,omitempty"` // Associated goal ID
// Virtual fields (not stored in DB)
ParentCount int `json:"parent_count,omitempty"`
CommentCount int `json:"comment_count,omitempty"`
ChildDoneCount int `json:"child_done_count,omitempty"`
ChildCount int `json:"child_count,omitempty"`
}
Task represents a kanban task
type TaskFilter ¶
type TaskFilter struct {
Status []TaskStatus `json:"status,omitempty"`
Assignee string `json:"assignee,omitempty"`
Tenant string `json:"tenant,omitempty"`
Priority *int `json:"priority,omitempty"`
Search string `json:"search,omitempty"`
GoalID string `json:"goal_id,omitempty"` // Filter by associated goal
DueBefore *time.Time `json:"due_before,omitempty"` // Filter by deadline
DueAfter *time.Time `json:"due_after,omitempty"` // Filter by deadline
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
TaskFilter represents filter criteria for listing tasks
type TaskOption ¶
type TaskOption func(*Task)
TaskOption is a functional option for creating tasks
func WithIdempotencyKey ¶
func WithIdempotencyKey(k string) TaskOption
WithIdempotencyKey sets the task idempotency key
func WithMaxRuntime ¶
func WithMaxRuntime(sec int) TaskOption
WithMaxRuntime sets the task max runtime in seconds
func WithParentID ¶
func WithParentID(parentID string) TaskOption
WithParentID creates an option to link to a parent task
type TaskStatus ¶
type TaskStatus string
TaskStatus represents the status of a task
const ( StatusTriage TaskStatus = "triage" StatusTodo TaskStatus = "todo" StatusReady TaskStatus = "ready" StatusRunning TaskStatus = "running" StatusBlocked TaskStatus = "blocked" StatusDone TaskStatus = "done" StatusArchived TaskStatus = "archived" )
type ThroughputStats ¶ added in v0.4.8
type ThroughputStats struct {
TotalCreated int `json:"total_created"` // Total tasks created
TotalCompleted int `json:"total_completed"` // Total tasks completed
AverageLeadTime float64 `json:"average_lead_time_hours"` // Average time from creation to completion
ThroughputPerDay float64 `json:"throughput_per_day"` // Average tasks completed per day
}
ThroughputStats represents throughput statistics