Spaces:
Running
Running
deploy: auto — frontend v84 + backend — 2026-08-23 13:12 UTC
#61
by Baida07 - opened
- agents/unified_loop.py +1 -1
- agents/unified_loop_helpers.py +13 -1
- api/browser.py +7 -7
agents/unified_loop.py
CHANGED
|
@@ -3038,7 +3038,7 @@ class UnifiedAgentLoop(DirectToolsMixin, PromptBuilderMixin, LLMSelectionMixin,
|
|
| 3038 |
except Exception:
|
| 3039 |
pass
|
| 3040 |
# S455-P10: task supervisionato — done_callback logga eccezioni silenziate
|
| 3041 |
-
asyncio.create_task(_reverify_task())
|
| 3042 |
_rv_t.add_done_callback(
|
| 3043 |
lambda t: t.exception() if not t.cancelled() and not t.exception() is None else None
|
| 3044 |
)
|
|
|
|
| 3038 |
except Exception:
|
| 3039 |
pass
|
| 3040 |
# S455-P10: task supervisionato — done_callback logga eccezioni silenziate
|
| 3041 |
+
_rv_t = asyncio.create_task(_reverify_task())
|
| 3042 |
_rv_t.add_done_callback(
|
| 3043 |
lambda t: t.exception() if not t.cancelled() and not t.exception() is None else None
|
| 3044 |
)
|
agents/unified_loop_helpers.py
CHANGED
|
@@ -27,7 +27,19 @@ import logging
|
|
| 27 |
_logger = logging.getLogger("agents.unified_loop_helpers")
|
| 28 |
|
| 29 |
# Import tipi condivisi — zero circular (unified_loop_types ha solo stdlib)
|
| 30 |
-
from agents.unified_loop_types import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
class HelpersMixin:
|
|
|
|
| 27 |
_logger = logging.getLogger("agents.unified_loop_helpers")
|
| 28 |
|
| 29 |
# Import tipi condivisi — zero circular (unified_loop_types ha solo stdlib)
|
| 30 |
+
from agents.unified_loop_types import (
|
| 31 |
+
StepCallback,
|
| 32 |
+
UnifiedLoopState,
|
| 33 |
+
_LANG_INSTRUCTIONS,
|
| 34 |
+
_detect_user_lang,
|
| 35 |
+
_maybe_await,
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def _get_classifier():
|
| 40 |
+
"""Load the error classifier lazily, avoiding import cycles."""
|
| 41 |
+
from agents.error_classifier import classify_error, format_for_context
|
| 42 |
+
return classify_error, format_for_context
|
| 43 |
|
| 44 |
|
| 45 |
class HelpersMixin:
|
api/browser.py
CHANGED
|
@@ -260,16 +260,16 @@ def _trim_ax_tree(node: dict, depth: int) -> dict:
|
|
| 260 |
Mantiene: role, name, description, value, checked, expanded, required.
|
| 261 |
Scarta: proprietà interne Playwright (nodeId, backendDOMNodeId, ignoredReasons).
|
| 262 |
"""
|
| 263 |
-
KEEP = frozenset({role, name, description, value, checked,
|
| 264 |
-
expanded, required, haspopup, level, pressed,
|
| 265 |
-
selected, multiselectable, orientation})
|
| 266 |
result: dict = {k: v for k, v in node.items() if k in KEEP and v not in (None, False, )}
|
| 267 |
-
if depth > 0 and node.get(children):
|
| 268 |
-
trimmed = [_trim_ax_tree(c, depth - 1) for c in node[children]]
|
| 269 |
# Filtra nodi completamente vuoti (solo role senza nome né figli)
|
| 270 |
-
trimmed = [c for c in trimmed if len(c) > 1 or c.get(children)]
|
| 271 |
if trimmed:
|
| 272 |
-
result[children] = trimmed
|
| 273 |
return result
|
| 274 |
|
| 275 |
|
|
|
|
| 260 |
Mantiene: role, name, description, value, checked, expanded, required.
|
| 261 |
Scarta: proprietà interne Playwright (nodeId, backendDOMNodeId, ignoredReasons).
|
| 262 |
"""
|
| 263 |
+
KEEP = frozenset({"role", "name", "description", "value", "checked",
|
| 264 |
+
"expanded", "required", "haspopup", "level", "pressed",
|
| 265 |
+
"selected", "multiselectable", "orientation"})
|
| 266 |
result: dict = {k: v for k, v in node.items() if k in KEEP and v not in (None, False, )}
|
| 267 |
+
if depth > 0 and node.get("children"):
|
| 268 |
+
trimmed = [_trim_ax_tree(c, depth - 1) for c in node["children"]]
|
| 269 |
# Filtra nodi completamente vuoti (solo role senza nome né figli)
|
| 270 |
+
trimmed = [c for c in trimmed if len(c) > 1 or c.get("children")]
|
| 271 |
if trimmed:
|
| 272 |
+
result["children"] = trimmed
|
| 273 |
return result
|
| 274 |
|
| 275 |
|