fix(system): retired heartbeat rows no longer alarm on status page

- GET /system/health splits processes into current instances (hosts with
  a beat in the last 10 min, newest per host+kind, not stopped) and
  retiredProcesses[]; 45s stale and level only consider current ones
- heartbeat writer marks stopped_at on graceful exit (migration 0043),
  upsert clears it; pure api role now stops its writer on SIGTERM
- scheduled job system.heartbeat_cleanup (maintain, 1h) deletes rows
  without a beat for 24h and samples older than 7 days
- status page: per-role alarms ("io worker 45 秒没有心跳"), collapsible
  retired instances; glossary/runbook updated
- bump all members to 0.2.2, CHANGELOG [0.2.2]

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 23:31:21 +08:00
1 parent fa261eb6cd
commit b4c9b1ead2
32 files changed
+747 -91

No files matched your search

+19
View File
@@ -1,6 +1,9 @@
import { join, resolve } from "node:path";
import { z } from "zod";
/** compose 里 `${X:-}` 展开成空串:按未设置处理 */
const emptyToUndef = (v: unknown) => (v === "" ? undefined : v);
const LogLevel = z.enum(["fatal", "error", "warn", "info", "debug", "trace", "silent"]);
export const ConfigSchema = z.object({
@@ -66,6 +69,22 @@ export const ConfigSchema = z.object({
ORGANIZE_ON_EXISTING: z.enum(["conflict", "skip", "replace_with_verify"]).default("conflict"),
/** 随行字幕中此语言加 .default 标记(对照 MP DEFAULT_SUB);不设 = 不加 */
ORGANIZE_DEFAULT_SUBTITLE_LANG: z.enum(["zh-cn", "zh-tw", "en", "ja", "ko"]).optional(),
// ── 浏览器服务(camofox-browser,docs/runbook/browser.md)──
/**
* 部署自带的浏览器服务地址(compose 缺省 http://camofox:9377;接自有实例时改成它的地址)。
* 设置后启动时登记/更新名为 camofox-env 的浏览器服务;不设则只用设置页登记的。
*/
BROWSER_PROVIDER_URL: z.preprocess(emptyToUndef, z.string().url().optional()),
/** 该服务的访问凭据(camofox CAMOFOX_ACCESS_KEY);只在进程内使用,不入库 */
BROWSER_ACCESS_KEY: z.preprocess(emptyToUndef, z.string().min(1).optional()),
/** false = 停用 camofox-env(容器可照常运行,界面标"浏览器不可用") */
BROWSER_ENABLED: z.preprocess(
emptyToUndef,
z
.enum(["true", "false", "1", "0"])
.default("true")
.transform((v) => v === "true" || v === "1"),
),
});
export type Config = z.infer<typeof ConfigSchema>;