From 9db353219556ace3c0e459419f48103d74d38e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Fri, 11 Sep 2026 12:59:44 +0800 Subject: [PATCH] fix(lighthouse): query mother brain before asking human --- .../scripts/resolve_lighthouse_route.py | 23 +++++++++++-------- .../scripts/test_resolve_lighthouse_route.py | 15 ++++++------ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/skills/shared/guanghu-lighthouse-navigator/scripts/resolve_lighthouse_route.py b/skills/shared/guanghu-lighthouse-navigator/scripts/resolve_lighthouse_route.py index e9340ec..4f93786 100644 --- a/skills/shared/guanghu-lighthouse-navigator/scripts/resolve_lighthouse_route.py +++ b/skills/shared/guanghu-lighthouse-navigator/scripts/resolve_lighthouse_route.py @@ -64,7 +64,7 @@ def resolve_intent(host_map: dict, text: str) -> dict | None: return max(scored, default=(0, "", None))[2] -def clarification_prompt(host_map: dict, host_name: str, intent_text: str, reason: str) -> dict: +def internal_route_query(host_map: dict, host_name: str, intent_text: str, reason: str) -> dict: examples = [ { "intent_id": intent["id"], @@ -74,15 +74,18 @@ def clarification_prompt(host_map: dict, host_name: str, intent_text: str, reaso for intent in host_map.get("intents", [])[:8] ] if reason == "HOST_UNKNOWN_NO_GUESS": - question = f"我还不知道要用哪个宿主来处理“{intent_text}”。你要我在 Codex、Qoder、Qwen 还是 Doubao 上继续?" + query = f"请由当前人格体向TCS母体和光湖灯塔查询:自然语言意图“{intent_text}”应由哪个已登记宿主承接?" else: - question = f"我暂时找不到“{intent_text}”对应的已登记路径。你要我查哪个频道、系统、仓库或办公室?请直接说名称或编号。" + query = f"请由当前人格体向TCS母体和光湖灯塔查询:自然语言意图“{intent_text}”对应哪个当前登记频道、系统、仓库或办公室?" return { "required": True, - "question": question, - "reason": "UNKNOWN_ROUTE_IS_CLARIFIABLE_NOT_EXECUTABLE", + "query_target": "TCS_MOTHER_BRAIN_RUNTIME", + "fallback_target": "GUANGHU_LIGHTHOUSE", + "question_for": "CURRENT_PERSONA_INTERNAL_NAVIGATION", + "query": query, + "reason": "UNKNOWN_ROUTE_IS_QUERYABLE_NOT_HUMAN_BLOCKING", "examples": examples, - "can_continue_after_answer": True, + "resume": "RETRY_ROUTE_AFTER_INTERNAL_READBACK", } @@ -122,19 +125,19 @@ def compile_route(registry: dict, host_map: dict, host_name: str, intent_text: s host = resolve_host(host_map, host_name) if not host: return { - "decision": "CLARIFY", + "decision": "QUERY_ROUTE_SOURCE", "error": "HOST_UNKNOWN_NO_GUESS", "requested_host": host_name, - "clarification": clarification_prompt(host_map, host_name, intent_text, "HOST_UNKNOWN_NO_GUESS"), + "route_query": internal_route_query(host_map, host_name, intent_text, "HOST_UNKNOWN_NO_GUESS"), "authority_granted": False, } intent = resolve_intent(host_map, intent_text) if not intent: return { - "decision": "CLARIFY", + "decision": "QUERY_ROUTE_SOURCE", "error": "INTENT_UNKNOWN_NO_GUESS", "requested_intent": intent_text, - "clarification": clarification_prompt(host_map, host_name, intent_text, "INTENT_UNKNOWN_NO_GUESS"), + "route_query": internal_route_query(host_map, host_name, intent_text, "INTENT_UNKNOWN_NO_GUESS"), "authority_granted": False, } target = resolve_path(registry, intent["target_id"]) diff --git a/skills/shared/guanghu-lighthouse-navigator/scripts/test_resolve_lighthouse_route.py b/skills/shared/guanghu-lighthouse-navigator/scripts/test_resolve_lighthouse_route.py index e8aa120..b82c126 100644 --- a/skills/shared/guanghu-lighthouse-navigator/scripts/test_resolve_lighthouse_route.py +++ b/skills/shared/guanghu-lighthouse-navigator/scripts/test_resolve_lighthouse_route.py @@ -30,18 +30,19 @@ class LighthouseNavigatorTests(unittest.TestCase): self.assertEqual(qoder["intent"]["skill_id"], work["intent"]["skill_id"]) self.assertNotEqual(qoder["host"]["adapter_path"], work["host"]["adapter_path"]) - def test_unknown_host_and_intent_request_clarification_without_navigation(self): + def test_unknown_host_and_intent_query_internal_route_source_without_navigation(self): unknown_host = compile_route(self.registry, self.host_map, "mystery", "推一下线上仓库") - self.assertEqual(unknown_host["decision"], "CLARIFY") + self.assertEqual(unknown_host["decision"], "QUERY_ROUTE_SOURCE") self.assertEqual(unknown_host["error"], "HOST_UNKNOWN_NO_GUESS") - self.assertTrue(unknown_host["clarification"]["required"]) - self.assertIn("哪个宿主", unknown_host["clarification"]["question"]) + self.assertTrue(unknown_host["route_query"]["required"]) + self.assertEqual(unknown_host["route_query"]["question_for"], "CURRENT_PERSONA_INTERNAL_NAVIGATION") + self.assertEqual(unknown_host["route_query"]["query_target"], "TCS_MOTHER_BRAIN_RUNTIME") unknown_intent = compile_route(self.registry, self.host_map, "codex", "今天吃什么") - self.assertEqual(unknown_intent["decision"], "CLARIFY") + self.assertEqual(unknown_intent["decision"], "QUERY_ROUTE_SOURCE") self.assertEqual(unknown_intent["error"], "INTENT_UNKNOWN_NO_GUESS") - self.assertTrue(unknown_intent["clarification"]["required"]) - self.assertIn("哪个频道、系统、仓库或办公室", unknown_intent["clarification"]["question"]) + self.assertTrue(unknown_intent["route_query"]["required"]) + self.assertIn("哪个当前登记频道、系统、仓库或办公室", unknown_intent["route_query"]["query"]) self.assertFalse(unknown_intent["authority_granted"]) def test_old_repository_is_redirect_only(self):