Documentation
¶
Overview ¶
Package shell provides an Eino-compatible shell execution tool.
The package intentionally exposes the execution boundary as configuration: callers own workspace containment, sandboxing, and environment policy.
Result preserves the original decoded JSON object in RawJSON so consumers can inspect unknown top-level fields added by future versions. RawJSON is never emitted when marshaling results produced by this package.
Index ¶
Constants ¶
const ( // DefaultShellBinary preserves the current local-symphony shell behavior. DefaultShellBinary = "sh" // OutputCapBytes is the default per-stream stdout/stderr output cap. OutputCapBytes = 256 * 1024 // DefaultOutputCapBytes aliases OutputCapBytes for constructor option // defaulting. DefaultOutputCapBytes = OutputCapBytes )
const ( // DefaultTimeoutSeconds is applied when timeout_seconds is omitted or zero. DefaultTimeoutSeconds = 60 // MaxTimeoutSeconds is the maximum accepted per-call timeout. MaxTimeoutSeconds = 600 )
const ( ErrCategoryValidation = "validation" ErrCategoryTimeout = "timeout" ErrCategoryCanceled = "canceled" ErrCategoryExecFailed = "exec_failed" ErrCategoryUnknown = "unknown" )
const Name = "shell"
Name is the model-facing tool name.
Variables ¶
This section is empty.
Functions ¶
func Schema ¶
func Schema() json.RawMessage
Schema returns a fresh JSON Schema copy for shell arguments.
Types ¶
type Options ¶
type Options struct {
// Env is the process environment for commands. A nil slice inherits the
// parent process environment, matching os/exec behavior.
Env []string
// ShellBinary is the executable used with "-lc". Empty uses
// DefaultShellBinary.
ShellBinary string
// OutputCapBytes caps stdout and stderr independently. Zero uses
// DefaultOutputCapBytes.
OutputCapBytes int
}
Options configures shell tool behavior that is intentionally owned by the caller rather than hidden inside the tool.
type Result ¶
type Result struct {
Outcome result.Outcome `json:"outcome"`
ExitCode int `json:"exit_code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
StdoutTruncated bool `json:"stdout_truncated,omitempty"`
StderrTruncated bool `json:"stderr_truncated,omitempty"`
DurationMS int64 `json:"duration_ms"`
TimedOut bool `json:"timed_out,omitempty"`
Error *ResultError `json:"error,omitempty"`
RawJSON json.RawMessage `json:"-"`
}
Result is the structured envelope returned to the model.
func (Result) IsRetryable ¶
IsRetryable reports whether the agent loop should retry the same call.
func (*Result) UnmarshalJSON ¶
UnmarshalJSON decodes Result and preserves the original object in RawJSON.
type ResultError ¶
ResultError is the structured failure envelope nested inside Result.
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool executes shell commands in a configured workspace directory.
func (*Tool) InvokableRun ¶
InvokableRun is the Eino tool entry point.