nodedex 0.1.1 → 0.1.3

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": "nodedex",
3
- "version": "0.1.1",
4
- "mcpName": "io.github.nodedex/nodedex",
3
+ "version": "0.1.3",
4
+ "mcpName": "io.github.NodeDex/nodedex",
5
5
  "description": "NodeDex — persistent knowledge-graph memory (MCP server) for AI agents: decisions with their why, dead-ends, and causal chains, built automatically from your agent's conversations",
6
6
  "license": "AGPL-3.0-or-later",
7
7
  "repository": {
@@ -18,6 +18,14 @@ import { fileURLToPath, pathToFileURL } from "node:url";
18
18
  import { dirname, resolve, join } from "node:path";
19
19
  import { homedir } from "node:os";
20
20
 
21
+ // Fail CLEARLY on old Node — the entry + server use global fetch / AbortSignal.timeout
22
+ // (Node ≥ 18); without this guard an old runtime dies with a cryptic ReferenceError.
23
+ const nodeMajor = Number(process.versions.node.split(".")[0]);
24
+ if (nodeMajor < 18) {
25
+ console.error(`[nodedex] Node ${process.versions.node} is too old — NodeDex needs Node >= 18. Upgrade at https://nodejs.org`);
26
+ process.exit(1);
27
+ }
28
+
21
29
  const here = dirname(fileURLToPath(import.meta.url));
22
30
  const args = process.argv.slice(2);
23
31
  const cmd = (args[0] || "").toLowerCase();
@@ -16,7 +16,7 @@ import { Box, Text, useApp, useInput } from "ink";
16
16
  import { Logo } from "./components.js";
17
17
  import { theme } from "./theme.js";
18
18
  import { saveConfig, DEFAULT_PORT, DEFAULT_LOCAL_BASE_URL, RECOMMENDED_MODELS, isTrainsOnPrompts, validateOpenRouterKey, listDbs, dbPathForName, scanLocalModels, scanCaptureHosts, setHermesCapture, setClaudeCapture, } from "./config.js";
19
- import { launchServer, genToken, launchWatcher, stopWatcher } from "./servers.js";
19
+ import { launchServer, genToken, launchWatcher, stopWatcher, scanFreePorts } from "./servers.js";
20
20
  import { probeServer, setBase } from "./api.js";
21
21
  import { writeConnectSnippets } from "./connect-snippets.js";
22
22
  const README_URL = "https://github.com/NodeDex/NodeDex-v0.1#connect-your-agent";
@@ -106,22 +106,16 @@ export function Onboarding({ onDone }) {
106
106
  });
107
107
  return () => { cancelled = true; };
108
108
  }, [step, localScanNonce]);
109
- // Detect free ports when entering the port step (reuse probeServer: a port with no
110
- // Nodedex responding is free enough to claim; launch fails loudly otherwise).
109
+ // Detect free ports when entering the port step. scanFreePorts checks actual
110
+ // BINDABILITY (momentary bind + close), not just "no NodeDex answering" — a port
111
+ // held by any other app must never be offered, or the launch hangs and fails.
111
112
  useEffect(() => {
112
113
  if (step !== "port" || freePorts.length > 0)
113
114
  return;
114
115
  let cancelled = false;
115
116
  (async () => {
116
117
  setStatus("Scanning for free ports…");
117
- const found = [];
118
- for (const p of [3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008]) {
119
- const probe = await probeServer(`http://localhost:${p}`);
120
- if (!probe.up)
121
- found.push(p);
122
- if (found.length >= 5)
123
- break;
124
- }
118
+ const found = await scanFreePorts(undefined, 5);
125
119
  if (cancelled)
126
120
  return;
127
121
  setStatus("");
@@ -144,7 +138,9 @@ export function Onboarding({ onDone }) {
144
138
  return;
145
139
  }
146
140
  const url = `http://localhost:${port}`;
147
- const deadline = Date.now() + 30000;
141
+ // 60s: a first boot on a slow disk / AV-scanned Windows can take a while to
142
+ // import 400+ files; the embedder download is background and doesn't block listen.
143
+ const deadline = Date.now() + 60000;
148
144
  while (Date.now() < deadline) {
149
145
  const probe = await probeServer(url);
150
146
  if (probe.up) {