control

package
v0.0.48 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCastNotFound = errors.New("sup: cast not found")
	ErrCallNotFound = errors.New("sup: call not found")
)

Functions

This section is empty.

Types

type ActorOption

type ActorOption func(*ExposedActor)

func Call

func Call[T any, R any](name string, fn func(context.Context, T) (R, error)) ActorOption

func Cast

func Cast[T any](name string, fn func(context.Context, T) error) ActorOption

type CallAction

type CallAction struct {
	Name         string         `json:"name"`
	InputSchema  map[string]any `json:"input_schema"`
	OutputSchema map[string]any `json:"output_schema"`
	// contains filtered or unexported fields
}

type CastAction

type CastAction struct {
	Name        string         `json:"name"`
	InputSchema map[string]any `json:"input_schema"`
	// contains filtered or unexported fields
}

type Control

type Control struct {
	Casts []*CastAction `json:"casts"`
	Calls []*CallAction `json:"calls"`
	// contains filtered or unexported fields
}

func NewControl

func NewControl() *Control

func (*Control) Call

func (c *Control) Call(ctx context.Context, name string, raw json.RawMessage) (any, error)

func (*Control) Cast

func (c *Control) Cast(ctx context.Context, name string, raw json.RawMessage) error

type ExposedActor

type ExposedActor struct {
	ID      string   `json:"id"`
	Spec    sup.Spec `json:"spec"`
	Control *Control `json:"control,omitempty"`
}

type ExposedSignal

type ExposedSignal struct {
	ID    string   `json:"id"`
	Spec  sup.Spec `json:"spec"`
	Type  string   `json:"type"`
	Value any      `json:"value"`
}

type Registry

type Registry struct {
	*sup.BaseActor
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(id string, opts ...RegistryOption) *Registry

func (*Registry) Handler

func (r *Registry) Handler() http.Handler

func (*Registry) Inspect

func (r *Registry) Inspect() sup.Spec

func (*Registry) Run

func (r *Registry) Run(ctx context.Context) error

type RegistryOption

type RegistryOption func(*Registry)

func WithActor

func WithActor(actor sup.Actor, opts ...ActorOption) RegistryOption

func WithSignal

func WithSignal[V any](signal sup.ReadableSignal[V]) RegistryOption

Jump to

Keyboard shortcuts

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