actions

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBuiltins

func RegisterBuiltins(reg *Registry, validator *validation.JSONSchemaValidator, httpCfg HTTPConfig, fsCfg FSConfig, shellCfg ShellConfig) error

RegisterBuiltins registers all built-in actions in the given registry.

func RegisterWorkflowActions

func RegisterWorkflowActions(reg *Registry, deps WorkflowActionDeps) error

RegisterWorkflowActions registers workflow actions into the given registry. Called after the executor is created so the SubWorkflowRunner can be wired.

Types

type Action

type Action interface {
	Name() string
	Schema() ActionSchema
	Execute(ctx context.Context, input ActionInput) (*ActionOutput, error)
	Validate(input map[string]any) error
}

Action is an executable unit of work within a workflow step.

func AssertActions

func AssertActions(validator *validation.JSONSchemaValidator) []Action

AssertActions returns all assertion-related actions.

func CryptoActions

func CryptoActions() []Action

CryptoActions returns all crypto-related actions.

func ExprActions added in v0.1.1

func ExprActions() []Action

ExprActions returns all expression evaluation actions.

func FSActions

func FSActions(cfg FSConfig) []Action

FSActions returns all filesystem-related actions.

func ShellActions

func ShellActions(cfg ShellConfig) []Action

ShellActions returns all shell-related actions.

func WorkflowActions

func WorkflowActions(deps WorkflowActionDeps) []Action

WorkflowActions returns the six workflow-scoped actions.

type ActionInfo

type ActionInfo struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

ActionInfo is a summary of a registered action for listing.

type ActionInput

type ActionInput struct {
	Params  map[string]any `json:"params"`
	Context map[string]any `json:"context,omitempty"`
}

ActionInput is the data provided to an action at execution time.

type ActionOutput

type ActionOutput struct {
	Data json.RawMessage `json:"data,omitempty"`
}

ActionOutput is the result of an action execution.

type ActionRegistry

type ActionRegistry interface {
	Register(action Action) error
	Get(name string) (Action, error)
	List() []ActionInfo
}

ActionRegistry manages the lifecycle and lookup of available actions.

type ActionSchema

type ActionSchema struct {
	InputSchema  json.RawMessage `json:"input_schema,omitempty"`
	OutputSchema json.RawMessage `json:"output_schema,omitempty"`
	Description  string          `json:"description,omitempty"`
}

ActionSchema describes the input/output contract of an action.

type AgentNotifier

type AgentNotifier interface {
	Notify(ctx context.Context, agentID string, payload map[string]any) error
}

AgentNotifier pushes notifications to connected agents via MCP SSE.

type FSConfig

type FSConfig struct {
	Limits      isolation.ResourceLimits
	MaxReadSize int64
}

FSConfig configures the filesystem actions.

type HTTPConfig

type HTTPConfig struct {
	MaxResponseBody int64
	DefaultTimeout  time.Duration
}

HTTPConfig configures the HTTP actions.

type HTTPGetAction

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

HTTPGetAction implements the "http.get" convenience action.

func NewHTTPGetAction

func NewHTTPGetAction(cfg HTTPConfig) *HTTPGetAction

NewHTTPGetAction creates a new http.get action.

func (*HTTPGetAction) Execute

func (a *HTTPGetAction) Execute(ctx context.Context, input ActionInput) (*ActionOutput, error)

func (*HTTPGetAction) Name

func (a *HTTPGetAction) Name() string

func (*HTTPGetAction) Schema

func (a *HTTPGetAction) Schema() ActionSchema

func (*HTTPGetAction) Validate

func (a *HTTPGetAction) Validate(input map[string]any) error

type HTTPPostAction

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

HTTPPostAction implements the "http.post" convenience action.

func NewHTTPPostAction

func NewHTTPPostAction(cfg HTTPConfig) *HTTPPostAction

NewHTTPPostAction creates a new http.post action.

func (*HTTPPostAction) Execute

func (a *HTTPPostAction) Execute(ctx context.Context, input ActionInput) (*ActionOutput, error)

func (*HTTPPostAction) Name

func (a *HTTPPostAction) Name() string

func (*HTTPPostAction) Schema

func (a *HTTPPostAction) Schema() ActionSchema

func (*HTTPPostAction) Validate

func (a *HTTPPostAction) Validate(input map[string]any) error

type HTTPRequestAction

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

HTTPRequestAction implements the "http.request" action.

func NewHTTPRequestAction

func NewHTTPRequestAction(cfg HTTPConfig) *HTTPRequestAction

NewHTTPRequestAction creates a new http.request action.

func (*HTTPRequestAction) Execute

func (a *HTTPRequestAction) Execute(ctx context.Context, input ActionInput) (*ActionOutput, error)

func (*HTTPRequestAction) Name

func (a *HTTPRequestAction) Name() string

func (*HTTPRequestAction) Schema

func (a *HTTPRequestAction) Schema() ActionSchema

func (*HTTPRequestAction) Validate

func (a *HTTPRequestAction) Validate(input map[string]any) error

type Registry

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

Registry is the concrete thread-safe ActionRegistry implementation.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty Registry.

func (*Registry) Count

func (r *Registry) Count() int

Count returns the number of registered actions.

func (*Registry) Get

func (r *Registry) Get(name string) (Action, error)

Get retrieves an action by name.

func (*Registry) Has

func (r *Registry) Has(name string) bool

Has checks if an action is registered.

func (*Registry) List

func (r *Registry) List() []ActionInfo

List returns info for all registered actions, sorted by name.

func (*Registry) Register

func (r *Registry) Register(action Action) error

Register adds an action to the registry. Returns error on duplicate name.

func (*Registry) RegisterPlugin

func (r *Registry) RegisterPlugin(prefix string, acts []Action) (int, error)

RegisterPlugin bulk-registers actions under a prefixed namespace. Each action name becomes "prefix.originalName" (e.g. "github.create_issue").

type ShellConfig

type ShellConfig struct {
	Isolator       isolation.Isolator
	DefaultTimeout time.Duration
	DefaultLimits  isolation.ResourceLimits
	MaxOutputSize  int64
}

ShellConfig configures the shell.exec action.

type SubWorkflowRunner

type SubWorkflowRunner func(ctx context.Context, templateName, version string, params map[string]any, parentID, agentID string) (json.RawMessage, error)

SubWorkflowRunner is a function that executes a child workflow and returns its output. The executor satisfies this by wiring it after construction (late-bind).

type WorkflowActionDeps

type WorkflowActionDeps struct {
	RunSubWorkflow SubWorkflowRunner
	Store          store.Store
	Hub            streaming.EventHub
	Notifier       AgentNotifier
	Logger         *slog.Logger
}

WorkflowActionDeps holds the dependencies injected into workflow actions.

Jump to

Keyboard shortcuts

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