class

Tools::ShellAccess::ShellCommandTool

Inherits Tools::BuiltInFunction < LLM::LocalFunction < LLM::Function < Reference < Object

The ShellCommandTool class defines a tool for executing shell commands within the current project directory. Note: This implementation assumes a protected environment (e.g., chroot).

Constants

ALWAYS_RESTRICTED = ["rm", "eval", "$(", "--expression", "-e ", "-e=", "|", ";"].map(&.upcase)
COMMON_DESCRIPTION = "Executes one of the allowed shell commands from within the current project's directory and returns the shell command's output.Commands with restricted terms always require approval."
FORBIDDEN_STRINGS = ["..", "<", ">", "&"]

In *nix commands, & is for background execution, so we forbid it.

MULTI_CMD_SPLIT_RX = /(\|\|)|(&&)|[;|]/

Class methods

description

The pre-loaded static description of the function.

Source
function_name

The name of the function

Source
side_effects

Don't know what the chell command does, so assume anything is possible

Instance methods

allowed_commands

Allowed commands can be specified via tool settings in the config file, or via ENKAIDU_ALLOWED_EXECUTABLES environment variable, with config taking priority. Approved commands are includes in the allowed commands list.

Source
approved_commands

Approved commands can be specified via tool settings in the config file, or via ENKAIDU_APPROVED_EXECUTABLES environment variable, with config taking priority.

Source
description

The runtime description of the function.

Source
name

The name of the function

Source
new_runner

Replace runner macro to create with self

Source
restricted_terms

Additional restricted terms can be specified via tool settings in the config file. Commands are checked if they are present ANYWHERE within.

Source

Nested types