@lmzhen/dsh-memory-files 0.3.24 → 0.3.25
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 +16 -5
- 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, makeSerialQueue } from "@lmzhen/dsh-evolution-core";
|
|
3
|
+
import { DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, MemoryStore, clampedNumber, 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`.
|
|
@@ -10,14 +10,25 @@ const name = "memory-files";
|
|
|
10
10
|
const inject = ["memory", "evolutionIo"];
|
|
11
11
|
const Config = z.object({
|
|
12
12
|
providerName: z.string().default("files"),
|
|
13
|
-
memoryCharLimit: z.number().default(DEFAULT_MEMORY_CHAR_LIMIT),
|
|
14
|
-
userCharLimit: z.number().default(DEFAULT_USER_CHAR_LIMIT),
|
|
13
|
+
memoryCharLimit: z.number().min(1).default(DEFAULT_MEMORY_CHAR_LIMIT),
|
|
14
|
+
userCharLimit: z.number().min(1).default(DEFAULT_USER_CHAR_LIMIT),
|
|
15
15
|
addDatePrefix: z.boolean().default(false),
|
|
16
16
|
root: z.string().default(""),
|
|
17
|
-
maxConsolidationFailures: z.number().default(DEFAULT_CONSOLIDATION_FAILURES)
|
|
17
|
+
maxConsolidationFailures: z.number().min(1).default(DEFAULT_CONSOLIDATION_FAILURES)
|
|
18
18
|
});
|
|
19
19
|
function apply(ctx, rawConfig) {
|
|
20
|
-
const
|
|
20
|
+
const clamped = [];
|
|
21
|
+
const field = (name, value, fallback) => {
|
|
22
|
+
const result = clampedNumber(value, fallback, { min: 1 });
|
|
23
|
+
if (value !== void 0 && result !== value) clamped.push(name);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
const config = Object.assign({}, rawConfig, {
|
|
27
|
+
memoryCharLimit: field("memoryCharLimit", rawConfig.memoryCharLimit, DEFAULT_MEMORY_CHAR_LIMIT),
|
|
28
|
+
userCharLimit: field("userCharLimit", rawConfig.userCharLimit, DEFAULT_USER_CHAR_LIMIT),
|
|
29
|
+
maxConsolidationFailures: field("maxConsolidationFailures", rawConfig.maxConsolidationFailures, DEFAULT_CONSOLIDATION_FAILURES)
|
|
30
|
+
});
|
|
31
|
+
if (clamped.length > 0) ctx.logger.warn(`memory-files: ${clamped.join(", ")} provided an invalid value; falling back to the default`);
|
|
21
32
|
const io = evolutionIoAdapter(() => ctx.evolutionIo.provider());
|
|
22
33
|
const serializedWrite = makeSerialQueue();
|
|
23
34
|
const store = new MemoryStore({
|
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.
|
|
4
|
+
"version": "0.3.25",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-core": "^0.3.25"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
38
38
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
39
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
40
|
-
"@lmzhen/dsh-memory": "^0.3.
|
|
39
|
+
"@lmzhen/dsh-evolution-io": "^0.3.25",
|
|
40
|
+
"@lmzhen/dsh-memory": "^0.3.25"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
44
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
45
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
46
|
-
"@lmzhen/dsh-memory": "^0.3.
|
|
44
|
+
"@lmzhen/dsh-evolution-core": "^0.3.25",
|
|
45
|
+
"@lmzhen/dsh-evolution-io": "^0.3.25",
|
|
46
|
+
"@lmzhen/dsh-memory": "^0.3.25"
|
|
47
47
|
}
|
|
48
48
|
}
|