plugins

package
v0.0.0-...-b2727fc Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSuspended = errors.New("activity result pending")

ErrSuspended is returned by a plugin when it wants to pause task execution and wait for an asynchronous action.

Functions

func DefaultHTTPDispatcher

func DefaultHTTPDispatcher(ctx context.Context, url string, taskID string, payload map[string]any) error

DefaultHTTPDispatcher sends the payload as-is with no envelope. Callers that need a specific request shape should provide a custom dispatcher.

Types

type APICallConfig

type APICallConfig struct {
	URL string `json:"url"`
}

APICallConfig holds properties decoded from the TaskTemplate's JSON configuration.

type APICallPlugin

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

APICallPlugin implements the generic_api_call plugin for FIRE_AND_FORGET tasks. It sends an API request to a configured URL containing the task data payload.

func (*APICallPlugin) Execute

func (p *APICallPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

type Dispatcher

type Dispatcher func(ctx context.Context, url string, taskID string, payload map[string]any) error

Dispatcher defines the function signature for executing external system integrations.

type ExternalReviewConfig

type ExternalReviewConfig struct {
	ExternalURL string `json:"external_url"`
}

ExternalReviewConfig holds properties decoded from the TaskTemplate's JSON configuration.

type ExternalReviewPlugin

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

ExternalReviewPlugin manages asynchronous delegation of task steps to third-party government agencies.

func (*ExternalReviewPlugin) Execute

func (p *ExternalReviewPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

type PaymentConfig

type PaymentConfig struct {
	PaymentServiceURL string `json:"payment_service_url"`
}

PaymentConfig holds properties decoded from the TaskTemplate's JSON configuration.

type PaymentPlugin

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

PaymentPlugin implements the generic_payment plugin. It initiates a payment step externally and transitions the task record to "PENDING_PAYMENT".

func (*PaymentPlugin) Execute

func (p *PaymentPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

type PluginContext

type PluginContext struct {
	Context         context.Context
	Record          *store.TaskRecord
	Inputs          map[string]any
	OutputNamespace string
}

PluginContext provides the database record, input arguments, and context to a plugin during execution.

type Registry

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

Registry is a thread-safe registry of task plugins keyed by taskType and pluginName.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new, empty Registry.

func (*Registry) Get

func (r *Registry) Get(taskType string) (TaskPlugin, bool)

Get retrieves a registered plugin by taskType and pluginName.

func (*Registry) Register

func (r *Registry) Register(taskType string, p TaskPlugin) error

Register adds a new plugin for a specific taskType. It returns an error if a plugin with the same name already exists for that taskType.

type TaskPlugin

type TaskPlugin interface {
	// Execute runs the custom logic of the plugin, updating the task record status and metadata.
	// The config argument contains the custom plugin configuration parameters unmarshaled from JSON.
	Execute(ctx PluginContext, config json.RawMessage) error
}

TaskPlugin is the interface that all interaction and system action handlers must implement.

func NewAPICallPlugin

func NewAPICallPlugin(dispatcher Dispatcher) TaskPlugin

NewAPICallPlugin creates a new APICallPlugin.

func NewExternalReviewPlugin

func NewExternalReviewPlugin(dispatcher Dispatcher) TaskPlugin

NewExternalReviewPlugin returns a plugin with a custom or default HTTP dispatcher.

func NewPaymentPlugin

func NewPaymentPlugin(dispatcher Dispatcher) TaskPlugin

NewPaymentPlugin creates a new PaymentPlugin.

func NewUserInputPlugin

func NewUserInputPlugin() TaskPlugin

type UserInputConfig

type UserInputConfig struct {
	StatusOverride string `json:"status_override,omitempty"`
}

UserInputConfig holds properties specific to the user input step

type UserInputPlugin

type UserInputPlugin struct{}

UserInputPlugin implements a standard human interaction / form submission step.

func (*UserInputPlugin) Execute

func (p *UserInputPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

Jump to

Keyboard shortcuts

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