internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalDecision added in v0.3.0

type ApprovalDecision int

ApprovalDecision represents user's approval decision

const (
	ApprovalDeny ApprovalDecision = iota
	ApprovalAllow
	ApprovalAllowAll
)

func (ApprovalDecision) String added in v0.3.0

func (ad ApprovalDecision) String() string

String returns string representation of approval decision

type ApprovalSession added in v0.3.0

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

ApprovalSession tracks approval decisions for a session

func NewApprovalSession added in v0.3.0

func NewApprovalSession() *ApprovalSession

NewApprovalSession creates a new approval session

func (*ApprovalSession) IsApprovalSkipped added in v0.3.0

func (as *ApprovalSession) IsApprovalSkipped() bool

IsApprovalSkipped returns whether approval is being skipped for the session

func (*ApprovalSession) PromptForApproval added in v0.3.0

func (as *ApprovalSession) PromptForApproval(command string) (ApprovalDecision, error)

PromptForApproval prompts the user for command execution approval

func (*ApprovalSession) SetSkipApproval added in v0.3.0

func (as *ApprovalSession) SetSkipApproval(skip bool)

SetSkipApproval sets the skip approval flag

type BashTool

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

BashTool represents the Bash tool that LLMs can invoke

func NewBashTool

func NewBashTool(manager *LLMToolsManager) *BashTool

NewBashTool creates a new Bash tool

func (*BashTool) Execute

func (bt *BashTool) Execute(command string) (string, error)

Execute executes a bash command and returns the result

func (*BashTool) ExecuteJSON

func (bt *BashTool) ExecuteJSON(command string) (string, error)

ExecuteJSON executes a bash command and returns JSON result

type LLMToolsManager

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

LLMToolsManager provides tools that LLMs can invoke

func NewLLMToolsManager

func NewLLMToolsManager(cfg *config.Config) *LLMToolsManager

NewLLMToolsManager creates a new LLM tools manager

func (*LLMToolsManager) GetAvailableTools

func (manager *LLMToolsManager) GetAvailableTools() []ToolDefinition

GetAvailableTools returns the list of available tools for LLMs

func (*LLMToolsManager) InvokeTool

func (manager *LLMToolsManager) InvokeTool(toolName string, parameters map[string]interface{}) (string, error)

InvokeTool invokes a tool by name with given parameters

type ToolDefinition

type ToolDefinition struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters"`
}

ToolDefinition represents a tool definition for LLMs

type ToolEngine

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

ToolEngine manages tool execution with security controls

func NewToolEngine

func NewToolEngine(cfg *config.Config) *ToolEngine

NewToolEngine creates a new tool engine

func (*ToolEngine) ExecuteBash

func (te *ToolEngine) ExecuteBash(command string) (*ToolResult, error)

ExecuteBash executes a bash command with security validation

func (*ToolEngine) GetApprovalSession added in v0.3.0

func (te *ToolEngine) GetApprovalSession() *ApprovalSession

GetApprovalSession returns the approval session

func (*ToolEngine) ListAllowedCommands

func (te *ToolEngine) ListAllowedCommands() []string

ListAllowedCommands returns the list of whitelisted commands

func (*ToolEngine) ValidateCommand

func (te *ToolEngine) ValidateCommand(command string) error

ValidateCommand checks if a command would be allowed without executing it

type ToolResult

type ToolResult struct {
	Command  string `json:"command"`
	Output   string `json:"output"`
	Error    string `json:"error,omitempty"`
	ExitCode int    `json:"exit_code"`
	Duration string `json:"duration"`
}

ToolResult represents the result of a tool execution

Jump to

Keyboard shortcuts

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