feat: expose research truth source health identity

This commit is contained in:
732642856
2026-07-21 14:30:44 +08:00
parent c60b3af7c3
commit a5a69a82b0
3 changed files with 118 additions and 0 deletions
+8
View File
@@ -1,5 +1,7 @@
import { NextResponse } from "next/server";
import { getTruthSourceRuntimeIdentity } from "@/lib/truth-source-runtime-identity";
type Check = {
status: "ok" | "degraded" | "blocked";
message?: string;
@@ -58,12 +60,17 @@ function aggregate(checks: Record<string, Check>) {
}
export async function GET() {
const truthSourceIdentity = getTruthSourceRuntimeIdentity();
const checks = {
web: { status: "ok" } satisfies Check,
supabasePublicConfig: envCheck(["NEXT_PUBLIC_SUPABASE_URL", "NEXT_PUBLIC_SUPABASE_ANON_KEY"]),
supabaseServiceRole: envCheck(["SUPABASE_SERVICE_ROLE_KEY"]),
modelProvider: anyEnvCheck(["LLM_MODELS_JSON", "OPENAI_API_KEY", "LLM_API_KEY", "DEEPSEEK_API_KEY"]),
jyotishApi: await jyotishApiCheck(),
researchTruthSource: {
status: truthSourceIdentity.status,
message: truthSourceIdentity.mountStatus === "mounted" ? undefined : truthSourceIdentity.mountStatus,
} satisfies Check,
};
const status = aggregate(checks);
return NextResponse.json(
@@ -73,6 +80,7 @@ export async function GET() {
deployment: {
gitCommit,
},
truthSource: truthSourceIdentity,
checks,
},
{ status: status === "ok" ? 200 : 503 },