Files
ai_academy/internal/agent/skills/source.go
T
runny 7ec21f35b0 chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、
Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。
今日开发的培训推送管理改动随后单独提交。
2026-11-16 18:12:23 +08:00

33 lines
1.3 KiB
Go

package skills
// SkillSource is where one set of skills comes from. Two implementations
// exist: host skill directories used in tests (*Loader) and the projection of
// skills an administrator installed into a workspace sandbox config's snapshot
// image (*TenantSkillSource).
//
// The five methods are the Progressive Disclosure levels the agent asks for:
// metadata for the system prompt, the SKILL.md body, individual resource
// files, the file listing, and the directory a script runs from.
type SkillSource interface {
DiscoverSkills() ([]*SkillMetadata, error)
LoadSkillInstructions(name string) (*Skill, error)
LoadSkillFile(name, relativePath string) (*SkillFile, error)
ListSkillFiles(name string) ([]string, error)
GetSkillBasePath(name string) (string, error)
}
var _ SkillSource = (*Loader)(nil)
// imageSkillSource is a source whose skills already exist inside the sandbox
// image. It is what separates the two sources at execution time: a host skill
// lives on the Academy machine and has to be uploaded into the sandbox, while
// an installed skill is already there and is executed in place.
type imageSkillSource interface {
SkillSource
// RemoteScriptPath returns the absolute in-sandbox path of one script.
RemoteScriptPath(name, relativePath string) (string, error)
}
var _ imageSkillSource = (*TenantSkillSource)(nil)