@automagik/omni 2.260530.4 → 2.260530.5
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/index.js +1 -1
- package/dist/server/index.js +66 -66
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124965,7 +124965,7 @@ import { fileURLToPath } from "url";
|
|
|
124965
124965
|
// package.json
|
|
124966
124966
|
var package_default = {
|
|
124967
124967
|
name: "@automagik/omni",
|
|
124968
|
-
version: "2.260530.
|
|
124968
|
+
version: "2.260530.5",
|
|
124969
124969
|
description: "LLM-optimized CLI for Omni",
|
|
124970
124970
|
type: "module",
|
|
124971
124971
|
bin: {
|
package/dist/server/index.js
CHANGED
|
@@ -225239,7 +225239,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
225239
225239
|
var require_package7 = __commonJS((exports, module) => {
|
|
225240
225240
|
module.exports = {
|
|
225241
225241
|
name: "@omni/api",
|
|
225242
|
-
version: "2.260530.
|
|
225242
|
+
version: "2.260530.5",
|
|
225243
225243
|
type: "module",
|
|
225244
225244
|
exports: {
|
|
225245
225245
|
".": {
|
|
@@ -342521,7 +342521,69 @@ function getPluginsDegradedReason() {
|
|
|
342521
342521
|
var pluginsDegraded = false, pluginsDegradedReason = null;
|
|
342522
342522
|
|
|
342523
342523
|
// ../api/src/routes/health.ts
|
|
342524
|
-
var import__package2, VERSION6, startTime2, healthRoutes
|
|
342524
|
+
var import__package2, VERSION6, startTime2, healthRoutes, getHealth = async (c) => {
|
|
342525
|
+
const db2 = c.get("db");
|
|
342526
|
+
const eventBus = c.get("eventBus");
|
|
342527
|
+
const channelRegistry2 = c.get("channelRegistry");
|
|
342528
|
+
let dbCheck;
|
|
342529
|
+
const dbStart = Date.now();
|
|
342530
|
+
try {
|
|
342531
|
+
await db2.execute(sql`SELECT 1`);
|
|
342532
|
+
dbCheck = { status: "ok", latency: Date.now() - dbStart };
|
|
342533
|
+
} catch (error3) {
|
|
342534
|
+
dbCheck = {
|
|
342535
|
+
status: "error",
|
|
342536
|
+
latency: Date.now() - dbStart,
|
|
342537
|
+
error: error3 instanceof Error ? error3.message : "Unknown error"
|
|
342538
|
+
};
|
|
342539
|
+
}
|
|
342540
|
+
let natsCheck;
|
|
342541
|
+
if (eventBus) {
|
|
342542
|
+
natsCheck = { status: "ok", details: { connected: true } };
|
|
342543
|
+
} else {
|
|
342544
|
+
natsCheck = { status: "ok", details: { connected: false, reason: "Not configured" } };
|
|
342545
|
+
}
|
|
342546
|
+
let instanceStats;
|
|
342547
|
+
try {
|
|
342548
|
+
const instanceCounts = await db2.select({
|
|
342549
|
+
channel: instances.channel,
|
|
342550
|
+
total: sql`count(*)::int`,
|
|
342551
|
+
active: sql`count(*) filter (where ${instances.isActive})::int`
|
|
342552
|
+
}).from(instances).groupBy(instances.channel);
|
|
342553
|
+
const byChannel = {};
|
|
342554
|
+
let total = 0;
|
|
342555
|
+
let active = 0;
|
|
342556
|
+
for (const row of instanceCounts) {
|
|
342557
|
+
byChannel[row.channel] = row.total;
|
|
342558
|
+
total += row.total;
|
|
342559
|
+
active += row.active;
|
|
342560
|
+
}
|
|
342561
|
+
let connected = 0;
|
|
342562
|
+
if (channelRegistry2) {
|
|
342563
|
+
for (const plugin7 of channelRegistry2.getAll()) {
|
|
342564
|
+
connected += plugin7.getConnectedInstances().length;
|
|
342565
|
+
}
|
|
342566
|
+
}
|
|
342567
|
+
instanceStats = { total, active, connected, byChannel };
|
|
342568
|
+
} catch {}
|
|
342569
|
+
const pluginsFailed = arePluginsDegraded();
|
|
342570
|
+
const pluginsCheck = pluginsFailed ? { status: "error", error: getPluginsDegradedReason() ?? "Plugin initialization failed" } : { status: "ok" };
|
|
342571
|
+
const hasErrors = dbCheck.status === "error" || natsCheck.status === "error" || pluginsFailed;
|
|
342572
|
+
const status = hasErrors ? "degraded" : "healthy";
|
|
342573
|
+
const response = {
|
|
342574
|
+
status,
|
|
342575
|
+
version: VERSION6,
|
|
342576
|
+
uptime: Math.floor((Date.now() - startTime2) / 1000),
|
|
342577
|
+
timestamp: new Date().toISOString(),
|
|
342578
|
+
checks: {
|
|
342579
|
+
database: dbCheck,
|
|
342580
|
+
nats: natsCheck,
|
|
342581
|
+
plugins: pluginsCheck
|
|
342582
|
+
},
|
|
342583
|
+
instances: instanceStats
|
|
342584
|
+
};
|
|
342585
|
+
return c.json(response, status === "healthy" ? 200 : 503);
|
|
342586
|
+
};
|
|
342525
342587
|
var init_health2 = __esm(() => {
|
|
342526
342588
|
init_src5();
|
|
342527
342589
|
init_drizzle_orm();
|
|
@@ -342530,69 +342592,7 @@ var init_health2 = __esm(() => {
|
|
|
342530
342592
|
VERSION6 = import__package2.default.version;
|
|
342531
342593
|
startTime2 = Date.now();
|
|
342532
342594
|
healthRoutes = new Hono2;
|
|
342533
|
-
healthRoutes.get("/health",
|
|
342534
|
-
const db2 = c.get("db");
|
|
342535
|
-
const eventBus = c.get("eventBus");
|
|
342536
|
-
const channelRegistry2 = c.get("channelRegistry");
|
|
342537
|
-
let dbCheck;
|
|
342538
|
-
const dbStart = Date.now();
|
|
342539
|
-
try {
|
|
342540
|
-
await db2.execute(sql`SELECT 1`);
|
|
342541
|
-
dbCheck = { status: "ok", latency: Date.now() - dbStart };
|
|
342542
|
-
} catch (error3) {
|
|
342543
|
-
dbCheck = {
|
|
342544
|
-
status: "error",
|
|
342545
|
-
latency: Date.now() - dbStart,
|
|
342546
|
-
error: error3 instanceof Error ? error3.message : "Unknown error"
|
|
342547
|
-
};
|
|
342548
|
-
}
|
|
342549
|
-
let natsCheck;
|
|
342550
|
-
if (eventBus) {
|
|
342551
|
-
natsCheck = { status: "ok", details: { connected: true } };
|
|
342552
|
-
} else {
|
|
342553
|
-
natsCheck = { status: "ok", details: { connected: false, reason: "Not configured" } };
|
|
342554
|
-
}
|
|
342555
|
-
let instanceStats;
|
|
342556
|
-
try {
|
|
342557
|
-
const instanceCounts = await db2.select({
|
|
342558
|
-
channel: instances.channel,
|
|
342559
|
-
total: sql`count(*)::int`,
|
|
342560
|
-
active: sql`count(*) filter (where ${instances.isActive})::int`
|
|
342561
|
-
}).from(instances).groupBy(instances.channel);
|
|
342562
|
-
const byChannel = {};
|
|
342563
|
-
let total = 0;
|
|
342564
|
-
let active = 0;
|
|
342565
|
-
for (const row of instanceCounts) {
|
|
342566
|
-
byChannel[row.channel] = row.total;
|
|
342567
|
-
total += row.total;
|
|
342568
|
-
active += row.active;
|
|
342569
|
-
}
|
|
342570
|
-
let connected = 0;
|
|
342571
|
-
if (channelRegistry2) {
|
|
342572
|
-
for (const plugin7 of channelRegistry2.getAll()) {
|
|
342573
|
-
connected += plugin7.getConnectedInstances().length;
|
|
342574
|
-
}
|
|
342575
|
-
}
|
|
342576
|
-
instanceStats = { total, active, connected, byChannel };
|
|
342577
|
-
} catch {}
|
|
342578
|
-
const pluginsFailed = arePluginsDegraded();
|
|
342579
|
-
const pluginsCheck = pluginsFailed ? { status: "error", error: getPluginsDegradedReason() ?? "Plugin initialization failed" } : { status: "ok" };
|
|
342580
|
-
const hasErrors = dbCheck.status === "error" || natsCheck.status === "error" || pluginsFailed;
|
|
342581
|
-
const status = hasErrors ? "degraded" : "healthy";
|
|
342582
|
-
const response = {
|
|
342583
|
-
status,
|
|
342584
|
-
version: VERSION6,
|
|
342585
|
-
uptime: Math.floor((Date.now() - startTime2) / 1000),
|
|
342586
|
-
timestamp: new Date().toISOString(),
|
|
342587
|
-
checks: {
|
|
342588
|
-
database: dbCheck,
|
|
342589
|
-
nats: natsCheck,
|
|
342590
|
-
plugins: pluginsCheck
|
|
342591
|
-
},
|
|
342592
|
-
instances: instanceStats
|
|
342593
|
-
};
|
|
342594
|
-
return c.json(response, status === "healthy" ? 200 : 503);
|
|
342595
|
-
});
|
|
342595
|
+
healthRoutes.get("/health", getHealth);
|
|
342596
342596
|
healthRoutes.get("/info", async (c) => {
|
|
342597
342597
|
const db2 = c.get("db");
|
|
342598
342598
|
const channelRegistry2 = c.get("channelRegistry");
|
|
@@ -358462,7 +358462,7 @@ function createApp(db2, eventBus = null, channelRegistry2 = null) {
|
|
|
358462
358462
|
app.use("*", contextMiddleware);
|
|
358463
358463
|
app.use("*", versionHeadersMiddleware);
|
|
358464
358464
|
app.onError(errorHandler2);
|
|
358465
|
-
app.get("/health",
|
|
358465
|
+
app.get("/health", getHealth);
|
|
358466
358466
|
app.route("/api/v2", healthRoutes);
|
|
358467
358467
|
app.route("/api/v2", openapiRoutes);
|
|
358468
358468
|
if (process.env.A2A_ENABLED === "true") {
|