Files
InfoRSI/src/materials/inputs.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

72 lines
3.2 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 { Ledger } from "../ledger/index.ts";
import type { Direction, MetricDefinition, Role, SubmissionKind } from "../vocab/index.ts";
// flow 交给 materials 的东西:账本里没有、只有 flow 拿得到的(任务书 09 第六部分第 1 条)。
/**
* 一份研究的事实:来自冻结的研究配置和任务。账本里的配置记录只存 Json,materials 不能引用 config、tasks,
* 所以由 flow 取好传进来。
*/
export type StudyFacts = {
finalMetric: string;
direction: Direction;
epsilon: number;
/** 已知最好,没有为 null。 */
knownBest: number | null;
/** 开放预留 λ。 */
lambda: number;
/** 正式运行总次数。 */
totalRuns: number;
/** 每人每轮提案上限 M,诊断解释的上限也是它。 */
proposalLimit: number;
/** 每人每轮诊断实验上限 A;诊断关掉时为 null。 */
diagnosisExperimentLimit: number | null;
factorLimit: number;
/** 最终指标和常规辅助指标的定义(tasks 的 metricDefinitions)。 */
metrics: MetricDefinition[];
/** 任务说明全文(TASK.md)。 */
taskText: string;
/** 单次正式运行的墙钟时限(秒),资源用量写"占时限几成"用。 */
wallSeconds: number;
};
/**
* 两个代码版本的比较结果。与 workspace 的 compareVersions 交回的形状相同(jev 的 codeHunks 是同样的先例),
* materials 不引用 workspace。块可以为空:空文件增删、只改可执行位都没有块,按整个文件改了算。
*/
export type LineRange = { start: number; end: number } | { after: number };
export type CodeChanges = {
files: Array<
{ path: string; change: "added" | "deleted" | "modified"; modeOnly: boolean } & (
| { binary: true }
| { binary: false; hunks: Array<{ from: LineRange; to: LineRange }> }
)
>;
diff: string;
};
/** 一份提示词文件:文字和原始字节的 sha256。 */
export type PromptFile = { text: string; hash: string };
/** 提示词目录读出来的全部文件(readPrompts)。 */
export type Prompts = { roles: Record<Role, PromptFile>; tasks: Record<SubmissionKind, PromptFile> };
/**
* 生成一份任务材料要的全部输入。全部必填,用不到的写 null:
* - changes:核验是起点到候选代码,修复是起点到上一次提交的代码,消融核验是完整代码到这一格的代码;诊断核验是当前基线到诊断程序,诊断修复是当前基线到上一次提交的诊断程序;其余为 null;
* - artifacts:解释任务要的本轮各次运行的产物、诊 1 要的本批基线那次运行的产物(运行编号 → 文件名 → 文字);其余为 null;
* - codeRoot:能读的代码版本取出到 `<codeRoot>/<版本号>`,flow 照材料里的目录取出。
*/
export type TaskRequest = {
kind: SubmissionKind;
actor: string;
stageId: string;
/** 一个任务一个对象:候选、原提案(挑刺)、消融格或本轮诊断(diagnosisId);入口、讨论、志愿、提案、诊断解释与预测、解释、收尾为 null。 */
object: string | null;
ledger: Ledger;
study: StudyFacts;
prompts: Prompts;
codeRoot: string;
changes: CodeChanges | null;
artifacts: Record<string, Record<string, string>> | null;
};