接口 AgentSkillRepository

所有超级接口:
AutoCloseable
所有已知实现类:
ClasspathSkillRepository, FileSystemSkillRepository

public interface AgentSkillRepository extends 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();
 
  • 方法详细资料

    • getSkill

      AgentSkill getSkill(String name)
      Gets a skill by its name.
      参数:
      name - The skill name
      返回:
      The skill matching the name
      抛出:
      IllegalArgumentException - if name or version is invalid
    • getAllSkillNames

      List<String> 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

      boolean save(List<AgentSkill> skills, boolean force)
      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 save
      force - Whether to force save even if the skill already exists
      返回:
      true if save succeeded, false otherwise
    • delete

      boolean delete(String skillName)
      Deletes a skill by its skill name.
      参数:
      skillName - The skill name (never null)
      返回:
      true if deletion succeeded, false if skill not found
    • skillExists

      boolean skillExists(String skillName)
      Checks if a skill exists in the repository.
      参数:
      skillName - The skill name (never null)
      返回:
      true if the skill exists, false otherwise
    • 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.
      返回:
      true if writable, false otherwise
    • 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