@lmzhen/dsh-evolution-maintenance 0.3.62 → 0.3.64

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.
@@ -17,7 +17,13 @@ async function snapshotFromLibrary(library, options = {}) {
17
17
  const entries = await library.list();
18
18
  const snapshots = [];
19
19
  for (const entry of entries) {
20
- const body = await library.read(entry.name);
20
+ let body;
21
+ try {
22
+ body = await library.read(entry.name);
23
+ } catch (error) {
24
+ options.onReadError?.(entry.name, error);
25
+ continue;
26
+ }
21
27
  if (body === void 0 || body === null) continue;
22
28
  snapshots.push({
23
29
  name: entry.name,
@@ -130,7 +136,8 @@ async function buildEnrichment(ctx, library) {
130
136
  const protectedMap = /* @__PURE__ */ new Map();
131
137
  const catalogInvalid = /* @__PURE__ */ new Map();
132
138
  for (const entry of await library.list()) {
133
- if (entry.protectedBy) protectedMap.set(entry.name, entry.protectedBy);
139
+ if (entry.protectionUnknown) protectedMap.set(entry.name, "unknown");
140
+ else if (entry.protectedBy) protectedMap.set(entry.name, entry.protectedBy);
134
141
  const body = await library.read(entry.name);
135
142
  if (body === void 0 || body === null) continue;
136
143
  const parsed = parseFrontmatter(body);
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as snapshotFromLibrary, n as PROBE_SIGNALS, r as computeProbe, t as buildEnrichment } from "./enrichment-B7tEHkM5.js";
1
+ import { i as snapshotFromLibrary, n as PROBE_SIGNALS, r as computeProbe, t as buildEnrichment } from "./enrichment-CYpvRfH_.js";
2
2
  import { AUTHORING_DESCRIPTION_BAR, DEFAULT_HEALTH_THRESHOLDS, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, LOW_QUALITY_THRESHOLD, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MIN_STAMP_BODY_CHARS, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, computeDriftSignals, findDriftSignal, redactSecrets, verifyPromptBundle } from "@lmzhen/dsh-evolution-core";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  //#region lib/types/render-facts.js
@@ -27,14 +27,15 @@ function renderFacts(report, options) {
27
27
  }
28
28
  function renderSignal(signal, redact) {
29
29
  const prefix = signal.verdict === "unknown" ? "[UNKNOWN]" : "[FACT]";
30
- const value = redact(signal.value);
30
+ const sanitize = (text) => redact(text).replaceAll("<<<END FACTS>>>", "<<<END FACTS (escaped)>>>").replaceAll("\n", " ").replaceAll("\r", " ");
31
+ const value = sanitize(signal.value);
31
32
  const parts = [
32
33
  `${prefix} signal=${signal.id}`,
33
34
  `value=${value}`,
34
35
  `verdict=${signal.verdict}`
35
36
  ];
36
37
  if (signal.threshold !== void 0) parts.push(`threshold=${signal.threshold}`);
37
- if (signal.detail !== void 0) parts.push(`detail=${redact(signal.detail)}`);
38
+ if (signal.detail !== void 0) parts.push(`detail=${sanitize(signal.detail)}`);
38
39
  return [parts.join(" ")];
39
40
  }
40
41
  //#endregion
@@ -384,7 +385,10 @@ async function runMaintain(runtime, options = {}) {
384
385
  quality: options.quality ? options.quality() : void 0,
385
386
  protected: options.protected ? options.protected() : void 0,
386
387
  catalogInvalid: options.catalogInvalid ? options.catalogInvalid() : void 0,
387
- usageObserved
388
+ usageObserved,
389
+ onReadError: (name, error) => {
390
+ runtime.logger?.warn(`evolution-maintenance: skipping unreadable skill "${name}": ${error instanceof Error ? error.message : String(error)}`);
391
+ }
388
392
  });
389
393
  if (snapshots.length === 0) return {
390
394
  ok: true,
@@ -407,7 +411,7 @@ ${MAINTAIN_OUTPUT_INSTRUCTION}`;
407
411
  recommendationCount: 0,
408
412
  error: `maintain: --timeout must be a positive integer in ms, at most 4294967295; got ${String(timeoutMs)}`
409
413
  };
410
- const signal = AbortSignal.timeout(timeoutMs);
414
+ const signal = options.signal !== void 0 ? AbortSignal.any([AbortSignal.timeout(timeoutMs), options.signal]) : AbortSignal.timeout(timeoutMs);
411
415
  abortSignal = signal;
412
416
  const agentOptions = { model: options.model ?? runtime.evolutionPolicy?.get()?.curatorModel ?? "deepseek-v4-pro" };
413
417
  if (options.provider) agentOptions.provider = options.provider;
package/lib/tools.js CHANGED
@@ -1,5 +1,5 @@
1
- import { i as snapshotFromLibrary, n as PROBE_SIGNALS, r as computeProbe, t as buildEnrichment } from "./enrichment-B7tEHkM5.js";
2
- import { SkillLibrary, redactSecrets, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
1
+ import { i as snapshotFromLibrary, n as PROBE_SIGNALS, r as computeProbe, t as buildEnrichment } from "./enrichment-CYpvRfH_.js";
2
+ import { SkillLibrary, redactSecrets, resolveRootConfig, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
3
3
  import z from "@deepseek-ai/schemastery";
4
4
  import { defineTool } from "@deepseek-ai/dsh-tools";
5
5
  //#region lib/types/tools.js
@@ -14,9 +14,13 @@ import { defineTool } from "@deepseek-ai/dsh-tools";
14
14
  * @module @lmzhen/dsh-evolution-maintenance-tools
15
15
  */
16
16
  const name = "evolution-maintenance-tools";
17
- const Config = z.object({ skillsRoot: z.string().default("") });
17
+ const Config = z.object({
18
+ root: z.string().default(""),
19
+ skillsRoot: z.string().default("")
20
+ });
18
21
  function apply(ctx, rawConfig = {}) {
19
- const config = rawConfig;
22
+ const rootConfig = resolveRootConfig(rawConfig);
23
+ if (rootConfig.usedDeprecatedAlias) ctx.logger.warn("evolution-maintenance-tools: config \"skillsRoot\" is deprecated (E-7); use \"root\" — the alias is honoured until 0.3.65");
20
24
  ctx.inject(["tools"], (toolCtx) => {
21
25
  const tools = toolCtx.get("tools");
22
26
  toolCtx.effect(() => tools.register(defineTool({
@@ -61,7 +65,7 @@ function apply(ctx, rawConfig = {}) {
61
65
  detail: ["evolution-io registry not mounted"],
62
66
  ...target ? { target } : {}
63
67
  };
64
- const library = new SkillLibrary(resolveSkillsRoot({ root: config.skillsRoot }), ioRegistry.provider());
68
+ const library = new SkillLibrary(resolveSkillsRoot({ root: rootConfig.root }), ioRegistry.provider());
65
69
  const enrichment = await buildEnrichment(ctx, library);
66
70
  const probe = computeProbe(signal, target, await snapshotFromLibrary(library, {
67
71
  descriptions: enrichment.descriptions,
@@ -16,6 +16,9 @@ export interface SkillLibraryLike {
16
16
  read(name: string): Promise<string | null | undefined>;
17
17
  }
18
18
  export interface SnapshotOptions {
19
+ /** E-9 (v18): called when one skill's body cannot be read; the scan skips
20
+ * that skill instead of aborting the whole run. */
21
+ onReadError?: ((name: string, error: unknown) => void) | undefined;
19
22
  /** Support-file relative paths per skill name, when the caller has them. */
20
23
  supportFiles?: ReadonlyMap<string, readonly string[]> | undefined;
21
24
  /** Parsed frontmatter description per skill name, when available. */
@@ -44,6 +44,8 @@ export interface MaintainRuntime {
44
44
  }
45
45
  export interface MaintainOptions {
46
46
  timeoutMs?: number;
47
+ /** E-6 (v18): external cancel signal (session/UI); combined with timeoutMs. */
48
+ signal?: AbortSignal | undefined;
47
49
  maxDepth?: number;
48
50
  model?: string;
49
51
  provider?: string;
@@ -12,13 +12,18 @@ import type { Context } from '@deepseek-ai/cordis';
12
12
  import z from '@deepseek-ai/schemastery';
13
13
  export declare const name = "evolution-maintenance-tools";
14
14
  export interface Config {
15
- /** Skill-tree root for probe reads; empty uses skillsRoot(). Align with
16
- * tool-skill-manage/skill-usage/evolution-skill-catalog/commands rows (A7). */
15
+ /** Skill-tree root for probe reads; empty uses the default tree. E-7 (v18):
16
+ * canonical key — the same `root` every other family row reads. */
17
+ root?: string | undefined;
18
+ /** Deprecated alias of `root` (E-7, v18); honoured only while `root` is
19
+ * empty, with a warning; removed after 0.3.65. */
17
20
  skillsRoot?: string | undefined;
18
21
  }
19
22
  export declare const Config: z<Schemastery.ObjectS<{
23
+ root: z<string, string>;
20
24
  skillsRoot: z<string, string>;
21
25
  }>, Schemastery.ObjectT<{
26
+ root: z<string, string>;
22
27
  skillsRoot: z<string, string>;
23
28
  }>>;
24
29
  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-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.62",
4
+ "version": "0.3.64",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -35,7 +35,7 @@
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
37
  "@deepseek-ai/schemastery": "^3.18.1",
38
- "@lmzhen/dsh-evolution-core": "^0.3.62"
38
+ "@lmzhen/dsh-evolution-core": "^0.3.64"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",