Help us shape the future of Go! Take the 2026 Go Developer Survey

questions

package
v0.19.9 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package questions is Orb's shared human-question capability and native tool.

Index

Constants

View Source
const Kind = "questions"
View Source
const ToolName = "ask_user_question"

Variables

This section is empty.

Functions

func Extension

func Extension(draw Draw) extensions.Factory

Types

type Answer

type Answer struct {
	ID       string   `json:"id"`
	Selected []string `json:"selected"`
	Custom   string   `json:"custom,omitempty"`
}

type Draw added in v0.19.4

type Draw struct {
	Panel Panel
	Text  func(text string, oneLine bool) extensions.Component
}

Draw is how a terminal draws questions: the panel it asks them in, and their lines in the transcript. A host without a terminal leaves it zero: its controller (an app, a Bridge peer) answers them from the presentation.

type Option

type Option struct {
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	Preview     string `json:"preview,omitempty"`
}

type Panel

type Panel func(request Request, theme extensions.Theme, height func() int, invalidate func(), done func(Result)) extensions.Component

Panel draws questions in a terminal and calls done with their answers.

type Question

type Question struct {
	ID          string   `json:"id"`
	Question    string   `json:"question"`
	Header      string   `json:"header,omitempty"`
	Options     []Option `json:"options,omitempty"`
	MultiSelect bool     `json:"multi_select,omitempty"`
}

type Request

type Request struct {
	Questions []Question `json:"questions"`
}

func (Request) Summary

func (request Request) Summary() string

func (Request) Validate

func (r Request) Validate() error

func (Request) ValidateReply

func (r Request) ValidateReply(raw string) error

type Result

type Result struct {
	Answers   []Answer `json:"answers,omitempty"`
	Cancelled bool     `json:"cancelled,omitempty"`
}

func Ask

func Ask(ctx context.Context, request Request, input extensions.InputHandler, panel Panel) (Result, error)

Ask uses the runtime's execution-bound input seam; it owns no queue or history. A terminal asks in panel, when one is given.

Directories

Path Synopsis
Package panel is how a terminal asks the questions plugin's questions: one tab per question, choices and a line of your own, then a review, in the local dialog and the remote conversation view alike.
Package panel is how a terminal asks the questions plugin's questions: one tab per question, choices and a line of your own, then a review, in the local dialog and the remote conversation view alike.

Jump to

Keyboard shortcuts

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