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

askuser

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AskUser

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

AskUser asks the human a question via the loop's user-input gate. It holds no dependencies beyond the (overridable) requestUserInput seam.

func NewAskUser

func NewAskUser() *AskUser

NewAskUser constructs an AskUser whose seam is wired to the real loop.RequestUserInput (which reads the runner-injected ctx values per call).

func (*AskUser) AuditSummary

func (a *AskUser) AuditSummary(argsJSON string) string

AuditSummary returns "AskUser: <question>". The question is shown to the user at the gate anyway, so it is not a secret. Unparsable args / an empty question yield a generic summary.

func (*AskUser) Info

func (a *AskUser) Info(context.Context) (*tool.ToolInfo, error)

Info returns AskUser's self-description. Name MUST equal "AskUser".

func (*AskUser) InvokableRun

func (a *AskUser) InvokableRun(ctx context.Context, argsJSON string) (*tool.ToolResult, error)

InvokableRun parses the args, requests user input via the seam, validates the answer against the choice list (if any), and returns the validated answer as the tool-result text. Every failure is a tool-result error STRING; it never returns a Go error.

func (*AskUser) PrepareCall

PrepareCall implements the mandatory tool preparation capability with a PURE, empty request: AskUser routes a question through the loop's own user-input capability — no filesystem, network, or command effect — so there is no capability to gate. Argument validation stays in InvokableRun (every failure is a tool-result string the model can recover from).

func (*AskUser) UserInputReplaySafe added in v0.13.0

func (a *AskUser) UserInputReplaySafe() bool

UserInputReplaySafe reports true: every path through InvokableRun up to and including the requestUserInput call only parses argsJSON into askUserArgs and validates it (parseAskUserArgs) — no filesystem, network, process, or other effect outside the process happens before the question is asked. A replayed run against a restored gate re-parses the same argsJSON and asks the same question, exactly as tool.UserInputReplaySafe requires.

Jump to

Keyboard shortcuts

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