openclaw-autoproxy 1.0.0 → 1.0.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.
@@ -3,6 +3,7 @@
3
3
  import { spawn } from "node:child_process";
4
4
  import { existsSync } from "node:fs";
5
5
  import { readFile } from "node:fs/promises";
6
+ import { createRequire } from "node:module";
6
7
  import path from "node:path";
7
8
  import process from "node:process";
8
9
  import { fileURLToPath } from "node:url";
@@ -12,8 +13,22 @@ const args = process.argv.slice(2);
12
13
  const currentFilePath = fileURLToPath(import.meta.url);
13
14
  const packageRoot = path.resolve(path.dirname(currentFilePath), "..");
14
15
  const serverEntryPath = path.join(packageRoot, "src", "gateway", "server.ts");
15
- const tsxCliPath = path.join(packageRoot, "node_modules", "tsx", "dist", "cli.mjs");
16
16
  const packageJsonPath = path.join(packageRoot, "package.json");
17
+ const require = createRequire(import.meta.url);
18
+
19
+ function resolveTsxCliPath() {
20
+ const localTsxCliPath = path.join(packageRoot, "node_modules", "tsx", "dist", "cli.mjs");
21
+
22
+ if (existsSync(localTsxCliPath)) {
23
+ return localTsxCliPath;
24
+ }
25
+
26
+ try {
27
+ return require.resolve("tsx/dist/cli.mjs");
28
+ } catch {
29
+ return null;
30
+ }
31
+ }
17
32
 
18
33
  function printHelp() {
19
34
  console.log(`openclaw-autoproxy - OpenClaw Auto Gateway CLI
@@ -60,8 +75,12 @@ async function printVersion() {
60
75
  }
61
76
 
62
77
  function runTsxMode(tsxArgs) {
63
- if (!existsSync(tsxCliPath)) {
64
- console.error("Missing tsx runtime. Reinstall dependencies and try again.");
78
+ const tsxCliPath = resolveTsxCliPath();
79
+
80
+ if (!tsxCliPath || !existsSync(tsxCliPath)) {
81
+ console.error(
82
+ "Missing tsx runtime. Reinstall package or install tsx globally (npm i -g tsx) and try again.",
83
+ );
65
84
  process.exit(1);
66
85
  }
67
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-autoproxy",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Local model-switching proxy gateway with OpenAI-compatible APIs",
5
5
  "type": "module",
6
6
  "main": "src/gateway/server.ts",