@lmzhen/dsh-evolution-feedback 0.3.68 → 0.3.70

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
@@ -147,6 +147,18 @@ var EvolutionFeedback = class EvolutionFeedback {
147
147
  * @param note - optional free-text note carried into the durable event.
148
148
  * @param kind - `skill` (default `session`) selects the score table.
149
149
  */
150
+ /**
151
+ * v30 FB-01: refold the shared event log into the in-process aggregate.
152
+ * The aggregate only folds at mount, so a long-lived process computed the
153
+ * ABSOLUTE feedback pair from a stale aggregate and overwrote the decision
154
+ * relevant `feedback_warn` another process had recorded. The log is the
155
+ * truth — re-reading it before each quality push shrinks the staleness
156
+ * window to the refold-vs-append race (near-zero, serialized by mutate).
157
+ */
158
+ async refold() {
159
+ if (!this.io) return;
160
+ await this.restore(this.io);
161
+ }
150
162
  record(target, rating, note, kind = "session") {
151
163
  const mode = kind === "skill" ? "skills" : "sessions";
152
164
  const table = this.state[mode];
@@ -510,9 +522,11 @@ function apply(ctx, rawConfig = {}) {
510
522
  const skillUsage = skillCtx.skillUsage;
511
523
  const pushQuality = (target, kind) => {
512
524
  if (kind !== "skill") return;
513
- const score = feedback.score(target, "skill");
514
- const warn = score < qualityWarnThreshold;
515
- skillUsage.setFeedbackQuality(target, score, warn).catch((error) => {
525
+ feedback.refold().then(() => {
526
+ const score = feedback.score(target, "skill");
527
+ const warn = score < qualityWarnThreshold;
528
+ return skillUsage.setFeedbackQuality(target, score, warn);
529
+ }).catch((error) => {
516
530
  skillCtx.logger.warn(error);
517
531
  });
518
532
  };
@@ -87,6 +87,15 @@ export declare class EvolutionFeedback {
87
87
  * @param note - optional free-text note carried into the durable event.
88
88
  * @param kind - `skill` (default `session`) selects the score table.
89
89
  */
90
+ /**
91
+ * v30 FB-01: refold the shared event log into the in-process aggregate.
92
+ * The aggregate only folds at mount, so a long-lived process computed the
93
+ * ABSOLUTE feedback pair from a stale aggregate and overwrote the decision
94
+ * relevant `feedback_warn` another process had recorded. The log is the
95
+ * truth — re-reading it before each quality push shrinks the staleness
96
+ * window to the refold-vs-append race (near-zero, serialized by mutate).
97
+ */
98
+ refold(): Promise<void>;
90
99
  record(target: string, rating: 'positive' | 'negative', note?: string, kind?: 'skill' | 'session'): void;
91
100
  score(target: string, kind?: 'skill' | 'session'): number;
92
101
  snapshot(): FeedbackState;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-feedback",
3
3
  "description": "Feedback-to-quality scoring for self-evolution (community build)",
4
- "version": "0.3.68",
4
+ "version": "0.3.70",
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.68"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.70"
35
35
  },
36
36
  "peerDependencies": {
37
- "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
37
+ "@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
38
38
  "@deepseek-ai/cordis": "^4.0.1",
39
- "@lmzhen/dsh-evolution-io": "^0.3.68",
40
- "@lmzhen/dsh-skill-usage": "^0.3.68"
39
+ "@lmzhen/dsh-evolution-io": "^0.3.70",
40
+ "@lmzhen/dsh-skill-usage": "^0.3.70"
41
41
  },
42
42
  "devDependencies": {
43
- "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
44
- "@lmzhen/dsh-evolution-io": "^0.3.68",
45
- "@lmzhen/dsh-evolution-io-node": "^0.3.68",
46
- "@lmzhen/dsh-skill-usage": "^0.3.68"
43
+ "@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
44
+ "@lmzhen/dsh-evolution-io": "^0.3.70",
45
+ "@lmzhen/dsh-evolution-io-node": "^0.3.70",
46
+ "@lmzhen/dsh-skill-usage": "^0.3.70"
47
47
  }
48
48
  }