shell

package
v1.55.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ToolNameShell              = "shell"
	ToolNameRunShellBackground = "run_background_job"
	ToolNameListBackgroundJobs = "list_background_jobs"
	ToolNameViewBackgroundJob  = "view_background_job"
	ToolNameStopBackgroundJob  = "stop_background_job"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RunShellArgs

type RunShellArgs struct {
	Cmd     string `json:"cmd" jsonschema:"The shell command to execute"`
	Cwd     string `json:"cwd,omitempty" jsonschema:"The working directory to execute the command in (default: \".\")"`
	Timeout int    `json:"timeout,omitempty" jsonschema:"Command execution timeout in seconds (default: 30)"`
}

func (*RunShellArgs) UnmarshalJSON

func (a *RunShellArgs) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts both the canonical "cmd" key and the common alias "command" for the shell command parameter.

The advertised schema still declares "cmd" as the canonical name, but many models (particularly ones biased by Anthropic's built-in bash tool and other ecosystems that use "command") occasionally emit "command" instead. Accepting both prevents a wasted turn on an empty-command error while keeping the canonical contract unchanged. When "cmd" is present with a non-blank value it wins; a blank (empty or whitespace-only) "cmd" falls back to "command" so a valid alias is not silently shadowed.

type RunShellBackgroundArgs

type RunShellBackgroundArgs struct {
	Cmd string `json:"cmd" jsonschema:"The shell command to execute in the background"`
	Cwd string `json:"cwd,omitempty" jsonschema:"The working directory to execute the command in (default: \".\")"`
}

func (*RunShellBackgroundArgs) UnmarshalJSON

func (a *RunShellBackgroundArgs) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts both "cmd" (canonical) and "command" (common alias), mirroring RunShellArgs.UnmarshalJSON. See its comment for rationale.

type ScriptShellTool

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

func NewScriptShellTool

func NewScriptShellTool(shellTools map[string]latest.ScriptShellToolConfig, env []string) (*ScriptShellTool, error)

func (*ScriptShellTool) Instructions

func (t *ScriptShellTool) Instructions() string

func (*ScriptShellTool) Tools

func (t *ScriptShellTool) Tools(context.Context) ([]tools.Tool, error)

type StopBackgroundJobArgs

type StopBackgroundJobArgs struct {
	JobID string `json:"job_id" jsonschema:"The ID of the background job to stop"`
}

type Tool

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

Tool provides shell command execution capabilities.

func NewShellTool

func NewShellTool(env []string, runConfig *config.RuntimeConfig) *Tool

NewShellTool creates a new shell tool.

func (*Tool) Instructions

func (t *Tool) Instructions() string

func (*Tool) Start

func (t *Tool) Start(context.Context) error

func (*Tool) Stop

func (t *Tool) Stop(context.Context) error

func (*Tool) Tools

func (t *Tool) Tools(context.Context) ([]tools.Tool, error)

type ViewBackgroundJobArgs

type ViewBackgroundJobArgs struct {
	JobID string `json:"job_id" jsonschema:"The ID of the background job to view"`
}

Jump to

Keyboard shortcuts

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