@melaya/runner 1.1.81 → 1.1.82
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/dist/assistantHost.py +25 -2
- package/package.json +1 -1
package/dist/assistantHost.py
CHANGED
|
@@ -850,9 +850,32 @@ def _excom_response_text(resp) -> str:
|
|
|
850
850
|
return ""
|
|
851
851
|
|
|
852
852
|
|
|
853
|
+
# Python connector tools answer an error as plain text ("No Obsidian vault is
|
|
854
|
+
# selected", "Google is not authorized. Reconnect ...", "Vault error (...)",
|
|
855
|
+
# "[timeout] ..."): the gate must report those as failed, never as done
|
|
856
|
+
# (mirrors server/src/services/agents/toolStatus.ts).
|
|
857
|
+
_EXCOM_FAIL_PREFIXES = ("error", "could not", "couldn't", "failed", "functionnotfounderror", "tool error",
|
|
858
|
+
"vault error", "[timeout]", "[error]", "http error", "cannot ", "unable to",
|
|
859
|
+
"no obsidian vault", "traceback (most recent call last)")
|
|
860
|
+
_EXCOM_AUTH_GAP_RE = None
|
|
861
|
+
_EXCOM_HTTP_ERR_RE = None
|
|
862
|
+
|
|
863
|
+
|
|
853
864
|
def _excom_looks_failed(text: str) -> bool:
|
|
854
|
-
|
|
855
|
-
|
|
865
|
+
global _EXCOM_AUTH_GAP_RE, _EXCOM_HTTP_ERR_RE
|
|
866
|
+
import re as _re
|
|
867
|
+
if _EXCOM_AUTH_GAP_RE is None:
|
|
868
|
+
_EXCOM_AUTH_GAP_RE = _re.compile(
|
|
869
|
+
r"\b(is|are) not (authori[sz]ed|connected)\b|\bnot authori[sz]ed\b|\bauthori[sz]ation (failed|expired|required)\b"
|
|
870
|
+
r"|\b(access|refresh) token (is )?(missing|expired|revoked)\b|\bno (access|refresh) token\b"
|
|
871
|
+
r"|\bmissing credentials?\b|\breconnect (the|your|it)\b")
|
|
872
|
+
_EXCOM_HTTP_ERR_RE = _re.compile(r"^http [45]\d\d\b")
|
|
873
|
+
raw = (text or "").lstrip().lower()
|
|
874
|
+
head = raw[:160]
|
|
875
|
+
if head.startswith(_EXCOM_FAIL_PREFIXES) or _EXCOM_HTTP_ERR_RE.match(head):
|
|
876
|
+
return True
|
|
877
|
+
# A structured payload (JSON) that merely mentions it is not an error.
|
|
878
|
+
return len(raw) <= 600 and not raw.startswith(("{", "[")) and bool(_EXCOM_AUTH_GAP_RE.search(head))
|
|
856
879
|
|
|
857
880
|
|
|
858
881
|
async def _excom_gate_middleware(kwargs, next_handler):
|