@paytaca/opencode-plugin 0.1.2 → 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/dist/wallet.js CHANGED
@@ -45,10 +45,17 @@ const fs = __importStar(require("fs"));
45
45
  const util_1 = require("util");
46
46
  const path = __importStar(require("path"));
47
47
  const execAsync = (0, util_1.promisify)(require('child_process').exec);
48
- // Get the path to paytaca binary (local or global)
49
48
  function getPaytacaCommand() {
49
+ try {
50
+ const paytacaCliPkg = require.resolve('paytaca-cli/package.json');
51
+ return path.resolve(path.dirname(paytacaCliPkg), 'bin', 'paytaca.js');
52
+ }
53
+ catch { }
50
54
  const localPaytaca = path.join(__dirname, '..', 'node_modules', '.bin', 'paytaca');
51
- return fs.existsSync(localPaytaca) ? localPaytaca : 'paytaca';
55
+ if (fs.existsSync(localPaytaca)) {
56
+ return localPaytaca;
57
+ }
58
+ return 'paytaca';
52
59
  }
53
60
  const PAYTACA_CMD = getPaytacaCommand();
54
61
  async function checkWallet() {
@@ -82,12 +89,6 @@ async function checkWallet() {
82
89
  }
83
90
  async function checkPaytacaCli() {
84
91
  try {
85
- // Check if paytaca binary exists
86
- const fs = require('fs');
87
- if (!fs.existsSync(PAYTACA_CMD)) {
88
- return false;
89
- }
90
- // Test if it runs
91
92
  await execAsync(`"${PAYTACA_CMD}" --version`);
92
93
  return true;
93
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paytaca/opencode-plugin",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "OpenCode plugin for Paytaca AI - AI inference provider powered by Bitcoin Cash micropayments",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/wallet.ts CHANGED
@@ -6,10 +6,18 @@ import { WalletInfo } from './types';
6
6
 
7
7
  const execAsync = promisify(require('child_process').exec);
8
8
 
9
- // Get the path to paytaca binary (local or global)
10
9
  function getPaytacaCommand(): string {
10
+ try {
11
+ const paytacaCliPkg = require.resolve('paytaca-cli/package.json');
12
+ return path.resolve(path.dirname(paytacaCliPkg), 'bin', 'paytaca.js');
13
+ } catch {}
14
+
11
15
  const localPaytaca = path.join(__dirname, '..', 'node_modules', '.bin', 'paytaca');
12
- return fs.existsSync(localPaytaca) ? localPaytaca : 'paytaca';
16
+ if (fs.existsSync(localPaytaca)) {
17
+ return localPaytaca;
18
+ }
19
+
20
+ return 'paytaca';
13
21
  }
14
22
 
15
23
  const PAYTACA_CMD = getPaytacaCommand();
@@ -50,12 +58,6 @@ export async function checkWallet(): Promise<WalletInfo> {
50
58
 
51
59
  export async function checkPaytacaCli(): Promise<boolean> {
52
60
  try {
53
- // Check if paytaca binary exists
54
- const fs = require('fs');
55
- if (!fs.existsSync(PAYTACA_CMD)) {
56
- return false;
57
- }
58
- // Test if it runs
59
61
  await execAsync(`"${PAYTACA_CMD}" --version`);
60
62
  return true;
61
63
  } catch {