@max-null/dsh-memory 0.2.1 → 0.2.2

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/dist/engine.d.ts CHANGED
@@ -77,12 +77,12 @@ export declare class MemoryEngine extends Service {
77
77
  private facility?;
78
78
  constructor(ctx: import('@deepseek-ai/cordis').Context, config?: MemoryConfig);
79
79
  protected [Service.init](): Promise<void>;
80
- /** 打开两个存储域(init 与 reload 共用)。 */
81
- private openDomains;
80
+ /** 打开存储域(init 与 reload 共用;backend 复用已注册实例)。 */
81
+ private openFacility;
82
82
  /**
83
- * 强制重载存储:关闭两域后重开,放弃内存缓存重读文件。
84
- * 供外部编辑记忆文件后刷新(JsonStorageBackend 打开时加载一次,
85
- * 无 watch——2026-08-19 用户实测面板不感知外部编辑)。
83
+ * 强制重载存储:关闭两域后重开(unit 释放后 backend 重读文件),
84
+ * 放弃内存缓存。供外部编辑记忆文件后刷新(JsonStorageBackend 打开时
85
+ * 加载一次,无 watch——2026-08-19 用户实测面板不感知外部编辑)。
86
86
  */
87
87
  reload(): Promise<void>;
88
88
  /** Create one record in `suggested` status — never self-promoting. */
package/dist/engine.js CHANGED
@@ -58,15 +58,17 @@ export class MemoryEngine extends Service {
58
58
  this.config = config;
59
59
  }
60
60
  async [Service.init]() {
61
- await this.openDomains();
62
- this.ctx.effect(() => () => { void this.facility?.closeAll(); }, 'memory.domainsClose');
63
- }
64
- /** 打开两个存储域(init 与 reload 共用)。 */
65
- async openDomains() {
61
+ // backend 只注册一次:registry 对重名注册抛 duplicate-backend
62
+ // (storage/tests/registry.spec 实测),reload 不得重复注册。
66
63
  const globalBackend = new JsonStorageBackend(this.config.globalRoot ?? globalRoot());
67
64
  const projectBackend = new JsonStorageBackend(this.config.projectRoot ?? projectRoot());
68
65
  this.ctx.storage.backend.register('memory-global', globalBackend);
69
66
  this.ctx.storage.backend.register('memory-project', projectBackend);
67
+ await this.openFacility();
68
+ this.ctx.effect(() => () => { void this.facility?.closeAll(); }, 'memory.domainsClose');
69
+ }
70
+ /** 打开存储域(init 与 reload 共用;backend 复用已注册实例)。 */
71
+ async openFacility() {
70
72
  const facility = new DomainFacility(this.ctx, {
71
73
  backend: 'memory-global',
72
74
  routes: { memory_project: 'memory-project' },
@@ -78,13 +80,13 @@ export class MemoryEngine extends Service {
78
80
  this.projectTable = projectDomain.table('blocks');
79
81
  }
80
82
  /**
81
- * 强制重载存储:关闭两域后重开,放弃内存缓存重读文件。
82
- * 供外部编辑记忆文件后刷新(JsonStorageBackend 打开时加载一次,
83
- * 无 watch——2026-08-19 用户实测面板不感知外部编辑)。
83
+ * 强制重载存储:关闭两域后重开(unit 释放后 backend 重读文件),
84
+ * 放弃内存缓存。供外部编辑记忆文件后刷新(JsonStorageBackend 打开时
85
+ * 加载一次,无 watch——2026-08-19 用户实测面板不感知外部编辑)。
84
86
  */
85
87
  async reload() {
86
88
  await this.facility?.closeAll();
87
- await this.openDomains();
89
+ await this.openFacility();
88
90
  }
89
91
  /** Create one record in `suggested` status — never self-promoting. */
90
92
  async remember(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max-null/dsh-memory",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Cross-session plaintext memory plugin for the DeepSeek Harness — deterministic BM25 recall, human-owned, no embeddings",
5
5
  "license": "MIT",
6
6
  "publishConfig": {