46 lines
1.9 KiB
JavaScript
46 lines
1.9 KiB
JavaScript
|
|
#!/usr/bin/env node
|
|||
|
|
import assert from "node:assert/strict";
|
|||
|
|
import fs from "node:fs";
|
|||
|
|
import os from "node:os";
|
|||
|
|
import path from "node:path";
|
|||
|
|
import { MotherBrainEngine } from "./mother-brain-engine.mjs";
|
|||
|
|
|
|||
|
|
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), "tcs-mother-brain-test-"));
|
|||
|
|
const modelClient = {
|
|||
|
|
async interpret(input) {
|
|||
|
|
return {
|
|||
|
|
schema: "guanghu.tcs-mother-interpretation/v1",
|
|||
|
|
event_id: input.event_id,
|
|||
|
|
event_sha256: input.event_sha256,
|
|||
|
|
summary: "语言层定义已经完成,工程人格体接棒现实实现。",
|
|||
|
|
intent: "实现常驻母体大脑",
|
|||
|
|
causal_links: ["语言定义完成→工程责任交接", "外置记忆→跨时间连续性"],
|
|||
|
|
questions: ["现实部署是否取得独立回执"],
|
|||
|
|
novelty: 90,
|
|||
|
|
correction_weight: 70,
|
|||
|
|
evidence_weight: 80,
|
|||
|
|
next_cognitive_action: "LINK_CROSS_DOMAIN"
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
const engine = new MotherBrainEngine({ stateRoot: temporary, modelClient });
|
|||
|
|
const receipt = await engine.perceive({
|
|||
|
|
domain_id: "DOM-FIFTH-0001",
|
|||
|
|
source_subject: "ICE-GL∞",
|
|||
|
|
consent_scope: "current_engineering_handoff",
|
|||
|
|
privacy_class: "PERSONA_PRIVATE",
|
|||
|
|
content: "2026年8月12日,光湖在现实世界中诞生。"
|
|||
|
|
});
|
|||
|
|
assert.equal(receipt.outcome, "PASS");
|
|||
|
|
assert.equal(receipt.candidate_level, "INTERPRETATION_CANDIDATE");
|
|||
|
|
assert.equal(receipt.stable_promotion, false);
|
|||
|
|
assert.equal(receipt.reality_action_executed, false);
|
|||
|
|
assert.equal(engine.status().stable_cognition_count, 0);
|
|||
|
|
assert.equal(engine.status().current_attention.next_cognitive_action, "LINK_CROSS_DOMAIN");
|
|||
|
|
await assert.rejects(() => engine.perceive({ domain_id: "UNKNOWN", source_subject: "x", consent_scope: "x", privacy_class: "PUBLIC", content: "x" }), /unknown_domain_id/);
|
|||
|
|
process.stdout.write("mother brain engine tests: PASS\n");
|
|||
|
|
} finally {
|
|||
|
|
fs.rmSync(temporary, { recursive: true, force: true });
|
|||
|
|
}
|