AS AgentScopeAPI 手册 / API Reference

WorkspaceSkillRepository

@SuppressWarnings("deprecation") public class WorkspaceSkillRepository implements RuntimeContextSkillRepository, LazyResourceCapable
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:66–679

工作区技能仓库,负责持久化与读取数据。位于 io.agentscope.harness.agent.skill 包,实现 RuntimeContextSkillRepository、LazyResourceCapable。核心成员包括 getSkill、getAllSkillNames、getAllSkills、skillExists、getRepositoryInfo、getSource。

AgentSkillRepository backed by an AbstractFilesystem, with lazy resource access via LazyResourceCapable. Supersedes the legacy FilesystemBackedSkillRepository + WritableFilesystemSkillRepository pair: writability is now a constructor parameter rather than a subclass.

Skills are discovered by globbing SKILL.md under skillsRelativeDir. Only the SKILL.md text is read at registration time; resources (references, scripts, assets) are fetched on demand through #resourcesFor(String, RuntimeContext) and consumed by the harness skill runtime when load_skill_through_path misses the in-memory map.

Per-user namespacing and sandbox routing are honored transparently because every filesystem call passes the explicitly supplied RuntimeContext. Context-less operations use the default namespace and never infer a user from another active agent call.

Deletes are non-destructive: skill directories are moved under .archive/<name>-<ts>/ rather than removed, matching the curator's never-delete invariant.

构造器摘要Constructor Summary

构造器Constructor说明Description
public WorkspaceSkillRepository(AbstractFilesystem filesystem, String skillsRelativeDir)
初始化 `WorkspaceSkillRepository` 实例。
Creates a read-only repository scoped to the default namespace; context-less operations resolve to `RuntimeContext#empty()` unless a request context is passed explicitly.
public WorkspaceSkillRepository(AbstractFilesystem filesystem, String skillsRelativeDir, String source)
初始化 `WorkspaceSkillRepository` 实例。
Creates a writable repository (matches the legacy `WritableFilesystemSkillRepository` default), scoped to the default namespace.
public WorkspaceSkillRepository(AbstractFilesystem filesystem, String skillsRelativeDir, String source, boolean writable)
初始化 `WorkspaceSkillRepository` 实例。
Creates a repository with explicit source and writability, scoped to the default namespace.

方法摘要Method Summary

方法Method说明Description
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 List<AgentSkill> getAllSkills(RuntimeContext context)
获取所有技能。
Lists skills using the caller's request-scoped context.
public boolean skillExists(String skillName)
设置该参数。
Performs the skill exists operation.
public boolean skillExists(String skillName, RuntimeContext context)
执行 `skillExists` 方法。
Variant of `#skillExists(String)` scoped to the supplied request context; `null` uses the default namespace.
public AgentSkillRepositoryInfo getRepositoryInfo()
获取仓库信息。
Returns the repository info.
public String getSource()
获取来源。
Returns the source.
public boolean isWriteable()
判断是否 `isWriteable`。
Returns whether the writeable.
public void setWriteable(boolean writeable)
设置 `setWriteable`。
Sets the writeable.
public SkillResources resourcesFor(String skillName, RuntimeContext ctx)
执行 `resourcesFor` 方法。
Performs the resources for operation.
public boolean save(List<AgentSkill> skills, boolean force)
保存数据到持久化存储。
Performs the save operation.
public boolean save(List<AgentSkill> skills, boolean force, RuntimeContext context)
保存数据到持久化存储。
Variant of `#save(List, boolean)` scoped to the supplied request context; `null` uses the default namespace.
public boolean delete(String skillName)
删除数据。
Performs the delete operation.
public boolean delete(String skillName, RuntimeContext context)
删除数据。
Variant of `#delete(String)` scoped to the supplied request context; `null` uses the default namespace.
public String readSkillFile(String skillName, String relPath)
执行读取技能文件相关操作。
Reads a single raw file under `<skillsRelativeDir>/<skillName>/<relPath>`.
public String readSkillFile(String skillName, String relPath, RuntimeContext context)
执行读取技能文件相关操作。
Variant of `#readSkillFile(String, String)` scoped to the supplied request context; `null` uses the default namespace.
public boolean writeSkillFile(String skillName, String relPath, String content)
执行写入技能文件相关操作。
Writes (or overwrites) a single raw file under `<skillsRelativeDir>/<skillName>/<relPath>`.
public boolean writeSkillFile(String skillName, String relPath, String content, RuntimeContext context)
执行写入技能文件相关操作。
Variant of `#writeSkillFile(String, String, String)` scoped to the supplied request context; `null` uses the default namespace.
public boolean deleteSkillFile(String skillName, String relPath)
删除技能文件。
Deletes a single raw file under `<skillsRelativeDir>/<skillName>/<relPath>`.
public boolean deleteSkillFile(String skillName, String relPath, RuntimeContext context)
删除技能文件。
Variant of `#deleteSkillFile(String, String)` scoped to the supplied request context; `null` uses the default namespace.
public String resolveSkillRoot(String skillName)
解析技能根。
Returns the relative skill root path for callers building sub-paths.
public AbstractFilesystem filesystem()
返回文件系统。
Returns the filesystem.
public String skillsRelativeDir()
返回 `skillsRelativeDir` 结果。
Returns the skills relative dir.

