feat: make TCS mother root the shared host entry

This commit is contained in:
冰朔 2026-09-08 13:47:41 +08:00
commit bcc3cc882f
3 changed files with 8 additions and 0 deletions

View file

@ -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 ''}`",

View file

@ -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'])