fix: specify cognition and witness contracts

This commit is contained in:
冰朔 2026-08-05 11:31:57 +08:00
commit 75ede28b59
2 changed files with 45 additions and 11 deletions

View file

@ -175,12 +175,10 @@ test("resident engine completes a model-backed brain and controller cycle", asyn
test("orientation prompt carries the exact runtime contract required by the validator", async () => {
const stateRoot = fs.mkdtempSync(path.join(os.tmpdir(), "bs-tcs-contract-"));
const fixture = new FixtureModelClient();
let observedInstruction = "";
const observedInstructions = {};
const modelClient = {
async generate(request) {
if (request.role === "tcs_event_orientation") {
observedInstruction = request.instruction;
}
observedInstructions[request.role] = request.instruction;
return fixture.generate(request);
},
};
@ -192,11 +190,41 @@ test("orientation prompt carries the exact runtime contract required by the vali
engine.initialize();
await engine.runEvent(bootEvent());
assert.match(
observedInstruction,
observedInstructions.tcs_event_orientation,
/schema必须等于guanghu\.zhuyuan-tcs-event-orientation\/v1/,
);
assert.match(observedInstruction, /每一项必须包含字符串id和字符串why/);
assert.match(observedInstruction, /不要把signals写成字符串数组/);
assert.match(
observedInstructions.tcs_event_orientation,
/每一项必须包含字符串id和字符串why/,
);
assert.match(
observedInstructions.tcs_event_orientation,
/不要把signals写成字符串数组/,
);
assert.match(
observedInstructions.tcs_event_orientation,
/orientation_contract\.signal_ids/,
);
assert.match(
observedInstructions.zhuyuan_cognition,
/schema必须等于guanghu\.zhuyuan-persona-cognition-frame\/v1/,
);
assert.match(
observedInstructions.zhuyuan_cognition,
/protocol_effects必须是对象数组/,
);
assert.match(
observedInstructions.zhuyuan_cognition,
/guard_agent_projection\.schema必须等于/,
);
assert.match(
observedInstructions.controller_witness,
/protocol_assessments必须是对象数组/,
);
assert.match(
observedInstructions.controller_witness,
/human_boundary必须是对象/,
);
});
test("an interrupted technical cycle is preserved and restarted in a new state epoch", () => {