54 lines
2.4 KiB
Python
54 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
import json
|
|
import pathlib
|
|
import sys
|
|
|
|
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
REPO = ROOT.parents[1]
|
|
errors = []
|
|
|
|
registry = json.loads((ROOT / "registries/module-registry.json").read_text())
|
|
ids = [m["module_id"] for m in registry["modules"]]
|
|
if len(ids) != len(set(ids)):
|
|
errors.append("duplicate module id")
|
|
|
|
required_sources = {
|
|
"USER_MESSAGE", "PERSONA_RESPONSE", "SYSTEM_CONTEXT", "PROTOCOL_EVENT",
|
|
"AGENT_ACTION", "TOOL_RESULT", "SYSTEM_RECEIPT",
|
|
}
|
|
types = (ROOT / "src/types.ts").read_text()
|
|
missing = sorted(x for x in required_sources if f'"{x}"' not in types)
|
|
if missing:
|
|
errors.append(f"missing source kinds: {missing}")
|
|
|
|
package = json.loads((ROOT / "package.json").read_text())
|
|
for forbidden in ("openai", "anthropic", "@google/generative-ai", "langchain"):
|
|
if forbidden in package.get("dependencies", {}):
|
|
errors.append(f"internal model dependency forbidden: {forbidden}")
|
|
for required in ("marked", "dompurify"):
|
|
if required not in package.get("dependencies", {}):
|
|
errors.append(f"knowledge human renderer dependency missing: {required}")
|
|
renderer = ROOT / "src/modules/knowledge-render/index.tsx"
|
|
if not renderer.exists() or "MarkdownDocument" not in renderer.read_text():
|
|
errors.append("knowledge human visual renderer missing")
|
|
|
|
tauri = json.loads((ROOT / "src-tauri/tauri.conf.json").read_text())
|
|
endpoints = tauri["plugins"]["updater"]["endpoints"]
|
|
if endpoints != ["https://guanghulab.com/hololake/releases/latest.json"]:
|
|
errors.append("update endpoint drift")
|
|
if not tauri["plugins"]["updater"].get("pubkey"):
|
|
errors.append("update signature trust missing")
|
|
|
|
architecture = json.loads((REPO / "routing/hololake-current-architecture.json").read_text())
|
|
clean = architecture.get("clean_v1_rebuild", {})
|
|
if clean.get("source") != "product-source/hololake-clean-desktop":
|
|
errors.append("current architecture does not point to clean V1")
|
|
if clean.get("enterprise_four_domains_embedded") is not False:
|
|
errors.append("enterprise domains embedded in personal product")
|
|
if clean.get("fifth_domain_private_content_embedded") is not False:
|
|
errors.append("Fifth Domain private content embedded in public product")
|
|
|
|
if errors:
|
|
print(json.dumps({"result": "FAIL_0", "errors": errors}, ensure_ascii=False, indent=2))
|
|
sys.exit(1)
|
|
print(json.dumps({"result": "PASS_100", "module_ids": ids, "source_kinds": sorted(required_sources)}, ensure_ascii=False, indent=2))
|