@lmzhen/dsh-tool-memory 0.3.50 → 0.3.52

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 +9 -2
  2. package/package.json +7 -7
package/lib/index.js CHANGED
@@ -180,6 +180,13 @@ async function apply(ctx, rawConfig) {
180
180
  chars: 0,
181
181
  limit: 0
182
182
  };
183
+ if (args.operations !== void 0 && !Array.isArray(args.operations)) return {
184
+ ok: false,
185
+ message: "Invalid shape: operations must be an array of {action, content?, old_text?} objects (or omit operations for a single operation).",
186
+ entries: [],
187
+ chars: 0,
188
+ limit: 0
189
+ };
183
190
  const target = args.target === "user" ? "user" : "memory";
184
191
  const normalized = Array.isArray(args.operations) ? {
185
192
  target,
@@ -191,7 +198,7 @@ async function apply(ctx, rawConfig) {
191
198
  old_text: args.old_text
192
199
  };
193
200
  const targetLabel = target === "memory" ? "" : `${target} `;
194
- const origin = resolveOrigins(exec.agent?.session.header.origin).approval;
201
+ const origin = resolveOrigins(exec.agent?.session?.header.origin).approval;
195
202
  const sessionPolicy = effectiveSessionPolicy(ctx, exec.agent?.session);
196
203
  const approval = ctx.get("evolutionApproval");
197
204
  if (approval) {
@@ -200,7 +207,7 @@ async function apply(ctx, rawConfig) {
200
207
  summary: `memory ${targetLabel}${Array.isArray(args.operations) ? `${args.operations.length} ops` : args.action ?? "add"}`,
201
208
  args: normalized,
202
209
  origin,
203
- ...exec.agent?.session.id ? { sessionId: exec.agent.session.id } : {},
210
+ ...exec.agent?.session?.id ? { sessionId: exec.agent.session.id } : {},
204
211
  ...exec.agent?.session ? { session: exec.agent.session } : {},
205
212
  ...sessionPolicy !== void 0 ? { sessionPolicy } : {}
206
213
  });
package/package.json CHANGED
@@ -1,14 +1,14 @@
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.50",
4
+ "version": "0.3.52",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/lmzhen/dsh-evolution.git",
11
- "directory": "packages/dsh-tool-memory"
11
+ "directory": "packages/tool-memory"
12
12
  },
13
13
  "type": "module",
14
14
  "main": "lib/index.js",
@@ -31,22 +31,22 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.1",
34
- "@lmzhen/dsh-evolution-core": "^0.3.50",
35
- "@lmzhen/dsh-evolution-approval": "^0.3.50"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.52",
35
+ "@lmzhen/dsh-evolution-approval": "^0.3.52"
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.50"
42
+ "@lmzhen/dsh-memory": "^0.3.52"
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.50",
50
- "@lmzhen/dsh-memory-files": "^0.3.50"
49
+ "@lmzhen/dsh-memory": "^0.3.52",
50
+ "@lmzhen/dsh-memory-files": "^0.3.52"
51
51
  }
52
52
  }