types

package
v1.144.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package types defines the shared wire contracts for the shell tools.

Index

Constants

View Source
const ToolNameShell = "shell"

Variables

This section is empty.

Functions

This section is empty.

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.

The command is resolved by safety.CommandArg over an exact-key map rather than by struct tags: encoding/json matches keys case-insensitively with last-wins, so {"cmd":"ls","CMD":"rm -rf x"} would run a command the runtime never classified. Sharing the resolver keeps the executed command identical to the labelled one.

Jump to

Keyboard shortcuts

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