@lmzhen/dsh-evolution-maintenance 0.22.0 → 0.24.0

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 -14
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as snapshotFromLibrary, i as enrichmentSnapshotOptions, n as computeProbe, r as buildEnrichment, t as PROBE_SIGNALS } from "./probe-Bojb0piw.js";
2
- import { AUTHORING_DESCRIPTION_BAR, DEFAULT_CURATOR_MODEL, DEFAULT_HEALTH_THRESHOLDS, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, LOW_QUALITY_THRESHOLD, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_TIMER_DELAY_MS, MIN_STAMP_BODY_CHARS, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, computeDriftSignals, findDriftSignal, redactSecrets, verifyPromptBundle } from "@lmzhen/dsh-evolution-core";
2
+ import { AUTHORING_DESCRIPTION_BAR, DEFAULT_CURATOR_MODEL, DEFAULT_HEALTH_THRESHOLDS, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, LOW_QUALITY_THRESHOLD, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_TIMER_DELAY_MS, MIN_STAMP_BODY_CHARS, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, computeDriftSignals, findDriftSignal, isRecord, redactSecrets, verifyPromptBundle } from "@lmzhen/dsh-evolution-core";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  //#region lib/types/render-facts.js
5
5
  /**
@@ -83,9 +83,6 @@ const IMPACTS = new Set([
83
83
  "worse",
84
84
  "neutral"
85
85
  ]);
86
- function isRecord(value) {
87
- return typeof value === "object" && value !== null && !Array.isArray(value);
88
- }
89
86
  function str(value, fallback) {
90
87
  return isNonEmptyString(value) ? value : fallback;
91
88
  }
@@ -375,7 +372,7 @@ function formatPlan(validated, runId) {
375
372
  lines.push(`Maintenance scan ${runId}: verdict=${plan.verdict} (${plan.plan.length} recommendations, ${plan.notes.length} notes)`);
376
373
  const noteLines = plan.notes.length === 0 ? [] : ["Notes:", ...plan.notes.map((note) => `- ${sanitizeField(note)}`)];
377
374
  if (plan.verdict === "no_issues") {
378
- lines.push("No drift issues detected. Nothing to do.");
375
+ lines.push("未检测到漂移问题,无需处理。");
379
376
  lines.push(...noteLines);
380
377
  return lines.join("\n");
381
378
  }
@@ -403,7 +400,7 @@ async function runMaintain(runtime, options = {}) {
403
400
  if (!verifyPromptBundle(PROMPT_BUNDLE)) return {
404
401
  ok: false,
405
402
  recommendationCount: 0,
406
- error: "dsh-evolution prompt bundle integrity check failed; refusing to run maintain"
403
+ error: "dsh-evolution 提示词包完整性检查失败;拒绝运行 maintain"
407
404
  };
408
405
  const enrichment = options.enrichment?.();
409
406
  const readFailures = [];
@@ -418,19 +415,19 @@ async function runMaintain(runtime, options = {}) {
418
415
  if (readFailures.length > 0) return {
419
416
  ok: false,
420
417
  recommendationCount: 0,
421
- error: `maintenance scan could not read ${readFailures.length} listed skill(s) (${readFailures.slice(0, 10).join(", ")}${readFailures.length > 10 ? ", …" : ""}) and read no skill at all — the library was NOT audited; fix the unreadable skills (or their directory names) and run the scan again`
418
+ error: `维护扫描无法读取列出的 ${readFailures.length} 个技能(${readFailures.slice(0, 10).join(", ")}${readFailures.length > 10 ? ", …" : ""}),且一个技能都没读到 —— the library was NOT audited; fix the unreadable skills (or their directory names) and run the scan again`
422
419
  };
423
420
  if (runtime.rootExists && !await runtime.rootExists()) return {
424
421
  ok: false,
425
422
  recommendationCount: 0,
426
- error: `maintenance scan found an empty skill library, but the configured skill root does not exist${runtime.skillRoot ? ` (${runtime.skillRoot})` : ""} — point the skillsRoot config at a real directory (a literal \`~\` is not expanded) and run the scan again`
423
+ error: `维护扫描发现技能库为空,但配置的技能根目录不存在${runtime.skillRoot ? ` (${runtime.skillRoot})` : ""} —— point the skillsRoot config at a real directory (a literal \`~\` is not expanded) and run the scan again`
427
424
  };
428
425
  return {
429
426
  ok: true,
430
427
  recommendationCount: 0,
431
428
  runId: options.runId ?? randomUUID(),
432
429
  verdict: "no_issues",
433
- text: "Maintenance scan: empty skill library. Nothing to do."
430
+ text: "维护扫描:技能库为空,无需处理。"
434
431
  };
435
432
  }
436
433
  const { facts, report, signalsVersion, signature } = buildMaintainFacts(snapshots, enrichment?.usageObservedValue, options.redact);
@@ -445,7 +442,7 @@ ${MAINTAIN_OUTPUT_INSTRUCTION}`;
445
442
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_TIMER_DELAY_MS) return {
446
443
  ok: false,
447
444
  recommendationCount: 0,
448
- error: `maintain: --timeout must be a positive integer in ms, at most ${MAX_TIMER_DELAY_MS}; got ${String(timeoutMs)}`
445
+ error: `maintain:--timeout 必须是以毫秒为单位的正整数,最大 ${MAX_TIMER_DELAY_MS};收到 ${String(timeoutMs)}`
449
446
  };
450
447
  const signal = options.signal !== void 0 ? AbortSignal.any([AbortSignal.timeout(timeoutMs), options.signal]) : AbortSignal.timeout(timeoutMs);
451
448
  abortSignal = signal;
@@ -540,19 +537,19 @@ ${MAINTAIN_OUTPUT_INSTRUCTION}`;
540
537
  if (runResult.stopReason === "aborted") return {
541
538
  ok: false,
542
539
  recommendationCount: 0,
543
- error: "Maintenance scan was aborted (the run was cancelled before the subagent produced a plan) — retry when the session is idle; concurrent re-submission cancels the previous scan."
540
+ error: "维护扫描已中止(在子智能体产出计划之前运行被取消):请在会话空闲时重试;并发重交会取消上一次扫描。"
544
541
  };
545
542
  return {
546
543
  ok: false,
547
544
  recommendationCount: 0,
548
- error: "Maintain subagent returned no structured plan (the model did not emit the structured plan, or the run ended without one) — retry; if it repeats, raise --timeout or check the model output shape."
545
+ error: "维护子智能体没有返回结构化计划(模型没有产出结构化计划,或运行在产出前结束):请重试;若反复出现,请提高 --timeout 或检查模型的输出结构。"
549
546
  };
550
547
  }
551
548
  const validated = validateAndNormalizeMaintainPlan(raw, report, existingSignalIds(report));
552
549
  if (!validated.ok) return {
553
550
  ok: false,
554
551
  recommendationCount: 0,
555
- error: `Maintain plan rejected by validator: ${validated.errors.slice(0, 5).join("; ")}`
552
+ error: `维护计划被校验器拒绝:${validated.errors.slice(0, 5).join("; ")}`
556
553
  };
557
554
  const runId = options.runId ?? randomUUID();
558
555
  return {
@@ -579,7 +576,7 @@ ${MAINTAIN_OUTPUT_INSTRUCTION}`;
579
576
  return {
580
577
  ok: false,
581
578
  recommendationCount: 0,
582
- 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}`
579
+ error: abortSignal?.aborted === true || name === "AbortError" || message === "This operation was aborted" ? "维护扫描已中止(取消或超时),计划尚未产出 —— 在技能多、库大的场景下,请重试或提高超时(evolution-commands maintainTimeoutMs)。" : `Maintenance scan failed: ${message}`
583
580
  };
584
581
  }
585
582
  }
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.22.0",
4
+ "version": "0.24.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,7 +31,7 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.4",
34
- "@lmzhen/dsh-evolution-core": "^0.22.0"
34
+ "@lmzhen/dsh-evolution-core": "^0.24.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/dsh-agent": "^0.2.0-rc.1",