SkillUsageStore
public class SkillUsageStore
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_PATHstaticfinal | 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
字段详情Field Detail
DEFAULT_RELATIVE_PATH
public static final String DEFAULT_RELATIVE_PATH
默认 RELATIVE 路径字段。声明为 public static final String DEFAULT_RELATIVE_PATH。
Default workspace-relative path for the filesystem sidecar.
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:47构造器详情Constructor Detail
SkillUsageStore
public SkillUsageStore(AbstractFilesystem filesystem)
初始化 SkillUsageStore 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filesystem | AbstractFilesystem | 文件系统(类型 `AbstractFilesystem`)。The filesystem. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:51–53SkillUsageStore
public SkillUsageStore(AbstractFilesystem filesystem, String relativePath)
初始化 SkillUsageStore 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filesystem | AbstractFilesystem | 文件系统(类型 `AbstractFilesystem`)。The filesystem. |
relativePath | String | relative 路径(类型 `String`)。The relative path. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:55–57方法详情Method Detail
baseStore
public static SkillUsageStore baseStore(BaseStore store)
设置基类存储。
Creates a store backed by a distributed BaseStore (one key per skill).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | BaseStore | 存储实例(类型 `BaseStore`)。The store. |
SkillUsageStoreio/agentscope/harness/agent/skill/curator/SkillUsageStore.java:60–62load
public Map<String, SkillUsageRecord> load()
从持久化存储恢复数据。
Load the entire sidecar map.
Map<String, SkillUsageRecord>io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:73–75save
public void save(Map<String, SkillUsageRecord> data)
保存数据到持久化存储。
Persist the entire sidecar map.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
data | Map<String, SkillUsageRecord> | 数据(类型 `Map`)。The data. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:78–80get
public Optional<SkillUsageRecord> get(String name)
按条件读取数据。
Read a single record by name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
Optional<SkillUsageRecord>io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:83–88bumpView
public void bumpView(String name)
设置该参数。
Performs the bump view operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:110–130bumpUse
public void bumpUse(String name)
设置该参数。
Performs the bump use operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:132–152bumpPatch
public void bumpPatch(String name)
设置该参数。
Performs the bump patch operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:154–174markAgentDraft
public void markAgentDraft(String name, String sessionId)
执行 markAgentDraft 方法。
Tag a freshly-created agent draft (called from SkillManageTool.create).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:207–227markAgentCreated
public void markAgentCreated(String name, String reviewerId, List<String> environments)
执行 markAgentCreated 方法。
Mark a skill as a fully agent-created (i.e.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
reviewerId | String | reviewer 标识(类型 `String`)。The reviewer id. |
environments | List<String> | 环境(类型 `List`)。The environments. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:234–254setState
public void setState(String name, State newState)
设置状态。
Sets the state.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
newState | State | 新建状态(类型 `State`)。The new state. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:256–279setPinned
public void setPinned(String name, boolean pinned)
设置 setPinned。
Sets the pinned.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
pinned | boolean | pinned(类型 `boolean`)。The pinned. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:281–301forget
public void forget(String name)
设置该参数。
Drop the record entirely.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:304–306agentCreatedReport
public List<Map.Entry<String, SkillUsageRecord>> agentCreatedReport()
返回智能体已创建报告。
All records whose createdBy is non-null (i.e.
List<Map.Entry<String, SkillUsageRecord>>io/agentscope/harness/agent/skill/curator/SkillUsageStore.java:313–322