@tonyclaw/llm-inspector 1.6.3 → 1.7.0

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.
@@ -1,10 +1,14 @@
1
1
  globalThis.__nitro_main__ = import.meta.url;
2
- import { a as FastResponse, s as serve } from "./_libs/srvx.mjs";
2
+ import { N as NodeResponse, s as serve } from "./_libs/srvx.mjs";
3
3
  import { d as defineHandler, H as HTTPError, t as toEventHandler, a as defineLazyEventHandler, b as H3Core } from "./_libs/h3.mjs";
4
4
  import { d as decodePath, w as withLeadingSlash, a as withoutTrailingSlash, j as joinURL } from "./_libs/ufo.mjs";
5
5
  import { promises } from "node:fs";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { dirname, resolve } from "node:path";
8
+ import "node:http";
9
+ import "node:stream";
10
+ import "node:https";
11
+ import "node:http2";
8
12
  import "./_libs/rou3.mjs";
9
13
  function lazyService(loader) {
10
14
  let promise, mod;
@@ -26,7 +30,7 @@ const services = {
26
30
  globalThis.__nitro_vite_envs__ = services;
27
31
  const errorHandler$1 = (error, event) => {
28
32
  const res = defaultHandler(error, event);
29
- return new FastResponse(typeof res.body === "string" ? res.body : JSON.stringify(res.body, null, 2), res);
33
+ return new NodeResponse(typeof res.body === "string" ? res.body : JSON.stringify(res.body, null, 2), res);
30
34
  };
31
35
  function defaultHandler(error, event, opts) {
32
36
  const isSensitive = error.unhandled;
@@ -93,52 +97,52 @@ const headers = ((m) => function headersRouteRule(event) {
93
97
  }
94
98
  });
95
99
  const assets = {
96
- "/assets/index-B3RwBPLW.css": {
97
- "type": "text/css; charset=utf-8",
98
- "etag": '"10c74-aXacU4DRFVsUwcC5jHnjoPRSlTA"',
99
- "mtime": "2026-06-03T08:06:11.052Z",
100
- "size": 68724,
101
- "path": "../public/assets/index-B3RwBPLW.css"
102
- },
103
100
  "/assets/alibaba-TTwafVwX.svg": {
104
101
  "type": "image/svg+xml",
105
102
  "etag": '"171b-6dyV5K8QjiaY35sN9qNprh9zDIs"',
106
- "mtime": "2026-06-03T08:06:11.050Z",
103
+ "mtime": "2026-06-03T08:20:44.008Z",
107
104
  "size": 5915,
108
105
  "path": "../public/assets/alibaba-TTwafVwX.svg"
109
106
  },
107
+ "/assets/index-B3RwBPLW.css": {
108
+ "type": "text/css; charset=utf-8",
109
+ "etag": '"10c74-aXacU4DRFVsUwcC5jHnjoPRSlTA"',
110
+ "mtime": "2026-06-03T08:20:44.011Z",
111
+ "size": 68724,
112
+ "path": "../public/assets/index-B3RwBPLW.css"
113
+ },
110
114
  "/assets/minimax-BPMzvuL-.jpeg": {
111
115
  "type": "image/jpeg",
112
116
  "etag": '"1b06-IwivU89ko5UTMUM1/t7hn4sQK9A"',
113
- "mtime": "2026-06-03T08:06:11.050Z",
117
+ "mtime": "2026-06-03T08:20:44.010Z",
114
118
  "size": 6918,
115
119
  "path": "../public/assets/minimax-BPMzvuL-.jpeg"
116
120
  },
117
121
  "/assets/zhipuai-BPNAnxo-.svg": {
118
122
  "type": "image/svg+xml",
119
123
  "etag": '"2bf8-hNaLCTi89nOFCsIIfWpP/jrfo0s"',
120
- "mtime": "2026-06-03T08:06:11.050Z",
124
+ "mtime": "2026-06-03T08:20:44.010Z",
121
125
  "size": 11256,
122
126
  "path": "../public/assets/zhipuai-BPNAnxo-.svg"
123
127
  },
124
128
  "/assets/main-Cp8AM0Pa.js": {
125
129
  "type": "text/javascript; charset=utf-8",
126
130
  "etag": '"4db57-FpqlPRLq9OHoaAFCL2NIXtZbW5c"',
127
- "mtime": "2026-06-03T08:06:11.052Z",
131
+ "mtime": "2026-06-03T08:20:44.011Z",
128
132
  "size": 318295,
129
133
  "path": "../public/assets/main-Cp8AM0Pa.js"
130
134
  },
131
135
  "/assets/qwen-CONDcHqt.png": {
132
136
  "type": "image/png",
133
137
  "etag": '"572c3-cdJAPaHdOvFCGzuaQjagdgOu6XE"',
134
- "mtime": "2026-06-03T08:06:11.052Z",
138
+ "mtime": "2026-06-03T08:20:44.010Z",
135
139
  "size": 357059,
136
140
  "path": "../public/assets/qwen-CONDcHqt.png"
137
141
  },
138
142
  "/assets/index-s4lwsWvq.js": {
139
143
  "type": "text/javascript; charset=utf-8",
140
144
  "etag": '"828c8-LEW/XL92J2/5lU4VKALlH7aVpaA"',
141
- "mtime": "2026-06-03T08:06:11.052Z",
145
+ "mtime": "2026-06-03T08:20:44.011Z",
142
146
  "size": 534728,
143
147
  "path": "../public/assets/index-s4lwsWvq.js"
144
148
  }
@@ -375,7 +379,6 @@ const host = process.env.NITRO_HOST || process.env.HOST;
375
379
  const cert = process.env.NITRO_SSL_CERT;
376
380
  const key = process.env.NITRO_SSL_KEY;
377
381
  const nitroApp = useNitroApp();
378
- let _fetch = nitroApp.fetch;
379
382
  serve({
380
383
  port,
381
384
  hostname: host,
@@ -383,11 +386,10 @@ serve({
383
386
  cert,
384
387
  key
385
388
  } : void 0,
386
- fetch: _fetch,
387
- bun: { websocket: void 0 }
389
+ fetch: nitroApp.fetch
388
390
  });
389
391
  trapUnhandledErrors();
390
- const bun = {};
392
+ const nodeServer = {};
391
393
  export {
392
- bun as default
394
+ nodeServer as default
393
395
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonyclaw/llm-inspector",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
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,89 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { spawn, execSync } from "node:child_process";
2
+ import { spawn } from "node:child_process";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { dirname, join } from "node:path";
5
- import { existsSync } from "node:fs";
6
5
 
7
6
  const __filename = fileURLToPath(import.meta.url);
8
7
  const __dirname = dirname(__filename);
9
8
 
10
9
  const DEFAULT_PORT = 25947;
11
10
 
12
- // Find bun executable
13
- const findBun = (): string | null => {
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
46
- const pathEnv = process.env.PATH ?? "";
47
- const pathDirs = pathEnv.split(process.platform === "win32" ? ";" : ":");
48
-
49
- for (const dir of pathDirs) {
50
- const bunPath = join(dir, process.platform === "win32" ? "bun.exe" : "bun");
51
- if (existsSync(bunPath)) {
52
- // On Windows, npm shim is a script, not the actual exe
53
- if (process.platform === "win32" && !bunPath.endsWith(".exe")) {
54
- const actualPath = join(dir, "node_modules", "bun", "bin", "bun.exe");
55
- if (existsSync(actualPath)) {
56
- return actualPath;
57
- }
58
- }
59
- return bunPath;
60
- }
61
- }
62
-
63
- // Common Windows paths
64
- if (process.platform === "win32") {
65
- const localAppData = process.env.LOCALAPPDATA ?? "";
66
- const appData = process.env.APPDATA ?? "";
67
- const userProfile = process.env.USERPROFILE ?? "";
68
-
69
- const commonPaths = [
70
- join(localAppData, "bun", "bin", "bun.exe"),
71
- join(appData, "bun", "bin", "bun.exe"),
72
- join(userProfile, "AppData", "Local", "bun", "bin", "bun.exe"),
73
- join(userProfile, "AppData", "Roaming", "npm", "node_modules", "bun", "bin", "bun.exe"),
74
- join(userProfile, "AppData", "Roaming", "npm", "bun.exe"),
75
- join(userProfile, "AppData", "Roaming", "npm", "bun"),
76
- ];
77
- for (const bunPath of commonPaths) {
78
- if (existsSync(bunPath)) {
79
- return bunPath;
80
- }
81
- }
82
- }
83
-
84
- return null;
85
- };
86
-
87
11
  const envPort = process.env["PORT"];
88
12
  const portDefault = envPort !== undefined ? Number(envPort) : DEFAULT_PORT;
89
13
 
@@ -157,22 +81,15 @@ if (open) {
157
81
  openBrowser(url);
158
82
  }
159
83
 
160
- // Find bun and start server
161
- const bunPath = findBun();
162
- if (bunPath === null) {
163
- console.error("\nError: bun is not installed or not in PATH.");
164
- console.error("Please install bun from https://bun.sh");
165
- process.exit(1);
166
- }
167
-
168
84
  // Compute server path
169
85
  const outputDir = __dirname;
170
86
  const serverPath = join(outputDir, "../.output/server/index.mjs");
171
87
 
172
- // Start server with bun
173
- const serverProcess = spawn(bunPath, [serverPath], {
88
+ // Start server with node
89
+ const serverProcess = spawn(process.execPath, [serverPath], {
174
90
  stdio: ["ignore", "inherit", "inherit"],
175
91
  detached: true,
92
+ env: { ...process.env },
176
93
  });
177
94
 
178
95
  serverProcess.unref();