AS AgentScopeAPI 手册 / API Reference

SkillUsageStore

public class SkillUsageStore
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:42–323

技能用量存储,负责持久化与读取数据。位于 io.agentscope.harness.agent.skill.curator 包。核心成员包括 baseStore、load、save、get、bumpView、bumpUse。

Sidecar telemetry store for per-skill usage and provenance.

Persists SkillUsageRecord instances (one per skill). The default backend stores all records in a single JSON file at <workspace>/skills/.usage.json; when constructed with a BaseStore, each skill is stored under ["skills", "usage"] with CAS updates.

Provenance gate: counter mutators (bumpView/bumpUse/bumpPatch) silently skip skills that are not agent-created. This avoids polluting telemetry for bundled / hub-installed / user-authored skills, matching the hermes-agent skill_usage._mutate behavior.

字段摘要Field Summary

字段Field类型Type说明Description
DEFAULT_RELATIVE_PATH
staticfinal
String
默认 RELATIVE 路径字段。
Default workspace-relative path for the filesystem sidecar.

构造器摘要Constructor Summary

构造器Constructor说明Description
public SkillUsageStore(AbstractFilesystem filesystem)
初始化 `SkillUsageStore` 实例。
Creates a new instance.
public SkillUsageStore(AbstractFilesystem filesystem, String relativePath)
初始化 `SkillUsageStore` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public static SkillUsageStore baseStore(BaseStore store)
static
设置基类存储。
Creates a store backed by a distributed `BaseStore` (one key per skill).
public Map<String, SkillUsageRecord> load()
从持久化存储恢复数据。
Load the entire sidecar map.
public void save(Map<String, SkillUsageRecord> data)
保存数据到持久化存储。
Persist the entire sidecar map.
public Optional<SkillUsageRecord> get(String name)
按条件读取数据。
Read a single record by name.
public void bumpView(String name)
设置该参数。
Performs the bump view operation.
public void bumpUse(String name)
设置该参数。
Performs the bump use operation.
public void bumpPatch(String name)
设置该参数。
Performs the bump patch operation.
public void markAgentDraft(String name, String sessionId)
执行 `markAgentDraft` 方法。
Tag a freshly-created agent draft (called from `SkillManageTool.create`).
public void markAgentCreated(String name, String reviewerId, List<String> environments)
执行 `markAgentCreated` 方法。
Mark a skill as a fully agent-created (i.e.
public void setState(String name, State newState)
设置状态。
Sets the state.
public void setPinned(String name, boolean pinned)
设置 `setPinned`。
Sets the pinned.
public void forget(String name)
设置该参数。
Drop the record entirely.
public List<Map.Entry<String, SkillUsageRecord>> agentCreatedReport()
返回智能体已创建报告。
All records whose `createdBy` is non-null (i.e.

字段详情Field Detail

DEFAULT_RELATIVE_PATH

public static final String DEFAULT_RELATIVE_PATH
staticfinal

默认 RELATIVE 路径字段。声明为 public static final String DEFAULT_RELATIVE_PATH。

Default workspace-relative path for the filesystem sidecar.

源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:47

构造器详情Constructor Detail

SkillUsageStore

public SkillUsageStore(AbstractFilesystem filesystem)

初始化 SkillUsageStore 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:51–53

SkillUsageStore

public SkillUsageStore(AbstractFilesystem filesystem, String relativePath)

初始化 SkillUsageStore 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
relativePathStringrelative 路径(类型 `String`)。The relative path.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:55–57

方法详情Method Detail

baseStore

public static SkillUsageStore baseStore(BaseStore store)
static

设置基类存储。

Creates a store backed by a distributed BaseStore (one key per skill).

参数Parameters
名称Name类型Type说明Description
storeBaseStore存储实例(类型 `BaseStore`)。The store.
返回Returns SkillUsageStore
返回SkillUsageStore。Returns skill usage store.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:60–62

load

public Map<String, SkillUsageRecord> load()

从持久化存储恢复数据。

Load the entire sidecar map.

返回Returns Map<String, SkillUsageRecord>
返回映射。Returns map.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:73–75

save

public void save(Map<String, SkillUsageRecord> data)

保存数据到持久化存储。

Persist the entire sidecar map.

参数Parameters
名称Name类型Type说明Description
dataMap<String, SkillUsageRecord>数据(类型 `Map`)。The data.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:78–80

get

public Optional<SkillUsageRecord> get(String name)

按条件读取数据。

Read a single record by name.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
返回Returns Optional<SkillUsageRecord>
返回可选。Returns optional.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:83–88

bumpView

public void bumpView(String name)

设置该参数。

Performs the bump view operation.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:110–130

bumpUse

public void bumpUse(String name)

设置该参数。

Performs the bump use operation.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:132–152

bumpPatch

public void bumpPatch(String name)

设置该参数。

Performs the bump patch operation.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:154–174

markAgentDraft

public void markAgentDraft(String name, String sessionId)

执行 markAgentDraft 方法。

Tag a freshly-created agent draft (called from SkillManageTool.create).

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:207–227

markAgentCreated

public void markAgentCreated(String name, String reviewerId, List<String> environments)

执行 markAgentCreated 方法。

Mark a skill as a fully agent-created (i.e.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
reviewerIdStringreviewer 标识(类型 `String`)。The reviewer id.
environmentsList<String>环境(类型 `List`)。The environments.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:234–254

setState

public void setState(String name, State newState)

设置状态。

Sets the state.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
newStateState新建状态(类型 `State`)。The new state.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:256–279

setPinned

public void setPinned(String name, boolean pinned)

设置 setPinned。

Sets the pinned.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
pinnedbooleanpinned(类型 `boolean`)。The pinned.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:281–301

forget

public void forget(String name)

设置该参数。

Drop the record entirely.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:304–306

agentCreatedReport

public List<Map.Entry<String, SkillUsageRecord>> agentCreatedReport()

返回智能体已创建报告。

All records whose createdBy is non-null (i.e.

返回Returns List<Map.Entry<String, SkillUsageRecord>>
返回列出>。Returns list.
源码Source io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:313–322
基于官方固定版本源码静态生成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.