dreamd-mcp 1.4.0 → 1.4.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/README.md CHANGED
@@ -72,7 +72,7 @@ git add .agent .gitignore && git commit -m "Add dreamd memory" -- .agent .gitign
72
72
 
73
73
  **Windows.** This shim ships no Windows binary: on native Windows `npx -y dreamd-mcp` exits 1 and points you at WSL2. A `dreamd.exe` built from source runs learn, the learning cycle and the Tantivy index; start `dreamd watch` before `dreamd mcp` ([docs/windows.md](https://github.com/botzrDev/dreamd/blob/main/docs/windows.md)).
74
74
 
75
- **Signals and exit status.** The shim passes SIGINT, SIGTERM and SIGHUP to `dreamd` and waits for it to exit. It exits with `dreamd`'s exit code, and if `dreamd` dies of a signal, the shim dies of the same signal. A binary that cannot start makes the shim exit 1 and print the binary's path. On Windows the shim passes nothing on: the console already sends Ctrl-C to `dreamd`, and the shim waits for it. Under `npx`, npm runs the shim through `sh -c`. Where `/bin/sh` is dash, as on Debian and Ubuntu, a SIGTERM sent to the `npm exec` process stops only that shell, and npm ignores SIGINT; send the signal to the process group, or press Ctrl-C in the terminal.
75
+ **Signals and exit status.** The shim passes SIGINT, SIGTERM and SIGHUP to `dreamd` and waits for it to exit. It exits with `dreamd`'s exit code, and if `dreamd` dies of a signal, the shim dies of the same signal. A binary that cannot start makes the shim exit 1 and print the binary's path. On Windows the shim passes nothing on: the console already sends Ctrl-C to `dreamd`, and the shim waits for it. Under `npx`, npm runs the shim through `sh -c`. Where `/bin/sh` is dash, as on Debian and Ubuntu, a SIGTERM sent to the `npm exec` process stops only that shell. The shim notices within a second that the process it started under is gone, and sends `dreamd` a SIGTERM, so `watch` stops and removes its socket. So any harness or script that kills `npm exec` also stops the server it started. npm ignores SIGINT, so to interrupt `npx … watch` press Ctrl-C in the terminal, or send SIGTERM.
76
76
 
77
77
  > **Leave `npx dreamd-mcp` floating; don't pin.** On a fresh spawn, npx re-resolves the `latest` dist-tag, so a floating config always starts the current version. A running MCP server or `dreamd watch` daemon keeps the version it started with until you restart it, and an offline run falls back to the last-cached binary.
78
78
 
package/bin/dreamd-mcp.js CHANGED
@@ -282,6 +282,9 @@ function exitCodeFor(code, signal) {
282
282
  return typeof n === 'number' ? 128 + n : 1;
283
283
  }
284
284
 
285
+ // How often the shim checks whether its parent is gone (DRM-160).
286
+ const ORPHAN_POLL_MS = 500;
287
+
285
288
  // Run the native binary and settle when it is gone. Never rejects. The child
286
289
  // shares the shim's stdio, so the JSON-RPC bytes of `dreamd mcp` pass straight
287
290
  // through; the shim itself writes nothing to stdout.
@@ -295,10 +298,12 @@ function runChild(bin, args, env) {
295
298
  for (const [sig, fn] of listeners) process.removeListener(sig, fn);
296
299
  listeners.length = 0;
297
300
  };
301
+ let orphanTimer = null;
298
302
  const settle = () => {
299
303
  if (done) return false;
300
304
  done = true;
301
305
  removeListeners();
306
+ if (orphanTimer) clearInterval(orphanTimer);
302
307
  return true;
303
308
  };
304
309
  try {
@@ -327,6 +332,26 @@ function runChild(bin, args, env) {
327
332
  process.on(sig, fn);
328
333
  listeners.push([sig, fn]);
329
334
  }
335
+ // The orphan rule (DRM-160). Under `npx`, the shim's parent is npm's
336
+ // `sh -c`. Where /bin/sh is dash, a SIGTERM to `npm exec` kills that
337
+ // shell and is never passed on, so the shim and the native `watch` kept
338
+ // running. When the parent the shim started under is gone, the shim is
339
+ // reparented: it then stops the child as if it had got SIGTERM. For
340
+ // `dreamd mcp` this changes nothing, since stdin EOF already ends it.
341
+ if (process.platform !== 'win32') {
342
+ const parent = process.ppid;
343
+ orphanTimer = setInterval(() => {
344
+ if (process.ppid === parent) return;
345
+ clearInterval(orphanTimer);
346
+ try {
347
+ child.kill('SIGTERM');
348
+ } catch {
349
+ // The child is already gone; its 'exit' settles.
350
+ }
351
+ }, ORPHAN_POLL_MS);
352
+ // The child keeps the shim alive; the timer must not.
353
+ orphanTimer.unref();
354
+ }
330
355
  child.on('error', (err) => {
331
356
  if (!settle()) return;
332
357
  process.stderr.write(`[dreamd-mcp] could not start ${bin}: ${err.code}: ${err.message}\n`);
package/manifest.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
- "version": "1.4.0",
2
+ "version": "1.4.1",
3
3
  "binaries": {
4
4
  "linux-x86_64": {
5
- "sha256": "a8fc1ece8cb1e90351ed941051d78661a68fcc012a5fa1e8cab2b266bff6bca4"
5
+ "sha256": "a0a42ae375198a81a484df3341fea78a0f6beff9e3a910ea2bc795a871fbcae9"
6
6
  },
7
7
  "darwin-x86_64": {
8
- "sha256": "5775bf1712e65c7242db51e107e2fcb7b3adcf00ec8939809a43b81ba3ddd306"
8
+ "sha256": "d7c0fe1971c439e5fe36a6bd20c48344ec98a3c5301f3698d6b84e726e0f98ba"
9
9
  },
10
10
  "darwin-aarch64": {
11
- "sha256": "34a3f17e5c548c41aa356b0973ba00f761c340e44ea11bbf755d4cc056333d82"
11
+ "sha256": "ca37ab40d5beda4f873980b838e7422c8f9b2c9ed47a6ac93067ce0d7578be95"
12
12
  }
13
13
  }
14
14
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dreamd-mcp",
3
3
  "mcpName": "io.github.botzrDev/dreamd",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "description": "Shared memory for Claude Code, Cursor, and Cline, in files you can audit. Trace a bad memory and remove it with a receipt. Local-first MCP server.",
6
6
  "keywords": [
7
7
  "mcp",