@lmzhen/dsh-memory-files 0.17.0 → 0.18.0
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 +4 -16
- package/lib/types/index.d.ts +2 -2
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import z from "@deepseek-ai/schemastery";
|
|
4
|
-
import { DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, MemoryStore, clampedNumber, evolutionIoAdapter, makeSerialQueue, paramRowId } from "@lmzhen/dsh-evolution-core";
|
|
4
|
+
import { DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, MemoryStore, clampedNumber, evolutionIoAdapter, makeSerialQueue, paramRowId, payloadText, userSetKeys } from "@lmzhen/dsh-evolution-core";
|
|
5
5
|
//#region lib/types/index.js
|
|
6
6
|
/**
|
|
7
7
|
* Local layered memory provider for `ctx.memory`.
|
|
@@ -24,7 +24,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
24
24
|
ctx.inject(["settings"], (injected) => {
|
|
25
25
|
const settings = injected.settings;
|
|
26
26
|
if (typeof settings?.configure !== "function") return;
|
|
27
|
-
const disposer = settings.configure({ auto: false });
|
|
27
|
+
const disposer = settings.configure({ auto: false }, ctx.fiber);
|
|
28
28
|
if (typeof disposer === "function") ctx.effect(() => disposer, "memory-files: settings presentation");
|
|
29
29
|
});
|
|
30
30
|
const clampedKeys = /* @__PURE__ */ new Set();
|
|
@@ -141,7 +141,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
141
141
|
applyBatch: async (target, operations) => {
|
|
142
142
|
const normalized = operations.map((op) => ({
|
|
143
143
|
action: op.action,
|
|
144
|
-
facts: op
|
|
144
|
+
facts: payloadText(op),
|
|
145
145
|
old_text: op.old_text
|
|
146
146
|
}));
|
|
147
147
|
return await serializedWrite(() => currentStore().applyBatch(target, normalized));
|
|
@@ -162,24 +162,12 @@ function apply(ctx, rawConfig = {}) {
|
|
|
162
162
|
renderContext: () => serializedWrite(() => currentStore().renderContext())
|
|
163
163
|
};
|
|
164
164
|
/**
|
|
165
|
-
* The keys the user set in this row's namespace (G1 §8.4-A). This is the ONLY
|
|
166
|
-
* remaining read of the settings user layer, and it reads KEY NAMES, never
|
|
167
|
-
* values: the platform resolves the user layer into the row's live fields, so the
|
|
168
|
-
* value comes from `budget` — but naming the winning surface needs to know
|
|
169
|
-
* whether the user set the key at all.
|
|
170
|
-
* @returns the keys present in this row's user layer.
|
|
171
|
-
*/
|
|
172
|
-
const userSetKeys = () => {
|
|
173
|
-
const entry = ctx.get("settings")?.describe?.({ redactSecrets: false }).find((item) => item.ns === paramRowId("memory-files"));
|
|
174
|
-
return new Set(Object.keys(entry?.user ?? {}));
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
165
|
* Which surface supplied one budget.
|
|
178
166
|
* @param id - the canonical registry id.
|
|
179
167
|
* @returns 'user', 'config', 'policy' or 'default'.
|
|
180
168
|
*/
|
|
181
169
|
const limitSource = (id) => {
|
|
182
|
-
if (userSetKeys().has(id)) return "user";
|
|
170
|
+
if (userSetKeys(ctx, paramRowId("memory-files")).has(id)) return "user";
|
|
183
171
|
if (explicitBudget(id)) return "config";
|
|
184
172
|
return (id === "memoryChars" ? policyBudget().memory : policyBudget().user) === void 0 ? "default" : "policy";
|
|
185
173
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -21,10 +21,10 @@ export interface Config {
|
|
|
21
21
|
* a live row field on the same terms as `memoryChars`. */
|
|
22
22
|
userChars?: Volatile<number | undefined>;
|
|
23
23
|
/** Deprecated alias of `memoryChars` (G0/S0.3): still readable, refused by
|
|
24
|
-
* writes;
|
|
24
|
+
* writes; removal was planned for 0.7.0 and is deferred (the alias still ships — see the package README). */
|
|
25
25
|
memoryCharLimit?: number;
|
|
26
26
|
/** Deprecated alias of `userChars` (G0/S0.3): still readable, refused by
|
|
27
|
-
* writes;
|
|
27
|
+
* writes; removal was planned for 0.7.0 and is deferred (the alias still ships — see the package README). */
|
|
28
28
|
userCharLimit?: number;
|
|
29
29
|
addDatePrefix?: Volatile<boolean>;
|
|
30
30
|
root?: string;
|
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.
|
|
4
|
+
"version": "0.18.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
30
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
29
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
30
|
+
"@lmzhen/dsh-evolution-core": "^0.18.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-io": "^0.
|
|
35
|
-
"@lmzhen/dsh-memory": "^0.
|
|
34
|
+
"@lmzhen/dsh-evolution-io": "^0.18.0",
|
|
35
|
+
"@lmzhen/dsh-memory": "^0.18.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
39
|
-
"@lmzhen/dsh-evolution-io": "^0.
|
|
40
|
-
"@lmzhen/dsh-memory": "^0.
|
|
38
|
+
"@lmzhen/dsh-evolution-core": "^0.18.0",
|
|
39
|
+
"@lmzhen/dsh-evolution-io": "^0.18.0",
|
|
40
|
+
"@lmzhen/dsh-memory": "^0.18.0"
|
|
41
41
|
}
|
|
42
42
|
}
|