Documentation
¶
Index ¶
- type ActionParams
- type Config
- type CreateTaskParams
- type RunnerFactoryFn
- type Service
- func (s *Service) CreateTask(ctx context.Context, params CreateTaskParams) (sqlc.AgentTask, error)
- func (s *Service) DeleteTask(ctx context.Context, id string, userID string) error
- func (s *Service) GetTask(ctx context.Context, id string, userID string) (sqlc.AgentTask, error)
- func (s *Service) HandleAction(ctx context.Context, id string, userID string, action ActionParams) (sqlc.AgentTask, error)
- func (s *Service) ListTaskEvents(ctx context.Context, taskID string) ([]sqlc.AgentTaskEvent, error)
- func (s *Service) ListTasks(ctx context.Context, userID, agentID, status string) ([]sqlc.AgentTask, error)
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop()
- func (s *Service) Tick()
- func (s *Service) UpdateTask(ctx context.Context, id string, userID string, update UpdateTaskParams) (sqlc.AgentTask, error)
- type TaskControlTool
- type UpdateTaskParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionParams ¶
type ActionParams struct {
Action string // cancel, approve, reject, respond
Message string // reason or response message
}
ActionParams holds parameters for task action handling.
type Config ¶
type Config struct {
Queries *sqlc.Queries
Notifier notify.Notifier
Memory memory.Provider
RunnerFactory RunnerFactoryFn
MaxConcurrency int // 0 = default 5
}
Config holds construction parameters for Service.
type CreateTaskParams ¶
type CreateTaskParams struct {
Title string
Description string
Priority string
AgentID string
UserID string
Deps []string
SchedulerJobID string
SchedulerRunID string
}
CreateTaskParams holds parameters for creating a new task.
type RunnerFactoryFn ¶
type RunnerFactoryFn func(agentID string) (agent.NewRunnerFunc, bool)
RunnerFactoryFn resolves a runner factory for a given agent ID. Returns false if the agent has no pool (task will be skipped).
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages task lifecycle: creation, dispatching workers, and actions.
func (*Service) CreateTask ¶
CreateTask inserts a new task. The scheduler Tick dispatches it.
func (*Service) DeleteTask ¶
DeleteTask deletes a task (cancels running worker if present).
func (*Service) HandleAction ¶
func (s *Service) HandleAction(ctx context.Context, id string, userID string, action ActionParams) (sqlc.AgentTask, error)
HandleAction processes approve/reject/respond/cancel actions on a task.
func (*Service) ListTaskEvents ¶
ListTaskEvents returns all events for a task ordered by creation time.
func (*Service) ListTasks ¶
func (s *Service) ListTasks(ctx context.Context, userID, agentID, status string) ([]sqlc.AgentTask, error)
ListTasks returns tasks for a specific agent, filtered by status.
func (*Service) Start ¶
Start initialises the service: resets stale running tasks to pending on startup. The caller is responsible for scheduling Tick on a recurring interval.
func (*Service) Stop ¶
func (s *Service) Stop()
Stop cancels the service context and waits for all running workers to finish.
type TaskControlTool ¶
type TaskControlTool struct {
// contains filtered or unexported fields
}
TaskControlTool is injected into task sessions. Its Execute method performs DB transitions directly.
func (*TaskControlTool) Definition ¶
func (t *TaskControlTool) Definition() tools.Definition