@lmzhen/dsh-evolution-review 0.3.51 → 0.3.53
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 +27 -10
- package/lib/types/index.d.ts +20 -0
- package/package.json +11 -11
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, clampedNumber, 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, resolveSkillsRoot, 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
|
/**
|
|
@@ -28,7 +28,8 @@ const Config = z.object({
|
|
|
28
28
|
z.const("both")
|
|
29
29
|
]).default(DEFAULT_SKILL_REVIEW_TRIGGER),
|
|
30
30
|
reviewWakeInject: z.boolean().default(true),
|
|
31
|
-
skillReviewCompletionMinToolCalls: z.number().min(1).default(DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS)
|
|
31
|
+
skillReviewCompletionMinToolCalls: z.number().min(1).default(DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS),
|
|
32
|
+
skillsRoot: z.string().default("")
|
|
32
33
|
});
|
|
33
34
|
/** V8-01 (0.3.45): the review subagent's structured-output contract. The
|
|
34
35
|
* `subagents.start` outputSchema is RAW JSON Schema validated by
|
|
@@ -185,6 +186,7 @@ function apply(ctx, rawConfig) {
|
|
|
185
186
|
ctx.logger.warn(`dsh-evolution-review: cadence counter reset could not be persisted after a delivered review (${resetError instanceof Error ? resetError.message : String(resetError)}) — a stateful reload may re-deliver this review`);
|
|
186
187
|
}
|
|
187
188
|
}
|
|
189
|
+
return;
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
192
|
if (kind && event.data.reason.kind !== "completed") {
|
|
@@ -469,7 +471,7 @@ function apply(ctx, rawConfig) {
|
|
|
469
471
|
ok: false,
|
|
470
472
|
message: "evolution-io service not mounted"
|
|
471
473
|
};
|
|
472
|
-
const library = new SkillLibrary(
|
|
474
|
+
const library = new SkillLibrary(resolveSkillsRoot({ root: config.skillsRoot }), evolutionIoAdapter(() => io.provider()), void 0, (event) => {
|
|
473
475
|
ctx.emit("evolution/skill-mutated", event);
|
|
474
476
|
});
|
|
475
477
|
const op = skillArgs;
|
|
@@ -598,6 +600,26 @@ function fingerprintPolicy(snapshot) {
|
|
|
598
600
|
return;
|
|
599
601
|
}
|
|
600
602
|
}
|
|
603
|
+
/**
|
|
604
|
+
* V10-10 (P2-11): render one `[result]` evidence line from a 'tool/result'
|
|
605
|
+
* event payload. The former read (`data.output`) targeted a field that does
|
|
606
|
+
* not exist on the upstream rc.2 payload, so EVERY result line rendered an
|
|
607
|
+
* empty payload and the review subagent never saw tool output — the evidence
|
|
608
|
+
* chain silently starved while still spending its line budget. The payload
|
|
609
|
+
* text now comes from `data.message.content` tool-result blocks (inner text
|
|
610
|
+
* blocks joined, mirroring the user/assistant rendering above). A failure is
|
|
611
|
+
* marked by the payload-level `error` OR a block-level `isError`. The legacy
|
|
612
|
+
* pre-rc.2 shape (no `message`) is tolerated as an empty payload — it never
|
|
613
|
+
* throws. Budget: 500 chars per line (the 12-line cap lives in
|
|
614
|
+
* buildReviewRequest and is unchanged).
|
|
615
|
+
*/
|
|
616
|
+
function renderToolResultLine(data) {
|
|
617
|
+
const shape = data;
|
|
618
|
+
const content = shape?.message?.content;
|
|
619
|
+
const resultBlocks = (Array.isArray(content) ? content : []).filter((block) => block.type === "tool-result");
|
|
620
|
+
const output = resultBlocks.map((block) => Array.isArray(block.content) ? block.content.map((inner) => inner.type === "text" && typeof inner.text === "string" ? inner.text : "").join(" ") : typeof block.text === "string" ? block.text : "").join(" ").trim();
|
|
621
|
+
return `[result]${shape?.error || resultBlocks.some((block) => block.isError === true) ? " [ERROR]" : ""} ${output.slice(0, 500)}`;
|
|
622
|
+
}
|
|
601
623
|
function buildReviewRequest(session, kind, signal, maxMessages, maxMessageChars) {
|
|
602
624
|
const messages = [];
|
|
603
625
|
const surface = session.deriveMessages();
|
|
@@ -613,12 +635,7 @@ function buildReviewRequest(session, kind, signal, maxMessages, maxMessageChars)
|
|
|
613
635
|
const data = event.data;
|
|
614
636
|
const argsRaw = typeof data?.arguments === "string" ? data.arguments : JSON.stringify(data?.arguments ?? {});
|
|
615
637
|
toolLines.push(`[call] ${data?.name ?? "?"} ${argsRaw.slice(0, 500)}`);
|
|
616
|
-
} else if (event?.type === "tool/result")
|
|
617
|
-
const data = event.data;
|
|
618
|
-
const output = typeof data?.output === "string" ? data.output : "";
|
|
619
|
-
const failure = data?.error ? " [ERROR]" : "";
|
|
620
|
-
toolLines.push(`[result]${failure} ${output.slice(0, 500)}`);
|
|
621
|
-
}
|
|
638
|
+
} else if (event?.type === "tool/result") toolLines.push(renderToolResultLine(event.data));
|
|
622
639
|
}
|
|
623
640
|
toolLines.reverse();
|
|
624
641
|
return [
|
|
@@ -632,4 +649,4 @@ function buildReviewRequest(session, kind, signal, maxMessages, maxMessageChars)
|
|
|
632
649
|
].join("\n");
|
|
633
650
|
}
|
|
634
651
|
//#endregion
|
|
635
|
-
export { Config, REVIEW_OUTPUT_SCHEMA, apply, clampReviewConfig, filterUnreadSkillOps, inject, name, shouldCompletionReview, sweepDeadSessionEntries };
|
|
652
|
+
export { Config, REVIEW_OUTPUT_SCHEMA, apply, clampReviewConfig, filterUnreadSkillOps, inject, name, renderToolResultLine, shouldCompletionReview, sweepDeadSessionEntries };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -38,6 +38,12 @@ export interface Config {
|
|
|
38
38
|
* differs). Default true; false degrades to the non-waking inject (the
|
|
39
39
|
* summary then waits for the next driver wake). */
|
|
40
40
|
reviewWakeInject?: boolean;
|
|
41
|
+
/** V10-11 (P2-7): skill tree root for the review's direct skill writes.
|
|
42
|
+
* Empty (the default) resolves through `resolveSkillsRoot` to the shared
|
|
43
|
+
* default root — the historical behavior. A custom root keeps review-created
|
|
44
|
+
* skills in the SAME tree the catalog/tools read instead of writing a
|
|
45
|
+
* parallel tree the rest of the family cannot see. */
|
|
46
|
+
skillsRoot?: string;
|
|
41
47
|
}
|
|
42
48
|
export declare const Config: z<Config>;
|
|
43
49
|
/** V8-01 (0.3.45): the review subagent's structured-output contract. The
|
|
@@ -101,4 +107,18 @@ export declare function filterUnreadSkillOps(ops: Array<{
|
|
|
101
107
|
action?: string;
|
|
102
108
|
name?: string;
|
|
103
109
|
}>, readNames: ReadonlySet<string>): number;
|
|
110
|
+
/**
|
|
111
|
+
* V10-10 (P2-11): render one `[result]` evidence line from a 'tool/result'
|
|
112
|
+
* event payload. The former read (`data.output`) targeted a field that does
|
|
113
|
+
* not exist on the upstream rc.2 payload, so EVERY result line rendered an
|
|
114
|
+
* empty payload and the review subagent never saw tool output — the evidence
|
|
115
|
+
* chain silently starved while still spending its line budget. The payload
|
|
116
|
+
* text now comes from `data.message.content` tool-result blocks (inner text
|
|
117
|
+
* blocks joined, mirroring the user/assistant rendering above). A failure is
|
|
118
|
+
* marked by the payload-level `error` OR a block-level `isError`. The legacy
|
|
119
|
+
* pre-rc.2 shape (no `message`) is tolerated as an empty payload — it never
|
|
120
|
+
* throws. Budget: 500 chars per line (the 12-line cap lives in
|
|
121
|
+
* buildReviewRequest and is unchanged).
|
|
122
|
+
*/
|
|
123
|
+
export declare function renderToolResultLine(data: unknown): string;
|
|
104
124
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.53",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/lmzhen/dsh-evolution.git",
|
|
11
|
-
"directory": "packages/
|
|
11
|
+
"directory": "packages/evolution-review"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "lib/index.js",
|
|
@@ -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.53",
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.3.53",
|
|
36
|
+
"@lmzhen/dsh-evolution-plan-validator": "^0.3.53"
|
|
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.53",
|
|
46
|
+
"@lmzhen/dsh-evolution-policy": "^0.3.53"
|
|
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.53",
|
|
58
|
+
"@lmzhen/dsh-evolution-core": "^0.3.53",
|
|
59
|
+
"@lmzhen/dsh-evolution-plan-validator": "^0.3.53",
|
|
60
|
+
"@lmzhen/dsh-evolution-state": "^0.3.53"
|
|
61
61
|
}
|
|
62
62
|
}
|