feat: 任务书 08,jev 模块与账本记 Jev 判断
src/jev 3 个文件 515 行:判重、查冻结条款、查代码改动三个函数,九问问法和阈值照参考项目,只改说法和字段名,阈值注明未在新项目材料上校准,等真实数据。 新增 npm run test:jev(真实 Jev 三处各问一次)。vocab 加 JevJudgment。 ledger 表结构版本 3:callEnded 四种结局对上 agents,墙钟时间用 Measured(恢复时补写出错、原因"进程中断"、测不到);退回、提交记录都带 jev。 config 加必填的 models.jev。 用户原话:"这次就给提交记录加一个和退回记录同样的 Jev 判断字段";"墙钟时间改用 Measured,恢复时写出错加测不到(原因'进程中断')"。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,14 +33,38 @@ test("模型调用:开始了没结束的被找出来,带着这次任务的
|
||||
ledger.append("callStarted", callStart("k1", "r1", "s1"));
|
||||
ledger.append("callStarted", callStart("k2", "e1"));
|
||||
ledger.append("callUsage", { call: "k1", reply: 1, usage });
|
||||
ledger.append("callEnded", { call: "k2", ending: "failed", reason: "接口超时" });
|
||||
ledger.append("callEnded", { call: "k2", wallSeconds: { status: "measured", value: 30 }, status: "failed", reason: "接口超时" });
|
||||
const calls = ledger.pending().calls;
|
||||
assert.deepEqual(calls.map((c) => c.content.call), ["k1"]);
|
||||
assert.deepEqual(calls[0]!.content.materials, callStart("k1").materials);
|
||||
ledger.append("callEnded", { call: "k1", ending: "completed" });
|
||||
ledger.append("callEnded", { call: "k1", wallSeconds: { status: "measured", value: 600 }, status: "notSubmitted", reason: "模型自己停下了" });
|
||||
assert.deepEqual(ledger.pending(), { runs: [], calls: [] });
|
||||
});
|
||||
|
||||
test("中断后恢复:给没结束的旧调用补写出错加测不到(进程中断),补写后不再算未完成", (t) => {
|
||||
const path = join(tempDir(t), "ledger.db");
|
||||
const ledger = Ledger.open(path);
|
||||
ledger.append("callStarted", callStart("k1", "r1", "s1"));
|
||||
ledger.append("callUsage", { call: "k1", reply: 1, usage });
|
||||
ledger.close(); // 控制进程被系统杀掉
|
||||
const reopened = Ledger.open(path);
|
||||
t.after(() => reopened.close());
|
||||
assert.deepEqual(reopened.pending().calls.map((c) => c.content.call), ["k1"]);
|
||||
reopened.append("callEnded", {
|
||||
call: "k1",
|
||||
wallSeconds: { status: "unmeasured", reason: "进程中断" },
|
||||
status: "failed",
|
||||
reason: "进程中断",
|
||||
});
|
||||
assert.deepEqual(reopened.pending(), { runs: [], calls: [] });
|
||||
assert.deepEqual(reopened.records().at(-1)!.content, {
|
||||
call: "k1",
|
||||
wallSeconds: { status: "unmeasured", reason: "进程中断" },
|
||||
status: "failed",
|
||||
reason: "进程中断",
|
||||
});
|
||||
});
|
||||
|
||||
test("关掉再打开:未完成的动作照样找得出来", (t) => {
|
||||
const path = join(tempDir(t), "ledger.db");
|
||||
const ledger = Ledger.open(path);
|
||||
|
||||
Reference in New Issue
Block a user