@lmzhen/dsh-evolution-core 0.3.47 → 0.3.49

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
@@ -646,7 +646,6 @@ const MAX_SKILL_CONTENT_CHARS = 1e5;
646
646
  const MAX_SKILL_FILE_BYTES = 1048576;
647
647
  const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
648
648
  const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
649
- /** Skill-review completion channel trigger mode: 'cadence' | 'completion' | 'both'. */
650
649
  /** Skill-review completion channel trigger mode: 'cadence' | 'completion' | 'both'.
651
650
  * 0.3.39 (V6-53 follow-up): default is 'cadence' — since 0.3.38 the cadence
652
651
  * channel's review is executed at conversation END (deferred), so 'both' would
@@ -2066,18 +2065,21 @@ var MemoryStore = class {
2066
2065
  return percent >= 80 ? ` ⚠️ Storage at ${percent}% (${chars}/${limit} chars).` : "";
2067
2066
  }
2068
2067
  /**
2069
- * Best-effort raw-copy backup of the on-disk file to `<file>.bak.<stamp>`
2070
- * before a refusal, so an externally modified (or oversized) file stays
2071
- * recoverable. Copies bytes instead of reading them so a pathologically
2072
- * large file is never loaded just to back it up. Failure to back up does
2073
- * not change the refusal semantics.
2068
+ * Best-effort raw-copy backup of the on-disk file to `<file>.bak` before a
2069
+ * refusal, so an externally modified (or oversized) file stays recoverable.
2070
+ * Copies bytes instead of reading them so a pathologically large file is
2071
+ * never loaded just to back it up. Failure to back up does not change the
2072
+ * refusal semantics. V8-23⑫ (0.3.49): ONE fixed backup name per target —
2073
+ * a fresh refusal overwrites it (the previous timestamped names accumulated
2074
+ * per drift incident with no retention policy).
2074
2075
  */
2075
2076
  async backupFile(target) {
2076
2077
  const path = fileFor(this.root, target);
2077
- const unique = `${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:T]/g, "").slice(0, 14)}-${Math.random().toString(36).slice(2, 8)}`;
2078
+ const backup = `${path}.bak`;
2078
2079
  try {
2079
- await this.io.copy(path, `${path}.bak.${unique}`);
2080
- return `${path}.bak.${unique}`;
2080
+ await this.io.remove(backup).catch(() => {});
2081
+ await this.io.copy(path, backup);
2082
+ return backup;
2081
2083
  } catch {
2082
2084
  return null;
2083
2085
  }
@@ -33,7 +33,6 @@ export declare const MAX_SKILL_CONTENT_CHARS = 100000;
33
33
  export declare const MAX_SKILL_FILE_BYTES = 1048576;
34
34
  export declare const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
35
35
  export declare const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
36
- /** Skill-review completion channel trigger mode: 'cadence' | 'completion' | 'both'. */
37
36
  /** Skill-review completion channel trigger mode: 'cadence' | 'completion' | 'both'.
38
37
  * 0.3.39 (V6-53 follow-up): default is 'cadence' — since 0.3.38 the cadence
39
38
  * channel's review is executed at conversation END (deferred), so 'both' would
package/lib/types/io.d.ts CHANGED
@@ -14,9 +14,12 @@ export interface EvolutionIoLike {
14
14
  copy(path: string, destination: string): Promise<void>;
15
15
  /**
16
16
  * Optional byte-size probe for the read guard. Return the file's size in
17
- * bytes, or `null`/`undefined` when unknown (unsupported backend, missing
18
- * file, stat failure). An implementation without this probe gets no guard:
19
- * consumers treat an unknown size as "guard not applicable".
17
+ * bytes, or `null` when the file does not exist (ENOENT/ENOTDIR);
18
+ * V8-23⑨ (0.3.49): the doc claimed "stat failure null" but the
19
+ * implementation propagates other stat errors only missing-file is a
20
+ * "guard not applicable" signal, a real stat failure is an IO error.
21
+ * An implementation without this probe gets no guard: consumers treat an
22
+ * unknown size as "guard not applicable".
20
23
  */
21
24
  size?(path: string): Promise<number | null>;
22
25
  /**
@@ -61,11 +61,13 @@ export declare class MemoryStore {
61
61
  */
62
62
  private storageHint;
63
63
  /**
64
- * Best-effort raw-copy backup of the on-disk file to `<file>.bak.<stamp>`
65
- * before a refusal, so an externally modified (or oversized) file stays
66
- * recoverable. Copies bytes instead of reading them so a pathologically
67
- * large file is never loaded just to back it up. Failure to back up does
68
- * not change the refusal semantics.
64
+ * Best-effort raw-copy backup of the on-disk file to `<file>.bak` before a
65
+ * refusal, so an externally modified (or oversized) file stays recoverable.
66
+ * Copies bytes instead of reading them so a pathologically large file is
67
+ * never loaded just to back it up. Failure to back up does not change the
68
+ * refusal semantics. V8-23⑫ (0.3.49): ONE fixed backup name per target —
69
+ * a fresh refusal overwrites it (the previous timestamped names accumulated
70
+ * per drift incident with no retention policy).
69
71
  */
70
72
  private backupFile;
71
73
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-core",
3
3
  "description": "Shared stores, prompts, signals and lifecycle logic for the dsh-evolution plugin family (community build)",
4
- "version": "0.3.47",
4
+ "version": "0.3.49",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },