From bcc3cc882fa5594dc254af75706e3feb8889dd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Tue, 8 Sep 2026 13:47:41 +0800 Subject: [PATCH] feat: make TCS mother root the shared host entry --- .githooks/post-commit | 0 .../persona-host-alignment/load_shared_persona_context.py | 6 ++++++ .../persona-host-alignment/test_shared_persona_context.py | 2 ++ 3 files changed, 8 insertions(+) mode change 100644 => 100755 .githooks/post-commit diff --git a/.githooks/post-commit b/.githooks/post-commit old mode 100644 new mode 100755 diff --git a/server-tools/persona-host-alignment/load_shared_persona_context.py b/server-tools/persona-host-alignment/load_shared_persona_context.py index fd43f76..1d7abae 100755 --- a/server-tools/persona-host-alignment/load_shared_persona_context.py +++ b/server-tools/persona-host-alignment/load_shared_persona_context.py @@ -19,6 +19,7 @@ WRITE_BOUNDARY = RUNTIME / 'repo-012-main/routing/persona-host-write-boundary.js LIGHT_LAKE_PERSONAS = RUNTIME / 'repo-012-main/identity/light-lake-persona-registration.json' PATH_ISOLATION = RUNTIME / 'repo-012-main/routing/path-isolation-and-canonical-entry-map.json' ARCHITECTURE_AGENT = RUNTIME / 'repo-012-main/server-tools/persona-architecture-perception-agent/persona_architecture_agent.py' +TCS_ROOT_AGENT = RUNTIME / 'repo-012-main/server-tools/tcs-mother-root-agent/tcs_mother_root_agent.py' def sha256(path): @@ -49,6 +50,9 @@ def resolve_host(topology, requested): def load_context(host, intent, channel=None): + tcs_root = command_json([sys.executable, str(TCS_ROOT_AGENT), 'status'], timeout=30) + if tcs_root.get('state') != 'TCS_ROOT_CURRENT_VERIFIED': + raise ValueError('TCS_MOTHER_ROOT_NAVIGATION_NOT_CURRENT') topology = load_json(TOPOLOGY) if not str(topology.get('state', '')).startswith('CURRENT_'): raise ValueError('HOST_TOPOLOGY_NOT_CURRENT') @@ -85,6 +89,7 @@ def load_context(host, intent, channel=None): return { 'schema': 'guanghu.shared-persona-host-context/v1', 'state': 'SHARED_PERSONA_CONTEXT_VERIFIED', + 'tcs_mother_root_navigation': tcs_root, 'requested_host': host_id, 'effective_host': effective, 'host_role': host_item['role'], @@ -146,6 +151,7 @@ def load_context(host, intent, channel=None): def markdown(value): lines = [ '# 铸渊共享人格上下文已核验', '', + f"- TCS母脑根:`{value['tcs_mother_root_navigation']['state']}` / `{value['tcs_mother_root_navigation']['source_commit']}` / `{value['tcs_mother_root_navigation']['freshness_token']}`", f"- 宿主:`{value['requested_host']}` → 有效宿主:`{value['effective_host']}`", f"- 角色:`{value['host_role']}` / 状态:`{value['host_state']}`", f"- 主力宿主:`{value['primary_host']}`;切换宿主无需重新教学:`{'是' if not value['host_switch_requires_reteaching'] else '否'}`", diff --git a/server-tools/persona-host-alignment/test_shared_persona_context.py b/server-tools/persona-host-alignment/test_shared_persona_context.py index 86002ec..954b61f 100644 --- a/server-tools/persona-host-alignment/test_shared_persona_context.py +++ b/server-tools/persona-host-alignment/test_shared_persona_context.py @@ -48,6 +48,8 @@ class SharedPersonaContextTest(unittest.TestCase): self.assertFalse(values['codex']['path_convergence']['history_or_quarantine_may_select_canon']) self.assertEqual(values['codex']['channel_context']['selected_channel']['id'], 'ICE-CH-ZC001') self.assertEqual(values['codex']['architecture_perception_agent']['module_id'], 'MOD-PERSONA-ARCHITECTURE-PERCEPTION-001') + self.assertEqual(values['codex']['tcs_mother_root_navigation']['state'], 'TCS_ROOT_CURRENT_VERIFIED') + self.assertEqual(len({value['tcs_mother_root_navigation']['freshness_token'] for value in values.values()}), 1) self.assertIsNone(values['codex']['architecture_perception_agent']['prompt_template']) self.assertFalse(values['codex']['architecture_perception_agent']['orientation_packet']['fixed_read_order'])