feat(cloud-agent): 技能 description 进入 Agent 系统提示 manifest
compileCloudAgentPolicies 的技能 manifest 此前只含 skillId/name/version/hash/entryPath/files,模型看不到每个已激活技能是干什么的,无法在多技能间路由、也无法向用户解释为何选它。本改动把 SkillItem.Description(技能市场公开元数据)注入 manifest,并以 500 runes 为上限截断(描述由技能作者提供,需防止异常长的描述撑爆提示词预算)。skill_read_file 渐进披露边界不变:instruction 与文件正文仍不进入系统提示。
This commit is contained in:
1 parent
c5b81f696c
commit
5fe27ae642
3 files changed
+32
-4
No files matched your search
@@ -84,6 +84,19 @@ func cloudAgentCapabilityGuide() string {
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// cloudAgentSkillManifestDescription bounds the system prompt: the description
|
||||
// is author-supplied public metadata, so it is trimmed and capped before it
|
||||
// enters the compiled policy.
|
||||
func cloudAgentSkillManifestDescription(description string) string {
|
||||
const maxRunes = 500
|
||||
trimmed := strings.TrimSpace(description)
|
||||
if utf8.RuneCountInString(trimmed) <= maxRunes {
|
||||
return trimmed
|
||||
}
|
||||
runes := []rune(trimmed)
|
||||
return strings.TrimSpace(string(runes[:maxRunes])) + "…"
|
||||
}
|
||||
|
||||
func compileCloudAgentPolicies(req CloudAgentRequest, skills []cloudAgentSkill, canvasSummary string, profile cloudAgentProfileSnapshot, anchors ...cloudAgentCreativeAnchor) (string, cloudAgentPolicySnapshot, error) {
|
||||
system, media, err := prompts.LoadAgentPolicies()
|
||||
if err != nil {
|
||||
@@ -121,7 +134,7 @@ func compileCloudAgentPolicies(req CloudAgentRequest, skills []cloudAgentSkill,
|
||||
}
|
||||
manifests := make([]map[string]any, 0, len(skills))
|
||||
for _, skill := range skills {
|
||||
manifests = append(manifests, map[string]any{"skillId": skill.ID, "name": skill.Name, "version": skill.Version, "hash": skill.Hash, "entryPath": cloudAgentSkillEntryPath, "files": cloudAgentSkillPaths(skill)})
|
||||
manifests = append(manifests, map[string]any{"skillId": skill.ID, "name": skill.Name, "description": cloudAgentSkillManifestDescription(skill.Description), "version": skill.Version, "hash": skill.Hash, "entryPath": cloudAgentSkillEntryPath, "files": cloudAgentSkillPaths(skill)})
|
||||
}
|
||||
context["skills"] = manifests
|
||||
layers := make([]map[string]any, 0, len(profile.Layers))
|
||||
|
||||
Reference in new issue
Block a user