toolkit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoApproveHandler

func AutoApproveHandler(ctx context.Context, result PermissionResult) bool

AutoApproveHandler always approves (for non-interactive mode)

func DefaultPermissionHandler

func DefaultPermissionHandler(ctx context.Context, result PermissionResult) bool

DefaultPermissionHandler prints to stdout and reads from stdin

Types

type Option

type Option func(*Toolkit)

Option is a functional option for configuring the toolkit

func WithAutoApprove

func WithAutoApprove(autoApprove bool) Option

WithAutoApprove enables auto-approval of all commands (non-interactive mode)

func WithPermissionHandler

func WithPermissionHandler(handler PermissionHandler) Option

WithPermissionHandler sets the permission handler for dangerous commands

func WithSkipCaution

func WithSkipCaution(skip bool) Option

WithSkipCaution skips confirmation for caution-level commands

type PermissionConfig

type PermissionConfig struct {
	// Handler is called when permission is needed (nil = auto-approve)
	Handler PermissionHandler
	// AutoApprove automatically approves all commands (non-interactive mode)
	AutoApprove bool
	// SkipCaution skips confirmation for caution-level commands
	SkipCaution bool
}

PermissionConfig holds permission settings for the toolkit

type PermissionHandler

type PermissionHandler func(ctx context.Context, result PermissionResult) bool

PermissionHandler is called when permission is needed Returns true if the command should proceed, false to block

type PermissionLevel

type PermissionLevel int

PermissionLevel indicates how dangerous a command is

const (
	// PermissionSafe - command is safe, no confirmation needed
	PermissionSafe PermissionLevel = iota
	// PermissionCaution - command modifies files, should confirm in interactive mode
	PermissionCaution
	// PermissionDangerous - command is potentially destructive, always confirm
	PermissionDangerous
	// PermissionBlocked - command should never run (long-running servers, etc.)
	PermissionBlocked
)

type PermissionResult

type PermissionResult struct {
	Level   PermissionLevel
	Reason  string
	Command string
}

PermissionResult contains the analysis of a command

func CheckPermission

func CheckPermission(command string) PermissionResult

CheckPermission analyzes a command and returns its permission level

type Toolkit

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

Toolkit provides a collection of tools for the AI agent

func New

func New(cwd string, opts ...Option) *Toolkit

New creates a new Toolkit with the specified working directory and options

func (*Toolkit) Get

func (tk *Toolkit) Get(name string) *tool.Tool

Get returns a tool by name, or nil if not found

func (*Toolkit) GetTools

func (tk *Toolkit) GetTools() []*tool.Tool

GetTools returns all available tools

func (*Toolkit) Run

func (tk *Toolkit) Run(ctx context.Context, name string, argsJSON string) (string, error)

Run executes a tool by name with the given JSON arguments

Jump to

Keyboard shortcuts

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