import type { CodeHunk, ProtocolRules } from "../jev/index.ts"; import type { ChecklistOf, JevJudgment, Submission, SubmissionKind } from "../vocab/index.ts"; // submissions 收的和交回的东西(任务书 10 第三部分)。submissions 只依赖 jev 和 vocab, // workspace 的存版本结果、materials 的冻结协议在这里按相同形状另写,flow 赋值时由 tsc 对齐。 /** * 冻结协议的主体(方法.md 4.3 ⑥"冻结协议包括"):因子、保障、指标、正文、实现条款。 * 不带答复:答复留在回应或统一的提交记录里(用户 2026-10-03 定)。flow 补上轮次、基线、合并了哪些原提案,写成 materials 的 FrozenProtocol。 */ export type ProtocolBody = Pick, "factors" | "safeguards" | "metrics" | "body" | "clauses">; /** 回应拼协议时叠在下面的那条原提案(作者自评不进协议)。 */ export type OriginalProposal = Pick, "factors" | "safeguards" | "metrics" | "body">; /** 实验员的工作目录存不成版本:workspace 给的路径和原因(例如符号链接)。 */ type NotSaved = { saved: false; path: string; reason: string }; /** * 实现、修复的代码:存成了版本就带改了的不许改的文件(tasks 的 protectedChanges)、 * 和本批基线比出的差异块(jev 的 codeHunks 切好的),以及给 Jev 对照的协议正文和要采集的指标。 */ export type ForwardCode = NotSaved | { saved: true; protectedFiles: string[]; hunks: CodeHunk[]; protocol: ProtocolRules }; /** 消融实现的代码:只查存没存成、改没改不许改的文件。 */ export type AblationCode = NotSaved | { saved: true; protectedFiles: string[] }; /** 按种类区分的"提交之后才知道的东西",没有的种类为 null。 */ type KnownByKind = { /** 本人本阶段已经收下几条提案(替换时不算被替换的那条)。 */ proposal: { accepted: number }; /** 作者那条原提案。 */ response: { original: OriginalProposal }; implementation: { code: ForwardCode }; repair: { code: ForwardCode }; /** 交了"跑不起来"(cannotRun 不是 null)时 flow 不存代码,code 为 null。 */ ablationImplementation: { code: AblationCode | null }; }; export type KnownOf = K extends keyof KnownByKind ? KnownByKind[K] : null; /** 交给 submissions 判的一份提交,以 kind 区分:内容、这次任务的对号清单、提交之后才知道的东西、Jev 的模型名。 */ export type Incoming = { [K in SubmissionKind]: { kind: K; content: Submission; checklist: ChecklistOf; known: KnownOf; jevModel: string }; }[SubmissionKind]; /** * 判的结论。jev 是用到的全部 Jev 判断(判"否"的也在),没问 Jev 的为 null(账本的 JevUsed 要求至少一条)。 * 收下时 protocol 只有回应、统一才有,其余为 null。 */ export type Verdict = | { accepted: true; jev: JevJudgment[] | null; protocol: ProtocolBody | null } | { accepted: false; reason: string; jev: JevJudgment[] | null };