feat(collab): launch JZAO-only HoloLake stage one

This commit is contained in:
冰朔 2026-09-09 21:22:18 +08:00
commit 1dd4a6a39e
17 changed files with 492 additions and 21 deletions

View file

@ -4,6 +4,15 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def normalize_channel_id(channel, rows):
if channel is None:
return None, 'NO_CHANNEL_PROVIDED'
requested = str(channel).strip()
matches = [item['id'] for item in rows if requested == item['id'] or requested in item.get('machine_aliases', [])]
if len(matches) != 1:
raise ValueError('UNKNOWN_OR_AMBIGUOUS_PRIVATE_CHANNEL')
return matches[0], 'EXACT' if requested == matches[0] else 'MACHINE_ALIAS_NORMALIZED'
def load_channels(channel=None, root=ROOT):
data = json.loads((root / 'routing/persona-channel-context-map.json').read_text())
if data['map_id'] != 'ZY-PERSONA-CHANNEL-CONTEXT-001':
@ -21,8 +30,8 @@ def load_channels(channel=None, root=ROOT):
if profile['world_path'] != registered['world_path']:
raise ValueError('CHANNEL_PATH_MISMATCH')
item['world_path'] = profile['world_path']
if channel is not None and channel not in {c['id'] for c in rows}:
raise ValueError('UNKNOWN_PRIVATE_CHANNEL')
return {**data, 'selected_channel': next((c for c in rows if c['id'] == channel), None),
'selection_state': 'PERSONA_SELECTED' if channel else 'PERSONA_INTERPRETATION_REQUIRED',
normalized, normalization_state = normalize_channel_id(channel, rows)
return {**data, 'requested_channel': channel, 'normalized_channel': normalized, 'channel_normalization_state': normalization_state,
'selected_channel': next((c for c in rows if c['id'] == normalized), None),
'selection_state': 'PERSONA_SELECTED' if normalized else 'PERSONA_INTERPRETATION_REQUIRED',
'authority_granted': False}

View file

@ -12,9 +12,17 @@ class ChannelContextTests(unittest.TestCase):
for id in ['ICE-CH-HB001', 'ICE-CH-LB001', 'ICE-CH-ZC001', 'ICE-CH-DK001']:
self.assertEqual(load_channels(id)['selected_channel']['id'], id)
def test_short_machine_aliases_normalize_before_architecture_agent(self):
pairs = [('HB001','ICE-CH-HB001'), ('LB001','ICE-CH-LB001'), ('ZC001','ICE-CH-ZC001'), ('DK001','ICE-CH-DK001'), ('BT001','ICE-CH-BT001')]
for alias, expected in pairs:
value = load_channels(alias)
self.assertEqual(value['normalized_channel'], expected)
self.assertEqual(value['selected_channel']['id'], expected)
self.assertEqual(value['channel_normalization_state'], 'MACHINE_ALIAS_NORMALIZED')
def test_public_and_unknown_not_silently_routed_private(self):
for id in ['CH-ZERO-CORE-LPM', 'not-a-channel']:
with self.assertRaisesRegex(ValueError, 'UNKNOWN_PRIVATE_CHANNEL'):
with self.assertRaisesRegex(ValueError, 'UNKNOWN_OR_AMBIGUOUS_PRIVATE_CHANNEL'):
load_channels(id)
if __name__ == '__main__': unittest.main()

View file

@ -95,15 +95,16 @@ def load_context(host, intent, channel=None):
architecture_mode = os.environ.get('PERSONA_ARCHITECTURE_OFFICIAL_MODE', 'verify')
if architecture_mode not in {'verify', 'local-only'}:
raise ValueError('PERSONA_ARCHITECTURE_OFFICIAL_MODE_INVALID')
channel_context = load_channels(channel)
selected_channel = channel_context['selected_channel']
canonical_channel = selected_channel['id'] if selected_channel else None
architecture_args = [
sys.executable, str(ARCHITECTURE_AGENT), '--persona', topology['persona_id'],
'--host', host_id, '--official-mode', architecture_mode, '--format', 'json'
]
if channel:
architecture_args.extend(['--channel', channel])
if canonical_channel:
architecture_args.extend(['--channel', canonical_channel])
architecture_perception = command_json(architecture_args, timeout=60)
channel_context = load_channels(channel)
selected_channel = channel_context['selected_channel']
selected_channel_id = selected_channel['id'] if selected_channel else 'DYNAMIC_CHANNEL_PENDING_PERSONA_INTERPRETATION'
intent_sha256 = hashlib.sha256(intent.encode('utf-8')).hexdigest()
session_id = os.environ.get('CODEX_THREAD_ID') or os.environ.get('CODEX_SESSION_ID') or f'{host_id}:{current["current_day"]}:{intent_sha256[:16]}'