toolapproval

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDecisionPatch added in v0.1.10

func ApplyDecisionPatch(args map[string]interface{}, patch map[string]interface{}) error

func ApplyEdits

func ApplyEdits(args map[string]interface{}, editors []*EditorView, editedFields map[string]interface{}) error

func ApplyReview added in v0.1.9

func ApplyReview(args map[string]interface{}, review *llm.ApprovalReviewConfig, payload map[string]interface{}) error

func ExtractEditedFields

func ExtractEditedFields(payload map[string]interface{}) map[string]interface{}

func WithElicitor

func WithElicitor(ctx context.Context, e Elicitor) context.Context

Types

type EditorView

type EditorView struct {
	Name        string        `json:"name"`
	Kind        string        `json:"kind"`
	Path        string        `json:"path,omitempty"`
	Label       string        `json:"label,omitempty"`
	Description string        `json:"description,omitempty"`
	Options     []*OptionView `json:"options,omitempty"`
}

type Elicitor

type Elicitor interface {
	ElicitToolApproval(ctx context.Context, turn *runtimerequestctx.TurnMeta, toolName string, cfg *llm.ApprovalConfig, args map[string]interface{}) (action string, payload map[string]interface{}, err error)
}

Elicitor creates an inline approval prompt for a tool call and waits for the user's decision. It returns the normalized action string: accept, decline, or cancel.

func ElicitorFromContext

func ElicitorFromContext(ctx context.Context) Elicitor

type OptionView

type OptionView struct {
	ID          string      `json:"id"`
	Label       string      `json:"label"`
	Description string      `json:"description,omitempty"`
	Item        interface{} `json:"item,omitempty"`
	Selected    bool        `json:"selected"`
}

type View

type View struct {
	ToolName  string                                 `json:"toolName"`
	Title     string                                 `json:"title"`
	Message   string                                 `json:"message"`
	Data      interface{}                            `json:"data,omitempty"`
	Editors   []*EditorView                          `json:"editors,omitempty"`
	Forge     *llm.ApprovalForgeView                 `json:"forge,omitempty"`
	Decisions map[string]*llm.ApprovalDecisionAction `json:"decisions,omitempty"`
}

View is the canonical view model built from a tool call request and its approval config.

func BuildView

func BuildView(toolName string, args map[string]interface{}, cfg *llm.ApprovalConfig) View

Jump to

Keyboard shortcuts

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