internal

package
v0.1.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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