@lmzhen/dsh-tool-memory 0.3.66 → 0.3.67

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 +22 -3
  2. package/package.json +7 -6
package/lib/index.js CHANGED
@@ -63,6 +63,16 @@ async function apply(ctx, rawConfig = {}) {
63
63
  }), "tool-memory.snapshot-refresh");
64
64
  } else ctx.logger.warn("tool-memory: systemPrompt service not mounted; memory guidance and snapshot are not injected (the write tool still works)");
65
65
  async function executeCore(normalized) {
66
+ if (normalized.operations?.some((op) => {
67
+ const raw = op;
68
+ return raw === null || typeof raw !== "object";
69
+ })) return {
70
+ ok: false,
71
+ message: "Every entry of operations must be an object.",
72
+ entries: [],
73
+ chars: 0,
74
+ limit: 0
75
+ };
66
76
  const result = normalized.operations ? await ctx.memory.applyBatch(normalized.target, normalized.operations) : await ctx.memory.applyBatch(normalized.target, [{
67
77
  action: normalized.action ?? "add",
68
78
  facts: normalized.facts,
@@ -158,15 +168,24 @@ async function apply(ctx, rawConfig = {}) {
158
168
  if (a.facts === void 0 || a.content === void 0) return false;
159
169
  return a.facts !== a.content;
160
170
  };
161
- if (Array.isArray(args.operations)) {
162
- for (const op of args.operations) if (conflict(op)) return {
171
+ if (Array.isArray(args.operations)) for (const op of args.operations) {
172
+ const raw = op;
173
+ if (raw === null || typeof raw !== "object") return {
174
+ ok: false,
175
+ message: "Every entry of operations must be an object.",
176
+ entries: [],
177
+ chars: 0,
178
+ limit: 0
179
+ };
180
+ if (conflict(op)) return {
163
181
  ok: false,
164
182
  message: "Provide only one of facts or content per operation (same field); different values were given.",
165
183
  entries: [],
166
184
  chars: 0,
167
185
  limit: 0
168
186
  };
169
- } else if (conflict(args)) return {
187
+ }
188
+ else if (conflict(args)) return {
170
189
  ok: false,
171
190
  message: "Provide only one of facts or content (same field); different values were given.",
172
191
  entries: [],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-tool-memory",
3
3
  "description": "Model-facing memory tool and prompt context (community build)",
4
- "version": "0.3.66",
4
+ "version": "0.3.67",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,22 +31,23 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.1",
34
- "@lmzhen/dsh-evolution-core": "^0.3.66",
35
- "@lmzhen/dsh-evolution-approval": "^0.3.66"
34
+ "@lmzhen/dsh-evolution-approval": "^0.3.67",
35
+ "@lmzhen/dsh-evolution-core": "^0.3.67"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
39
39
  "@deepseek-ai/cordis": "^4.0.1",
40
40
  "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
41
41
  "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
42
- "@lmzhen/dsh-memory": "^0.3.66"
42
+ "@lmzhen/dsh-memory": "^0.3.67"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
46
46
  "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
47
47
  "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
48
48
  "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.1-rc.2",
49
- "@lmzhen/dsh-memory": "^0.3.66",
50
- "@lmzhen/dsh-memory-files": "^0.3.66"
49
+ "@lmzhen/dsh-evolution-approval": "^0.3.67",
50
+ "@lmzhen/dsh-memory": "^0.3.67",
51
+ "@lmzhen/dsh-memory-files": "^0.3.67"
51
52
  }
52
53
  }