c47e6445d0
CI / quality (pull_request) Successful in 19s
CI / lint (pull_request) Successful in 22s
CI / benchmark-publish (pull_request) Has been skipped
CI / security (pull_request) Successful in 33s
CI / build (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 1m0s
CI / integration_tests (pull_request) Successful in 4m56s
CI / unit_tests (pull_request) Successful in 15m11s
CI / docker (pull_request) Successful in 1m33s
CI / benchmark-regression (pull_request) Successful in 20m55s
CI / coverage (pull_request) Successful in 33m42s
CI / lint (push) Successful in 13s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 17s
CI / security (push) Successful in 28s
CI / typecheck (push) Successful in 32s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 3m3s
CI / benchmark-publish (push) Successful in 10m8s
CI / unit_tests (push) Successful in 12m42s
CI / docker (push) Successful in 39s
CI / coverage (push) Has been cancelled
Add ActorCompiler module that translates GRAPH-type ActorConfigSchema definitions into LangGraph NodeConfig/Edge structures with LSP binding metadata. Includes subgraph resolution with cross-actor cycle detection, entry/exit validation, and CompilationMetadata for diagnostics. New files: - src/cleveragents/actor/compiler.py: Core compiler with compile_actor() - features/actor_compiler.feature: 13 Behave scenarios - features/steps/actor_compiler_steps.py: Step definitions - robot/actor_compiler.robot: 4 Robot smoke tests - benchmarks/actor_compiler_bench.py: ASV performance benchmarks - docs/reference/actor_compiler.md: Compilation pipeline reference Modified: - src/cleveragents/actor/__init__.py: Export compiler types - vulture_whitelist.py: Whitelist new public API ISSUES CLOSED: #158
75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
"""Robot Framework helper for actor compiler smoke tests.
|
|
|
|
Provides a CLI interface for Robot to invoke the actor compiler on
|
|
YAML-defined GRAPH actors and inspect compilation metadata.
|
|
|
|
Usage:
|
|
python robot/helper_actor_compiler.py compile <yaml_file>
|
|
python robot/helper_actor_compiler.py compile-fail <yaml_file>
|
|
python robot/helper_actor_compiler.py metadata <yaml_file>
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_SRC = str(Path(__file__).resolve().parents[1] / "src")
|
|
if _SRC not in sys.path:
|
|
sys.path.insert(0, _SRC)
|
|
|
|
from cleveragents.actor.compiler import compile_actor # noqa: E402
|
|
from cleveragents.actor.schema import ActorConfigSchema # noqa: E402
|
|
|
|
|
|
def main() -> int:
|
|
"""Entry point called by Robot Framework ``Run Process``."""
|
|
if len(sys.argv) < 3:
|
|
print("Usage: helper_actor_compiler.py <compile|compile-fail|metadata> <file>")
|
|
return 1
|
|
|
|
command = sys.argv[1]
|
|
yaml_path = sys.argv[2]
|
|
|
|
if command == "compile":
|
|
try:
|
|
config = ActorConfigSchema.from_yaml_file(yaml_path)
|
|
compiled = compile_actor(config)
|
|
print(f"actor-compiler-ok: {compiled.name}")
|
|
print(f"nodes: {len(compiled.nodes)}")
|
|
print(f"edges: {len(compiled.edges)}")
|
|
print(f"entry: {compiled.entry_point}")
|
|
return 0
|
|
except Exception as exc:
|
|
print(f"actor-compiler-fail: {exc}")
|
|
return 1
|
|
|
|
if command == "compile-fail":
|
|
try:
|
|
config = ActorConfigSchema.from_yaml_file(yaml_path)
|
|
compile_actor(config)
|
|
print("actor-compiler-unexpected-success")
|
|
return 1
|
|
except Exception as exc:
|
|
print(f"actor-compiler-expected-fail: {exc}")
|
|
return 0
|
|
|
|
if command == "metadata":
|
|
try:
|
|
config = ActorConfigSchema.from_yaml_file(yaml_path)
|
|
compiled = compile_actor(config)
|
|
meta = compiled.metadata.model_dump(mode="json")
|
|
print(f"actor-compiler-metadata: {json.dumps(meta)}")
|
|
return 0
|
|
except Exception as exc:
|
|
print(f"actor-compiler-fail: {exc}")
|
|
return 1
|
|
|
|
print(f"Unknown command: {command}")
|
|
return 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|