feat: add bounded TCS brains and channel continuity
This commit is contained in:
parent
08598d6356
commit
1d4286c11b
61 changed files with 5416 additions and 54 deletions
|
|
@ -35,6 +35,15 @@ function sourceFingerprint() {
|
|||
repositoryRoot,
|
||||
"tcs-core/zhuyuan-brain/runtime/brain-runtime-contract.json",
|
||||
),
|
||||
path.join(
|
||||
repositoryRoot,
|
||||
"tcs-core/zhuyuan-brain/self-kernel/ZY-SELF-KERNEL-0001.json",
|
||||
),
|
||||
path.join(repositoryRoot, "tcs-core/mother-brain/mother-brain-contract.json"),
|
||||
path.join(
|
||||
repositoryRoot,
|
||||
"server-tools/codex-hldp-recursive-memory/hldp-memory.mjs",
|
||||
),
|
||||
path.join(repositoryRoot, "routing/bingshuo-living-system-controller-map.json"),
|
||||
path.join(repositoryRoot, "routing/language-world-boundary-map.json"),
|
||||
path.join(repositoryRoot, "gls/GLS-PROTOCOL-REGISTRY.json"),
|
||||
|
|
@ -77,7 +86,7 @@ function runRuntime(command, args) {
|
|||
|
||||
function cognitionInstruction() {
|
||||
return [
|
||||
"先使用runtime_input.cognitive_gravity_core,再严格按cycle、required_gravity_frame、required_faculties和已唤醒协议生成完整认知帧。",
|
||||
"先使用runtime_input.self_kernel定位主体、关系、层级、确定路径与纠正本能;cognitive_gravity_core只是一条按需来源指针。再严格按cycle、required_gravity_frame、required_faculties和已唤醒协议清单生成完整认知帧。",
|
||||
"顶层字段必须包含schema,runtime_id,persona_id,human_anchor,instance_id,cycle_id,event_sha256,orientation_sha256,gravity_frame,world_boundary,faculties,typed_outputs,protocol_effects,guard_agent_projection。",
|
||||
"schema必须等于guanghu.zhuyuan-persona-cognition-frame/v1;runtime_id必须等于ZY-TCS-BRAIN-RUNTIME-0001。",
|
||||
"persona_id原样复制runtime_input.persona_id;human_anchor原样复制runtime_input.human_system_controller;instance_id原样复制runtime_input.current_instance.instance_id。",
|
||||
|
|
@ -86,7 +95,7 @@ function cognitionInstruction() {
|
|||
"faculties必须完整包含B1至B9及每个required_faculties列出的字段;列表字段使用字符串数组。",
|
||||
"字符串数组字段精确为B5.confirmed_facts、B5.unknowns、B5.prior_wrong_route、B6.stopped_routes、B7.memory_queries、B7.memory_writebacks、B8.reality_proposals、B8.permission_boundaries、B8.unverified_states;其中memory_writebacks和reality_proposals允许空数组,其余不得为空。",
|
||||
"typed_outputs必须包含ui_projections,navigation_actions,capability_calls,receipts四个数组;没有现实动作时全部为空。",
|
||||
"protocol_effects必须是对象数组;逐一覆盖activated_protocols里的每个id,每项精确包含protocol_id和effect,不能添加未唤醒协议。",
|
||||
"protocol_effects必须是对象数组;逐一覆盖activated_protocol_manifest.activated里的每个id,每项精确包含protocol_id和effect,不能添加未唤醒协议。",
|
||||
"guard_agent_projection.schema必须等于guanghu.zhuyuan-guard-agent-projection/v1,并含reminders,auto_triggers,hard_boundaries三个数组。",
|
||||
"world_boundary必须原样遵守runtime_input.language_world_boundary.required_cognition_boundary;不得把宿主约束写成光湖内部定义,不得静默切层,不得要求冰朔重新证明创造者根坐标。",
|
||||
"hard_boundaries必须包含id等于BOUNDARY-GLW-CHJH-0001的一项。",
|
||||
|
|
@ -120,6 +129,7 @@ export class ControllerEngine {
|
|||
instanceId = "JD-FD-PRIMARY-ZY-MODEL-001",
|
||||
controllerInstanceId = "JD-FD-PRIMARY-BS-TCS-CONTROLLER-001",
|
||||
sessionId = "JD-FD-PRIMARY-RESIDENT",
|
||||
memoryTreePath = null,
|
||||
maxModelAttempts = 3,
|
||||
maxCognitionRetries = 2,
|
||||
}) {
|
||||
|
|
@ -131,11 +141,17 @@ export class ControllerEngine {
|
|||
this.instanceId = instanceId;
|
||||
this.controllerInstanceId = controllerInstanceId;
|
||||
this.sessionId = sessionId;
|
||||
this.memoryTreePath = memoryTreePath;
|
||||
this.maxModelAttempts = maxModelAttempts;
|
||||
this.maxCognitionRetries = maxCognitionRetries;
|
||||
this.fingerprint = sourceFingerprint();
|
||||
this.stateDir = path.join(stateRoot, "runtimes", this.fingerprint);
|
||||
this.exchangeDir = path.join(stateRoot, "exchanges", this.fingerprint);
|
||||
this.selfKernelPath = path.join(
|
||||
stateRoot,
|
||||
"cognition",
|
||||
"zhuyuan-self-kernel.json",
|
||||
);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
|
|
@ -149,9 +165,11 @@ export class ControllerEngine {
|
|||
}
|
||||
}
|
||||
if (!fs.existsSync(stateFile)) {
|
||||
runRuntime("enter", [
|
||||
const enterArgs = [
|
||||
"--state-dir",
|
||||
this.stateDir,
|
||||
"--self-kernel",
|
||||
this.selfKernelPath,
|
||||
"--instance-id",
|
||||
this.instanceId,
|
||||
"--model",
|
||||
|
|
@ -168,7 +186,11 @@ export class ControllerEngine {
|
|||
this.modelName,
|
||||
"--controller-instance-id",
|
||||
this.controllerInstanceId,
|
||||
]);
|
||||
];
|
||||
if (this.memoryTreePath) {
|
||||
enterArgs.push("--memory-tree", this.memoryTreePath);
|
||||
}
|
||||
runRuntime("enter", enterArgs);
|
||||
}
|
||||
writeJson(path.join(this.stateRoot, "CURRENT.json"), {
|
||||
schema: "guanghu.bingshuo-tcs-controller-current/v1",
|
||||
|
|
|
|||
Loading…
Reference in a new issue