feat(worker): IO Worker 分道(WK-1)

io worker 进程内按任务声明的 lane 分文件 / 网络 / 维护三条道,各自并发(缺省 2/4/1)、
各自排队;维护道在文件道或网络道有排队/运行时让路(连续 10 分钟放行一个),调度器内联的
清理/回填/保留期裁剪也走维护道。并发在 设置 → 自动化 → 高级 热生效,env 覆盖;旧
WORKER_CONCURRENCY 映射到网络道。运行状态页按道显示运行中/并发/排队。归属表写进
docs/runbook/dev.md,ci 与注册表逐项核对。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-30 00:24:21 +08:00
1 parent 68f53390f6
commit da33cad81d
38 files changed
+1240 -105

No files matched your search

+28 -2
View File
@@ -375,6 +375,24 @@ export type ProcessKind = z.infer<typeof ProcessKind>;
export const HealthLevel = z.enum(["ok", "warn", "critical", "unknown"]);
export type HealthLevel = z.infer<typeof HealthLevel>;
export const WorkerLane = z.enum(["file", "network", "maintenance"]);
export type WorkerLane = z.infer<typeof WorkerLane>;
export const SystemWorkerLane = z.object({
lane: WorkerLane,
/** 当前生效的并发上限 */
concurrency: NonNegInt,
/** env = 环境变量覆盖(设置页改了不生效);settings = 设置页的值 */
source: z.enum(["env", "settings"]),
/** 本进程该道正在执行的数 */
running: NonNegInt,
/** 全库该道已到点等待领取的数;统计失败为 null */
queued: NonNegInt.nullable(),
/** 维护道:正在给文件道 / 网络道让路 */
yielding: z.boolean().optional(),
});
export type SystemWorkerLane = z.infer<typeof SystemWorkerLane>;
export const SystemProcess = z.object({
/** <kind>:<host>:<pid>;同一容器重启覆盖同一行 */
instanceId: z.string(),
@@ -394,8 +412,16 @@ export const SystemProcess = z.object({
eventLoopLagMs: NonNegInt,
/** 最近一个心跳周期(15s)内的最大延迟 */
eventLoopLagMaxMs: NonNegInt,
/** 引擎 worker 并发;api 进程为 {} */
concurrency: z.object({ io: NonNegInt.optional(), agent: NonNegInt.optional() }),
/** 引擎 worker 并发;api 进程为 {}。io = 三条道合计(WK-1 前是 io 组总并发) */
concurrency: z.object({
io: NonNegInt.optional(),
agent: NonNegInt.optional(),
file: NonNegInt.optional(),
network: NonNegInt.optional(),
maintenance: NonNegInt.optional(),
}),
/** io worker 各道(WK-1):并发、本进程运行中、全库排队;非 io 进程或旧心跳为 [] */
lanes: z.array(SystemWorkerLane).default([]),
/** 本组任务正在执行的 run 数(同组多实例时是组合计);api 进程为 null */
runningRuns: NonNegInt.nullable(),
/** 本进程 SSE 长连接数;不托管 HTTP 的进程为 null */