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

tooltest

package
v7.68.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tooltest provides repository-internal helpers for unit-testing local tool handlers without exposing a production authority bypass from package tools.

Index

Constants

This section is empty.

Variables

View Source
var (
	PermissionDecisionAllow = PermissionDecision{State: PermissionDecisionStateAllow}
	PermissionDecisionDeny  = PermissionDecision{State: PermissionDecisionStateDeny}
)

Functions

func Dispatcher

func Dispatcher(approver Approver) tools.EffectDispatcher

Dispatcher returns an in-memory authorization adapter for repository tests. It must not be used by production packages.

func Run

func Run(ctx context.Context, registry *tools.Registry, call tools.ToolCall, approver Approver) tools.Result

Run executes one registered handler under an explicitly test-only dispatcher.

func RunBatch

func RunBatch(ctx context.Context, registry *tools.Registry, calls []tools.ToolCall, approver Approver) []tools.Result

RunBatch executes registered handlers under an explicitly test-only dispatcher.

Types

type ApprovalRequest

type ApprovalRequest struct {
	ApprovalID    string
	ID            string
	Name          string
	Args          string
	ArgsHash      string
	ValidatedArgs any
	Activity      *tools.ActivityPresentation
	RunID         string
	ThreadID      string
	TurnID        string
	PromptScopeID string
	Step          int
	BatchIndex    int
	BatchSize     int
	Resources     []tools.ResourceRef
	Effects       []tools.Effect
	Labels        map[string]string
	HostContext   map[string]string
	ReadOnly      bool
	Destructive   bool
	OpenWorld     bool
}

type PermissionDecision

type PermissionDecision struct {
	State  PermissionDecisionState
	Reason string
}

func PermissionDecisionDenied

func PermissionDecisionDenied(reason string) PermissionDecision

func (PermissionDecision) Allowed

func (d PermissionDecision) Allowed() bool

func (PermissionDecision) RejectionReason

func (d PermissionDecision) RejectionReason() string

type PermissionDecisionState

type PermissionDecisionState string
const (
	PermissionDecisionStateAllow PermissionDecisionState = "allow"
	PermissionDecisionStateDeny  PermissionDecisionState = "deny"
)

Jump to

Keyboard shortcuts

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