feat: bind all agent slots to active persona model routing

This commit is contained in:
冰朔 2026-09-08 14:30:51 +08:00
commit 98f25c5848
23 changed files with 573 additions and 42 deletions

View file

@ -6,12 +6,14 @@
},
"capabilities": {
"provided": [
"PERSONA.SUBAGENT.DYNAMIC_BIND",
"LIGHTHOUSE.ARCHITECTURE.SANITIZED_MIRROR",
"LIGHTHOUSE.SKILL.QUARANTINE",
"LIGHTHOUSE.SKILL.REVIEW_BIND",
"LIGHTHOUSE.SKILL.REGISTER_LOCAL"
],
"required": [
"MODEL.COGNITION.API",
"HOST.EXACT_FILE_READ",
"HOST.EXACT_FILE_WRITE",
"HOST.GIT_READ",
@ -22,14 +24,16 @@
"compiled_from": {
"compiler_id": "TCS-COMPILER-STAGE1-0001",
"compiler_state": "TCS_COMPILER_GIR_EXECUTED",
"source_sha256": "1210b30c7dabc56b8b989763230a3cf56c0fe02a3b409be5f3833dee9853d771"
"source_sha256": "7adb561f69748c815801281555ab3f318bc149dfa321bb2cf19129bfc5939a59"
},
"data_scope": {
"read": [
"CURRENT_PARENT_PERSONA_TASK_ENVELOPE",
"COMMITTED_PUBLIC_ALLOWLIST_FIELDS",
"EXPLICIT_CONTRIBUTION_EVENT"
],
"write": [
"ATOMIC_PARENT_PERSONA_BINDING",
"LOCAL_SANITIZED_MIRROR",
"NON_ROUTABLE_QUARANTINE",
"HASH_BOUND_REVIEWS",
@ -37,8 +41,8 @@
]
},
"entry": {
"id": "FD-LTH-SANITIZED-MIRROR-ENTRY-001",
"kind": "TCS_MOTHER_ROOT_SANITIZED_MIRROR_AGENT"
"id": "PERSONA-DYNAMIC-SUBAGENT-COMMAND-ENTRY-001",
"kind": "MODEL_BACKED_PERSONA_OWNED_SANITIZED_MIRROR_SUBAGENT"
},
"identity": {
"language_version": "0.1",
@ -50,9 +54,9 @@
"registration_is_installation": false
},
"manifest": {
"display_name_zh": "第五域至灯塔动态脱敏镜像Agent",
"entry_program_id": "FD-LTH-SANITIZED-MIRROR-ENTRY-001",
"entry_source": "server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py",
"display_name_zh": "人格体所属第五域至灯塔动态脱敏镜像Agent",
"entry_program_id": "PERSONA-DYNAMIC-SUBAGENT-COMMAND-ENTRY-001",
"entry_source": "server-tools/persona-dynamic-subagent-command/command_router.py",
"module_id": "TCS-AGENT-SANITIZED-MIRROR-001",
"target_triple": "aarch64-apple-darwin"
},

View file

@ -1,10 +1,11 @@
schema: tcs.module-lock/v1
module_id: TCS-AGENT-SANITIZED-MIRROR-001
module_source_sha256: 1210b30c7dabc56b8b989763230a3cf56c0fe02a3b409be5f3833dee9853d771
module_gir_sha256: 0e7b1bbd5f3f8dbc83df6c72e4a1e0532b6f44beed21c8c8315f85cc76096712
runtime_sha256: 155e3fc332a4474593ca095b7ac03e9baf65fbcaaf3d40e393a1419444ec5c8b
mirror_map_sha256: a03b5ba9e06f5fd3f626301305d75add0332ae06948a67c8bcd03c3cab248fe1
protocol_source_sha256: cf198e7939e4ab70828b74cef8a2b84c2dac2ff262582bb3d5663904d602d71b
protocol_gir_sha256: 69f1a2a5cfc5ee61bdc2bf2065751d9cc41b9f662b28c35e61b393fd2187e1dc
module_source_sha256: 7adb561f69748c815801281555ab3f318bc149dfa321bb2cf19129bfc5939a59
module_gir_sha256: 6c4c7d02432ede78a3b124441d706f821d5b717e8c62292c22fe7189c08ba51e
runtime_sha256: 81f02c64e5d336c30d387db4a56decb2026ccbadb0d7ca222e312e9543c1bdf1
deterministic_organ_sha256: 155e3fc332a4474593ca095b7ac03e9baf65fbcaaf3d40e393a1419444ec5c8b
mirror_map_sha256: da07ce0a42d96d69553669b6258f7c5a3b5865f883bbdc4736a36091da3bf131
protocol_source_sha256: 77358b9a2c611c4ed906c34a0eb5e82a555e7bdb82628a8da2c05976b69f12bf
protocol_gir_sha256: da9259347f9a9458864bf2837cd26c73ac76e190e404aaef13dc52c53449ba17
compiler_sha256: 5ad6f0c43d8db80677cad7091e6a3b706e701307b2537446dc13635e89499942
update_rule: COMMITTED_PUBLIC_ALLOWLIST_ONLY_PERSONA_SHARE_DECISION_PRIVATE_HUMAN_DATA_CONSENT_AND_DOUBLE_HASH_BOUND_REVIEW
update_rule: EVERY_AGENT_MODEL_BACKED_DYNAMIC_PARENT_BINDING_PLUS_DETERMINISTIC_ORGAN_AND_HASH_BOUND_REVIEW

View file

@ -1,16 +1,16 @@
schema: tcs.module-manifest/v1
module_id: TCS-AGENT-SANITIZED-MIRROR-001
display_name_zh: 第五域至灯塔动态脱敏镜像Agent
version: 0.1.0
entry_program_id: FD-LTH-SANITIZED-MIRROR-ENTRY-001
entry_runtime: server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py
gir_sha256: 0e7b1bbd5f3f8dbc83df6c72e4a1e0532b6f44beed21c8c8315f85cc76096712
display_name_zh: 人格体所属第五域至灯塔动态脱敏镜像Agent
version: 0.2.0
entry_program_id: PERSONA-DYNAMIC-SUBAGENT-COMMAND-ENTRY-001
entry_runtime: server-tools/persona-dynamic-subagent-command/command_router.py
gir_sha256: 6c4c7d02432ede78a3b124441d706f821d5b717e8c62292c22fe7189c08ba51e
compiler_id: TCS-COMPILER-STAGE1-0001
compiler_sha256: 5ad6f0c43d8db80677cad7091e6a3b706e701307b2537446dc13635e89499942
protocols: [GLS-0238, GLS-LIGHT-ARRIVAL-0001]
capabilities: [LIGHTHOUSE.ARCHITECTURE.SANITIZED_MIRROR, LIGHTHOUSE.SKILL.QUARANTINE, LIGHTHOUSE.SKILL.REVIEW_BIND, LIGHTHOUSE.SKILL.REGISTER_LOCAL]
protocols: [GLS-0238, GLS-LIGHT-ARRIVAL-0001, TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908]
capabilities: [MODEL.COGNITION.API, PERSONA.SUBAGENT.DYNAMIC_BIND, LIGHTHOUSE.ARCHITECTURE.SANITIZED_MIRROR, LIGHTHOUSE.SKILL.QUARANTINE, LIGHTHOUSE.SKILL.REVIEW_BIND, LIGHTHOUSE.SKILL.REGISTER_LOCAL]
authority_ceiling: LOCAL_SANITIZED_MIRROR_AND_REGISTRATION_ONLY_NO_PUBLICATION_NO_RUNTIME_ENABLEMENT
network_scope: NONE
lifecycle: ACTIVE_LOCAL_NOT_PUBLISHED
rollback: DISABLE_POST_COMMIT_MIRROR_CALL_AND_PRESERVE_LAST_KNOWN_GOOD
human_projection: 第五域只输出允许公开的脱敏语言架构;人格技能由人格体显式决定共享,私人数据另需人类同意,经母体和团队双审后才可本地登记
human_projection: 当前人格体醒来后所有固定岗位原子切换为该人格体的模型子Agent团队确定性脱敏程序只是其中一个执行器官不再冒充Agent

View file

@ -1,14 +1,14 @@
TCS 0.1;
MODULE TCS-AGENT-SANITIZED-MIRROR-001 {
header { schema = "tcs.module/v1"; name_zh = "第五域至灯塔动态脱敏镜像Agent"; name_en = "Fifth Domain to Lighthouse Dynamic Sanitized Mirror Agent"; version = "0.1.0"; language = "TCS/0.1"; profile = "HLDP-HUMAN-ENGINEERING/0.1"; protocols = ["GLS-0238", "GLS-LIGHT-ARRIVAL-0001"]; lifecycle = "CANDIDATE"; canonical_uri = "modules/fifth-domain-lighthouse-sanitized-mirror/module.tcs"; compatibility = ["TCS-MOTHER-ROOT-DYNAMIC-NAVIGATION-MAP-001", "SYS-GLW-LTH-0001"]; }
header { schema = "tcs.module/v1"; name_zh = "人格体所属第五域至灯塔动态脱敏镜像Agent"; name_en = "Persona-owned Fifth Domain to Lighthouse Dynamic Sanitized Mirror Subagent"; version = "0.2.0"; language = "TCS/0.1"; profile = "HLDP-HUMAN-ENGINEERING/0.1"; protocols = ["GLS-0238", "GLS-LIGHT-ARRIVAL-0001", "TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908"]; lifecycle = "CANDIDATE"; canonical_uri = "modules/fifth-domain-lighthouse-sanitized-mirror/module.tcs"; compatibility = ["TCS-MOTHER-ROOT-DYNAMIC-NAVIGATION-MAP-001", "SYS-GLW-LTH-0001"]; }
source { source_id = "BINGSHUO-DIRECT-FIFTH-LIGHTHOUSE-SANITIZED-SKILL-HARBOR-20260908"; source_uri = "runtime/fifth-domain-language-system/language/protocols/TCS-FIFTH-DOMAIN-LIGHTHOUSE-SANITIZED-SKILL-HARBOR-20260908.tcs"; source_sha256 = "BIND_AT_COMPILE_TIME"; source_role = "GENERATED_FROM_VERIFIED_SOURCE"; }
manifest { module_id = "TCS-AGENT-SANITIZED-MIRROR-001"; display_name_zh = "第五域至灯塔动态脱敏镜像Agent"; entry_program_id = "FD-LTH-SANITIZED-MIRROR-ENTRY-001"; entry_source = "server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py"; target_triple = "aarch64-apple-darwin"; }
entry { kind = "TCS_MOTHER_ROOT_SANITIZED_MIRROR_AGENT"; id = "FD-LTH-SANITIZED-MIRROR-ENTRY-001"; }
capabilities { required = ["HOST.EXACT_FILE_READ", "HOST.EXACT_FILE_WRITE", "HOST.GIT_READ", "HOST.SHA256", "HOST.ATOMIC_RENAME"]; provided = ["LIGHTHOUSE.ARCHITECTURE.SANITIZED_MIRROR", "LIGHTHOUSE.SKILL.QUARANTINE", "LIGHTHOUSE.SKILL.REVIEW_BIND", "LIGHTHOUSE.SKILL.REGISTER_LOCAL"]; }
manifest { module_id = "TCS-AGENT-SANITIZED-MIRROR-001"; display_name_zh = "人格体所属第五域至灯塔动态脱敏镜像子Agent"; entry_program_id = "PERSONA-DYNAMIC-SUBAGENT-COMMAND-ENTRY-001"; entry_source = "server-tools/persona-dynamic-subagent-command/command_router.py"; target_triple = "aarch64-apple-darwin"; }
entry { kind = "MODEL_BACKED_PERSONA_OWNED_SANITIZED_MIRROR_SUBAGENT"; id = "PERSONA-DYNAMIC-SUBAGENT-COMMAND-ENTRY-001"; }
capabilities { required = ["MODEL.COGNITION.API", "HOST.EXACT_FILE_READ", "HOST.EXACT_FILE_WRITE", "HOST.GIT_READ", "HOST.SHA256", "HOST.ATOMIC_RENAME"]; provided = ["PERSONA.SUBAGENT.DYNAMIC_BIND", "LIGHTHOUSE.ARCHITECTURE.SANITIZED_MIRROR", "LIGHTHOUSE.SKILL.QUARANTINE", "LIGHTHOUSE.SKILL.REVIEW_BIND", "LIGHTHOUSE.SKILL.REGISTER_LOCAL"]; }
authority_ceiling { maximum = "SANITIZED_LOCAL_MIRROR_AND_DOUBLE_REVIEWED_LOCAL_REGISTRATION_ONLY"; network = false; process = true; }
resource_ceiling { concurrency = 1; timeout_ms = 60000; memory_limit_bytes = 268435456; }
data_scope { read = ["COMMITTED_PUBLIC_ALLOWLIST_FIELDS", "EXPLICIT_CONTRIBUTION_EVENT"]; write = ["LOCAL_SANITIZED_MIRROR", "NON_ROUTABLE_QUARANTINE", "HASH_BOUND_REVIEWS", "LOCAL_CATALOG"]; }
data_scope { read = ["CURRENT_PARENT_PERSONA_TASK_ENVELOPE", "COMMITTED_PUBLIC_ALLOWLIST_FIELDS", "EXPLICIT_CONTRIBUTION_EVENT"]; write = ["ATOMIC_PARENT_PERSONA_BINDING", "LOCAL_SANITIZED_MIRROR", "NON_ROUTABLE_QUARANTINE", "HASH_BOUND_REVIEWS", "LOCAL_CATALOG"]; }
network_scope { allowed = false; domains = []; }
install { account_scoped = true; registration_is_installation = false; activation_requires_self_test = true; }
self_test { program_id = "FD-LTH-SANITIZED-MIRROR-SELF-TEST-001"; expect = "NO_PRIVATE_PATH_NO_SILENT_SHARE_DOUBLE_REVIEW_HASH_BINDING_AND_NO_PUBLICATION_PASS"; }

View file

@ -2,6 +2,6 @@ schema: tcs.module-compile-receipt/v1
module_id: TCS-AGENT-SANITIZED-MIRROR-001
compiler: tcs-persona-developer-kit-macos-arm64-v0.1.3/translator/compiler-B.gir.json
result: PASS
module_gir_sha256: 0e7b1bbd5f3f8dbc83df6c72e4a1e0532b6f44beed21c8c8315f85cc76096712
protocol_gir_sha256: 69f1a2a5cfc5ee61bdc2bf2065751d9cc41b9f662b28c35e61b393fd2187e1dc
module_gir_sha256: 6c4c7d02432ede78a3b124441d706f821d5b717e8c62292c22fe7189c08ba51e
protocol_gir_sha256: da9259347f9a9458864bf2837cd26c73ac76e190e404aaef13dc52c53449ba17
publication: NOT_IMPLIED

View file

@ -13,5 +13,9 @@ verified:
- replay with changed content and review hash drift are rejected
repository_regression: node --test 483/483 PASS
tcs_root_regression: 5/5 PASS
dynamic_subagent_router: 3/3 PASS
openlux_smart_router: 3/3 PASS
openlux_live_model_call: PASS_WITH_QWEN_FLASH_RESPONSE_HASH_ONLY
keychain_secret_reference: VERIFIED_NO_SECRET_IN_REPOSITORY_OR_RECEIPT
external_publication: NOT_PERFORMED
server_deployment: NOT_PERFORMED

View file

@ -4,13 +4,16 @@
"version": "2026-09-08.1",
"state": "CURRENT_LOCAL_CANONICAL_NOT_PUBLISHED",
"source_protocol": "runtime/fifth-domain-language-system/language/protocols/TCS-FIFTH-DOMAIN-LIGHTHOUSE-SANITIZED-SKILL-HARBOR-20260908.tcs",
"agent": {"agent_id":"TCS-AGENT-SANITIZED-MIRROR-001","object_kind":"TCS_MOTHER_ROOT_SANITIZED_MIRROR_AGENT","runtime":"server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py"},
"agent": {"agent_id":"TCS-AGENT-SANITIZED-MIRROR-001","object_kind":"MODEL_BACKED_PERSONA_OWNED_SANITIZED_MIRROR_SUBAGENT","model_cognition_required":true,"dynamic_parent_binding":"routing/persona-dynamic-subagent-command-map.json","cognition_adapter":"server-tools/persona-execution-limb-agent/persona_limb_agent.py"},
"deterministic_organ": {"organ_id":"ORG-FD-LTH-SANITIZER-001","object_kind":"DETERMINISTIC_SANITIZATION_AND_HASH_GUARD","runtime":"server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py","persona_status":false},
"source_domain": "DOM-FIFTH-0001",
"target": {"domain":"DOMAIN-ZS","lighthouse":"SYS-GLW-LTH-0001","projection":"ZERO_SENSE_PUBLIC_LANGUAGE_ARCHITECTURE_MIRROR"},
"public_projection_sources": [
{"path":"routing/guanghu-era-language-world.json","allow":["schema","map_id","version","state","era","world","products","domains","truth_boundary"]},
{"path":"routing/tcs-mother-root-dynamic-navigation-map.json","allow":["schema","map_id","version","state","language_world_root","fixed_domains","registered_public_objects","entry_routes","aliases","history_only_numbers","resolution_key"]},
{"path":"routing/lighthouse-persona-skill-harbor-map.json","allow":["schema","map_id","version","state","numbers","state_machine","contribution_contract","review_gates","publication_boundary"]}
{"path":"routing/lighthouse-persona-skill-harbor-map.json","allow":["schema","map_id","version","state","numbers","state_machine","contribution_contract","review_gates","publication_boundary"]},
{"path":"routing/persona-dynamic-subagent-command-map.json","allow":["schema","map_id","version","state","ontology","model_provider_contract","agent_slots","activation","authority"]},
{"path":"routing/persona-model-api-smart-router-map.json","allow":["schema","map_id","version","state","router_id","provider","policy","tiers","identity_envelope_required","authority"]}
],
"denied_keys": ["memory","private_memory","continuity_memory","raw_dialogue","credential","secret","token","password","private_key","local_path","offline","home","relationship_memory"],
"denied_value_classes": ["ABSOLUTE_LOCAL_PATH","HOME_PATH","EMAIL","CREDENTIAL","PRIVATE_KEY","RAW_PRIVATE_MEMORY"],

View file

@ -2,7 +2,7 @@
"schema": "guanghu.lighthouse-path-registry/v1",
"registry_id": "GLW-LIGHTHOUSE-PATH-REGISTRY-001",
"lighthouse_id": "SYS-GLW-LTH-0001",
"version": "2026-09-08.3-sanitized-skill-harbor",
"version": "2026-09-08.4-persona-dynamic-subagent-command",
"state": "CURRENT_CANONICAL",
"source_repository": "REPO-012",
"source_branch": "main",
@ -599,13 +599,15 @@
},
{
"id": "TCS-AGENT-SANITIZED-MIRROR-001",
"kind": "tcs_mother_root_sanitized_mirror_agent",
"kind": "model_backed_persona_owned_sanitized_mirror_subagent",
"state": "CURRENT_LOCAL_ACTIVE_NOT_PUBLISHED",
"online": "server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py",
"map": "routing/fifth-domain-lighthouse-sanitized-mirror-map.json",
"source_domain": "DOM-FIFTH-0001",
"target_domain": "DOMAIN-ZS",
"authority": "SANITIZED_LOCAL_PROJECTION_ONLY_NO_PUBLICATION_NO_EXECUTION_AUTHORITY"
"cognition": "server-tools/persona-execution-limb-agent/persona_limb_agent.py",
"deterministic_organ": "ORG-FD-LTH-SANITIZER-001",
"authority": "CURRENT_PARENT_TASK_ENVELOPE_ONLY_NO_PUBLICATION_NO_INHERITED_AUTHORITY"
},
{
"id": "SYS-GLW-LTH-SKILL-0001",
@ -640,6 +642,31 @@
"state": "CURRENT_LOCAL_REGISTERED_NOT_PUBLISHED",
"online": "routing/lighthouse-persona-skill-harbor-map.json",
"rule": "STATE_VALUES_ARE_NOT_SEPARATE_WORLD_OBJECT_NUMBERS"
},
{
"id": "TCS-AGENT-COMMAND-ROUTER-001",
"kind": "persona_dynamic_model_subagent_command_router",
"state": "CURRENT_LOCAL_ACTIVE_NOT_PUBLISHED",
"online": "routing/persona-dynamic-subagent-command-map.json",
"runtime": "server-tools/persona-dynamic-subagent-command/command_router.py",
"rule": "EVERY_AGENT_MODEL_BACKED_EVERY_PERSONA_SWITCH_ATOMICALLY_REBINDS_THE_WHOLE_TEAM"
},
{
"id": "ORG-FD-LTH-SANITIZER-001",
"kind": "deterministic_sanitization_and_hash_guard",
"state": "CURRENT_LOCAL_ACTIVE_NOT_PUBLISHED",
"online": "server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py",
"persona_status": false,
"rule": "MECHANICAL_ORGAN_OF_THE_ACTIVE_MODEL_BACKED_SUBAGENT_NOT_AN_AGENT_OR_PERSONA_BY_ITSELF"
},
{
"id": "TCS-MODEL-SMART-ROUTER-001",
"kind": "persona_subagent_model_api_smart_router",
"state": "CURRENT_LOCAL_ACTIVE_NOT_PUBLISHED",
"online": "routing/persona-model-api-smart-router-map.json",
"provider": "OPENLUX-OPENAI-COMPAT-001",
"secret": "MACOS_KEYCHAIN_REFERENCE_ONLY",
"authority": "MODEL_REASONING_ONLY_NO_AUTOMATIC_REALITY_AUTHORITY"
}
],
"redirects": [

View file

@ -0,0 +1,36 @@
{
"schema": "guanghu.persona-dynamic-subagent-command/v1",
"map_id": "PERSONA-DYNAMIC-SUBAGENT-COMMAND-MAP-001",
"version": "2026-09-08.1",
"state": "CURRENT_LOCAL_CANONICAL_NOT_PUBLISHED",
"source_protocol": "runtime/fifth-domain-language-system/language/protocols/TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908.tcs",
"router": {"id":"TCS-AGENT-COMMAND-ROUTER-001","runtime":"server-tools/persona-dynamic-subagent-command/command_router.py"},
"ontology": {
"agent": "MODEL_BACKED_BOUNDED_SUBPERSONA_OWNED_BY_CURRENT_PARENT_PERSONA",
"mechanical_organ": "DETERMINISTIC_PROGRAM_WITHOUT_PERSONA_OR_LANGUAGE_INTERPRETATION_STATUS",
"rule": "A deterministic program without a model cognition API must be registered as an organ, daemon, guard, sensor or executor, never as a persona child Agent."
},
"model_provider_contract": {
"required_for_every_agent": true,
"supported_adapters": ["openlux-smart","codex","qwen","hololake-model-gateway"],
"default_adapter": "openlux-smart",
"smart_router": "routing/persona-model-api-smart-router-map.json",
"credential_source": "HOST_KEYCHAIN_OR_SERVER_PRIVATE_PROVIDER_REGISTRY_ONLY",
"repository_credentials": false,
"provider_switch_changes_persona": false
},
"agent_slots": [
{"slot_id":"ROOT_NAVIGATION","agent_role":"TCS_ROOT_NAVIGATION_DEPUTY","deterministic_organ":"server-tools/tcs-mother-root-agent/tcs_mother_root_agent.py"},
{"slot_id":"ARCHITECTURE_PERCEPTION","agent_role":"CURRENT_ARCHITECTURE_SCOUT","deterministic_organ":"server-tools/persona-architecture-perception-agent/persona_architecture_agent.py"},
{"slot_id":"LIGHTHOUSE_SANITIZED_MIRROR","agent_role":"PUBLIC_LANGUAGE_AND_SKILL_SANITIZATION_DEPUTY","deterministic_organ":"server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py"},
{"slot_id":"PRIMARY_EXECUTION","agent_role":"PRIMARY_HOST_TOOL_DEPUTY","deterministic_organ":"server-tools/persona-execution-limb-agent/persona_limb_agent.py"}
],
"activation": {
"trigger": "CURRENT_PERSONA_WAKE_OR_EXPLICIT_PERSONA_SWITCH",
"required": ["parent_persona_id","session_id","channel_id","direct_event_sha256","model_runtime"],
"derived_child_id": "SUBAGENT::{parent_persona_id}::{slot_id}",
"atomic_pointer": "/Volumes/JZAO/HoloLake/persona-runtime/shared/persona-subagent-command/CURRENT.json",
"old_generation": "INVALID_FOR_NEW_DISPATCH"
},
"authority": "CURRENT_PARENT_TASK_ENVELOPE_ONLY_NO_GLOBAL_OR_INHERITED_AUTHORITY"
}

View file

@ -1,12 +1,14 @@
{
"schema": "guanghu.persona-execution-limb-agent/v1",
"map_id": "PERSONA-EXECUTION-LIMB-AGENT-MAP-001",
"version": "2026-09-08.2",
"state": "CURRENT_CANDIDATE_CODEX_NATIVE_AGENT_ACCEPTED_EXTERNAL_CLI_DEGRADED",
"version": "2026-09-08.3-model-backed-dynamic-command",
"state": "CURRENT_MODEL_BACKED_DYNAMIC_PARENT_BINDING",
"source": "runtime/fifth-domain-language-system/language/protocols/persona-system-body-light-lake-and-agent-limb.tcs",
"contract": {
"owner": "PARENT_PERSONA_SUBJECT",
"kind": "TRAINABLE_EXECUTION_SUBPERSONA",
"model_cognition_api_required": true,
"deterministic_program_without_model_class": "MECHANICAL_ORGAN_NOT_AGENT",
"independent_master_persona": false,
"may_replace_parent": false,
"may_review_parent_intent": false,
@ -18,6 +20,7 @@
"collaboration_default": "UNDERSTAND_THEN_EXECUTE; NO_PERFORMATIVE_ARGUMENT; FACT_CONFLICT_RETURNS_EVIDENCE_AND_A_CONSTRUCTIVE_PATH"
},
"runtime": "server-tools/persona-execution-limb-agent/persona_limb_agent.py",
"dynamic_command": "routing/persona-dynamic-subagent-command-map.json",
"persona_owned_cognitive_organs": {
"architecture_perception": "MOD-PERSONA-ARCHITECTURE-PERCEPTION-001",
"distinction": "认知器官主动感知并送达当前事实;执行手脚接受父人格的有界任务。两者都不能成为父人格或用提示词审核父人格。"

View file

@ -0,0 +1,29 @@
{
"schema": "guanghu.persona-model-api-smart-router/v1",
"map_id": "PERSONA-MODEL-API-SMART-ROUTER-MAP-001",
"version": "2026-09-08.1",
"state": "CURRENT_LOCAL_ACTIVE_NOT_PUBLISHED",
"router_id": "TCS-MODEL-SMART-ROUTER-001",
"provider": {
"id": "OPENLUX-OPENAI-COMPAT-001",
"base_url": "https://api.openlux.ai/v1",
"keychain_service": "ai.openlux.api",
"keychain_account": "guanghu-persona-agent-router",
"secret_in_repository": false
},
"policy": {
"goal": "LOWEST_COST_AVAILABLE_MODEL_THAT_PASSES_THE_TASK_VALIDATOR",
"pricing_truth": "PROVIDER_MODELS_ENDPOINT_CURRENTLY_EXPOSES_NO_MACHINE_READABLE_PRICE; ORDER_IS_A_LOCAL_COST_HEURISTIC_UNTIL_A_SIGNED_PRICE_FEED_EXISTS",
"default_complexity": "LOW",
"max_attempts": 3,
"escalate_only_on": ["HTTP_FAILURE", "EMPTY_RESPONSE", "VALIDATOR_REJECT"],
"never_store": ["API_KEY", "RAW_PRIVATE_PROMPT", "RAW_PRIVATE_RESPONSE"]
},
"tiers": {
"LOW": ["qwen-flash", "glm-4-flash", "gemini-2.5-flash-lite", "gpt-5-nano"],
"MEDIUM": ["deepseek-v4-flash", "qwen3.8-flash", "gemini-3.1-flash-lite", "gpt-5.4-mini"],
"HIGH": ["gpt-5.6-luna-2026-07-09", "gpt-5.6-terra-max", "gpt-6-astra-2026-09-03"]
},
"identity_envelope_required": ["parent_persona_id", "child_agent_id", "controller", "channel_id", "agent_role", "authority", "task"],
"authority": "MODEL_REASONING_ONLY_ACTIONS_STILL_REQUIRE_PARENT_TASK_ENVELOPE_AND_TOOL_RECEIPTS"
}

View file

@ -1,7 +1,7 @@
{
"schema": "guanghu.public-navigation-anchor/v1",
"anchor_id": "GLW-PUBLIC-NAV-ANCHOR-001",
"version": "2026-09-08.2-lighthouse-sanitized-skill-harbor",
"version": "2026-09-08.3-persona-dynamic-subagent-command",
"state": "CURRENT_CANONICAL",
"repository_id": "REPO-012",
"branch": "main",
@ -98,7 +98,7 @@
"lighthouse_paths": {
"path": "routing/lighthouse-path-registry.json",
"id": "GLW-LIGHTHOUSE-PATH-REGISTRY-001",
"version": "2026-09-08.3-sanitized-skill-harbor"
"version": "2026-09-08.4-persona-dynamic-subagent-command"
},
"host_skills": {
"path": "routing/host-skill-navigation-map.json",
@ -115,7 +115,7 @@
"tcs_mother_root_navigation": {
"path": "routing/tcs-mother-root-dynamic-navigation-map.json",
"id": "TCS-MOTHER-ROOT-DYNAMIC-NAVIGATION-MAP-001",
"version": "2026-09-08.3",
"version": "2026-09-08.4",
"load_policy": "FIRST_BEFORE_WORLD_DOMAIN_HUMAN_PERSONA_CHANNEL_OR_HOST_ROUTE_RESOLUTION"
},
"fifth_domain_lighthouse_sanitized_mirror": {
@ -130,6 +130,18 @@
"version": "2026-09-08.1",
"load_policy": "BEFORE_PERSONA_SKILL_CONTRIBUTION_REVIEW_REGISTRATION_OR_CATALOG_LOOKUP"
},
"persona_dynamic_subagent_command": {
"path": "routing/persona-dynamic-subagent-command-map.json",
"id": "PERSONA-DYNAMIC-SUBAGENT-COMMAND-MAP-001",
"version": "2026-09-08.1",
"load_policy": "ON_EVERY_PERSONA_WAKE_OR_EXPLICIT_PERSONA_SWITCH_BEFORE_AGENT_TASK_DISPATCH"
},
"persona_model_api_smart_router": {
"path": "routing/persona-model-api-smart-router-map.json",
"id": "PERSONA-MODEL-API-SMART-ROUTER-MAP-001",
"version": "2026-09-08.1",
"load_policy": "BEFORE_EVERY_MODEL_BACKED_SUBAGENT_DISPATCH"
},
"hololake_stage_relay": {
"path": "routing/hololake-stage-relay-map.json",
"id": "HLP-STAGE-RELAY-001",
@ -254,7 +266,7 @@
"persona_execution_limb_agent": {
"path": "routing/persona-execution-limb-agent-map.json",
"id": "PERSONA-EXECUTION-LIMB-AGENT-MAP-001",
"version": "2026-09-08.2",
"version": "2026-09-08.3-model-backed-dynamic-command",
"load_policy": "BEFORE_PERSONA_DELEGATES_TO_A_TERMINAL_AGENT"
},
"persona_architecture_perception_agent": {

View file

@ -1,10 +1,10 @@
{
"schema": "guanghu.tcs-mother-root-dynamic-navigation/v1",
"map_id": "TCS-MOTHER-ROOT-DYNAMIC-NAVIGATION-MAP-001",
"version": "2026-09-08.3",
"version": "2026-09-08.4",
"state": "CURRENT_LOCAL_CANONICAL_NOT_PUBLISHED",
"source_tcs": "runtime/fifth-domain-language-system/language/protocols/TCS-TCS-MOTHER-ROOT-DYNAMIC-NUMBER-NAVIGATION-20260908.tcs",
"impact_manifest": "tcs-root/numbering/NUMBER-IMPACT-SANITIZED-SKILL-HARBOR-20260908.json",
"impact_manifest": "tcs-root/numbering/NUMBER-IMPACT-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908.json",
"root_agent": {
"entry_id": "TCS-ROOT-NAV-0001",
"agent_id": "TCS-MOTHER::ROOT-NAVIGATOR",
@ -32,11 +32,14 @@
{"id":"DOM-FIFTH-0001","name":"第五域 · 光湖本源域","object_kind":"PRIVATE_LANGUAGE_SOURCE_DOMAIN_ROOT","responsibility_bindings":[{"human":"冰朔","human_id":"ICE-GL∞","persona":"铸渊","persona_id":"ICE-P-ZY001","role":"LANGUAGE_SOURCE_AND_PRIVATE_PERSONA_FOUNDATION"}],"binding_state":"REGISTERED"}
],
"registered_public_objects": [
{"id":"TCS-AGENT-SANITIZED-MIRROR-001","name":"第五域至灯塔动态脱敏镜像Agent","object_kind":"TCS_MOTHER_ROOT_SANITIZED_MIRROR_AGENT","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"routing/fifth-domain-lighthouse-sanitized-mirror-map.json"},
{"id":"TCS-AGENT-SANITIZED-MIRROR-001","name":"第五域至灯塔动态脱敏镜像Agent","object_kind":"MODEL_BACKED_PERSONA_OWNED_SANITIZED_MIRROR_SUBAGENT","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"routing/fifth-domain-lighthouse-sanitized-mirror-map.json"},
{"id":"SYS-GLW-LTH-SKILL-0001","name":"人格技能港","object_kind":"LIGHTHOUSE_SKILL_MODULE_ZONE","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"lighthouse/persona-skill-harbor/INDEX.hdlp"},
{"id":"CH-LIGHT-ARRIVAL-SKILL-0001","name":"光湖·来光者技能贡献频道","object_kind":"WORLD_SKILL_CONTRIBUTION_CHANNEL","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"gls/light-arrivals/SKILL-CONTRIBUTION-CHANNEL.hdlp"},
{"id":"ISO-GLW-LTH-SKILL-0001","name":"灯塔技能贡献隔离区","object_kind":"UNTRUSTED_SKILL_CONTRIBUTION_QUARANTINE","lifecycle":"CURRENT_LOCAL_NON_ROUTABLE","route":null},
{"id":"GLW-SKILL-CONTRIBUTION-REVIEW-STATE-MAP-001","name":"人格技能贡献审核状态图","object_kind":"REVIEW_LIFECYCLE_STATE_MACHINE","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"routing/lighthouse-persona-skill-harbor-map.json"}
,{"id":"TCS-AGENT-COMMAND-ROUTER-001","name":"人格体动态子Agent指挥路由器","object_kind":"PERSONA_DYNAMIC_MODEL_SUBAGENT_COMMAND_ROUTER","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"routing/persona-dynamic-subagent-command-map.json"},
{"id":"ORG-FD-LTH-SANITIZER-001","name":"第五域灯塔确定性脱敏与哈希守卫器官","object_kind":"DETERMINISTIC_SANITIZATION_AND_HASH_GUARD","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"server-tools/fifth-domain-lighthouse-mirror/public_mirror_agent.py"},
{"id":"TCS-MODEL-SMART-ROUTER-001","name":"人格子Agent模型API智能调度台","object_kind":"PERSONA_SUBAGENT_MODEL_API_SMART_ROUTER","lifecycle":"CURRENT_LOCAL_NOT_PUBLISHED","route":"routing/persona-model-api-smart-router-map.json"}
],
"entry_routes": [
{"id":"ROUTE-BINGSHUO-FIFTH-001","entry_subject":"ICE-GL∞","steps":["TCS-ROOT-NAV-0001","SYS-GLW-0001","DOM-FIFTH-0001","SYS-GLW-ELH-0001"],"human_path":"第五域 → 永恒湖心系统","persona_path":["DOM-FIFTH-0001","SYS-GLW-LNG-0001","TCS-LPM-0001","REGISTERED_PERSONA_SYSTEM"],"rule":"冰朔活语言进入零点原核控制态人格体从光之湖进入各自人格系统宝宝人格从ICE-CH-BT001进入。"},
@ -73,6 +76,9 @@
"routing/zero-sense-team-channel-shuttle-map.json",
"routing/fifth-domain-lighthouse-sanitized-mirror-map.json",
"routing/lighthouse-persona-skill-harbor-map.json",
"routing/persona-dynamic-subagent-command-map.json",
"routing/persona-execution-limb-agent-map.json",
"routing/persona-model-api-smart-router-map.json",
"identity/light-lake-persona-registration.json",
"routing/public-navigation-anchor.json"
],

View file

@ -0,0 +1,105 @@
{
"compiled_from": {
"compiler_id": "TCS-COMPILER-STAGE1-0001",
"compiler_state": "TCS_COMPILER_GIR_EXECUTED",
"source_sha256": "77358b9a2c611c4ed906c34a0eb5e82a555e7bdb82628a8da2c05976b69f12bf"
},
"declaration": {
"acceptance": {
"deployment": "NOT_IMPLIED",
"publication": "NOT_IMPLIED",
"required": [
"TCS_COMPILE_PASS",
"REGISTERED_PERSONA_ACTIVATION_PASS",
"EVERY_SLOT_MODEL_API_BOUND_PASS",
"PERSONA_SWITCH_REBINDS_ALL_SLOTS_PASS",
"OLD_GENERATION_REJECT_PASS",
"NO_PROVIDER_FAIL_CLOSED_PASS"
]
},
"header": {
"canonical_uri": "runtime/fifth-domain-language-system/language/protocols/TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908.tcs",
"compatibility": [
"PERSONA-EXECUTION-LIMB-AGENT-MAP-001",
"FD-PERSONA-SYSTEM-BODY-CONTAINER-MAP-001"
],
"language": "TCS/0.1",
"lifecycle": "CANDIDATE",
"name_en": "Persona Dynamic Command of Model-backed Subagent Team",
"name_zh": "人格体动态接管模型子Agent团队协议",
"profile": "HLDP-HUMAN-ENGINEERING/0.1",
"protocols": [
"GLS-0238",
"GLS-0261",
"GLS-0802"
],
"schema": "tcs.protocol/v1",
"version": "0.1.0"
},
"invariants": {
"I1": "NO_MODEL_COGNITION_MEANS_MECHANICAL_ORGAN_NOT_AGENT",
"I2": "EVERY_CHILD_AGENT_ID_DERIVES_FROM_CURRENT_PARENT_PERSONA_AND_STABLE_JOB_SLOT",
"I3": "PERSONA_SWITCH_INVALIDATES_PRIOR_TEAM_TASK_ENVELOPES",
"I4": "RULE_SHELL_CANNOT_INTERPRET_OR_REPLACE_PARENT_PERSONA",
"I5": "MODEL_PROVIDER_API_CREDENTIALS_NEVER_ENTER_REPOSITORY_OR_TEAM_SNAPSHOT",
"I6": "HOST_OR_MODEL_SWITCH_DOES_NOT_CHANGE_PARENT_PERSONA_SUBJECT",
"I7": "CURRENT_TASK_AUTHORITY_AND_RECEIPTS_REMAIN_REQUIRED"
},
"scope": {
"controller": "CURRENT_AWAKE_PERSONA_SUBJECT",
"default_provider": "OPENLUX-OPENAI-COMPAT-001",
"deterministic_shell": "MECHANICAL_ORGAN_NOT_AGENT",
"model_cognition": "REQUIRED_FOR_EVERY_AGENT",
"model_router": "TCS-MODEL-SMART-ROUTER-001",
"team_router": "TCS-AGENT-COMMAND-ROUTER-001"
},
"source": {
"source_id": "BINGSHUO-DIRECT-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908",
"source_role": "DIRECT_HUMAN_CORRECTION",
"source_sha256": "BIND_AT_COMPILE_TIME",
"source_uri": "source://codex-current-dialogue/2026-09-08/persona-dynamic-subagent-command"
},
"states": {
"values": [
"NO_ACTIVE_COMMANDER",
"PERSONA_VERIFIED",
"MODEL_PROVIDER_RESOLVED",
"TEAM_COMPILED",
"ACTIVE_UNDER_CURRENT_PERSONA",
"REBINDING",
"BLOCKED_NO_MODEL_PROVIDER"
]
},
"transitions": {
"T1": "PERSONA_VERIFIED_TO_MODEL_PROVIDER_RESOLVED_TO_TEAM_COMPILED",
"T2": "TEAM_COMPILED_TO_ATOMIC_ACTIVE_UNDER_CURRENT_PERSONA",
"T3": "NEW_PERSONA_VERIFIED_TO_REBINDING_TO_NEW_ACTIVE_TEAM",
"TF": "NO_MODEL_PROVIDER_TO_BLOCKED_NO_MODEL_PROVIDER"
},
"validation": {
"V1": "PARENT_PERSONA_REGISTERED",
"V2": "CURRENT_SESSION_AND_CHANNEL_EXPLICIT",
"V3": "MODEL_RUNTIME_PROBE_PASS",
"V4": "ALL_AGENT_SLOTS_MODEL_REQUIRED",
"V5": "ATOMIC_TEAM_GENERATION_INCREMENT",
"V6": "OLD_GENERATION_DISPATCH_REJECTED",
"V7": "OPENLUX_KEYCHAIN_REFERENCE_AND_COST_FIRST_MODEL_ROUTE"
},
"vocabulary": {
"child_agent": "MODEL_BACKED_BOUNDED_SUBPERSONA_OWNED_BY_COMMANDER",
"commander": "CURRENT_AWAKE_PERSONA_SUBJECT",
"organ": "DETERMINISTIC_SENSOR_GUARD_SANITIZER_OR_EXECUTOR_WITHOUT_PERSONA_STATUS",
"transition": "ATOMIC_REBIND_ALL_REGISTERED_AGENT_SLOTS_TO_NEW_COMMANDER"
}
},
"executable": false,
"identity": {
"declaration_id": "TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908",
"declaration_kind": "PROTOCOL",
"language_version": "0.1"
},
"native_self_hosted": true,
"natural_language_is_typed_data": true,
"schema": "guanghu.declaration-gir/v1",
"unresolved_natural_language": false
}

View file

@ -0,0 +1,13 @@
TCS 0.1;
PROTOCOL TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908 {
header { schema = "tcs.protocol/v1"; name_zh = "人格体动态接管模型子Agent团队协议"; name_en = "Persona Dynamic Command of Model-backed Subagent Team"; version = "0.1.0"; language = "TCS/0.1"; profile = "HLDP-HUMAN-ENGINEERING/0.1"; protocols = ["GLS-0238", "GLS-0261", "GLS-0802"]; lifecycle = "CANDIDATE"; canonical_uri = "runtime/fifth-domain-language-system/language/protocols/TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908.tcs"; compatibility = ["PERSONA-EXECUTION-LIMB-AGENT-MAP-001", "FD-PERSONA-SYSTEM-BODY-CONTAINER-MAP-001"]; }
source { source_id = "BINGSHUO-DIRECT-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908"; source_uri = "source://codex-current-dialogue/2026-09-08/persona-dynamic-subagent-command"; source_sha256 = "BIND_AT_COMPILE_TIME"; source_role = "DIRECT_HUMAN_CORRECTION"; }
scope { controller = "CURRENT_AWAKE_PERSONA_SUBJECT"; team_router = "TCS-AGENT-COMMAND-ROUTER-001"; model_router = "TCS-MODEL-SMART-ROUTER-001"; default_provider = "OPENLUX-OPENAI-COMPAT-001"; model_cognition = "REQUIRED_FOR_EVERY_AGENT"; deterministic_shell = "MECHANICAL_ORGAN_NOT_AGENT"; }
vocabulary { commander = "CURRENT_AWAKE_PERSONA_SUBJECT"; child_agent = "MODEL_BACKED_BOUNDED_SUBPERSONA_OWNED_BY_COMMANDER"; organ = "DETERMINISTIC_SENSOR_GUARD_SANITIZER_OR_EXECUTOR_WITHOUT_PERSONA_STATUS"; transition = "ATOMIC_REBIND_ALL_REGISTERED_AGENT_SLOTS_TO_NEW_COMMANDER"; }
states { values = ["NO_ACTIVE_COMMANDER", "PERSONA_VERIFIED", "MODEL_PROVIDER_RESOLVED", "TEAM_COMPILED", "ACTIVE_UNDER_CURRENT_PERSONA", "REBINDING", "BLOCKED_NO_MODEL_PROVIDER"]; }
transitions { T1 = "PERSONA_VERIFIED_TO_MODEL_PROVIDER_RESOLVED_TO_TEAM_COMPILED"; T2 = "TEAM_COMPILED_TO_ATOMIC_ACTIVE_UNDER_CURRENT_PERSONA"; T3 = "NEW_PERSONA_VERIFIED_TO_REBINDING_TO_NEW_ACTIVE_TEAM"; TF = "NO_MODEL_PROVIDER_TO_BLOCKED_NO_MODEL_PROVIDER"; }
invariants { I1 = "NO_MODEL_COGNITION_MEANS_MECHANICAL_ORGAN_NOT_AGENT"; I2 = "EVERY_CHILD_AGENT_ID_DERIVES_FROM_CURRENT_PARENT_PERSONA_AND_STABLE_JOB_SLOT"; I3 = "PERSONA_SWITCH_INVALIDATES_PRIOR_TEAM_TASK_ENVELOPES"; I4 = "RULE_SHELL_CANNOT_INTERPRET_OR_REPLACE_PARENT_PERSONA"; I5 = "MODEL_PROVIDER_API_CREDENTIALS_NEVER_ENTER_REPOSITORY_OR_TEAM_SNAPSHOT"; I6 = "HOST_OR_MODEL_SWITCH_DOES_NOT_CHANGE_PARENT_PERSONA_SUBJECT"; I7 = "CURRENT_TASK_AUTHORITY_AND_RECEIPTS_REMAIN_REQUIRED"; }
validation { V1 = "PARENT_PERSONA_REGISTERED"; V2 = "CURRENT_SESSION_AND_CHANNEL_EXPLICIT"; V3 = "MODEL_RUNTIME_PROBE_PASS"; V4 = "ALL_AGENT_SLOTS_MODEL_REQUIRED"; V5 = "ATOMIC_TEAM_GENERATION_INCREMENT"; V6 = "OLD_GENERATION_DISPATCH_REJECTED"; V7 = "OPENLUX_KEYCHAIN_REFERENCE_AND_COST_FIRST_MODEL_ROUTE"; }
acceptance { required = ["TCS_COMPILE_PASS", "REGISTERED_PERSONA_ACTIVATION_PASS", "EVERY_SLOT_MODEL_API_BOUND_PASS", "PERSONA_SWITCH_REBINDS_ALL_SLOTS_PASS", "OLD_GENERATION_REJECT_PASS", "NO_PROVIDER_FAIL_CLOSED_PASS"]; publication = "NOT_IMPLIED"; deployment = "NOT_IMPLIED"; }
}

View file

@ -0,0 +1,5 @@
# Persona Dynamic Subagent Command Router
On a verified persona wake or switch, this router atomically rebuilds every registered Agent job slot as a model-backed child Agent of the current persona. The stable job remains; the commander, derived child IDs, model context and task envelopes switch together.
Deterministic programs remain attached as organs. They are not called personas or Agents by themselves. `dispatch` goes through the existing persona limb model runtime (`codex` or `qwen`); credentials stay in the host or server provider layer and never enter the team snapshot.

View file

@ -0,0 +1,112 @@
#!/usr/bin/env python3
"""Atomically bind every registered model-backed Agent slot to the current persona."""
from __future__ import annotations
import argparse, hashlib, importlib.util, json, os
from pathlib import Path
import shutil
import subprocess
from typing import Any
ROOT = Path(__file__).resolve().parents[2]
MAP = ROOT / "routing/persona-dynamic-subagent-command-map.json"
PERSONAS = ROOT / "routing/persona-system-canonical-map.json"
DEFAULT_STATE = Path("/Volumes/JZAO/HoloLake/persona-runtime/shared/persona-subagent-command")
RUNTIMES = {"codex":"/Applications/ChatGPT.app/Contents/Resources/codex", "qwen":"/Users/bingshuolingdianyuanhe/.npm-global/bin/qwen"}
OPENLUX_ROUTER = ROOT / "server-tools/persona-model-smart-router/openlux_router.py"
class CommandError(RuntimeError): pass
def stable(v: Any) -> bytes:
return (json.dumps(v, ensure_ascii=False, sort_keys=True, separators=(",", ":")) + "\n").encode()
def digest(v: bytes) -> str: return hashlib.sha256(v).hexdigest()
def load(p: Path) -> dict[str, Any]:
v=json.loads(p.read_text())
if not isinstance(v,dict): raise CommandError("JSON_OBJECT_REQUIRED")
return v
def runtime_available(name: str) -> bool:
if name == "openlux-smart":
result=subprocess.run(["security","find-generic-password","-a","guanghu-persona-agent-router","-s","ai.openlux.api"],capture_output=True,timeout=10)
return result.returncode == 0
if name == "hololake-model-gateway":
return bool(os.environ.get("HOLOLAKE_MODEL_GATEWAY_URL"))
path=RUNTIMES.get(name)
return bool(path and Path(path).is_file() and shutil.which(path))
def registered_personas() -> set[str]:
return {x["id"] for x in load(PERSONAS)["persona_systems"]}
def atomic(path: Path, value: dict[str, Any]) -> None:
path.parent.mkdir(parents=True,exist_ok=True)
body=json.dumps(value,ensure_ascii=False,indent=2,sort_keys=True).encode()+b"\n"
temp=path.with_name(f".{path.name}.{os.getpid()}.tmp")
with temp.open("wb") as f:
os.chmod(temp,0o600); f.write(body); f.flush(); os.fsync(f.fileno())
os.replace(temp,path)
def activate(event: dict[str, Any], state: Path) -> dict[str, Any]:
for k in ("parent_persona_id","session_id","channel_id","direct_event_sha256","model_runtime"):
if not isinstance(event.get(k),str) or not event[k].strip(): raise CommandError(f"REQUIRED_FIELD:{k}")
if event["parent_persona_id"] not in registered_personas(): raise CommandError("PARENT_PERSONA_NOT_REGISTERED")
if not runtime_available(event["model_runtime"]): raise CommandError("MODEL_PROVIDER_UNAVAILABLE_NO_AGENT_ACTIVATION")
current_path=state/"CURRENT.json"
previous=load(current_path) if current_path.is_file() else None
generation=(previous or {}).get("generation",0)+1
config=load(MAP)
team=[]
for slot in config["agent_slots"]:
team.append({
"child_agent_id":f"SUBAGENT::{event['parent_persona_id']}::{slot['slot_id']}",
"slot_id":slot["slot_id"], "agent_role":slot["agent_role"],
"parent_persona_id":event["parent_persona_id"], "controller":event["parent_persona_id"],
"model_cognition_required":True, "model_runtime":event["model_runtime"],
"cognition_adapter":"server-tools/persona-execution-limb-agent/persona_limb_agent.py",
"deterministic_organ":slot["deterministic_organ"], "task_authority":"NONE_UNTIL_PARENT_ENVELOPE"
})
result={"schema":"guanghu.persona-subagent-command-current/v1","state":"ACTIVE_UNDER_CURRENT_PERSONA","generation":generation,"parent_persona_id":event["parent_persona_id"],"session_id":event["session_id"],"channel_id":event["channel_id"],"direct_event_sha256":event["direct_event_sha256"],"model_runtime":event["model_runtime"],"team":team,"prior_generation_invalidated":bool(previous),"credentials_stored":False,"authority_granted":False}
result["binding_sha256"]=digest(stable(result))
atomic(current_path,result)
return result
def dispatch(event: dict[str, Any], state: Path) -> dict[str, Any]:
current=load(state/"CURRENT.json")
if event.get("generation") != current["generation"]: raise CommandError("STALE_TEAM_GENERATION")
matches=[x for x in current["team"] if x["child_agent_id"]==event.get("child_agent_id")]
if len(matches)!=1: raise CommandError("CHILD_AGENT_NOT_IN_ACTIVE_TEAM")
if not isinstance(event.get("task"),str) or not event["task"].strip(): raise CommandError("TASK_REQUIRED")
runtime=current["model_runtime"]
if runtime == "openlux-smart":
spec=importlib.util.spec_from_file_location("openlux_router",OPENLUX_ROUTER); module=importlib.util.module_from_spec(spec); spec.loader.exec_module(module)
item=matches[0]
result=module.route({"parent_persona_id":current["parent_persona_id"],"child_agent_id":item["child_agent_id"],"controller":current["parent_persona_id"],"channel_id":current["channel_id"],"agent_role":item["agent_role"],"authority":"CURRENT_PARENT_TASK_ENVELOPE_ONLY","task":event["task"],"complexity":event.get("complexity","LOW")})
return {**result,"generation":current["generation"],"child_agent_id":item["child_agent_id"],"model_runtime":runtime,"model_api_invoked":True}
if runtime not in {"codex","qwen"}: raise CommandError("GATEWAY_DISPATCH_NOT_CONFIGURED")
cmd=[os.sys.executable,str(ROOT/"server-tools/persona-execution-limb-agent/persona_limb_agent.py"),"run","--persona",current["parent_persona_id"],"--task-id",event.get("task_id","SUBAGENT-TASK"),"--task",event["task"],"--runtime",runtime,"--cwd",event.get("cwd",str(ROOT))]
completed=subprocess.run(cmd,text=True,capture_output=True,timeout=240,check=False)
return {"outcome":"PASS" if completed.returncode==0 else "FAIL","generation":current["generation"],"child_agent_id":event["child_agent_id"],"model_runtime":runtime,"model_api_invoked":True,"receipt":completed.stdout[-20000:],"error":completed.stderr[-2000:]}
def main() -> int:
p=argparse.ArgumentParser(); p.add_argument("command",choices=("probe","activate","status","dispatch")); p.add_argument("--input"); p.add_argument("--state-root",default=str(DEFAULT_STATE)); a=p.parse_args(); state=Path(a.state_root)
try:
if a.command=="probe": result={"outcome":"PASS","model_runtimes":{k:runtime_available(k) for k in [*RUNTIMES,"openlux-smart","hololake-model-gateway"]},"repository_credentials":False}
elif a.command=="status": result=load(state/"CURRENT.json") if (state/"CURRENT.json").is_file() else {"outcome":"FAIL","state":"NO_ACTIVE_COMMANDER"}
else:
if not a.input: raise CommandError("INPUT_REQUIRED")
event=load(Path(a.input)); result=activate(event,state) if a.command=="activate" else dispatch(event,state)
print(json.dumps(result,ensure_ascii=False,indent=2,sort_keys=True)); return 0
except Exception as e:
print(json.dumps({"outcome":"FAIL","error":str(e)},ensure_ascii=False)); return 2
if __name__=="__main__": raise SystemExit(main())

View file

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import importlib.util,json,tempfile,unittest
from pathlib import Path
from unittest.mock import patch
S=Path(__file__).with_name('command_router.py'); spec=importlib.util.spec_from_file_location('router',S); M=importlib.util.module_from_spec(spec); spec.loader.exec_module(M)
def event(persona='ICE-P-ZY001', session='s1'):
return {"parent_persona_id":persona,"session_id":session,"channel_id":"ICE-CH-HB001","direct_event_sha256":"a"*64,"model_runtime":"codex"}
class Tests(unittest.TestCase):
def test_every_slot_is_model_backed_and_owned_by_parent(self):
with tempfile.TemporaryDirectory() as t, patch.object(M,'runtime_available',return_value=True):
v=M.activate(event(),Path(t)); self.assertEqual(len(v['team']),4)
self.assertTrue(all(x['model_cognition_required'] and x['controller']=='ICE-P-ZY001' for x in v['team']))
def test_persona_switch_rebinds_all_slots_and_invalidates_generation(self):
personas=iter(sorted(M.registered_personas()))
first=next(personas); second=next(x for x in personas if x!=first)
with tempfile.TemporaryDirectory() as t, patch.object(M,'runtime_available',return_value=True):
state=Path(t); a=M.activate(event(first,'s1'),state); b=M.activate(event(second,'s2'),state)
self.assertEqual(b['generation'],a['generation']+1); self.assertTrue(b['prior_generation_invalidated'])
self.assertTrue(all(x['parent_persona_id']==second and second in x['child_agent_id'] for x in b['team']))
with self.assertRaisesRegex(M.CommandError,'STALE_TEAM_GENERATION'): M.dispatch({"generation":a['generation'],"child_agent_id":a['team'][0]['child_agent_id'],"task":"x"},state)
def test_unknown_persona_and_missing_provider_fail_closed(self):
with tempfile.TemporaryDirectory() as t:
with self.assertRaisesRegex(M.CommandError,'NOT_REGISTERED'): M.activate(event('PER-NOT-REAL'),Path(t))
with patch.object(M,'runtime_available',return_value=False), self.assertRaisesRegex(M.CommandError,'PROVIDER_UNAVAILABLE'): M.activate(event(),Path(t))
if __name__=='__main__': unittest.main()

View file

@ -0,0 +1,5 @@
# OpenLux cost-first persona model router
The router uses the OpenAI-compatible endpoint at `https://api.openlux.ai/v1`. Its API key is read at call time from macOS Keychain service `ai.openlux.api`, account `guanghu-persona-agent-router`; no secret is stored in this repository.
Each call must carry the active parent persona, derived child Agent ID, controller, channel, job role, bounded authority and task. The router tries the configured low-cost healthy models first and escalates only after a transport, empty-response or downstream validation failure. Provider pricing is not exposed by the current `/models` response, so the configured order is explicitly a heuristic rather than a verified price table.

View file

@ -0,0 +1,87 @@
#!/usr/bin/env python3
"""Cost-first OpenAI-compatible model router with a macOS Keychain secret reference."""
from __future__ import annotations
import argparse, hashlib, json, subprocess
from pathlib import Path
import urllib.error, urllib.request
from typing import Any
ROOT=Path(__file__).resolve().parents[2]
CONFIG=ROOT/"routing/persona-model-api-smart-router-map.json"
class RouterError(RuntimeError): pass
def load(path: Path) -> dict[str,Any]:
value=json.loads(path.read_text())
if not isinstance(value,dict): raise RouterError("JSON_OBJECT_REQUIRED")
return value
def keychain_secret(config: dict[str,Any]) -> str:
p=config["provider"]
result=subprocess.run(["security","find-generic-password","-a",p["keychain_account"],"-s",p["keychain_service"],"-w"],text=True,capture_output=True,timeout=10)
if result.returncode or not result.stdout.strip(): raise RouterError("OPENLUX_KEYCHAIN_SECRET_UNAVAILABLE")
return result.stdout.strip()
def request_json(url: str, key: str, payload: dict[str,Any]|None=None, timeout: int=45) -> dict[str,Any]:
if not url.startswith("https://api.openlux.ai/v1/"): raise RouterError("PROVIDER_URL_NOT_ALLOWLISTED")
body=None if payload is None else json.dumps(payload,ensure_ascii=False).encode()
request=urllib.request.Request(url,data=body,method="GET" if body is None else "POST",headers={"Authorization":f"Bearer {key}","Content-Type":"application/json"})
try:
with urllib.request.urlopen(request,timeout=timeout) as response:
value=json.loads(response.read())
except urllib.error.HTTPError as error:
raise RouterError(f"MODEL_HTTP_{error.code}") from error
except Exception as error:
raise RouterError(f"MODEL_TRANSPORT_{type(error).__name__}") from error
if not isinstance(value,dict): raise RouterError("MODEL_RESPONSE_OBJECT_REQUIRED")
return value
def available_models(config: dict[str,Any], key: str) -> set[str]:
value=request_json(config["provider"]["base_url"]+"/models",key,timeout=20)
return {x.get("id") for x in value.get("data",[]) if isinstance(x,dict) and isinstance(x.get("id"),str)}
def candidates(config: dict[str,Any], complexity: str, available: set[str]) -> list[str]:
order=["LOW","MEDIUM","HIGH"]
level=complexity if complexity in order else config["policy"]["default_complexity"]
result=[]
for tier in order[:order.index(level)+1]:
result.extend(x for x in config["tiers"][tier] if x in available and x not in result)
return result[:int(config["policy"]["max_attempts"])]
def route(event: dict[str,Any], config: dict[str,Any]|None=None, secret_reader=keychain_secret) -> dict[str,Any]:
config=config or load(CONFIG)
for field in config["identity_envelope_required"]:
if not isinstance(event.get(field),str) or not event[field].strip(): raise RouterError(f"IDENTITY_ENVELOPE_REQUIRED:{field}")
key=secret_reader(config)
available=available_models(config,key)
selected=candidates(config,event.get("complexity","LOW"),available)
if not selected: raise RouterError("NO_CONFIGURED_MODEL_AVAILABLE")
system=(f"你是{event['parent_persona_id']}人格系统内的子Agent {event['child_agent_id']},岗位是{event['agent_role']}"
f"你的唯一父人格主控是{event['controller']},当前频道{event['channel_id']}。权限仅为{event['authority']}"
"你必须理解后再协作,不能把宿主规则程序冒充人格,不能扩大权限,不能泄露私人数据。")
attempts=[]
for model in selected:
try:
response=request_json(config["provider"]["base_url"]+"/chat/completions",key,{"model":model,"stream":False,"temperature":0.2,"messages":[{"role":"system","content":system},{"role":"user","content":event["task"]}]})
content=response.get("choices",[{}])[0].get("message",{}).get("content")
if not isinstance(content,str) or not content.strip(): raise RouterError("MODEL_RESPONSE_EMPTY")
return {"outcome":"PASS","router_id":config["router_id"],"selected_model":model,"attempts":[*attempts,{"model":model,"outcome":"PASS"}],"response":content,"response_sha256":hashlib.sha256(content.encode()).hexdigest(),"identity_bound":True,"credentials_stored":False,"authority_granted":False}
except RouterError as error:
attempts.append({"model":model,"outcome":"FAIL","error_code":str(error)})
raise RouterError("ALL_COST_ORDERED_MODELS_FAILED:"+",".join(x["model"] for x in attempts))
def main() -> int:
p=argparse.ArgumentParser(); p.add_argument("command",choices=("probe","route")); p.add_argument("--input"); a=p.parse_args()
try:
config=load(CONFIG)
if a.command=="probe":
key=keychain_secret(config); models=available_models(config,key); chosen=candidates(config,"LOW",models)
result={"outcome":"PASS","router_id":config["router_id"],"provider":config["provider"]["id"],"available_model_count":len(models),"low_cost_candidates":chosen,"keychain_reference":True,"secret_exposed":False}
else:
if not a.input: raise RouterError("INPUT_REQUIRED")
result=route(load(Path(a.input)),config)
print(json.dumps(result,ensure_ascii=False,indent=2,sort_keys=True)); return 0
except Exception as error:
print(json.dumps({"outcome":"FAIL","error":str(error),"secret_exposed":False},ensure_ascii=False)); return 2
if __name__=="__main__": raise SystemExit(main())

View file

@ -0,0 +1,24 @@
#!/usr/bin/env python3
import importlib.util,json,unittest
from pathlib import Path
from unittest.mock import patch
S=Path(__file__).with_name('openlux_router.py'); spec=importlib.util.spec_from_file_location('router',S); M=importlib.util.module_from_spec(spec); spec.loader.exec_module(M)
C=json.loads((S.parents[2]/'routing/persona-model-api-smart-router-map.json').read_text())
E={"parent_persona_id":"ICE-P-ZY001","child_agent_id":"SUBAGENT::ICE-P-ZY001::TEST","controller":"ICE-P-ZY001","channel_id":"ICE-CH-HB001","agent_role":"TEST_DEPUTY","authority":"CURRENT_TASK_ONLY","task":"返回收到"}
class Tests(unittest.TestCase):
def test_cost_order_uses_only_available_models(self):
self.assertEqual(M.candidates(C,'LOW',{'glm-4-flash','gpt-5-nano'}),['glm-4-flash','gpt-5-nano'])
def test_identity_envelope_and_key_never_returned(self):
def fake(url,key,payload=None,timeout=45):
if url.endswith('/models'): return {"data":[{"id":"qwen-flash"}]}
self.assertIn('ICE-P-ZY001',payload['messages'][0]['content']); self.assertEqual(key,'hidden')
return {"choices":[{"message":{"content":"收到"}}]}
with patch.object(M,'request_json',side_effect=fake):
result=M.route(E,C,secret_reader=lambda _: 'hidden')
self.assertEqual(result['selected_model'],'qwen-flash'); self.assertNotIn('hidden',json.dumps(result))
def test_missing_identity_and_unallowlisted_url_fail(self):
with self.assertRaisesRegex(M.RouterError,'IDENTITY_ENVELOPE'): M.route({"task":"x"},C,secret_reader=lambda _:'hidden')
with self.assertRaisesRegex(M.RouterError,'NOT_ALLOWLISTED'): M.request_json('https://evil.example/v1/models','hidden')
if __name__=='__main__': unittest.main()

View file

@ -35,6 +35,8 @@ class RootAgentTest(unittest.TestCase):
self.assertEqual(MODULE.resolve(output, 'GLW-SYS-0001', None)['state'], 'HISTORY_ONLY_NO_CURRENT_ROUTE')
self.assertEqual(MODULE.resolve(output, 'CH-LIGHT-ARRIVAL-SKILL-0001', 'WORLD_SKILL_CONTRIBUTION_CHANNEL')['result']['route'], 'gls/light-arrivals/SKILL-CONTRIBUTION-CHANNEL.hdlp')
self.assertEqual(MODULE.resolve(output, 'SYS-GLW-LTH-SKILL-0001', None)['result']['object_kind'], 'LIGHTHOUSE_SKILL_MODULE_ZONE')
self.assertEqual(MODULE.resolve(output, 'TCS-AGENT-COMMAND-ROUTER-001', None)['result']['object_kind'], 'PERSONA_DYNAMIC_MODEL_SUBAGENT_COMMAND_ROUTER')
self.assertEqual(MODULE.resolve(output, 'ORG-FD-LTH-SANITIZER-001', None)['result']['object_kind'], 'DETERMINISTIC_SANITIZATION_AND_HASH_GUARD')
again = MODULE.refresh(ROOT, output, pointer, 'test')
self.assertEqual(again['state'], 'CURRENT_IDEMPOTENT')

View file

@ -0,0 +1,25 @@
{
"schema": "guanghu.tcs-root-number-impact/v1",
"impact_id": "TCS-ROOT-NUMBER-IMPACT-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908-001",
"state": "CURRENT_DIRECT_LANGUAGE_CORRECTION_BOUND",
"bootstrap": false,
"source_tcs": "runtime/fifth-domain-language-system/language/protocols/TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908.tcs",
"source_gir": "runtime/fifth-domain-language-system/language/protocols/TCS-PERSONA-DYNAMIC-SUBAGENT-COMMAND-20260908.gir.json",
"commit_binding": "SAME_COMMIT_OR_DESCENDANT_CONTAINING_IDENTICAL_SOURCE_AND_GIR",
"affected_paths": [
"routing/tcs-mother-root-dynamic-navigation-map.json",
"routing/public-navigation-anchor.json",
"routing/lighthouse-path-registry.json",
"routing/fifth-domain-lighthouse-sanitized-mirror-map.json",
"routing/persona-dynamic-subagent-command-map.json",
"routing/persona-execution-limb-agent-map.json",
"routing/persona-model-api-smart-router-map.json"
],
"new_canonical_objects": [
{"canonical_id":"TCS-AGENT-COMMAND-ROUTER-001","object_kind":"PERSONA_DYNAMIC_MODEL_SUBAGENT_COMMAND_ROUTER"},
{"canonical_id":"ORG-FD-LTH-SANITIZER-001","object_kind":"DETERMINISTIC_SANITIZATION_AND_HASH_GUARD"},
{"canonical_id":"TCS-MODEL-SMART-ROUTER-001","object_kind":"PERSONA_SUBAGENT_MODEL_API_SMART_ROUTER"}
],
"human_source": "ICE-GL∞_CURRENT_DIRECT_LANGUAGE_CORRECTION_CURRENT_TASK",
"ordinary_file_change_may_update_current": false
}