@lmzhen/dsh-tool-memory 0.3.34 → 0.3.36

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 +4 -2
  2. package/package.json +6 -6
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { defineTool } from "@deepseek-ai/dsh-tools";
4
- import { resolveOrigins } from "@lmzhen/dsh-evolution-core";
4
+ import { clampedNumber, resolveOrigins } from "@lmzhen/dsh-evolution-core";
5
5
  //#region lib/types/index.js
6
6
  /**
7
7
  * Model-facing memory tool and runtime-context memory snapshot.
@@ -33,6 +33,8 @@ const Config = z.object({
33
33
  });
34
34
  async function apply(ctx, rawConfig) {
35
35
  if (!rawConfig.memoryEnabled) return;
36
+ const entryPreviewChars = clampedNumber(rawConfig.entryPreviewChars, DEFAULT_ENTRY_PREVIEW_CHARS, { min: 1 });
37
+ if (entryPreviewChars !== (rawConfig.entryPreviewChars ?? DEFAULT_ENTRY_PREVIEW_CHARS)) ctx.logger.warn(`tool-memory: entryPreviewChars=${String(rawConfig.entryPreviewChars)} is invalid; falling back to the default ${DEFAULT_ENTRY_PREVIEW_CHARS}`);
36
38
  const systemPrompt = ctx.get("systemPrompt");
37
39
  let snapshotText = "";
38
40
  try {
@@ -69,7 +71,7 @@ async function apply(ctx, rawConfig) {
69
71
  return {
70
72
  ok: result.ok,
71
73
  message: result.message,
72
- entries: result.entries.map((entry) => entry.slice(0, rawConfig.entryPreviewChars ?? DEFAULT_ENTRY_PREVIEW_CHARS)),
74
+ entries: result.entries.map((entry) => entry.slice(0, entryPreviewChars)),
73
75
  chars: result.chars,
74
76
  limit: result.limit
75
77
  };
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.34",
4
+ "version": "0.3.36",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -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.34",
35
- "@lmzhen/dsh-evolution-approval": "^0.3.34"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.36",
35
+ "@lmzhen/dsh-evolution-approval": "^0.3.36"
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.34"
42
+ "@lmzhen/dsh-memory": "^0.3.36"
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.34",
50
- "@lmzhen/dsh-memory-files": "^0.3.34"
49
+ "@lmzhen/dsh-memory": "^0.3.36",
50
+ "@lmzhen/dsh-memory-files": "^0.3.36"
51
51
  }
52
52
  }