@lmzhen/dsh-evolution-maintenance 0.3.0 → 0.3.1

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/invariant.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region lib/types/invariant.js
2
- const PACKAGE_NAME = "@deepseek-ai/dsh-evolution-maintenance";
2
+ const PACKAGE_NAME = "@lmzhen/dsh-evolution-maintenance";
3
3
  const name = "evolution-maintenance-invariant";
4
4
  const inject = ["invariants"];
5
5
  const install = () => {};
@@ -0,0 +1,71 @@
1
+ import { HEALTH_STAMP_RE, computeDedupGroups, computePrefixClusters, duplicateHeadings, missingSupportPointers, narrowNameMatches, overlongLines } from "@lmzhen/dsh-evolution-core";
2
+ //#region lib/types/probe.js
3
+ /**
4
+ * Probe detail computation (011 Phase 3).
5
+ *
6
+ * Pure functions over a skill snapshot — the SAME calculators the scan uses
7
+ * (`duplicateHeadings` / `overlongLines` / `missingSupportPointers` /
8
+ * `narrowNameMatches` / `computeDedupGroups` / `computePrefixClusters`), so a
9
+ * probe result can never disagree with the facts block. No IO, no writes.
10
+ */
11
+ const PROBE_SIGNALS = [
12
+ "dedup_group",
13
+ "prefix_cluster",
14
+ "usage_observed",
15
+ "stamp_density",
16
+ "body_size",
17
+ "dup_heading",
18
+ "overlong_line",
19
+ "pointer_missing",
20
+ "narrow_name",
21
+ "description_chars",
22
+ "quality_low"
23
+ ];
24
+ function result(signal, detail, target) {
25
+ return target ? {
26
+ signal,
27
+ target,
28
+ detail
29
+ } : {
30
+ signal,
31
+ detail
32
+ };
33
+ }
34
+ function findSnapshot(snapshots, name) {
35
+ return snapshots.find((snapshot) => snapshot.name === name);
36
+ }
37
+ /**
38
+ * Compute probe details for a query. Skill-level signals require `target`;
39
+ * library-level signals ignore it. Unknown signals yield an explicit
40
+ * `unknown-signal` detail (never a fabricated verdict).
41
+ */
42
+ function computeProbe(signal, target, snapshots) {
43
+ if (!PROBE_SIGNALS.includes(signal)) return result(signal, [`unknown-signal '${signal}' (allowed: ${PROBE_SIGNALS.join(", ")})`], target);
44
+ if (signal === "dedup_group") return result(signal, computeDedupGroups({ contents: new Map(snapshots.map((snapshot) => [snapshot.name, snapshot.body])) }).map((group) => group.join(" ~ ")));
45
+ if (signal === "prefix_cluster") return result(signal, computePrefixClusters(snapshots.map((snapshot) => snapshot.name)).map((cluster) => `${cluster.key}: ${cluster.members.join(", ")}`));
46
+ if (signal === "usage_observed") return result(signal, [`usage_observed=${snapshots.every((snapshot) => snapshot.usageObserved === true) ? "observed" : "unknown"}`]);
47
+ if (!target) return result(signal, ["skill-level signal requires a target skill name"]);
48
+ const snapshot = findSnapshot(snapshots, target);
49
+ if (!snapshot) return result(signal, [`skill '${target}' not found in snapshot`], target);
50
+ const body = snapshot.body;
51
+ switch (signal) {
52
+ case "stamp_density": {
53
+ const kb = Math.max(1, body.length / 1024);
54
+ const stamps = body.match(HEALTH_STAMP_RE) ?? [];
55
+ return result(signal, [`stamp_density=${(stamps.length / kb).toFixed(2)}/KB (${stamps.length} stamps / ${Math.round(kb)}KB)`, ...stamps.slice(0, 10).map((stamp) => `stamp: ${stamp}`)], target);
56
+ }
57
+ case "body_size": return result(signal, [`body=${body.length} chars`], target);
58
+ case "dup_heading": return result(signal, duplicateHeadings(body).map((d) => `${d.heading} x${d.count}`), target);
59
+ case "overlong_line": return result(signal, overlongLines(body).map((line) => `line ${line.lineNo}: ${line.chars} chars`), target);
60
+ case "pointer_missing": return result(signal, missingSupportPointers(body, snapshot.supportFiles ?? []).map((path) => `no body reference: ${path}`), target);
61
+ case "narrow_name": return result(signal, narrowNameMatches(snapshot.name).map((shape) => `narrow shape: ${shape}`), target);
62
+ case "description_chars": return result(signal, [`description=${snapshot.description === void 0 ? "missing" : `${snapshot.description.length} chars`}`], target);
63
+ case "quality_low": {
64
+ const quality = snapshot.quality;
65
+ return result(signal, [quality === null || quality === void 0 ? "quality=unknown" : `quality=${quality.toFixed(2)}`], target);
66
+ }
67
+ default: return result(signal, [`unsupported skill-level signal "${signal}"`], target);
68
+ }
69
+ }
70
+ //#endregion
71
+ export { computeProbe as n, PROBE_SIGNALS as t };
package/lib/tools.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as computeProbe, t as PROBE_SIGNALS } from "./probe-CrVeRJ6b.js";
2
- import { SkillLibrary, redactSecrets } from "@deepseek-ai/dsh-evolution-core";
2
+ import { SkillLibrary, redactSecrets } from "@lmzhen/dsh-evolution-core";
3
3
  import { defineTool } from "@deepseek-ai/dsh-tools";
4
4
  //#region lib/types/tools.js
5
5
  /**
@@ -10,7 +10,7 @@ import { defineTool } from "@deepseek-ai/dsh-tools";
10
10
  * evidence). The subagent may use it to sharpen confidence and
11
11
  * semantic_reasoning; it must never introduce evidence ids outside the facts
12
12
  * block (validated plan-side). No write path exists in this tool.
13
- * @module @deepseek-ai/dsh-evolution-maintenance-tools
13
+ * @module @lmzhen/dsh-evolution-maintenance-tools
14
14
  */
15
15
  const name = "evolution-maintenance-tools";
16
16
  function apply(ctx, rawConfig = {}) {
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.0",
4
+ "version": "0.3.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,16 +29,12 @@
29
29
  "./package.json": "./package.json"
30
30
  },
31
31
  "files": [
32
- "lib/index.js",
33
- "lib/invariant.js",
34
- "lib/tools.js",
35
- "lib/types/**/*.d.ts",
36
- "lib/types/invariant.d.ts",
37
- "lib/types/tools.d.ts"
32
+ "lib/*.js",
33
+ "lib/types/**/*.d.ts"
38
34
  ],
39
35
  "license": "MIT",
40
36
  "dependencies": {
41
- "@lmzhen/dsh-evolution-core": "^0.3.0"
37
+ "@lmzhen/dsh-evolution-core": "^0.3.1"
42
38
  },
43
39
  "peerDependencies": {
44
40
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",