@lmzhen/dsh-evolution-core 0.1.0-rc.69 → 0.1.0-rc.70

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
@@ -100,7 +100,7 @@ function nodeEvolutionIo() {
100
100
  }
101
101
  await new Promise((resolve) => setTimeout(resolve, 50));
102
102
  }
103
- throw new Error(`could not acquire write lock for ${path} after 10 attempts`);
103
+ throw new Error(`could not acquire write lock for ${path} after 40 attempts`);
104
104
  };
105
105
  return {
106
106
  async readText(path) {
@@ -742,6 +742,11 @@ function isEventRecord(event) {
742
742
  * Parse an event log body. A missing file, a whitespace-only file (rc.69:
743
743
  * rebuildable, NOT malformed) or a corrupt one reads as empty; corrupt content
744
744
  * is still refused on append, never overwritten.
745
+ *
746
+ * Per-entry normalization (rc.70 F-1): entries without a numeric `seq` are
747
+ * skipped here and dropped at the next append — valid entries survive, the
748
+ * damaged record is the only loss (self-heal semantics, matching the usage
749
+ * sidecar's per-field normalization on read).
745
750
  */
746
751
  function parseEvolutionEvents(raw) {
747
752
  if (raw === null || raw.trim() === "") return [];
@@ -795,7 +800,7 @@ async function readEvolutionEvents(io, path) {
795
800
  const parsed = JSON.parse(raw);
796
801
  if (!Array.isArray(parsed.events)) return {
797
802
  events: [],
798
- malformed: true
803
+ malformed: false
799
804
  };
800
805
  return {
801
806
  events: parsed.events.filter(isEventRecord),
@@ -30,6 +30,11 @@ export declare function eventsFile(home: string): string;
30
30
  * Parse an event log body. A missing file, a whitespace-only file (rc.69:
31
31
  * rebuildable, NOT malformed) or a corrupt one reads as empty; corrupt content
32
32
  * is still refused on append, never overwritten.
33
+ *
34
+ * Per-entry normalization (rc.70 F-1): entries without a numeric `seq` are
35
+ * skipped here and dropped at the next append — valid entries survive, the
36
+ * damaged record is the only loss (self-heal semantics, matching the usage
37
+ * sidecar's per-field normalization on read).
33
38
  */
34
39
  export declare function parseEvolutionEvents(raw: string | null): EvolutionEvent[];
35
40
  /**
@@ -41,7 +46,10 @@ export declare function parseEvolutionEvents(raw: string | null): EvolutionEvent
41
46
  export declare function appendEvolutionEvent(io: EvolutionIoLike, path: string, event: Omit<EvolutionEvent, 'seq' | 'at'>): Promise<number>;
42
47
  export interface EventLogRead {
43
48
  events: EvolutionEvent[];
44
- /** True when the file existed but could not be parsed (loss case; never overwritten). */
49
+ /** True when the body is not valid JSON (syntax-level damage): refused on
50
+ * append, bytes untouched. Well-formed JSON with a damaged `events` field
51
+ * is REPLACEABLE garbage — reads as empty and is rewritten at the next
52
+ * append (rc.70 F-1: read and append agree on the same boundary). */
45
53
  malformed: boolean;
46
54
  }
47
55
  /** Read the event log; a missing/whitespace-only file reads as empty,
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.1.0-rc.69",
4
+ "version": "0.1.0-rc.70",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },