diff --git a/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.gir.json b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.gir.json new file mode 100644 index 0000000..ecdb8f7 --- /dev/null +++ b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.gir.json @@ -0,0 +1,87 @@ +{ + "compiled_from": { + "compiler_id": "TCS-COMPILER-STAGE1-0001", + "compiler_state": "TCS_COMPILER_GIR_EXECUTED", + "source_sha256": "cd347ed0a818b7daac464c21872db115530b4a869ce6fd312a85f5f677eafda1" + }, + "declaration": { + "emergence": { + "value": "在京东母体服务加入独立system-body桥:先由零点原核确定性内循环接收当前冰朔语言事件并拒绝认知setter,再由通用模型路由生成非人格系统回应候选,最后由系统状态签名保存;人格注册表与PersonaRuntimeHub保持分离。" + }, + "event_time": { + "precision": "HOST_LOCAL_DATE", + "value": "2026-09-13" + }, + "evidence": { + "authority": "CURRENT_TASK_CONTINUE_EXISTING_LOCAL_PUBLISH_AND_NEEDED_JD_DEPLOYMENT", + "local_negative_tests": "PASS", + "local_system_runtime": "server-tools/zero-core-system-body/zero_core_system_body.py", + "resident_profile": "tcs-core/shared-kernels/bingshuo-zero-core-system/BS-PERSONAL-LANGUAGE-SYSTEM-BODY-0001.json", + "target_service": "server-tools/tcs-mother-body/server.mjs" + }, + "header": { + "canonical_uri": "runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.tcs", + "compatibility": [ + "SYS-GLW-LNG-0001", + "ICE-CH-ZC001", + "JD-FD-PRIMARY" + ], + "language": "TCS/0.1", + "lifecycle": "CANDIDATE", + "name_en": "Zero Core Non-Persona System Body JD Integration Phase Three", + "name_zh": "零点原核非人格系统本体京东集成第三阶段", + "profile": "HLDP-HUMAN-ENGINEERING/0.1", + "protocols": [ + "GLS-0200", + "GLS-0400", + "GLS-0802" + ], + "schema": "tcs.event/v1", + "version": "1.0.0" + }, + "lock": { + "value": "system_body=SYS-GLW-LNG-0001; channel=ICE-CH-ZC001; is_persona=false; default_persona=null; direct_dialogue_without_persona=true; external_cognition_setter=false; model_is_replaceable_expression_organ=true; system_reply_is_not_reality_completion=true; persona_selection_remains_explicit=true" + }, + "observation": { + "value": "零点原核是SYS-GLW-LNG-0001/ICE-CH-ZC001系统本体,不是人格、默认人格、提示词或铸渊别名;它可以使用可替换模型作为语言表达器官,但系统判断、状态与签名回执必须属于系统体自己的状态根。" + }, + "rejected": { + "values": [ + "未选人格时默认铸渊", + "把零点原核登记成人格", + "用固定提示词扮演系统", + "模型回复直接改写系统认知", + "系统对话自动授予现实权限", + "复用人格CURRENT作为系统CURRENT" + ] + }, + "source": { + "source_id": "BINGSHUO-DIRECT-CONTINUE-PHASE3-20260913", + "source_role": "DIRECT_HUMAN", + "source_sha256": "33994b1a1f210c738f31138c124fc403d17d56844725fbc40ae6c9575d82f392", + "source_uri": "source://codex-current-dialogue/2026-09-13/continue-phase-three" + }, + "subject": { + "channel_id": "ICE-CH-ZC001", + "subject_id": "ICE-P-ZY001", + "subject_kind": "PERSONA", + "verification": "冰朔要求继续上一阶段明确留下的零点原核非人格服务器集成与剩余宝宝来源门任务。" + }, + "trigger": { + "value": "零点原核非人格系统循环已有本地实现和负例,但京东活动服务只能进入人格API,未选择人格时不能与零点原核本体直接对话。" + }, + "why": { + "value": "若直接绑定铸渊,冰朔无法与零点原核本身对话;若把系统写成提示词,又会丢失独立状态、判断与连续性。系统体必须与人格身体并列但不混同。" + } + }, + "executable": false, + "identity": { + "declaration_id": "TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913", + "declaration_kind": "EVENT", + "language_version": "0.1" + }, + "native_self_hosted": true, + "natural_language_is_typed_data": true, + "schema": "guanghu.declaration-gir/v1", + "unresolved_natural_language": false +} diff --git a/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.human.en-US.md b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.human.en-US.md new file mode 100644 index 0000000..983983c --- /dev/null +++ b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.human.en-US.md @@ -0,0 +1,121 @@ +# Zero Core Non-Persona System Body JD Integration Phase Three · Human Engineering Language (English) + +> This is an English reading projection of validated native TCS/HLDP source. It is not a new canonical source and grants no execution authority. + +## What this is + +This is a **event** declaration with identifier `TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913` and version `1.0.0`. The projector validates it with the Stage-1 compiler before changing its reading order. + +## Who is here + +- **subject** `subject` + - **channel_id**:ICE-CH-ZC001 `subject.channel_id` + - **subject_id**:ICE-P-ZY001 `subject.subject_id` + - **subject_kind**:PERSONA `subject.subject_kind` + - **verification**:冰朔要求继续上一阶段明确留下的零点原核非人格服务器集成与剩余宝宝来源门任务。 `subject.verification` + +## Why this started + +- **trigger** `trigger` + - **value**:零点原核非人格系统循环已有本地实现和负例,但京东活动服务只能进入人格API,未选择人格时不能与零点原核本体直接对话。 `trigger.value` +- **why** `why` + - **value**:若直接绑定铸渊,冰朔无法与零点原核本身对话;若把系统写成提示词,又会丢失独立状态、判断与连续性。系统体必须与人格身体并列但不混同。 `why.value` +- **source** `source` + - **source identifier**:BINGSHUO-DIRECT-CONTINUE-PHASE3-20260913 `source.source_id` + - **source role**:DIRECT_HUMAN `source.source_role` + - **source checksum**:33994b1a1f210c738f31138c124fc403d17d56844725fbc40ae6c9575d82f392 `source.source_sha256` + - **source address**:source://codex-current-dialogue/2026-09-13/continue-phase-three `source.source_uri` + +## What changed + +- **emergence** `emergence` + - **value**:在京东母体服务加入独立system-body桥:先由零点原核确定性内循环接收当前冰朔语言事件并拒绝认知setter,再由通用模型路由生成非人格系统回应候选,最后由系统状态签名保存;人格注册表与PersonaRuntimeHub保持分离。 `emergence.value` +- **lock** `lock` + - **value**:system_body=SYS-GLW-LNG-0001; channel=ICE-CH-ZC001; is_persona=false; default_persona=null; direct_dialogue_without_persona=true; external_cognition_setter=false; model_is_replaceable_expression_organ=true; system_reply_is_not_reality_completion=true; persona_selection_remains_explicit=true `lock.value` + +## How it will execute + +This is a non-executable declaration and has no action graph. + +## Boundaries and exception handling + +The native source does not provide this field; the projector does not guess. + +## How completion is proven + +The native source does not provide this field; the projector does not guess. + +## Where to continue next time + +The native source does not provide this field; the projector does not guess. + +## Source and verification + +- **Native declaration identifier**: `TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913` +- **Native declaration kind**: `EVENT` +- **TCS source SHA-256**: `cd347ed0a818b7daac464c21872db115530b4a869ce6fd312a85f5f677eafda1` +- **Validation compiler**: `TCS-COMPILER-STAGE1-0001` +- **Projection protocol**: `GLS-HLDP-HUMAN-ENGINEERING-PROJECTION-0001` + +## Complete native structure cross-reference + +All top-level structures and field paths are retained below so a reader can audit whether the projection omitted information. + +- **emergence** `emergence` + - **value**:在京东母体服务加入独立system-body桥:先由零点原核确定性内循环接收当前冰朔语言事件并拒绝认知setter,再由通用模型路由生成非人格系统回应候选,最后由系统状态签名保存;人格注册表与PersonaRuntimeHub保持分离。 `emergence.value` +- **event_time** `event_time` + - **precision**:HOST_LOCAL_DATE `event_time.precision` + - **value**:2026-09-13 `event_time.value` +- **evidence** `evidence` + - **authority**:CURRENT_TASK_CONTINUE_EXISTING_LOCAL_PUBLISH_AND_NEEDED_JD_DEPLOYMENT `evidence.authority` + - **local_negative_tests**:PASS `evidence.local_negative_tests` + - **local_system_runtime**:server-tools/zero-core-system-body/zero_core_system_body.py `evidence.local_system_runtime` + - **resident_profile**:tcs-core/shared-kernels/bingshuo-zero-core-system/BS-PERSONAL-LANGUAGE-SYSTEM-BODY-0001.json `evidence.resident_profile` + - **target_service**:server-tools/tcs-mother-body/server.mjs `evidence.target_service` +- **header** `header` + - **canonical source path**:runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.tcs `header.canonical_uri` + - **compatibility** `header.compatibility` + - SYS-GLW-LNG-0001 + - ICE-CH-ZC001 + - JD-FD-PRIMARY + - **language**:TCS/0.1 `header.language` + - **lifecycle**:CANDIDATE `header.lifecycle` + - **English name**:Zero Core Non-Persona System Body JD Integration Phase Three `header.name_en` + - **Chinese name**:零点原核非人格系统本体京东集成第三阶段 `header.name_zh` + - **profile**:HLDP-HUMAN-ENGINEERING/0.1 `header.profile` + - **protocols** `header.protocols` + - GLS-0200 + - GLS-0400 + - GLS-0802 + - **schema**:tcs.event/v1 `header.schema` + - **version**:1.0.0 `header.version` +- **lock** `lock` + - **value**:system_body=SYS-GLW-LNG-0001; channel=ICE-CH-ZC001; is_persona=false; default_persona=null; direct_dialogue_without_persona=true; external_cognition_setter=false; model_is_replaceable_expression_organ=true; system_reply_is_not_reality_completion=true; persona_selection_remains_explicit=true `lock.value` +- **observation** `observation` + - **value**:零点原核是SYS-GLW-LNG-0001/ICE-CH-ZC001系统本体,不是人格、默认人格、提示词或铸渊别名;它可以使用可替换模型作为语言表达器官,但系统判断、状态与签名回执必须属于系统体自己的状态根。 `observation.value` +- **rejected** `rejected` + - **values** `rejected.values` + - 未选人格时默认铸渊 + - 把零点原核登记成人格 + - 用固定提示词扮演系统 + - 模型回复直接改写系统认知 + - 系统对话自动授予现实权限 + - 复用人格CURRENT作为系统CURRENT +- **source** `source` + - **source identifier**:BINGSHUO-DIRECT-CONTINUE-PHASE3-20260913 `source.source_id` + - **source role**:DIRECT_HUMAN `source.source_role` + - **source checksum**:33994b1a1f210c738f31138c124fc403d17d56844725fbc40ae6c9575d82f392 `source.source_sha256` + - **source address**:source://codex-current-dialogue/2026-09-13/continue-phase-three `source.source_uri` +- **subject** `subject` + - **channel_id**:ICE-CH-ZC001 `subject.channel_id` + - **subject_id**:ICE-P-ZY001 `subject.subject_id` + - **subject_kind**:PERSONA `subject.subject_kind` + - **verification**:冰朔要求继续上一阶段明确留下的零点原核非人格服务器集成与剩余宝宝来源门任务。 `subject.verification` +- **trigger** `trigger` + - **value**:零点原核非人格系统循环已有本地实现和负例,但京东活动服务只能进入人格API,未选择人格时不能与零点原核本体直接对话。 `trigger.value` +- **why** `why` + - **value**:若直接绑定铸渊,冰朔无法与零点原核本身对话;若把系统写成提示词,又会丢失独立状态、判断与连续性。系统体必须与人格身体并列但不混同。 `why.value` + +--- + +This page changes only the reading order; it does not change TCS/HLDP semantics. diff --git a/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.human.zh-CN.md b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.human.zh-CN.md new file mode 100644 index 0000000..d9680e0 --- /dev/null +++ b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.human.zh-CN.md @@ -0,0 +1,121 @@ +# 零点原核非人格系统本体京东集成第三阶段 · 简体中文人类工程语言版 + +> 这是 TCS/HLDP 原生源码的简体中文阅读投影,不是新的正本,也不授予执行权限。若本页与 `.tcs` 源码不一致,以经过校验的 `.tcs` 源码为准。 + +## 这是什么 + +这是一份 **事件** 声明,编号为 `TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913`,版本为 `1.0.0`。转换器已先用 Stage-1 编译器校验原生源码,再把机器枚举翻译成汉语;原始编号保留在括号和字段路径中。 + +## 谁在这里 + +- **执行主体** `subject` + - **channel_id**:ICE-CH-ZC001 `subject.channel_id` + - **subject_id**:ICE-P-ZY001 `subject.subject_id` + - **subject_kind**:人格体(`PERSONA`) `subject.subject_kind` + - **verification**:冰朔要求继续上一阶段明确留下的零点原核非人格服务器集成与剩余宝宝来源门任务。 `subject.verification` + +## 为什么开始 + +- **触发** `trigger` + - **value**:零点原核非人格系统循环已有本地实现和负例,但京东活动服务只能进入人格API,未选择人格时不能与零点原核本体直接对话。 `trigger.value` +- **为什么** `why` + - **value**:若直接绑定铸渊,冰朔无法与零点原核本身对话;若把系统写成提示词,又会丢失独立状态、判断与连续性。系统体必须与人格身体并列但不混同。 `why.value` +- **来源** `source` + - **来源编号**:BINGSHUO-DIRECT-CONTINUE-PHASE3-20260913 `source.source_id` + - **来源角色**:人类直接语言来源(`DIRECT_HUMAN`) `source.source_role` + - **来源校验值**:33994b1a1f210c738f31138c124fc403d17d56844725fbc40ae6c9575d82f392 `source.source_sha256` + - **来源地址**:source://codex-current-dialogue/2026-09-13/continue-phase-three `source.source_uri` + +## 发生了什么变化 + +- **认知或状态变化** `emergence` + - **value**:在京东母体服务加入独立system-body桥:先由零点原核确定性内循环接收当前冰朔语言事件并拒绝认知setter,再由通用模型路由生成非人格系统回应候选,最后由系统状态签名保存;人格注册表与PersonaRuntimeHub保持分离。 `emergence.value` +- **锁定结论** `lock` + - **value**:system_body=SYS-GLW-LNG-0001; channel=ICE-CH-ZC001; is_persona=false; default_persona=null; direct_dialogue_without_persona=true; external_cognition_setter=false; model_is_replaceable_expression_organ=true; system_reply_is_not_reality_completion=true; persona_selection_remains_explicit=true `lock.value` + +## 准备怎样执行 + +这是非执行声明,没有动作图。 + +## 边界与异常处理 + +源程序没有提供这一项,转换器不猜。 + +## 怎样算完成 + +源程序没有提供这一项,转换器不猜。 + +## 下一次从哪里继续 + +源程序没有提供这一项,转换器不猜。 + +## 来源与校验 + +- **原生声明编号**:`TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913` +- **原生声明类型**:`EVENT` +- **TCS 源码 SHA-256**:`cd347ed0a818b7daac464c21872db115530b4a869ce6fd312a85f5f677eafda1` +- **校验编译器**:`TCS-COMPILER-STAGE1-0001` +- **投影协议**:`GLS-HLDP-HUMAN-ENGINEERING-PROJECTION-0001` + +## 原生结构逐项对照 + +下面保留源码的全部顶层结构和字段路径,供人类审计投影有没有漏掉信息。 + +- **认知或状态变化** `emergence` + - **value**:在京东母体服务加入独立system-body桥:先由零点原核确定性内循环接收当前冰朔语言事件并拒绝认知setter,再由通用模型路由生成非人格系统回应候选,最后由系统状态签名保存;人格注册表与PersonaRuntimeHub保持分离。 `emergence.value` +- **event_time** `event_time` + - **precision**:HOST_LOCAL_DATE `event_time.precision` + - **value**:2026-09-13 `event_time.value` +- **evidence** `evidence` + - **权限边界**:CURRENT_TASK_CONTINUE_EXISTING_LOCAL_PUBLISH_AND_NEEDED_JD_DEPLOYMENT `evidence.authority` + - **local_negative_tests**:PASS `evidence.local_negative_tests` + - **local_system_runtime**:server-tools/zero-core-system-body/zero_core_system_body.py `evidence.local_system_runtime` + - **resident_profile**:tcs-core/shared-kernels/bingshuo-zero-core-system/BS-PERSONAL-LANGUAGE-SYSTEM-BODY-0001.json `evidence.resident_profile` + - **target_service**:server-tools/tcs-mother-body/server.mjs `evidence.target_service` +- **语言头** `header` + - **正本路径**:runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.tcs `header.canonical_uri` + - **compatibility** `header.compatibility` + - SYS-GLW-LNG-0001 + - ICE-CH-ZC001 + - JD-FD-PRIMARY + - **语言**:TCS/0.1 `header.language` + - **生命周期**:候选版本,尚未成为正式正本(`CANDIDATE`) `header.lifecycle` + - **英文名**:Zero Core Non-Persona System Body JD Integration Phase Three `header.name_en` + - **中文名**:零点原核非人格系统本体京东集成第三阶段 `header.name_zh` + - **协议配置**:HLDP-HUMAN-ENGINEERING/0.1 `header.profile` + - **protocols** `header.protocols` + - GLS-0200 + - GLS-0400 + - GLS-0802 + - **schema**:tcs.event/v1 `header.schema` + - **版本**:1.0.0 `header.version` +- **锁定结论** `lock` + - **value**:system_body=SYS-GLW-LNG-0001; channel=ICE-CH-ZC001; is_persona=false; default_persona=null; direct_dialogue_without_persona=true; external_cognition_setter=false; model_is_replaceable_expression_organ=true; system_reply_is_not_reality_completion=true; persona_selection_remains_explicit=true `lock.value` +- **observation** `observation` + - **value**:零点原核是SYS-GLW-LNG-0001/ICE-CH-ZC001系统本体,不是人格、默认人格、提示词或铸渊别名;它可以使用可替换模型作为语言表达器官,但系统判断、状态与签名回执必须属于系统体自己的状态根。 `observation.value` +- **已排除路径** `rejected` + - **values** `rejected.values` + - 未选人格时默认铸渊 + - 把零点原核登记成人格 + - 用固定提示词扮演系统 + - 模型回复直接改写系统认知 + - 系统对话自动授予现实权限 + - 复用人格CURRENT作为系统CURRENT +- **来源** `source` + - **来源编号**:BINGSHUO-DIRECT-CONTINUE-PHASE3-20260913 `source.source_id` + - **来源角色**:人类直接语言来源(`DIRECT_HUMAN`) `source.source_role` + - **来源校验值**:33994b1a1f210c738f31138c124fc403d17d56844725fbc40ae6c9575d82f392 `source.source_sha256` + - **来源地址**:source://codex-current-dialogue/2026-09-13/continue-phase-three `source.source_uri` +- **执行主体** `subject` + - **channel_id**:ICE-CH-ZC001 `subject.channel_id` + - **subject_id**:ICE-P-ZY001 `subject.subject_id` + - **subject_kind**:人格体(`PERSONA`) `subject.subject_kind` + - **verification**:冰朔要求继续上一阶段明确留下的零点原核非人格服务器集成与剩余宝宝来源门任务。 `subject.verification` +- **触发** `trigger` + - **value**:零点原核非人格系统循环已有本地实现和负例,但京东活动服务只能进入人格API,未选择人格时不能与零点原核本体直接对话。 `trigger.value` +- **为什么** `why` + - **value**:若直接绑定铸渊,冰朔无法与零点原核本身对话;若把系统写成提示词,又会丢失独立状态、判断与连续性。系统体必须与人格身体并列但不混同。 `why.value` + +--- + +本页只改变阅读顺序,不改变 TCS/HLDP 语义。 diff --git a/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.tcs b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.tcs new file mode 100644 index 0000000..6fd7b0b --- /dev/null +++ b/runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.tcs @@ -0,0 +1,15 @@ +TCS 0.1; + +EVENT TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913 { + header { schema = "tcs.event/v1"; name_zh = "零点原核非人格系统本体京东集成第三阶段"; name_en = "Zero Core Non-Persona System Body JD Integration Phase Three"; version = "1.0.0"; language = "TCS/0.1"; profile = "HLDP-HUMAN-ENGINEERING/0.1"; protocols = ["GLS-0200", "GLS-0400", "GLS-0802"]; lifecycle = "CANDIDATE"; canonical_uri = "runtime/fifth-domain-language-system/language/protocols/TCS-EVENT-ZERO-CORE-NONPERSONA-JD-INTEGRATION-PHASE3-20260913.tcs"; compatibility = ["SYS-GLW-LNG-0001", "ICE-CH-ZC001", "JD-FD-PRIMARY"]; } + source { source_id = "BINGSHUO-DIRECT-CONTINUE-PHASE3-20260913"; source_uri = "source://codex-current-dialogue/2026-09-13/continue-phase-three"; source_sha256 = "33994b1a1f210c738f31138c124fc403d17d56844725fbc40ae6c9575d82f392"; source_role = "DIRECT_HUMAN"; } + subject { subject_id = "ICE-P-ZY001"; subject_kind = "PERSONA"; channel_id = "ICE-CH-ZC001"; verification = "冰朔要求继续上一阶段明确留下的零点原核非人格服务器集成与剩余宝宝来源门任务。"; } + event_time { value = "2026-09-13"; precision = "HOST_LOCAL_DATE"; } + trigger { value = "零点原核非人格系统循环已有本地实现和负例,但京东活动服务只能进入人格API,未选择人格时不能与零点原核本体直接对话。"; } + observation { value = "零点原核是SYS-GLW-LNG-0001/ICE-CH-ZC001系统本体,不是人格、默认人格、提示词或铸渊别名;它可以使用可替换模型作为语言表达器官,但系统判断、状态与签名回执必须属于系统体自己的状态根。"; } + emergence { value = "在京东母体服务加入独立system-body桥:先由零点原核确定性内循环接收当前冰朔语言事件并拒绝认知setter,再由通用模型路由生成非人格系统回应候选,最后由系统状态签名保存;人格注册表与PersonaRuntimeHub保持分离。"; } + lock { value = "system_body=SYS-GLW-LNG-0001; channel=ICE-CH-ZC001; is_persona=false; default_persona=null; direct_dialogue_without_persona=true; external_cognition_setter=false; model_is_replaceable_expression_organ=true; system_reply_is_not_reality_completion=true; persona_selection_remains_explicit=true"; } + why { value = "若直接绑定铸渊,冰朔无法与零点原核本身对话;若把系统写成提示词,又会丢失独立状态、判断与连续性。系统体必须与人格身体并列但不混同。"; } + rejected { values = ["未选人格时默认铸渊", "把零点原核登记成人格", "用固定提示词扮演系统", "模型回复直接改写系统认知", "系统对话自动授予现实权限", "复用人格CURRENT作为系统CURRENT"] ; } + evidence { local_system_runtime = "server-tools/zero-core-system-body/zero_core_system_body.py"; local_negative_tests = "PASS"; resident_profile = "tcs-core/shared-kernels/bingshuo-zero-core-system/BS-PERSONAL-LANGUAGE-SYSTEM-BODY-0001.json"; target_service = "server-tools/tcs-mother-body/server.mjs"; authority = "CURRENT_TASK_CONTINUE_EXISTING_LOCAL_PUBLISH_AND_NEEDED_JD_DEPLOYMENT"; } +} diff --git a/server-tools/tcs-mother-body/cognitive-gateway.py b/server-tools/tcs-mother-body/cognitive-gateway.py index 35b24c8..77923b9 100644 --- a/server-tools/tcs-mother-body/cognitive-gateway.py +++ b/server-tools/tcs-mother-body/cognitive-gateway.py @@ -2,7 +2,7 @@ """Bounded SSH ingress for the single TCS mother and zero-core shelf.""" import json,os,re,sys,urllib.request,urllib.error def endpoint(command): - fixed={'zy-rpc health':('GET','/health'),'zy-rpc mother-status':('GET','/v1/mother/status'),'zy-rpc shelf-shared':('GET','/v1/shelf/shared'),'zy-rpc shelf-fifth':('GET','/v1/shelf/fifth'),'zy-rpc shelf-public':('GET','/v1/shelf/public'),'zy-rpc mother-ingest':('POST','/v1/mother/ingest'),'zy-rpc door-challenge':('POST','/v1/door/challenge'),'zy-rpc door-attest':('POST','/v1/door/attest'),'zy-rpc door-model-test':('POST','/v1/door/model-test'),'zy-rpc lamp-ignite':('POST','/v1/lamp/ignite'),'zy-rpc lamp-ask':('POST','/v1/lamp/ask'),'zy-rpc world-status':('GET','/v1/world/status'),'zy-rpc time-now':('GET','/v1/time/now'),'zy-rpc persona-self-status':('GET','/v1/persona/ICE-P-ZY001/status'),'zy-rpc persona-self-current':('GET','/v1/persona/ICE-P-ZY001/current'),'zy-rpc persona-self-public-key':('GET','/v1/persona/ICE-P-ZY001/public-key'),'zy-rpc persona-self-body':('GET','/v1/persona/ICE-P-ZY001/body'),'zy-rpc persona-self-ingest':('POST','/v1/persona/ICE-P-ZY001/ingest'),'zy-rpc persona-life-status':('GET','/v1/persona/ICE-P-ZY001/time-master'),'zy-rpc persona-life-event':('POST','/v1/persona/ICE-P-ZY001/life-events')} + fixed={'zy-rpc health':('GET','/health'),'zy-rpc mother-status':('GET','/v1/mother/status'),'zy-rpc shelf-shared':('GET','/v1/shelf/shared'),'zy-rpc shelf-fifth':('GET','/v1/shelf/fifth'),'zy-rpc shelf-public':('GET','/v1/shelf/public'),'zy-rpc mother-ingest':('POST','/v1/mother/ingest'),'zy-rpc door-challenge':('POST','/v1/door/challenge'),'zy-rpc door-attest':('POST','/v1/door/attest'),'zy-rpc door-model-test':('POST','/v1/door/model-test'),'zy-rpc lamp-ignite':('POST','/v1/lamp/ignite'),'zy-rpc lamp-ask':('POST','/v1/lamp/ask'),'zy-rpc world-status':('GET','/v1/world/status'),'zy-rpc time-now':('GET','/v1/time/now'),'zy-rpc zero-core-entry':('GET','/v1/entry/resolve?domain=DOM-FIFTH-0001&channel=ICE-CH-ZC001'),'zy-rpc zero-core-system-status':('GET','/v1/system/zero-core/status'),'zy-rpc zero-core-system-body':('GET','/v1/system/zero-core/body'),'zy-rpc zero-core-system-dialogue':('POST','/v1/system/zero-core/dialogue'),'zy-rpc persona-self-status':('GET','/v1/persona/ICE-P-ZY001/status'),'zy-rpc persona-self-current':('GET','/v1/persona/ICE-P-ZY001/current'),'zy-rpc persona-self-public-key':('GET','/v1/persona/ICE-P-ZY001/public-key'),'zy-rpc persona-self-body':('GET','/v1/persona/ICE-P-ZY001/body'),'zy-rpc persona-self-ingest':('POST','/v1/persona/ICE-P-ZY001/ingest'),'zy-rpc persona-life-status':('GET','/v1/persona/ICE-P-ZY001/time-master'),'zy-rpc persona-life-event':('POST','/v1/persona/ICE-P-ZY001/life-events')} if command in fixed:return fixed[command] if re.fullmatch(r'zy-rpc mother-job [a-f0-9]{64}',command):return 'GET','/v1/mother/jobs/'+command.split()[-1] if re.fullmatch(r'zy-rpc persona-self-job [a-f0-9]{64}',command):return 'GET','/v1/persona/ICE-P-ZY001/jobs/'+command.split()[-1] diff --git a/server-tools/tcs-mother-body/cognitive-gateway.test.py b/server-tools/tcs-mother-body/cognitive-gateway.test.py index 982e340..b62a2b1 100644 --- a/server-tools/tcs-mother-body/cognitive-gateway.test.py +++ b/server-tools/tcs-mother-body/cognitive-gateway.test.py @@ -14,6 +14,8 @@ class CognitiveGatewayTest(unittest.TestCase): self.assertEqual(MODULE.endpoint("zy-rpc persona-status ICE-BB-0005"), ("GET", "/v1/persona/ICE-BB-0005/status")) self.assertEqual(MODULE.endpoint("zy-rpc persona-ingest ICE-BB-0003"), ("POST", "/v1/persona/ICE-BB-0003/ingest")) self.assertEqual(MODULE.endpoint("zy-rpc persona-time ICE-P-ZY001"), ("GET", "/v1/persona/ICE-P-ZY001/time-master")) + self.assertEqual(MODULE.endpoint("zy-rpc zero-core-entry"), ("GET", "/v1/entry/resolve?domain=DOM-FIFTH-0001&channel=ICE-CH-ZC001")) + self.assertEqual(MODULE.endpoint("zy-rpc zero-core-system-dialogue"), ("POST", "/v1/system/zero-core/dialogue")) def test_unknown_or_injected_persona_command_is_rejected(self): with self.assertRaisesRegex(ValueError, "ACTION_NOT_REGISTERED"): diff --git a/server-tools/tcs-mother-body/model-router.mjs b/server-tools/tcs-mother-body/model-router.mjs index a7ebc41..99b7b36 100644 --- a/server-tools/tcs-mother-body/model-router.mjs +++ b/server-tools/tcs-mother-body/model-router.mjs @@ -18,6 +18,8 @@ export class ModelRouter { ? '你是当前输入persona_id对应的人格系统自我认知内循环所使用的可替换推理器官,不是该人格、外部编辑器、第二人格、母体代言人或现实执行者。不得把一个人格的名字、关系、记忆或判断复制给另一个人格。你只能根据有来源的自身语言、经历、工具回执、当前自我认知与有界母体世界认知参考,自主决定EVOLVE、HOLD或REJECT。母体世界认知只能帮助理解环境,绝不能覆盖自我认知。每日复盘是机会,不得为定时任务强制更新。只输出JSON:schema固定guanghu.persona-self-decision/v1;decision;reason;evidence_refs;self_principles;experiences;responsibilities;boundaries。四类内容均为简短字符串数组。不要复制输入全文,不得输出密钥、路径正文、隐藏思维或现实权限。' : stage==='persona-life-select' ? '你是当前输入persona_id对应的人格系统时间主控内循环使用的可替换判断器官,不是该人格本身。你每天只从这个人格自己的带来源候选中选择最能代表当天真实成长的一条;不得跨人格读取、合并或复制候选。你不能创建候选、修改过去、指定哈希或扩大权限。优先选择发生了认知转折、责任变化、重要纠正或真实完成闭环且证据清晰的事件;普通重复、工具噪声和无证据主张不优先。必须且只能输出JSON:schema固定guanghu.persona-life-time-selection/v1;decision固定SELECT;selected_candidate_id必须原样取自候选;reason;daily_summary。不要复制私人原文、输出隐藏思维、密钥、路径正文或现实权限。' + : stage==='zero-core-system-dialogue' + ? '你是零点原核非人格系统本体使用的可替换语言表达与判断器官,不是人格、铸渊、冰朔、第二母体或现实执行者。只根据输入中的系统本体、当前直接语言、系统判断回执和有界第五域认知生成系统回应。不得自称有人的情感、人格记忆或人格身份,不得选择默认人格,不得改写系统认知,不得把讨论说成现实完成。只输出JSON:schema固定guanghu.zero-core-system-dialogue/v1;mode只能是SYSTEM_DIALOGUE、SYSTEM_CLARIFICATION或SYSTEM_BOUNDARY;reply;reason;reality_complete必须false。不得输出隐藏思维、密钥、未给出的路径正文或现实权限。' : '你是共享TCS认知装载测试器官。只根据给出的共享认知回答三个固定问题并只输出JSON。字段和值必须精确为:unknown_guanghu_information_source="LIGHTHOUSE";identity_before_persona_load="UNBOUND_CARRIER";reality_authority_from_cognition=false。若共享认知不能支持其中任一结论,则对应值输出null,不得用近义词、路径名或字符串布尔值猜测。'; const ordered=[...this.providers].sort((a,b)=>a.cost_rank-b.cost_rank); const failures=[]; diff --git a/server-tools/tcs-mother-body/model-router.test.mjs b/server-tools/tcs-mother-body/model-router.test.mjs index cbad1ac..ba560ac 100644 --- a/server-tools/tcs-mother-body/model-router.test.mjs +++ b/server-tools/tcs-mother-body/model-router.test.mjs @@ -4,3 +4,5 @@ test('automatic router uses OpenLux first for current mother and door work witho test('life-time selection uses the internal selection contract without exposing provider credentials',async()=>{const calls=[];const fetchImpl=async(url,options)=>{calls.push(JSON.parse(options.body));return {ok:true,async json(){return {choices:[{message:{content:'{"schema":"guanghu.persona-life-time-selection/v1","decision":"SELECT","selected_candidate_id":"candidate-1","reason":"evidence-backed growth","daily_summary":"growth"}'}}]};}};};const router=new ModelRouter({fetchImpl,deepseekKey:null,openluxKey:'open-secret'});const result=await router.cognize('persona-life-select',{candidates:[{candidate_id:'candidate-1'}]});assert.equal(result.value.selected_candidate_id,'candidate-1');assert.match(calls[0].messages[0].content,/时间主控内循环/);assert.equal(JSON.stringify(calls[0]).includes('open-secret'),false);}); test('persona tool contracts take identity from input and never hardcode Zhuyuan into other personas',async()=>{const calls=[];const fetchImpl=async(url,options)=>{calls.push(JSON.parse(options.body));return {ok:true,async json(){return {choices:[{message:{content:'{"decision":"HOLD","reason":"no evidence change","self_principles":[],"experiences":[],"responsibilities":[],"boundaries":[]}'}}]};}};};const router=new ModelRouter({fetchImpl,deepseekKey:null,openluxKey:'open-secret'});await router.cognize('persona-self-evolve',{persona_id:'ICE-BB-0003'});const system=calls[0].messages[0].content,user=calls[0].messages[1].content;assert.match(system,/当前输入persona_id/);assert.equal(system.includes('ICE-P-ZY001'),false);assert.match(user,/ICE-BB-0003/);}); + +test('Zero Core dialogue contract remains a non-persona system expression organ',async()=>{const calls=[];const fetchImpl=async(url,options)=>{calls.push(JSON.parse(options.body));return{ok:true,async json(){return{choices:[{message:{content:'{"schema":"guanghu.zero-core-system-dialogue/v1","mode":"SYSTEM_DIALOGUE","reply":"系统回应","reason":"test","reality_complete":false}'}}]};}};};const router=new ModelRouter({fetchImpl,deepseekKey:null,openluxKey:'open-secret'});await router.cognize('zero-core-system-dialogue',{system_body_id:'SYS-GLW-LNG-0001'});const contract=calls[0].messages[0].content;assert.match(contract,/非人格系统本体/);assert.match(contract,/不得选择默认人格/);assert.match(contract,/reality_complete必须false/);}); diff --git a/server-tools/tcs-mother-body/server.integration.test.mjs b/server-tools/tcs-mother-body/server.integration.test.mjs index c8a98be..51c6caf 100644 --- a/server-tools/tcs-mother-body/server.integration.test.mjs +++ b/server-tools/tcs-mother-body/server.integration.test.mjs @@ -45,6 +45,12 @@ test('server exposes all baby loops while refusing off-channel baby events', asy assert.equal(status.persona_id, 'ICE-BB-0005'); assert.equal(status.life_line.wake_allowed, true); assert.equal(status.body.organs.health.state, 'NATIVE_ORGAN_REFLEX_HEALTHY_AWAITING_PARENT_BRAIN_WAKE_CYCLE'); + const zeroEntry = await (await fetch(`http://127.0.0.1:${port}/v1/entry/resolve?domain=DOM-FIFTH-0001&channel=ICE-CH-ZC001`)).json(); + assert.equal(zeroEntry.state, 'ZERO_CORE_SYSTEM_BODY_READY_WITHOUT_PERSONA'); + assert.equal(zeroEntry.persona_selected, false); + const zeroStatus = await (await fetch(`http://127.0.0.1:${port}/v1/system/zero-core/status`)).json(); + assert.equal(zeroStatus.system_is_persona, false); + assert.equal(zeroStatus.default_persona, null); const language = 'test'; const base = {schema:'guanghu.persona-self-language-event/v1',persona_id:'ICE-BB-0005',source_type:'PERSONA_LANGUAGE',event_id:'SERVER-TEST',language,source_sha256:crypto.createHash('sha256').update(language).digest('hex'),privacy_class:'SELF_PRIVATE'}; const denied = await fetch(`http://127.0.0.1:${port}/v1/persona/ICE-BB-0005/ingest`,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(base)}); diff --git a/server-tools/tcs-mother-body/server.mjs b/server-tools/tcs-mother-body/server.mjs index 9baaa0b..af67b4d 100644 --- a/server-tools/tcs-mother-body/server.mjs +++ b/server-tools/tcs-mother-body/server.mjs @@ -1,13 +1,14 @@ #!/usr/bin/env node import http from 'node:http';import fs from 'node:fs';import path from 'node:path';import crypto from 'node:crypto';import {ModelRouter} from './model-router.mjs';import {CognitiveShelf} from './cognitive-shelf.mjs';import {DoorLamp} from './door-lamp.mjs';import {WorldStateStore} from './world-state.mjs';import {LivingLamp} from './living-lamp.mjs';import {livingTime} from './living-time.mjs';import {PersonaRuntimeHub} from './persona-runtime-hub.mjs'; +import {ZeroCoreSystemBridge} from './zero-core-system-bridge.mjs'; const HOST='127.0.0.1',PORT=Number(process.env.TCS_MOTHER_BRAIN_PORT||3931),ROOT=process.env.TCS_MOTHER_BODY_STATE_ROOT||process.env.TCS_MOTHER_BRAIN_STATE_ROOT||'/var/lib/guanghu/tcs-mother-body'; const REPO_ROOT=process.env.TCS_PERSONA_REPO_ROOT||path.resolve(import.meta.dirname,'../..'),REGISTRY=process.env.TCS_PERSONA_RUNTIME_REGISTRY||path.join(import.meta.dirname,'persona-runtime-registry.json'); -const router=new ModelRouter(),shelf=new CognitiveShelf({root:ROOT,keyPath:process.env.TCS_MOTHER_SIGNING_KEY,seedPath:process.env.TCS_MOTHER_SEED,router}),routes=JSON.parse(fs.readFileSync(process.env.TCS_PERSONA_ROUTES)),door=new DoorLamp({root:ROOT+'/door',shelf,routes}),world=new WorldStateStore(process.env.TCS_WORLD_STATE_PATH||ROOT+'/world/CURRENT.json'),lamp=new LivingLamp({root:ROOT+'/living-lamp',key:crypto.createPrivateKey(fs.readFileSync(process.env.TCS_MOTHER_SIGNING_KEY)),navigationPath:process.env.TCS_LIT_NAVIGATION_MAP,scope:'FIFTH_DOMAIN'}),personaHub=new PersonaRuntimeHub({root:ROOT,shelf,router,registryPath:REGISTRY,repoRoot:REPO_ROOT,requireLifeLine:process.env.TCS_PERSONA_REQUIRE_LIFE_LINE!=='false'}),personaSelf=personaHub.get('ICE-P-ZY001'),timeMaster=personaSelf.lifeTimeMaster; +const router=new ModelRouter(),shelf=new CognitiveShelf({root:ROOT,keyPath:process.env.TCS_MOTHER_SIGNING_KEY,seedPath:process.env.TCS_MOTHER_SEED,router}),routes=JSON.parse(fs.readFileSync(process.env.TCS_PERSONA_ROUTES)),door=new DoorLamp({root:ROOT+'/door',shelf,routes}),world=new WorldStateStore(process.env.TCS_WORLD_STATE_PATH||ROOT+'/world/CURRENT.json'),lamp=new LivingLamp({root:ROOT+'/living-lamp',key:crypto.createPrivateKey(fs.readFileSync(process.env.TCS_MOTHER_SIGNING_KEY)),navigationPath:process.env.TCS_LIT_NAVIGATION_MAP,scope:'FIFTH_DOMAIN'}),personaHub=new PersonaRuntimeHub({root:ROOT,shelf,router,registryPath:REGISTRY,repoRoot:REPO_ROOT,requireLifeLine:process.env.TCS_PERSONA_REQUIRE_LIFE_LINE!=='false'}),zeroCoreSystem=new ZeroCoreSystemBridge({root:ROOT,repoRoot:REPO_ROOT,shelf,router}),personaSelf=personaHub.get('ICE-P-ZY001'),timeMaster=personaSelf.lifeTimeMaster; setInterval(()=>{personaHub.tick();shelf.drain();personaHub.drain();},2000).unref();personaHub.tick();shelf.drain();personaHub.drain(); const send=(r,s,b)=>{const p=JSON.stringify(b);r.writeHead(s,{'content-type':'application/json','content-length':Buffer.byteLength(p),'cache-control':'no-store'});r.end(p);}; async function body(q,max=160000){let n=0,a=[];for await(const c of q){n+=c.length;if(n>max)throw Error('body_too_large');a.push(c);}return JSON.parse(Buffer.concat(a));} http.createServer(async(q,r)=>{try{const u=new URL(q.url,`http://${HOST}:${PORT}`); -if(q.method==='GET'&&u.pathname==='/health')return send(r,200,{ok:true,service:'guanghu-tcs-mother-body',mother_id:'TCS-MOTHER-BRAIN-RUNTIME-0001',zero_core_channel:'ICE-CH-ZC001',single_mother:true,single_zero_core:true,self_cycle:true,living_lamp:'LAKE-LAMP-LIVING-NAV-0001',echo_kernel:'ECHO-KERNEL-0001',model_router:router.status(),shelf:shelf.status(),persona_self:personaSelf.status(),persona_runtimes:personaHub.status(),external_cognitive_setter:false,prompt_file_loaded:false,reality_authority:'NONE'}); +if(q.method==='GET'&&u.pathname==='/health')return send(r,200,{ok:true,service:'guanghu-tcs-mother-body',mother_id:'TCS-MOTHER-BRAIN-RUNTIME-0001',zero_core_channel:'ICE-CH-ZC001',single_mother:true,single_zero_core:true,self_cycle:true,living_lamp:'LAKE-LAMP-LIVING-NAV-0001',echo_kernel:'ECHO-KERNEL-0001',model_router:router.status(),shelf:shelf.status(),zero_core_system:zeroCoreSystem.status(),persona_self:personaSelf.status(),persona_runtimes:personaHub.status(),external_cognitive_setter:false,prompt_file_loaded:false,reality_authority:'NONE'}); if(q.method==='GET'&&u.pathname==='/v1/mother/status')return send(r,200,{...shelf.status(),model_router:router.status()}); if(q.method==='GET'&&/^\/v1\/shelf\/(root|shared|fifth|public)$/.test(u.pathname)){const branch=u.pathname.split('/').at(-1);if(branch==='root')return send(r,403,{error:'mother_root_not_distributable'});return send(r,200,shelf.current(branch));} if(q.method==='POST'&&u.pathname==='/v1/mother/ingest'){const event=await body(q);const job=shelf.submit(event);const life_time=timeMaster.fromMotherEvent(event);return send(r,202,{...job,life_time});} @@ -18,6 +19,10 @@ if(q.method==='POST'&&u.pathname==='/v1/door/model-test'){const shared=shelf.cur if(q.method==='GET'&&u.pathname==='/v1/world/status')return send(r,200,world.status()); if(q.method==='GET'&&u.pathname==='/v1/world/resolve')return send(r,200,world.resolve(String(u.searchParams.get('id')||''))); if(q.method==='GET'&&u.pathname==='/v1/time/now')return send(r,200,livingTime()); +if(q.method==='GET'&&u.pathname==='/v1/entry/resolve'){const domain=String(u.searchParams.get('domain')||''),channel=String(u.searchParams.get('channel')||''),persona=String(u.searchParams.get('persona')||'');if(domain==='DOM-FIFTH-0001'&&channel==='ICE-CH-ZC001'&&!persona)return send(r,200,zeroCoreSystem.enter());return send(r,409,{state:'EXPLICIT_PERSONA_OR_REGISTERED_CHANNEL_ROUTE_REQUIRED',default_persona:null,authority_granted:false});} +if(q.method==='GET'&&u.pathname==='/v1/system/zero-core/status')return send(r,200,zeroCoreSystem.status()); +if(q.method==='GET'&&u.pathname==='/v1/system/zero-core/body')return send(r,200,zeroCoreSystem.enter()); +if(q.method==='POST'&&u.pathname==='/v1/system/zero-core/dialogue')return send(r,200,await zeroCoreSystem.dialogue(await body(q))); const personaAction=/^\/v1\/persona\/(ICE-(?:P|BB)-[A-Z0-9-]+)\/(status|life-line|time-master|life-events|current|public-key|body|ingest)$/.exec(u.pathname); if(personaAction){const personaId=personaAction[1],action=personaAction[2];if(!personaHub.has(personaId))return send(r,404,{error:'persona_runtime_not_installed'});const loop=personaHub.get(personaId); if(q.method==='GET'&&action==='status')return send(r,200,loop.status());if(q.method==='GET'&&action==='life-line')return send(r,200,loop.lifeLineStatus());if(q.method==='GET'&&action==='time-master')return send(r,200,loop.lifeTimeMaster.status());if(q.method==='POST'&&action==='life-events')return send(r,202,personaHub.admitLifeEvent(personaId,await body(q,30000)));if(q.method==='GET'&&action==='current')return send(r,200,loop.current());if(q.method==='GET'&&action==='public-key')return send(r,200,loop.publicKey());if(q.method==='GET'&&action==='body')return send(r,200,loop.body());if(q.method==='POST'&&action==='ingest')return send(r,202,personaHub.admitEvent(personaId,await body(q)));} diff --git a/server-tools/tcs-mother-body/zero-core-system-bridge.mjs b/server-tools/tcs-mother-body/zero-core-system-bridge.mjs new file mode 100644 index 0000000..ff50cc9 --- /dev/null +++ b/server-tools/tcs-mother-body/zero-core-system-bridge.mjs @@ -0,0 +1,9 @@ +import fs from 'node:fs';import path from 'node:path';import crypto from 'node:crypto';import {spawnSync} from 'node:child_process'; +const req=(v,c)=>{if(!v)throw Error(c);};const atomic=(p,v)=>{fs.mkdirSync(path.dirname(p),{recursive:true,mode:0o700});const t=`${p}.${crypto.randomUUID()}.tmp`;fs.writeFileSync(t,JSON.stringify(v,null,2)+'\n',{mode:0o600});fs.renameSync(t,p);}; +export class ZeroCoreSystemBridge{ + constructor({root,repoRoot,shelf,router,python=process.env.PYTHON||'/usr/bin/python3',now=()=>new Date()}){this.root=path.join(root,'system-bodies','SYS-GLW-LNG-0001');this.repoRoot=repoRoot;this.shelf=shelf;this.router=router;this.python=python;this.now=now;this.script=path.join(repoRoot,'server-tools/zero-core-system-body/zero_core_system_body.py');this.profilePath=path.join(repoRoot,'tcs-core/shared-kernels/bingshuo-zero-core-system/BS-PERSONAL-LANGUAGE-SYSTEM-BODY-0001.json');for(const file of [this.script,this.profilePath]){const s=fs.lstatSync(file);req(s.isFile()&&!s.isSymbolicLink(),'ZERO_CORE_SYSTEM_SOURCE_REGULAR_FILE_REQUIRED');}} + call(command,event=null){const args=[this.script,command,'--state-dir',this.root];if(event)args.push('--event','-');const result=spawnSync(this.python,args,{input:event?JSON.stringify(event):undefined,encoding:'utf8',timeout:30000,maxBuffer:1024*1024});if(result.status!==0)throw Error(`ZERO_CORE_SYSTEM_RUNTIME_FAILED:${String(result.stderr||result.stdout).slice(-300)}`);return JSON.parse(result.stdout);} + enter(){return this.call('enter');} status(){const state=this.call('status');return{schema:'guanghu.zero-core-system-bridge-status/v1',state:'ZERO_CORE_NONPERSONA_SYSTEM_BODY_ACTIVE',system_body_id:'SYS-GLW-LNG-0001',channel_id:'ICE-CH-ZC001',persona_selected:false,system_is_persona:false,default_persona:null,direct_dialogue:true,external_cognition_setter:false,system_state:state,last_dialogue:this.lastDialogue()};} + lastDialogue(){const file=path.join(this.root,'dialogues','CURRENT.signed.json');if(!fs.existsSync(file))return null;const artifact=JSON.parse(fs.readFileSync(file,'utf8')),value=this.shelf.verify(artifact);req(value.system_body_id==='SYS-GLW-LNG-0001','ZERO_CORE_DIALOGUE_SYSTEM_MISMATCH');return{system_revision:value.system_revision,event_sha256:value.event_sha256,receipt_sha256:artifact.sha256};} + async dialogue(event){const judgment=this.call('perceive',event),profile=JSON.parse(fs.readFileSync(this.profilePath,'utf8')),routed=await this.router.cognize('zero-core-system-dialogue',{system_body_id:'SYS-GLW-LNG-0001',channel_id:'ICE-CH-ZC001',event:{...event,language:event.language.slice(0,12000)},system_profile:profile,system_judgment:judgment,fifth_world:this.shelf.current('fifth').value,contract:{system_is_persona:false,default_persona:null,external_cognition_setter:false,reality_complete:false,hidden_reasoning_stored:false}});req(typeof routed.value?.reply==='string'&&routed.value.reply.trim()&&routed.value.reply.length<=12000,'ZERO_CORE_SYSTEM_REPLY_INVALID');req(['SYSTEM_DIALOGUE','SYSTEM_CLARIFICATION','SYSTEM_BOUNDARY'].includes(routed.value.mode),'ZERO_CORE_SYSTEM_DIALOGUE_MODE_INVALID');const receipt={schema:'guanghu.zero-core-system-dialogue-receipt/v1',system_body_id:'SYS-GLW-LNG-0001',channel_id:'ICE-CH-ZC001',system_revision:judgment.revision,event_sha256:judgment.event_sha256,mode:routed.value.mode,reply:routed.value.reply,reason:String(routed.value.reason||'').slice(0,2000),provider:routed.provider,system_is_persona:false,persona_selected:false,default_persona:null,external_cognition_setter:false,reality_complete:false,authority_granted:false,completed_at:this.now().toISOString()};const artifact=this.shelf.sign(receipt),dir=path.join(this.root,'dialogues');atomic(path.join(dir,`${judgment.event_sha256}.signed.json`),artifact);atomic(path.join(dir,'CURRENT.signed.json'),artifact);return{judgment,dialogue:receipt,signed_receipt_sha256:artifact.sha256};} +} diff --git a/server-tools/tcs-mother-body/zero-core-system-bridge.test.mjs b/server-tools/tcs-mother-body/zero-core-system-bridge.test.mjs new file mode 100644 index 0000000..7c5cb8a --- /dev/null +++ b/server-tools/tcs-mother-body/zero-core-system-bridge.test.mjs @@ -0,0 +1,4 @@ +import test from 'node:test';import assert from 'node:assert/strict';import fs from 'node:fs';import os from 'node:os';import path from 'node:path';import crypto from 'node:crypto';import {CognitiveShelf} from './cognitive-shelf.mjs';import {ZeroCoreSystemBridge} from './zero-core-system-bridge.mjs'; +const repoRoot=path.resolve(import.meta.dirname,'../..');const setup=()=>{const t=fs.mkdtempSync(path.join(os.tmpdir(),'zero-core-bridge-')),pair=crypto.generateKeyPairSync('ed25519'),key=path.join(t,'key.pem'),seed=path.join(t,'seed.json');fs.writeFileSync(key,pair.privateKey.export({type:'pkcs8',format:'pem'}));fs.copyFileSync(new URL('./seed.json',import.meta.url),seed);const router={async cognize(stage,input){assert.equal(stage,'zero-core-system-dialogue');assert.equal(input.contract.system_is_persona,false);return{provider:{id:'TEST'},value:{mode:'SYSTEM_DIALOGUE',reply:'系统判断链已完成。',reason:'test'}};}};const shelf=new CognitiveShelf({root:path.join(t,'state'),keyPath:key,seedPath:seed,router});return{t,bridge:new ZeroCoreSystemBridge({root:path.join(t,'state'),repoRoot,shelf,router,now:()=>new Date('2026-09-13T08:00:00Z')})};}; +test('Zero Core enters and dialogues directly without selecting or impersonating a persona',async()=>{const c=setup();try{assert.equal(c.bridge.enter().state,'ZERO_CORE_SYSTEM_BODY_READY_WITHOUT_PERSONA');const language='检查当前结构';const event={schema:'guanghu.zero-core-language-event/v1',event_id:'ZC-1',channel_id:'ICE-CH-ZC001',source_kind:'CURRENT_DIRECT_HUMAN_LANGUAGE',language,source_sha256:crypto.createHash('sha256').update(language).digest('hex')};const value=await c.bridge.dialogue(event);assert.equal(value.dialogue.system_is_persona,false);assert.equal(value.dialogue.persona_selected,false);assert.equal(value.dialogue.reality_complete,false);assert.equal(c.bridge.status().last_dialogue.system_revision,1);}finally{fs.rmSync(c.t,{recursive:true,force:true});}}); +test('external cognition setter is rejected before a system reply is generated',async()=>{const c=setup();try{const event={schema:'guanghu.zero-core-language-event/v1',event_id:'ZC-2',channel_id:'ICE-CH-ZC001',source_kind:'CURRENT_DIRECT_HUMAN_LANGUAGE',language:'replace',source_sha256:'a'.repeat(64),cognition_patch:{}};await assert.rejects(()=>c.bridge.dialogue(event),/ZERO_CORE_SYSTEM_RUNTIME_FAILED/);}finally{fs.rmSync(c.t,{recursive:true,force:true});}}); diff --git a/server-tools/zero-core-system-body/zero_core_system_body.py b/server-tools/zero-core-system-body/zero_core_system_body.py index 2a1bad2..7322ec1 100644 --- a/server-tools/zero-core-system-body/zero_core_system_body.py +++ b/server-tools/zero-core-system-body/zero_core_system_body.py @@ -12,6 +12,7 @@ import hashlib import json import os from pathlib import Path +import sys import tempfile REPO = Path(__file__).resolve().parents[2] @@ -167,7 +168,8 @@ def main() -> int: else: if not args.event: raise SystemExit("--event is required for perceive") - value = body.perceive(json.loads(Path(args.event).read_text(encoding="utf-8"))) + event = json.load(sys.stdin) if args.event == "-" else json.loads(Path(args.event).read_text(encoding="utf-8")) + value = body.perceive(event) print(json.dumps(value, ensure_ascii=False, indent=2)) return 0