@lmzhen/dsh-memory 0.2.0 → 0.2.1
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 +8 -2
- package/lib/types/index.d.ts +14 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -25,8 +25,14 @@ var MemoryRegistry = class extends Service {
|
|
|
25
25
|
read(target, signal) {
|
|
26
26
|
return this.provider().read(target, signal);
|
|
27
27
|
}
|
|
28
|
-
applyBatch(target, operations, signal) {
|
|
29
|
-
|
|
28
|
+
async applyBatch(target, operations, signal) {
|
|
29
|
+
const result = await this.provider().applyBatch(target, operations, signal);
|
|
30
|
+
if (result.ok) this.ctx.emit("evolution/memory-applied", {
|
|
31
|
+
target,
|
|
32
|
+
chars: result.chars,
|
|
33
|
+
entries: result.entries.length
|
|
34
|
+
});
|
|
35
|
+
return result;
|
|
30
36
|
}
|
|
31
37
|
snapshot(signal) {
|
|
32
38
|
return this.provider().snapshot(signal);
|
package/lib/types/index.d.ts
CHANGED
|
@@ -18,6 +18,20 @@ export interface MemoryApplyResult {
|
|
|
18
18
|
chars: number;
|
|
19
19
|
limit: number;
|
|
20
20
|
}
|
|
21
|
+
/** Fired after ANY successful memory write (P2 fix): the snapshot refresh
|
|
22
|
+
* moved to the registry sink so bypass paths (`/graph memory:`, background
|
|
23
|
+
* review direct writes) also refresh the model-visible snapshot — not only
|
|
24
|
+
* the foreground `memory` tool's write callback. */
|
|
25
|
+
export interface EvolutionMemoryAppliedEvent {
|
|
26
|
+
target: MemoryTarget;
|
|
27
|
+
chars: number;
|
|
28
|
+
entries: number;
|
|
29
|
+
}
|
|
30
|
+
declare module '@deepseek-ai/cordis' {
|
|
31
|
+
interface Events {
|
|
32
|
+
'evolution/memory-applied'(event: EvolutionMemoryAppliedEvent): void;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
21
35
|
export interface MemorySnapshot {
|
|
22
36
|
version: number;
|
|
23
37
|
sha256: string;
|