agent402-tollbooth 0.10.0 → 0.10.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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.js +13 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # agent402-tollbooth
2
2
 
3
+ Part of [Agent402](https://agent402.tools), the open-source paid door for AI agents.
4
+
3
5
  **Open-source, self-hostable pay-per-crawl for x402 and MPP. Put it in front of
4
6
  any site or API: humans browse free, AI crawlers and agents pay per request** -
5
7
  in USDC over the [x402 protocol](https://x402.org), over
package/index.js CHANGED
@@ -12,7 +12,8 @@
12
12
  // The proof-of-work rail works out of the box with zero configuration. To also
13
13
  // accept USDC, set `payTo` and supply `verifyX402` (wire it to the standard
14
14
  // x402 server middleware / your facilitator — see README).
15
- import { fileURLToPath } from "node:url";
15
+ import { realpathSync } from "node:fs";
16
+ import { fileURLToPath, pathToFileURL } from "node:url";
16
17
  import { Readable } from "node:stream";
17
18
  import { randomBytes } from "node:crypto";
18
19
  import { createPow } from "./pow.js";
@@ -910,4 +911,14 @@ async function startCli() {
910
911
  });
911
912
  }
912
913
 
913
- if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) startCli();
914
+ // THE BIN SYMLINK. npm links the bin as `.bin/agent402-tollbooth`, so argv[1]
915
+ // is the SYMLINK path while import.meta.url is the realpath - they never match,
916
+ // and the documented install path (`npx agent402-tollbooth`) started nothing at
917
+ // all while `node index.js` worked fine. Exactly the defect found and fixed in
918
+ // agent402-openclaw 0.1.2; it survived here because every test invokes
919
+ // index.js by path, which is the one way to call it that cannot see the bug.
920
+ // Compare the REALPATH, the way openclaw/cli.js does.
921
+ function invokedDirectly() {
922
+ try { return import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href; } catch { return false; }
923
+ }
924
+ if (process.argv[1] && invokedDirectly()) startCli();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent402-tollbooth",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Agent402 tollbooth: open-source, self-hostable pay-per-crawl for x402 AND MPP (the sell side of Agentic Finance): charge AI bots per request (USDC via x402, or MPP - the Machine Payments Protocol - through the same settlement, or USDG on Robinhood Chain, or free proof-of-work) while humans browse free. Drop-in Express middleware or reverse proxy that settles both wires from env alone - no Cloudflare, no Stripe, no signup.",
5
5
  "type": "module",
6
6
  "main": "index.js",