-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathrun_openspace_test.py
More file actions
62 lines (51 loc) · 2.03 KB
/
Copy pathrun_openspace_test.py
File metadata and controls
62 lines (51 loc) · 2.03 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
"""Local dev harness: run `demo/test_openspace_mcp.ainl` with the OpenClaw adapter registry."""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
sys.path.insert(0, str(ROOT))
from adapters.openclaw_integration import openclaw_monitor_registry # noqa: E402
from runtime.engine import RuntimeEngine # noqa: E402
DEMO = ROOT / "demo" / "test_openspace_mcp.ainl"
def main() -> None:
source = DEMO.read_text(encoding="utf-8")
print("🔌 Loading OpenClaw adapter registry...")
reg = openclaw_monitor_registry()
print(f" Adapters: {list(reg._adapters.keys())}")
print("\n🚀 Building engine...")
engine = RuntimeEngine.from_code(
code=source,
adapters=reg,
source_path=str(DEMO),
strict=False,
)
print(f"✅ Engine built. Default entry: {engine.default_entry_label()}")
print("\n▶️ Running...")
try:
result = engine.run_label(engine.default_entry_label())
print(f"\n✅ Result: {result}")
except Exception as e:
print(f"❌ Error: {e}")
import traceback
traceback.print_exc()
print("\nAdapter registry contents:")
if engine.adapters:
print(f" Type: {type(engine.adapters)}")
print(f" Registered adapters: {list(engine.adapters.keys())}")
print(f" Adapter 'mcp' in registry: {hasattr(engine.adapters, 'mcp')}")
print(f" Adapter lookup for 'mcp': {getattr(engine.adapters, 'mcp', None)}")
try:
mcp_adapter = engine.adapters.get("mcp")
print(f" mcp_adapter type: {type(mcp_adapter)}")
if mcp_adapter:
print(
f" mcp_adapter methods: {[m for m in dir(mcp_adapter) if not m.startswith('_')]}"
)
except Exception:
pass
else:
print(" No adapter registry available")
sys.exit(1)
if __name__ == "__main__":
main()