@lmzhen/dsh-memory-files 0.3.16 → 0.3.17

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 +4 -8
  2. package/package.json +7 -7
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import z from "@deepseek-ai/schemastery";
3
- import { DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, MemoryStore, evolutionIoAdapter } from "@lmzhen/dsh-evolution-core";
3
+ import { DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, MemoryStore, evolutionIoAdapter, makeSerialQueue } from "@lmzhen/dsh-evolution-core";
4
4
  //#region lib/types/index.js
5
5
  /**
6
6
  * Local layered memory provider for `ctx.memory`.
@@ -19,12 +19,7 @@ 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
+ const serializedWrite = makeSerialQueue();
28
23
  const store = new MemoryStore({
29
24
  memoryCharLimit: config.memoryCharLimit,
30
25
  userCharLimit: config.userCharLimit,
@@ -45,7 +40,8 @@ function apply(ctx, rawConfig) {
45
40
  return await serializedWrite(() => store.applyBatch(target, normalized));
46
41
  },
47
42
  snapshot: async () => {
48
- const [memory, user] = await Promise.all([store.read("memory"), store.read("user")]);
43
+ const memory = await store.read("memory");
44
+ const user = await store.read("user");
49
45
  const text = JSON.stringify([memory, user]);
50
46
  return {
51
47
  version: 1,
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.3.16",
4
+ "version": "0.3.17",
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.3.16"
36
+ "@lmzhen/dsh-evolution-core": "^0.3.17"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.1",
40
40
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
41
- "@lmzhen/dsh-evolution-io": "^0.3.16",
42
- "@lmzhen/dsh-memory": "^0.3.16"
41
+ "@lmzhen/dsh-evolution-io": "^0.3.17",
42
+ "@lmzhen/dsh-memory": "^0.3.17"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
46
- "@lmzhen/dsh-evolution-core": "^0.3.16",
47
- "@lmzhen/dsh-evolution-io": "^0.3.16",
48
- "@lmzhen/dsh-memory": "^0.3.16"
46
+ "@lmzhen/dsh-evolution-core": "^0.3.17",
47
+ "@lmzhen/dsh-evolution-io": "^0.3.17",
48
+ "@lmzhen/dsh-memory": "^0.3.17"
49
49
  }
50
50
  }