类 FileSystemSkillRepository

java.lang.Object
io.agentscope.core.skill.repository.FileSystemSkillRepository
所有已实现的接口:
AgentSkillRepository, AutoCloseable

public class FileSystemSkillRepository extends Object implements AgentSkillRepository
File system based implementation of AgentSkillRepository.

This repository stores skills in a local file system directory structure where each skill is stored in its own subdirectory containing a SKILL.md file and optional resource files.

Directory structure:


 baseDir/
 ├── skill-name-1/
 │   ├── SKILL.md          # Required: Entry file with YAML frontmatter
 │   ├── references/       # Optional: Reference documentation
 │   ├── examples/         # Optional: Example files
 │   └── scripts/          # Optional: Script files
 └── skill-name-2/
     └── SKILL.md
 

Example usage:


 Path baseDir = Paths.get("/path/to/skills");
 FileSystemSkillRepository repo = new FileSystemSkillRepository(baseDir);
 AgentSkill skill = repo.getSkill("my-skill");
 
  • 构造器详细资料

    • FileSystemSkillRepository

      public FileSystemSkillRepository(Path baseDir)
    • FileSystemSkillRepository

      public FileSystemSkillRepository(Path baseDir, boolean writeable)
      Creates a FileSystemSkillRepository with the specified base directory.
      参数:
      baseDir - The base directory containing skill subdirectories (must not be null)
      writeable - Whether the repository supports write operations
      抛出:
      IllegalArgumentException - if baseDir is null, doesn't exist, is not a directory, or is empty
    • FileSystemSkillRepository

      public FileSystemSkillRepository(Path baseDir, boolean writeable, String source)
      Creates a FileSystemSkillRepository with the specified base directory and source.
      参数:
      baseDir - The base directory containing skill subdirectories (must not be null)
      writeable - Whether the repository supports write operations
      source - The custom source identifier for skills (null to use default)
      抛出:
      IllegalArgumentException - if baseDir is null, doesn't exist, is not a directory, or is empty
  • 方法详细资料

    • getSkill

      public AgentSkill getSkill(String name)
      从接口复制的说明: AgentSkillRepository
      Gets a skill by its name.
      指定者:
      getSkill 在接口中 AgentSkillRepository
      参数:
      name - The skill name
      返回:
      The skill matching the name
    • getAllSkillNames

      public List<String> getAllSkillNames()
      从接口复制的说明: AgentSkillRepository
      Lists all available skill IDs in the repository.

      Each skill ID follows the format name_version_source.

      指定者:
      getAllSkillNames 在接口中 AgentSkillRepository
      返回:
      List of all skill IDs (never null, may be empty)
    • getAllSkills

      public List<AgentSkill> getAllSkills()
      从接口复制的说明: AgentSkillRepository
      Gets all skills from the repository.
      指定者:
      getAllSkills 在接口中 AgentSkillRepository
      返回:
      List of all skills (never null, may be empty)
    • save

      public boolean save(List<AgentSkill> skills, boolean force)
      从接口复制的说明: AgentSkillRepository
      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.

      指定者:
      save 在接口中 AgentSkillRepository
      参数:
      skills - The skills to save
      force - Whether to force save even if the skill already exists
      返回:
      true if save succeeded, false otherwise
    • delete

      public boolean delete(String skillName)
      从接口复制的说明: AgentSkillRepository
      Deletes a skill by its skill name.
      指定者:
      delete 在接口中 AgentSkillRepository
      参数:
      skillName - The skill name (never null)
      返回:
      true if deletion succeeded, false if skill not found
    • skillExists

      public boolean skillExists(String skillName)
      从接口复制的说明: AgentSkillRepository
      Checks if a skill exists in the repository.
      指定者:
      skillExists 在接口中 AgentSkillRepository
      参数:
      skillName - The skill name (never null)
      返回:
      true if the skill exists, false otherwise
    • getRepositoryInfo

      public AgentSkillRepositoryInfo getRepositoryInfo()
      从接口复制的说明: AgentSkillRepository
      Gets metadata about this repository.

      The information includes repository type, location, and other metadata.

      指定者:
      getRepositoryInfo 在接口中 AgentSkillRepository
      返回:
      Repository information (never null)
    • getSource

      public String getSource()
      从接口复制的说明: AgentSkillRepository
      Gets the source identifier of this repository.

      The source follows the format repositoryType_location.

      指定者:
      getSource 在接口中 AgentSkillRepository
      返回:
      The source identifier (never null)
    • setWriteable

      public void setWriteable(boolean writeable)
      从接口复制的说明: AgentSkillRepository
      Sets the writeable flag for this repository.
      指定者:
      setWriteable 在接口中 AgentSkillRepository
      参数:
      writeable - Whether the repository supports write operations
    • isWriteable

      public boolean isWriteable()
      从接口复制的说明: AgentSkillRepository
      Checks if the repository supports write operations.
      指定者:
      isWriteable 在接口中 AgentSkillRepository
      返回:
      true if writable, false otherwise