Documentation
¶
Index ¶
- type ShellTool
- func (s *ShellTool) ExecutePipeline(ctx context.Context, commands []string) (*interfaces.ToolOutput, error)
- func (s *ShellTool) ExecuteScript(ctx context.Context, scriptPath string, args []string) (*interfaces.ToolOutput, error)
- func (s *ShellTool) GetAllowedCommands() []string
- func (s *ShellTool) IsCommandAllowed(command string) bool
- type ShellToolBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShellTool ¶
ShellTool Shell 命令执行工具
提供安全的 shell 命令执行能力,支持命令白名单
func NewShellTool ¶
NewShellTool 创建 Shell 工具
Parameters:
- allowedCommands: 允许执行的命令列表(白名单)
- timeout: 默认超时时间
func (*ShellTool) ExecutePipeline ¶
func (s *ShellTool) ExecutePipeline(ctx context.Context, commands []string) (*interfaces.ToolOutput, error)
ExecutePipeline 执行管道命令的便捷方法
func (*ShellTool) ExecuteScript ¶
func (s *ShellTool) ExecuteScript(ctx context.Context, scriptPath string, args []string) (*interfaces.ToolOutput, error)
ExecuteScript 执行脚本的便捷方法
func (*ShellTool) GetAllowedCommands ¶
GetAllowedCommands 获取允许的命令列表
func (*ShellTool) IsCommandAllowed ¶
IsCommandAllowed 检查命令是否在白名单中
type ShellToolBuilder ¶
type ShellToolBuilder struct {
// contains filtered or unexported fields
}
ShellToolBuilder Shell 工具构建器
func NewShellToolBuilder ¶
func NewShellToolBuilder() *ShellToolBuilder
NewShellToolBuilder 创建 Shell 工具构建器
func (*ShellToolBuilder) WithAllowedCommands ¶
func (b *ShellToolBuilder) WithAllowedCommands(commands ...string) *ShellToolBuilder
WithAllowedCommands 设置允许的命令
func (*ShellToolBuilder) WithTimeout ¶
func (b *ShellToolBuilder) WithTimeout(timeout time.Duration) *ShellToolBuilder
WithTimeout 设置超时
Click to show internal directories.
Click to hide internal directories.