Documentation
¶
Index ¶
- func AllTools() []string
- func AssertContains(t *testing.T, str, substr string)
- func AssertFileContent(t *testing.T, path, expectedContent string)
- func AssertFileExists(t *testing.T, path string)
- func AssertFileNotExists(t *testing.T, path string)
- func AssertToolError(t *testing.T, result map[string]interface{}) string
- func AssertToolSuccess(t *testing.T, result map[string]interface{}) map[string]interface{}
- func BenchmarkTool(b *testing.B, tool tools.Tool, input map[string]interface{})
- func CreateTestFiles(th *TestHelper) map[string]string
- func ExecuteToolWithInput(t *testing.T, tool tools.Tool, input map[string]interface{}) map[string]interface{}
- func ExecuteToolWithRealFS(t *testing.T, tool tools.Tool, input map[string]interface{}) map[string]interface{}
- func ExecutionTools() []string
- func FileSystemTools() []string
- func GetBoolParam(input map[string]interface{}, key string, defaultValue bool) bool
- func GetIntParam(input map[string]interface{}, key string, defaultValue int) int
- func GetStringParam(input map[string]interface{}, key string, defaultValue string) string
- func GetStringSliceParam(input map[string]interface{}, key string) []string
- func NetworkTools() []string
- func NewBashOutputTool(config map[string]interface{}) (tools.Tool, error)
- func NewBashTool(config map[string]interface{}) (tools.Tool, error)
- func NewClaudeErrorResponse(err error, recommendations ...string) map[string]interface{}
- func NewEditTool(config map[string]interface{}) (tools.Tool, error)
- func NewExitPlanModeTool(config map[string]interface{}) (tools.Tool, error)
- func NewGlobTool(config map[string]interface{}) (tools.Tool, error)
- func NewGrepTool(config map[string]interface{}) (tools.Tool, error)
- func NewHttpRequestTool(config map[string]interface{}) (tools.Tool, error)
- func NewKillShellTool(config map[string]interface{}) (tools.Tool, error)
- func NewMockToolContext() sandbox.Sandbox
- func NewReadTool(config map[string]interface{}) (tools.Tool, error)
- func NewSemanticSearchTool(config map[string]interface{}) (tools.Tool, error)
- func NewSkillTool(config map[string]interface{}) (tools.Tool, error)
- func NewTaskTool(config map[string]interface{}) (tools.Tool, error)
- func NewTodoWriteTool(config map[string]interface{}) (tools.Tool, error)
- func NewWebSearchTool(config map[string]interface{}) (tools.Tool, error)
- func NewWriteTool(config map[string]interface{}) (tools.Tool, error)
- func RegisterAll(registry *tools.Registry)
- func SemanticTools() []string
- func SkillTools() []string
- func SkipIfShort(t *testing.T)
- func TaskManagementTools() []string
- func ValidateRequired(input map[string]interface{}, required []string) error
- type BashOutputTool
- func (t *BashOutputTool) Description() string
- func (t *BashOutputTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
- func (t *BashOutputTool) InputSchema() map[string]interface{}
- func (t *BashOutputTool) Name() string
- func (t *BashOutputTool) Prompt() string
- type BashTool
- type ConcurrentTestResult
- type EditTool
- type ExitPlanModeTool
- func (t *ExitPlanModeTool) Description() string
- func (t *ExitPlanModeTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
- func (t *ExitPlanModeTool) InputSchema() map[string]interface{}
- func (t *ExitPlanModeTool) Name() string
- func (t *ExitPlanModeTool) Prompt() string
- type FileCount
- type FilePlanManager
- func (fpm *FilePlanManager) DeletePlan(planID string) error
- func (fpm *FilePlanManager) GetPlansByStatus(status string) ([]*PlanRecord, error)
- func (fpm *FilePlanManager) ListPlans() ([]*PlanRecord, error)
- func (fpm *FilePlanManager) LoadPlan(planID string) (*PlanRecord, error)
- func (fpm *FilePlanManager) StorePlan(plan *PlanRecord) error
- func (fpm *FilePlanManager) UpdatePlanStatus(planID string, status string) error
- type FileStorageManager
- func (fsm *FileStorageManager) Backup(backupPath string) error
- func (fsm *FileStorageManager) DeleteData(key string) error
- func (fsm *FileStorageManager) Exists(key string) bool
- func (fsm *FileStorageManager) ListKeys(prefix string) ([]string, error)
- func (fsm *FileStorageManager) LoadData(key string, target interface{}) error
- func (fsm *FileStorageManager) Restore(backupPath string) error
- func (fsm *FileStorageManager) StoreData(key string, data interface{}) error
- type FileSubagentManager
- func (sm *FileSubagentManager) CleanupSubagent(taskID string) error
- func (sm *FileSubagentManager) GetSubagent(taskID string) (*SubagentInstance, error)
- func (sm *FileSubagentManager) GetSubagentOutput(taskID string) (string, error)
- func (sm *FileSubagentManager) ListSubagents() ([]*SubagentInstance, error)
- func (sm *FileSubagentManager) ResumeSubagent(taskID string) (*SubagentInstance, error)
- func (sm *FileSubagentManager) StartSubagent(ctx context.Context, config *SubagentConfig) (*SubagentInstance, error)
- func (sm *FileSubagentManager) StopSubagent(taskID string) error
- type FileTaskManager
- func (tm *FileTaskManager) CleanupTask(taskID string) error
- func (tm *FileTaskManager) GetTask(taskID string) (*TaskInfo, error)
- func (tm *FileTaskManager) GetTaskOutput(taskID string, filter string, lines int) (string, string, error)
- func (tm *FileTaskManager) GetTaskStatus(taskID string) (string, error)
- func (tm *FileTaskManager) KillTask(taskID string, signal string, timeout int) error
- func (tm *FileTaskManager) ListTasks() ([]*TaskInfo, error)
- func (tm *FileTaskManager) StartTask(ctx context.Context, cmd string, opts *TaskOptions) (*TaskInfo, error)
- type FileTodoManager
- func (ftm *FileTodoManager) BackupTodoLists() (map[string]*TodoList, error)
- func (ftm *FileTodoManager) DeleteTodoList(listName string) error
- func (ftm *FileTodoManager) ListTodoLists() ([]string, error)
- func (ftm *FileTodoManager) LoadTodoList(listName string) (*TodoList, error)
- func (ftm *FileTodoManager) RestoreTodoLists(backup map[string]*TodoList) error
- func (ftm *FileTodoManager) StoreTodoList(list *TodoList) error
- type GlobTool
- type GrepMatch
- type GrepResult
- type GrepTool
- type HttpRequestTool
- func (t *HttpRequestTool) Description() string
- func (t *HttpRequestTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
- func (t *HttpRequestTool) InputSchema() map[string]interface{}
- func (t *HttpRequestTool) Name() string
- func (t *HttpRequestTool) Prompt() string
- type KillShellTool
- func (t *KillShellTool) Description() string
- func (t *KillShellTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
- func (t *KillShellTool) InputSchema() map[string]interface{}
- func (t *KillShellTool) Name() string
- func (t *KillShellTool) Prompt() string
- type MockSandbox
- type PlanManager
- type PlanRecord
- type ReadTool
- type RealFS
- func (rfs *RealFS) Glob(ctx context.Context, pattern string, opts *sandbox.GlobOptions) ([]string, error)
- func (rfs *RealFS) IsInside(path string) bool
- func (rfs *RealFS) Read(ctx context.Context, path string) (string, error)
- func (rfs *RealFS) Resolve(path string) string
- func (rfs *RealFS) Stat(ctx context.Context, path string) (sandbox.FileInfo, error)
- func (rfs *RealFS) Temp(name string) string
- func (rfs *RealFS) Write(ctx context.Context, path string, content string) error
- type RealSandbox
- func (rs *RealSandbox) Dispose() error
- func (rs *RealSandbox) Exec(ctx context.Context, cmd string, opts *sandbox.ExecOptions) (*sandbox.ExecResult, error)
- func (rs *RealSandbox) FS() sandbox.SandboxFS
- func (rs *RealSandbox) Kind() string
- func (rs *RealSandbox) Unwatch(watchID string) error
- func (rs *RealSandbox) Watch(paths []string, listener sandbox.FileChangeListener) (string, error)
- func (rs *RealSandbox) WorkDir() string
- type ResourceUsage
- type SemanticSearchTool
- func (t *SemanticSearchTool) Description() string
- func (t *SemanticSearchTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
- func (t *SemanticSearchTool) InputSchema() map[string]interface{}
- func (t *SemanticSearchTool) Name() string
- func (t *SemanticSearchTool) Prompt() string
- type SkillTool
- type StorageManager
- type SubagentConfig
- type SubagentInstance
- type SubagentManager
- type SubagentResourceUsage
- type TaskDefinition
- type TaskExecution
- type TaskInfo
- type TaskManager
- type TaskOptions
- type TaskTool
- type TestHelper
- func (th *TestHelper) AddCleanup(cleanup func())
- func (th *TestHelper) CleanupAll()
- func (th *TestHelper) CreateTempDir(name string) string
- func (th *TestHelper) CreateTempFile(name, content string) string
- func (th *TestHelper) FileExists(path string) bool
- func (th *TestHelper) GetTestDataPath(name string) string
- func (th *TestHelper) ReadFile(path string) string
- type TodoItem
- type TodoList
- type TodoManager
- type TodoWriteTool
- func (t *TodoWriteTool) Description() string
- func (t *TodoWriteTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
- func (t *TodoWriteTool) InputSchema() map[string]interface{}
- func (t *TodoWriteTool) Name() string
- func (t *TodoWriteTool) Prompt() string
- type WebSearchTool
- func (t *WebSearchTool) Description() string
- func (t *WebSearchTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
- func (t *WebSearchTool) InputSchema() map[string]interface{}
- func (t *WebSearchTool) Name() string
- func (t *WebSearchTool) Prompt() string
- type WriteTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertContains ¶
AssertContains 断言字符串包含子字符串
func AssertFileContent ¶
AssertFileContent 断言文件内容
func AssertFileNotExists ¶
AssertFileNotExists 断言文件不存在
func AssertToolError ¶
AssertToolError 断言工具执行失败
func AssertToolSuccess ¶
AssertToolSuccess 断言工具执行成功
func BenchmarkTool ¶
BenchmarkTool 工具性能基准测试辅助函数
func CreateTestFiles ¶
func CreateTestFiles(th *TestHelper) map[string]string
CreateTestFiles 创建标准测试文件
func ExecuteToolWithInput ¶
func ExecuteToolWithInput(t *testing.T, tool tools.Tool, input map[string]interface{}) map[string]interface{}
ExecuteToolWithInput 使用指定输入执行工具
func ExecuteToolWithRealFS ¶
func ExecuteToolWithRealFS(t *testing.T, tool tools.Tool, input map[string]interface{}) map[string]interface{}
ExecuteToolWithRealFS 使用真实文件系统执行工具
func GetBoolParam ¶
GetBoolParam 获取布尔参数的通用函数
func GetIntParam ¶
GetIntParam 获取整数参数的通用函数
func GetStringParam ¶
GetStringParam 获取字符串参数的通用函数
func GetStringSliceParam ¶
GetStringSliceParam 获取字符串数组参数的通用函数
func NewBashOutputTool ¶
NewBashOutputTool 创建BashOutput工具
func NewBashTool ¶
NewBashTool 创建Bash执行工具
func NewClaudeErrorResponse ¶
NewClaudeErrorResponse 创建Claude兼容的错误响应
func NewEditTool ¶
NewEditTool 创建Edit工具
func NewExitPlanModeTool ¶
NewExitPlanModeTool 创建ExitPlanMode工具
func NewGlobTool ¶
NewGlobTool 创建Glob工具
func NewGrepTool ¶
NewGrepTool 创建Grep工具
func NewHttpRequestTool ¶
NewHttpRequestTool 创建HTTP请求工具
func NewKillShellTool ¶
NewKillShellTool 创建KillShell工具
func NewReadTool ¶
NewReadTool 创建文件读取工具
func NewSemanticSearchTool ¶
func NewSkillTool ¶
NewSkillTool 创建 SkillTool 实例
func NewTaskTool ¶
NewTaskTool 创建Task工具
func NewTodoWriteTool ¶
NewTodoWriteTool 创建TodoWrite工具
func NewWebSearchTool ¶
NewWebSearchTool 创建网络搜索工具
func NewWriteTool ¶
NewWriteTool 创建文件写入工具
func ValidateRequired ¶
ValidateRequired 验证必需参数的通用函数
Types ¶
type BashOutputTool ¶
type BashOutputTool struct{}
BashOutputTool 后台shell输出获取工具 支持获取后台运行命令的输出和状态
func (*BashOutputTool) Description ¶
func (t *BashOutputTool) Description() string
func (*BashOutputTool) Execute ¶
func (t *BashOutputTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
func (*BashOutputTool) InputSchema ¶
func (t *BashOutputTool) InputSchema() map[string]interface{}
func (*BashOutputTool) Name ¶
func (t *BashOutputTool) Name() string
func (*BashOutputTool) Prompt ¶
func (t *BashOutputTool) Prompt() string
type BashTool ¶
type BashTool struct {
// contains filtered or unexported fields
}
BashTool 增强的Bash命令执行工具 支持持久化shell会话功能
func (*BashTool) Description ¶
func (*BashTool) InputSchema ¶
type ConcurrentTestResult ¶
type ConcurrentTestResult struct {
SuccessCount int
ErrorCount int
Errors []error
Duration time.Duration
}
ConcurrentTestResult 并发测试结果
func RunConcurrentTest ¶
func RunConcurrentTest(concurrency int, testFunc func() error) *ConcurrentTestResult
RunConcurrentTest 运行并发测试
type EditTool ¶
type EditTool struct{}
EditTool 增强的文件编辑工具 支持精确的字符串替换编辑功能
func (*EditTool) Description ¶
func (*EditTool) InputSchema ¶
type ExitPlanModeTool ¶
type ExitPlanModeTool struct{}
ExitPlanModeTool 规划模式退出工具 支持在规划模式完成后展示实施计划并请求用户确认
func (*ExitPlanModeTool) Description ¶
func (t *ExitPlanModeTool) Description() string
func (*ExitPlanModeTool) Execute ¶
func (t *ExitPlanModeTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
func (*ExitPlanModeTool) InputSchema ¶
func (t *ExitPlanModeTool) InputSchema() map[string]interface{}
func (*ExitPlanModeTool) Name ¶
func (t *ExitPlanModeTool) Name() string
func (*ExitPlanModeTool) Prompt ¶
func (t *ExitPlanModeTool) Prompt() string
type FilePlanManager ¶
type FilePlanManager struct {
// contains filtered or unexported fields
}
FilePlanManager 计划管理器实现
func NewFilePlanManager ¶
func NewFilePlanManager(storageMgr StorageManager) *FilePlanManager
NewFilePlanManager 创建计划管理器
func (*FilePlanManager) DeletePlan ¶
func (fpm *FilePlanManager) DeletePlan(planID string) error
DeletePlan 删除计划
func (*FilePlanManager) GetPlansByStatus ¶
func (fpm *FilePlanManager) GetPlansByStatus(status string) ([]*PlanRecord, error)
GetPlansByStatus 按状态获取计划
func (*FilePlanManager) ListPlans ¶
func (fpm *FilePlanManager) ListPlans() ([]*PlanRecord, error)
ListPlans 列出所有计划
func (*FilePlanManager) LoadPlan ¶
func (fpm *FilePlanManager) LoadPlan(planID string) (*PlanRecord, error)
LoadPlan 加载计划
func (*FilePlanManager) StorePlan ¶
func (fpm *FilePlanManager) StorePlan(plan *PlanRecord) error
StorePlan 存储计划
func (*FilePlanManager) UpdatePlanStatus ¶
func (fpm *FilePlanManager) UpdatePlanStatus(planID string, status string) error
UpdatePlanStatus 更新计划状态
type FileStorageManager ¶
type FileStorageManager struct {
// contains filtered or unexported fields
}
FileStorageManager 基于文件的存储管理器实现
func NewFileStorageManager ¶
func NewFileStorageManager() *FileStorageManager
NewFileStorageManager 创建基于文件的存储管理器
func (*FileStorageManager) Backup ¶
func (fsm *FileStorageManager) Backup(backupPath string) error
Backup 备份数据
func (*FileStorageManager) DeleteData ¶
func (fsm *FileStorageManager) DeleteData(key string) error
DeleteData 删除数据
func (*FileStorageManager) Exists ¶
func (fsm *FileStorageManager) Exists(key string) bool
Exists 检查数据是否存在
func (*FileStorageManager) ListKeys ¶
func (fsm *FileStorageManager) ListKeys(prefix string) ([]string, error)
ListKeys 列出所有键
func (*FileStorageManager) LoadData ¶
func (fsm *FileStorageManager) LoadData(key string, target interface{}) error
LoadData 加载数据
func (*FileStorageManager) Restore ¶
func (fsm *FileStorageManager) Restore(backupPath string) error
Restore 从备份恢复数据
func (*FileStorageManager) StoreData ¶
func (fsm *FileStorageManager) StoreData(key string, data interface{}) error
StoreData 存储数据
type FileSubagentManager ¶
type FileSubagentManager struct {
// contains filtered or unexported fields
}
FileSubagentManager 基于文件的子代理管理器实现
func NewFileSubagentManager ¶
func NewFileSubagentManager() *FileSubagentManager
NewFileSubagentManager 创建基于文件的子代理管理器
func (*FileSubagentManager) CleanupSubagent ¶
func (sm *FileSubagentManager) CleanupSubagent(taskID string) error
CleanupSubagent 清理子代理资源
func (*FileSubagentManager) GetSubagent ¶
func (sm *FileSubagentManager) GetSubagent(taskID string) (*SubagentInstance, error)
GetSubagent 获取子代理信息
func (*FileSubagentManager) GetSubagentOutput ¶
func (sm *FileSubagentManager) GetSubagentOutput(taskID string) (string, error)
GetSubagentOutput 获取子代理输出
func (*FileSubagentManager) ListSubagents ¶
func (sm *FileSubagentManager) ListSubagents() ([]*SubagentInstance, error)
ListSubagents 列出所有子代理
func (*FileSubagentManager) ResumeSubagent ¶
func (sm *FileSubagentManager) ResumeSubagent(taskID string) (*SubagentInstance, error)
ResumeSubagent 恢复子代理
func (*FileSubagentManager) StartSubagent ¶
func (sm *FileSubagentManager) StartSubagent(ctx context.Context, config *SubagentConfig) (*SubagentInstance, error)
StartSubagent 启动子代理
func (*FileSubagentManager) StopSubagent ¶
func (sm *FileSubagentManager) StopSubagent(taskID string) error
StopSubagent 停止子代理
type FileTaskManager ¶
type FileTaskManager struct {
// contains filtered or unexported fields
}
FileTaskManager 基于文件系统的任务管理器实现
func NewFileTaskManager ¶
func NewFileTaskManager() *FileTaskManager
NewFileTaskManager 创建基于文件的任务管理器
func (*FileTaskManager) CleanupTask ¶
func (tm *FileTaskManager) CleanupTask(taskID string) error
CleanupTask 清理任务相关文件
func (*FileTaskManager) GetTask ¶
func (tm *FileTaskManager) GetTask(taskID string) (*TaskInfo, error)
GetTask 获取任务信息
func (*FileTaskManager) GetTaskOutput ¶
func (tm *FileTaskManager) GetTaskOutput(taskID string, filter string, lines int) (string, string, error)
GetTaskOutput 获取任务输出
func (*FileTaskManager) GetTaskStatus ¶
func (tm *FileTaskManager) GetTaskStatus(taskID string) (string, error)
GetTaskStatus 获取任务状态
func (*FileTaskManager) KillTask ¶
func (tm *FileTaskManager) KillTask(taskID string, signal string, timeout int) error
KillTask 终止任务
func (*FileTaskManager) ListTasks ¶
func (tm *FileTaskManager) ListTasks() ([]*TaskInfo, error)
ListTasks 列出所有任务
func (*FileTaskManager) StartTask ¶
func (tm *FileTaskManager) StartTask(ctx context.Context, cmd string, opts *TaskOptions) (*TaskInfo, error)
StartTask 启动后台任务
type FileTodoManager ¶
type FileTodoManager struct {
// contains filtered or unexported fields
}
FileTodoManager 任务列表管理器实现
func NewFileTodoManager ¶
func NewFileTodoManager(storageMgr StorageManager) *FileTodoManager
NewFileTodoManager 创建任务列表管理器
func (*FileTodoManager) BackupTodoLists ¶
func (ftm *FileTodoManager) BackupTodoLists() (map[string]*TodoList, error)
BackupTodoLists 备份任务列表
func (*FileTodoManager) DeleteTodoList ¶
func (ftm *FileTodoManager) DeleteTodoList(listName string) error
DeleteTodoList 删除任务列表
func (*FileTodoManager) ListTodoLists ¶
func (ftm *FileTodoManager) ListTodoLists() ([]string, error)
ListTodoLists 列出所有任务列表
func (*FileTodoManager) LoadTodoList ¶
func (ftm *FileTodoManager) LoadTodoList(listName string) (*TodoList, error)
LoadTodoList 加载任务列表
func (*FileTodoManager) RestoreTodoLists ¶
func (ftm *FileTodoManager) RestoreTodoLists(backup map[string]*TodoList) error
RestoreTodoLists 恢复任务列表
func (*FileTodoManager) StoreTodoList ¶
func (ftm *FileTodoManager) StoreTodoList(list *TodoList) error
StoreTodoList 存储任务列表
type GlobTool ¶
type GlobTool struct{}
GlobTool 增强的文件搜索工具 支持模式匹配文件搜索功能
func (*GlobTool) Description ¶
func (*GlobTool) InputSchema ¶
type GrepTool ¶
type GrepTool struct{}
GrepTool 增强的内容搜索工具 支持正则表达式内容搜索功能
func (*GrepTool) Description ¶
func (*GrepTool) InputSchema ¶
type HttpRequestTool ¶
type HttpRequestTool struct {
// contains filtered or unexported fields
}
HttpRequestTool HTTP请求工具 设计参考: DeepAgents deepagents-cli/tools.py:http_request
func (*HttpRequestTool) Description ¶
func (t *HttpRequestTool) Description() string
func (*HttpRequestTool) Execute ¶
func (t *HttpRequestTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
func (*HttpRequestTool) InputSchema ¶
func (t *HttpRequestTool) InputSchema() map[string]interface{}
func (*HttpRequestTool) Name ¶
func (t *HttpRequestTool) Name() string
func (*HttpRequestTool) Prompt ¶
func (t *HttpRequestTool) Prompt() string
type KillShellTool ¶
type KillShellTool struct{}
KillShellTool 后台shell终止工具 支持终止后台运行的shell进程
func (*KillShellTool) Description ¶
func (t *KillShellTool) Description() string
func (*KillShellTool) Execute ¶
func (t *KillShellTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
func (*KillShellTool) InputSchema ¶
func (t *KillShellTool) InputSchema() map[string]interface{}
func (*KillShellTool) Name ¶
func (t *KillShellTool) Name() string
func (*KillShellTool) Prompt ¶
func (t *KillShellTool) Prompt() string
type MockSandbox ¶
type MockSandbox struct {
sandbox.MockSandbox
}
MockSandbox 简单的沙箱模拟实现
func (*MockSandbox) SafeExecute ¶
func (m *MockSandbox) SafeExecute(ctx context.Context, cmd string) error
SafeExecute 模拟安全执行
type PlanManager ¶
type PlanManager interface {
// StorePlan 存储计划
StorePlan(plan *PlanRecord) error
// LoadPlan 加载计划
LoadPlan(planID string) (*PlanRecord, error)
// UpdatePlanStatus 更新计划状态
UpdatePlanStatus(planID string, status string) error
// GetPlansByStatus 按状态获取计划
GetPlansByStatus(status string) ([]*PlanRecord, error)
// ListPlans 列出所有计划
ListPlans() ([]*PlanRecord, error)
// DeletePlan 删除计划
DeletePlan(planID string) error
}
PlanManager 计划管理器接口
var GlobalPlanManager PlanManager
type PlanRecord ¶
type PlanRecord struct {
ID string `json:"id"`
Content string `json:"content"`
EstimatedDuration string `json:"estimated_duration,omitempty"`
Dependencies []string `json:"dependencies,omitempty"`
Risks []string `json:"risks,omitempty"`
SuccessCriteria []string `json:"success_criteria,omitempty"`
ConfirmationRequired bool `json:"confirmation_required"`
Status string `json:"status"` // "pending_approval", "approved", "rejected", "completed"
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ApprovedAt *time.Time `json:"approved_at,omitempty"`
AgentID string `json:"agent_id"`
SessionID string `json:"session_id"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
PlanRecord 计划记录
type ReadTool ¶
type ReadTool struct{}
ReadTool 增强的文件读取工具 兼容标准Read工具功能
func (*ReadTool) Description ¶
func (*ReadTool) InputSchema ¶
type RealSandbox ¶
type RealSandbox struct{}
RealSandbox 使用真实文件系统的沙箱(仅用于测试)
func (*RealSandbox) Dispose ¶
func (rs *RealSandbox) Dispose() error
func (*RealSandbox) Exec ¶
func (rs *RealSandbox) Exec(ctx context.Context, cmd string, opts *sandbox.ExecOptions) (*sandbox.ExecResult, error)
func (*RealSandbox) FS ¶
func (rs *RealSandbox) FS() sandbox.SandboxFS
func (*RealSandbox) Kind ¶
func (rs *RealSandbox) Kind() string
func (*RealSandbox) Unwatch ¶
func (rs *RealSandbox) Unwatch(watchID string) error
func (*RealSandbox) Watch ¶
func (rs *RealSandbox) Watch(paths []string, listener sandbox.FileChangeListener) (string, error)
func (*RealSandbox) WorkDir ¶
func (rs *RealSandbox) WorkDir() string
type ResourceUsage ¶
type ResourceUsage struct {
CPU float64 `json:"cpu_percent"` // CPU使用率百分比
Memory int64 `json:"memory_bytes"` // 内存使用量(字节)
DiskIO int64 `json:"disk_io_bytes"` // 磁盘IO(字节)
}
ResourceUsage 进程资源使用情况
type SemanticSearchTool ¶
type SemanticSearchTool struct {
// contains filtered or unexported fields
}
SemanticSearchTool 基于 SemanticMemory 的语义检索工具。 输入:
{
"query": string,
"top_k": number (可选, 默认使用 SemanticMemoryConfig.TopK),
"metadata": object (可选, 如 {"user_id":"alice","project_id":"demo"})
}
输出:
[
{"id": "...", "score": 0.87, "metadata": {...}},
...
]
func (*SemanticSearchTool) Description ¶
func (t *SemanticSearchTool) Description() string
func (*SemanticSearchTool) Execute ¶
func (t *SemanticSearchTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
func (*SemanticSearchTool) InputSchema ¶
func (t *SemanticSearchTool) InputSchema() map[string]interface{}
func (*SemanticSearchTool) Name ¶
func (t *SemanticSearchTool) Name() string
func (*SemanticSearchTool) Prompt ¶
func (t *SemanticSearchTool) Prompt() string
type SkillTool ¶
type SkillTool struct{}
SkillTool 通用的 Skill 执行工具
注意:本工具不会自动注册到默认内置工具列表中,需要在 Agent 模板中显式声明, 并在 ToolContext.Services 中注入 *skills.Runtime 实例,键名为 "skills_runtime"。
func (*SkillTool) Description ¶
func (*SkillTool) InputSchema ¶
type StorageManager ¶
type StorageManager interface {
// StoreData 存储数据
StoreData(key string, data interface{}) error
// LoadData 加载数据
LoadData(key string, target interface{}) error
// DeleteData 删除数据
DeleteData(key string) error
// Exists 检查数据是否存在
Exists(key string) bool
// ListKeys 列出所有键
ListKeys(prefix string) ([]string, error)
// Backup 备份数据
Backup(backupPath string) error
// Restore 从备份恢复数据
Restore(backupPath string) error
}
StorageManager 存储管理器接口
var GlobalStorageManager StorageManager
全局存储管理器实例
func GetGlobalStorageManager ¶
func GetGlobalStorageManager() StorageManager
GetGlobalStorageManager 获取全局存储管理器
type SubagentConfig ¶
type SubagentConfig struct {
ID string `json:"id"`
Type string `json:"type"` // "general-purpose", "Explore", "Plan", "statusline-setup"
Prompt string `json:"prompt"`
Model string `json:"model,omitempty"`
WorkDir string `json:"work_dir,omitempty"`
Env map[string]string `json:"env,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
SubagentConfig 子代理配置
type SubagentInstance ¶
type SubagentInstance struct {
ID string `json:"id"`
Type string `json:"type"`
Status string `json:"status"` // "starting", "running", "completed", "failed", "stopped"
PID int `json:"pid,omitempty"`
Command string `json:"command"`
Config *SubagentConfig `json:"config"`
StartTime time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time,omitempty"`
Duration time.Duration `json:"duration"`
Output string `json:"output"`
Error string `json:"error,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
LastUpdate time.Time `json:"last_update"`
Metadata map[string]string `json:"metadata,omitempty"`
ResourceUsage *SubagentResourceUsage `json:"resource_usage,omitempty"`
}
SubagentInstance 子代理实例
type SubagentManager ¶
type SubagentManager interface {
// StartSubagent 启动子代理
StartSubagent(ctx context.Context, config *SubagentConfig) (*SubagentInstance, error)
// ResumeSubagent 恢复子代理
ResumeSubagent(taskID string) (*SubagentInstance, error)
// GetSubagent 获取子代理信息
GetSubagent(taskID string) (*SubagentInstance, error)
// StopSubagent 停止子代理
StopSubagent(taskID string) error
// ListSubagents 列出所有子代理
ListSubagents() ([]*SubagentInstance, error)
// GetSubagentOutput 获取子代理输出
GetSubagentOutput(taskID string) (string, error)
// CleanupSubagent 清理子代理资源
CleanupSubagent(taskID string) error
}
SubagentManager 子代理管理器接口
var GlobalSubagentManager SubagentManager
全局子代理管理器实例
func GetGlobalSubagentManager ¶
func GetGlobalSubagentManager() SubagentManager
GetGlobalSubagentManager 获取全局子代理管理器
type SubagentResourceUsage ¶
type SubagentResourceUsage struct {
MemoryMB float64 `json:"memory_mb"`
CPUPercent float64 `json:"cpu_percent"`
DiskMB float64 `json:"disk_mb"`
NetworkMB float64 `json:"network_mb"`
}
SubagentResourceUsage 子代理资源使用情况
type TaskDefinition ¶
type TaskDefinition struct {
ID string `json:"id"`
Description string `json:"description"`
Subagent string `json:"subagent"`
Prompt string `json:"prompt"`
Model string `json:"model,omitempty"`
Resume string `json:"resume,omitempty"`
CreatedAt time.Time `json:"createdAt"`
StartedAt *time.Time `json:"startedAt,omitempty"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
Status string `json:"status"` // "created", "running", "completed", "failed"
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TaskDefinition 任务定义
type TaskExecution ¶
type TaskExecution struct {
TaskID string `json:"task_id"`
Subagent string `json:"subagent"`
Model string `json:"model"`
Status string `json:"status"`
Result interface{} `json:"result,omitempty"`
Error string `json:"error,omitempty"`
StartTime time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time,omitempty"`
Duration time.Duration `json:"duration"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TaskExecution 任务执行结果
type TaskInfo ¶
type TaskInfo struct {
ID string `json:"id"`
Command string `json:"command"`
PID int `json:"pid"`
Status string `json:"status"` // "running", "completed", "failed", "killed"
ExitCode int `json:"exit_code"`
StartTime time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time,omitempty"`
Duration time.Duration `json:"duration"`
WorkDir string `json:"work_dir"`
Shell string `json:"shell"`
Options *TaskOptions `json:"options"`
Metadata map[string]string `json:"metadata"`
LastUpdate time.Time `json:"last_update"`
}
TaskInfo 任务信息
type TaskManager ¶
type TaskManager interface {
// StartTask 启动后台任务
StartTask(ctx context.Context, cmd string, opts *TaskOptions) (*TaskInfo, error)
// GetTask 获取任务信息
GetTask(taskID string) (*TaskInfo, error)
// GetTaskOutput 获取任务输出
GetTaskOutput(taskID string, filter string, lines int) (string, string, error)
// KillTask 终止任务
KillTask(taskID string, signal string, timeout int) error
// ListTasks 列出所有任务
ListTasks() ([]*TaskInfo, error)
// GetTaskStatus 获取任务状态
GetTaskStatus(taskID string) (string, error)
// CleanupTask 清理任务相关文件
CleanupTask(taskID string) error
}
TaskManager 后台任务管理器接口
var GlobalTaskManager TaskManager
全局任务管理器实例
type TaskOptions ¶
type TaskOptions struct {
WorkDir string `json:"work_dir"`
Env map[string]string `json:"env"`
Timeout time.Duration `json:"timeout"`
Background bool `json:"background"`
Shell string `json:"shell"`
CaptureOutput bool `json:"capture_output"`
OutputDir string `json:"output_dir"`
}
TaskOptions 任务启动选项
type TaskTool ¶
type TaskTool struct{}
TaskTool 专门代理启动工具 支持启动专门的代理来处理复杂的多步骤任务
func (*TaskTool) Description ¶
func (*TaskTool) InputSchema ¶
type TestHelper ¶
type TestHelper struct {
T *testing.T
TmpDir string
Context context.Context
Cleanup []func() // 清理函数列表
}
TestHelper 测试辅助工具
func (*TestHelper) CreateTempDir ¶
func (th *TestHelper) CreateTempDir(name string) string
CreateTempDir 创建临时目录
func (*TestHelper) CreateTempFile ¶
func (th *TestHelper) CreateTempFile(name, content string) string
CreateTempFile 创建临时文件
func (*TestHelper) FileExists ¶
func (th *TestHelper) FileExists(path string) bool
FileExists 检查文件是否存在
func (*TestHelper) GetTestDataPath ¶
func (th *TestHelper) GetTestDataPath(name string) string
GetTestDataPath 获取测试数据文件路径
type TodoItem ¶
type TodoItem struct {
ID string `json:"id"`
Content string `json:"content"`
Status string `json:"status"` // "pending", "in_progress", "completed"
ActiveForm string `json:"activeForm"`
Priority int `json:"priority,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TodoItem 单个任务项
type TodoList ¶
type TodoList struct {
ID string `json:"id"`
Name string `json:"name"`
Todos []TodoItem `json:"todos"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TodoList 任务列表
type TodoManager ¶
type TodoManager interface {
// StoreTodoList 存储任务列表
StoreTodoList(list *TodoList) error
// LoadTodoList 加载任务列表
LoadTodoList(listName string) (*TodoList, error)
// ListTodoLists 列出所有任务列表
ListTodoLists() ([]string, error)
// DeleteTodoList 删除任务列表
DeleteTodoList(listName string) error
// BackupTodoLists 备份任务列表
BackupTodoLists() (map[string]*TodoList, error)
// RestoreTodoLists 恢复任务列表
RestoreTodoLists(backup map[string]*TodoList) error
}
TodoManager 任务列表管理器接口
var GlobalTodoManager TodoManager
func GetGlobalTodoManager ¶
func GetGlobalTodoManager() TodoManager
GetGlobalTodoManager 获取全局任务列表管理器
type TodoWriteTool ¶
type TodoWriteTool struct{}
TodoWriteTool 任务管理工具 支持创建和管理结构化任务列表
func (*TodoWriteTool) Description ¶
func (t *TodoWriteTool) Description() string
func (*TodoWriteTool) Execute ¶
func (t *TodoWriteTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
func (*TodoWriteTool) InputSchema ¶
func (t *TodoWriteTool) InputSchema() map[string]interface{}
func (*TodoWriteTool) Name ¶
func (t *TodoWriteTool) Name() string
func (*TodoWriteTool) Prompt ¶
func (t *TodoWriteTool) Prompt() string
type WebSearchTool ¶
type WebSearchTool struct {
// contains filtered or unexported fields
}
WebSearchTool 网络搜索工具 (使用 Tavily API) 设计参考: DeepAgents deepagents-cli/tools.py:web_search
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(ctx context.Context, input map[string]interface{}, tc *tools.ToolContext) (interface{}, error)
func (*WebSearchTool) InputSchema ¶
func (t *WebSearchTool) InputSchema() map[string]interface{}
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
func (*WebSearchTool) Prompt ¶
func (t *WebSearchTool) Prompt() string
type WriteTool ¶
type WriteTool struct{}
WriteTool 增强的文件写入工具 兼容标准Write工具功能