prompt

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package prompt is the dashboard's request→response widget: a person fills a form, submits, sees a working state, and the answer returns to the SAME widget. It is the human-initiated mirror of `ask` (which is system asks human); here a human asks the flow and waits for it to answer.

The round trip is a loop the author wires: the widget emits the submission on Out, the flow processes it, and the result is wired back into the widget's In port. A request id rides the whole way so a returning answer is matched to the submission that asked for it — a late answer to a superseded question is ignored rather than shown against the wrong prompt.

The three states a person sees, all in one tile:

  • idle: the form and a Submit button (plus the previous answer, if any)
  • working: the form hidden, a "working…" line — the feedback whose absence made a bare signal widget feel dead
  • answered: the answer rendered as markdown, the form ready to ask again

Index

Constants

View Source
const (
	ComponentName = "prompt"
	OutPort       = "out"
	InPort        = "in"
)

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 receives the answer coming back on In. It also handles the Out/In ports the runtime dispatches here; the submission itself arrives via OnControl (the widget), not Handle.

func (*Component) Instance

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

func (*Component) OnControl

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

OnControl receives a submission from the widget: the filled form with the submit button true. It emits the values on Out and flips the widget to working.

func (*Component) OnReconcile

func (c *Component) OnReconcile(ctx context.Context, _ v1alpha1.TinyNode) error

OnReconcile rehydrates the widget after a restart: re-publish whatever the persisted session says, so a page reload shows the working state or the last answer rather than a blank form.

func (*Component) OnSettings

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

func (*Component) Ports

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

type In

type In struct {
	RequestID string `json:"requestId" title:"Request ID" description:"The id from Out, unchanged."`
	Answer    string `json:"answer" title:"Answer" description:"Text to show in the widget. Markdown is rendered."`
	Context   any    `json:"context,omitempty" configurable:"true" title:"Context"`
}

In is the answer coming back: the request id it answers and the text to show. Anything not matching the outstanding request is ignored.

type Out

type Out struct {
	RequestID string          `json:"requestId" title:"Request ID" description:"Carry this back unchanged on the answer so the widget matches it."`
	Values    json.RawMessage `json:"values" title:"Values" description:"The submitted form."`
	Context   any             `json:"context,omitempty" configurable:"true" title:"Context"`
}

Out is what a submission emits: the form values, the request id to carry back, and a passthrough context.

type Settings

type Settings struct {
	Form string `` /* 231-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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