service

package
v0.2.74 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoreMemoryService

func NewCoreMemoryService(logger logging.Logger, planner interfaces.TaskPlanner) interfaces.TaskService

NewCoreMemoryService creates a new in-memory service for core tasks

Types

type CoreMemoryService

type CoreMemoryService struct {
	// contains filtered or unexported fields
}

CoreMemoryService implements the interfaces.TaskService interface with in-memory storage

func (*CoreMemoryService) AddTaskLog

func (s *CoreMemoryService) AddTaskLog(ctx context.Context, taskID string, message string, level string) error

AddTaskLog adds a log entry to a task

func (*CoreMemoryService) ApproveTaskPlan

func (s *CoreMemoryService) ApproveTaskPlan(ctx context.Context, taskID string, reqObj interface{}) (interface{}, error)

ApproveTaskPlan approves or rejects a task plan

func (*CoreMemoryService) CreateTask

func (s *CoreMemoryService) CreateTask(ctx context.Context, reqObj interface{}) (interface{}, error)

CreateTask creates a new task

func (*CoreMemoryService) GetTask

func (s *CoreMemoryService) GetTask(ctx context.Context, taskID string) (interface{}, error)

GetTask gets a task by ID

func (*CoreMemoryService) GetTaskLogs

func (s *CoreMemoryService) GetTaskLogs(ctx context.Context, taskID string) ([]*core.Log, error)

GetTaskLogs returns all logs for a task

func (*CoreMemoryService) ListTasks

func (s *CoreMemoryService) ListTasks(ctx context.Context, filterObj interface{}) ([]interface{}, error)

ListTasks returns tasks based on the filter

func (*CoreMemoryService) UpdateTask

func (s *CoreMemoryService) UpdateTask(ctx context.Context, taskID string, updatesObj interface{}) (interface{}, error)

UpdateTask updates a task

type InMemoryTaskService

type InMemoryTaskService struct {
	// contains filtered or unexported fields
}

InMemoryTaskService implements the Service interface with an in-memory storage

func NewInMemoryTaskService

func NewInMemoryTaskService(logger logging.Logger, planner interfaces.TaskPlanner, executor TaskRunner) *InMemoryTaskService

NewInMemoryTaskService creates a new in-memory task service.

executor may be nil, in which case an approved plan is marked executing and left for the caller to run.

func (*InMemoryTaskService) AddTaskLog

func (s *InMemoryTaskService) AddTaskLog(ctx context.Context, taskID string, message string, level string) error

AddTaskLog adds a log entry to a task

func (*InMemoryTaskService) ApproveTaskPlan

func (s *InMemoryTaskService) ApproveTaskPlan(ctx context.Context, taskID string, req task.ApproveTaskPlanRequest) (*task.Task, error)

ApproveTaskPlan approves or rejects a task plan

func (*InMemoryTaskService) CreateTask

CreateTask creates a new task

func (*InMemoryTaskService) GetTask

func (s *InMemoryTaskService) GetTask(ctx context.Context, taskID string) (*task.Task, error)

GetTask gets a task by ID

func (*InMemoryTaskService) ListTasks

func (s *InMemoryTaskService) ListTasks(ctx context.Context, filter task.TaskFilter) ([]*task.Task, error)

ListTasks returns tasks filtered by the provided criteria

func (*InMemoryTaskService) UpdateTask

func (s *InMemoryTaskService) UpdateTask(ctx context.Context, taskID string, updates []task.TaskUpdate) (*task.Task, error)

UpdateTask updates an existing task with new steps or modifications

type TaskRunner added in v0.2.73

type TaskRunner interface {
	ExecuteTask(ctx context.Context, t *task.Task) error
}

TaskRunner executes an approved task.

This is the only executor capability InMemoryTaskService uses, so it is the only one the constructor asks for.

It exists because the service previously took an interfaces.TaskExecutor, which nothing in this module satisfies: *task/executor.TaskExecutor has no CancelTask, GetTaskStatus, ExecuteWorkflow or ExecuteWorkflowAsync, and its ExecuteStep/ExecuteTask take concrete types rather than the interface{} that contract declares. The service was therefore uninstantiable with anything at all -- an eight-method interface with zero implementations. Asking only for the one method actually used makes it implementable in a few lines, without repairing an interface nobody can satisfy.

Note that *task/executor.TaskExecutor still does NOT satisfy this, for a separate reason worth recording: it operates on *task/core.Task while this service operates on *task.Task, and those are two distinct structs rather than an alias. pkg/task and pkg/task/core are parallel type hierarchies for the same concept. Reconciling them is a larger change than this one and is left deliberately undone rather than papered over with a conversion shim.

Jump to

Keyboard shortcuts

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