Documentation
¶
Index ¶
- type ClaudeSkillAdapter
- type ClaudeSkillExecutor
- type ProgressCallback
- type Skill
- type SkillExecutor
- type SkillManager
- func (m *SkillManager) CleanupOldVenvs(ctx context.Context) error
- func (m *SkillManager) GetAllSkills() []*Skill
- func (m *SkillManager) GetLLMTools() []*schema.ToolInfo
- func (m *SkillManager) GetSkill(skillID string) (*Skill, bool)
- func (m *SkillManager) RegisterSkill(skill *Skill) error
- func (m *SkillManager) UnregisterSkill(skillID string)
- type SkillResult
- type SkillRuntime
- type SkillTool
- type SkillToolParameter
- type VenvInfo
- type VenvManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClaudeSkillAdapter ¶
type ClaudeSkillAdapter struct{}
ClaudeSkillAdapter Claude Skill 结果适配器 职责:将 Skill 输出转换为统一的 ToolResult
func NewClaudeSkillAdapter ¶
func NewClaudeSkillAdapter() *ClaudeSkillAdapter
NewClaudeSkillAdapter 创建 Claude Skill 适配器
func (*ClaudeSkillAdapter) ToToolResult ¶
func (a *ClaudeSkillAdapter) ToToolResult( skillResult *SkillResult, skillName string, duration time.Duration, ) (*schema.ToolResult, error)
ToToolResult 将 Skill 结果转换为 ToolResult
type ClaudeSkillExecutor ¶
type ClaudeSkillExecutor struct {
// contains filtered or unexported fields
}
ClaudeSkillExecutor Claude Skill 执行器
func NewClaudeSkillExecutor ¶
func NewClaudeSkillExecutor(skillManager *SkillManager) *ClaudeSkillExecutor
NewClaudeSkillExecutor 创建 Claude Skill 执行器
func (*ClaudeSkillExecutor) Execute ¶
func (e *ClaudeSkillExecutor) Execute( ctx framework.ToolContext, tool framework.ToolDefinition, input map[string]interface{}, ) (*schema.ToolResult, error)
Execute 执行 Claude Skill
type ProgressCallback ¶
ProgressCallback 进度回调函数类型 stage: 阶段名称 (preparing_venv, creating_venv, installing_deps, preparing_script, executing_script) message: 进度消息 metadata: 额外的元数据
type Skill ¶
type Skill struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Runtime SkillRuntime `json:"runtime"`
Tool SkillTool `json:"tool"`
Script string `json:"script"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Skill Skill 定义
func (*Skill) ValidateArgs ¶
ValidateArgs 验证参数
type SkillExecutor ¶
type SkillExecutor struct {
// contains filtered or unexported fields
}
SkillExecutor Skill 执行器
func NewSkillExecutor ¶
func NewSkillExecutor(venvBaseDir, skillsDir string) (*SkillExecutor, error)
NewSkillExecutor 创建 Skill 执行器
func (*SkillExecutor) ExecuteSkill ¶
func (e *SkillExecutor) ExecuteSkill(ctx context.Context, skill *Skill, args map[string]interface{}, progressCallback ProgressCallback) (*SkillResult, error)
ExecuteSkill 执行 Skill(带进度回调)
type SkillManager ¶
type SkillManager struct {
Executor *SkillExecutor
// contains filtered or unexported fields
}
SkillManager Skill 管理器
func NewSkillManager ¶
func NewSkillManager(venvBaseDir, skillsDir string) (*SkillManager, error)
NewSkillManager 创建 Skill 管理器
func (*SkillManager) CleanupOldVenvs ¶
func (m *SkillManager) CleanupOldVenvs(ctx context.Context) error
CleanupOldVenvs 清理旧的虚拟环境
func (*SkillManager) GetAllSkills ¶
func (m *SkillManager) GetAllSkills() []*Skill
GetAllSkills 获取所有 Skills
func (*SkillManager) GetLLMTools ¶
func (m *SkillManager) GetLLMTools() []*schema.ToolInfo
GetLLMTools 获取 LLM 工具定义
func (*SkillManager) GetSkill ¶
func (m *SkillManager) GetSkill(skillID string) (*Skill, bool)
GetSkill 获取 Skill
func (*SkillManager) RegisterSkill ¶
func (m *SkillManager) RegisterSkill(skill *Skill) error
RegisterSkill 注册 Skill
func (*SkillManager) UnregisterSkill ¶
func (m *SkillManager) UnregisterSkill(skillID string)
UnregisterSkill 注销 Skill
type SkillResult ¶
type SkillResult struct {
Success bool `json:"success"`
Output string `json:"output"`
Error string `json:"error,omitempty"`
Duration int64 `json:"duration"` // 毫秒
}
SkillResult 执行结果
type SkillRuntime ¶
type SkillRuntime struct {
Type string `json:"type"` // python, node, shell
Version string `json:"version"` // 3.9+, 18+
Requirements []string `json:"requirements"` // 依赖列表
}
SkillRuntime 运行时配置
type SkillTool ¶
type SkillTool struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]SkillToolParameter `json:"parameters"`
}
SkillTool 工具定义
type SkillToolParameter ¶
type SkillToolParameter struct {
Type string `json:"type"` // string, number, boolean, array, object
Required bool `json:"required"`
Description string `json:"description"`
Default interface{} `json:"default,omitempty"`
}
SkillToolParameter 工具参数
type VenvInfo ¶
type VenvInfo struct {
Hash string // 依赖哈希
Path string // 虚拟环境路径
PythonPath string // Python 解释器路径
Requirements []string // 依赖列表
CreatedAt time.Time // 创建时间
LastUsedAt time.Time // 最后使用时间
}
VenvInfo 虚拟环境信息
type VenvManager ¶
type VenvManager struct {
// contains filtered or unexported fields
}
VenvManager 虚拟环境管理器
func NewVenvManager ¶
func NewVenvManager(baseDir string) (*VenvManager, error)
NewVenvManager 创建虚拟环境管理器
func (*VenvManager) CleanupOldVenvs ¶
CleanupOldVenvs 清理旧的虚拟环境
func (*VenvManager) GetOrCreateVenv ¶
func (m *VenvManager) GetOrCreateVenv(ctx context.Context, requirements []string, progressCallback ProgressCallback) (*VenvInfo, error)
GetOrCreateVenv 获取或创建虚拟环境(带进度回调)
func (*VenvManager) GetStats ¶
func (m *VenvManager) GetStats() map[string]interface{}
GetStats 获取统计信息