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

+19 -9
View File
@@ -71,19 +71,29 @@ describe("能力调用分级(HTTP 路径)", () => {
});
describe("worker 分组与事件循环探针", () => {
const names = ["evaluateAcquisition", "resolveDecision", "runAgent", "verifyAndImport"];
it("io / agent / split 的任务选择", () => {
expect(workerPlan("io", names, { io: 4 })).toEqual([
{ label: "io", versions: ["evaluateAcquisition", "verifyAndImport"], concurrency: 4 },
const tasks = [
{ name: "evaluateAcquisition", lane: "network" as const },
{ name: "resolveDecision", lane: "agent" as const },
{ name: "runAgent" },
{ name: "verifyAndImport", lane: "file" as const },
{ name: "purgeTrash", lane: "maintenance" as const },
];
it("io / agent / split 的任务选择(io 按 lane 分三条道;没声明 lane 的 runAgent 兜底归 agent)", () => {
expect(workerPlan("io", tasks).map((p) => [p.label, p.versions])).toEqual([
["file", ["verifyAndImport"]],
["network", ["evaluateAcquisition"]],
["maintenance", ["purgeTrash"]],
]);
expect(workerPlan("agent", names, { agent: 2 })).toEqual([
expect(workerPlan("agent", tasks, { agent: 2 })).toEqual([
{ label: "agent", versions: ["resolveDecision", "runAgent"], concurrency: 2 },
]);
expect(workerPlan("split", names, { io: 3, agent: 1 }).map((p) => [p.label, p.concurrency])).toEqual([
["io", 3],
["agent", 1],
expect(workerPlan("split", tasks, { agent: 1 }).map((p) => p.label)).toEqual([
"file",
"network",
"maintenance",
"agent",
]);
expect(workerPlan("all", names, {})).toEqual([{ label: "all" }]);
expect(workerPlan("all", tasks, {})).toEqual([{ label: "all" }]);
});
it("主线程被同步占住超过阈值 → 计数", async () => {