接口 AgentSkillRepository
- 所有超级接口:
AutoCloseable
Repository interface for AgentSkill persistence operations.
This interface follows the Repository Pattern and Dependency Inversion Principle, allowing different storage backends (filesystem, database, remote APIs, etc.) to be used interchangeably.
Example usage:
AgentSkillRepository repo = new GitHubSkillRepository("owner/repo");
AgentSkill skill = repo.getByName("calculate").orElseThrow();
-
方法概要
修饰符和类型方法说明default voidclose()Cleans up any resources used by this repository.booleanDeletes a skill by its skill name.Lists all available skill IDs in the repository.Gets all skills from the repository.Gets metadata about this repository.Gets a skill by its name.Gets the source identifier of this repository.booleanChecks if the repository supports write operations.booleansave(List<AgentSkill> skills, boolean force) Saves or updates a skill in the repository.voidsetWriteable(boolean writeable) Sets the writeable flag for this repository.booleanskillExists(String skillName) Checks if a skill exists in the repository.
-
方法详细资料
-
getSkill
Gets a skill by its name.- 参数:
name- The skill name- 返回:
- The skill matching the name
- 抛出:
IllegalArgumentException- if name or version is invalid
-
getAllSkillNames
Lists all available skill IDs in the repository.Each skill ID follows the format
name_version_source.- 返回:
- List of all skill IDs (never null, may be empty)
-
getAllSkills
List<AgentSkill> getAllSkills()Gets all skills from the repository.- 返回:
- List of all skills (never null, may be empty)
-
save
Saves or updates a skill in the repository.If a skill with the same name exists, it will be updated. Otherwise, a new skill will be created.
If the skills list is empty, return false.
- 参数:
skills- The skills to saveforce- Whether to force save even if the skill already exists- 返回:
trueif save succeeded,falseotherwise
-
delete
Deletes a skill by its skill name.- 参数:
skillName- The skill name (never null)- 返回:
trueif deletion succeeded,falseif skill not found
-
skillExists
Checks if a skill exists in the repository.- 参数:
skillName- The skill name (never null)- 返回:
trueif the skill exists,falseotherwise
-
getRepositoryInfo
AgentSkillRepositoryInfo getRepositoryInfo()Gets metadata about this repository.The information includes repository type, location, and other metadata.
- 返回:
- Repository information (never null)
-
getSource
String getSource()Gets the source identifier of this repository.The source follows the format
repositoryType_location.- 返回:
- The source identifier (never null)
-
setWriteable
void setWriteable(boolean writeable) Sets the writeable flag for this repository.- 参数:
writeable- Whether the repository supports write operations
-
isWriteable
boolean isWriteable()Checks if the repository supports write operations.- 返回:
trueif writable,falseotherwise
-
close
default void close()Cleans up any resources used by this repository.Implementations should override this method if they need to release resources such as network connections, file handles, or caches.
- 指定者:
close在接口中AutoCloseable
-