Documentation
¶
Index ¶
- func AnswerDefault(question *agentv0.Question) (*agentv0.Answer, error)
- func Choice(answers map[string]*agentv0.Answer, stage string) (*agentv0.ChoiceAnswer, error)
- func Confirm(answers map[string]*agentv0.Answer, stage string) (bool, error)
- func Display(msg *agentv0.Message, data map[string]string) *agentv0.Question
- func Do(ctx context.Context, ...) error
- func GetDefaultConfirm(options []*agentv0.Question, name string) (bool, error)
- func GetDefaultStringInput(options []*agentv0.Question, name string) (string, error)
- func InputInt(answers map[string]*agentv0.Answer, stage string) (int, error)
- func InputString(answers map[string]*agentv0.Answer, stage string) (string, error)
- func NewChoice(msg *agentv0.Message, options ...*agentv0.Message) *agentv0.Question
- func NewChoiceWithDefault(msg *agentv0.Message, defaultOption string, options ...*agentv0.Message) *agentv0.Question
- func NewConfirm(msg *agentv0.Message, defaultConfirm bool) *agentv0.Question
- func NewIntInput(msg *agentv0.Message, defaultValue int) *agentv0.Question
- func NewSelection(msg *agentv0.Message, options ...*agentv0.Message) *agentv0.Question
- func NewSelectionWithDefault(msg *agentv0.Message, defaultOptions []string, options ...*agentv0.Message) *agentv0.Question
- func NewStringInput(msg *agentv0.Message, defaultValue string) *agentv0.Question
- func Selection(answers map[string]*agentv0.Answer, stage string) (*agentv0.SelectionAnswer, error)
- type AnswerProvider
- type QuestionAsker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnswerDefault ¶ added in v0.2.39
AnswerDefault resolves a question using only its protocol-declared default. It is the shared non-interactive policy for CI, MCP, pipes, and orchestration: callers must never guess a choice that the plugin did not declare.
func Do ¶ added in v0.0.51
func Do(ctx context.Context, stream grpc.BidiStreamingClient[agentv0.Answer, agentv0.Question], handler AnswerProvider) error
Do drives a bidirectional Communicate stream from the CLI side. It reads Questions from the stream, passes them to the AnswerProvider, and sends Answers back until the stream closes.
func GetDefaultConfirm ¶ added in v0.1.89
func GetDefaultStringInput ¶ added in v0.1.89
func InputString ¶ added in v0.1.155
func NewChoiceWithDefault ¶ added in v0.2.39
func NewChoiceWithDefault(msg *agentv0.Message, defaultOption string, options ...*agentv0.Message) *agentv0.Question
NewChoiceWithDefault declares the deterministic option selected by non-interactive callers. defaultOption is the stable Message.Name, not its display label.
func NewConfirm ¶ added in v0.0.51
func NewIntInput ¶ added in v0.1.33
func NewSelection ¶ added in v0.0.51
func NewSelectionWithDefault ¶ added in v0.2.39
func NewSelectionWithDefault(msg *agentv0.Message, defaultOptions []string, options ...*agentv0.Message) *agentv0.Question
NewSelectionWithDefault declares the deterministic set selected by non-interactive callers. Each value is a stable Message.Name.
func NewStringInput ¶ added in v0.0.51
Types ¶
type AnswerProvider ¶ added in v0.0.51
type AnswerProvider interface {
Answer(ctx context.Context, question *agentv0.Question) (*agentv0.Answer, error)
}
AnswerProvider answers interactive questions from a plugin. The CLI implements this (e.g. terminal prompts, defaults).
type QuestionAsker ¶ added in v0.1.155
type QuestionAsker struct {
// contains filtered or unexported fields
}
QuestionAsker is implemented by plugins to ask questions during Create/Sync. It sends Questions and receives Answers on a bidi stream.
func NewQuestionAsker ¶ added in v0.1.155
func NewQuestionAsker(stream grpc.BidiStreamingServer[agentv0.Answer, agentv0.Question]) *QuestionAsker
NewQuestionAsker wraps a bidi stream for the plugin side.
func (*QuestionAsker) Ask ¶ added in v0.1.155
Ask sends a question to the CLI and waits for the answer.
func (*QuestionAsker) RunSequence ¶ added in v0.1.155
func (qa *QuestionAsker) RunSequence(questions []*agentv0.Question) (map[string]*agentv0.Answer, error)
RunSequence asks a sequence of questions and returns all answers keyed by question name.