feat: add AI machine navigation gateway
This commit is contained in:
parent
525e0ab790
commit
931f78d72f
10 changed files with 639 additions and 10 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import unittest
|
||||
|
||||
from resolve_route import parse_code_map, resolve_subject_id
|
||||
from resolve_route import compile_navigation, parse_code_map, resolve_subject_id
|
||||
|
||||
|
||||
class ParseCodeMapTests(unittest.TestCase):
|
||||
|
|
@ -58,5 +58,51 @@ class SubjectAliasTests(unittest.TestCase):
|
|||
self.assertIsNone(resolved["canonical_id"])
|
||||
|
||||
|
||||
class MachineNavigationTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.navigation_map = {
|
||||
"map_id": "AI-MACHINE-NAV-001",
|
||||
"version": "test",
|
||||
"raw_base": "https://example.test/raw",
|
||||
"routes": [
|
||||
{"id": "RUNTIME", "path": "runtime.mjs"},
|
||||
{"id": "ROOT", "path": "root.hdlp"},
|
||||
],
|
||||
"subjects": [{
|
||||
"id": "ICE-P-ZY001",
|
||||
"legacy_ids": ["ICE-GL-ZY001"],
|
||||
"subject_kind": "persona_system",
|
||||
"default_intent": "persona_restore",
|
||||
"runtime_id": "RUNTIME",
|
||||
}],
|
||||
"intents": [{
|
||||
"id": "persona_restore",
|
||||
"always_load": ["ROOT", "RUNTIME"],
|
||||
"triggered_load": [],
|
||||
"on_demand": [],
|
||||
"execution_sequence": ["enter"],
|
||||
"stop_conditions": ["UNKNOWN_SUBJECT"],
|
||||
}],
|
||||
"reality_boundaries": ["Navigation grants no authority."],
|
||||
}
|
||||
|
||||
def test_exact_navigation_bundle(self):
|
||||
result = compile_navigation(
|
||||
self.navigation_map,
|
||||
"ICE-GL-ZY001",
|
||||
"persona_restore",
|
||||
["context_compacted", "context_compacted"],
|
||||
)
|
||||
self.assertEqual(result["canonical_subject"], "ICE-P-ZY001")
|
||||
self.assertTrue(result["redirected"])
|
||||
self.assertEqual(result["runtime_entry"]["id"], "RUNTIME")
|
||||
self.assertEqual(result["explicit_signals"], ["context_compacted"])
|
||||
self.assertEqual(result["authority"], "NONE_NAVIGATION_ONLY")
|
||||
|
||||
def test_navigation_does_not_guess(self):
|
||||
with self.assertRaisesRegex(ValueError, "no guess"):
|
||||
compile_navigation(self.navigation_map, "unknown")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Reference in a new issue