Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewShellBash ¶
func NewShellBash(cfg ShellBashConfig, deps ShellBashDeps) (agentkit.Tool, error)
NewShellBash registers tool/shell-bash: Execute bash commands rooted in the workspace (tool name: bash).
Best practices:
- Keep commands non-interactive; avoid pagers and prompts.
- For unattended runs pair with policy/shell-allowlist in strict mode.
Types ¶
type ShellBashConfig ¶
type ShellBashConfig struct {
// WorkDir is working directory relative to the workspace root.
WorkDir string `json:"workDir"`
// TimeoutSeconds is per-command limit when the model omits timeout; 0 means no limit.
TimeoutSeconds int `json:"timeoutSeconds"`
// Commands optionally overrides env var names injected for shell-bash.<token>.
// Default: scope is derived from the command's first token; keys come from L1 scopedEnv
// or secrets.enc.json / dotenv (/env add).
Commands map[string][]string `json:"commands,omitempty"`
// TrimEnv trims the child env to a minimal base (PATH/HOME/... + PWD) plus
// scoped/extra pairs. Default false: the child inherits the full host env
// (os.Environ) plus scoped pairs — secrets belong in scopedEnv / /env add.
TrimEnv *bool `json:"trimEnv,omitempty"`
// ExtraEnv adds static, non-secret KEY=value entries to the child env.
// Secrets belong in credentials scopedEnv / /env add, not here.
ExtraEnv map[string]string `json:"extraEnv,omitempty"`
}
func (*ShellBashConfig) SetDefaults ¶ added in v0.3.48
func (c *ShellBashConfig) SetDefaults()
SetDefaults implements pluginkit.Defaulter.
func (*ShellBashConfig) Validate ¶ added in v0.3.48
func (c *ShellBashConfig) Validate() error
Validate implements pluginkit.Validator.
type ShellBashDeps ¶
type ShellBashDeps struct {
Workspace workspace.Service `json:"workspace"`
Credentials credentials.Store `json:"credentials,omitempty"`
}
type ShellInput ¶
type ShellInput struct {
Command string `json:"command" jsonschema:"Shell command to execute"`
Timeout *float64 `json:"timeout,omitempty" jsonschema:"Timeout in seconds (optional, no default timeout)"`
}
ShellInput matches pi bash tool parameters.
type ShellOutput ¶
type StructuredShell ¶ added in v0.3.69
type StructuredShell interface {
// RunStructured executes command in the tool's workspace work dir (bash -lc),
// with optional per-call timeout in seconds. Callers may wrap with cd.
RunStructured(ctx context.Context, command string, timeoutSeconds *float64) (stdout, stderr string, exitCode int, err error)
}
StructuredShell is an optional capability on tool/shell-bash: run a command and get raw stdout/stderr/exit code without model-facing truncation or "Command exited with code" text. Workflow script steps prefer this over parsing bash tool output.
Click to show internal directories.
Click to hide internal directories.