Documentation
¶
Index ¶
- type DBTaskService
- func (s *DBTaskService) CreateTask(ctx context.Context, title, sessionID string, steps []Step) (*Task, error)
- func (s *DBTaskService) GetTask(ctx context.Context, id string) (*Task, error)
- func (s *DBTaskService) ListTasks(ctx context.Context) ([]Task, error)
- func (s *DBTaskService) UpdateStep(ctx context.Context, taskID string, stepIndex int, newStatus StepStatus, ...) error
- type InMemoryTaskService
- func (s *InMemoryTaskService) CreateTask(title, sessionID string, steps []Step) (*Task, error)
- func (s *InMemoryTaskService) GetTask(id string) (*Task, error)
- func (s *InMemoryTaskService) ListTasks() ([]Task, error)
- func (s *InMemoryTaskService) UpdateStep(taskID string, stepIndex int, newStatus StepStatus, output string, ...) error
- type Service
- type Step
- type StepStatus
- type Task
- type TaskStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBTaskService ¶
type DBTaskService struct {
// contains filtered or unexported fields
}
DBTaskService is a DB-backed implementation of the Task Service.
func NewDBTaskService ¶
func NewDBTaskService(db *sql.DB) *DBTaskService
func (*DBTaskService) CreateTask ¶
func (*DBTaskService) ListTasks ¶
func (s *DBTaskService) ListTasks(ctx context.Context) ([]Task, error)
func (*DBTaskService) UpdateStep ¶
func (s *DBTaskService) UpdateStep(ctx context.Context, taskID string, stepIndex int, newStatus StepStatus, output string, errMsg string) error
type InMemoryTaskService ¶
type InMemoryTaskService struct {
// contains filtered or unexported fields
}
InMemoryTaskService is a thread-safe in-memory implementation of Service.
func NewInMemoryTaskService ¶
func NewInMemoryTaskService() *InMemoryTaskService
NewInMemoryTaskService creates a new in-memory task service.
func (*InMemoryTaskService) CreateTask ¶
func (s *InMemoryTaskService) CreateTask(title, sessionID string, steps []Step) (*Task, error)
CreateTask creates a new task with the given title, session and steps.
func (*InMemoryTaskService) GetTask ¶
func (s *InMemoryTaskService) GetTask(id string) (*Task, error)
GetTask retrieves a task by ID.
func (*InMemoryTaskService) ListTasks ¶
func (s *InMemoryTaskService) ListTasks() ([]Task, error)
ListTasks returns all tasks.
func (*InMemoryTaskService) UpdateStep ¶
func (s *InMemoryTaskService) UpdateStep(taskID string, stepIndex int, newStatus StepStatus, output string, errMsg string) error
UpdateStep updates a specific step within a task.
type Service ¶
type Service interface {
// CreateTask creates a new task with the given title, session and steps.
CreateTask(title, sessionID string, steps []Step) (*Task, error)
// GetTask retrieves a task by ID.
GetTask(id string) (*Task, error)
// UpdateStep updates a specific step within a task.
UpdateStep(taskID string, stepIndex int, newStatus StepStatus, output string, err string) error
// ListTasks returns all tasks.
ListTasks() ([]Task, error)
}
Service defines the contract for a task planning and execution service.
type Step ¶
type Step struct {
ID string // unique step identifier
Description string // what this step does
Type string // "freeform" or "structured"
Status StepStatus // current status
RetryCount int // how many retries have occurred
Output string // textual output from execution
Error string // error message if failed
}
Step describes a single actionable unit within a Task.
type StepStatus ¶
type StepStatus string
StepStatus represents the status of an individual task step.
const ( StepPending StepStatus = "pending" StepRunning StepStatus = "running" StepCompleted StepStatus = "completed" StepFailed StepStatus = "failed" )
type Task ¶
type Task struct {
ID string // unique task identifier
SessionID string // session this task belongs to
Title string // human-readable title
Status TaskStatus
CurrentStepIndex int // index of the currently active step
Steps []Step // ordered list of steps
CreatedAt time.Time // creation timestamp
UpdatedAt time.Time // last update timestamp
}
Task represents a multi-step plan that agents can execute.
type TaskStatus ¶
type TaskStatus string
TaskStatus represents the high-level status of a multi-step task.
const ( TaskPending TaskStatus = "pending" TaskRunning TaskStatus = "running" TaskCompleted TaskStatus = "completed" TaskFailed TaskStatus = "failed" )