nostr-bray 1.42.2 → 2.0.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.
Files changed (2) hide show
  1. package/dist/cli/index.js +23 -0
  2. package/package.json +3 -3
package/dist/cli/index.js CHANGED
@@ -540,4 +540,27 @@ else {
540
540
  ctx.destroy();
541
541
  pool.close();
542
542
  }
543
+ await exitCleanly();
544
+ }
545
+ /**
546
+ * Leave the process, rather than waiting for the event loop to drain.
547
+ *
548
+ * `pool.close()` asks nostr-tools to close its relay connections, but a relay
549
+ * that holds the socket open leaves a handle behind and Node then waits on it
550
+ * indefinitely — the command prints its result and never returns. That is fatal
551
+ * for scripting: `nostr-bray req ... | head` simply hangs.
552
+ *
553
+ * stdout is drained first. Writes to a pipe are asynchronous, so exiting
554
+ * immediately after a large `console.log` can truncate it.
555
+ */
556
+ async function exitCleanly() {
557
+ const stream = process.stdout;
558
+ if ((stream.writableLength ?? 0) > 0) {
559
+ await new Promise(resolve => {
560
+ stream.once('drain', () => resolve());
561
+ // Never block on a stalled consumer
562
+ setTimeout(resolve, 2_000).unref();
563
+ });
564
+ }
565
+ process.exit(process.exitCode ?? 0);
543
566
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "1.42.2",
3
+ "version": "2.0.0",
4
4
  "mcpName": "dev.forgesworn/bray",
5
5
  "description": "Trust-aware Nostr for AI and humans. Three dimensions of trust -- verification, proximity, and access -- woven into every interaction.",
6
6
  "type": "module",
@@ -149,7 +149,7 @@
149
149
  "homepage": "https://github.com/forgesworn/bray#readme",
150
150
  "license": "MIT",
151
151
  "engines": {
152
- "node": ">=20"
152
+ "node": ">=22.19.0"
153
153
  },
154
154
  "dependencies": {
155
155
  "@forgesworn/range-proof": "^2.0.1",
@@ -166,7 +166,7 @@
166
166
  "signet-protocol": "^1.1.0",
167
167
  "socks-proxy-agent": "^10.0.0",
168
168
  "spoken-token": "^2.0.3",
169
- "undici": "^7.25.0",
169
+ "undici": "^8.9.0",
170
170
  "ws": "^8.20.0",
171
171
  "zod": "^4.3.6"
172
172
  },