Files
cdsl-cad/backend/engine/cdsl_engine/__init__.py
T
2026-09-02 13:51:35 +08:00

62 lines
2.2 KiB
Python

"""
Local CDSL engine copied into the product repository.
The package exposes the CDSL-only rebuild API used by the backend Agent.
"""
from __future__ import annotations
from .llm_compiler import compile_cdsl
from .llm_engine import run_engine_plan
try:
from .rebuild import compare_with_gold, compile_cdsl_to_pack, run_cdsl_only, run_engine, run_rebuild
except ModuleNotFoundError as exc:
# The legacy rebuild façade optionally depends on cdsl_importer, which is
# not present in the standalone runtime distribution. Keep importing the
# executable session runtime possible; callers of the legacy façade get a
# precise import error when they invoke it.
if exc.name != "cdsl_importer":
raise
def _legacy_rebuild_unavailable(*_args, _missing=exc, **_kwargs):
raise RuntimeError("legacy rebuild facade requires the optional cdsl_importer package") from _missing
compare_with_gold = _legacy_rebuild_unavailable
compile_cdsl_to_pack = _legacy_rebuild_unavailable
run_cdsl_only = _legacy_rebuild_unavailable
run_engine = _legacy_rebuild_unavailable
run_rebuild = _legacy_rebuild_unavailable
from .semantic_validation import validate_semantic_cdsl
from .sketch_solver import CORE_SHAPE_GENERATORS, resolve_all_sketches, resolve_required_sketches
from .runtime import ALL_ATOMIC_IDS, EXECUTORS, RuntimeExecutionError, analyze_cdsl, rebuild_cdsl
from .operation_contracts import materialized_feature_contracts
# The package-level runtime contract is the session executor registry. The
# older llm_engine dispatcher remains available only for legacy engine packs.
SUPPORTED_ATOMIC_IDS = ALL_ATOMIC_IDS
SHAPE_GENERATORS = CORE_SHAPE_GENERATORS
__all__ = [
"compile_cdsl",
"compile_cdsl_to_pack",
"run_engine_plan",
"run_engine",
"run_cdsl_only",
"run_rebuild",
"compare_with_gold",
"resolve_all_sketches",
"resolve_required_sketches",
"CORE_SHAPE_GENERATORS",
"SHAPE_GENERATORS",
"SUPPORTED_ATOMIC_IDS",
"validate_semantic_cdsl",
"ALL_ATOMIC_IDS",
"EXECUTORS",
"rebuild_cdsl",
"analyze_cdsl",
"RuntimeExecutionError",
"materialized_feature_contracts",
]
__version__ = "1.0.0"