@lmzhen/dsh-evolution-commands 0.3.15 → 0.3.17
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 +22 -20
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -36,8 +36,9 @@ function apply(ctx, rawConfig = {}) {
|
|
|
36
36
|
});
|
|
37
37
|
const approval = ctx.get("evolutionApproval");
|
|
38
38
|
if (input === "pending") {
|
|
39
|
-
const pending = approval ? await approval.list("pending") : [];
|
|
40
|
-
|
|
39
|
+
const pending = approval ? [...await approval.list("pending"), ...await approval.list("executing")] : [];
|
|
40
|
+
if (pending.length === 0) return ok("No pending evolution writes.");
|
|
41
|
+
return ok(pending.map((p) => `${p.id} ${p.kind} ${p.status === "executing" ? "EXECUTING " : ""}${p.summary}`).join("\n") + (pending.some((p) => p.status === "executing") ? "\n(EXECUTING: a previous approve may have crashed after running; verify the write manually, then reject — approve will not re-run it)" : ""));
|
|
41
42
|
}
|
|
42
43
|
if (input.startsWith("approve ")) {
|
|
43
44
|
const id = input.slice(8).trim();
|
|
@@ -205,12 +206,11 @@ function apply(ctx, rawConfig = {}) {
|
|
|
205
206
|
const subagents = ctx.get("subagents");
|
|
206
207
|
if (!ioRegistry) return err("Evolution IO registry not mounted — maintenance scan unavailable.");
|
|
207
208
|
if (!subagents) return err("Subagents service not mounted — maintenance scan unavailable.");
|
|
208
|
-
maintainInFlightSince = Date.now();
|
|
209
|
-
const library = new SkillLibrary(config.skillsRoot, ioRegistry.provider());
|
|
210
|
-
const enrichment = await buildEnrichment(ctx, library);
|
|
211
|
-
let outcome;
|
|
212
209
|
try {
|
|
213
|
-
|
|
210
|
+
maintainInFlightSince = Date.now();
|
|
211
|
+
const library = new SkillLibrary(config.skillsRoot, ioRegistry.provider());
|
|
212
|
+
const enrichment = await buildEnrichment(ctx, library);
|
|
213
|
+
const outcome = await runMaintain({
|
|
214
214
|
library,
|
|
215
215
|
subagents,
|
|
216
216
|
parent: invocation.agent
|
|
@@ -223,22 +223,24 @@ function apply(ctx, rawConfig = {}) {
|
|
|
223
223
|
catalogInvalid: () => enrichment.catalogInvalid,
|
|
224
224
|
usageObserved: () => enrichment.usageObservedValue
|
|
225
225
|
});
|
|
226
|
+
lastMaintainRunId = outcome.runId ?? "";
|
|
227
|
+
if (!outcome.ok) return err(outcome.error ?? "Maintenance scan failed.");
|
|
228
|
+
appendEvolutionEvent(ioRegistry.provider(), eventsFile(process.env.DSH_HOME ?? join(homedir(), ".dsh")), {
|
|
229
|
+
type: "maintain",
|
|
230
|
+
source: "manual",
|
|
231
|
+
runId: outcome.runId,
|
|
232
|
+
verdict: outcome.verdict,
|
|
233
|
+
recommendations: outcome.text?.split("\n").filter((line) => line.startsWith("- [")).length ?? 0
|
|
234
|
+
}).catch((error) => {
|
|
235
|
+
ctx.logger.warn(`evolution-commands: failed to record maintain event: ${String(error)}`);
|
|
236
|
+
});
|
|
237
|
+
return ok(`Maintenance scan ${outcome.runId}:\n${outcome.text ?? ""}`);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
return err(`Maintenance scan failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
226
240
|
} finally {
|
|
227
241
|
maintainInFlightSince = 0;
|
|
242
|
+
lastMaintainAt = Date.now();
|
|
228
243
|
}
|
|
229
|
-
lastMaintainAt = Date.now();
|
|
230
|
-
lastMaintainRunId = outcome.runId ?? "";
|
|
231
|
-
if (!outcome.ok) return err(outcome.error ?? "Maintenance scan failed.");
|
|
232
|
-
appendEvolutionEvent(ioRegistry.provider(), eventsFile(process.env.DSH_HOME ?? join(homedir(), ".dsh")), {
|
|
233
|
-
type: "maintain",
|
|
234
|
-
source: "manual",
|
|
235
|
-
runId: outcome.runId,
|
|
236
|
-
verdict: outcome.verdict,
|
|
237
|
-
recommendations: outcome.text?.split("\n").filter((line) => line.startsWith("- [")).length ?? 0
|
|
238
|
-
}).catch((error) => {
|
|
239
|
-
ctx.logger.warn(`evolution-commands: failed to record maintain event: ${String(error)}`);
|
|
240
|
-
});
|
|
241
|
-
return ok(`Maintenance scan ${outcome.runId}:\n${outcome.text ?? ""}`);
|
|
242
244
|
}
|
|
243
245
|
if (/^maintain\b/.test(input)) return err("Unknown maintain arguments: expected bare `maintain` or `maintain --timeout <ms>` (a positive integer). Got: " + input);
|
|
244
246
|
if (input === "preset install") {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-commands",
|
|
3
3
|
"description": "Human commands for the evolution family (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.17",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
36
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
37
|
-
"@lmzhen/dsh-evolution-maintenance": "^0.3.
|
|
36
|
+
"@lmzhen/dsh-evolution-core": "^0.3.17",
|
|
37
|
+
"@lmzhen/dsh-evolution-maintenance": "^0.3.17"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@deepseek-ai/cordis": "^4.0.1",
|