ci(hub): 补齐 Hub 检查和健康 smoke

This commit is contained in:
2026-07-08 15:14:06 +08:00
parent ead5cf04d6
commit 1cfda3ccd2
3 changed files with 122 additions and 140 deletions
+16 -5
View File
@@ -14,7 +14,7 @@ import "dotenv/config";
import Fastify from "fastify";
import { prisma } from "./db.js";
import { createDefaultModelRegistry } from "./agent/defaultModels.js";
import { createLarkClient, startFeishuListenerWithClient, type FeishuRuntime } from "./feishu/client.js";
import { createLarkClient, startFeishuListenerWithClient } from "./feishu/client.js";
import { makeTriggerHandler } from "./feishu/trigger.js";
function requireEnv(name: string): string {
@@ -26,6 +26,12 @@ function requireEnv(name: string): string {
return v;
}
function booleanEnv(name: string, fallback: boolean): boolean {
const raw = process.env[name];
if (raw === undefined || raw === "") return fallback;
return !["0", "false", "no", "off"].includes(raw.trim().toLowerCase());
}
async function main(): Promise<void> {
const databaseUrl = requireEnv("DATABASE_URL");
void databaseUrl;
@@ -59,10 +65,15 @@ async function main(): Promise<void> {
const models = createDefaultModelRegistry();
// --- Feishu listener ---
const feishuConfig = { appId: feishuAppId, appSecret: feishuAppSecret, botOpenId: feishuBotOpenId };
const larkClient = createLarkClient(feishuConfig);
const trigger = makeTriggerHandler({ prisma, models, logger: app.log });
startFeishuListenerWithClient(feishuConfig, larkClient, app.log, trigger);
const feishuListenerEnabled = booleanEnv("HUB_FEISHU_LISTENER_ENABLED", true);
if (feishuListenerEnabled) {
const feishuConfig = { appId: feishuAppId, appSecret: feishuAppSecret, botOpenId: feishuBotOpenId };
const larkClient = createLarkClient(feishuConfig);
const trigger = makeTriggerHandler({ prisma, models, logger: app.log });
startFeishuListenerWithClient(feishuConfig, larkClient, app.log, trigger);
} else {
app.log.info("feishu listener disabled by HUB_FEISHU_LISTENER_ENABLED");
}
app.listen({ port, host: "0.0.0.0" }, (err, address) => {
if (err !== null) {