Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements. Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate. Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable. Refs: Versioned dependencies U1/U3; feature/dependency-workspace
24 lines
945 B
Go
24 lines
945 B
Go
package skills
|
||
|
||
import (
|
||
"fmt"
|
||
|
||
agentskills "git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/runtime/skills"
|
||
)
|
||
|
||
// ValidateForPlugin 用 agent-native 的同一校验器验证插件技能
|
||
// (开放规范:name 必填且与目录同名、description 必填、已知键白名单)。
|
||
// 失败带插件上下文与字段定位,由调用方整批拒绝该插件(fail-closed,
|
||
// 与 agents/ 资产的禁带键同款形态)。
|
||
func ValidateForPlugin(pluginID, name string, body []byte) error {
|
||
if err := agentskills.ValidateSkillDocument(name, "plugins/"+pluginID+"/skills/"+name+".md", body); err != nil {
|
||
return fmt.Errorf("plugins: %s: skill %s: %w", pluginID, name, err)
|
||
}
|
||
return nil
|
||
}
|
||
|
||
// validateBuiltin 校验内置配方(种子写入前置;recipes 全部 dogfood 合规)。
|
||
func validateBuiltin(name string, body []byte) error {
|
||
return agentskills.ValidateSkillDocument(name, "recipes/"+name+"/SKILL.md", body)
|
||
}
|