dsh-engram 0.8.7 → 0.9.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-engram",
3
3
  "description": "Minimalist long-term memory for DeepSeek Harness, distilling symbolic-index + pi-esr ideas: zero-LLM auto-capture, a symbolic [ENGRAM] index with progressive disclosure, and an ESR-lite evidence-closure protocol (esr_task / esr_node / esr_close / esr_link). Real agent-behaviour telemetry (usage rollup + /stats) and a deterministic offline recall benchmark (npm run eval). Hot path is model-free; storage on ctx.storageDomain; web memory viewer, observability panel and config card through DSH's native settings slots.",
4
- "version": "0.8.7",
4
+ "version": "0.9.0",
5
5
  "packageManager": "pnpm@11.22.0",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -118,39 +118,50 @@ async function discoverPresets(status, presetsDirFlag) {
118
118
  push(id, entry.path);
119
119
  }
120
120
 
121
- // 2. Legacy roots.
122
- for (const root of legacyPresetRoots()) {
121
+ // 2. An explicit --presets-dir wins over everything: the operator named it.
122
+ // Without this, a stale legacy composed-preset root (this machine has an
123
+ // older checkout beside the repo) claims the ids first, the declarative
124
+ // patch files are deduped away by id, and `status` reports the legacy
125
+ // layout while showing the declarative ones as "custom" (three CLI tests
126
+ // caught exactly this on Linux).
127
+ const scanDeclarative = async (dir) => {
123
128
  let entries = [];
124
129
  try {
125
- entries = await readdir(root, { withFileTypes: true });
130
+ entries = await readdir(dir, { withFileTypes: true });
126
131
  } catch {
127
- continue;
132
+ return;
128
133
  }
129
134
  for (const entry of entries) {
130
- if (!entry.isDirectory()) continue;
131
- const file = await compositionIn(join(root, entry.name));
132
- if (file === undefined) continue;
133
- push(entry.name, file);
135
+ if (!entry.isFile() || !entry.name.endsWith(".patch.yml")) continue;
136
+ push(entry.name.slice(0, -".patch.yml".length), join(dir, entry.name));
134
137
  }
135
- }
136
-
137
- // 3. Declarative shipped presets.
138
+ };
139
+ //
140
+ // Resolved once, up front: an explicit --presets-dir or DSH_WEB_PRESETS_DIR is
141
+ // the operator naming a directory, and the dsh-anchored default is the layout
142
+ // this DSH ships. Either beats a stale legacy root that only happens to exist.
138
143
  const presetsDir = discoverPresetsDir({
139
144
  presetsDir: presetsDirFlag,
140
145
  anchors: [dshBinAnchor()].filter((anchor) => typeof anchor === "string"),
141
146
  });
142
- if (presetsDir !== undefined) {
147
+ if (presetsDir !== undefined) await scanDeclarative(presetsDir);
148
+
149
+ // 3. Legacy roots.
150
+ for (const root of legacyPresetRoots()) {
143
151
  let entries = [];
144
152
  try {
145
- entries = await readdir(presetsDir, { withFileTypes: true });
153
+ entries = await readdir(root, { withFileTypes: true });
146
154
  } catch {
147
- entries = [];
155
+ continue;
148
156
  }
149
157
  for (const entry of entries) {
150
- if (!entry.isFile() || !entry.name.endsWith(".patch.yml")) continue;
151
- push(entry.name.slice(0, -".patch.yml".length), join(presetsDir, entry.name));
158
+ if (!entry.isDirectory()) continue;
159
+ const file = await compositionIn(join(root, entry.name));
160
+ if (file === undefined) continue;
161
+ push(entry.name, file);
152
162
  }
153
163
  }
164
+
154
165
  return presets;
155
166
  }
156
167
 
@@ -241,8 +252,9 @@ async function printStatus(presetsDirFlag) {
241
252
  // Printed from data, not from startup logs — a dormant leg must be visible
242
253
  // without the terminal that printed the warning.
243
254
  try {
244
- const home = process.env.DSH_HOME ?? join(homedir(), ".dsh");
245
- log(` ${describePushLegs(readPushLegsHealth(home))}`);
255
+ // `readLedger` above already resolves the same way: `<dsh home>/engram`.
256
+ const engramDir = join(process.env.DSH_HOME ?? join(homedir(), ".dsh"), "engram");
257
+ log(` ${describePushLegs(readPushLegsHealth(engramDir))}`);
246
258
  log("");
247
259
  } catch {}
248
260