Files
InfoRSI/src/submissions/types.ts
T
iomgaa 852600df02 feat: 诊断(任务书 18 第一块):诊断数学、四种提交、一次运行跑多个实验、账本与材料、flow 诊断各步
消融默认关,关掉时解释阶段一并跳过;选诊断实验用信息价值减成本。
eval/diagnosis/research.json 为第三块配置。vocab 字段说明的出口文字随提示词一起改,见下一次提交的 prompts/ 与同文件改动(本次含在内)。

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 10:36:20 -04:00

56 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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<Submission<"unification">, "factors" | "safeguards" | "metrics" | "body" | "clauses">;
/** 回应拼协议时叠在下面的那条原提案(作者自评不进协议)。 */
export type OriginalProposal = Pick<Submission<"proposal">, "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 };
/** 诊断程序和候选代码同形:和当前基线比出的差异块,给 Jev 对照的是选中实验的原文和要采集的指标。 */
diagnosisImplementation: { code: ForwardCode };
diagnosisRepair: { code: ForwardCode };
/** 交了"跑不起来"(cannotRun 不是 null)时 flow 不存代码,code 为 null。 */
ablationImplementation: { code: AblationCode | null };
};
export type KnownOf<K extends SubmissionKind> = K extends keyof KnownByKind ? KnownByKind[K] : null;
/** 交给 submissions 判的一份提交,以 kind 区分:内容、这次任务的对号清单、提交之后才知道的东西、Jev 的模型名。 */
export type Incoming = {
[K in SubmissionKind]: { kind: K; content: Submission<K>; checklist: ChecklistOf<K>; known: KnownOf<K>; 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 };