process

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTools

func LoadTools(path string) (map[string]ProcessConfig, error)

LoadTools reads a configuration file (YAML or JSON) and returns a map of tool names to configs.

Types

type ConfigFile

type ConfigFile struct {
	Tools []ProcessConfig `yaml:"tools" json:"tools"`
}

ConfigFile represents the structure of tools.yaml

type ProcessConfig

type ProcessConfig struct {
	Name        string            `yaml:"name" json:"name"`
	Command     string            `yaml:"command" json:"command"`
	Args        []string          `yaml:"args" json:"args"`
	Environment map[string]string `yaml:"env" json:"env"`
	Description string            `yaml:"description" json:"description"`
}

ProcessConfig represents the configuration for an external tool execution.

type RegisteredProcess

type RegisteredProcess struct {
	Command string
	Args    []string // Default/Template args
}

RegisteredProcess defines a allowed command execution.

type Runner

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

Runner implements a ToolRunner that executes local processes. It follows a Strict Registry pattern for security (Allow-Listing).

func NewRunner

func NewRunner(opts ...RunnerOption) *Runner

NewRunner creates a new Process Runner.

func (*Runner) Execute

func (r *Runner) Execute(ctx context.Context, toolCall domain.ToolCall) (domain.ToolResult, error)

Execute satisfies the hypothetical ToolRunner interface (or is called by IOHandler). For now, checks the toolCall.Name against the registry.

func (*Runner) Register

func (r *Runner) Register(name string, command string, args ...string)

Register adds a trusted script/command to the allow-list.

type RunnerOption

type RunnerOption func(*Runner)

RunnerOption configures the runner.

func WithBaseDir added in v0.7.3

func WithBaseDir(dir string) RunnerOption

WithBaseDir sets the working directory for executed processes.

func WithInlineExecution

func WithInlineExecution(allow bool) RunnerOption

WithInlineExecution enables ad-hoc execution (Dangerous).

func WithRegistry

func WithRegistry(tools map[string]ProcessConfig) RunnerOption

WithRegistry populates the allow-list from a loaded config.

Jump to

Keyboard shortcuts

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