@lmzhen/dsh-skill-usage 0.3.70 → 0.3.72
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 +8 -11
- package/lib/types/index.d.ts +2 -1
- package/package.json +5 -5
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 { appendEvolutionEvent, bumpPatch, bumpUse, bumpView, eventsFile, evolutionIoAdapter, evolutionRoot, getRecord, loadUsage, markAgentCreated, mutateUsage, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
|
|
3
|
+
import { appendEvolutionEvent, bumpPatch, bumpUse, bumpView, eventsFile, evolutionIoAdapter, evolutionRoot, getRecord, loadUsage, makeSerialQueue, markAgentCreated, mutateUsage, resolveSkillsRoot, usageObserved } from "@lmzhen/dsh-evolution-core";
|
|
4
4
|
//#region lib/types/index.js
|
|
5
5
|
/**
|
|
6
6
|
* Skill usage telemetry service for the evolution family.
|
|
@@ -55,7 +55,8 @@ var SkillUsageRegistry = class extends Service {
|
|
|
55
55
|
root;
|
|
56
56
|
eventsHome;
|
|
57
57
|
io;
|
|
58
|
-
|
|
58
|
+
/** Process-local RMW queue (v34 B14 / v35 R6: the same factory the other sidecars use). */
|
|
59
|
+
serial = makeSerialQueue();
|
|
59
60
|
constructor(ctx, config = {}) {
|
|
60
61
|
super(ctx, "skillUsage");
|
|
61
62
|
this.root = resolveSkillsRoot(config);
|
|
@@ -88,9 +89,9 @@ var SkillUsageRegistry = class extends Service {
|
|
|
88
89
|
const normalized = name.trim();
|
|
89
90
|
return this.mutate(async (map) => {
|
|
90
91
|
if (!map.has(normalized)) return;
|
|
91
|
-
const
|
|
92
|
+
const windowOpening = !usageObserved(map);
|
|
92
93
|
bumpView(map, normalized, /* @__PURE__ */ new Date());
|
|
93
|
-
if (
|
|
94
|
+
if (windowOpening) await this.appendUsageWindowEvent(map);
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
/**
|
|
@@ -130,7 +131,7 @@ var SkillUsageRegistry = class extends Service {
|
|
|
130
131
|
* order would deadlock, so the one-way order is a binding invariant.
|
|
131
132
|
*/
|
|
132
133
|
mutate(task) {
|
|
133
|
-
|
|
134
|
+
return this.serial(async () => {
|
|
134
135
|
let outcome = void 0;
|
|
135
136
|
await mutateUsage(this.root, this.io, async (map) => {
|
|
136
137
|
outcome = await task(map);
|
|
@@ -139,8 +140,6 @@ var SkillUsageRegistry = class extends Service {
|
|
|
139
140
|
} });
|
|
140
141
|
return outcome;
|
|
141
142
|
});
|
|
142
|
-
this.chain = run.then(() => void 0, () => void 0);
|
|
143
|
-
return run;
|
|
144
143
|
}
|
|
145
144
|
async record(name, kind, at = /* @__PURE__ */ new Date()) {
|
|
146
145
|
const normalized = name.trim();
|
|
@@ -165,9 +164,7 @@ var SkillUsageRegistry = class extends Service {
|
|
|
165
164
|
* reader observes a complete generation (old or new), never a torn file, and
|
|
166
165
|
* the lock exists for the read-modify-write cycle this method does not do. */
|
|
167
166
|
async report() {
|
|
168
|
-
|
|
169
|
-
this.chain = run.then(() => void 0, () => void 0);
|
|
170
|
-
return run;
|
|
167
|
+
return this.serial(async () => new Map(await loadUsage(this.root, this.io)));
|
|
171
168
|
}
|
|
172
169
|
async markAgentCreated(name) {
|
|
173
170
|
await this.mutate((map) => {
|
|
@@ -211,7 +208,7 @@ var SkillUsageRegistry = class extends Service {
|
|
|
211
208
|
* @internal Exported for this package's own tests only.
|
|
212
209
|
*/
|
|
213
210
|
async invalidate() {
|
|
214
|
-
await this.
|
|
211
|
+
await this.serial(async () => {});
|
|
215
212
|
}
|
|
216
213
|
/** P1-1 (v15): write the FEEDBACK-owned quality signal onto the usage
|
|
217
214
|
* sidecar. Renamed from `setQuality` (it no longer writes the fields the
|
package/lib/types/index.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ export declare class SkillUsageRegistry extends Service {
|
|
|
21
21
|
readonly root: string;
|
|
22
22
|
private readonly eventsHome;
|
|
23
23
|
private readonly io;
|
|
24
|
-
|
|
24
|
+
/** Process-local RMW queue (v34 B14 / v35 R6: the same factory the other sidecars use). */
|
|
25
|
+
private readonly serial;
|
|
25
26
|
constructor(ctx: Context, config?: Config);
|
|
26
27
|
/**
|
|
27
28
|
* Read-side telemetry (A2): bump the view counter for an EXISTING record
|
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.
|
|
4
|
+
"version": "0.3.72",
|
|
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.
|
|
34
|
+
"@lmzhen/dsh-evolution-core": "^0.3.72"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
38
38
|
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
|
|
39
39
|
"@deepseek-ai/dsh-session": "^0.1.5-rc.2",
|
|
40
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
40
|
+
"@lmzhen/dsh-evolution-io": "^0.3.72"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
|
|
44
44
|
"@deepseek-ai/dsh-session": "^0.1.5-rc.2",
|
|
45
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
46
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
45
|
+
"@lmzhen/dsh-evolution-core": "^0.3.72",
|
|
46
|
+
"@lmzhen/dsh-evolution-io": "^0.3.72"
|
|
47
47
|
}
|
|
48
48
|
}
|