memex-mvp 0.10.8 → 0.10.9

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/cli/index.js CHANGED
@@ -1707,7 +1707,10 @@ Examples:
1707
1707
  memex web --port 9000 custom port
1708
1708
  memex web --public --token s3cret bind on 0.0.0.0 with bearer auth
1709
1709
  `);
1710
- return;
1710
+ // Help path: exit cleanly so the caller (server.js) doesn't fall through
1711
+ // to MCP-mode init, and Node doesn't warn about an unsettled top-level
1712
+ // await waiting on an HTTP server that was never started.
1713
+ process.exit(0);
1711
1714
  }
1712
1715
  else if (a.startsWith('--')) {
1713
1716
  console.error(`Unknown flag: ${a}`);
@@ -1734,7 +1737,12 @@ Examples:
1734
1737
 
1735
1738
  const { startServer } = await import('../web/index.js');
1736
1739
  await startServer(opts);
1737
- // startServer keeps the process alive on its own http server.
1740
+ // The HTTP server now holds the event loop open. Park on an unsettled
1741
+ // promise so cmdWeb never returns to the dispatcher — that way server.js
1742
+ // doesn't reach process.exit(0) below or fall through to MCP-mode init.
1743
+ // (Required because `await runCli(...)` would otherwise resolve as soon
1744
+ // as startServer's listen-callback fires.)
1745
+ await new Promise(() => {});
1738
1746
  }
1739
1747
 
1740
1748
  // =============================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memex-mvp",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Local-first MCP server for cross-agent AI memory. One SQLite + FTS5 corpus across Claude Code, Cowork, Cursor, Continue, Zed, Obsidian, and Telegram — passively captured, verbatim, searchable from any MCP-compatible client.",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -64,31 +64,23 @@ import { runCli, CLI_SUBCOMMAND_NAMES } from './lib/cli/index.js';
64
64
  //
65
65
  // This runs BEFORE any DB/watcher side-effects so the CLI doesn't open
66
66
  // the DB in write mode unnecessarily.
67
- // We use a labelled async IIFE so we can `break` (or just fall through)
68
- // without abusing top-level `return`, which is illegal in ESM modules.
69
67
  {
70
68
  const sub = process.argv[2];
71
69
  if (sub && CLI_SUBCOMMAND_NAMES.includes(sub)) {
70
+ // For long-running subs (currently only `web`), cmdWeb parks on an
71
+ // unsettled promise after starting the HTTP server, so this `await`
72
+ // never resolves and process.exit below is never reached. For one-shot
73
+ // subs (search, recent, telegram, …), runCli returns and we exit here.
72
74
  await runCli(sub, process.argv.slice(3));
73
- // 'web' is a long-running server — exiting here would kill it the moment
74
- // startServer's listen-callback resolves. Let the HTTP server hold the
75
- // event loop open instead.
76
- if (sub !== 'web') process.exit(0);
77
- } else if (sub && !sub.startsWith('-')) {
75
+ process.exit(0);
76
+ }
77
+ if (sub && !sub.startsWith('-')) {
78
78
  // Unknown positional subcommand — fail fast with help, don't drift
79
79
  // into MCP mode (which would just hang waiting for stdin).
80
80
  console.error(`Unknown subcommand: ${sub}`);
81
81
  console.error(`Run 'memex --help' for usage.`);
82
82
  process.exit(2);
83
83
  }
84
- // For 'web': fall through to the rest of server.js so it keeps running.
85
- // Actually no — the rest of server.js initializes MCP mode (stdin handler,
86
- // DB watchers). For 'web' we DON'T want that. Sentinel-exit instead:
87
- if (sub === 'web') {
88
- // Server is listening — nothing more for this process to do.
89
- // Just sit on the event loop until the HTTP server is closed.
90
- await new Promise(() => {});
91
- }
92
84
  // No args (or only flags we don't recognize) → MCP mode
93
85
  }
94
86