Documentation
¶
Overview ¶
Package bash provides shell command execution using mvdan/sh interpreter.
Index ¶
Constants ¶
const DefaultTimeout = 15 * time.Second
DefaultTimeout is the default command timeout.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Inputs ¶
type Inputs struct {
Command string `json:"command" jsonschema:"required,description=Shell command or script to execute" validate:"required"`
Workdir string `json:"workdir,omitempty" jsonschema:"description=Working directory to execute command in"`
TimeoutMS int64 `json:"timeout_ms,omitempty" jsonschema:"description=Command timeout in milliseconds (default: 15000)"`
}
Inputs defines the parameters for the Bash tool.
type LimitedBuffer ¶
type LimitedBuffer struct {
// contains filtered or unexported fields
}
LimitedBuffer is an io.Writer that wraps bytes.Buffer with a byte-level cap. When max <= 0, writes pass through without capping. When the cap is reached, excess bytes are silently discarded.
func (*LimitedBuffer) Capped ¶
func (lb *LimitedBuffer) Capped() bool
func (*LimitedBuffer) Len ¶
func (lb *LimitedBuffer) Len() int
func (*LimitedBuffer) String ¶
func (lb *LimitedBuffer) String() string
type StreamingWriter ¶
type StreamingWriter struct {
// contains filtered or unexported fields
}
StreamingWriter wraps a LimitedBuffer and calls a callback with each complete line of output, throttled to avoid flooding the UI event channel. Thread-safe: shell pipelines may write from multiple goroutines.
func NewStreamingWriter ¶
func NewStreamingWriter(buf *LimitedBuffer, callback func(line string)) *StreamingWriter
NewStreamingWriter creates a writer that tees to buf and streams lines via callback.
func (*StreamingWriter) Flush ¶
func (sw *StreamingWriter) Flush()
Flush emits any remaining partial line (content without a trailing newline). Call after the command finishes to ensure the last line is not lost.
type Tool ¶
type Tool struct {
tool.Base
Timeout time.Duration
Truncation config.BashTruncation
Rewrite string
// contains filtered or unexported fields
}
Tool implements the Bash command execution tool using mvdan/sh interpreter.
func New ¶
func New(truncation config.BashTruncation, rewrite string) *Tool
New creates a new Bash tool with documentation.
func (*Tool) Close ¶
func (t *Tool) Close()
Close removes any temp files created during truncated output.