Class NacosSkillRepository
- All Implemented Interfaces:
io.agentscope.core.skill.repository.AgentSkillRepository,AutoCloseable
AgentSkillRepository backed by Nacos AI skill packages.
Loading: Downloads the skill ZIP through AiService, then builds
AgentSkill from it (including SKILL.md). Indented YAML frontmatter in Nacos
exports is normalized so AgentScope's flat key: value parser can read it. API choice:
AiService.downloadSkillZipByVersion(String, String) if a version is set; else AiService.downloadSkillZipByLabel(String, String) if only a label is set; else AiService.downloadSkillZip(String). When both version and label resolve, version wins and the
label is not used for download.
Capabilities: Read operations work: getSkill(String), skillExists(String), getRepositoryInfo(), getSource(), isWriteable() (always false). Writes are unsupported: save(List, boolean) and
delete(String) do nothing; setWriteable(boolean) is ignored. These paths log a
warning.
Listing: Nacos AI Service has no "list all skills" API. When constructed
without knownSkillNames, getAllSkillNames() and getAllSkills() return
empty results and log a warning. Pass a non-empty knownSkillNames list to the
NacosSkillRepository(AiService, String, Properties, List) constructor to enable
enumeration — getAllSkills() will then fetch each skill via getSkill(String)
in sequence (one network call per skill; prefer MysqlSkillRepository for large
catalogues).
Version and label resolution: Independently for version and for label, the
first non-blank value wins, in order: (1) Properties from NacosSkillRepository(AiService, String, Properties), (2) JVM system property SKILL_VERSION_PATH or SKILL_LABEL_PATH, (3) environment variable ENV_SKILL_VERSION_PATH or ENV_SKILL_LABEL_PATH.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEnvironment variable name for skill label (fallback after properties and JVM).static final StringEnvironment variable name for skill version (fallback after properties and JVM).static final StringKey for skill label inProperties, JVMSystem.getProperty(String), etc.static final StringKey for skill version inProperties, JVMSystem.getProperty(String), etc. -
Constructor Summary
ConstructorsConstructorDescriptionNacosSkillRepository(com.alibaba.nacos.api.ai.AiService aiService, String namespaceId) Same asNacosSkillRepository(AiService, String, Properties)withproperties == null.NacosSkillRepository(com.alibaba.nacos.api.ai.AiService aiService, String namespaceId, Properties properties) Same asNacosSkillRepository(AiService, String, Properties, List)with an emptyknownSkillNames.NacosSkillRepository(com.alibaba.nacos.api.ai.AiService aiService, String namespaceId, Properties properties, List<String> knownSkillNames) Creates a repository for the given Nacos namespace; resolves skill version and label once (see class Javadoc for precedence). -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanList<io.agentscope.core.skill.AgentSkill>io.agentscope.core.skill.repository.AgentSkillRepositoryInfoio.agentscope.core.skill.AgentSkillbooleanbooleanvoidsetWriteable(boolean writeable) booleanskillExists(String skillName)
-
Field Details
-
SKILL_VERSION_PATH
Key for skill version inProperties, JVMSystem.getProperty(String), etc.- See Also:
-
SKILL_LABEL_PATH
Key for skill label inProperties, JVMSystem.getProperty(String), etc.- See Also:
-
ENV_SKILL_VERSION_PATH
Environment variable name for skill version (fallback after properties and JVM).- See Also:
-
ENV_SKILL_LABEL_PATH
Environment variable name for skill label (fallback after properties and JVM).- See Also:
-
-
Constructor Details
-
NacosSkillRepository
Same asNacosSkillRepository(AiService, String, Properties)withproperties == null. -
NacosSkillRepository
public NacosSkillRepository(com.alibaba.nacos.api.ai.AiService aiService, String namespaceId, Properties properties) Same asNacosSkillRepository(AiService, String, Properties, List)with an emptyknownSkillNames. -
NacosSkillRepository
public NacosSkillRepository(com.alibaba.nacos.api.ai.AiService aiService, String namespaceId, Properties properties, List<String> knownSkillNames) Creates a repository for the given Nacos namespace; resolves skill version and label once (see class Javadoc for precedence).- Parameters:
aiService- the Nacos AI service (must not be null)namespaceId- the Nacos namespace id (blank treated aspublic)properties- optional application properties; may benullknownSkillNames- skill names to expose viagetAllSkillNames()andgetAllSkills(); pass empty list to keep the no-op behaviour
-
-
Method Details
-
getSkill
- Specified by:
getSkillin interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
skillExists
- Specified by:
skillExistsin interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
getRepositoryInfo
public io.agentscope.core.skill.repository.AgentSkillRepositoryInfo getRepositoryInfo()- Specified by:
getRepositoryInfoin interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
getSource
- Specified by:
getSourcein interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
setWriteable
public void setWriteable(boolean writeable) - Specified by:
setWriteablein interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
isWriteable
public boolean isWriteable()- Specified by:
isWriteablein interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
getAllSkillNames
- Specified by:
getAllSkillNamesin interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
getAllSkills
- Specified by:
getAllSkillsin interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
save
- Specified by:
savein interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
delete
- Specified by:
deletein interfaceio.agentscope.core.skill.repository.AgentSkillRepository
-
close
public void close()- Specified by:
closein interfaceio.agentscope.core.skill.repository.AgentSkillRepository- Specified by:
closein interfaceAutoCloseable
-