From 5580bc87cc2a73b9db0cefbcddfc5b314ab78d46 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Sat, 14 Mar 2026 09:16:47 -0600 Subject: [PATCH] fix: handle yuyar typo variant of yuyay-response tags Models occasionally misspell yuyay as yuyar since it's a made-up word. Use [yr] character class in all regexes and partial tag prefixes. --- src/mnemosyne/gateway.py | 13 ++++++++++--- src/mnemosyne/tags.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mnemosyne/gateway.py b/src/mnemosyne/gateway.py index e1a9b4d..1758fa5 100644 --- a/src/mnemosyne/gateway.py +++ b/src/mnemosyne/gateway.py @@ -72,13 +72,20 @@ import re as _re # streaming responses and executes the contained ops in real-time. # --------------------------------------------------------------------------- -_TAG_OPEN_RE = _re.compile(r"<(memory_cleanup|yuyay-response)") -_TAG_CLOSE_RE = _re.compile(r"") +_TAG_OPEN_RE = _re.compile(r"<(memory_cleanup|yuya[yr]-response)") +_TAG_CLOSE_RE = _re.compile(r"") # Matches a trailing '<' optionally followed by a prefix of a known tag name # or ' bool: diff --git a/src/mnemosyne/tags.py b/src/mnemosyne/tags.py index f38af67..3117eb2 100644 --- a/src/mnemosyne/tags.py +++ b/src/mnemosyne/tags.py @@ -166,7 +166,7 @@ def parse_cleanup_tags(text: str) -> CleanupOps: # Match ... blocks _YUYAY_RESPONSE_PATTERN = re.compile( - r"\s*(.*?)\s*", + r"\s*(.*?)\s*", re.DOTALL, )