orchestrator

package
v0.0.0-...-ad95c11 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*TaskManager)

Option configures a TaskManager.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger overrides the structured logger used by TaskManager. Defaults to slog.Default() when not provided.

type SubTaskTemplate

type SubTaskTemplate = types.SubTaskTemplate

TaskTemplate and SubTaskTemplate are defined in artifact/adapter/types so that artifact adapters and orchestrator can both reference them without a circular import. These aliases preserve the orchestrator.TaskTemplate / orchestrator.SubTaskTemplate API.

type TaskCompletedCallback

type TaskCompletedCallback func(parentWorkflowID string, parentRunID string, parentNodeID string, finalVariables map[string]any) error

TaskCompletedCallback is a callback function invoked when a Task workflow completes. It is typically used to wake up the parent workflow with the final task output variables.

type TaskManager

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

TaskManager orchestrates decoupled tasks and interactions under parent workflows. It bridges macro-level workflows and micro-level interactive tasks via a single DB entry per task.

func NewTaskManager

func NewTaskManager(
	db store.TaskStore,
	registry *artifact.Registry,
	pluginsRegistry *plugins.Registry,
	extensionsRegistry *extensions.Registry,
	taskWorkflowManager engine.TemporalManager,
	onTaskCompleted TaskCompletedCallback,
	renderer renderer.Renderer,
	opts ...Option,
) *TaskManager

NewTaskManager creates a TaskManager instance.

  • db — the persistence/in-memory task store.
  • registry — artifact registry holding task templates, subtask templates, workflow definitions, and render configs.
  • pluginsRegistry — registry containing task execution plugin handlers.
  • taskWorkflowManager — the TemporalManager used to start and complete Task sub-workflows.
  • onTaskCompleted — callback invoked when a Task workflow finishes; typically invokes Parent.TaskDone to resume the parent workflow using stored coordinates.

func (*TaskManager) CompleteTaskStep

func (tm *TaskManager) CompleteTaskStep(ctx context.Context, taskID string, payload map[string]any) error

CompleteTaskStep is the public API for external clients or portals to submit form/interaction data and resume the active step in the corresponding Task workflow.

func (*TaskManager) GetAllTasks

func (tm *TaskManager) GetAllTasks(ctx context.Context, parentWorkflowID string) []TaskView

GetAllTasks returns a lightweight summary of tasks for listing purposes. The View field is intentionally not populated — callers should use GetTaskRenderInfo to fetch the full rendered view for a specific task.

If parentWorkflowID is non-empty, the result is narrowed to tasks spawned by that parent workflow; an empty string returns all tasks.

func (*TaskManager) GetTaskRenderInfo

func (tm *TaskManager) GetTaskRenderInfo(context context.Context, taskID string) (TaskView, error)

GetTaskRenderInfo retrieves a task record and dynamically decorates it with rich render metadata (like JSON schemas) fetched on-the-fly from its executing plugin.

func (*TaskManager) HandleTaskCompletion

func (tm *TaskManager) HandleTaskCompletion(ctx context.Context, workflowID string, finalVariables map[string]any) error

HandleTaskCompletion is called when a Task workflow hits its END node. It marks the task complete and fires the onTaskCompleted callback to resume the parent workflow.

func (*TaskManager) StartSubTask

func (tm *TaskManager) StartSubTask(ctx context.Context, payload engine.TaskPayload) (map[string]any, error)

StartSubTask is called by the Task's workflow engine when it activates an interaction step. It routes to the correct capability handler dynamically from the plugin registry.

func (*TaskManager) StartTask

func (tm *TaskManager) StartTask(ctx context.Context, payload engine.TaskPayload) (map[string]any, error)

StartTask is called by the parent workflow engine when it activates a TASK node. It looks up the template registry, creates a single DB record with parent coordinates, and kicks off the Task's internal workflow.

type TaskTemplate

type TaskTemplate = types.TaskTemplate

TaskTemplate and SubTaskTemplate are defined in artifact/adapter/types so that artifact adapters and orchestrator can both reference them without a circular import. These aliases preserve the orchestrator.TaskTemplate / orchestrator.SubTaskTemplate API.

type TaskView

type TaskView struct {
	TaskID    string          `json:"task_id"`
	TaskType  string          `json:"task_type"`
	State     string          `json:"state"`
	View      json.RawMessage `json:"view,omitempty"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
}

TaskView represents a purely presentational view of a task for the frontend. It removes all internal Temporal coordinates and exposes only what the UI needs.

Jump to

Keyboard shortcuts

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