tools

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalGate

type ApprovalGate struct {
	OnPresent func(toolName string, args json.RawMessage, preview string) (bool, error)
	// contains filtered or unexported fields
}

func NewApprovalGate

func NewApprovalGate() *ApprovalGate

func NewApprovalGateWithPermissions added in v0.2.0

func NewApprovalGateWithPermissions(autoApprove, deny []string) *ApprovalGate

func (*ApprovalGate) IsAutoApproved added in v0.2.0

func (g *ApprovalGate) IsAutoApproved(toolName string) bool

func (*ApprovalGate) IsDenied added in v0.2.0

func (g *ApprovalGate) IsDenied(toolName string) bool

func (*ApprovalGate) RequestApproval

func (g *ApprovalGate) RequestApproval(toolName string, args json.RawMessage, preview string) (bool, error)

func (*ApprovalGate) SetPermissions added in v0.2.0

func (g *ApprovalGate) SetPermissions(autoApprove, deny []string)

func (*ApprovalGate) WrapExecution

func (g *ApprovalGate) WrapExecution(ctx context.Context, tool Tool, args json.RawMessage) (Result, error)

type FilePatchTool

type FilePatchTool struct {
	IgnoreMatcher ignore.Matcher
	OnModified    func(path string)
}

func (*FilePatchTool) Execute

func (f *FilePatchTool) Execute(ctx context.Context, args json.RawMessage) (Result, error)

func (*FilePatchTool) RequiresApproval

func (f *FilePatchTool) RequiresApproval() bool

func (*FilePatchTool) Spec

func (f *FilePatchTool) Spec() ToolSpec

type FileReadTool

type FileReadTool struct {
	IgnoreMatcher ignore.Matcher
}

func (*FileReadTool) Execute

func (f *FileReadTool) Execute(ctx context.Context, args json.RawMessage) (Result, error)

func (*FileReadTool) RequiresApproval

func (f *FileReadTool) RequiresApproval() bool

func (*FileReadTool) Spec

func (f *FileReadTool) Spec() ToolSpec

type FileWriteTool

type FileWriteTool struct {
	IgnoreMatcher ignore.Matcher
	OnModified    func(path string)
}

func (*FileWriteTool) Execute

func (f *FileWriteTool) Execute(ctx context.Context, args json.RawMessage) (Result, error)

func (*FileWriteTool) RequiresApproval

func (f *FileWriteTool) RequiresApproval() bool

func (*FileWriteTool) Spec

func (f *FileWriteTool) Spec() ToolSpec

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Get

func (r *Registry) Get(name string) Tool

func (*Registry) List

func (r *Registry) List() []string

func (*Registry) Register

func (r *Registry) Register(t Tool)

func (*Registry) Specs

func (r *Registry) Specs() []ToolSpec

type Result

type Result struct {
	Output string `json:"output,omitempty"`
	Error  string `json:"error,omitempty"`
	Diff   string `json:"diff,omitempty"`
}

func (Result) String

func (r Result) String() string

type ShellExecTool

type ShellExecTool struct {
	Timeout time.Duration
}

func (*ShellExecTool) Execute

func (s *ShellExecTool) Execute(ctx context.Context, args json.RawMessage) (Result, error)

func (*ShellExecTool) RequiresApproval

func (s *ShellExecTool) RequiresApproval() bool

func (*ShellExecTool) Spec

func (s *ShellExecTool) Spec() ToolSpec

type Tool

type Tool interface {
	Spec() ToolSpec
	Execute(ctx context.Context, args json.RawMessage) (Result, error)
	RequiresApproval() bool
}

type ToolSpec

type ToolSpec struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Parameters  json.RawMessage `json:"parameters"`
}

Jump to

Keyboard shortcuts

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