@lmzhen/dsh-evolution-feedback 0.3.69 → 0.3.71
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 +12 -6
- package/lib/types/index.d.ts +1 -1
- package/package.json +9 -9
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import { EVENT_LOG_VERSION, appendEvolutionEvent, clampedNumber, eventsFile, evolutionIoAdapter, evolutionRoot, listEventArchives, parseEvolutionEvents, readEvolutionTimeline, transactIo } from "@lmzhen/dsh-evolution-core";
|
|
2
|
+
import { EVENT_LOG_VERSION, appendEvolutionEvent, clampedNumber, eventsFile, evolutionEventPayloadIssue, evolutionIoAdapter, evolutionRoot, listEventArchives, parseEvolutionEvents, readEvolutionTimeline, transactIo } from "@lmzhen/dsh-evolution-core";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
//#region lib/types/index.js
|
|
5
5
|
/**
|
|
@@ -90,14 +90,15 @@ var EvolutionFeedback = class EvolutionFeedback {
|
|
|
90
90
|
await this.mutate(async () => {
|
|
91
91
|
const rawEvents = await io.readText(eventsPath);
|
|
92
92
|
const archiveNames = await listEventArchives(io, eventsPath);
|
|
93
|
+
const rawCache = await io.readText(path);
|
|
93
94
|
if ((rawEvents === null || rawEvents.trim() === "") && archiveNames.length === 0) {
|
|
94
|
-
const aggregate = parseAggregate(
|
|
95
|
+
const aggregate = parseAggregate(rawCache, this.warn);
|
|
95
96
|
if (aggregate) try {
|
|
96
|
-
await migrateFeedbackEvents(io, eventsPath, aggregate);
|
|
97
|
+
await migrateFeedbackEvents(io, eventsPath, aggregate, this.warn);
|
|
97
98
|
} catch {}
|
|
98
99
|
}
|
|
99
|
-
const { events } = await readEvolutionTimeline(io, eventsPath);
|
|
100
|
-
const cache = parseCache(
|
|
100
|
+
const { events } = await readEvolutionTimeline(io, eventsPath, archiveNames);
|
|
101
|
+
const cache = parseCache(rawCache, this.warn);
|
|
101
102
|
const maxSeq = events.reduce((max, event) => Math.max(max, event.seq), 0);
|
|
102
103
|
const floor = events[0]?.seq ?? 0;
|
|
103
104
|
const usableCache = cache && cache.lastSeq >= floor - 1 ? cache : null;
|
|
@@ -294,8 +295,13 @@ function containsLegacySequence(existing, expected) {
|
|
|
294
295
|
* and race-safe (the search runs inside the same transact). Exported for the
|
|
295
296
|
* migration-race regression test.
|
|
296
297
|
*/
|
|
297
|
-
async function migrateFeedbackEvents(io, eventsPath, aggregate) {
|
|
298
|
+
async function migrateFeedbackEvents(io, eventsPath, aggregate, warn = () => {}) {
|
|
298
299
|
const expected = synthesizeFeedbackEvents(aggregate);
|
|
300
|
+
const refused = expected.filter((event) => evolutionEventPayloadIssue(event) !== null);
|
|
301
|
+
if (refused.length > 0) {
|
|
302
|
+
warn(`evolution-feedback: migration refused ${refused.length} synthesized event(s) that the event log's payload gate rejects (types: ${[...new Set(refused.map((event) => event.type))].join(", ")}) — history starts empty instead of writing an unreadable log`);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
299
305
|
await transactIo(io, eventsPath, (current) => {
|
|
300
306
|
const existing = parseEvolutionEvents(current);
|
|
301
307
|
if (containsLegacySequence(existing, expected)) return Promise.resolve(current);
|
package/lib/types/index.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export declare class EvolutionFeedback {
|
|
|
116
116
|
* and race-safe (the search runs inside the same transact). Exported for the
|
|
117
117
|
* migration-race regression test.
|
|
118
118
|
*/
|
|
119
|
-
export declare function migrateFeedbackEvents(io: IoLike, eventsPath: string, aggregate: FeedbackState): Promise<void>;
|
|
119
|
+
export declare function migrateFeedbackEvents(io: IoLike, eventsPath: string, aggregate: FeedbackState, warn?: (message: string) => void): Promise<void>;
|
|
120
120
|
export declare const name = "evolution-feedback";
|
|
121
121
|
export interface Config {
|
|
122
122
|
/** Score below which the FEEDBACK pair flips to warned (P1-1, v15: written
|
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.
|
|
4
|
+
"version": "0.3.71",
|
|
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.71"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
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.
|
|
40
|
-
"@lmzhen/dsh-skill-usage": "^0.3.
|
|
39
|
+
"@lmzhen/dsh-evolution-io": "^0.3.71",
|
|
40
|
+
"@lmzhen/dsh-skill-usage": "^0.3.71"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
44
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
45
|
-
"@lmzhen/dsh-evolution-io-node": "^0.3.
|
|
46
|
-
"@lmzhen/dsh-skill-usage": "^0.3.
|
|
43
|
+
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
|
|
44
|
+
"@lmzhen/dsh-evolution-io": "^0.3.71",
|
|
45
|
+
"@lmzhen/dsh-evolution-io-node": "^0.3.71",
|
|
46
|
+
"@lmzhen/dsh-skill-usage": "^0.3.71"
|
|
47
47
|
}
|
|
48
48
|
}
|