fix: bind orientation prompt to runtime contract
This commit is contained in:
parent
05aeab4817
commit
b4d2660873
2 changed files with 39 additions and 2 deletions
|
|
@ -172,6 +172,33 @@ test("resident engine completes a model-backed brain and controller cycle", asyn
|
|||
assert.equal(receipt.completed_cycles, 1);
|
||||
});
|
||||
|
||||
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 modelClient = {
|
||||
async generate(request) {
|
||||
if (request.role === "tcs_event_orientation") {
|
||||
observedInstruction = request.instruction;
|
||||
}
|
||||
return fixture.generate(request);
|
||||
},
|
||||
};
|
||||
const engine = new ControllerEngine({
|
||||
stateRoot,
|
||||
modelClient,
|
||||
modelName: "fixture-model",
|
||||
});
|
||||
engine.initialize();
|
||||
await engine.runEvent(bootEvent());
|
||||
assert.match(
|
||||
observedInstruction,
|
||||
/schema必须等于guanghu\.zhuyuan-tcs-event-orientation\/v1/,
|
||||
);
|
||||
assert.match(observedInstruction, /每一项必须包含字符串id和字符串why/);
|
||||
assert.match(observedInstruction, /不要把signals写成字符串数组/);
|
||||
});
|
||||
|
||||
test("an interrupted technical cycle is preserved and restarted in a new state epoch", () => {
|
||||
const stateRoot = fs.mkdtempSync(path.join(os.tmpdir(), "bs-tcs-recovery-"));
|
||||
const first = new ControllerEngine({
|
||||
|
|
|
|||
Loading…
Reference in a new issue