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 ¶
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 ¶
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