feat: flow 第 2 部分,第 r 轮开轮到选批(任务书 14 第二块)

- next-step 按"第 r 轮"列出提案、第一次预测、挑刺、回应与统一、第二次预测的任务
  (一人对一个对象),判重、冻结协议、选批三步,走到 implementation 停下(任务书 15)
- steps/dispatch.ts:同阶段一人任务先后跑、不同人同时跑;提案、挑刺按 proposalId、critiqueId 分份
- steps/round.ts:判重两两问 Jev、连通成组、并进留池候选;冻结协议在回应阶段关闭后一个事务写全;
  选批照 rules 的 BatchInput 拼,种子用 decisionSeed 版本 1(选格预留版本 2)
- materials 导出 Board(构造改收记录数组,给纯函数用);讨论原文里已作废的入口编号就地标"(已作废)"
- 删 SOURCES.md 里参考项目实测事实那一段(用户 2026-10-03 同意)
- 测试:下一步做什么 21 条、判重连组 4 条、冻结与选批 2 条、作废标注 1 条;npm test 437 通过

全新上下文审阅一轮(只看三个程序步骤与恢复):没有会污染账本的问题。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 13:59:54 -04:00
parent 2c6fdce1ca
commit f98d664a16
17 changed files with 835 additions and 133 deletions
+13 -2
View File
@@ -8,7 +8,9 @@ import { EVENTS, nextStep, type Next } from "./next-step.ts";
import { ledgerFile } from "./paths.ts";
import { recover } from "./recover.ts";
import { baselineRun, saveBaseline } from "./steps/baseline.ts";
import { assignEntries, dispatchStage } from "./steps/round-zero.ts";
import { dispatchStage } from "./steps/dispatch.ts";
import { dedupe, freezeProtocols, selectBatch } from "./steps/round.ts";
import { assignEntries } from "./steps/round-zero.ts";
import { freezeConfig, halt, openStudy, USER_STOPPED, type Study, type StudyEnding } from "./study.ts";
// 主循环:读账本 → 问下一步 → 做这一步 → 回到开头(任务书 12 第 2.4 节)。每做完一步都重新读账本。
@@ -83,7 +85,7 @@ async function doStep(s: Study, next: Exclude<Next, { do: "freezeConfig" }>): Pr
s.ledger.append("event", { event: EVENTS.skipped, reason: next.reason, objects: [next.step] });
return null;
case "openStage":
s.ledger.append("stageOpen", { stageId: next.stageId, stage: next.stage, round: 0, roster: next.roster });
s.ledger.append("stageOpen", { stageId: next.stageId, stage: next.stage, round: next.round, roster: next.roster });
return null;
case "closeStage":
s.ledger.append("stageClose", { stageId: next.stageId });
@@ -93,6 +95,15 @@ async function doStep(s: Study, next: Exclude<Next, { do: "freezeConfig" }>): Pr
case "assignEntries":
assignEntries(s);
return null;
case "dedupe":
await dedupe(s, next.round);
return null;
case "freezeProtocols":
freezeProtocols(s, next.round);
return null;
case "selectBatch":
selectBatch(s, next.round);
return null;
case "halt":
return halt(s.ledger, next.reason, next.objects);
}