@tonyclaw/llm-inspector 1.6.2 → 1.6.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/.output/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { spawn } from "node:child_process";
4
+ import { spawn, execSync } from "node:child_process";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { dirname, join } from "node:path";
7
7
  import { existsSync } from "node:fs";
@@ -9,6 +9,29 @@ var __filename = fileURLToPath(import.meta.url);
9
9
  var __dirname = dirname(__filename);
10
10
  var DEFAULT_PORT = 25947;
11
11
  var findBun = () => {
12
+ try {
13
+ const cmd = process.platform === "win32" ? "where bun" : "which bun";
14
+ const output = execSync(cmd, { encoding: "utf8", timeout: 5e3 }).trim();
15
+ if (!output) return null;
16
+ const firstLine = output.split("\n")[0] ?? "";
17
+ const firstPath = firstLine.trim();
18
+ if (!firstPath) return null;
19
+ if (process.platform === "win32" && firstPath.endsWith(".cmd")) {
20
+ const dir = join(firstPath, "..");
21
+ const actualPath = join(dir, "node_modules", "bun", "bin", "bun.exe");
22
+ if (existsSync(actualPath)) {
23
+ return actualPath;
24
+ }
25
+ const exePath = join(dir, "bun.exe");
26
+ if (existsSync(exePath)) {
27
+ return exePath;
28
+ }
29
+ }
30
+ if (existsSync(firstPath)) {
31
+ return firstPath;
32
+ }
33
+ } catch {
34
+ }
12
35
  const pathEnv = process.env.PATH ?? "";
13
36
  const pathDirs = pathEnv.split(process.platform === "win32" ? ";" : ":");
14
37
  for (const dir of pathDirs) {
@@ -32,6 +55,7 @@ var findBun = () => {
32
55
  join(appData, "bun", "bin", "bun.exe"),
33
56
  join(userProfile, "AppData", "Local", "bun", "bin", "bun.exe"),
34
57
  join(userProfile, "AppData", "Roaming", "npm", "node_modules", "bun", "bin", "bun.exe"),
58
+ join(userProfile, "AppData", "Roaming", "npm", "bun.exe"),
35
59
  join(userProfile, "AppData", "Roaming", "npm", "bun")
36
60
  ];
37
61
  for (const bunPath2 of commonPaths) {
@@ -1,5 +1,5 @@
1
1
  {
2
- "date": "2026-06-03T07:56:05.905Z",
2
+ "date": "2026-06-03T08:06:17.001Z",
3
3
  "preset": "bun",
4
4
  "framework": {
5
5
  "name": "nitro",
@@ -93,52 +93,52 @@ const headers = ((m) => function headersRouteRule(event) {
93
93
  }
94
94
  });
95
95
  const assets = {
96
- "/assets/alibaba-TTwafVwX.svg": {
97
- "type": "image/svg+xml",
98
- "etag": '"171b-6dyV5K8QjiaY35sN9qNprh9zDIs"',
99
- "mtime": "2026-06-03T07:55:59.581Z",
100
- "size": 5915,
101
- "path": "../public/assets/alibaba-TTwafVwX.svg"
102
- },
103
96
  "/assets/index-B3RwBPLW.css": {
104
97
  "type": "text/css; charset=utf-8",
105
98
  "etag": '"10c74-aXacU4DRFVsUwcC5jHnjoPRSlTA"',
106
- "mtime": "2026-06-03T07:55:59.583Z",
99
+ "mtime": "2026-06-03T08:06:11.052Z",
107
100
  "size": 68724,
108
101
  "path": "../public/assets/index-B3RwBPLW.css"
109
102
  },
110
- "/assets/main-Cp8AM0Pa.js": {
111
- "type": "text/javascript; charset=utf-8",
112
- "etag": '"4db57-FpqlPRLq9OHoaAFCL2NIXtZbW5c"',
113
- "mtime": "2026-06-03T07:55:59.583Z",
114
- "size": 318295,
115
- "path": "../public/assets/main-Cp8AM0Pa.js"
116
- },
117
- "/assets/qwen-CONDcHqt.png": {
118
- "type": "image/png",
119
- "etag": '"572c3-cdJAPaHdOvFCGzuaQjagdgOu6XE"',
120
- "mtime": "2026-06-03T07:55:59.581Z",
121
- "size": 357059,
122
- "path": "../public/assets/qwen-CONDcHqt.png"
103
+ "/assets/alibaba-TTwafVwX.svg": {
104
+ "type": "image/svg+xml",
105
+ "etag": '"171b-6dyV5K8QjiaY35sN9qNprh9zDIs"',
106
+ "mtime": "2026-06-03T08:06:11.050Z",
107
+ "size": 5915,
108
+ "path": "../public/assets/alibaba-TTwafVwX.svg"
123
109
  },
124
110
  "/assets/minimax-BPMzvuL-.jpeg": {
125
111
  "type": "image/jpeg",
126
112
  "etag": '"1b06-IwivU89ko5UTMUM1/t7hn4sQK9A"',
127
- "mtime": "2026-06-03T07:55:59.580Z",
113
+ "mtime": "2026-06-03T08:06:11.050Z",
128
114
  "size": 6918,
129
115
  "path": "../public/assets/minimax-BPMzvuL-.jpeg"
130
116
  },
131
117
  "/assets/zhipuai-BPNAnxo-.svg": {
132
118
  "type": "image/svg+xml",
133
119
  "etag": '"2bf8-hNaLCTi89nOFCsIIfWpP/jrfo0s"',
134
- "mtime": "2026-06-03T07:55:59.581Z",
120
+ "mtime": "2026-06-03T08:06:11.050Z",
135
121
  "size": 11256,
136
122
  "path": "../public/assets/zhipuai-BPNAnxo-.svg"
137
123
  },
124
+ "/assets/main-Cp8AM0Pa.js": {
125
+ "type": "text/javascript; charset=utf-8",
126
+ "etag": '"4db57-FpqlPRLq9OHoaAFCL2NIXtZbW5c"',
127
+ "mtime": "2026-06-03T08:06:11.052Z",
128
+ "size": 318295,
129
+ "path": "../public/assets/main-Cp8AM0Pa.js"
130
+ },
131
+ "/assets/qwen-CONDcHqt.png": {
132
+ "type": "image/png",
133
+ "etag": '"572c3-cdJAPaHdOvFCGzuaQjagdgOu6XE"',
134
+ "mtime": "2026-06-03T08:06:11.052Z",
135
+ "size": 357059,
136
+ "path": "../public/assets/qwen-CONDcHqt.png"
137
+ },
138
138
  "/assets/index-s4lwsWvq.js": {
139
139
  "type": "text/javascript; charset=utf-8",
140
140
  "etag": '"828c8-LEW/XL92J2/5lU4VKALlH7aVpaA"',
141
- "mtime": "2026-06-03T07:55:59.583Z",
141
+ "mtime": "2026-06-03T08:06:11.052Z",
142
142
  "size": 534728,
143
143
  "path": "../public/assets/index-s4lwsWvq.js"
144
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonyclaw/llm-inspector",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "type": "module",
5
5
  "description": "LLM API proxy inspector — captures and displays requests/responses from AI coding tools in a web UI",
6
6
  "license": "MIT",
package/src/cli.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from "node:child_process";
2
+ import { spawn, execSync } from "node:child_process";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { dirname, join } from "node:path";
5
5
  import { existsSync } from "node:fs";
@@ -11,7 +11,38 @@ const DEFAULT_PORT = 25947;
11
11
 
12
12
  // Find bun executable
13
13
  const findBun = (): string | null => {
14
- // Check if bun is in PATH
14
+ // Try running `where bun` (Windows) or `which bun` (Unix) to find in PATH
15
+ try {
16
+ const cmd = process.platform === "win32" ? "where bun" : "which bun";
17
+ const output = execSync(cmd, { encoding: "utf8", timeout: 5000 }).trim();
18
+ if (!output) return null;
19
+
20
+ // Take first line and handle Windows .cmd shim
21
+ const firstLine = output.split("\n")[0] ?? "";
22
+ const firstPath = firstLine.trim();
23
+ if (!firstPath) return null;
24
+
25
+ if (process.platform === "win32" && firstPath.endsWith(".cmd")) {
26
+ // npm shim - find actual exe
27
+ const dir = join(firstPath, "..");
28
+ const actualPath = join(dir, "node_modules", "bun", "bin", "bun.exe");
29
+ if (existsSync(actualPath)) {
30
+ return actualPath;
31
+ }
32
+ // Also try .exe directly in same directory
33
+ const exePath = join(dir, "bun.exe");
34
+ if (existsSync(exePath)) {
35
+ return exePath;
36
+ }
37
+ }
38
+ if (existsSync(firstPath)) {
39
+ return firstPath;
40
+ }
41
+ } catch {
42
+ // Command failed, continue with other methods
43
+ }
44
+
45
+ // Check PATH directories directly
15
46
  const pathEnv = process.env.PATH ?? "";
16
47
  const pathDirs = pathEnv.split(process.platform === "win32" ? ";" : ":");
17
48
 
@@ -20,7 +51,6 @@ const findBun = (): string | null => {
20
51
  if (existsSync(bunPath)) {
21
52
  // On Windows, npm shim is a script, not the actual exe
22
53
  if (process.platform === "win32" && !bunPath.endsWith(".exe")) {
23
- // Check if it's the npm shim and find the actual exe
24
54
  const actualPath = join(dir, "node_modules", "bun", "bin", "bun.exe");
25
55
  if (existsSync(actualPath)) {
26
56
  return actualPath;
@@ -41,6 +71,7 @@ const findBun = (): string | null => {
41
71
  join(appData, "bun", "bin", "bun.exe"),
42
72
  join(userProfile, "AppData", "Local", "bun", "bin", "bun.exe"),
43
73
  join(userProfile, "AppData", "Roaming", "npm", "node_modules", "bun", "bin", "bun.exe"),
74
+ join(userProfile, "AppData", "Roaming", "npm", "bun.exe"),
44
75
  join(userProfile, "AppData", "Roaming", "npm", "bun"),
45
76
  ];
46
77
  for (const bunPath of commonPaths) {