tools

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoderConfig

func NewCoderConfig(model string) agent.SubAgentConfig

func NewResearcherConfig

func NewResearcherConfig(model string) agent.SubAgentConfig

func NewReviewerConfig

func NewReviewerConfig(model string) agent.SubAgentConfig

func NewTesterConfig

func NewTesterConfig(model string) agent.SubAgentConfig

func WithDir

func WithDir(ctx context.Context, dir string) context.Context

Types

type BashTool

type BashTool struct {
	MaxTimeoutMs int
	MaxOutput    int
}

BashTool executes shell commands.

func NewBashTool

func NewBashTool() *BashTool

func (*BashTool) Description

func (t *BashTool) Description() string

func (*BashTool) Execute

func (t *BashTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*BashTool) IsSafeCommand

func (t *BashTool) IsSafeCommand(cmd string) bool

IsSafeCommand checks if a command is in the safe list.

func (*BashTool) Name

func (t *BashTool) Name() string

func (*BashTool) Parameters

func (t *BashTool) Parameters() json.RawMessage

func (*BashTool) RequiresPermission

func (t *BashTool) RequiresPermission() bool

type DelegateTask

type DelegateTask struct {
	Agent  string `json:"agent"`
	Prompt string `json:"prompt"`
}

type DelegateTool

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

func NewDelegateTool

func NewDelegateTool(
	prov provider.Provider,
	store session.SessionStore,
	registry tool.ToolRegistry,
	configs map[string]agent.SubAgentConfig,
) *DelegateTool

func (*DelegateTool) Description

func (t *DelegateTool) Description() string

func (*DelegateTool) Execute

func (t *DelegateTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*DelegateTool) Name

func (t *DelegateTool) Name() string

func (*DelegateTool) Parameters

func (t *DelegateTool) Parameters() json.RawMessage

func (*DelegateTool) RequiresPermission

func (t *DelegateTool) RequiresPermission() bool

type EditFileTool

type EditFileTool struct{}

EditFileTool performs find/replace within a file.

func (*EditFileTool) Description

func (t *EditFileTool) Description() string

func (*EditFileTool) Execute

func (t *EditFileTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*EditFileTool) Name

func (t *EditFileTool) Name() string

func (*EditFileTool) Parameters

func (t *EditFileTool) Parameters() json.RawMessage

func (*EditFileTool) RequiresPermission

func (t *EditFileTool) RequiresPermission() bool

type GitTool

type GitTool struct{}

func NewGitTool

func NewGitTool() *GitTool

func (*GitTool) Description

func (t *GitTool) Description() string

func (*GitTool) Execute

func (t *GitTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*GitTool) Name

func (t *GitTool) Name() string

func (*GitTool) Parameters

func (t *GitTool) Parameters() json.RawMessage

func (*GitTool) RequiresPermission

func (t *GitTool) RequiresPermission() bool

func (*GitTool) RequiresPermissionForInput

func (t *GitTool) RequiresPermissionForInput(input json.RawMessage) bool

type GlobTool

type GlobTool struct{}

GlobTool finds files matching a pattern.

func (*GlobTool) Description

func (t *GlobTool) Description() string

func (*GlobTool) Execute

func (t *GlobTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*GlobTool) Name

func (t *GlobTool) Name() string

func (*GlobTool) Parameters

func (t *GlobTool) Parameters() json.RawMessage

func (*GlobTool) RequiresPermission

func (t *GlobTool) RequiresPermission() bool

type GrepTool

type GrepTool struct{}

GrepTool searches file contents using regex patterns. Uses ripgrep (rg) if available, falls back to Go regex.

func (*GrepTool) Description

func (t *GrepTool) Description() string

func (*GrepTool) Execute

func (t *GrepTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*GrepTool) Name

func (t *GrepTool) Name() string

func (*GrepTool) Parameters

func (t *GrepTool) Parameters() json.RawMessage

func (*GrepTool) RequiresPermission

func (t *GrepTool) RequiresPermission() bool

type ListDirTool

type ListDirTool struct{}

func (*ListDirTool) Description

func (t *ListDirTool) Description() string

func (*ListDirTool) Execute

func (t *ListDirTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*ListDirTool) Name

func (t *ListDirTool) Name() string

func (*ListDirTool) Parameters

func (t *ListDirTool) Parameters() json.RawMessage

func (*ListDirTool) RequiresPermission

func (t *ListDirTool) RequiresPermission() bool

type ReadFileTool

type ReadFileTool struct{}

ReadFileTool reads file contents with optional line range.

func (*ReadFileTool) Description

func (t *ReadFileTool) Description() string

func (*ReadFileTool) Execute

func (t *ReadFileTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*ReadFileTool) Name

func (t *ReadFileTool) Name() string

func (*ReadFileTool) Parameters

func (t *ReadFileTool) Parameters() json.RawMessage

func (*ReadFileTool) RequiresPermission

func (t *ReadFileTool) RequiresPermission() bool

type Registry

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

Registry implements tool.ToolRegistry with thread-safe tool management.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new empty tool registry.

func (*Registry) Get

func (r *Registry) Get(name string) (tool.Tool, bool)

Get retrieves a tool by name.

func (*Registry) List

func (r *Registry) List() []tool.Tool

List returns all registered tools.

func (*Registry) Register

func (r *Registry) Register(t tool.Tool) error

Register adds a tool to the registry. Returns an error if a tool with the same name already exists.

func (*Registry) Schemas

func (r *Registry) Schemas() []provider.ToolDef

Schemas returns tool definitions for LLM function calling.

type SubAgentTool

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

func NewSubAgentTool

func NewSubAgentTool(
	config agent.SubAgentConfig,
	prov provider.Provider,
	store session.SessionStore,
	registry tool.ToolRegistry,
) *SubAgentTool

func (*SubAgentTool) Description

func (t *SubAgentTool) Description() string

func (*SubAgentTool) Execute

func (t *SubAgentTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*SubAgentTool) Name

func (t *SubAgentTool) Name() string

func (*SubAgentTool) Parameters

func (t *SubAgentTool) Parameters() json.RawMessage

func (*SubAgentTool) RequiresPermission

func (t *SubAgentTool) RequiresPermission() bool

type WebFetchTool

type WebFetchTool struct {
	Client         *http.Client
	MaxContentLen  int
	DefaultTimeout time.Duration
}

func NewWebFetchTool

func NewWebFetchTool() *WebFetchTool

func (*WebFetchTool) Description

func (t *WebFetchTool) Description() string

func (*WebFetchTool) Execute

func (t *WebFetchTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*WebFetchTool) Name

func (t *WebFetchTool) Name() string

func (*WebFetchTool) Parameters

func (t *WebFetchTool) Parameters() json.RawMessage

func (*WebFetchTool) RequiresPermission

func (t *WebFetchTool) RequiresPermission() bool

type WriteFileTool

type WriteFileTool struct{}

WriteFileTool creates or overwrites a file with the given content.

func (*WriteFileTool) Description

func (t *WriteFileTool) Description() string

func (*WriteFileTool) Execute

func (t *WriteFileTool) Execute(ctx context.Context, input json.RawMessage) (tool.ToolResult, error)

func (*WriteFileTool) Name

func (t *WriteFileTool) Name() string

func (*WriteFileTool) Parameters

func (t *WriteFileTool) Parameters() json.RawMessage

func (*WriteFileTool) RequiresPermission

func (t *WriteFileTool) RequiresPermission() bool

Jump to

Keyboard shortcuts

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