-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathdebug_content_engine.py
More file actions
34 lines (29 loc) · 1.2 KB
/
Copy pathdebug_content_engine.py
File metadata and controls
34 lines (29 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import sys, json, os
from pathlib import Path
ROOT = Path('.').resolve()
sys.path.insert(0, str(ROOT))
from compiler_v2 import AICodeCompiler
from runtime.engine import RuntimeEngine, run_with_debug
from adapters.openclaw_integration import openclaw_monitor_registry
from adapters.openclaw_memory import OpenClawMemoryAdapter
from adapters.github import GitHubAdapter
from adapters.crm import CrmAdapter
from openclaw.bridge.run_wrapper_ainl import compile_source_cached, BridgeTokenBudgetAdapter, _BRIDGE_DIR, build_wrapper_registry
# Load the IR with trace
path = ROOT / "scripts" / "wrappers" / "content-engine.ainl"
def _compile(src_text):
return AICodeCompiler(strict_mode=False, strict_reachability=False).compile(src_text, emit_graph=True)
ir = compile_source_cached(path, _compile)
if ir.get("errors"):
print("Compile errors:", ir["errors"])
sys.exit(1)
# Build adapters
reg = build_wrapper_registry()
frame = {
"crm_health_url": "http://localhost:3000/health",
"dry_run": True,
}
# Run with debug to get trace
result = run_with_debug(RuntimeEngine(ir, adapters=reg, trace=True, execution_mode="graph-preferred"), "0", frame)
print(json.dumps(result, indent=2, default=str))