shell

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package shell provides permission-gated command execution tools for agents that explicitly opt into local coding workflows.

Index

Constants

View Source
const (
	// ToolName is the model-visible name of the shell execution tool.
	ToolName = "shell_exec"

	// DefaultTimeout caps a single shell_exec call when ExecOptions.Timeout
	// is zero.
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func Exec

func Exec(opts ExecOptions) (glue.Tool, error)

Exec returns a glue.Tool named "shell_exec" that runs argv-style commands through a glue.Executor after validating workspace and binary bounds. The tool is permission-gated via ToolSpec metadata.

Types

type ExecOptions

type ExecOptions struct {
	// Executor runs the validated command. Nil uses glue.LocalExecutor{}.
	Executor glue.Executor

	// WorkDir is the workspace root. Required.
	WorkDir string

	// Env is the exact child environment. The model cannot add env vars.
	Env []string

	// AllowedBinaries is a basename allowlist. Empty means deny all.
	AllowedBinaries []string

	// Timeout caps each command. Zero falls back to DefaultTimeout.
	Timeout time.Duration

	// MaxOutputBytes caps stdout and stderr independently. Zero falls
	// back to glue.DefaultExecMaxOutputBytes.
	MaxOutputBytes int
}

ExecOptions configures Exec.

Jump to

Keyboard shortcuts

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