Documentation
¶
Index ¶
- type AliyunConfig
- type AliyunFS
- func (afs *AliyunFS) Glob(ctx context.Context, pattern string, opts *sandbox.GlobOptions) ([]string, error)
- func (afs *AliyunFS) IsInside(path string) bool
- func (afs *AliyunFS) Read(ctx context.Context, path string) (string, error)
- func (afs *AliyunFS) Resolve(path string) string
- func (afs *AliyunFS) Stat(ctx context.Context, path string) (sandbox.FileInfo, error)
- func (afs *AliyunFS) Temp(name string) string
- func (afs *AliyunFS) Write(ctx context.Context, path string, content string) error
- type AliyunSandbox
- type MCPCallParams
- type MCPClient
- type MCPClientConfig
- type MCPError
- type MCPRequest
- type MCPResponse
- type MCPTool
- type VolcengineConfig
- type VolcengineFS
- func (vfs *VolcengineFS) Glob(ctx context.Context, pattern string, opts *sandbox.GlobOptions) ([]string, error)
- func (vfs *VolcengineFS) IsInside(path string) bool
- func (vfs *VolcengineFS) Read(ctx context.Context, path string) (string, error)
- func (vfs *VolcengineFS) Resolve(path string) string
- func (vfs *VolcengineFS) Stat(ctx context.Context, path string) (sandbox.FileInfo, error)
- func (vfs *VolcengineFS) Temp(name string) string
- func (vfs *VolcengineFS) Write(ctx context.Context, path string, content string) error
- type VolcengineSandbox
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliyunConfig ¶
type AliyunConfig struct {
// MCP 服务端点
MCPEndpoint string
// 认证信息
AccessKeyID string
AccessKeySecret string
SecurityToken string
// 沙箱配置
Region string // 默认 cn-hangzhou
WorkDir string // 允许的工作目录
Image string // Ubuntu/其他镜像
Timeout time.Duration
Environment map[string]string
// OSS 配置 (可选)
OSSEndpoint string
OSSBucket string
}
AliyunConfig 阿里云沙箱配置
type AliyunFS ¶
type AliyunFS struct {
// contains filtered or unexported fields
}
AliyunFS 阿里云文件系统实现
func (*AliyunFS) Glob ¶
func (afs *AliyunFS) Glob(ctx context.Context, pattern string, opts *sandbox.GlobOptions) ([]string, error)
Glob 匹配文件
type AliyunSandbox ¶
type AliyunSandbox struct {
*sandbox.RemoteSandbox
// contains filtered or unexported fields
}
AliyunSandbox 阿里云 AgentBay 沙箱
func NewAliyunSandbox ¶
func NewAliyunSandbox(config *AliyunConfig) (*AliyunSandbox, error)
NewAliyunSandbox 创建阿里云沙箱
func (*AliyunSandbox) Exec ¶
func (as *AliyunSandbox) Exec(ctx context.Context, cmd string, opts *sandbox.ExecOptions) (*sandbox.ExecResult, error)
Exec 执行 Shell 命令
type MCPCallParams ¶
type MCPCallParams struct {
Name string `json:"name"`
Arguments map[string]any `json:"arguments,omitempty"`
}
MCPCallParams 工具调用参数
type MCPClient ¶
type MCPClient struct {
// contains filtered or unexported fields
}
MCPClient MCP 协议客户端
type MCPClientConfig ¶
type MCPClientConfig struct {
Endpoint string
AccessKeyID string
AccessKeySecret string
SecurityToken string
Timeout time.Duration
}
MCPClientConfig MCP 客户端配置
type MCPError ¶
type MCPError struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
MCPError MCP 错误
type MCPRequest ¶
type MCPRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
ID int64 `json:"id"`
Params MCPCallParams `json:"params,omitempty"`
}
MCPRequest MCP 请求
type MCPResponse ¶
type MCPResponse struct {
JSONRPC string `json:"jsonrpc"`
ID int64 `json:"id"`
Result json.RawMessage `json:"result,omitempty"`
Error *MCPError `json:"error,omitempty"`
}
MCPResponse MCP 响应
type MCPTool ¶
type MCPTool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"inputSchema"`
}
MCPTool MCP 工具定义
type VolcengineConfig ¶
type VolcengineConfig struct {
// API 配置
Endpoint string
AccessKey string
SecretKey string
// 沙箱配置
Region string
WorkDir string
Image string
Timeout time.Duration
Environment map[string]string
// 计算资源配置
CPU int // vCPU 核数
Memory int // 内存 MB
}
VolcengineConfig 火山引擎沙箱配置
type VolcengineFS ¶
type VolcengineFS struct {
// contains filtered or unexported fields
}
VolcengineFS 火山引擎文件系统
func (*VolcengineFS) Glob ¶
func (vfs *VolcengineFS) Glob(ctx context.Context, pattern string, opts *sandbox.GlobOptions) ([]string, error)
Glob 匹配文件
func (*VolcengineFS) IsInside ¶
func (vfs *VolcengineFS) IsInside(path string) bool
IsInside 检查路径是否在沙箱内
func (*VolcengineFS) Resolve ¶
func (vfs *VolcengineFS) Resolve(path string) string
Resolve 解析路径为绝对路径
type VolcengineSandbox ¶
type VolcengineSandbox struct {
*sandbox.RemoteSandbox
// contains filtered or unexported fields
}
VolcengineSandbox 火山引擎沙箱
func NewVolcengineSandbox ¶
func NewVolcengineSandbox(config *VolcengineConfig) (*VolcengineSandbox, error)
NewVolcengineSandbox 创建火山引擎沙箱
func (*VolcengineSandbox) Exec ¶
func (vs *VolcengineSandbox) Exec(ctx context.Context, cmd string, opts *sandbox.ExecOptions) (*sandbox.ExecResult, error)
Exec 执行命令
Click to show internal directories.
Click to hide internal directories.