askuser

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package askuser provides the ask_user tool that lets the agent ask the user one or more questions and block until they respond.

Index

Constants

View Source
const (
	// MaxQuestions is the largest batch a single ask_user call may contain.
	// The Automation API's answer cap mirrors it.
	MaxQuestions = 32
	// MaxQuestionBytes bounds a single question's text.
	MaxQuestionBytes = 4 << 10
	// MaxOptions bounds the predefined choices offered for one question.
	MaxOptions = 32
	// MaxOptionBytes bounds a single predefined choice.
	MaxOptionBytes = 1 << 10
)

Limits on a single ask_user call. They exist because the answers come back through a UI or, for automation sessions, through an HTTP endpoint that caps the answer array: a prompt with more questions than the answer cap could never be answered by a machine caller. Bounding the text keeps one prompt from being a payload dump.

Variables

This section is empty.

Functions

func NewTool

func NewTool(b *Bridge) core.Tool

NewTool creates the ask_user tool wired to the given bridge.

Types

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

Bridge connects the ask_user tool to the UI.

func NewBridge

func NewBridge() *Bridge

NewBridge creates a bridge.

func (*Bridge) Prompts

func (b *Bridge) Prompts() <-chan Prompt

Prompts returns the channel the UI listens on.

type Prompt

type Prompt struct {
	Questions []Question
	Response  chan<- []string // one answer per question (exactly once)
}

Prompt is the full batch sent from the agent to the UI.

type Question

type Question struct {
	Text    string   `json:"question"`
	Options []string `json:"options,omitempty"`
}

Question describes a single question with optional predefined choices.

Jump to

Keyboard shortcuts

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