ask

package
v0.7.19 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName = "ask"
	RequestPort   = "request"
	OutPort       = "out"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	module.Base
	// contains filtered or unexported fields
}

func (*Component) GetInfo

func (c *Component) GetInfo() module.ComponentInfo

func (*Component) Handle

func (c *Component) Handle(ctx context.Context, _ module.Handler, port string, msg any) module.Result

Handle opens the gate. It returns immediately: the run does not stay parked waiting for a human. Continuity lives in this node's published form, and the answer arrives later as a separate control message that starts the downstream hop itself.

func (*Component) Instance

func (c *Component) Instance() module.Component

func (*Component) OnControl

func (c *Component) OnControl(ctx context.Context, msg any) error

OnControl receives the human's submission. The form has no Go type — its shape is only known at runtime — so the runtime decodes it into the map this port advertises as its configuration, and the submitted values arrive here as that map rather than a typed struct.

func (*Component) OnSettings

func (c *Component) OnSettings(_ context.Context, msg any) error

func (*Component) Ports

func (c *Component) Ports() []module.Port

type Context

type Context any

Context is the passthrough payload — whatever the flow was carrying when it reached the gate. It rides through the human's decision unchanged so the downstream action knows what it is acting on.

type Reply

type Reply struct {
	Values  map[string]interface{} `json:"values" title:"Values" description:"What the human submitted, keyed by the form's field names."`
	Context Context                `json:"context,omitempty" title:"Context" description:"The request payload, unchanged."`
}

Reply is emitted once a human submits the form.

type Request

type Request struct {
	Context Context `` /* 152-byte string literal not displayed */
}

Request is what the flow sends to open the gate. The form is fixed by Settings; this carries the thing being decided on.

type Settings

type Settings struct {
	// Form is a JSON Schema rendered as the question put to the human. It is
	// authored here rather than derived from a Go type, which is the whole
	// point: the same component asks "approve this restart?" or "how many
	// replicas?" depending on what is written here.
	Form string `` /* 234-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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