orchestrator

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package orchestrator coordinates agent tasks and dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StorePath        string
	LogDir           string
	MaxParallel      int
	DefaultMCPConfig string
	DefaultEngine    string
	PersonaPath      string
	AppConfig        *mesnadaconfig.Config // Full app config for passing to managers
}

Config holds orchestrator configuration.

type Orchestrator

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

Orchestrator coordinates the execution of CLI agents.

func New

func New(cfg Config) (*Orchestrator, error)

New creates a new Orchestrator.

func (*Orchestrator) ACPSessionControl

func (o *Orchestrator) ACPSessionControl(taskID, action, message, mode string) (interface{}, error)

ACPSessionControl sends a control command to an active ACP session. This delegates to the agent manager's ACP session control.

func (*Orchestrator) Cancel

func (o *Orchestrator) Cancel(taskID string) error

Cancel cancels a running task.

func (*Orchestrator) Delete

func (o *Orchestrator) Delete(taskID string) error

Delete removes a task from the store. If the task is running, it will attempt to cancel it first. If the process is already dead or doesn't exist, the task will be deleted anyway.

func (*Orchestrator) GetStats

func (o *Orchestrator) GetStats() Stats

GetStats returns orchestrator statistics.

func (*Orchestrator) GetTask

func (o *Orchestrator) GetTask(taskID string) (*models.Task, error)

GetTask retrieves a task by ID.

func (*Orchestrator) ListPersonas

func (o *Orchestrator) ListPersonas() []string

ListPersonas returns a list of available persona names.

func (*Orchestrator) ListTasks

func (o *Orchestrator) ListTasks(req models.ListRequest) ([]*models.Task, error)

ListTasks lists tasks matching the filter.

func (*Orchestrator) Pause

func (o *Orchestrator) Pause(taskID string) (*models.Task, error)

Pause pauses a running or pending task. Pausing stops the underlying Copilot process (if any) and marks the task as paused.

func (*Orchestrator) Purge

func (o *Orchestrator) Purge(taskID string) error

Purge stops a running task (if needed), deletes its log file (if any), and removes it from the store. This operation is intentionally idempotent: purging a missing task returns nil.

func (*Orchestrator) Resume

func (o *Orchestrator) Resume(ctx context.Context, taskID string, opts ResumeOptions) (*models.Task, error)

Resume creates a new task to continue work from a previously paused task.

func (*Orchestrator) Retry

func (o *Orchestrator) Retry(ctx context.Context, taskID string, opts RetryOptions) (*models.Task, error)

Retry relaunches a failed task or reactivates a pending task. For failed tasks, it creates a new task reusing the same log file (append mode) with the original prompt plus a retry notice. For pending tasks, it checks dependencies and starts the task if ready.

func (*Orchestrator) SetProgress

func (o *Orchestrator) SetProgress(taskID string, percentage int, description string) error

SetProgress updates the progress of a running task.

func (*Orchestrator) Shutdown

func (o *Orchestrator) Shutdown() error

Shutdown gracefully shuts down the orchestrator.

func (*Orchestrator) Spawn

Spawn creates and optionally starts a new agent task.

func (*Orchestrator) Wait

func (o *Orchestrator) Wait(ctx context.Context, taskID string, timeout time.Duration) (*models.Task, error)

Wait waits for a task to complete.

func (*Orchestrator) WaitMultiple

func (o *Orchestrator) WaitMultiple(ctx context.Context, taskIDs []string, waitAll bool, timeout time.Duration) (map[string]*models.Task, error)

WaitMultiple waits for multiple tasks.

type ResumeOptions

type ResumeOptions struct {
	Prompt     string
	Model      string
	Background bool
	Timeout    string
	Tags       *[]string
}

ResumeOptions controls how a paused task is resumed.

type RetryOptions

type RetryOptions struct {
	Background bool
}

RetryOptions controls how a failed or pending task is retried.

type Stats

type Stats struct {
	Total           int                         `json:"total"`
	Pending         int                         `json:"pending"`
	Running         int                         `json:"running"`
	Paused          int                         `json:"paused"`
	Completed       int                         `json:"completed"`
	Failed          int                         `json:"failed"`
	Cancelled       int                         `json:"cancelled"`
	RunningProgress map[string]TaskProgressInfo `json:"running_progress,omitempty"`
}

Stats holds orchestrator statistics.

type TaskProgressInfo

type TaskProgressInfo struct {
	TaskID      string    `json:"task_id"`
	Percentage  int       `json:"percentage"`
	Description string    `json:"description"`
	UpdatedAt   time.Time `json:"updated_at"`
}

TaskProgressInfo holds progress information for a task.

Jump to

Keyboard shortcuts

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