@lmzhen/dsh-evolution-review 0.3.30 → 0.3.32
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 +43 -18
- package/package.json +10 -10
package/lib/index.js
CHANGED
|
@@ -207,7 +207,11 @@ function apply(ctx, rawConfig) {
|
|
|
207
207
|
try {
|
|
208
208
|
const result = await run.result;
|
|
209
209
|
if (!result.structured) {
|
|
210
|
-
|
|
210
|
+
try {
|
|
211
|
+
ctx.emit("evolution/review-error", { sessionId: session.id });
|
|
212
|
+
} catch (emitError) {
|
|
213
|
+
ctx.logger.warn(`dsh-evolution-review: review-error emit failed: ${emitError instanceof Error ? emitError.message : String(emitError)}`);
|
|
214
|
+
}
|
|
211
215
|
ctx.logger.warn("dsh-evolution-review: review subagent returned no structured plan");
|
|
212
216
|
return false;
|
|
213
217
|
}
|
|
@@ -247,16 +251,23 @@ function apply(ctx, rawConfig) {
|
|
|
247
251
|
ctx.logger.warn(`dsh-evolution-review: result notice inject failed: ${injectError instanceof Error ? injectError.message : String(injectError)}`);
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
try {
|
|
255
|
+
ctx.emit("evolution/plan-applied", {
|
|
256
|
+
sessionId: session.id,
|
|
257
|
+
planId: randomUUID(),
|
|
258
|
+
policyFingerprint,
|
|
259
|
+
memoryApplied: actions.filter((action) => action.startsWith("Memory")).length,
|
|
260
|
+
skillApplied: actions.filter((action) => action.startsWith("Skill ")).length,
|
|
261
|
+
rejectedOps: validation.rejected.length + skippedUnread,
|
|
262
|
+
executionFailures: executed.failedOps.length,
|
|
263
|
+
...executed.aborted !== void 0 ? { executionError: executed.aborted } : {},
|
|
264
|
+
...executed.failedOps[0] !== void 0 && executed.aborted === void 0 ? { executionError: executed.failedOps[0] } : {},
|
|
265
|
+
evidenceQuotes,
|
|
266
|
+
estimatedInputChars: reviewText.length
|
|
267
|
+
});
|
|
268
|
+
} catch (emitError) {
|
|
269
|
+
ctx.logger.warn(`dsh-evolution-review: plan-applied emit failed: ${emitError instanceof Error ? emitError.message : String(emitError)}`);
|
|
270
|
+
}
|
|
260
271
|
return true;
|
|
261
272
|
} finally {
|
|
262
273
|
try {
|
|
@@ -277,6 +288,7 @@ function apply(ctx, rawConfig) {
|
|
|
277
288
|
const approval = ctx.get("evolutionApproval");
|
|
278
289
|
const origins = resolveOrigins(void 0, true);
|
|
279
290
|
const actions = [];
|
|
291
|
+
const failedOps = [];
|
|
280
292
|
let ok = true;
|
|
281
293
|
try {
|
|
282
294
|
for (const op of plan.memoryOps ?? []) {
|
|
@@ -287,8 +299,12 @@ function apply(ctx, rawConfig) {
|
|
|
287
299
|
facts: op.facts ?? op.content,
|
|
288
300
|
old_text: op.old_text
|
|
289
301
|
};
|
|
290
|
-
|
|
291
|
-
|
|
302
|
+
const result = approval ? await runApproved("memory", `memory ${normalized.target} ${normalized.action}`, normalized, normalized) : await memory?.applyBatch(normalized.target, [normalized]);
|
|
303
|
+
if (result?.ok) actions.push("Memory updated");
|
|
304
|
+
else {
|
|
305
|
+
ok = false;
|
|
306
|
+
failedOps.push(`memory ${normalized.action} ${normalized.target}: ${result?.message ?? "service unavailable"}`);
|
|
307
|
+
}
|
|
292
308
|
}
|
|
293
309
|
for (const op of plan.skillOps ?? []) {
|
|
294
310
|
if (!Array.isArray(op.evidence) || op.evidence.length === 0 || !op.name) continue;
|
|
@@ -300,18 +316,27 @@ function apply(ctx, rawConfig) {
|
|
|
300
316
|
operation: args,
|
|
301
317
|
origin: origins.library
|
|
302
318
|
};
|
|
303
|
-
|
|
304
|
-
|
|
319
|
+
const result = approval ? await runApproved("skill", `skill ${op.action ?? "patch"} ${op.name}`, runnerArgs, runnerArgs) : await executeSkillDirect(args);
|
|
320
|
+
if (result?.ok) actions.push(`Skill ${op.name} ${op.action ?? "patch"}`);
|
|
321
|
+
else {
|
|
322
|
+
ok = false;
|
|
323
|
+
failedOps.push(`skill ${op.action ?? "patch"} ${op.name}: ${result?.message ?? "service unavailable"}`);
|
|
324
|
+
}
|
|
305
325
|
}
|
|
326
|
+
if (failedOps.length > 0) ctx.logger.warn(`dsh-evolution-review: executePlan ${actions.length === 0 ? "no op landed" : `${actions.length} op(s) landed, ${failedOps.length} failed`}: ${failedOps.join("; ")}`);
|
|
306
327
|
return {
|
|
307
328
|
actions,
|
|
308
|
-
ok
|
|
329
|
+
ok,
|
|
330
|
+
failedOps
|
|
309
331
|
};
|
|
310
332
|
} catch (error) {
|
|
311
|
-
|
|
333
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
334
|
+
ctx.logger.warn(`dsh-evolution-review: executePlan aborted mid-way after ${actions.length} ops landed: ${reason}`);
|
|
312
335
|
return {
|
|
313
336
|
actions,
|
|
314
|
-
ok: false
|
|
337
|
+
ok: false,
|
|
338
|
+
failedOps,
|
|
339
|
+
aborted: reason
|
|
315
340
|
};
|
|
316
341
|
}
|
|
317
342
|
async function runApproved(kind, summary, stored, runnerArgs) {
|
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.32",
|
|
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.32",
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.3.32",
|
|
36
|
+
"@lmzhen/dsh-evolution-plan-validator": "^0.3.32"
|
|
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.32",
|
|
46
|
+
"@lmzhen/dsh-evolution-policy": "^0.3.32"
|
|
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.32",
|
|
58
|
+
"@lmzhen/dsh-evolution-core": "^0.3.32",
|
|
59
|
+
"@lmzhen/dsh-evolution-plan-validator": "^0.3.32",
|
|
60
|
+
"@lmzhen/dsh-evolution-state": "^0.3.32"
|
|
61
61
|
}
|
|
62
62
|
}
|