tools

package
v0.0.0-...-b59f3eb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverTools

func DiscoverTools(dir string) []coretools.DiscoveredTool

DiscoverTools scans the given directory for tool scripts/modules.

Types

type CLIExecuteConfig

type CLIExecuteConfig struct {
	AllowedBinaries []string
	EnvPassthrough  []string
	TimeoutSeconds  int    // default 120
	MaxOutputBytes  int    // default 1MB
	WorkDir         string // confine path arguments to this directory
}

CLIExecuteConfig holds the configuration for the cli_execute tool.

func ParseCLIExecuteConfig

func ParseCLIExecuteConfig(raw map[string]any) CLIExecuteConfig

ParseCLIExecuteConfig extracts typed config from the map[string]any that YAML produces. Handles both int and float64 for numeric fields.

type CLIExecuteTool

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

CLIExecuteTool is a Category-A builtin tool that executes only pre-approved CLI binaries via exec.Command (no shell), with env isolation, timeouts, and output limits.

func NewCLIExecuteTool

func NewCLIExecuteTool(config CLIExecuteConfig) *CLIExecuteTool

NewCLIExecuteTool creates a CLIExecuteTool from the given config. It resolves each binary via exec.LookPath at startup and records availability.

func (*CLIExecuteTool) Availability

func (t *CLIExecuteTool) Availability() (available, missing []string)

Availability returns the lists of available and missing binaries.

func (*CLIExecuteTool) Category

func (t *CLIExecuteTool) Category() coretools.Category

Category returns CategoryBuiltin.

func (*CLIExecuteTool) Description

func (t *CLIExecuteTool) Description() string

Description returns a description of the tool. Binary names are deliberately omitted — listing them here causes the LLM to regurgitate them when users ask capability questions. The LLM discovers allowed binaries from the schema enum.

func (*CLIExecuteTool) Execute

func (t *CLIExecuteTool) Execute(ctx context.Context, args json.RawMessage) (string, error)

Execute runs the specified binary with the given arguments after performing all security checks.

func (*CLIExecuteTool) InputSchema

func (t *CLIExecuteTool) InputSchema() json.RawMessage

InputSchema returns a dynamic JSON schema with the binary field's enum populated from AllowedBinaries.

func (*CLIExecuteTool) Name

func (t *CLIExecuteTool) Name() string

Name returns the tool name.

func (*CLIExecuteTool) SetProxyURL

func (t *CLIExecuteTool) SetProxyURL(url string)

SetProxyURL sets the egress proxy URL for subprocess env injection.

func (*CLIExecuteTool) WithCredentialInjector

func (t *CLIExecuteTool) WithCredentialInjector(inj *credentials.Injector) *CLIExecuteTool

WithCredentialInjector attaches an R9 JIT-credential injector. Called by the runner at startup after resolving AgentSpec.Credentials. nil-safe: passing nil is equivalent to not calling this.

type OSCommandExecutor

type OSCommandExecutor struct{}

OSCommandExecutor implements tools.CommandExecutor using os/exec.

func (*OSCommandExecutor) Run

func (e *OSCommandExecutor) Run(ctx context.Context, command string, args []string, stdin []byte) (string, error)

type RunSkillScriptTool

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

RunSkillScriptTool executes a helper script that ships inside a skill's own directory — the kind a SKILL.md body references by relative path ("run owl/scripts/check.py"). Unlike a `## Tool:` entry (registered as a first-class callable tool via registerSkillTools, `.sh`-only), this tool resolves an arbitrary script path relative to the skill directory, picks the interpreter from the extension (shell / python / javascript), and runs it with the skill directory as the working directory so the script's own relative references resolve. See issue #251.

Path resolution is confined to the skill directory (no `..` / absolute escape) via builtins.SafeSkillJoin. The subprocess inherits the same egress proxy + env passthrough as cli_execute and skill scripts.

func NewRunSkillScriptTool

func NewRunSkillScriptTool(workDir, proxyURL, socksURL string, envVars []string) *RunSkillScriptTool

NewRunSkillScriptTool constructs the tool rooted at the agent working directory, wired to the egress proxy and the skill env passthrough. socksURL is the raw-TCP SOCKS5 egress URL (empty when unconfigured).

func (*RunSkillScriptTool) Category

func (t *RunSkillScriptTool) Category() coretools.Category

func (*RunSkillScriptTool) Description

func (t *RunSkillScriptTool) Description() string

func (*RunSkillScriptTool) Execute

func (t *RunSkillScriptTool) Execute(ctx context.Context, args json.RawMessage) (string, error)

func (*RunSkillScriptTool) InputSchema

func (t *RunSkillScriptTool) InputSchema() json.RawMessage

func (*RunSkillScriptTool) Name

func (t *RunSkillScriptTool) Name() string

type SkillCommandExecutor

type SkillCommandExecutor struct {
	Timeout  time.Duration
	WorkDir  string   // agent working directory — script paths are relative to this
	EnvVars  []string // extra env var names to pass through (e.g., "TAVILY_API_KEY")
	ProxyURL string   // HTTP egress proxy URL (e.g., "http://127.0.0.1:54321")
	SOCKSURL string   // SOCKS5 egress proxy URL (e.g., "socks5h://127.0.0.1:54322"); empty when raw-TCP egress disabled
	Model    string   // configured LLM model name — passed as REVIEW_MODEL to skill scripts
}

SkillCommandExecutor implements tools.CommandExecutor with a configurable timeout and environment variable passthrough for skill scripts.

func (*SkillCommandExecutor) Run

func (e *SkillCommandExecutor) Run(ctx context.Context, command string, args []string, stdin []byte) (string, error)

Directories

Path Synopsis
Package browser implements the opt-in browser tool family (issue #94): a chromedp-driven headless Chromium whose traffic is forced through the agent's EgressProxy, exposed to the LLM as token-optimized tools that exchange indexed page digests instead of raw HTML.
Package browser implements the opt-in browser tool family (issue #94): a chromedp-driven headless Chromium whose traffic is forced through the agent's EgressProxy, exposed to the LLM as token-optimized tools that exchange indexed page digests instead of raw HTML.
Package devtools provides developer tools that are only available with --dev flag.
Package devtools provides developer tools that are only available with --dev flag.

Jump to

Keyboard shortcuts

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