Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToolDefinitions ¶
func GenerateToolDefinitions(skill *SkillPackage) ([]openai.Tool, map[string]string)
GenerateToolDefinitions generates the list of OpenAI tools for a given skill. It returns the tool definitions and a map of tool names to script paths for execution. 优先使用 SKILL.md 中定义的工具,如果未定义则自动生成。
func SkillsToPrompt ¶ added in v0.4.0
func SkillsToPrompt(skills map[string]SkillPackage) string
SkillsToPrompt converts a slice of SkillPackage objects to a prompt string
Types ¶
type Agent ¶ added in v0.2.0
type Agent struct {
// contains filtered or unexported fields
}
Agent manages the skill discovery, selection, and execution process.
func NewAgent ¶ added in v0.2.0
func NewAgent(cfg RunnerConfig, mcpClient *mcp.Client) (*Agent, error)
NewAgent creates and initializes a new Agent.
type OpenAIChatClient ¶ added in v0.4.0
type OpenAIChatClient interface {
CreateChatCompletion(ctx context.Context, req openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error)
}
OpenAIChatClient interface for dependency injection and testing
type RunnerConfig ¶ added in v0.2.0
type RunnerConfig struct {
APIKey string
APIBase string
Model string
SkillsDir string
Verbose int
Debug bool
AutoApproveTools bool
AllowedScripts []string
Loop bool
SkillName string
}
RunnerConfig holds all the necessary configuration for the runner.
type SkillMeta ¶
type SkillMeta struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
AllowedTools []string `yaml:"allowed-tools"`
Model string `yaml:"model,omitempty"`
Author string `yaml:"author,omitempty"`
Version string `yaml:"version,omitempty"`
License string `yaml:"license,omitempty"`
Tools []ToolDefinition `yaml:"tools,omitempty"` // 工具定义列表
}
SkillMeta corresponds to the content of SKILL.md frontmatter
type SkillPackage ¶
type SkillPackage struct {
Path string `json:"path"`
Meta SkillMeta `json:"meta"`
Body string `json:"body"` // Raw Markdown content of SKILL.md body
Resources SkillResources `json:"resources"`
}
SkillPackage represents a fully and finely parsed Claude Skill package
func ParseSkillPackage ¶
func ParseSkillPackage(dirPath string) (*SkillPackage, error)
ParseSkillPackage finely parses the Skill package in the given directory path
func ParseSkillPackages ¶
func ParseSkillPackages(rootDir string) ([]*SkillPackage, error)
type SkillResources ¶
type SkillResources struct {
Scripts []string `json:"scripts"`
References []string `json:"references"`
Assets []string `json:"assets"`
Templates []string `json:"templates"`
}
SkillResources lists the relevant resource files in the skill package
type ToolDefinition ¶ added in v0.6.1
type ToolDefinition struct {
Name string `yaml:"name"`
Script string `yaml:"script,omitempty"` // 可选,指定脚本路径
Description string `yaml:"description,omitempty"`
Parameters map[string]ToolParameter `yaml:"parameters,omitempty"`
}
ToolDefinition 定义单个工具的配置
func GetToolDefinitions ¶ added in v0.6.1
func GetToolDefinitions(skill *SkillPackage) []ToolDefinition
GetToolDefinitions 返回 skill 中定义的工具列表(用于外部访问)
type ToolParameter ¶ added in v0.6.1
type ToolParameter struct {
Type string `yaml:"type"`
Description string `yaml:"description,omitempty"`
Required bool `yaml:"required,omitempty"`
}
ToolParameter 定义工具参数