@lmzhen/dsh-evolution-commands 0.3.3 → 0.3.5

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 CHANGED
@@ -42,7 +42,7 @@ function apply(ctx, rawConfig = {}) {
42
42
  name: "evolution",
43
43
  description: "Self-evolution status and approval controls",
44
44
  recordInput: false,
45
- input: { hint: "pending | approve <id> | reject <id> | curator run|pause|resume|status|report|scope | restore | consolidate <target> <sources...> | skill restore <name> | skills health | learn [request] | maintain | restructure <name> \"<heading>\" <to_file> | replay" },
45
+ input: { hint: "pending | approve <id> | reject <id> | curator run|pause|resume|status|report|scope | restore | consolidate <target> <sources...> | skill restore <name> | skills health | learn [request] | maintain [--timeout ms] | restructure <name> \"<heading>\" <to_file> | replay" },
46
46
  async handler(invocation) {
47
47
  const input = invocation.rawInput?.trim() ?? "";
48
48
  const ok = (text) => ({
@@ -210,8 +210,11 @@ function apply(ctx, rawConfig = {}) {
210
210
  }), enrichment.usageObservedValue, void 0);
211
211
  return ok(`Maintenance facts (0-token preview):\n${facts}`);
212
212
  }
213
- if (input === "maintain") {
214
- const cooldownMs = config.maintainCooldownMs ?? 13e4;
213
+ const maintainArgs = /^maintain(?: --timeout (\d+))?\s*$/.exec(input);
214
+ if (maintainArgs) {
215
+ const runTimeoutMs = maintainArgs[1] ? Number(maintainArgs[1]) : config.maintainTimeoutMs ?? 12e4;
216
+ if (!Number.isSafeInteger(runTimeoutMs) || runTimeoutMs <= 0) return err("Invalid --timeout value: expected a positive integer number of milliseconds (e.g. /evolution maintain --timeout 600000).");
217
+ const cooldownMs = config.maintainCooldownMs ?? 3e4;
215
218
  const sinceLast = Date.now() - lastMaintainAt;
216
219
  if (cooldownMs > 0 && sinceLast < cooldownMs) return ok(`Maintenance cooldown active (${Math.ceil((cooldownMs - sinceLast) / 1e3)}s) — latest scan ${lastMaintainRunId}; re-running now would spend another model call.`);
217
220
  const ioRegistry = ctx.get("evolutionIo");
@@ -225,7 +228,7 @@ function apply(ctx, rawConfig = {}) {
225
228
  subagents,
226
229
  parent: invocation.agent
227
230
  }, {
228
- timeoutMs: config.maintainTimeoutMs ?? 12e4,
231
+ timeoutMs: runTimeoutMs,
229
232
  descriptions: () => enrichment.descriptions,
230
233
  supportFiles: () => enrichment.supportFiles,
231
234
  quality: () => enrichment.quality,
@@ -10,8 +10,10 @@ export interface Config {
10
10
  skillsRoot?: string | undefined;
11
11
  /** Cooldown window for scan commands (ms) — misclick/rapid-trigger guard;
12
12
  * secondary calls inside the window return the previous runId instead of
13
- * spending another model call. Default 130s (>= maintain timeout 120s, so
14
- * the window also covers in-flight runs); transient (per-process). */
13
+ * spending another model call. Default 30s (0.3.5). NOTE: the window starts
14
+ * AFTER a run settles (lastMaintainAt updates post-run) — it does NOT dedupe
15
+ * in-flight runs, so the old 130s ">= timeout" rationale was a comment bug.
16
+ * Transient (per-process). */
15
17
  maintainCooldownMs?: number | undefined;
16
18
  /** Subagent deadline for one maintenance scan (ms). Default 120s; raise on
17
19
  * slow providers or very large skill libraries (0.3.3). */
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.3",
4
+ "version": "0.3.5",
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.3",
37
- "@lmzhen/dsh-evolution-maintenance": "^0.3.3"
36
+ "@lmzhen/dsh-evolution-core": "^0.3.5",
37
+ "@lmzhen/dsh-evolution-maintenance": "^0.3.5"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@deepseek-ai/cordis": "^4.0.1",