构造器详情Constructor Detail

WorkspaceSkillRepository

public WorkspaceSkillRepository(AbstractFilesystem filesystem, String skillsRelativeDir)

初始化 WorkspaceSkillRepository 实例。

Creates a read-only repository scoped to the default namespace; context-less operations resolve to RuntimeContext#empty() unless a request context is passed explicitly.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
skillsRelativeDirString技能 Relative 目录(类型 `String`)。The skills relative dir.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:87–89

WorkspaceSkillRepository

public WorkspaceSkillRepository(AbstractFilesystem filesystem, String skillsRelativeDir, String source)

初始化 WorkspaceSkillRepository 实例。

Creates a writable repository (matches the legacy WritableFilesystemSkillRepository default), scoped to the default namespace.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
skillsRelativeDirString技能 Relative 目录(类型 `String`)。The skills relative dir.
sourceString来源(类型 `String`)。The source.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:95–98

WorkspaceSkillRepository

public WorkspaceSkillRepository(AbstractFilesystem filesystem, String skillsRelativeDir, String source, boolean writable)

初始化 WorkspaceSkillRepository 实例。

Creates a repository with explicit source and writability, scoped to the default namespace.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
skillsRelativeDirString技能 Relative 目录(类型 `String`)。The skills relative dir.
sourceString来源(类型 `String`)。The source.
writablebooleanwritable(类型 `boolean`)。The writable.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:103–112

方法详情Method Detail

getSkill

public AgentSkill getSkill(String name)

获取技能。

Returns the skill.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
返回Returns AgentSkill
返回AgentSkill。Returns agent skill.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:118–129

getAllSkillNames

public List<String> getAllSkillNames()

获取 getAllSkillNames。

Returns the all skill names.

返回Returns List<String>
返回列出。Returns list.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:131–139

getAllSkills

public List<AgentSkill> getAllSkills()

获取所有技能。

Returns the all skills.

返回Returns List<AgentSkill>
返回列出。Returns list.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:141–144

getAllSkills

public List<AgentSkill> getAllSkills(RuntimeContext context)

获取所有技能。

Lists skills using the caller's request-scoped context.

参数Parameters
名称Name类型Type说明Description
contextRuntimeContext上下文(类型 `RuntimeContext`)。The context.
返回Returns List<AgentSkill>
返回列出。Returns list.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:149–186

skillExists

public boolean skillExists(String skillName)

设置该参数。

Performs the skill exists operation.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:188–191

skillExists

public boolean skillExists(String skillName, RuntimeContext context)

执行 skillExists 方法。

Variant of #skillExists(String) scoped to the supplied request context; null uses the default namespace.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
contextRuntimeContext上下文(类型 `RuntimeContext`)。The context.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:194–196

getRepositoryInfo

public AgentSkillRepositoryInfo getRepositoryInfo()

获取仓库信息。

Returns the repository info.

返回Returns AgentSkillRepositoryInfo
返回AgentSkillRepositoryInfo。Returns agent skill repository info.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:198–201

getSource

public String getSource()

获取来源。

Returns the source.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:203–206

isWriteable

public boolean isWriteable()

判断是否 isWriteable。

Returns whether the writeable.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:208–211

setWriteable

public void setWriteable(boolean writeable)

