tools

package
v0.106.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ask func(ctx context.Context, req AskRequest) (answers []string, ok bool)
View Source
var Browser *browser.Manager
View Source
var ComputerApprover func(app string) bool
View Source
var ComputerPolicy *computer.Policy
View Source
var LSP interface {
	WaitDiagnostics(ctx context.Context, path string) string
}
View Source
var Suggester func(name string) []string

Functions

func AttachScreenshot added in v0.103.0

func AttachScreenshot(ctx context.Context, jpeg []byte) bool

func Authorize added in v0.103.0

func Authorize(ctx context.Context, tool, command string) error

func BinaryPlaceholder

func BinaryPlaceholder(name string, size int) string

func CommandRule

func CommandRule(command string) string

func Defs

func Defs(ts []Tool) []ai.Tool

func Execute

func Execute(ctx context.Context, ts []Tool, name string, args json.RawMessage) string

func IsBinary

func IsBinary(data []byte) bool

func IsStale

func IsStale(err error) bool

func ResolvePath added in v0.103.0

func ResolvePath(ctx context.Context, path string) string

func SuggestTool

func SuggestTool(name string, candidates []string) []string

func Truncate

func Truncate(s string) string

func TruncateTail

func TruncateTail(s string) string

func WithGate added in v0.103.0

func WithGate(ctx context.Context, gate func(GateRequest) (GateDecision, string)) context.Context

func WithOnUpdate

func WithOnUpdate(ctx context.Context, onUpdate func(outputSoFar string)) context.Context

func WithWorkingDir added in v0.103.0

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

func WorkingDir added in v0.103.0

func WorkingDir(ctx context.Context) string

Types

type AskOption

type AskOption struct {
	Label       string `json:"label"`
	Description string `json:"description"`
}

type AskRequest

type AskRequest struct {
	Question string      `json:"question"`
	Options  []AskOption `json:"options"`
	Multiple bool        `json:"multiple"`
}

type GateDecision

type GateDecision int
const (
	GateAllowOnce GateDecision = iota
	GateAllowAlways
	GateReject
)

type GateRequest

type GateRequest struct {
	Context context.Context
	Tool    string
	Command string
	Rule    string
}

type InteractiveRunner

type InteractiveRunner interface {
	Run(ctx context.Context, command string, timeout time.Duration, keys <-chan []byte) string
}
var InteractiveBash InteractiveRunner

type Result added in v0.103.0

type Result struct {
	Text  string
	Parts []ai.ContentPart
}

func ExecuteResult added in v0.103.0

func ExecuteResult(ctx context.Context, ts []Tool, name string, args json.RawMessage, vision bool) Result

type Tool

type Tool struct {
	Def       ai.Tool
	Run       func(ctx context.Context, args json.RawMessage) (string, error)
	NoInherit bool
}

func All

func All() []Tool

func BrowserExec

func BrowserExec() Tool

func ComputerExec

func ComputerExec() Tool

func QuestionTool

func QuestionTool() Tool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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