Documentation
¶
Index ¶
- Constants
- type Component
- func (t *Component) GetInfo() module.ComponentInfo
- func (t *Component) Handle(ctx context.Context, _ module.Handler, port string, msg any) module.Result
- func (t *Component) Instance() module.Component
- func (t *Component) OnControl(ctx context.Context, msg any) error
- func (t *Component) OnSettings(_ context.Context, msg any) error
- func (t *Component) Ports() []module.Port
- type Context
- type Control
- type ResultMessage
- type Settings
Constants ¶
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 ¶
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.
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 */
}
ResultMessage is what the flow writes back after handling a submission.