feat: execute stage-one capability modules

This commit is contained in:
冰朔 2026-09-08 22:11:38 +08:00
commit 25d54fd601
21 changed files with 520 additions and 48 deletions

View file

@ -47,10 +47,10 @@ def audit()->dict[str,Any]:
if container["compatibility"]["same_memory"] is not False: errors.append("CONTAINER_MEMORY_COLLAPSE")
if not legacy["parts"]: errors.append("LEGACY_PARTS_EMPTY")
living=registry.get("living_runtime",{})
if living.get("state")!="READY_17_MODULES_API_VERIFIED" or not (LIVING_STATE/"CONTAINER.json").is_file(): errors.append("LIVING_CONTAINER_NOT_READY")
if living.get("state")!="READY_17_CAPABILITY_MODULES_API_AND_ORGAN_VERIFIED" or not (LIVING_STATE/"CONTAINER.json").is_file(): errors.append("LIVING_CONTAINER_NOT_READY")
for item in modules:
current=LIVING_STATE/"modules"/item["module_id"]/"CURRENT.json"
if not current.is_file() or load(current).get("state")!="READY_API_VERIFIED": errors.append(f"LIVING_MODULE_NOT_READY:{item['module_id']}")
if not current.is_file() or load(current).get("state")!="READY_API_AND_CAPABILITY_VERIFIED": errors.append(f"LIVING_MODULE_NOT_READY:{item['module_id']}")
return {"outcome":"PASS" if not errors else "FAIL","errors":errors,"module_count":len(modules),"legacy_part_count":len(legacy["parts"]),"cumulative_gate_count":len(modules)}
def snapshot()->dict[str,Any]:
@ -60,7 +60,7 @@ def snapshot()->dict[str,Any]:
counts={}
for item in modules: counts[item["product_status"]]=counts.get(item["product_status"],0)+1
current=next((x for x in modules if x["product_status"] not in {"RELEASED","RELEASED_SIGNED_NOTARIZED_PUBLIC"}),None)
value={"schema":"guanghu.heartbeat-engineering-shelf-current/v1","state":"CURRENT_LANGUAGE_RUNTIME_17_MODULES_API_VERIFIED","system_id":system["system_id"],"shelf_id":system["shelf_id"],"project_id":system["project_id"],"repo012_head":git("rev-parse","HEAD"),"repo014_main":system["official_product_architecture"]["main"],"module_count":len(modules),"status_counts":counts,"current_language_module_id":None,"current_product_module_id":current["module_id"] if current else None,"modules":modules,"legacy_parts":legacy["parts"],"language_runtime":registry["living_runtime"],"reality_engineering_started":False,"zero_core_dispatch":"NOT_ISSUED"}
value={"schema":"guanghu.heartbeat-engineering-shelf-current/v1","state":"CURRENT_LANGUAGE_RUNTIME_17_CAPABILITY_MODULES_API_AND_ORGAN_VERIFIED","system_id":system["system_id"],"shelf_id":system["shelf_id"],"project_id":system["project_id"],"repo012_head":git("rev-parse","HEAD"),"repo014_main":system["official_product_architecture"]["main"],"module_count":len(modules),"status_counts":counts,"current_language_module_id":None,"current_product_module_id":current["module_id"] if current else None,"modules":modules,"legacy_parts":legacy["parts"],"language_runtime":registry["living_runtime"],"reality_engineering_started":False,"zero_core_dispatch":"NOT_ISSUED"}
value["freshness_token"]=digest(stable(value)); return value
def sync(state:Path)->dict[str,Any]:
@ -100,7 +100,7 @@ def status()->dict[str,Any]:
def resume()->dict[str,Any]:
value=snapshot(); current=next(x for x in value["modules"] if x["module_id"]==value["current_product_module_id"])
prior=[x["module_id"] for x in value["modules"] if x["sequence"]<current["sequence"]]
return {"outcome":"PASS","project_id":value["project_id"],"language_runtime_state":"READY_17_MODULES_API_VERIFIED","current_product_module":current,"prior_product_cumulative_scope":prior,"next_product_gate":current["cumulative_gate"],"reality_engineering_started":False,"requires_dual_signature_before_zero_core":True}
return {"outcome":"PASS","project_id":value["project_id"],"language_runtime_state":"READY_17_CAPABILITY_MODULES_API_AND_ORGAN_VERIFIED","current_product_module":current,"prior_product_cumulative_scope":prior,"next_product_gate":current["cumulative_gate"],"reality_engineering_started":False,"requires_dual_signature_before_zero_core":True}
def main()->int:
p=argparse.ArgumentParser();p.add_argument("command",choices=("audit","sync","status","query","smart-query","resume"));p.add_argument("--text",default="");p.add_argument("--state-root",default=str(DEFAULT_STATE));a=p.parse_args()