mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
Mechanically re-derived: bin/debrand runs over a fresh import of posthog/posthog@fa1a9a60d4 (2026-08-06). The pipeline (.hanzo/workflows), the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md and the squashed initial migration are restored from the shipped tree, same as the previous import. The prune's import-closure guard kept 21 products the new core now imports; dropping them is a refactor now, recorded rather than forced.
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""The canvas platform contract, loaded from the builder package's manifest.
|
|
|
|
manifest.json is the single source of truth shared by the Node builder
|
|
(build.mjs), this Python validator/build service, and the artifact origin's
|
|
CSP. The desktop app asserts its own copy against the same file in a contract
|
|
test, so a drift in pinned dependencies or limits fails loudly instead of
|
|
diverging silently.
|
|
"""
|
|
|
|
import json
|
|
from functools import lru_cache
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
from django.conf import settings
|
|
|
|
CANVAS_BUILDER_DIR = Path(settings.CANVAS_BUILDER_DIR)
|
|
|
|
|
|
@lru_cache(maxsize=1)
|
|
def platform_contract() -> dict[str, Any]:
|
|
return json.loads((CANVAS_BUILDER_DIR / "manifest.json").read_text())
|
|
|
|
|
|
def platform_dependencies() -> dict[str, str]:
|
|
"""Pinned name → exact version of every platform-supported dependency."""
|
|
return {name: entry["version"] for name, entry in platform_contract()["dependencies"].items()}
|
|
|
|
|
|
def allowed_import_specifiers() -> frozenset[str]:
|
|
return frozenset(platform_contract()["allowedImportSpecifiers"])
|
|
|
|
|
|
def artifact_csp() -> str:
|
|
return platform_contract()["csp"]
|
|
|
|
|
|
def contract_limits() -> dict[str, int]:
|
|
return platform_contract()["limits"]
|
|
|
|
|
|
def canvas_sdk_version() -> str:
|
|
return platform_contract()["canvasSdkVersion"]
|