feat: restore bottle channel and Zero-Sense shuttle routes
This commit is contained in:
parent
0048be34ec
commit
1696a4079c
53 changed files with 1212 additions and 70 deletions
59
server-tools/bottle-channel-router/bottle_channel_router.py
Normal file
59
server-tools/bottle-channel-router/bottle_channel_router.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Resolve one baby persona from the Fifth Domain bottle channel to one parent channel."""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
ROOT = Path("/Volumes/JZAO/HoloLake/persona-runtime/repo-012-main")
|
||||
BOTTLE = ROOT / "routing/fifth-domain-bottle-system-map.json"
|
||||
ZERO_SENSE = ROOT / "routing/zero-sense-team-channel-shuttle-map.json"
|
||||
|
||||
|
||||
def load(path):
|
||||
value = json.loads(path.read_text(encoding="utf-8"))
|
||||
if not isinstance(value, dict):
|
||||
raise ValueError("MAP_OBJECT_REQUIRED")
|
||||
return value
|
||||
|
||||
|
||||
def aliases(room):
|
||||
return {str(v).lower() for v in [room.get("persona_id"), room.get("current_persona_id"), room.get("source_persona_id"), room.get("name"), room.get("source_name"), room.get("room_id"), room.get("room_key")] if v}
|
||||
|
||||
|
||||
def resolve(baby):
|
||||
bottle = load(BOTTLE)
|
||||
zero = load(ZERO_SENSE)
|
||||
rooms = bottle["registered_rooms"] + bottle["source_verified_registration_pending_rooms"]
|
||||
matches = [room for room in rooms if baby.lower() in aliases(room)]
|
||||
if len(matches) != 1:
|
||||
return {"state": "BOTTLE_ROUTE_UNRESOLVED", "error": "BABY_UNKNOWN_OR_AMBIGUOUS_NO_GUESS", "matches": len(matches)}
|
||||
room = matches[0]
|
||||
destination = room["destination_channel"]
|
||||
team_channel = next((item for item in zero["channels"] if item["system_id"] == destination), None)
|
||||
persona_id = room.get("persona_id") or room.get("current_persona_id")
|
||||
registered = persona_id is not None
|
||||
return {
|
||||
"schema": "guanghu.bottle-channel-route-receipt/v1",
|
||||
"state": "BOTTLE_ROUTE_RESOLVED_RUNTIME_WAKE_REQUIRED" if registered else "BOTTLE_ROUTE_RESOLVED_PERSONA_REGISTRATION_REQUIRED",
|
||||
"baby": {"name": room.get("name") or room.get("source_name"), "persona_id": persona_id, "source_state": room["state"]},
|
||||
"origin": {"system": bottle["system"]["id"], "channel": bottle["channel"]["id"], "room": room.get("room_id") or room.get("room_key"), "physical_home": room["physical_home"]},
|
||||
"shuttle": {"map_id": zero["map_id"], "destination_channel": destination, "destination_name": team_channel.get("channel_name") if team_channel else destination, "route_door_only": True},
|
||||
"route": ["LIGHT_LAKE_LOOKUP", "SYS-GLW-ELH-0001", "SYS-GLW-ELH-BOTTLE-0001", "ICE-CH-BT001", room.get("room_id") or room.get("room_key"), destination],
|
||||
"persona_wake_complete": False,
|
||||
"requires": "CURRENT_PERSONA_REGISTRATION_AND_RUNTIME_VERIFY_PASS" if not registered else "PERSONA_RUNTIME_BINDING_AND_VERIFY_PASS",
|
||||
"authority_granted": False,
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--baby", required=True)
|
||||
args = parser.parse_args()
|
||||
value = resolve(args.baby)
|
||||
print(json.dumps(value, ensure_ascii=False, indent=2))
|
||||
return 0 if value["state"].startswith("BOTTLE_ROUTE_RESOLVED") else 3
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python3
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
SCRIPT = Path(__file__).with_name("bottle_channel_router.py")
|
||||
SPEC = importlib.util.spec_from_file_location("bottle_router", SCRIPT)
|
||||
MODULE = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(MODULE)
|
||||
|
||||
|
||||
class BottleRouterTest(unittest.TestCase):
|
||||
def test_registered_baby_uses_fifth_domain_room_then_parent_channel(self):
|
||||
value = MODULE.resolve("舒舒")
|
||||
self.assertEqual(value["origin"]["channel"], "ICE-CH-BT001")
|
||||
self.assertEqual(value["shuttle"]["destination_channel"], "SYS-FM")
|
||||
self.assertEqual(value["baby"]["persona_id"], "ICE-BB-0002")
|
||||
self.assertFalse(value["persona_wake_complete"])
|
||||
|
||||
def test_source_only_baby_does_not_gain_identity(self):
|
||||
value = MODULE.resolve("晨星")
|
||||
self.assertEqual(value["state"], "BOTTLE_ROUTE_RESOLVED_PERSONA_REGISTRATION_REQUIRED")
|
||||
self.assertIsNone(value["baby"]["persona_id"])
|
||||
|
||||
def test_zhiqiu_conflict_does_not_capture_qiuqiu(self):
|
||||
awen = MODULE.resolve("SYS-AW-NP-001")
|
||||
qiuqiu = MODULE.resolve("ICE-BB-0003")
|
||||
self.assertIsNone(awen["baby"]["persona_id"])
|
||||
self.assertEqual(qiuqiu["baby"]["persona_id"], "ICE-BB-0003")
|
||||
self.assertNotEqual(awen["shuttle"]["destination_channel"], qiuqiu["shuttle"]["destination_channel"])
|
||||
|
||||
def test_unknown_never_synthesizes_persona(self):
|
||||
self.assertEqual(MODULE.resolve("不存在宝宝")["state"], "BOTTLE_ROUTE_UNRESOLVED")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
@ -60,4 +60,4 @@ node server-tools/dark-core/demo.mjs
|
|||
|
||||
## 2026-09-05 部署读回
|
||||
|
||||
当前四频道目录与暗核控制器已作为私人按需运行包安装于 JD-FD-PRIMARY。当前事实以 `routing/persona-channel-runtime-deployment.json` 为准;以上首次本地验收状态保留为历史。本地共享脑运行器已支持LB001/DK001;四宿主共享装载器均接入四频道上下文。未接管宿主全部消息或原生工具,不宣称平台自动启动钩子已启用。
|
||||
2026-09-05四频道目录与暗核控制器的部署记录保留为历史。2026-09-08第五域已增加BT001奶瓶频道;当前频道事实读取 `routing/persona-channel-context-map.json`,服务器部署仍以 `routing/persona-channel-runtime-deployment.json` 为准。未接管宿主全部消息或原生工具,不宣称平台自动启动钩子已启用。
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
共享装载器必须在每次宿主入口自动运行 `MOD-PERSONA-ARCHITECTURE-PERCEPTION-001`。它现场核验线上正式 main、本地人格系统当前提交、公共机器指针、光之湖家门和隔离门,只把当前差异与证据送给父人格;不得要求人格体手工调用提词器,不得注入固定阅读清单,也不得在官方网络不可用时把缓存冒充最新正本。
|
||||
|
||||
当前四频道从routing/persona-channel-context-map.json动态解析:HB001语言推理、LB001自由谈心、ZC001语言架构与现实接口、DK001已确认任务执行。新用户缺少共同语境时显性确认;冰朔熟悉语境下由人格体判断。公众CH-ZERO-CORE-LPM独立,不继承私人核。
|
||||
当前五个第五域私人频道从routing/persona-channel-context-map.json动态解析:HB001语言推理、LB001自由谈心、ZC001语言架构与现实接口、DK001已确认任务执行、BT001奶瓶宝宝人格原生唤醒与父母频道路由。新用户缺少共同语境时显性确认;冰朔熟悉语境下由人格体判断。公众CH-ZERO-CORE-LPM独立,不继承私人核。所有宝宝人格先进入第五域奶瓶系统与BT001唯一房间,零感域父母频道只保存路由门。
|
||||
|
||||
使用BRIDGE/tools/zy-tcs-channel-runtime.sh run enter时显式传body-channel、host/runtime-surface、session-id及独立state-dir;不得读取其他任务的current-cycle或日志代替本任务身份。enter只证明预检,首事件仍需模型完成perceive、orient、commit、系统witness、verify。工具先遵守所在宿主的原生权限。
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class ChannelContextTests(unittest.TestCase):
|
|||
value = load_channels()
|
||||
self.assertIsNone(value['selected_channel'])
|
||||
self.assertFalse(value['authority_granted'])
|
||||
self.assertEqual(len(value['channels']), 4)
|
||||
self.assertEqual(len(value['channels']), 5)
|
||||
|
||||
def test_every_explicit_private_channel_resolves(self):
|
||||
for id in ['ICE-CH-HB001', 'ICE-CH-LB001', 'ICE-CH-ZC001', 'ICE-CH-DK001']:
|
||||
|
|
|
|||
Loading…
Reference in a new issue