Documentation
¶
Overview ¶
Package shell ties command sources (native host, upstream MCP servers, scripts), the builtins and an engine together into one runnable shell. Both the MCP server and the CLI's `run` go through Shell.Run.
Index ¶
Constants ¶
const ( DefaultTimeout = 120 * time.Second DefaultMaxOutput = 64 << 10 )
Variables ¶
This section is empty.
Functions ¶
func FormatSources ¶
func FormatSources(statuses []SourceStatus) string
FormatSources renders a "Sources:" block for listings.
func Warnings ¶
func Warnings(statuses []SourceStatus) []string
Warnings formats the failed sources in statuses.
Types ¶
type Result ¶
type Result struct {
Stdout string
Stderr string
ExitCode int
Truncated bool
// Err is set when the script could not run to completion: no source reachable,
// parse error, timeout. ExitCode is still meaningful (124 for timeouts).
Err error
// Warnings report sources that were unavailable while others worked.
Warnings []string
}
Result is the outcome of one script run.
type Shell ¶
type Shell struct {
// Sources supply the shell's commands. On a name clash a later source wins over an
// earlier one, and every source wins over the generic builtins.
Sources []host.Source
Engine engine.Engine
// Extra are Go-side commands added by the embedding binary. They take precedence
// over the builtins and every source.
Extra []engine.Command
Timeout time.Duration // default DefaultTimeout
MaxOutput int // per stream, in bytes; default DefaultMaxOutput
}
func (*Shell) Close ¶
func (s *Shell) Close()
Close releases every source that holds resources (upstream subprocesses, sessions).
type SourceStatus ¶
SourceStatus is one source's state after fetching commands.