@lmzhen/dsh-evolution-maintenance 0.3.12 → 0.3.14

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 +11 -2
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -109,6 +109,8 @@ function validateEvidence(value, validSignals, errors, path) {
109
109
  function validateAndNormalizeMaintainPlan(raw, report, validSignals) {
110
110
  const errors = [];
111
111
  const forcedHuman = [];
112
+ const protectedNames = /* @__PURE__ */ new Set();
113
+ for (const skill of report.skills) if (skill.protected) protectedNames.add(skill.name);
112
114
  if (!isRecord(raw)) return {
113
115
  ok: false,
114
116
  errors: ["plan root: must be an object"],
@@ -135,6 +137,10 @@ function validateAndNormalizeMaintainPlan(raw, report, validSignals) {
135
137
  }
136
138
  if (typeof item.kind !== "string" || !KINDS.has(item.kind)) errors.push(`${path}.kind: invalid`);
137
139
  if (!Array.isArray(item.names) || item.names.length === 0 || !item.names.every(isNonEmptyString)) errors.push(`${path}.names: non-empty string array required`);
140
+ else if (item.names.some((nm) => protectedNames.has(nm))) {
141
+ const hit = item.names.find((nm) => protectedNames.has(nm));
142
+ errors.push(`${path}.names: references protected skill "${String(hit)}" — §7 forbids recommendations for bundled/hub-installed/pinned skills`);
143
+ }
138
144
  if (!isNonEmptyString(item.rule)) errors.push(`${path}.rule: required`);
139
145
  if (typeof item.finding !== "string" || item.finding.trim().length === 0) errors.push(`${path}.finding: required`);
140
146
  if (!isNonEmptyString(item.recommendation)) errors.push(`${path}.recommendation: required`);
@@ -309,6 +315,7 @@ function formatPlan(validated, runId) {
309
315
  }
310
316
  /** Run one maintenance scan and return display text plus validation metadata. */
311
317
  async function runMaintain(runtime, options = {}) {
318
+ let abortSignal;
312
319
  try {
313
320
  if (!verifyPromptBundle(PROMPT_BUNDLE)) return {
314
321
  ok: false,
@@ -333,6 +340,8 @@ async function runMaintain(runtime, options = {}) {
333
340
 
334
341
  按模板契约输出 JSON 维护计划(verdict/plan/notes);除 skill 工具与维护模板外你无其他工具。`;
335
342
  const timeoutMs = options.timeoutMs ?? 6e5;
343
+ const signal = AbortSignal.timeout(timeoutMs);
344
+ abortSignal = signal;
336
345
  const agentOptions = { model: options.model ?? "deepseek-v4-pro" };
337
346
  if (options.provider) agentOptions.provider = options.provider;
338
347
  const runResult = await (await runtime.subagents.start("spawn", {
@@ -342,7 +351,7 @@ async function runMaintain(runtime, options = {}) {
342
351
  text: prompt
343
352
  }],
344
353
  parent: runtime.parent,
345
- signal: AbortSignal.timeout(timeoutMs),
354
+ signal,
346
355
  maxDepth: options.maxDepth ?? 1,
347
356
  agentOptions,
348
357
  persona: template,
@@ -425,7 +434,7 @@ async function runMaintain(runtime, options = {}) {
425
434
  const message = error instanceof Error ? error.message : String(error);
426
435
  return {
427
436
  ok: false,
428
- error: name === "AbortError" || /abort/i.test(`${String(name)} ${message}`) ? "Maintenance scan was aborted (cancellation or timeout) before a plan was produced — retry, or raise the timeout (evolution-commands maintainTimeoutMs) on a slow/large library." : `Maintenance scan failed: ${message}`
437
+ error: abortSignal?.aborted === true || name === "AbortError" || message === "This operation was aborted" ? "Maintenance scan was aborted (cancellation or timeout) before a plan was produced — retry, or raise the timeout (evolution-commands maintainTimeoutMs) on a slow/large library." : `Maintenance scan failed: ${message}`
429
438
  };
430
439
  }
431
440
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-maintenance",
3
3
  "description": "Deterministic maintenance-scan surface: skill-library snapshot assembly, drift signals and mechanical-facts rendering (design 011) (community build)",
4
- "version": "0.3.12",
4
+ "version": "0.3.14",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
- "@lmzhen/dsh-evolution-core": "^0.3.12"
37
+ "@lmzhen/dsh-evolution-core": "^0.3.14"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",