@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.
- package/.output/cli.js +4 -68
- package/.output/nitro.json +3 -3
- package/.output/server/_chunks/ssr-renderer.mjs +4 -0
- package/.output/server/_libs/h3-v2.mjs +5 -5
- package/.output/server/_libs/h3.mjs +5 -5
- package/.output/server/_libs/react-dom.mjs +2074 -1228
- package/.output/server/_libs/readable-stream.mjs +3 -3
- package/.output/server/_libs/srvx.mjs +443 -47
- package/.output/server/_libs/util-deprecate.mjs +2 -2
- package/.output/server/_ssr/index-ByCLZu7J.mjs +4 -3
- package/.output/server/_ssr/index.mjs +7 -0
- package/.output/server/_ssr/router-Bq_mxeNz.mjs +3 -0
- package/.output/server/index.mjs +22 -20
- package/package.json +1 -1
- package/src/cli.ts +4 -87
package/.output/cli.js
CHANGED
|
@@ -1,71 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { spawn
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
|
-
import { existsSync } from "node:fs";
|
|
8
7
|
var __filename = fileURLToPath(import.meta.url);
|
|
9
8
|
var __dirname = dirname(__filename);
|
|
10
9
|
var DEFAULT_PORT = 25947;
|
|
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
|
-
}
|
|
35
|
-
const pathEnv = process.env.PATH ?? "";
|
|
36
|
-
const pathDirs = pathEnv.split(process.platform === "win32" ? ";" : ":");
|
|
37
|
-
for (const dir of pathDirs) {
|
|
38
|
-
const bunPath2 = join(dir, process.platform === "win32" ? "bun.exe" : "bun");
|
|
39
|
-
if (existsSync(bunPath2)) {
|
|
40
|
-
if (process.platform === "win32" && !bunPath2.endsWith(".exe")) {
|
|
41
|
-
const actualPath = join(dir, "node_modules", "bun", "bin", "bun.exe");
|
|
42
|
-
if (existsSync(actualPath)) {
|
|
43
|
-
return actualPath;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return bunPath2;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (process.platform === "win32") {
|
|
50
|
-
const localAppData = process.env.LOCALAPPDATA ?? "";
|
|
51
|
-
const appData = process.env.APPDATA ?? "";
|
|
52
|
-
const userProfile = process.env.USERPROFILE ?? "";
|
|
53
|
-
const commonPaths = [
|
|
54
|
-
join(localAppData, "bun", "bin", "bun.exe"),
|
|
55
|
-
join(appData, "bun", "bin", "bun.exe"),
|
|
56
|
-
join(userProfile, "AppData", "Local", "bun", "bin", "bun.exe"),
|
|
57
|
-
join(userProfile, "AppData", "Roaming", "npm", "node_modules", "bun", "bin", "bun.exe"),
|
|
58
|
-
join(userProfile, "AppData", "Roaming", "npm", "bun.exe"),
|
|
59
|
-
join(userProfile, "AppData", "Roaming", "npm", "bun")
|
|
60
|
-
];
|
|
61
|
-
for (const bunPath2 of commonPaths) {
|
|
62
|
-
if (existsSync(bunPath2)) {
|
|
63
|
-
return bunPath2;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
68
|
-
};
|
|
69
10
|
var envPort = process.env["PORT"];
|
|
70
11
|
var portDefault = envPort !== void 0 ? Number(envPort) : DEFAULT_PORT;
|
|
71
12
|
var args = process.argv.slice(2);
|
|
@@ -128,16 +69,11 @@ var openBrowser = (targetUrl) => {
|
|
|
128
69
|
if (open) {
|
|
129
70
|
openBrowser(url);
|
|
130
71
|
}
|
|
131
|
-
var bunPath = findBun();
|
|
132
|
-
if (bunPath === null) {
|
|
133
|
-
console.error("\nError: bun is not installed or not in PATH.");
|
|
134
|
-
console.error("Please install bun from https://bun.sh");
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
72
|
var outputDir = __dirname;
|
|
138
73
|
var serverPath = join(outputDir, "../.output/server/index.mjs");
|
|
139
|
-
var serverProcess = spawn(
|
|
74
|
+
var serverProcess = spawn(process.execPath, [serverPath], {
|
|
140
75
|
stdio: ["ignore", "inherit", "inherit"],
|
|
141
|
-
detached: true
|
|
76
|
+
detached: true,
|
|
77
|
+
env: { ...process.env }
|
|
142
78
|
});
|
|
143
79
|
serverProcess.unref();
|
package/.output/nitro.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"date": "2026-06-03T08:
|
|
3
|
-
"preset": "
|
|
2
|
+
"date": "2026-06-03T08:20:50.424Z",
|
|
3
|
+
"preset": "node-server",
|
|
4
4
|
"framework": {
|
|
5
5
|
"name": "nitro",
|
|
6
6
|
"version": ""
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"serverEntry": "server/index.mjs",
|
|
12
12
|
"publicDir": "public",
|
|
13
13
|
"commands": {
|
|
14
|
-
"preview": "
|
|
14
|
+
"preview": "node ./server/index.mjs"
|
|
15
15
|
},
|
|
16
16
|
"config": {}
|
|
17
17
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { H as HTTPError, c as toRequest } from "../_libs/h3.mjs";
|
|
2
2
|
import "../_libs/rou3.mjs";
|
|
3
3
|
import "../_libs/srvx.mjs";
|
|
4
|
+
import "node:http";
|
|
5
|
+
import "node:stream";
|
|
6
|
+
import "node:https";
|
|
7
|
+
import "node:http2";
|
|
4
8
|
function fetchViteEnv(viteEnvName, input, init) {
|
|
5
9
|
const envs = globalThis.__nitro_vite_envs__ || {};
|
|
6
10
|
const viteEnv = envs[viteEnvName];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { N as NullProtoObj } from "./rou3.mjs";
|
|
2
|
-
import { F as FastURL,
|
|
2
|
+
import { F as FastURL, N as NodeResponse } from "./srvx.mjs";
|
|
3
3
|
const kEventNS = "h3.internal.event.";
|
|
4
4
|
const kEventRes = /* @__PURE__ */ Symbol.for(`${kEventNS}res`);
|
|
5
5
|
const kEventResHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.headers`);
|
|
@@ -162,7 +162,7 @@ var HTTPResponse = class {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
function prepareResponse(val, event, config, nested) {
|
|
165
|
-
if (val === kHandled) return new
|
|
165
|
+
if (val === kHandled) return new NodeResponse(null);
|
|
166
166
|
if (val === kNotFound) val = new HTTPError({
|
|
167
167
|
status: 404,
|
|
168
168
|
message: `Cannot find any route matching [${event.req.method}] ${event.url}`
|
|
@@ -184,7 +184,7 @@ function prepareResponse(val, event, config, nested) {
|
|
|
184
184
|
if (!(val instanceof Response)) {
|
|
185
185
|
const res = prepareResponseBody(val, event, config);
|
|
186
186
|
const status = res.status || preparedRes?.status;
|
|
187
|
-
return new
|
|
187
|
+
return new NodeResponse(nullBody(event.req.method, status) ? null : res.body, {
|
|
188
188
|
status,
|
|
189
189
|
statusText: res.statusText || preparedRes?.statusText,
|
|
190
190
|
headers: res.headers && preparedHeaders ? mergeHeaders$1(res.headers, preparedHeaders) : res.headers || preparedHeaders
|
|
@@ -195,7 +195,7 @@ function prepareResponse(val, event, config, nested) {
|
|
|
195
195
|
mergeHeaders$1(val.headers, preparedHeaders, val.headers);
|
|
196
196
|
return val;
|
|
197
197
|
} catch {
|
|
198
|
-
return new
|
|
198
|
+
return new NodeResponse(nullBody(event.req.method, val.status) ? null : val.body, {
|
|
199
199
|
status: val.status,
|
|
200
200
|
statusText: val.statusText,
|
|
201
201
|
headers: mergeHeaders$1(val.headers, preparedHeaders)
|
|
@@ -260,7 +260,7 @@ function nullBody(method, status) {
|
|
|
260
260
|
return method === "HEAD" || status === 100 || status === 101 || status === 102 || status === 204 || status === 205 || status === 304;
|
|
261
261
|
}
|
|
262
262
|
function errorResponse(error, debug) {
|
|
263
|
-
return new
|
|
263
|
+
return new NodeResponse(JSON.stringify({
|
|
264
264
|
...error.toJSON(),
|
|
265
265
|
stack: debug && error.stack ? error.stack.split("\n").map((l) => l.trim()) : void 0
|
|
266
266
|
}, void 0, debug ? 2 : void 0), {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { N as NullProtoObj } from "./rou3.mjs";
|
|
2
|
-
import { F as FastURL,
|
|
2
|
+
import { F as FastURL, N as NodeResponse } from "./srvx.mjs";
|
|
3
3
|
const kEventNS = "h3.internal.event.";
|
|
4
4
|
const kEventRes = /* @__PURE__ */ Symbol.for(`${kEventNS}res`);
|
|
5
5
|
const kEventResHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.headers`);
|
|
@@ -162,7 +162,7 @@ var HTTPResponse = class {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
function prepareResponse(val, event, config, nested) {
|
|
165
|
-
if (val === kHandled) return new
|
|
165
|
+
if (val === kHandled) return new NodeResponse(null);
|
|
166
166
|
if (val === kNotFound) val = new HTTPError({
|
|
167
167
|
status: 404,
|
|
168
168
|
message: `Cannot find any route matching [${event.req.method}] ${event.url}`
|
|
@@ -184,7 +184,7 @@ function prepareResponse(val, event, config, nested) {
|
|
|
184
184
|
if (!(val instanceof Response)) {
|
|
185
185
|
const res = prepareResponseBody(val, event, config);
|
|
186
186
|
const status = res.status || preparedRes?.status;
|
|
187
|
-
return new
|
|
187
|
+
return new NodeResponse(nullBody(event.req.method, status) ? null : res.body, {
|
|
188
188
|
status,
|
|
189
189
|
statusText: res.statusText || preparedRes?.statusText,
|
|
190
190
|
headers: res.headers && preparedHeaders ? mergeHeaders$1(res.headers, preparedHeaders) : res.headers || preparedHeaders
|
|
@@ -195,7 +195,7 @@ function prepareResponse(val, event, config, nested) {
|
|
|
195
195
|
mergeHeaders$1(val.headers, preparedHeaders, val.headers);
|
|
196
196
|
return val;
|
|
197
197
|
} catch {
|
|
198
|
-
return new
|
|
198
|
+
return new NodeResponse(nullBody(event.req.method, val.status) ? null : val.body, {
|
|
199
199
|
status: val.status,
|
|
200
200
|
statusText: val.statusText,
|
|
201
201
|
headers: mergeHeaders$1(val.headers, preparedHeaders)
|
|
@@ -260,7 +260,7 @@ function nullBody(method, status) {
|
|
|
260
260
|
return method === "HEAD" || status === 100 || status === 101 || status === 102 || status === 204 || status === 205 || status === 304;
|
|
261
261
|
}
|
|
262
262
|
function errorResponse(error, debug) {
|
|
263
|
-
return new
|
|
263
|
+
return new NodeResponse(JSON.stringify({
|
|
264
264
|
...error.toJSON(),
|
|
265
265
|
stack: debug && error.stack ? error.stack.split("\n").map((l) => l.trim()) : void 0
|
|
266
266
|
}, void 0, debug ? 2 : void 0), {
|