@lmzhen/dsh-evolution-review 0.3.24 → 0.3.26
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 +40 -10
- package/package.json +10 -10
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
|
-
import { COMPLETION_SKILL_REVIEW_PROMPT, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_USER_CHAR_LIMIT, PROMPT_BUNDLE, SkillLibrary, advanceReview, evolutionIoAdapter, foldTurn, redactSecrets, resolveOrigins, reviewPrompt, verifyPromptBundle } from "@lmzhen/dsh-evolution-core";
|
|
4
|
+
import { COMPLETION_SKILL_REVIEW_PROMPT, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_USER_CHAR_LIMIT, PROMPT_BUNDLE, SkillLibrary, advanceReview, clampedNumber, evolutionIoAdapter, foldTurn, redactSecrets, resolveOrigins, reviewPrompt, verifyPromptBundle } from "@lmzhen/dsh-evolution-core";
|
|
5
5
|
import { validateEvolutionPlan } from "@lmzhen/dsh-evolution-plan-validator";
|
|
6
6
|
//#region lib/types/index.js
|
|
7
7
|
/**
|
|
@@ -13,22 +13,52 @@ const inject = ["agents"];
|
|
|
13
13
|
const Config = z.object({
|
|
14
14
|
reviewEnabled: z.boolean().default(true),
|
|
15
15
|
reviewMode: z.union([z.const("subagent"), z.const("inject")]).default("subagent"),
|
|
16
|
-
memoryInterval: z.number().default(DEFAULT_REVIEW_MEMORY_INTERVAL),
|
|
17
|
-
skillInterval: z.number().default(DEFAULT_REVIEW_SKILL_INTERVAL),
|
|
16
|
+
memoryInterval: z.number().min(1).default(DEFAULT_REVIEW_MEMORY_INTERVAL),
|
|
17
|
+
skillInterval: z.number().min(1).default(DEFAULT_REVIEW_SKILL_INTERVAL),
|
|
18
18
|
reviewToolAllow: z.array(z.string()).default(["skill"]),
|
|
19
|
-
reviewTimeoutMs: z.number().default(12e4),
|
|
20
|
-
executionTimeoutMs: z.number().default(3e4),
|
|
21
|
-
reviewContextMessages: z.number().default(60),
|
|
22
|
-
reviewMessageChars: z.number().default(2e3),
|
|
23
|
-
reviewMaxDepth: z.number().default(1),
|
|
19
|
+
reviewTimeoutMs: z.number().min(1).default(12e4),
|
|
20
|
+
executionTimeoutMs: z.number().min(1).default(3e4),
|
|
21
|
+
reviewContextMessages: z.number().min(1).default(60),
|
|
22
|
+
reviewMessageChars: z.number().min(1).default(2e3),
|
|
23
|
+
reviewMaxDepth: z.number().min(1).default(1),
|
|
24
24
|
reviewProvider: z.string(),
|
|
25
25
|
skillReviewTrigger: z.string().default(DEFAULT_SKILL_REVIEW_TRIGGER),
|
|
26
|
-
skillReviewCompletionMinToolCalls: z.number().default(DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS)
|
|
26
|
+
skillReviewCompletionMinToolCalls: z.number().min(1).default(DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS)
|
|
27
27
|
});
|
|
28
28
|
let statelessReviewStateWarned = false;
|
|
29
|
+
/**
|
|
30
|
+
* G3.1 (0.3.23): clamp the numeric review config at assembly so a 0/negative/
|
|
31
|
+
* NaN/±Infinity value falls back to the package default instead of folding as a
|
|
32
|
+
* "disabled" special value (a 0 interval would fire a review every turn; NaN
|
|
33
|
+
* folds as NaN into the cadence/timeout). The schema `.min(1)` guards the
|
|
34
|
+
* loader path; this clamp also covers NaN/±Infinity (which schemastery lets a
|
|
35
|
+
* bare number schema through) and direct construction. `reviewMaxDepth` clamps
|
|
36
|
+
* to at least 1 because 0 is the historical 0.3.1 maximum-depth defect (a 0
|
|
37
|
+
* rejects the spawn outright). Warn once when a user-supplied value had to be
|
|
38
|
+
* corrected.
|
|
39
|
+
*/
|
|
40
|
+
function clampReviewConfig(rawConfig, ctx) {
|
|
41
|
+
const clamped = [];
|
|
42
|
+
const field = (name, value, fallback, min) => {
|
|
43
|
+
const result = clampedNumber(value, fallback, { min });
|
|
44
|
+
if (value !== void 0 && result !== value) clamped.push(name);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
const config = Object.assign({}, rawConfig, {
|
|
48
|
+
memoryInterval: field("memoryInterval", rawConfig.memoryInterval, DEFAULT_REVIEW_MEMORY_INTERVAL, 1),
|
|
49
|
+
skillInterval: field("skillInterval", rawConfig.skillInterval, DEFAULT_REVIEW_SKILL_INTERVAL, 1),
|
|
50
|
+
reviewTimeoutMs: field("reviewTimeoutMs", rawConfig.reviewTimeoutMs, 12e4, 1),
|
|
51
|
+
reviewContextMessages: field("reviewContextMessages", rawConfig.reviewContextMessages, 60, 1),
|
|
52
|
+
reviewMessageChars: field("reviewMessageChars", rawConfig.reviewMessageChars, 2e3, 1),
|
|
53
|
+
reviewMaxDepth: field("reviewMaxDepth", rawConfig.reviewMaxDepth, 1, 1),
|
|
54
|
+
skillReviewCompletionMinToolCalls: field("skillReviewCompletionMinToolCalls", rawConfig.skillReviewCompletionMinToolCalls, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, 1)
|
|
55
|
+
});
|
|
56
|
+
if (clamped.length > 0) ctx.logger.warn(`dsh-evolution-review: ${clamped.join(", ")} provided an invalid value; falling back to the default`);
|
|
57
|
+
return config;
|
|
58
|
+
}
|
|
29
59
|
function apply(ctx, rawConfig) {
|
|
30
60
|
if (!verifyPromptBundle(PROMPT_BUNDLE)) throw new Error("dsh-evolution prompt bundle integrity check failed; refusing to schedule review work");
|
|
31
|
-
const config = rawConfig;
|
|
61
|
+
const config = clampReviewConfig(rawConfig, ctx);
|
|
32
62
|
const turnStarts = /* @__PURE__ */ new Map();
|
|
33
63
|
const cumulativeToolCalls = /* @__PURE__ */ new Map();
|
|
34
64
|
const completionInjected = /* @__PURE__ */ new Set();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-review",
|
|
3
3
|
"description": "Background review orchestration (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.26",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-approval": "^0.3.
|
|
35
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
36
|
-
"@lmzhen/dsh-evolution-plan-validator": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-approval": "^0.3.26",
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.3.26",
|
|
36
|
+
"@lmzhen/dsh-evolution-plan-validator": "^0.3.26"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
|
|
43
43
|
"@deepseek-ai/dsh-session": "^0.1.1-rc.2",
|
|
44
44
|
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
|
|
45
|
-
"@lmzhen/dsh-evolution-state": "^0.3.
|
|
46
|
-
"@lmzhen/dsh-evolution-policy": "^0.3.
|
|
45
|
+
"@lmzhen/dsh-evolution-state": "^0.3.26",
|
|
46
|
+
"@lmzhen/dsh-evolution-policy": "^0.3.26"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@deepseek-ai/dsh-agent": "^0.1.1-rc.2",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@deepseek-ai/dsh-session-persistence": "^0.1.1-rc.2",
|
|
55
55
|
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.1-rc.2",
|
|
56
56
|
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
|
|
57
|
-
"@lmzhen/dsh-evolution-approval": "^0.3.
|
|
58
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
59
|
-
"@lmzhen/dsh-evolution-plan-validator": "^0.3.
|
|
60
|
-
"@lmzhen/dsh-evolution-state": "^0.3.
|
|
57
|
+
"@lmzhen/dsh-evolution-approval": "^0.3.26",
|
|
58
|
+
"@lmzhen/dsh-evolution-core": "^0.3.26",
|
|
59
|
+
"@lmzhen/dsh-evolution-plan-validator": "^0.3.26",
|
|
60
|
+
"@lmzhen/dsh-evolution-state": "^0.3.26"
|
|
61
61
|
}
|
|
62
62
|
}
|