FileSystemSkillRepository
public class FileSystemSkillRepository implements AgentSkillRepository
io/agentscope/core/skill/repository/FileSystemSkillRepository.java:60–292文件系统技能仓库,负责持久化与读取数据。位于 io.agentscope.core.skill.repository 包,实现 AgentSkillRepository。核心成员包括 isLazy、getSkill、getAllSkillNames、getAllSkills、save、delete。
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");
`
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public FileSystemSkillRepository(Path baseDir) | 初始化 `FileSystemSkillRepository` 实例。 Creates a new instance. |
public FileSystemSkillRepository(Path baseDir, boolean writeable) | 初始化 `FileSystemSkillRepository` 实例。 Creates a FileSystemSkillRepository with the specified base directory. |
public FileSystemSkillRepository(Path baseDir, boolean writeable, String source) | 初始化 `FileSystemSkillRepository` 实例。 Creates a FileSystemSkillRepository with the specified base directory and source. |
public FileSystemSkillRepository(Path baseDir, boolean writeable, String source, boolean lazy) | 初始化 `FileSystemSkillRepository` 实例。 Creates a FileSystemSkillRepository with explicit lazy mode. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public boolean isLazy() | 判断是否 `isLazy`。 Whether this repository only reads SKILL.md and defers support-file loading. |
public AgentSkill getSkill(String name) | 获取技能。 Returns the skill. |
public List<String> getAllSkillNames() | 获取 `getAllSkillNames`。 Returns the all skill names. |
public List<AgentSkill> getAllSkills() | 获取所有技能。 Returns the all skills. |
public boolean save(List<AgentSkill> skills, boolean force) | 保存数据到持久化存储。 Performs the save operation. |
public boolean delete(String skillName) | 删除数据。 Performs the delete operation. |
public boolean skillExists(String skillName) | 设置该参数。 Performs the skill exists operation. |
public AgentSkillRepositoryInfo getRepositoryInfo() | 获取仓库信息。 Returns the repository info. |
public String getSource() | 获取来源。 Returns the source. |
public void setWriteable(boolean writeable) | 设置 `setWriteable`。 Sets the writeable. |
public boolean isWriteable() | 判断是否 `isWriteable`。 Returns whether the writeable. |
构造器详情Constructor Detail
FileSystemSkillRepository
public FileSystemSkillRepository(Path baseDir)
初始化 FileSystemSkillRepository 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
baseDir | Path | 基类目录(类型 `Path`)。The base dir. |
io/agentscope/core/skill/repository/FileSystemSkillRepository.java:83–85FileSystemSkillRepository
public FileSystemSkillRepository(Path baseDir, boolean writeable)
初始化 FileSystemSkillRepository 实例。
Creates a FileSystemSkillRepository with the specified base directory.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
baseDir | Path | 基类目录(类型 `Path`)。The base directory containing skill subdirectories (must not be null) |
writeable | boolean | writeable(类型 `boolean`)。Whether the repository supports write operations |
IllegalArgumentException可能抛出 `IllegalArgumentException`。if baseDir is null, doesn't exist, is not a directory, or is empty
io/agentscope/core/skill/repository/FileSystemSkillRepository.java:95–97FileSystemSkillRepository
public FileSystemSkillRepository(Path baseDir, boolean writeable, String source)
初始化 FileSystemSkillRepository 实例。
Creates a FileSystemSkillRepository with the specified base directory and source.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
baseDir | Path | 基类目录(类型 `Path`)。The base directory containing skill subdirectories (must not be null) |
writeable | boolean | writeable(类型 `boolean`)。Whether the repository supports write operations |
source | String | 来源(类型 `String`)。The custom source identifier for skills (null to use default) |
IllegalArgumentException可能抛出 `IllegalArgumentException`。if baseDir is null, doesn't exist, is not a directory, or is empty
io/agentscope/core/skill/repository/FileSystemSkillRepository.java:108–110FileSystemSkillRepository
public FileSystemSkillRepository(Path baseDir, boolean writeable, String source, boolean lazy)
初始化 FileSystemSkillRepository 实例。
Creates a FileSystemSkillRepository with explicit lazy mode.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
baseDir | Path | 基类目录(类型 `Path`)。The base directory containing skill subdirectories (must not be null) |
writeable | boolean | writeable(类型 `boolean`)。Whether the repository supports write operations |
source | String | 来源(类型 `String`)。The custom source identifier for skills (null to use default) |
lazy | boolean | lazy(类型 `boolean`)。when `true`, support files are NOT pre-loaded; consumers must resolve them via the skill's `originDir`. Use this together with a `load_skill_through_path` disk-fallback for large skill libraries |
IllegalArgumentException可能抛出 `IllegalArgumentException`。if baseDir is null, doesn't exist, is not a directory, or is empty
io/agentscope/core/skill/repository/FileSystemSkillRepository.java:124–148方法详情Method Detail
isLazy
public boolean isLazy()
判断是否 isLazy。
Whether this repository only reads SKILL.md and defers support-file loading.
booleanio/agentscope/core/skill/repository/FileSystemSkillRepository.java:151–153getSkill
public AgentSkill getSkill(String name)
获取技能。
Returns the skill.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
AgentSkillio/agentscope/core/skill/repository/FileSystemSkillRepository.java:155–171getAllSkillNames
public List<String> getAllSkillNames()
获取 getAllSkillNames。
Returns the all skill names.
List<String>io/agentscope/core/skill/repository/FileSystemSkillRepository.java:173–176getAllSkills
public List<AgentSkill> getAllSkills()
获取所有技能。
Returns the all skills.
List<AgentSkill>io/agentscope/core/skill/repository/FileSystemSkillRepository.java:178–220save
public boolean save(List<AgentSkill> skills, boolean force)
保存数据到持久化存储。
Performs the save operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skills | List<AgentSkill> | 技能(类型 `List`)。The skills. |
force | boolean | force(类型 `boolean`)。The force. |
booleanio/agentscope/core/skill/repository/FileSystemSkillRepository.java:225–239delete
public boolean delete(String skillName)
删除数据。
Performs the delete operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillName | String | 技能名称(类型 `String`)。The skill name. |
booleanio/agentscope/core/skill/repository/FileSystemSkillRepository.java:241–251skillExists
public boolean skillExists(String skillName)
设置该参数。
Performs the skill exists operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillName | String | 技能名称(类型 `String`)。The skill name. |
booleanio/agentscope/core/skill/repository/FileSystemSkillRepository.java:253–256getRepositoryInfo
public AgentSkillRepositoryInfo getRepositoryInfo()
获取仓库信息。
Returns the repository info.
AgentSkillRepositoryInfoio/agentscope/core/skill/repository/FileSystemSkillRepository.java:258–261getSource
public String getSource()
获取来源。
Returns the source.
Stringio/agentscope/core/skill/repository/FileSystemSkillRepository.java:263–266setWriteable
public void setWriteable(boolean writeable)
设置 setWriteable。
Sets the writeable.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
writeable | boolean | writeable(类型 `boolean`)。The writeable. |
io/agentscope/core/skill/repository/FileSystemSkillRepository.java:283–286isWriteable
public boolean isWriteable()
判断是否 isWriteable。
Returns whether the writeable.
booleanio/agentscope/core/skill/repository/FileSystemSkillRepository.java:288–291