设置 setWriteable。

Sets the writeable.

参数Parameters
名称Name类型Type说明Description
writeablebooleanwriteable(类型 `boolean`)。The writeable.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:213–216

resourcesFor

public SkillResources resourcesFor(String skillName, RuntimeContext ctx)

执行 resourcesFor 方法。

Performs the resources for operation.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
ctxRuntimeContext运行时上下文(类型 `RuntimeContext`)。The ctx.
返回Returns SkillResources
返回SkillResources。Returns skill resources.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:222–229

save

public boolean save(List<AgentSkill> skills, boolean force)

保存数据到持久化存储。

Performs the save operation.

参数Parameters
名称Name类型Type说明Description
skillsList<AgentSkill>技能(类型 `List`)。The skills.
forcebooleanforce(类型 `boolean`)。The force.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:235–238

save

public boolean save(List<AgentSkill> skills, boolean force, RuntimeContext context)

保存数据到持久化存储。

Variant of #save(List, boolean) scoped to the supplied request context; null uses the default namespace.

参数Parameters
名称Name类型Type说明Description
skillsList<AgentSkill>技能(类型 `List`)。The skills.
forcebooleanforce(类型 `boolean`)。The force.
contextRuntimeContext上下文(类型 `RuntimeContext`)。The context.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:241–269

delete

public boolean delete(String skillName)

删除数据。

Performs the delete operation.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:271–274

delete

public boolean delete(String skillName, RuntimeContext context)

删除数据。

Variant of #delete(String) scoped to the supplied request context; null uses the default namespace.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
contextRuntimeContext上下文(类型 `RuntimeContext`)。The context.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:277–308

readSkillFile

public String readSkillFile(String skillName, String relPath)

执行读取技能文件相关操作。

Reads a single raw file under / /.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
relPathStringrel 路径(类型 `String`)。The rel path.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:318–320

readSkillFile

public String readSkillFile(String skillName, String relPath, RuntimeContext context)

执行读取技能文件相关操作。

Variant of #readSkillFile(String, String) scoped to the supplied request context; null uses the default namespace.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
relPathStringrel 路径(类型 `String`)。The rel path.
contextRuntimeContext上下文(类型 `RuntimeContext`)。The context.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:323–338

writeSkillFile

public boolean writeSkillFile(String skillName, String relPath, String content)

执行写入技能文件相关操作。

Writes (or overwrites) a single raw file under / /.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
relPathStringrel 路径(类型 `String`)。The rel path.
contentString内容(类型 `String`)。The content.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:345–347

writeSkillFile

public boolean writeSkillFile(String skillName, String relPath, String content, RuntimeContext context)

执行写入技能文件相关操作。

Variant of #writeSkillFile(String, String, String) scoped to the supplied request context; null uses the default namespace.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
relPathStringrel 路径(类型 `String`)。The rel path.
contentString内容(类型 `String`)。The content.
contextRuntimeContext上下文(类型 `RuntimeContext`)。The context.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:350–374

deleteSkillFile

public boolean deleteSkillFile(String skillName, String relPath)

删除技能文件。

Deletes a single raw file under / /.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
relPathStringrel 路径(类型 `String`)。The rel path.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:380–382

deleteSkillFile

public boolean deleteSkillFile(String skillName, String relPath, RuntimeContext context)

删除技能文件。

Variant of #deleteSkillFile(String, String) scoped to the supplied request context; null uses the default namespace.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
relPathStringrel 路径(类型 `String`)。The rel path.
contextRuntimeContext上下文(类型 `RuntimeContext`)。The context.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:385–401

resolveSkillRoot

public String resolveSkillRoot(String skillName)

解析技能根。

Returns the relative skill root path for callers building sub-paths.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:404–406

filesystem

public AbstractFilesystem filesystem()

返回文件系统。

Returns the filesystem.

返回Returns AbstractFilesystem
返回AbstractFilesystem。Returns abstract filesystem.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:412–414

skillsRelativeDir

public String skillsRelativeDir()

返回 skillsRelativeDir 结果。

Returns the skills relative dir.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/skill/WorkspaceSkillRepository.java:416–418

继承成员Inherited Members

继承自Methods inherited from RuntimeContextSkillRepository
继承自Methods inherited from AgentSkillRepository
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.