@paydlux/agent 0.1.8 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +10 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -14,7 +14,8 @@
14
14
  // A seller should type one command and get a price, a link, and a key to paste
15
15
  // into their bot.
16
16
  import { createInterface } from "node:readline/promises";
17
- import { existsSync, readFileSync, writeFileSync, chmodSync } from "node:fs";
17
+ import { existsSync, readFileSync, writeFileSync, chmodSync, realpathSync } from "node:fs";
18
+ import { pathToFileURL } from "node:url";
18
19
  import { resolve } from "node:path";
19
20
  import { Keypair } from "@stellar/stellar-sdk";
20
21
  import { StellarVault, USDC_ISSUER } from "./vault.js";
@@ -437,7 +438,13 @@ export async function main() {
437
438
  return approver();
438
439
  bad(`unknown command "${cmd}".\n\n${HELP}`);
439
440
  }
440
- // Only run when this file is the entry point, so importing it in a test is safe.
441
- if (process.argv[1] && /cli\.(ts|js)$/.test(process.argv[1])) {
441
+ // Run only when this file is the entry point, so importing it in a test is safe.
442
+ // Compare realpaths, not the invocation string: npm's bin launcher runs this as
443
+ // .../node_modules/.bin/paydlux, which does not end in .js, so a name-based test
444
+ // silently turns the published `paydlux` command into a no-op.
445
+ const invoked = process.argv[1]
446
+ ? pathToFileURL(existsSync(process.argv[1]) ? realpathSync(process.argv[1]) : process.argv[1]).href
447
+ : undefined;
448
+ if (invoked === import.meta.url) {
442
449
  main().catch((e) => { console.error("failed:", e.message); process.exit(1); });
443
450
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paydlux/agent",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Payments for AI agents that a human approves. Spending mandates enforced on the Stellar ledger: 2-of-2 vault, pre-authorised transaction envelopes, HTTP 402, USDC.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",