@lmzhen/dsh-skill-usage 0.1.0-rc.4 → 0.1.0-rc.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Service } from "@deepseek-ai/cordis";
2
2
  import z from "@deepseek-ai/schemastery";
3
- import { bumpPatch, bumpUse, bumpView, evolutionIoAdapter, loadUsage, saveUsage, skillsRoot } from "@lmzhen/dsh-evolution-core";
3
+ import { bumpPatch, bumpUse, bumpView, evolutionIoAdapter, loadUsage, markAgentCreated, saveUsage, skillsRoot } from "@lmzhen/dsh-evolution-core";
4
4
  //#region lib/types/index.js
5
5
  /**
6
6
  * Skill usage telemetry service for the evolution family.
@@ -15,7 +15,7 @@ var SkillUsageRegistry = class extends Service {
15
15
  chain = Promise.resolve();
16
16
  constructor(ctx, config = {}) {
17
17
  super(ctx, "skillUsage");
18
- this.root = config.root ?? skillsRoot();
18
+ this.root = config.root || skillsRoot();
19
19
  this.io = evolutionIoAdapter(() => ctx.evolutionIo.provider());
20
20
  }
21
21
  async map() {
@@ -44,11 +44,34 @@ var SkillUsageRegistry = class extends Service {
44
44
  }
45
45
  async markAgentCreated(name) {
46
46
  await this.mutate(async (map) => {
47
- const { markAgentCreated } = await import("@lmzhen/dsh-evolution-core");
48
47
  markAgentCreated(map, name);
49
48
  await this.flush();
50
49
  });
51
50
  }
51
+ /**
52
+ * Mark a skill's usage record as archived (delete / curator archive paths).
53
+ * Unlike `record('patch')` this never bumps the patch counter — archiving is
54
+ * a state transition, not a content mutation.
55
+ */
56
+ async markArchived(name, at = /* @__PURE__ */ new Date()) {
57
+ await this.mutate(async (map) => {
58
+ const record = map.get(name);
59
+ if (record) {
60
+ record.state = "archived";
61
+ record.archived_at = at.toISOString();
62
+ }
63
+ await this.flush();
64
+ });
65
+ }
66
+ /**
67
+ * Drop the in-memory cache once queued work drains, so the next `map()` reads
68
+ * the file again. The curator writes the sidecar directly; without this, the
69
+ * next tool telemetry flush would re-cover its quality/state/pinned writes.
70
+ */
71
+ async invalidate() {
72
+ await this.chain;
73
+ this.usage = null;
74
+ }
52
75
  /** Write feedback-derived quality onto the usage sidecar; curator reads it. */
53
76
  async setQuality(name, score, warn) {
54
77
  await this.mutate(async (map) => {
@@ -28,6 +28,18 @@ export declare class SkillUsageRegistry extends Service {
28
28
  record(name: string, kind: 'use' | 'view' | 'patch', at?: Date): Promise<void>;
29
29
  report(): Promise<UsageMap>;
30
30
  markAgentCreated(name: string): Promise<void>;
31
+ /**
32
+ * Mark a skill's usage record as archived (delete / curator archive paths).
33
+ * Unlike `record('patch')` this never bumps the patch counter — archiving is
34
+ * a state transition, not a content mutation.
35
+ */
36
+ markArchived(name: string, at?: Date): Promise<void>;
37
+ /**
38
+ * Drop the in-memory cache once queued work drains, so the next `map()` reads
39
+ * the file again. The curator writes the sidecar directly; without this, the
40
+ * next tool telemetry flush would re-cover its quality/state/pinned writes.
41
+ */
42
+ invalidate(): Promise<void>;
31
43
  /** Write feedback-derived quality onto the usage sidecar; curator reads it. */
32
44
  setQuality(name: string, score: number, warn: boolean): Promise<void>;
33
45
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-skill-usage",
3
3
  "description": "Skill usage telemetry service (community build)",
4
- "version": "0.1.0-rc.4",
4
+ "version": "0.1.0-rc.41",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,16 +33,16 @@
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
35
  "@deepseek-ai/schemastery": "^3.18.1",
36
- "@lmzhen/dsh-evolution-core": "^0.1.0-rc.4"
36
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.41"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.1",
40
40
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
41
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.4"
41
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.41"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
45
- "@lmzhen/dsh-evolution-core": "^0.1.0-rc.4",
46
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.4"
45
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.41",
46
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.41"
47
47
  }
48
48
  }