@lmzhen/dsh-skill-usage 0.3.22 → 0.3.24

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.
Files changed (2) hide show
  1. package/lib/index.js +5 -5
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { Service } from "@deepseek-ai/cordis";
2
2
  import z from "@deepseek-ai/schemastery";
3
- import { homedir } from "node:os";
4
- import { join } from "node:path";
5
- import { appendEvolutionEvent, bumpPatch, bumpUse, bumpView, eventsFile, evolutionIoAdapter, getRecord, loadUsage, markAgentCreated, mutateUsage, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
3
+ import { appendEvolutionEvent, bumpPatch, bumpUse, bumpView, eventsFile, evolutionIoAdapter, evolutionRoot, getRecord, loadUsage, markAgentCreated, mutateUsage, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
6
4
  //#region lib/types/index.js
7
5
  /**
8
6
  * Skill usage telemetry service for the evolution family.
@@ -30,7 +28,9 @@ function skillNameFromToolCall(raw) {
30
28
  return "";
31
29
  }
32
30
  else if (raw && typeof raw === "object") parsed = raw;
33
- return typeof parsed.name === "string" ? parsed.name : typeof parsed.skill === "string" ? parsed.skill : "";
31
+ if (!parsed || typeof parsed !== "object") return "";
32
+ const obj = parsed;
33
+ return typeof obj.name === "string" ? obj.name : typeof obj.skill === "string" ? obj.skill : "";
34
34
  }
35
35
  /** Cumulative library-wide usage totals (C observation-window event counts). */
36
36
  function usageTotals(map) {
@@ -62,7 +62,7 @@ var SkillUsageRegistry = class extends Service {
62
62
  constructor(ctx, config = {}) {
63
63
  super(ctx, "skillUsage");
64
64
  this.root = resolveSkillsRoot(config);
65
- this.eventsHome = config.eventsHome || process.env.DSH_HOME || join(homedir(), ".dsh");
65
+ this.eventsHome = config.eventsHome || evolutionRoot();
66
66
  this.io = evolutionIoAdapter(() => ctx.evolutionIo.provider());
67
67
  ctx.on("session/event", (_session, event) => {
68
68
  if (event.type !== "tool/call") return;
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.3.22",
4
+ "version": "0.3.24",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,18 +31,18 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.1",
34
- "@lmzhen/dsh-evolution-core": "^0.3.22"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.24"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.1",
38
38
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
39
39
  "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
40
- "@lmzhen/dsh-evolution-io": "^0.3.22"
40
+ "@lmzhen/dsh-evolution-io": "^0.3.24"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
44
44
  "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
45
- "@lmzhen/dsh-evolution-core": "^0.3.22",
46
- "@lmzhen/dsh-evolution-io": "^0.3.22"
45
+ "@lmzhen/dsh-evolution-core": "^0.3.24",
46
+ "@lmzhen/dsh-evolution-io": "^0.3.24"
47
47
  }
48
48
  }