The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge branch 'main' into feat/hermes-relay-tool-metrics
Jeffrey Quesnelledaf67f2e5991
diff --cc tests/hermes_cli/test_relay_shared_metrics_runtime.pyindex 3e8526b3d7b,ec5f4e3c7f4..3dabef54493--- a/tests/hermes_cli/test_relay_shared_metrics_runtime.py+++ b/tests/hermes_cli/test_relay_shared_metrics_runtime.py@@@ -30,13 -30,11 +30,14 @@@ class _Relayself.events: list[tuple[Any, ...]] = []self._callbacks: dict[str, Any] = {}self._starts: dict[Any, dict[str, Any]] = {}+ self._tool_starts: dict[Any, dict[str, Any]] = {}self._scope_starts: dict[Any, dict[str, Any]] = {}self._scope = contextvars.ContextVar("relay_scope", default=None)+ self._scope_stack = contextvars.ContextVar("relay_scope_stack", default=None)self._scope_serial = 0- self.ScopeType = SimpleNamespace(Agent="agent", Function="function")+ self.ScopeType = SimpleNamespace(+ Agent="agent", Function="function", Tool="tool"+ )self.LLMRequest = _Requestself.scope = SimpleNamespace(push=self._scope_push,@@@ -93,20 -102,11 +106,22 @@@def _scope_event(self, name: str, **kwargs: Any) -> None:self.events.append(("scope.event", name, kwargs))+ event = SimpleNamespace(+ kind="mark",+ category=None,+ name=name,+ scope_category=None,+ category_profile=None,+ metadata=kwargs.get("metadata"),+ data=kwargs.get("data"),+ )+ for callback in list(self._callbacks.values()):+ callback(event)def _get_scope_stack(self) -> Any:- current = self._scope.get()+ stack = self._scope_stack.get()+ current = stack[-1] if stack else None+ self._scope.set(current)self.events.append(("scope.sync", current))return currentdiff --cc tools/approval.pyindex 8ebc47a4621,151e5340655..f5e7f0beb15--- a/tools/approval.py+++ b/tools/approval.py@@@ -3110,28 -3170,24 +3170,43 @@@ def _run_approval_gate),}+ _fire_approval_hook(+ "pre_approval_request",+ command=display_target,+ description=description,+ pattern_key=pattern_key,+ pattern_keys=[pattern_key],+ session_key=session_key,+ surface="cli",+ )choice = prompt_dangerous_approval(display_target, description,approval_callback=approval_callback)+ _fire_approval_hook(+ "post_approval_response",+ command=display_target,+ description=description,+ pattern_key=pattern_key,+ pattern_keys=[pattern_key],+ session_key=session_key,+ surface="cli",+ choice=choice,+ )+ if choice == "timeout":+ return {+ "approved": False,+ "message": (+ f"BLOCKED: Action timed out without user response. The user "+ f"has NOT consented to this action. Do NOT retry it, do NOT "+ f"rephrase it, and do NOT attempt the same outcome via a "+ f"different path. Silence is not consent."+ ),+ "pattern_key": pattern_key,+ "description": description,+ "outcome": "timeout",+ "user_consent": False,+ }+if choice == "deny":return {"approved": False,