fix: resolve lighthouse routes from canonical TCS root
This commit is contained in:
parent
8ac1ef2357
commit
02217d11ea
5 changed files with 135 additions and 5 deletions
|
|
@ -10,9 +10,25 @@ import subprocess
|
|||
from pathlib import Path
|
||||
|
||||
SCRIPT_PATH = Path(__file__).resolve()
|
||||
REPO_ROOT = SCRIPT_PATH.parents[4]
|
||||
SHARED_ROOT = SCRIPT_PATH.parents[3]
|
||||
if (REPO_ROOT / "routing" / "lighthouse-path-registry.json").is_file():
|
||||
LOCAL_SOURCE_ROOT = SCRIPT_PATH.parents[3]
|
||||
RUNTIME_ROOT = Path("/Volumes/JZAO/HoloLake/persona-runtime")
|
||||
POINTER = RUNTIME_ROOT / "TCS-ROOT.json"
|
||||
SHARED_ROOT = RUNTIME_ROOT / "shared"
|
||||
|
||||
|
||||
def canonical_repo_root() -> Path | None:
|
||||
if (LOCAL_SOURCE_ROOT / "routing" / "lighthouse-path-registry.json").is_file():
|
||||
return LOCAL_SOURCE_ROOT
|
||||
if POINTER.is_file() and not POINTER.is_symlink():
|
||||
value = json.loads(POINTER.read_text(encoding="utf-8"))
|
||||
candidate = Path(value.get("canonical_repo", ""))
|
||||
if (candidate / "routing" / "lighthouse-path-registry.json").is_file():
|
||||
return candidate
|
||||
return None
|
||||
|
||||
|
||||
REPO_ROOT = canonical_repo_root()
|
||||
if REPO_ROOT:
|
||||
DEFAULT_LIGHTHOUSE = REPO_ROOT / "routing" / "lighthouse-path-registry.json"
|
||||
DEFAULT_HOST_MAP = REPO_ROOT / "routing" / "host-skill-navigation-map.json"
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -11,8 +11,25 @@ import shutil
|
|||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[4]
|
||||
DEFAULT_TARGET = Path("/Volumes/JZAO/HoloLake/persona-runtime/shared")
|
||||
SCRIPT_PATH = Path(__file__).resolve()
|
||||
LOCAL_SOURCE_ROOT = SCRIPT_PATH.parents[3]
|
||||
RUNTIME_ROOT = Path("/Volumes/JZAO/HoloLake/persona-runtime")
|
||||
POINTER = RUNTIME_ROOT / "TCS-ROOT.json"
|
||||
|
||||
|
||||
def canonical_repo_root() -> Path:
|
||||
if (LOCAL_SOURCE_ROOT / "routing" / "lighthouse-path-registry.json").is_file():
|
||||
return LOCAL_SOURCE_ROOT
|
||||
if POINTER.is_file() and not POINTER.is_symlink():
|
||||
value = json.loads(POINTER.read_text(encoding="utf-8"))
|
||||
candidate = Path(value.get("canonical_repo", ""))
|
||||
if (candidate / "routing" / "lighthouse-path-registry.json").is_file():
|
||||
return candidate
|
||||
raise RuntimeError("CANONICAL_REPO012_UNAVAILABLE")
|
||||
|
||||
|
||||
REPO_ROOT = canonical_repo_root()
|
||||
DEFAULT_TARGET = RUNTIME_ROOT / "shared"
|
||||
ASSETS = {
|
||||
"routing/lighthouse-path-registry.json": "registries/lighthouse-path-registry.json",
|
||||
"routing/host-skill-navigation-map.json": "registries/host-skill-navigation-map.json",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ class LighthouseNavigatorTests(unittest.TestCase):
|
|||
self.assertIn("finalize-development.mjs", route["intent"]["executor"])
|
||||
self.assertFalse(route["authority_granted"])
|
||||
self.assertFalse(route["transport_probe"]["secret_read"])
|
||||
self.assertEqual(
|
||||
route["target"]["offline"],
|
||||
"/Volumes/JZAO/HoloLake/persona-runtime/repo-012-main",
|
||||
)
|
||||
self.assertTrue(route["offline_reality"]["exists"])
|
||||
|
||||
def test_qoder_and_qoderwork_resolve_same_brain_with_distinct_adapters(self):
|
||||
qoder = compile_route(self.registry, self.host_map, "qoder-cn", "大脑思维技能包")
|
||||
|
|
|
|||
Loading…
Reference in a new issue