@lmzhen/dsh-tool-memory 0.3.81 → 0.3.83
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/README.md +1 -1
- package/lib/index.js +28 -0
- package/package.json +7 -7
package/README.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -104,6 +104,14 @@ async function apply(ctx, rawConfig = {}) {
|
|
|
104
104
|
limit: result.limit
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
+
const requiredFieldRejection = (op, position) => {
|
|
108
|
+
const body = (op.facts ?? op.content ?? "").trim();
|
|
109
|
+
if (op.action === "add") return body ? null : `Operation ${position} (add): facts is required. No operations were applied.`;
|
|
110
|
+
if (op.action !== "remove" && op.action !== "replace") return `Operation ${position}: unknown action "${String(op.action)}" (expected add/remove/replace). No operations were applied.`;
|
|
111
|
+
if (!(op.old_text ?? "").trim()) return `Operation ${position} (${op.action}): old_text is required. No operations were applied.`;
|
|
112
|
+
if (op.action === "replace" && !body) return `Operation ${position} (replace): facts is required.`;
|
|
113
|
+
return null;
|
|
114
|
+
};
|
|
107
115
|
if (!memoryDisabled) ctx.tools.register(defineTool({
|
|
108
116
|
name: "memory",
|
|
109
117
|
description: MEMORY_TOOL_DESCRIPTION,
|
|
@@ -234,6 +242,26 @@ async function apply(ctx, rawConfig = {}) {
|
|
|
234
242
|
facts: args.facts ?? args.content,
|
|
235
243
|
old_text: args.old_text
|
|
236
244
|
};
|
|
245
|
+
if (normalized.operations) for (const [index, op] of normalized.operations.entries()) {
|
|
246
|
+
const rejection = requiredFieldRejection(op, index + 1);
|
|
247
|
+
if (rejection) return {
|
|
248
|
+
ok: false,
|
|
249
|
+
message: rejection,
|
|
250
|
+
entries: [],
|
|
251
|
+
chars: 0,
|
|
252
|
+
limit: 0
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
const rejection = requiredFieldRejection(normalized, 1);
|
|
257
|
+
if (rejection) return {
|
|
258
|
+
ok: false,
|
|
259
|
+
message: rejection,
|
|
260
|
+
entries: [],
|
|
261
|
+
chars: 0,
|
|
262
|
+
limit: 0
|
|
263
|
+
};
|
|
264
|
+
}
|
|
237
265
|
const targetLabel = target === "memory" ? "" : `${target} `;
|
|
238
266
|
const origin = resolveExecOrigins(exec).approval;
|
|
239
267
|
const sessionPolicy = effectiveSessionPolicy(ctx, exec.agent?.session);
|
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.
|
|
4
|
+
"version": "0.3.83",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,21 +27,21 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
30
|
-
"@lmzhen/dsh-evolution-approval": "^0.3.
|
|
31
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
30
|
+
"@lmzhen/dsh-evolution-approval": "^0.3.83",
|
|
31
|
+
"@lmzhen/dsh-evolution-core": "^0.3.83"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
35
35
|
"@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
|
|
36
36
|
"@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2",
|
|
37
|
-
"@lmzhen/dsh-memory": "^0.3.
|
|
37
|
+
"@lmzhen/dsh-memory": "^0.3.83"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
|
|
41
41
|
"@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2",
|
|
42
42
|
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.5-rc.2",
|
|
43
|
-
"@lmzhen/dsh-evolution-approval": "^0.3.
|
|
44
|
-
"@lmzhen/dsh-memory": "^0.3.
|
|
45
|
-
"@lmzhen/dsh-memory-files": "^0.3.
|
|
43
|
+
"@lmzhen/dsh-evolution-approval": "^0.3.83",
|
|
44
|
+
"@lmzhen/dsh-memory": "^0.3.83",
|
|
45
|
+
"@lmzhen/dsh-memory-files": "^0.3.83"
|
|
46
46
|
}
|
|
47
47
|
}
|