ltcai 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/tools.py CHANGED
@@ -21,6 +21,7 @@ from typing import Any, Callable, Dict, List, Optional
21
21
 
22
22
  _PLATFORM = platform.system() # "Darwin" | "Windows" | "Linux"
23
23
 
24
+ from latticeai.core.tool_registry import ToolRegistry
24
25
  from p_reinforce import BRAIN_DIR, STRUCTURE
25
26
 
26
27
  # ── Computer Use ──────────────────────────────────────────────────────────────
@@ -1512,13 +1513,13 @@ TOOL_HANDLERS: Dict[str, Callable[[Dict[str, Any]], Dict[str, Any]]] = {
1512
1513
  }
1513
1514
 
1514
1515
 
1516
+ DEFAULT_TOOL_REGISTRY = ToolRegistry(TOOL_HANDLERS)
1517
+
1518
+
1515
1519
  def registered_tools() -> frozenset:
1516
1520
  """Names dispatchable through ``execute_tool`` — the seam other modules verify against."""
1517
- return frozenset(TOOL_HANDLERS)
1521
+ return DEFAULT_TOOL_REGISTRY.registered_tools()
1518
1522
 
1519
1523
 
1520
1524
  def execute_tool(action: str, args: Dict[str, Any]) -> Dict[str, Any]:
1521
- handler = TOOL_HANDLERS.get(action)
1522
- if handler is None:
1523
- raise ToolError(f"Unknown action: {action}")
1524
- return handler(args)
1525
+ return DEFAULT_TOOL_REGISTRY.execute(action, args, error_cls=ToolError)