@lmzhen/dsh-evolution-commands 0.3.15 → 0.3.16

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.
Files changed (2) hide show
  1. package/lib/index.js +19 -18
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -205,12 +205,11 @@ function apply(ctx, rawConfig = {}) {
205
205
  const subagents = ctx.get("subagents");
206
206
  if (!ioRegistry) return err("Evolution IO registry not mounted — maintenance scan unavailable.");
207
207
  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
208
  try {
213
- outcome = await runMaintain({
209
+ maintainInFlightSince = Date.now();
210
+ const library = new SkillLibrary(config.skillsRoot, ioRegistry.provider());
211
+ const enrichment = await buildEnrichment(ctx, library);
212
+ const outcome = await runMaintain({
214
213
  library,
215
214
  subagents,
216
215
  parent: invocation.agent
@@ -223,22 +222,24 @@ function apply(ctx, rawConfig = {}) {
223
222
  catalogInvalid: () => enrichment.catalogInvalid,
224
223
  usageObserved: () => enrichment.usageObservedValue
225
224
  });
225
+ lastMaintainRunId = outcome.runId ?? "";
226
+ if (!outcome.ok) return err(outcome.error ?? "Maintenance scan failed.");
227
+ appendEvolutionEvent(ioRegistry.provider(), eventsFile(process.env.DSH_HOME ?? join(homedir(), ".dsh")), {
228
+ type: "maintain",
229
+ source: "manual",
230
+ runId: outcome.runId,
231
+ verdict: outcome.verdict,
232
+ recommendations: outcome.text?.split("\n").filter((line) => line.startsWith("- [")).length ?? 0
233
+ }).catch((error) => {
234
+ ctx.logger.warn(`evolution-commands: failed to record maintain event: ${String(error)}`);
235
+ });
236
+ return ok(`Maintenance scan ${outcome.runId}:\n${outcome.text ?? ""}`);
237
+ } catch (error) {
238
+ return err(`Maintenance scan failed: ${error instanceof Error ? error.message : String(error)}`);
226
239
  } finally {
227
240
  maintainInFlightSince = 0;
241
+ lastMaintainAt = Date.now();
228
242
  }
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
243
  }
243
244
  if (/^maintain\b/.test(input)) return err("Unknown maintain arguments: expected bare `maintain` or `maintain --timeout <ms>` (a positive integer). Got: " + input);
244
245
  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.15",
4
+ "version": "0.3.16",
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.15",
37
- "@lmzhen/dsh-evolution-maintenance": "^0.3.15"
36
+ "@lmzhen/dsh-evolution-core": "^0.3.16",
37
+ "@lmzhen/dsh-evolution-maintenance": "^0.3.16"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@deepseek-ai/cordis": "^4.0.1",