@lmzhen/dsh-memory-files 0.1.0-rc.4 → 0.1.0-rc.41

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 +7 -1
  2. package/package.json +7 -7
package/lib/index.js CHANGED
@@ -19,6 +19,12 @@ const Config = z.object({
19
19
  function apply(ctx, rawConfig) {
20
20
  const config = rawConfig;
21
21
  const io = evolutionIoAdapter(() => ctx.evolutionIo.provider());
22
+ let writeChain = Promise.resolve();
23
+ const serializedWrite = (task) => {
24
+ const run = writeChain.then(task, task);
25
+ writeChain = run.then(() => void 0, () => void 0);
26
+ return run;
27
+ };
22
28
  const store = new MemoryStore({
23
29
  memoryCharLimit: config.memoryCharLimit,
24
30
  userCharLimit: config.userCharLimit,
@@ -36,7 +42,7 @@ function apply(ctx, rawConfig) {
36
42
  facts: op.facts ?? op.content,
37
43
  old_text: op.old_text
38
44
  }));
39
- return store.applyBatch(target, normalized);
45
+ return await serializedWrite(() => store.applyBatch(target, normalized));
40
46
  },
41
47
  snapshot: async () => {
42
48
  const [memory, user] = await Promise.all([store.read("memory"), store.read("user")]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-memory-files",
3
3
  "description": "Local layered memory provider (community build)",
4
- "version": "0.1.0-rc.4",
4
+ "version": "0.1.0-rc.41",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,18 +33,18 @@
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
35
  "@deepseek-ai/schemastery": "^3.18.1",
36
- "@lmzhen/dsh-evolution-core": "^0.1.0-rc.4"
36
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.41"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.1",
40
40
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
41
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.4",
42
- "@lmzhen/dsh-memory": "^0.1.0-rc.4"
41
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.41",
42
+ "@lmzhen/dsh-memory": "^0.1.0-rc.41"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
46
- "@lmzhen/dsh-evolution-core": "^0.1.0-rc.4",
47
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.4",
48
- "@lmzhen/dsh-memory": "^0.1.0-rc.4"
46
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.41",
47
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.41",
48
+ "@lmzhen/dsh-memory": "^0.1.0-rc.41"
49
49
  }
50
50
  }