lianrouter 2.3.1 → 2.3.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/cli.js +8 -5
- package/dist/tray.js +12 -7
- package/package.json +43 -43
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ var package_default;
|
|
|
17
17
|
var init_package = __esm(() => {
|
|
18
18
|
package_default = {
|
|
19
19
|
name: "lianrouter",
|
|
20
|
-
version: "2.3.
|
|
20
|
+
version: "2.3.3",
|
|
21
21
|
description: "LianRouter launcher: install, run and control the gateway from one command",
|
|
22
22
|
type: "module",
|
|
23
23
|
bin: {
|
|
@@ -861,6 +861,7 @@ var init_engine = __esm(() => {
|
|
|
861
861
|
import { existsSync as existsSync2, mkdirSync, readFileSync } from "fs";
|
|
862
862
|
import { homedir } from "os";
|
|
863
863
|
import { dirname as dirname2, join as join5, resolve as resolve3 } from "path";
|
|
864
|
+
import { fileURLToPath } from "url";
|
|
864
865
|
function resolveInstallRoot(env = process.env, platform = process.platform) {
|
|
865
866
|
const override = env[HOME_ENV];
|
|
866
867
|
if (override !== undefined && override.trim() !== "") {
|
|
@@ -922,7 +923,7 @@ function ensureStateDirs(installRoot = resolveInstallRoot()) {
|
|
|
922
923
|
mkdirSync(dir, { recursive: true });
|
|
923
924
|
}
|
|
924
925
|
}
|
|
925
|
-
function resolveDevRepoRoot(startDir =
|
|
926
|
+
function resolveDevRepoRoot(startDir = moduleDir) {
|
|
926
927
|
let current = resolve3(startDir);
|
|
927
928
|
for (;; ) {
|
|
928
929
|
if (isRepoRoot(current)) {
|
|
@@ -963,8 +964,10 @@ function consoleUrl(port, host = "localhost") {
|
|
|
963
964
|
function healthUrl(port) {
|
|
964
965
|
return `http://127.0.0.1:${port}/health`;
|
|
965
966
|
}
|
|
966
|
-
var HOME_ENV = "LIANROUTER_HOME", APP_DIR_NAME = "LianRouter", LOGS_DIR = "logs", CACHE_DIR = "cache", RUN_DIR = "run", UPDATE_CACHE_DIR = "updates", CONFIG_FILE_NAME = ".env", LOG_FILE_NAME = "lianrouter.log", PID_FILE_NAME = "lianrouter.pid", CONTROL_FILE_NAME = "control.json", TRAY_PID_FILE_NAME = "tray.pid", DEFAULT_PORT = 12800;
|
|
967
|
-
var init_paths = () => {
|
|
967
|
+
var moduleDir, HOME_ENV = "LIANROUTER_HOME", APP_DIR_NAME = "LianRouter", LOGS_DIR = "logs", CACHE_DIR = "cache", RUN_DIR = "run", UPDATE_CACHE_DIR = "updates", CONFIG_FILE_NAME = ".env", LOG_FILE_NAME = "lianrouter.log", PID_FILE_NAME = "lianrouter.pid", CONTROL_FILE_NAME = "control.json", TRAY_PID_FILE_NAME = "tray.pid", DEFAULT_PORT = 12800;
|
|
968
|
+
var init_paths = __esm(() => {
|
|
969
|
+
moduleDir = dirname2(fileURLToPath(import.meta.url));
|
|
970
|
+
});
|
|
968
971
|
|
|
969
972
|
// cli/tui/terminal.ts
|
|
970
973
|
function enterAltScreen() {
|
|
@@ -2951,7 +2954,7 @@ function resolveTrayEntry(options) {
|
|
|
2951
2954
|
return trayEntryCandidates(options).find((candidate) => existsSync4(candidate));
|
|
2952
2955
|
}
|
|
2953
2956
|
function trayEntryCandidates(options) {
|
|
2954
|
-
const bundleDir = options.bundleDir ??
|
|
2957
|
+
const bundleDir = options.bundleDir ?? moduleDir;
|
|
2955
2958
|
const candidates = [];
|
|
2956
2959
|
if (options.devRepoRoot !== undefined) {
|
|
2957
2960
|
candidates.push(join7(options.devRepoRoot, "cli", "dist", "tray.js"));
|
package/dist/tray.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// cli/tray/host.ts
|
|
3
3
|
import { mkdirSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
|
|
4
|
-
import { dirname as
|
|
4
|
+
import { dirname as dirname3, join as join4 } from "path";
|
|
5
5
|
|
|
6
6
|
// cli/tray/connection.ts
|
|
7
7
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -422,6 +422,11 @@ function createRepeatSuppressor(windowMs, now) {
|
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
+
// cli/src/paths.ts
|
|
426
|
+
import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
427
|
+
import { fileURLToPath } from "url";
|
|
428
|
+
var moduleDir = dirname2(fileURLToPath(import.meta.url));
|
|
429
|
+
|
|
425
430
|
// cli/tray/pump.ts
|
|
426
431
|
import { JSCallback, ptr as ptr2 } from "bun:ffi";
|
|
427
432
|
|
|
@@ -1075,10 +1080,10 @@ async function watchUpdate(options) {
|
|
|
1075
1080
|
var TOOLTIP_UNREACHABLE = "LianRouter \u2014 control unreachable";
|
|
1076
1081
|
var TOOLTIP_REFRESH_MS = 15000;
|
|
1077
1082
|
function trayPidPath(installRoot) {
|
|
1078
|
-
return
|
|
1083
|
+
return join4(installRoot, "run", "tray.pid");
|
|
1079
1084
|
}
|
|
1080
1085
|
function claimTrayPidFile(path) {
|
|
1081
|
-
mkdirSync(
|
|
1086
|
+
mkdirSync(dirname3(path), { recursive: true });
|
|
1082
1087
|
try {
|
|
1083
1088
|
const raw = readFileSync3(path, "utf8").trim();
|
|
1084
1089
|
const existing = Number.parseInt(raw, 10);
|
|
@@ -1222,7 +1227,7 @@ async function main() {
|
|
|
1222
1227
|
if (command === TRAY_COMMANDS.exit) {
|
|
1223
1228
|
const result = await callRecovering({
|
|
1224
1229
|
installRoot,
|
|
1225
|
-
startDir:
|
|
1230
|
+
startDir: moduleDir,
|
|
1226
1231
|
deps: recoveryDeps,
|
|
1227
1232
|
...knownPort === undefined ? {} : { gatewayPort: knownPort },
|
|
1228
1233
|
call: (client) => client.shutdown()
|
|
@@ -1236,7 +1241,7 @@ async function main() {
|
|
|
1236
1241
|
await openConsoleGuard.run(command, async () => {
|
|
1237
1242
|
const result = await callRecovering({
|
|
1238
1243
|
installRoot,
|
|
1239
|
-
startDir:
|
|
1244
|
+
startDir: moduleDir,
|
|
1240
1245
|
deps: recoveryDeps,
|
|
1241
1246
|
...knownPort === undefined ? {} : { gatewayPort: knownPort },
|
|
1242
1247
|
call: (client) => client.openWeb()
|
|
@@ -1253,7 +1258,7 @@ async function main() {
|
|
|
1253
1258
|
if (command === TRAY_COMMANDS.checkUpdate) {
|
|
1254
1259
|
const accepted = await callRecovering({
|
|
1255
1260
|
installRoot,
|
|
1256
|
-
startDir:
|
|
1261
|
+
startDir: moduleDir,
|
|
1257
1262
|
deps: recoveryDeps,
|
|
1258
1263
|
...knownPort === undefined ? {} : { gatewayPort: knownPort },
|
|
1259
1264
|
call: (client) => client.startUpdate()
|
|
@@ -1268,7 +1273,7 @@ async function main() {
|
|
|
1268
1273
|
}
|
|
1269
1274
|
const result = await callRecovering({
|
|
1270
1275
|
installRoot,
|
|
1271
|
-
startDir:
|
|
1276
|
+
startDir: moduleDir,
|
|
1272
1277
|
deps: recoveryDeps,
|
|
1273
1278
|
...knownPort === undefined ? {} : { gatewayPort: knownPort },
|
|
1274
1279
|
call: (client) => command === TRAY_COMMANDS.restart ? client.restart() : client.stop()
|
package/package.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "lianrouter",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"description": "LianRouter launcher: install, run and control the gateway from one command",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"lianrouter": "dist/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"engines": {
|
|
10
|
-
"bun": ">=1.4.2"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "bun run ../scripts/build-cli.ts",
|
|
18
|
-
"typecheck": "tsc --noEmit -p .",
|
|
19
|
-
"postinstall": "echo lianrouter: the gateway binary installs on first run, not during this install",
|
|
20
|
-
"prepublishOnly": "bun run build"
|
|
21
|
-
},
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/ReXooGen/Lian-Router.git",
|
|
25
|
-
"directory": "cli"
|
|
26
|
-
},
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": "https://github.com/ReXooGen/Lian-Router/issues"
|
|
29
|
-
},
|
|
30
|
-
"homepage": "https://github.com/ReXooGen/Lian-Router#readme",
|
|
31
|
-
"publishConfig": {
|
|
32
|
-
"access": "public"
|
|
33
|
-
},
|
|
34
|
-
"keywords": [
|
|
35
|
-
"lianrouter",
|
|
36
|
-
"ai-gateway",
|
|
37
|
-
"openai-compatible",
|
|
38
|
-
"llm-router",
|
|
39
|
-
"self-hosted",
|
|
40
|
-
"cli",
|
|
41
|
-
"launcher"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "lianrouter",
|
|
3
|
+
"version": "2.3.3",
|
|
4
|
+
"description": "LianRouter launcher: install, run and control the gateway from one command",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"lianrouter": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"bun": ">=1.4.2"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "bun run ../scripts/build-cli.ts",
|
|
18
|
+
"typecheck": "tsc --noEmit -p .",
|
|
19
|
+
"postinstall": "echo lianrouter: the gateway binary installs on first run, not during this install",
|
|
20
|
+
"prepublishOnly": "bun run build"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/ReXooGen/Lian-Router.git",
|
|
25
|
+
"directory": "cli"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/ReXooGen/Lian-Router/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/ReXooGen/Lian-Router#readme",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"lianrouter",
|
|
36
|
+
"ai-gateway",
|
|
37
|
+
"openai-compatible",
|
|
38
|
+
"llm-router",
|
|
39
|
+
"self-hosted",
|
|
40
|
+
"cli",
|
|
41
|
+
"launcher"
|
|
42
|
+
]
|
|
43
|
+
}
|