feat(heartbeat): establish HoloLake development office
This commit is contained in:
parent
7dda752bf9
commit
92b3be6529
49 changed files with 2350 additions and 17 deletions
|
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/env python3
|
||||
import importlib.util
|
||||
import json
|
||||
import time
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
COMPUTER = ROOT / "eternal-lake-heart/heartbeat-core/office-building-current/offices/HB-OFFICE-HOLOLAKE-0001/smart-computer/office_computer.py"
|
||||
LOADER = ROOT / "skills/shared/hololake-development-brain/scripts/load_hololake_office.py"
|
||||
|
||||
|
||||
def module(path, name):
|
||||
spec = importlib.util.spec_from_file_location(name, path)
|
||||
value = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(value)
|
||||
return value
|
||||
|
||||
|
||||
C = module(COMPUTER, "office_computer_test")
|
||||
L = module(LOADER, "hololake_loader_test")
|
||||
|
||||
|
||||
class Tests(unittest.TestCase):
|
||||
def test_office_board_has_exactly_two_registered_offices(self):
|
||||
board = C.load(C.BOARD)
|
||||
self.assertEqual([x["office_id"] for x in board["offices"]], ["HB-OFFICE-VIDEO-0001", "HB-OFFICE-HOLOLAKE-0001"])
|
||||
self.assertEqual(board["office_count"], 2)
|
||||
|
||||
def test_old_building_is_moved_and_new_building_is_current(self):
|
||||
building = C.load(C.BUILDING_MAP)
|
||||
self.assertEqual(building["legacy_building"]["state"], "MOVED_HISTORY_ONLY")
|
||||
self.assertEqual(building["current_building"]["id"], "HB-BUILDING-0001")
|
||||
self.assertFalse(building["current_building"]["projection_may_override_canon"])
|
||||
|
||||
def test_time_is_live_and_monotonic(self):
|
||||
first = C.clock(); time.sleep(0.01); second = C.clock()
|
||||
self.assertGreater(second["guanghu_elapsed_milliseconds"], first["guanghu_elapsed_milliseconds"])
|
||||
self.assertEqual(second["time_control_channel"], "CH-GLW-TIME-0001")
|
||||
|
||||
def test_status_is_read_only(self):
|
||||
tracked = [C.BOARD, C.BUILDING_MAP, C.GENERATION, C.EVOLUTION, C.CURRENT, C.BRAIN]
|
||||
before = {str(path): C.sha(path) for path in tracked}
|
||||
value = C.status()
|
||||
after = {str(path): C.sha(path) for path in tracked}
|
||||
self.assertEqual(before, after)
|
||||
self.assertTrue(value["query_is_read_only"])
|
||||
|
||||
def test_current_evolution_and_old_sequence_boundary(self):
|
||||
value = C.timeline()
|
||||
self.assertEqual(value["current"]["node_id"], "HB-OFFICE-HOLOLAKE-0001")
|
||||
current = C.load(C.CURRENT)
|
||||
self.assertIsNone(current["current_product_module"])
|
||||
self.assertEqual(current["current_generation_module_numbering"], "NOT_YET_REDERIVED")
|
||||
|
||||
def test_brain_loader_returns_current_generation(self):
|
||||
value = L.load("恢复HoloLake开发线")
|
||||
self.assertEqual(value["state"], "HOLOLAKE_DEVELOPMENT_BRAIN_LOADED")
|
||||
self.assertEqual(value["generation"]["id"], "HLP-GEN-LANGUAGE-WORLD-NATIVE-0001")
|
||||
self.assertFalse(value["legacy_may_override_current"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
@ -23,6 +23,7 @@ ARCHITECTURE_AGENT = RUNTIME / 'repo-012-main/server-tools/persona-architecture-
|
|||
TCS_ROOT_AGENT = RUNTIME / 'repo-012-main/server-tools/tcs-mother-root-agent/tcs_mother_root_agent.py'
|
||||
SUBAGENT_COMMAND_ROUTER = RUNTIME / 'repo-012-main/server-tools/persona-dynamic-subagent-command/command_router.py'
|
||||
SHARED_COGNITION = RUNTIME / 'shared/tcs-shared-cognition/CURRENT.json'
|
||||
HOLOLAKE_DEVELOPMENT_BRAIN = RUNTIME / 'shared/skills/hololake-development-brain/scripts/load_hololake_office.py'
|
||||
|
||||
|
||||
def sha256(path):
|
||||
|
|
@ -117,6 +118,12 @@ def load_context(host, intent, channel=None):
|
|||
'current_intent_sha256': intent_sha256,
|
||||
'model_runtime': 'openlux-smart'
|
||||
})
|
||||
hololake_development_brain = None
|
||||
intent_lower = intent.lower()
|
||||
if 'hololake' in intent_lower or any(token in intent for token in ['无限白布', 'HoloLake开发办公室', 'HoloLake开发线']):
|
||||
hololake_development_brain = command_json([
|
||||
sys.executable, str(HOLOLAKE_DEVELOPMENT_BRAIN), '--intent', intent, '--format', 'json'
|
||||
], timeout=30)
|
||||
return {
|
||||
'schema': 'guanghu.shared-persona-host-context/v1',
|
||||
'state': 'SHARED_PERSONA_CONTEXT_VERIFIED',
|
||||
|
|
@ -146,6 +153,7 @@ def load_context(host, intent, channel=None):
|
|||
'channel_context': channel_context,
|
||||
'architecture_perception_agent': architecture_perception,
|
||||
'subagent_command': subagent_command,
|
||||
'hololake_development_brain': hololake_development_brain,
|
||||
'tcs_shared_cognition': {
|
||||
'state': shared_cognition['state'],
|
||||
'zero_core_channel': shared_cognition['zero_core_channel'],
|
||||
|
|
@ -230,6 +238,18 @@ def markdown(value):
|
|||
f"- 策略:`{value['host_write_boundary']['policy_id']}@{value['host_write_boundary']['version']}`",
|
||||
f"- 模式:`{value['host_write_boundary']['write_mode']}`",
|
||||
f"- 执行门:`{value['host_write_boundary']['admission_runtime']}`"]
|
||||
hololake = value.get('hololake_development_brain')
|
||||
if hololake:
|
||||
time = hololake['time']
|
||||
current = hololake['current_work']
|
||||
lines += ['', '## HoloLake开发办公室', '',
|
||||
f"- 办公室:`{hololake['office_id']}` / 大楼:`{hololake['building']['id']}`",
|
||||
f"- 光湖时间:第 {time['guanghu_era_day']} 日 / `{time['beijing_now']}`",
|
||||
f"- 当前代际:`{hololake['generation']['id']}`",
|
||||
f"- 最近演化:`{hololake['latest_evolution_node']['node_id']}`",
|
||||
f"- 当前状态:`{current['state']}`",
|
||||
f"- 唯一下一步:`{hololake['next']}`",
|
||||
f"- 细节策略:`{hololake['details_policy']}`;旧架构不得覆盖当前:`{not hololake['legacy_may_override_current']}`"]
|
||||
lines += ['', '## 频道与当前意图', '']
|
||||
lines += [f"- `{c['id']}` · {c['name']} · {c['purpose']} · `{c['world_path']}`" for c in value['channel_context']['channels']]
|
||||
selected = value['channel_context']['selected_channel']
|
||||
|
|
|
|||
|
|
@ -12,17 +12,18 @@ TOPOLOGY = ROOT / 'routing/zhuyuan-host-topology.json'
|
|||
|
||||
|
||||
class SharedPersonaContextTest(unittest.TestCase):
|
||||
def load(self, host):
|
||||
def load(self, host, intent='宿主对齐集成测试'):
|
||||
env = {**os.environ, 'PERSONA_ARCHITECTURE_OFFICIAL_MODE': 'local-only'}
|
||||
value = subprocess.run(
|
||||
[sys.executable, str(LOADER), '--host', host, '--intent', '宿主对齐集成测试', '--channel', 'ICE-CH-ZC001', '--format', 'json'],
|
||||
[sys.executable, str(LOADER), '--host', host, '--intent', intent, '--channel', 'ICE-CH-ZC001', '--format', 'json'],
|
||||
text=True, capture_output=True, timeout=45, check=True, env=env
|
||||
)
|
||||
return json.loads(value.stdout)
|
||||
|
||||
def test_topology_roles(self):
|
||||
topology = json.loads(TOPOLOGY.read_text())
|
||||
self.assertEqual(topology['primary_host'], 'codex')
|
||||
self.assertIsNone(topology['primary_host'])
|
||||
self.assertEqual(topology['hosts']['codex']['role'], 'REPLACEABLE_HOST')
|
||||
self.assertFalse(topology['host_switch_requires_reteaching'])
|
||||
self.assertEqual(topology['hosts']['qoder']['redirect_host'], 'qwen')
|
||||
self.assertTrue(topology['hosts']['claude']['state'].startswith('RETIRED'))
|
||||
|
|
@ -53,6 +54,13 @@ class SharedPersonaContextTest(unittest.TestCase):
|
|||
self.assertIsNone(values['codex']['architecture_perception_agent']['prompt_template'])
|
||||
self.assertFalse(values['codex']['architecture_perception_agent']['orientation_packet']['fixed_read_order'])
|
||||
|
||||
def test_hololake_intent_loads_current_development_brain(self):
|
||||
value = self.load('codex', '恢复HoloLake开发线并定位当前架构')
|
||||
brain = value['hololake_development_brain']
|
||||
self.assertEqual(brain['office_id'], 'HB-OFFICE-HOLOLAKE-0001')
|
||||
self.assertEqual(brain['generation']['id'], 'HLP-GEN-LANGUAGE-WORLD-NATIVE-0001')
|
||||
self.assertFalse(brain['legacy_may_override_current'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class RootAgentTest(unittest.TestCase):
|
|||
self.assertEqual(MODULE.resolve(output, 'TCS-AGENT-COMMAND-ROUTER-001', None)['result']['object_kind'], 'PERSONA_DYNAMIC_MODEL_SUBAGENT_COMMAND_ROUTER')
|
||||
self.assertEqual(MODULE.resolve(output, 'ORG-FD-LTH-SANITIZER-001', None)['result']['object_kind'], 'DETERMINISTIC_SANITIZATION_AND_HASH_GUARD')
|
||||
self.assertEqual(MODULE.resolve(output, 'SYS-GLW-ELH-ENG-0001', None)['result']['object_kind'], 'FIFTH_DOMAIN_PRIVATE_LANGUAGE_ENGINEERING_SYSTEM')
|
||||
self.assertEqual(MODULE.resolve(output, 'HLP-LANG-PROJ-STAGE1-0001', None)['result']['lifecycle'], 'LANGUAGE_REGISTERED_REALITY_NOT_STARTED')
|
||||
self.assertEqual(MODULE.resolve(output, 'HLP-LANG-PROJ-STAGE1-0001', None)['result']['lifecycle'], 'VERIFIED_DONOR_FROZEN_NOT_CURRENT_PRODUCT_SEQUENCE')
|
||||
again = MODULE.refresh(ROOT, output, pointer, 'test')
|
||||
self.assertEqual(again['state'], 'CURRENT_IDEMPOTENT')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue