Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(voice): strip a nested tool envelope whole, not down to its inner brace

Harald4a54879b400e
diff --git a/jarvis/brain/output_filter.py b/jarvis/brain/output_filter.py
index 1c03ece4fd..0fae80bea5 100644
--- a/jarvis/brain/output_filter.py
+++ b/jarvis/brain/output_filter.py
@@ -198,9 +198,17 @@ TOOL_CALL_FN_RE = re.compile(
TOOL_CALL_INLINE_RE = re.compile(
r"\b\w+\{\"[^\"]+\"\s*:[^}]*\}",
)
+#: A tool envelope, tolerating ONE level of nesting — ``"input": {...}`` is the
+#: normal shape, and a pattern that cannot see past the inner object stops at
+#: its closing brace and leaves a bare "}" standing in the spoken sentence
+#: ("Ich öffne Spotify. }"). One level covers every envelope this codebase
+#: emits; deeper nesting is not expressible in a regex and is out of scope for
+#: a filter that must stay regex-only (CLAUDE.md §5).
+_TOOL_JSON_INNER = r"(?:[^{}]|\{[^{}]*\})"
TOOL_JSON_RE = re.compile(
- r"\{[^{}]*\"(?:tool|action|op|command|name|args|parameters|utterance)\""
- r"\s*:\s*[^}]*\}",
+ r"\{" + _TOOL_JSON_INNER + r"*?"
+ r"\"(?:tool|action|op|command|name|args|parameters|utterance)\""
+ r"\s*:\s*" + _TOOL_JSON_INNER + r"*\}",
re.IGNORECASE,
)
# Tool name as a Python-style keyword call: ``spawn_openclaw(utterance='x', ...)``