vibora 1.8.0 → 1.9.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.
- package/dist/assets/index-BxbgLbxS.css +1 -0
- package/dist/assets/{index-DP-OAlLv.js → index-CCtJOkVu.js} +63 -63
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/server/index.js +141 -0
- package/dist/assets/index-BMm5AnYN.js +0 -45
- package/dist/assets/index-BNhD6i8B.js +0 -45
- package/dist/assets/index-BfcOSnqG.css +0 -1
- package/dist/assets/index-Bj6X8q5U.js +0 -46
- package/dist/assets/index-BrWX1YZT.css +0 -1
- package/dist/assets/index-BxOt05pH.css +0 -1
- package/dist/assets/index-ByL08tgg.js +0 -45
- package/dist/assets/index-COn-Eyu7.css +0 -1
- package/dist/assets/index-ClQ5DUcr.js +0 -46
- package/dist/assets/index-Co_u49xL.css +0 -1
- package/dist/assets/index-DCMXlbkM.css +0 -1
- package/dist/assets/index-DDBvX7Ij.css +0 -1
- package/dist/assets/index-DJxCuTf-.js +0 -45
- package/dist/assets/index-DS5B_viR.js +0 -116
- package/dist/assets/index-DgP1TgfA.js +0 -45
- package/dist/assets/index-DijiKhVm.js +0 -46
- package/dist/assets/index-Djf_9c_I.css +0 -1
- package/dist/assets/index-Hcd8Y1ma.js +0 -45
- package/dist/assets/index-I_FT38E3.css +0 -1
- package/dist/assets/index-IdRTHnwv.js +0 -51
- package/dist/assets/index-ViklVZfD.js +0 -51
- package/dist/assets/index-Xk8D-HCD.css +0 -1
- package/dist/assets/index-f56gTmVJ.css +0 -1
- package/dist/assets/index-qBnZOT-E.js +0 -45
- package/dist/assets/index-r3_O3Fa_.js +0 -45
package/dist/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<link rel="icon" type="image/png" sizes="512x512" href="/vibora-icon.png" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>Vibora</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-CCtJOkVu.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BxbgLbxS.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -143986,6 +143986,147 @@ monitoringRoutes.get("/docker-stats", (c) => {
|
|
|
143986
143986
|
return c.json({ error: message }, 500);
|
|
143987
143987
|
}
|
|
143988
143988
|
});
|
|
143989
|
+
function getProcessEnv(pid) {
|
|
143990
|
+
try {
|
|
143991
|
+
const environ = readFileSync7(`/proc/${pid}/environ`, "utf-8");
|
|
143992
|
+
const env = {};
|
|
143993
|
+
for (const entry of environ.split("\x00")) {
|
|
143994
|
+
const idx = entry.indexOf("=");
|
|
143995
|
+
if (idx > 0) {
|
|
143996
|
+
env[entry.slice(0, idx)] = entry.slice(idx + 1);
|
|
143997
|
+
}
|
|
143998
|
+
}
|
|
143999
|
+
return env;
|
|
144000
|
+
} catch {
|
|
144001
|
+
return {};
|
|
144002
|
+
}
|
|
144003
|
+
}
|
|
144004
|
+
function getParentPid(pid) {
|
|
144005
|
+
try {
|
|
144006
|
+
const stat = readFileSync7(`/proc/${pid}/stat`, "utf-8");
|
|
144007
|
+
const match3 = stat.match(/^\d+ \([^)]+\) \S+ (\d+)/);
|
|
144008
|
+
return match3 ? parseInt(match3[1], 10) : null;
|
|
144009
|
+
} catch {
|
|
144010
|
+
return null;
|
|
144011
|
+
}
|
|
144012
|
+
}
|
|
144013
|
+
function findViboraInstances() {
|
|
144014
|
+
const backends = [];
|
|
144015
|
+
const frontends = [];
|
|
144016
|
+
try {
|
|
144017
|
+
const procDirs = readdirSync7("/proc").filter((d) => /^\d+$/.test(d));
|
|
144018
|
+
for (const pidStr of procDirs) {
|
|
144019
|
+
const pid = parseInt(pidStr, 10);
|
|
144020
|
+
try {
|
|
144021
|
+
const cmdline = readFileSync7(`/proc/${pid}/cmdline`, "utf-8").replace(/\0/g, " ");
|
|
144022
|
+
const env = getProcessEnv(pid);
|
|
144023
|
+
const parentPid = getParentPid(pid);
|
|
144024
|
+
const cmdParts = cmdline.trim().split(/\s+/);
|
|
144025
|
+
const isBunProcess = cmdParts[0]?.includes("bun") ?? false;
|
|
144026
|
+
const isDevBackend = isBunProcess && cmdline.includes("server/index.ts");
|
|
144027
|
+
const isProdBackend = isBunProcess && !!env.VIBORA_PACKAGE_ROOT;
|
|
144028
|
+
if (isDevBackend || isProdBackend) {
|
|
144029
|
+
const port = parseInt(env.PORT || "3333", 10);
|
|
144030
|
+
const cwd = getProcessCwd(pid);
|
|
144031
|
+
let viboraDir = env.VIBORA_DIR || (isDevBackend ? "~/.vibora/dev" : "~/.vibora");
|
|
144032
|
+
if (viboraDir.startsWith(".") && cwd !== "(unknown)") {
|
|
144033
|
+
viboraDir = cwd;
|
|
144034
|
+
}
|
|
144035
|
+
const mode = isDevBackend ? "development" : "production";
|
|
144036
|
+
backends.push({
|
|
144037
|
+
pid,
|
|
144038
|
+
port,
|
|
144039
|
+
viboraDir,
|
|
144040
|
+
mode,
|
|
144041
|
+
memoryMB: getProcessMemoryMB(pid),
|
|
144042
|
+
startedAt: getProcessStartTime(pid),
|
|
144043
|
+
parentPid
|
|
144044
|
+
});
|
|
144045
|
+
}
|
|
144046
|
+
const isNodeProcess = cmdParts[0]?.includes("node") ?? false;
|
|
144047
|
+
if (isNodeProcess && cmdline.includes("vite") && env.VITE_BACKEND_PORT) {
|
|
144048
|
+
const backendPort = parseInt(env.VITE_BACKEND_PORT, 10);
|
|
144049
|
+
const port = 5173;
|
|
144050
|
+
frontends.push({
|
|
144051
|
+
pid,
|
|
144052
|
+
port,
|
|
144053
|
+
memoryMB: getProcessMemoryMB(pid),
|
|
144054
|
+
startedAt: getProcessStartTime(pid),
|
|
144055
|
+
parentPid,
|
|
144056
|
+
backendPort
|
|
144057
|
+
});
|
|
144058
|
+
}
|
|
144059
|
+
} catch {}
|
|
144060
|
+
}
|
|
144061
|
+
} catch {}
|
|
144062
|
+
const groups = [];
|
|
144063
|
+
for (const backend of backends) {
|
|
144064
|
+
const associatedFrontend = frontends.find((f) => f.backendPort === backend.port || f.parentPid && f.parentPid === backend.parentPid);
|
|
144065
|
+
groups.push({
|
|
144066
|
+
viboraDir: backend.viboraDir,
|
|
144067
|
+
port: backend.port,
|
|
144068
|
+
mode: backend.mode,
|
|
144069
|
+
backend: {
|
|
144070
|
+
pid: backend.pid,
|
|
144071
|
+
memoryMB: backend.memoryMB,
|
|
144072
|
+
startedAt: backend.startedAt
|
|
144073
|
+
},
|
|
144074
|
+
frontend: associatedFrontend ? {
|
|
144075
|
+
pid: associatedFrontend.pid,
|
|
144076
|
+
memoryMB: associatedFrontend.memoryMB,
|
|
144077
|
+
startedAt: associatedFrontend.startedAt
|
|
144078
|
+
} : null,
|
|
144079
|
+
totalMemoryMB: backend.memoryMB + (associatedFrontend?.memoryMB || 0)
|
|
144080
|
+
});
|
|
144081
|
+
if (associatedFrontend) {
|
|
144082
|
+
const idx = frontends.indexOf(associatedFrontend);
|
|
144083
|
+
if (idx >= 0)
|
|
144084
|
+
frontends.splice(idx, 1);
|
|
144085
|
+
}
|
|
144086
|
+
}
|
|
144087
|
+
groups.sort((a, b) => a.port - b.port);
|
|
144088
|
+
return groups;
|
|
144089
|
+
}
|
|
144090
|
+
monitoringRoutes.get("/vibora-instances", (c) => {
|
|
144091
|
+
const groups = findViboraInstances();
|
|
144092
|
+
return c.json(groups);
|
|
144093
|
+
});
|
|
144094
|
+
monitoringRoutes.post("/vibora-instances/:pid/kill", async (c) => {
|
|
144095
|
+
const pidStr = c.req.param("pid");
|
|
144096
|
+
const backendPid = parseInt(pidStr, 10);
|
|
144097
|
+
if (isNaN(backendPid)) {
|
|
144098
|
+
return c.json({ error: "Invalid PID" }, 400);
|
|
144099
|
+
}
|
|
144100
|
+
const groups = findViboraInstances();
|
|
144101
|
+
const group = groups.find((g) => g.backend?.pid === backendPid);
|
|
144102
|
+
if (!group) {
|
|
144103
|
+
return c.json({ error: "Vibora instance not found" }, 404);
|
|
144104
|
+
}
|
|
144105
|
+
const killedPids = [];
|
|
144106
|
+
const pidsToKill = [
|
|
144107
|
+
group.frontend?.pid,
|
|
144108
|
+
group.backend?.pid
|
|
144109
|
+
].filter((p) => p !== null && p !== undefined);
|
|
144110
|
+
for (const pid of pidsToKill) {
|
|
144111
|
+
try {
|
|
144112
|
+
process.kill(pid, "SIGTERM");
|
|
144113
|
+
killedPids.push(pid);
|
|
144114
|
+
} catch {}
|
|
144115
|
+
}
|
|
144116
|
+
await new Promise((resolve4) => setTimeout(resolve4, 500));
|
|
144117
|
+
for (const pid of pidsToKill) {
|
|
144118
|
+
try {
|
|
144119
|
+
process.kill(pid, 0);
|
|
144120
|
+
process.kill(pid, "SIGKILL");
|
|
144121
|
+
} catch {}
|
|
144122
|
+
}
|
|
144123
|
+
return c.json({
|
|
144124
|
+
success: true,
|
|
144125
|
+
killed: killedPids,
|
|
144126
|
+
viboraDir: group.viboraDir,
|
|
144127
|
+
port: group.port
|
|
144128
|
+
});
|
|
144129
|
+
});
|
|
143989
144130
|
|
|
143990
144131
|
// server/app.ts
|
|
143991
144132
|
function getDistPath() {
|