form

package
v0.9.33 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName = "form"
	OutPort       = "out"
	ResultPort    = "result"
)

form is the one-widget request→response surface: a configurable form with a Submit button and a result line INSIDE the same card. Submit emits the filled values on Out; the flow answers on Result and the widget shows it in place. The settings-form pattern (masked API key → validate → store → "saved ••••last4 ✓") is the canonical use.

It is the prompt component's form half, reborn: prompt merged into chat for conversations, which left "a form that reports its outcome" without a component — signal (stateless trigger) plus display (separate panel) was the workaround.

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 (t *Component) GetInfo() module.ComponentInfo

func (*Component) Handle

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

Handle receives the flow's Result and shows it in the widget. NOT leader-gated: results route to any replica and converge through state, same rule as chat's say/ask.

func (*Component) Instance

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

func (*Component) OnControl

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

OnControl handles Submit: emit the filled values once on Out. Same fire-and-forget contract as signal — the flow's answer comes back through the Result port, not a blocking reply.

func (*Component) OnSettings

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

func (*Component) Ports

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

type Context

type Context any

type Control

type Control struct {
	Context Context `json:"context" required:"true" configurable:"true" title:"Form"`
	Submit  bool    `json:"submit" format:"button" title:"Submit" required:"true"`
	Result  string  `json:"result,omitempty" readonly:"true" format:"markdown" title:"" description:""`
}

Control is the widget: the form, Submit, and the result line the flow wrote back — rendered as read-only prose under the button.

type ResultMessage

type ResultMessage struct {
	Text    string  `` /* 132-byte string literal not displayed */
	Prefill Context `` /* 224-byte string literal not displayed */
}

ResultMessage is what the flow writes back after handling a submission.

type Settings

type Settings struct {
	Context Context `` /* 205-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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