@lmzhen/dsh-evolution-commands 0.3.9 → 0.3.11

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
@@ -14,6 +14,7 @@ function apply(ctx, rawConfig = {}) {
14
14
  const config = rawConfig;
15
15
  let lastMaintainAt = 0;
16
16
  let lastMaintainRunId = "";
17
+ let maintainInFlightSince = 0;
17
18
  ctx.inject(["commands"], (commandCtx) => {
18
19
  commandCtx.commands.register({
19
20
  name: "evolution",
@@ -183,14 +184,17 @@ function apply(ctx, rawConfig = {}) {
183
184
  const { facts } = buildMaintainFacts(await snapshotFromLibrary(library, {
184
185
  descriptions: enrichment.descriptions,
185
186
  supportFiles: enrichment.supportFiles,
186
- quality: enrichment.quality
187
+ quality: enrichment.quality,
188
+ protected: enrichment.protected,
189
+ catalogInvalid: enrichment.catalogInvalid
187
190
  }), enrichment.usageObservedValue, void 0);
188
191
  return ok(`Maintenance facts (0-token preview):\n${facts}`);
189
192
  }
190
193
  const maintainArgs = /^maintain(?: --timeout (\d+))?\s*$/.exec(input);
191
194
  if (maintainArgs) {
192
- const runTimeoutMs = maintainArgs[1] ? Number(maintainArgs[1]) : config.maintainTimeoutMs ?? 12e4;
195
+ const runTimeoutMs = maintainArgs[1] ? Number(maintainArgs[1]) : config.maintainTimeoutMs ?? 6e5;
193
196
  if (!Number.isSafeInteger(runTimeoutMs) || runTimeoutMs <= 0) return err("Invalid --timeout value: expected a positive integer number of milliseconds (e.g. /evolution maintain --timeout 600000).");
197
+ if (maintainInFlightSince > 0) return ok(`Maintenance scan is already running (since ~${Math.max(1, Math.round((Date.now() - maintainInFlightSince) / 1e3))}s ago) — re-submitting now would cancel it. Wait for it to settle; the result appears when it finishes.`);
194
198
  const cooldownMs = config.maintainCooldownMs ?? 3e4;
195
199
  const sinceLast = Date.now() - lastMaintainAt;
196
200
  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.`);
@@ -200,17 +204,25 @@ function apply(ctx, rawConfig = {}) {
200
204
  if (!subagents) return err("Subagents service not mounted — maintenance scan unavailable.");
201
205
  const library = new SkillLibrary(config.skillsRoot, ioRegistry.provider());
202
206
  const enrichment = await buildEnrichment(ctx, library);
203
- const outcome = await runMaintain({
204
- library,
205
- subagents,
206
- parent: invocation.agent
207
- }, {
208
- timeoutMs: runTimeoutMs,
209
- descriptions: () => enrichment.descriptions,
210
- supportFiles: () => enrichment.supportFiles,
211
- quality: () => enrichment.quality,
212
- usageObserved: () => enrichment.usageObservedValue
213
- });
207
+ maintainInFlightSince = Date.now();
208
+ let outcome;
209
+ try {
210
+ outcome = await runMaintain({
211
+ library,
212
+ subagents,
213
+ parent: invocation.agent
214
+ }, {
215
+ timeoutMs: runTimeoutMs,
216
+ descriptions: () => enrichment.descriptions,
217
+ supportFiles: () => enrichment.supportFiles,
218
+ quality: () => enrichment.quality,
219
+ protected: () => enrichment.protected,
220
+ catalogInvalid: () => enrichment.catalogInvalid,
221
+ usageObserved: () => enrichment.usageObservedValue
222
+ });
223
+ } finally {
224
+ maintainInFlightSince = 0;
225
+ }
214
226
  lastMaintainAt = Date.now();
215
227
  lastMaintainRunId = outcome.runId ?? "";
216
228
  if (!outcome.ok) return err(outcome.error ?? "Maintenance scan failed.");
@@ -15,8 +15,10 @@ export interface Config {
15
15
  * in-flight runs, so the old 130s ">= timeout" rationale was a comment bug.
16
16
  * Transient (per-process). */
17
17
  maintainCooldownMs?: number | undefined;
18
- /** Subagent deadline for one maintenance scan (ms). Default 120s; raise on
19
- * slow providers or very large skill libraries (0.3.3). */
18
+ /** Subagent deadline for one maintenance scan (ms). Default 600s (0.3.10):
19
+ * the real library's full audit (bodies + support files + judgment) needs
20
+ * 4-8 min — the 13:38 successful run used --timeout 600000; the old 120s
21
+ * default deadlined bare runs mid-analysis (14:37 run aborted at 119.94s). */
20
22
  maintainTimeoutMs?: number | undefined;
21
23
  }
22
24
  export declare function apply(ctx: Context, rawConfig?: Config): void;
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.9",
4
+ "version": "0.3.11",
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.9",
37
- "@lmzhen/dsh-evolution-maintenance": "^0.3.9"
36
+ "@lmzhen/dsh-evolution-core": "^0.3.11",
37
+ "@lmzhen/dsh-evolution-maintenance": "^0.3.11"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@deepseek-ai/cordis": "^4.0.1",