syntaxmatrix 2.5.5__py3-none-any.whl → 2.5.5.2__py3-none-any.whl

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.
syntaxmatrix/__init__.py CHANGED
@@ -25,7 +25,7 @@ warning = _app_instance.warning
25
25
 
26
26
  set_user_icon = _app_instance.set_user_icon
27
27
  set_bot_icon = _app_instance.set_bot_icon
28
- # set_favicon = _app_instance.set_favicon
28
+ set_favicon = _app_instance.set_favicon
29
29
  set_project_name = _app_instance.set_project_name
30
30
  set_site_title = _app_instance.set_site_title
31
31
  set_site_logo = _app_instance.set_site_logo
@@ -0,0 +1,24 @@
1
+ # syntaxmatrix/agent_tools.py
2
+ from dataclasses import dataclass
3
+ from typing import Callable, Optional, Dict, Any, List, Literal
4
+
5
+ Phase = Literal["sanitize_early", "domain_patches", "syntax_fixes", "final_repair"]
6
+
7
+ @dataclass
8
+ class CodeTool:
9
+ name: str
10
+ phase: Phase
11
+ fn: Callable[[str, Dict[str, Any]], str]
12
+ when: Optional[Callable[[str, Dict[str, Any]], bool]] = None
13
+ priority: int = 100 # lower runs earlier within the phase
14
+
15
+ class ToolRunner:
16
+ def __init__(self, tools: List[CodeTool]):
17
+ # stable order: phase → priority → name
18
+ self.tools = sorted(tools, key=lambda t: (t.phase, t.priority, t.name))
19
+
20
+ def run(self, code: str, ctx: Dict[str, Any]) -> str:
21
+ for t in self.tools:
22
+ if t.when is None or t.when(code, ctx):
23
+ code = t.fn(code, ctx)
24
+ return code