codebot

package
v0.0.0-...-51ec4da Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTool

func RegisterTool(tool Tool)

Types

type ASTEdit

type ASTEdit struct {
	Node     string `json:"node"`
	Action   string `json:"action"`
	Filename string `json:"filename"`
}

func (*ASTEdit) BuildFunctionDefinition

func (t *ASTEdit) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*ASTEdit) Run

func (t *ASTEdit) Run(ctx context.Context, c *Chat, args map[string]any) (*ASTEditResults, error)

type ASTEditResults

type ASTEditResults struct {
	Success bool `json:"success"`
}

type Chat

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

func NewChat

func NewChat(ctx context.Context, llmClient gollm.Client, model string, baseDir string, contextFiles map[string]*FileInfo, toolbox *Toolbox, ui ui.UI) (*Chat, error)

func (*Chat) Close

func (c *Chat) Close() error

func (*Chat) SendMessage

func (c *Chat) SendMessage(ctx context.Context, userParts ...any) error

type CreateFile

type CreateFile struct {
	Contents  string `json:"contents"`
	Filename  string `json:"filename"`
	Overwrite bool   `json:"overwrite"`
}

func (*CreateFile) BuildFunctionDefinition

func (t *CreateFile) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*CreateFile) Run

func (t *CreateFile) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type CreateFileResults

type CreateFileResults struct {
	Success bool `json:"success"`
}

type CustomRegexFilter

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

CustomRegexFilter implements the Filter interface. It allows for inclusion and exclusion of tools based on regex patterns. Note: If excludeRegex is not give, it will not exclude any tools.

func NewCustomRegexFilter

func NewCustomRegexFilter(includeRegex, excludeRegex string) (*CustomRegexFilter, error)

func (*CustomRegexFilter) Exclude

func (a *CustomRegexFilter) Exclude(tool Tool) bool

func (*CustomRegexFilter) Include

func (a *CustomRegexFilter) Include(tool Tool) bool

type EditFile

type EditFile struct {
	ExistingText string `json:"existing_text"`
	NewText      string `json:"new_text"`
	Filename     string `json:"filename"`
}

func (*EditFile) BuildFunctionDefinition

func (t *EditFile) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*EditFile) Run

func (t *EditFile) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type EditFileResults

type EditFileResults struct {
	Success bool `json:"success"`
}

type File

type File struct {
	Filename string `json:"filename"`
}

type FileInfo

type FileInfo struct {
	Path    string
	Content string
}

type Filter

type Filter interface {
	// Exclude methods determine if a tool should be excluded based on regex patterns.
	Exclude(tool Tool) bool
	// Include methods determine if a tool should be included based on regex patterns.
	Include(tool Tool) bool
}

Filter interface for tools to be included or excluded based on regex patterns.

type FindInWorkspace

type FindInWorkspace struct {
	FindText string `json:"find_text"`
}

func (*FindInWorkspace) BuildFunctionDefinition

func (t *FindInWorkspace) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*FindInWorkspace) Run

func (t *FindInWorkspace) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type FindInWorkspaceResult

type FindInWorkspaceResult struct {
	Matches []*Match `json:"matches"`
	Result  string   `json:"result"`
}

type FunctionResult

type FunctionResult struct {
	Response any
	Error    error
}

type ListInWorkspace

type ListInWorkspace struct {
	FindFileName string `json:"find_file_name"`
}

func (*ListInWorkspace) BuildFunctionDefinition

func (t *ListInWorkspace) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*ListInWorkspace) Run

func (t *ListInWorkspace) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type ListInWorkspaceResponse

type ListInWorkspaceResponse struct {
	Matches []*File `json:"matches"`
	Result  string  `json:"result"`
}

type Match

type Match struct {
	Filename     string `json:"filename"`
	MatchingLine string `json:"matching_line"`
	Context      string `json:"context"`
}

type ReadFile

type ReadFile struct {
	Filename string `json:"filename"`
}

func (*ReadFile) BuildFunctionDefinition

func (t *ReadFile) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*ReadFile) Run

func (t *ReadFile) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type ReadFileResponse

type ReadFileResponse struct {
	Contents string `json:"contents"`
}

type RunShellCommand

type RunShellCommand struct {
	Command string `json:"shell_command"`
}

func (*RunShellCommand) BuildFunctionDefinition

func (t *RunShellCommand) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*RunShellCommand) Run

func (t *RunShellCommand) Run(ctx context.Context, c *Chat, llmArgs map[string]any) (any, error)

type RunShellCommandResults

type RunShellCommandResults struct {
	Stdout   string `json:"stdout"`
	Stderr   string `json:"stderr"`
	ExitCode int    `json:"exit_code"`
}

type RunTerminalCommand

type RunTerminalCommand struct {
	Command string `json:"command"`
	Args    string `json:"args"`
}

func (*RunTerminalCommand) BuildFunctionDefinition

func (t *RunTerminalCommand) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*RunTerminalCommand) Run

func (t *RunTerminalCommand) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type RunTerminalCommandResults

type RunTerminalCommandResults struct {
	Success bool   `json:"success"`
	Output  string `json:"output"`
	Error   string `json:"error"`
}

type Tool

type Tool interface {
	BuildFunctionDefinition() *gollm.FunctionDefinition

	Run(ctx context.Context, c *Chat, args map[string]any) (any, error)
}

func GetAllTools

func GetAllTools() []Tool

func GetFilteredTools

func GetFilteredTools(filter Filter) []Tool

GetFilteredTools returns a list of tools that match the filter criteria. It excludes tools that are marked for exclusion and includes those that are marked for inclusion.

type Toolbox

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

func NewToolbox

func NewToolbox(tools []Tool) *Toolbox

func (*Toolbox) CallFunction

func (t *Toolbox) CallFunction(ctx context.Context, c *Chat, functionCall gollm.FunctionCall) (*FunctionResult, error)

func (*Toolbox) GetFunctionDefinitions

func (t *Toolbox) GetFunctionDefinitions() []*gollm.FunctionDefinition

type VerifyCode

type VerifyCode struct {
	Filename string `json:"filename"`
}

func (*VerifyCode) BuildFunctionDefinition

func (t *VerifyCode) BuildFunctionDefinition() *gollm.FunctionDefinition

func (*VerifyCode) Run

func (t *VerifyCode) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type VerifyCodeResponse

type VerifyCodeResponse struct {
	Success bool `json:"success"`
	Errors  []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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