shell

package
v1.62.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 23 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

func CreateScriptToolSet added in v1.60.0

func CreateScriptToolSet(ctx context.Context, toolset latest.Toolset, runConfig *config.RuntimeConfig) (tools.ToolSet, error)

CreateScriptToolSet is used by the tools registry.

func CreateToolSet added in v1.60.0

func CreateToolSet(ctx context.Context, toolset latest.Toolset, runConfig *config.RuntimeConfig) (tools.ToolSet, error)

CreateToolSet is used by the tools registry.

Types

type RunShellArgs

type RunShellArgs struct {
	Cmd     string `json:"cmd" jsonschema:"Shell command"`
	Cwd     string `json:"cwd,omitempty" jsonschema:"Working directory (default \".\")"`
	Timeout int    `json:"timeout,omitempty" jsonschema:"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:"Shell command to run in background"`
	Cwd string `json:"cwd,omitempty" jsonschema:"Working directory (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 ScriptToolSet added in v1.60.0

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

func NewScript added in v1.60.0

func NewScript(shellTools map[string]latest.ScriptShellToolConfig, env []string) (*ScriptToolSet, error)

func (*ScriptToolSet) Instructions added in v1.60.0

func (t *ScriptToolSet) Instructions() string

func (*ScriptToolSet) Tools added in v1.60.0

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

type StopBackgroundJobArgs

type StopBackgroundJobArgs struct {
	JobID string `json:"job_id" jsonschema:"Background job ID"`
}

type ToolSet added in v1.60.0

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

ToolSet provides shell command execution capabilities.

func New added in v1.60.0

func New(env []string, runConfig *config.RuntimeConfig) *ToolSet

New creates a new shell toolset.

func (*ToolSet) Instructions added in v1.60.0

func (t *ToolSet) Instructions() string

func (*ToolSet) Start added in v1.60.0

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

func (*ToolSet) Stop added in v1.60.0

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

func (*ToolSet) Tools added in v1.60.0

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

type ViewBackgroundJobArgs

type ViewBackgroundJobArgs struct {
	JobID string `json:"job_id" jsonschema:"Background job ID"`
}

Jump to

Keyboard shortcuts

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