@lmzhen/dsh-memory 0.17.1 → 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 CHANGED
@@ -25,7 +25,12 @@ var MemoryRegistry = class extends Service {
25
25
  this.providerName = config.provider ?? "";
26
26
  }
27
27
  registerProvider(provider) {
28
- if (this.providers.has(provider.name)) throw new Error(`memory provider "${provider.name}" already registered`);
28
+ const idempotent = this.providers.get(provider.name) === provider;
29
+ if (!idempotent && this.providers.has(provider.name)) throw new Error(`memory provider "${provider.name}" already registered`);
30
+ if (idempotent) {
31
+ const existing = this.disposals.get(provider.name);
32
+ if (existing !== void 0) return existing;
33
+ }
29
34
  this.providers.set(provider.name, provider);
30
35
  if (this.providerName && provider.name !== this.providerName && !this.providers.has(this.providerName) && !this.pinWarned) {
31
36
  this.pinWarned = true;
@@ -15,8 +15,9 @@ export interface MemoryOperation {
15
15
  action: 'add' | 'replace' | 'remove';
16
16
  facts?: string | undefined;
17
17
  /** PLAN-R2 P2-6 (2026-09-16): content is an accepted alias honored by the
18
- * reference store (applyBatchCore reads `facts ?? content`); third-party
19
- * providers may normalize it to their own field. */
18
+ * reference store (applyBatchCore resolves the pair through core's
19
+ * `payloadText`, T3-06/A34); third-party providers may normalize it to their
20
+ * own field. */
20
21
  content?: string | undefined;
21
22
  old_text?: string | undefined;
22
23
  }
@@ -38,6 +39,12 @@ export interface EvolutionMemoryAppliedEvent {
38
39
  }
39
40
  declare module '@deepseek-ai/cordis' {
40
41
  interface Events {
42
+ /**
43
+ * A memory write succeeded, on the registry's single sink (so bypass paths are covered). An
44
+ * ANNOUNCEMENT: it reports the resulting size, it decides nothing (A98 / O-1).
45
+ * @param event - the target that was written and its resulting char/entry counts.
46
+ * @mode emit
47
+ */
41
48
  'evolution/memory-applied'(event: EvolutionMemoryAppliedEvent): void;
42
49
  }
43
50
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-memory",
3
3
  "description": "Memory provider registry for self-evolution (community build)",
4
- "version": "0.17.1",
4
+ "version": "0.18.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@deepseek-ai/schemastery": "^3.18.1"
29
+ "@deepseek-ai/schemastery": "^3.18.4"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@deepseek-ai/cordis": "^4.0.1"