Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: run and hide MiniMax-M2 tool calls that llama-server leaves in content (#16103)
Daniel Hanbc66d7998f7b
diff --git a/studio/backend/core/inference/chat_template_helpers.py b/studio/backend/core/inference/chat_template_helpers.pyindex ee6252119c6..3e48475a976 100644--- a/studio/backend/core/inference/chat_template_helpers.py+++ b/studio/backend/core/inference/chat_template_helpers.py@@ -106,7 +106,7 @@ _CONTROL_MARKUP = re.compile(# Bare-tag families. <s> and </s> (Llama-2 BOS/EOS) collide with HTML; kept, since a live document boundary beats a space in a rare <s>.r"|/?(?:(?:start|end)_of_turn|tool_(?:call|response)|tools|think|eos|bos|s|sop"r"|start_of_image|image_soft_token|audio_soft_token"- r"|arg_key|arg_value|function|parameter|param)>"+ r"|arg_key|arg_value|function|parameter|param|minimax:tool_call)>"# Opener halves carry "=value", so the attribute form needs its own alternative beside function=r"|(?:function|parameter)=|(?:function|param(?:eter)?)\s+name=\""r"|(?:tool(?:_call|_response)?|channel|turn)\|>"diff --git a/studio/backend/core/inference/tool_call_parser.py b/studio/backend/core/inference/tool_call_parser.pyindex f004d6e7f8f..a2e6c17b645 100644--- a/studio/backend/core/inference/tool_call_parser.py+++ b/studio/backend/core/inference/tool_call_parser.py@@ -41,6 +41,7 @@ TOOL_XML_SIGNALS = ("<|tool_calls_section_begin|>","<|tool_call_begin|>","<|content_invoke_tool_json|>",+ "<minimax:tool_call>",)@@ -378,6 +379,12 @@ _KIMI_ARG_BEGIN = "<|tool_call_argument_begin|>"_KIMI_CALL_END = "<|tool_call_end|>"_KIMI_ID_RE = re.compile(r"^(?:functions\.)?([\w\.\-]+)(?::(\d+))?$")+# MiniMax-M2 / M2.1: ``<minimax:tool_call><invoke name="NAME"><parameter name="KEY">VALUE</parameter></invoke></minimax:tool_call>``.+_MINIMAX_BLOCK_OPEN = "<minimax:tool_call>"+_MINIMAX_BLOCK_CLOSE = "</minimax:tool_call>"+_MINIMAX_INVOKE_OPEN_RE = re.compile(r'<invoke\s+name="([\w\.\-]+)">')+_MINIMAX_INVOKE_CLOSE = "</invoke>"+# Gemma 4: ``<|tool_call>call:NAME{...}<tool_call|>``, ``<|"|>`` wraps strings._GEMMA_TC_RE = re.compile(r"<\|tool_call>\s*call\s*:\s*([\w\.\-]+)\s*\{")_GEMMA_STR_BEGIN = '<|"|>'@@ -798,6 +805,7 @@ _CONTAINING_WRAPPERS = ("<function=",'<function name="',"[TOOL_CALLS]",+ "<minimax:tool_call>",) + _INFERENCE_WRAPPER_OPENERS@@ -1302,6 +1310,21 @@ def _strip_glm_calls(text: str, *, final: bool) -> str:return "".join(out)+def _strip_minimax_calls(text: str, *, final: bool) -> str:+ """Strip ``<minimax:tool_call>`` blocks at the close the parser uses; ``final`` drops a trailing unclosed block."""+ if _MINIMAX_BLOCK_OPEN not in text:+ return text+ out: list[str] = []+ pos = 0+ for start, end, closed in _minimax_block_spans(text):+ if not (closed or final):+ break+ out.append(text[pos:start])+ pos = end+ out.append(text[pos:])+ return "".join(out)++def strip_segment(segment: str,*,@@ -1310,6 +1333,7 @@ def strip_segment() -> str:"""Strips markup from one non-think segment; seg_final enables end-of-turn arms. routes/inference.py differs, pinned by tests/test_route_strip_drift.py."""seg = _strip_mistral_closed_calls(segment)+ seg = _strip_minimax_calls(seg, final = seg_final)# Name-gated: an inactive ``foo[ARGS]{..}`` is prose and is kept.seg = _tool_healing._strip_bracket_tag_calls(seg, enabled_tool_names = enabled_tool_names)if seg_final:@@ -1404,6 +1428,7 @@ _STRIP_SENTINELS = ("[ARGS]", # reasoning-model rehearsal"<|python_tag|>", # Llama-3 built-in tools"<|content_invoke_tool_json|>",+ "<minimax:tool_call>","<|", # DeepSeek's full-width pipe opens every one of its markers"<think", # reasoning segmentation"</think",@@ -1426,6 +1451,7 @@ _OPEN_CALL_TRIGGERS = ("<function","[TOOL_CALLS]","[ARGS]",+ "<minimax:tool_call>","<|","<think","</think",@@ -1886,7 +1912,13 @@ def has_tool_signal(text: str) -> bool:# A Qwen/Hermes envelope whose args carry DeepSeek/Kimi markers must parse as the outer call._EMBEDDED_MARKER_RE = re.compile(- _DEEPSEEK_OPEN_RE_SRC + "|" + re.escape(_KIMI_SECTION_BEGIN) + "|" + re.escape(_KIMI_CALL_BEGIN)+ _DEEPSEEK_OPEN_RE_SRC+ + "|"+ + re.escape(_KIMI_SECTION_BEGIN)+ + "|"+ + re.escape(_KIMI_CALL_BEGIN)+ + "|"+ + re.escape(_MINIMAX_BLOCK_OPEN))# The lookahead mirrors the ``_TOOL_ALL_PATS`` python_tag arm so a prose mention is not one._OUTER_ENVELOPE_OPEN_RE = re.compile(@@ -2275,9 +2307,11 @@ def parse_tool_calls_from_text(_km_section = content.find(_KIMI_SECTION_BEGIN)_km_bare = content.find(_KIMI_CALL_BEGIN)_km_pos = min(p for p in (_km_section, _km_bare, len(content)) if p >= 0)+ _mm_pos = content.find(_MINIMAX_BLOCK_OPEN)pre_pass = [(_ds_pos, _parse_deepseek_tool_calls),(_km_pos, _parse_kimi_tool_calls),+ (_mm_pos if _mm_pos >= 0 else len(content), _parse_minimax_tool_calls),]pre_pass.sort(key = lambda pair: pair[0])for _pos, parser in pre_pass:@@ -4322,3 +4356,128 @@ def _parse_kimi_section_body(# Seeking <|tool_call_end|> could skip the next call when this one's marker is missing.pos = brace_end + 1return out+++class _MinimaxValueIndex:+ """Whether a tag sits inside an unclosed ``<parameter>`` value (argument text, not markup), O(log n) per query."""++ __slots__ = ("_param_starts", "_param_ends", "_param_closers", "_func_closers")++ def __init__(self, text: str):+ starts: list[int] = []+ ends: list[int] = []+ for m in _TC_PARAM_START_RE.finditer(text):+ starts.append(m.start())+ # Bounded at the tag's own ">", as the helper's endpos-limited match is.+ ends.append(text.index(">", m.start()) + 1)+ self._param_starts = starts+ self._param_ends = ends+ self._param_closers = self._positions(text, ("</parameter>", "</param>"))+ self._func_closers = self._positions(text, (_MINIMAX_INVOKE_CLOSE, _MINIMAX_BLOCK_CLOSE))++ @staticmethod+ def _positions(text: str, tags) -> list[int]:+ found: list[int] = []+ for tag in tags:+ at = text.find(tag)+ while at >= 0:+ found.append(at)+ at = text.find(tag, at + len(tag))+ return sorted(found)++ @staticmethod+ def _any_in(positions: list[int], lo: int, hi: int) -> bool:+ i = bisect.bisect_left(positions, lo)+ return i < len(positions) and positions[i] <= hi++ def inside(self, pos: int) -> bool:+ idx = bisect.bisect_right(self._param_ends, pos) - 1+ if idx < 0:+ return False+ last = self._param_starts[idx]+ if self._any_in(self._param_closers, last, pos):+ return False+ if self._param_closers and self._param_closers[-1] >= pos + 1:+ return True+ return not self._any_in(self._func_closers, last, pos)+++def _minimax_block_spans(text: str) -> list[tuple[int, int, bool]]:+ """``(start, end, closed)`` per ``<minimax:tool_call>`` block; an unclosed block runs to the end of the text."""+ spans: list[tuple[int, int, bool]] = []+ if _MINIMAX_BLOCK_OPEN not in text:+ return spans+ inside = _MinimaxValueIndex(text).inside+ pos = 0+ while True:+ start = text.find(_MINIMAX_BLOCK_OPEN, pos)+ if start < 0:+ return spans+ if inside(start):+ pos = start + len(_MINIMAX_BLOCK_OPEN)+ continue+ close = text.find(_MINIMAX_BLOCK_CLOSE, start + len(_MINIMAX_BLOCK_OPEN))+ while close >= 0 and inside(close):+ close = text.find(_MINIMAX_BLOCK_CLOSE, close + 1)+ if close < 0:+ spans.append((start, len(text), False))+ return spans+ pos = close + len(_MINIMAX_BLOCK_CLOSE)+ spans.append((start, pos, True))+++def _parse_minimax_tool_calls(+ content: str,+ *,+ id_offset: int,+ allow_incomplete: bool = True,+) -> list[dict]:+ """Values stay strings as in the ``<function=...>`` form; the tool loop coerces them by schema. A block inside+ reasoning (a ``<think>`` span, or before a stray ``</think>`` the template opened) is a rehearsal and is skipped."""+ out: list[dict] = []+ if _MINIMAX_BLOCK_OPEN not in content:+ return out+ # Tool-aware, so a think tag in another block's arguments neither hides nor opens reasoning.+ think_spans = _merge_spans(_tool_healing._think_spans_outside_tool_markup(content))+ think_starts = [s for s, _ in think_spans]+ inside = _MinimaxValueIndex(content).inside+ for start, end, closed in _minimax_block_spans(content):+ think_idx = bisect.bisect_right(think_starts, start) - 1+ if think_idx >= 0 and start < think_spans[think_idx][1]:+ continue+ body_end = end - len(_MINIMAX_BLOCK_CLOSE) if closed else end+ invokes = [+ m+ for m in _MINIMAX_INVOKE_OPEN_RE.finditer(content, start, body_end)+ if not inside(m.start())+ ]+ for idx, im in enumerate(invokes):+ next_invoke = invokes[idx + 1].start() if idx + 1 < len(invokes) else body_end+ close = content.find(_MINIMAX_INVOKE_CLOSE, im.end(), next_invoke)+ while close >= 0 and inside(close):+ close = content.find(_MINIMAX_INVOKE_CLOSE, close + 1, next_invoke)+ if close < 0 and not allow_incomplete:+ continue+ body = content[im.end() : close if close >= 0 else next_invoke]+ args: dict = {}+ param_unclosed = False+ body_inside = _MinimaxValueIndex(body).inside+ params = [pm for pm in _TC_PARAM_START_RE.finditer(body) if not body_inside(pm.start())]+ for pidx, pm in enumerate(params):+ next_param = params[pidx + 1].start() if pidx + 1 < len(params) else len(body)+ raw_val = body[pm.end() : next_param]+ param_closed = raw_val.rstrip().endswith(("</parameter>", "</param>"))+ if not param_closed:+ param_unclosed = True+ val = _TC_PARAM_CLOSE_RE.sub("", raw_val) if param_closed else raw_val+ args[pm.group(1) or pm.group(2)] = _trim_param_value(val)+ if param_unclosed and not allow_incomplete:+ continue+ out.append(+ {+ "id": f"call_{id_offset + len(out)}",+ "type": "function",+ "function": {"name": im.group(1), "arguments": json.dumps(args)},+ }+ )+ return outdiff --git a/studio/backend/core/tool_healing.py b/studio/backend/core/tool_healing.pyindex 003d01ef4df..e83eba92b02 100644--- a/studio/backend/core/tool_healing.py+++ b/studio/backend/core/tool_healing.py@@ -253,12 +253,14 @@ _TOOL_TAG_PREFIXES = ("</param","<arg_","</arg_",+ "<minimax:",+ "</minimax:","<|","<|","[",)_TOOL_TAG_HINT_RE = re.compile(- r"</?(?:tool|function|param|arg_)|<[||]|\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\]"+ r"</?(?:tool|function|param|arg_|minimax:)|<[||]|\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\]")@@ -1341,6 +1343,10 @@ def _tool_call_markup_spans(text: str) -> list[tuple[int, int]]:continuespans.extend(m.span() for m in pat.finditer(text, 0, scan_end))spans.extend((start, end) for start, end, _kind, _m in _iter_bracket_spans(text))+ if "<minimax:tool_call>" in text:+ # Parameter-aware block bounds, so a quoted closer cannot end the span; lazy, as that module imports this one.+ from core.inference.tool_call_parser import _minimax_block_spans+ spans.extend((start, end) for start, end, _closed in _minimax_block_spans(text))# An unclosed opener is a real incomplete call only outside closed/bracket spans.for pat in _TOOL_OPEN_XML_TAIL_PATS:for m in pat.finditer(text):@@ -1371,7 +1377,20 @@ def _think_spans_outside_tool_markup(text: str) -> list[tuple[int, int]]:return think_spansif not call_spans:return think_spans- return [(s, e) for (s, e) in think_spans if not any(cs <= s < ce for cs, ce in call_spans)]+ # Merged and bisected: a pairwise scan is quadratic on long output.+ merged: list[list[int]] = []+ for cs, ce in sorted(call_spans):+ if merged and cs <= merged[-1][1]:+ merged[-1][1] = max(merged[-1][1], ce)+ else:+ merged.append([cs, ce])+ starts = [cs for cs, _ in merged]+ kept = []+ for s, e in think_spans:+ i = bisect.bisect_right(starts, s) - 1+ if i < 0 or s >= merged[i][1]:+ kept.append((s, e))+ return keptdef strip_outside_think(text: str, strip_segment) -> str:diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.pyindex 189d1ae9479..1d9fea30ff5 100644--- a/studio/backend/routes/inference.py+++ b/studio/backend/routes/inference.py@@ -3660,6 +3660,7 @@ from core.inference.tool_call_parser import (_strip_function_xml_calls,_strip_gemma_wrapperless_calls,_strip_glm_calls,+ _strip_minimax_calls,_strip_mistral_closed_calls,)from core.inference.tool_call_parser import TOOL_XML_SIGNALS as _PARSER_TOOL_SIGNALS@@ -6623,6 +6624,8 @@ def _strip_tool_xml_for_display(def _strip_segment(seg: str, is_last: bool) -> str:# Strips close at each call's real terminator, so a quoted </function> cannot truncate them.seg = _strip_mistral_closed_calls(seg)+ # llama-server leaves MiniMax blocks in content when tool_choice is "none".+ seg = _strip_minimax_calls(seg, final = is_last)seg = _strip_bracket_tag_calls(seg, enabled_tool_names = enabled_tool_names)if is_last:seg = _strip_gemma_wrapperless_calls(seg, enabled_tool_names)@@ -6646,6 +6649,7 @@ def _strip_tool_xml_for_display(# Every literal some arm of ``_strip_tool_xml_for_display`` needs before it can edit text. Markerless Gemma has# none and is caught by ``_DISPLAY_GEMMA_CALL_RE``, a superset of ``_GEMMA_BARE_TC_RE``._DISPLAY_STRIP_SENTINELS = (+ "<minimax:tool_call>","<tool_call","</tool_call","<|tool_call",diff --git a/studio/backend/tests/data/refactor_guard/ast_inventory.json b/studio/backend/tests/data/refactor_guard/ast_inventory.jsonindex af9566ab000..7a6017d06c4 100644--- a/studio/backend/tests/data/refactor_guard/ast_inventory.json+++ b/studio/backend/tests/data/refactor_guard/ast_inventory.json@@ -1102,15 +1102,15 @@},"core.inference.tool_call_parser": {"compiled": {- "INTENT_SIGNAL": "\"(?im)(\\\\b(i['\\\\u2019](ll|m going to|m gonna)|i am (going to|gonna)|i will|i shall)\\\\b(?!\\\\s+(?:not|never)\\\\b)(?!\\\\s+(?:do(?:ing)?\\\\s+my\\\\s+best|try\\\\s+my\\\\s+best|be\\\\s+(?:able|happy|glad)\\\\s+to\\\\b|assist\\\\b|help\\\\s+you\\\\b(?!\\\\s+(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render))|give\\\\s+you\\\\s+accurate\\\\b|(?:dig\\\\s+in|help\\\\s+analy[sz]e)\\\\b(?=[^\\\\w]*\\\\Z)))|\\\\b(?:let me|allow me)\\\\b(?!\\\\s+(?:not|never|know)\\\\b)(?!\\\\s+(?:dig\\\\s+in|help\\\\s+analy[sz]e)\\\\b(?=[^\\\\w]*\\\\Z))(?!\\\\s+to\\\\s+(?:do(?:ing)?\\\\s+my\\\\s+best|try\\\\s+my\\\\s+best|be\\\\s+(?:able|happy|glad)\\\\s+to\\\\b|assist\\\\b|help\\\\s+you\\\\b(?!\\\\s+(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render))|give\\\\s+you\\\\s+accurate\\\\b|(?:dig\\\\s+in|help\\\\s+analy[sz]e)\\\\b(?=[^\\\\w]*\\\\Z)))|(?:^|[.!?]\\\\s+)\\\\s*(?:the\\\\s+)?first\\\\s+step\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:\u2013\u2014-]?\\\\s+(?:my|our)\\\\s+(?:plan|approach|step)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:\u2013\u2014-]?\\\\s+(?:i|we|let['\u2019]?s|let us)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:\u2013\u2014-]?\\\\s+(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render)\\\\b|\\\\bstep \\\\d+[ \\\\t*_]*(?::[ \\\\t*_\\\\r]*$|(?:[:,.)\\\\u2013\\\\u2014-][ \\\\t*_]*)?(?:\\\\r?\\\\n(?:[ \\\\t]*\\\\r?\\\\n)?[ \\\\t*_#>-]*(?:\\\\d+[.)][ \\\\t*_]*)?)?(?:(?:let['\u2019]?s|let us)\\\\b|(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render)\\\\b))|\\\\bhere['\\\\u2019]?s (?:my |the |a )?(?:plan|approach)|\\\\b(?:now i|next i)\\\\b)\" flags=42",+ "INTENT_SIGNAL": "\"(?im)(\\\\b(i['\\\\u2019](ll|m going to|m gonna)|i am (going to|gonna)|i will|i shall)\\\\b(?!\\\\s+(?:not|never)\\\\b)(?!\\\\s+(?:do(?:ing)?\\\\s+my\\\\s+best|try\\\\s+my\\\\s+best|be\\\\s+(?:able|happy|glad)\\\\s+to\\\\b|assist\\\\b|help\\\\s+you\\\\b(?!\\\\s+(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render))|give\\\\s+you\\\\s+accurate\\\\b|(?:dig\\\\s+in|help\\\\s+analy[sz]e)\\\\b(?=[^\\\\w]*\\\\Z)))|\\\\b(?:let me|allow me)\\\\b(?!\\\\s+(?:not|never|know)\\\\b)(?!\\\\s+(?:dig\\\\s+in|help\\\\s+analy[sz]e)\\\\b(?=[^\\\\w]*\\\\Z))(?!\\\\s+to\\\\s+(?:do(?:ing)?\\\\s+my\\\\s+best|try\\\\s+my\\\\s+best|be\\\\s+(?:able|happy|glad)\\\\s+to\\\\b|assist\\\\b|help\\\\s+you\\\\b(?!\\\\s+(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render))|give\\\\s+you\\\\s+accurate\\\\b|(?:dig\\\\s+in|help\\\\s+analy[sz]e)\\\\b(?=[^\\\\w]*\\\\Z)))|(?:^|[.!?]\\\\s+)\\\\s*(?:the\\\\s+)?first\\\\s+step\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:–—-]?\\\\s+(?:my|our)\\\\s+(?:plan|approach|step)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:–—-]?\\\\s+(?:i|we|let['’]?s|let us)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:–—-]?\\\\s+(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render)\\\\b|\\\\bstep \\\\d+[ \\\\t*_]*(?::[ \\\\t*_\\\\r]*$|(?:[:,.)\\\\u2013\\\\u2014-][ \\\\t*_]*)?(?:\\\\r?\\\\n(?:[ \\\\t]*\\\\r?\\\\n)?[ \\\\t*_#>-]*(?:\\\\d+[.)][ \\\\t*_]*)?)?(?:(?:let['’]?s|let us)\\\\b|(?:search|check|look|find|fetch|get|call|use|run|query|invoke|analy[sz]e|review|inspect|read|gather|examine|retrieve|browse|consult|verify|confirm|compute|calculate|determine|identify|render)\\\\b))|\\\\bhere['\\\\u2019]?s (?:my |the |a )?(?:plan|approach)|\\\\b(?:now i|next i)\\\\b)\" flags=42","_ATTR_FUNC_OPEN_RE": "'<function\\\\s+name=\"' flags=32","_BACKTICK_RUN_RE": "'`+' flags=32","_BARE_JSON_NAME_RE": "'\"name\"\\\\s*:\\\\s*\"([^\"]+)\"' flags=32","_BLOCKED_BODY_MASK_RUN_RE": "'\\ue000+' flags=32",- "_DEEPSEEK_BEGIN_RE": "'<\uff5c(?:tool\u2581calls\u2581begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool\u2581calls)\uff5c>' flags=32",+ "_DEEPSEEK_BEGIN_RE": "'<|(?:tool▁calls▁begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool▁calls)|>' flags=32","_DEEPSEEK_GLUE_GAP_STOP_RE": "'[`<>\\\\[\\\\]{}]' flags=32",- "_DEEPSEEK_R1_CLOSE_RE": "'```[\\\\s\\\\r\\\\n]*<\uff5ctool\u2581call\u2581end\uff5c>' flags=32",- "_EMBEDDED_MARKER_RE": "'<\uff5c(?:tool\u2581calls\u2581begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool\u2581calls)\uff5c>|<\\\\|tool_calls_section_begin\\\\|>|<\\\\|tool_call_begin\\\\|>' flags=32",+ "_DEEPSEEK_R1_CLOSE_RE": "'```[\\\\s\\\\r\\\\n]*<|tool▁call▁end|>' flags=32",+ "_EMBEDDED_MARKER_RE": "'<|(?:tool▁calls▁begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool▁calls)|>|<\\\\|tool_calls_section_begin\\\\|>|<\\\\|tool_call_begin\\\\|>|<minimax:tool_call>' flags=32","_FENCE_ONLY_RE": "'[\\\\w.\\\\-]*[ \\\\t]*\\\\n?[ \\\\t]*`{3,}[a-zA-Z0-9_+-]*' flags=32","_FUNC_CLOSE_TAG_RE": "'</function>' flags=32","_GEMMA_BARE_TC_PREFIX_RE": "'(?<!\\\\w)call\\\\s*(?::\\\\s*[\\\\w\\\\.\\\\-]*)?$' flags=32",@@ -1131,6 +1131,7 @@"_LLAMA3_PY_CALL_HEAD_RE": "'\\\\s*([\\\\w\\\\.\\\\-]+)\\\\s*\\\\.\\\\s*call\\\\s*\\\\(' flags=32","_LLAMA3_PY_CALL_RE": "'<\\\\|python_tag\\\\|>\\\\s*([\\\\w\\\\.\\\\-]+)\\\\s*\\\\.\\\\s*call\\\\s*\\\\(' flags=32","_LLAMA3_WS_RE": "'\\\\s*' flags=32",+ "_MINIMAX_INVOKE_OPEN_RE": "'<invoke\\\\s+name=\"([\\\\w\\\\.\\\\-]+)\">' flags=32","_MISTRAL_V11_NAME_RE": "'\\\\s*([\\\\w\\\\.\\\\-]+)\\\\s*' flags=32","_ONE_STRING_ARG_CALL_RE": "'\\\\A\\\\s*\\\\{\\\\s*\"name\"\\\\s*:\\\\s*\"([\\\\w.\\\\-]+)\"\\\\s*,\\\\s*\"(?:arguments|parameters)\"\\\\s*:\\\\s*\\\\{\\\\s*\"([A-Za-z_][\\\\w\\\\-]*)\"\\\\s*:\\\\s*\"(.*)\"\\\\s*\\\\}\\\\s*\\\\}\\\\s*\\\\Z' flags=48","_OPEN_CALL_WS_RE": "'\\\\s*' flags=32",@@ -1150,15 +1151,15 @@"_TOOL_ALL_PATS[10]": "'<\\\\|tool_call>(?=\\\\s*call\\\\s*:|\\\\s*$).*$' flags=48","_TOOL_ALL_PATS[11]": "'\\\\[TOOL_CALLS\\\\](?=\\\\s*(?:[\\\\[{]|[A-Za-z_][\\\\w.\\\\-]*(?:[\\\\[{]|\\\\s*$))|\\\\s*$).*$' flags=48","_TOOL_ALL_PATS[12]": "'<\\\\|python_tag\\\\|>(?=\\\\s*(?:\\\\{|[A-Za-z_][\\\\w.]*\\\\()|\\\\s*$).*$' flags=48",- "_TOOL_ALL_PATS[13]": "'<\uff5c(?:tool\u2581calls\u2581begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool\u2581calls)\uff5c>(?=\\\\s*(?:<\uff5ctool\u2581call\u2581begin\uff5c>|function)|\\\\s*$).*$' flags=48",- "_TOOL_ALL_PATS[14]": "'<\uff5ctool\u2581call\u2581begin\uff5c>(?=\\\\s*function|\\\\s*$).*$' flags=48",+ "_TOOL_ALL_PATS[13]": "'<|(?:tool▁calls▁begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool▁calls)|>(?=\\\\s*(?:<|tool▁call▁begin|>|function)|\\\\s*$).*$' flags=48",+ "_TOOL_ALL_PATS[14]": "'<|tool▁call▁begin|>(?=\\\\s*function|\\\\s*$).*$' flags=48","_TOOL_ALL_PATS[15]": "'<\\\\|tool_calls_section_begin\\\\|>(?=\\\\s*<\\\\|tool_call_begin\\\\|>|\\\\s*$).*$' flags=48","_TOOL_ALL_PATS[16]": "'<\\\\|tool_call_begin\\\\|>(?=\\\\s*[A-Za-z_][\\\\w.\\\\-]*:\\\\d|\\\\s*$).*$' flags=48","_TOOL_ALL_PATS[1]": "'<function(?:=[\\\\w.\\\\-]+|\\\\s+name=\"[\\\\w.\\\\-]+\")>(?:(?!<function(?:=[\\\\w.\\\\-]+|\\\\s+name=\"[\\\\w.\\\\-]+\")>).)*</function>' flags=48","_TOOL_ALL_PATS[2]": "'<\\\\|tool_call>.*?<tool_call\\\\|>' flags=48","_TOOL_ALL_PATS[3]": "'\\\\[TOOL_CALLS\\\\]\\\\s*\\\\[.*?\\\\](?:\\\\s*</s>)?' flags=48","_TOOL_ALL_PATS[4]": "'\\\\[TOOL_CALLS\\\\]\\\\s*[\\\\w\\\\.\\\\-]+\\\\s*(?:\\\\[ARGS\\\\])?\\\\s*\\\\{.*?\\\\}' flags=48",- "_TOOL_ALL_PATS[5]": "'<\uff5c(?:tool\u2581calls\u2581begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool\u2581calls)\uff5c>.*?<\uff5ctool\u2581calls\u2581end\uff5c>' flags=48",+ "_TOOL_ALL_PATS[5]": "'<|(?:tool▁calls▁begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool▁calls)|>.*?<|tool▁calls▁end|>' flags=48","_TOOL_ALL_PATS[6]": "'<\\\\|tool_calls_section_begin\\\\|>.*?<\\\\|tool_calls_section_end\\\\|>' flags=48","_TOOL_ALL_PATS[7]": "'<\\\\|tool_call_begin\\\\|>.*?<\\\\|tool_call_end\\\\|>' flags=48","_TOOL_ALL_PATS[8]": "'<tool_call>.*$' flags=48",@@ -1168,12 +1169,12 @@"_TOOL_CLOSED_PATS[2]": "'<\\\\|tool_call>.*?<tool_call\\\\|>' flags=48","_TOOL_CLOSED_PATS[3]": "'\\\\[TOOL_CALLS\\\\]\\\\s*\\\\[.*?\\\\](?:\\\\s*</s>)?' flags=48","_TOOL_CLOSED_PATS[4]": "'\\\\[TOOL_CALLS\\\\]\\\\s*[\\\\w\\\\.\\\\-]+\\\\s*(?:\\\\[ARGS\\\\])?\\\\s*\\\\{.*?\\\\}' flags=48",- "_TOOL_CLOSED_PATS[5]": "'<\uff5c(?:tool\u2581calls\u2581begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool\u2581calls)\uff5c>.*?<\uff5ctool\u2581calls\u2581end\uff5c>' flags=48",+ "_TOOL_CLOSED_PATS[5]": "'<|(?:tool▁calls▁begin|tool_calls_begin|tool calls begin|tool\\\\\\\\_calls\\\\\\\\_begin|tool▁calls)|>.*?<|tool▁calls▁end|>' flags=48","_TOOL_CLOSED_PATS[6]": "'<\\\\|tool_calls_section_begin\\\\|>.*?<\\\\|tool_calls_section_end\\\\|>' flags=48","_TOOL_CLOSED_PATS[7]": "'<\\\\|tool_call_begin\\\\|>.*?<\\\\|tool_call_end\\\\|>' flags=48"},"regexes": {- "re.compile(\"(?im)(\\\\b(i['\\\\u2019](ll|m going to|m gonna)|i am (going to|gonna)|i will|i shall)\\\\b(?!\\\\s+(?:not|never)\\\\b)(?!\\\\s+\" + _HELP_OFFER + ')|\\\\b(?:let me|allow me)\\\\b(?!\\\\s+(?:not|never|know)\\\\b)(?!\\\\s+' + _SIGN_OFF + ')(?!\\\\s+to\\\\s+' + _HELP_OFFER + \")|(?:^|[.!?]\\\\s+)\\\\s*(?:the\\\\s+)?first\\\\s+step\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:\u2013\u2014-]?\\\\s+(?:my|our)\\\\s+(?:plan|approach|step)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:\u2013\u2014-]?\\\\s+(?:i|we|let['\u2019]?s|let us)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:\u2013\u2014-]?\\\\s+\" + _ACTION_VERB + \"\\\\b|\\\\bstep \\\\d+[ \\\\t*_]*(?::[ \\\\t*_\\\\r]*$|(?:[:,.)\\\\u2013\\\\u2014-][ \\\\t*_]*)?(?:\\\\r?\\\\n(?:[ \\\\t]*\\\\r?\\\\n)?[ \\\\t*_#>-]*(?:\\\\d+[.)][ \\\\t*_]*)?)?(?:(?:let['\u2019]?s|let us)\\\\b|\" + _ACTION_VERB + \"\\\\b))|\\\\bhere['\\\\u2019]?s (?:my |the |a )?(?:plan|approach)|\\\\b(?:now i|next i)\\\\b)\")": 1,+ "re.compile(\"(?im)(\\\\b(i['\\\\u2019](ll|m going to|m gonna)|i am (going to|gonna)|i will|i shall)\\\\b(?!\\\\s+(?:not|never)\\\\b)(?!\\\\s+\" + _HELP_OFFER + ')|\\\\b(?:let me|allow me)\\\\b(?!\\\\s+(?:not|never|know)\\\\b)(?!\\\\s+' + _SIGN_OFF + ')(?!\\\\s+to\\\\s+' + _HELP_OFFER + \")|(?:^|[.!?]\\\\s+)\\\\s*(?:the\\\\s+)?first\\\\s+step\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:–—-]?\\\\s+(?:my|our)\\\\s+(?:plan|approach|step)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:–—-]?\\\\s+(?:i|we|let['’]?s|let us)\\\\b|(?:^|[.!?]\\\\s+)\\\\s*first\\\\s*[,:–—-]?\\\\s+\" + _ACTION_VERB + \"\\\\b|\\\\bstep \\\\d+[ \\\\t*_]*(?::[ \\\\t*_\\\\r]*$|(?:[:,.)\\\\u2013\\\\u2014-][ \\\\t*_]*)?(?:\\\\r?\\\\n(?:[ \\\\t]*\\\\r?\\\\n)?[ \\\\t*_#>-]*(?:\\\\d+[.)][ \\\\t*_]*)?)?(?:(?:let['’]?s|let us)\\\\b|\" + _ACTION_VERB + \"\\\\b))|\\\\bhere['\\\\u2019]?s (?:my |the |a )?(?:plan|approach)|\\\\b(?:now i|next i)\\\\b)\")": 1,"re.compile('\"[\\\\s}\\\\]]*,\\\\s*(?:\"[A-Za-z_][\\\\w\\\\-]*\"|\\\\\\'[A-Za-z_][\\\\w\\\\-]*\\\\\\'|[A-Za-z_][\\\\w\\\\-]*)\\\\s*:')": 1,"re.compile('\"name\"\\\\s*:\\\\s*\"([^\"]+)\"')": 1,"re.compile('(?:^|[{,\\\\[])\\\\s*[A-Za-z_][\\\\w.\\\\-]*\\\\s*:\\\\s*<\\\\|\"\\\\|>')": 1,@@ -1199,13 +1200,14 @@"re.compile('<function(?:=[\\\\w.\\\\-]+|\\\\s+name=\"[\\\\w.\\\\-]+\")>.*$', re.DOTALL)": 1,"re.compile('<function(?:=[\\\\w\\\\.\\\\-]+|\\\\s+name=\"[\\\\w\\\\.\\\\-]+\")>')": 1,"re.compile('<function\\\\s+name=\"')": 1,+ "re.compile('<invoke\\\\s+name=\"([\\\\w\\\\.\\\\-]+)\">')": 1,"re.compile('<tool_call>(?:(?!<tool_call>).)*</tool_call>', re.DOTALL)": 1,"re.compile('<tool_call>.*$', re.DOTALL)": 1,"re.compile('<tool_call>.*?</tool_call>', re.DOTALL)": 1,"re.compile('<tool_call>\\\\s*([\\\\w.\\\\-]+)\\\\s*(?=\\\\n|<arg_key>|</tool_call>)')": 1,"re.compile('<tool_call>\\\\s*\\\\{')": 1,"re.compile('<tool_call>|<function(?:=|\\\\s+name=\")|<\\\\|tool_call>|<\\\\|python_tag\\\\|>(?=\\\\s*(?:\\\\{|[A-Za-z_][\\\\w.]*\\\\())')": 1,- "re.compile('<\uff5ctool\u2581call\u2581begin\uff5c>(?=\\\\s*function|\\\\s*$).*$', re.DOTALL)": 1,+ "re.compile('<|tool▁call▁begin|>(?=\\\\s*function|\\\\s*$).*$', re.DOTALL)": 1,"re.compile('[\\\\w.\\\\-]*[ \\\\t]*\\\\n?[ \\\\t]*`{3,}[a-zA-Z0-9_+-]*')": 1,"re.compile('[`<>\\\\[\\\\]{}]')": 1,"re.compile('\\\\A\\\\s*\\\\{\\\\s*\"name\"\\\\s*:\\\\s*\"([\\\\w.\\\\-]+)\"\\\\s*,\\\\s*\"(?:arguments|parameters)\"\\\\s*:\\\\s*\\\\{\\\\s*\"([A-Za-z_][\\\\w\\\\-]*)\"\\\\s*:\\\\s*\"(.*)\"\\\\s*\\\\}\\\\s*\\\\}\\\\s*\\\\Z', re.DOTALL)": 1,@@ -1225,9 +1227,9 @@"re.compile('`+')": 1,"re.compile('```[\\\\s\\\\r\\\\n]*' + re.escape(_DEEPSEEK_CALL_END))": 1,"re.compile('true|false|null')": 1,- "re.compile(_DEEPSEEK_OPEN_RE_SRC + '(?=\\\\s*(?:<\uff5ctool\u2581call\u2581begin\uff5c>|function)|\\\\s*$).*$', re.DOTALL)": 1,- "re.compile(_DEEPSEEK_OPEN_RE_SRC + '.*?<\uff5ctool\u2581calls\u2581end\uff5c>', re.DOTALL)": 1,- "re.compile(_DEEPSEEK_OPEN_RE_SRC + '|' + re.escape(_KIMI_SECTION_BEGIN) + '|' + re.escape(_KIMI_CALL_BEGIN))": 1,+ "re.compile(_DEEPSEEK_OPEN_RE_SRC + '(?=\\\\s*(?:<|tool▁call▁begin|>|function)|\\\\s*$).*$', re.DOTALL)": 1,+ "re.compile(_DEEPSEEK_OPEN_RE_SRC + '.*?<|tool▁calls▁end|>', re.DOTALL)": 1,+ "re.compile(_DEEPSEEK_OPEN_RE_SRC + '|' + re.escape(_KIMI_SECTION_BEGIN) + '|' + re.escape(_KIMI_CALL_BEGIN) + '|' + re.escape(_MINIMAX_BLOCK_OPEN))": 1,"re.compile(_DEEPSEEK_OPEN_RE_SRC)": 1,"re.compile(_GEMMA_SLOT + '(\\\\d+)' + _GEMMA_SLOT)": 1},@@ -1543,6 +1545,18 @@"_MAX_GEMMA_PREFIX_TAIL": {"kind": "assign"},+ "_MINIMAX_BLOCK_CLOSE": {+ "kind": "assign"+ },+ "_MINIMAX_BLOCK_OPEN": {+ "kind": "assign"+ },+ "_MINIMAX_INVOKE_CLOSE": {+ "kind": "assign"+ },+ "_MINIMAX_INVOKE_OPEN_RE": {+ "kind": "assign"+ },"_MISTRAL_ARGS_MARKER": {"kind": "assign"},@@ -1561,6 +1575,33 @@"_MISTRAL_V11_NAME_RE": {"kind": "assign"},+ "_MinimaxValueIndex": {+ "bases": [],+ "decorators": [],+ "kind": "class",+ "methods": {+ "__init__": {+ "decorators": [],+ "signature": "self, text: str"+ },+ "_any_in": {+ "decorators": [+ "staticmethod"+ ],+ "signature": "positions: list[int], lo: int, hi: int"+ },+ "_positions": {+ "decorators": [+ "staticmethod"+ ],+ "signature": "text: str, tags"+ },+ "inside": {+ "decorators": [],+ "signature": "self, pos: int"+ }+ }+ },"_ONE_STRING_ARG_CALL_RE": {"kind": "assign"},@@ -1585,6 +1626,9 @@"_OPEN_FUNCTION_OPENER_RE": {"kind": "assign"},+ "_OPEN_PARAMETER_TAGS": {+ "kind": "assign"+ },"_OUTER_ENVELOPE_CLOSED_PATS": {"kind": "assign"},@@ -1839,6 +1883,11 @@"kind": "def","signature": "spans: list"},+ "_minimax_block_spans": {+ "decorators": [],+ "kind": "def",+ "signature": "text: str"+ },"_mistral_region_end": {"decorators": [],"kind": "def",@@ -1929,6 +1978,11 @@"kind": "def","signature": "content: str, *, id_offset: int, allow_incomplete: bool=True"},+ "_parse_minimax_tool_calls": {+ "decorators": [],+ "kind": "def",+ "signature": "content: str, *, id_offset: int, allow_incomplete: bool=True"+ },"_parse_mistral_array": {"decorators": [],"kind": "def",@@ -2009,6 +2063,11 @@"kind": "def","signature": "text: str"},+ "_strip_minimax_calls": {+ "decorators": [],+ "kind": "def",+ "signature": "text: str, *, final: bool"+ },"_strip_mistral_closed_calls": {"decorators": [],"kind": "def",@@ -2176,9 +2235,6 @@"decorators": [],"kind": "def","signature": "reasoning: str"- },- "_OPEN_PARAMETER_TAGS": {- "kind": "assign"}}},@@ -2194,6 +2250,7 @@"_REHEARSAL_CLOSED_STRIP_RE": "'(?<!\\\\[CALL_ID\\\\])\\\\b([\\\\w-]+)\\\\[ARGS\\\\]\\\\s*\\\\{[^{}]*(?:\\\\{[^{}]*\\\\}[^{}]*)*\\\\}' flags=48","_REHEARSAL_RE": "'(?<!\\\\[CALL_ID\\\\])\\\\b([\\\\w-]+)\\\\[ARGS\\\\]\\\\s*(?=\\\\{)' flags=32","_REHEARSAL_TAIL_STRIP_RE": "'(?<!\\\\[CALL_ID\\\\])\\\\b([\\\\w-]+)\\\\[ARGS\\\\]\\\\s*(?:\\\\{.*)?$' flags=48",+ "_TAG_MENTION_RE": "'(?<!`)(``?)[ \\\\t]*(<(?!/?think(?:ing)?>)[^<>`\\\\n]+>[\\\\w.\\\\-]*|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\][\\\\w.\\\\-]*)[ \\\\t]*\\\\1' flags=32","_TC_END_TAG_RE": "'</tool_call>|<\\\\|end_message\\\\|>' flags=32","_TC_FUNC_CLOSED_PAT": "'<function=[\\\\w.-]+>.*?</function>' flags=48","_TC_FUNC_CLOSE_RE": "'\\\\s*</function>\\\\s*$' flags=32",@@ -2232,16 +2289,17 @@"_TOOL_OPEN_XML_TAIL_PATS[0]": "'<tool_call>.*$' flags=48","_TOOL_OPEN_XML_TAIL_PATS[1]": "'<\\\\|tool_call>.*$' flags=48","_TOOL_OPEN_XML_TAIL_PATS[2]": "'<function=[\\\\w-]+>.*$' flags=48",- "_WRAP_OPEN_RE": "'<tool_call>\\\\s*$' flags=32",+ "_TOOL_TAG_HINT_RE": "'</?(?:tool|function|param|arg_|minimax:)|<[||]|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\]' flags=32","_WRAP_CLOSE_RE": "'\\\\s*</tool_call>' flags=32",- "_TAG_MENTION_RE": "'(?<!`)(``?)[ \\\\t]*(<(?!/?think(?:ing)?>)[^<>`\\\\n]+>[\\\\w.\\\\-]*|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\][\\\\w.\\\\-]*)[ \\\\t]*\\\\1' flags=32",- "_TOOL_TAG_HINT_RE": "'</?(?:tool|function|param|arg_)|<[|\uff5c]|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\]' flags=32"+ "_WRAP_OPEN_RE": "'<tool_call>\\\\s*$' flags=32"},"regexes": {"re.compile('(?:<tool_call>|<\\\\|content_invoke_tool_json\\\\|>)\\\\s*\\\\{')": 1,"re.compile('(?<!\\\\[CALL_ID\\\\])\\\\b([\\\\w-]+)\\\\[ARGS\\\\]\\\\s*' + _BRACKETED_JSON_ONE_LEVEL, re.DOTALL)": 1,"re.compile('(?<!\\\\[CALL_ID\\\\])\\\\b([\\\\w-]+)\\\\[ARGS\\\\]\\\\s*(?:\\\\{.*)?$', re.DOTALL)": 1,"re.compile('(?<!\\\\[CALL_ID\\\\])\\\\b([\\\\w-]+)\\\\[ARGS\\\\]\\\\s*(?=\\\\{)')": 1,+ "re.compile('(?<!`)(``?)[ \\\\t]*(<(?!/?think(?:ing)?>)[^<>`\\\\n]+>[\\\\w.\\\\-]*|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\][\\\\w.\\\\-]*)[ \\\\t]*\\\\1')": 1,+ "re.compile('</?(?:tool|function|param|arg_|minimax:)|<[||]|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\]')": 1,"re.compile('</think>|\\\\[/THINK\\\\]')": 1,"re.compile('</tool_call>|<\\\\|end_message\\\\|>')": 1,"re.compile('<\\\\|tool_call>.*$', re.DOTALL)": 1,@@ -2255,6 +2313,7 @@"re.compile('<think>|\\\\[THINK\\\\]')": 1,"re.compile('<tool_call>.*$', re.DOTALL)": 1,"re.compile('<tool_call>.*?</tool_call>', re.DOTALL)": 1,+ "re.compile('<tool_call>\\\\s*$')": 1,"re.compile('<tool_call\\\\|>')": 2,"re.compile('[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*', re.DOTALL)": 1,"re.compile('[^\"{}<]*(?:<(?!\\\\|\"\\\\|>)[^\"{}<]*)*')": 1,@@ -2266,13 +2325,10 @@"re.compile('\\\\[TOOL_CALLS\\\\]\\\\s*[\\\\w-]+(?:\\\\[CALL_ID\\\\][\\\\w-]+)?(?:\\\\[ARGS\\\\])?\\\\s*' + _BRACKETED_JSON_ONE_LEVEL, re.DOTALL)": 1,"re.compile('\\\\s*</function>\\\\s*$')": 1,"re.compile('\\\\s*</parameter>\\\\s*$')": 1,+ "re.compile('\\\\s*</tool_call>')": 1,"re.compile('\\\\s*[A-Za-z_][\\\\w.\\\\-]*\\\\s*:')": 1,"re.compile('^[ \\\\t]*(?:>[ \\\\t]*)*(?:(?P<bt>```+)[^`\\\\n]*$.*?(?:^[ \\\\t]*(?:>[ \\\\t]*)*(?P=bt)`*[ \\\\t\\\\r]*$|\\\\Z)|(?P<tl>~~~+)[^\\\\n]*$.*?(?:^[ \\\\t]*(?:>[ \\\\t]*)*(?P=tl)~*[ \\\\t\\\\r]*$|\\\\Z))|``(?:[^`]|`(?!`))*?``|`[^`\\\\n]*`', re.DOTALL | re.MULTILINE)": 1,- "re.match('\\\\s*\\\\[/TOOL_CALLS\\\\]', content[end:])": 1,- "re.compile('<tool_call>\\\\s*$')": 1,- "re.compile('\\\\s*</tool_call>')": 1,- "re.compile('(?<!`)(``?)[ \\\\t]*(<(?!/?think(?:ing)?>)[^<>`\\\\n]+>[\\\\w.\\\\-]*|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\][\\\\w.\\\\-]*)[ \\\\t]*\\\\1')": 1,- "re.compile('</?(?:tool|function|param|arg_)|<[|\uff5c]|\\\\[/?(?:TOOL_CALLS|ARGS|CALL_ID)\\\\]')": 1+ "re.match('\\\\s*\\\\[/TOOL_CALLS\\\\]', content[end:])": 1},"symbols": {"EXECUTION_CLASS_TOOL_NAMES": {@@ -2314,6 +2370,34 @@"_MISTRAL_BRACKET_RE": {"kind": "assign"},+ "_OPEN_PARAMETER_SCAN_LIMIT": {+ "kind": "assign"+ },+ "_OpenParameterIndex": {+ "bases": [],+ "decorators": [],+ "kind": "class",+ "methods": {+ "__init__": {+ "decorators": [],+ "signature": "self, content: str, *, param_start_re=None, param_closers=(_PARAM_CLOSE_TAG,), func_closers=(_FUNC_CLOSE_TAG,)"+ },+ "_build": {+ "decorators": [],+ "signature": "self"+ },+ "_positions": {+ "decorators": [+ "staticmethod"+ ],+ "signature": "content: str, tags"+ },+ "inside": {+ "decorators": [],+ "signature": "self, pos: int"+ }+ }+ },"_PARAM_CLOSE_TAG": {"kind": "assign"},@@ -2332,6 +2416,9 @@"_REHEARSAL_TAIL_STRIP_RE": {"kind": "assign"},+ "_TAG_MENTION_RE": {+ "kind": "assign"+ },"_TC_END_TAG_RE": {"kind": "assign"},@@ -2386,6 +2473,18 @@"_TOOL_OPEN_XML_TAIL_PATS": {"kind": "assign"},+ "_TOOL_TAG_HINT_RE": {+ "kind": "assign"+ },+ "_TOOL_TAG_PREFIXES": {+ "kind": "assign"+ },+ "_WRAP_CLOSE_RE": {+ "kind": "assign"+ },+ "_WRAP_OPEN_RE": {+ "kind": "assign"+ },"_balanced_brace_end": {"decorators": [],"kind": "def",@@ -2566,6 +2665,11 @@"kind": "def","signature": "text: str, patterns, enabled_tool_names=None"},+ "in_tag_mention": {+ "decorators": [],+ "kind": "def",+ "signature": "spans, pos: int"+ },"marker_coverage": {"decorators": [],"kind": "def",@@ -2591,54 +2695,6 @@"kind": "def","signature": "text: str, patterns"},- "_WRAP_CLOSE_RE": {- "kind": "assign"- },- "_WRAP_OPEN_RE": {- "kind": "assign"- },- "_OpenParameterIndex": {- "bases": [],- "decorators": [],- "kind": "class",- "methods": {- "__init__": {- "decorators": [],- "signature": "self, content: str, *, param_start_re=None, param_closers=(_PARAM_CLOSE_TAG,), func_closers=(_FUNC_CLOSE_TAG,)"- },- "_build": {- "decorators": [],- "signature": "self"- },- "_positions": {- "decorators": [- "staticmethod"- ],- "signature": "content: str, tags"- },- "inside": {- "decorators": [],- "signature": "self, pos: int"- }- }- },- "_OPEN_PARAMETER_SCAN_LIMIT": {- "kind": "assign"- },- "_TAG_MENTION_RE": {- "kind": "assign"- },- "_TOOL_TAG_HINT_RE": {- "kind": "assign"- },- "_TOOL_TAG_PREFIXES": {- "kind": "assign"- },- "in_tag_mention": {- "decorators": [],- "kind": "def",- "signature": "spans, pos: int"- },"tag_mention_spans": {"decorators": [],"kind": "def",diff --git a/studio/backend/tests/data/refactor_guard/golden_outputs.json b/studio/backend/tests/data/refactor_guard/golden_outputs.jsonindex 257baa5cca6..4e5f3a54fb0 100644--- a/studio/backend/tests/data/refactor_guard/golden_outputs.json+++ b/studio/backend/tests/data/refactor_guard/golden_outputs.json@@ -1,139 +1,142 @@{"core.inference.tool_call_parser": {- "_balanced_bracket_end": "19de8fb63babb0861475879bfbc13edd8efde741a2354b8bee9028d598a0c92d",- "_balanced_paren_end": "f45332aefa427ff956758a2eaac5cb851ba2e86f53a930fe2b99920118f3c7c4",- "_blocked_markerless_body_spans": "3b9e46336b0bf3b24f00d639e7f891bd4176a9ce7207e694e28524b69245605b",- "_call_object_end": "1ba933d7c9f25ded793c98ab912d20245809ca0434179d1d225aa0cc47b9aca0",- "_consume_mistral_call": "813544e2d389e368c2d6c77f333ae1d07409d9cf0d3bdad8735c116577bcd380",- "_decoded_key": "78aa12becfd9bc1f17e0bdb39dfe16824279dc82d4bd5a97c5b511904ad773c0",- "_disabled_gemma_call_end_containing_signal": "c08417f20bd3f6c67d09c63f750894aa02104faef091f31dba29c57e585ac69a",- "_escape_bare_quotes": "2166469192d10173d4e11354a52cfdc55b16dc608fe5e74343cd336dfca09a84",- "_escaped_string_content_spans": "90f2e2f10c8322bd126f413564d9a5e075606cbabe25b47596cfcc9156f7213c",- "_find_outside_json_strings": "cf83e50f5e7308aae25758d71b706f91c87e690bc6fdddb24605671fb67e3788",- "_first_foreign_tool_signal": "253f37233f0cd47bb9a1f4e2cb04072d1575b1245d5f0a2c0fc7190dfa138354",- "_first_sentinel": "a5aebe5d9a8bdd81671d6c572517e0e8526d269db1a0fdf92e86c618ce8155e0",- "_gemma_balanced_brace_end": "a5fbd98554937c109db0e3b848ba997193994c85025b383c4958452b913d7e5d",- "_gemma_bare_body_arguments": "b9ae7baf34cbff7fdbf0bb883417d77785d8246a703b160029e7297c0ecc0631",- "_gemma_body_brace_end": "ad13a08b3a789c52bec6e851b53cf4b90c7b794904f3ee54bf12d4042e4b0820",- "_gemma_call_is_anchored": "c52e950286578ec37883135946183a85ab3f74b03690722408e40ab65e7f7c6a",- "_gemma_coerce_scalar": "4649c55ae145ed01354b7bc6dc730fe150235e6f197d1d0b50978eed0b23c811",- "_gemma_parse_array": "9f3694cab755fc86e7acb1c05c56968f15363a763716e63f80890cb790115a74",- "_gemma_parse_mapping": "af0ecc03a7b209b5edc2d7c573c9bf0377c50ed26eb346b43b7f234af2a2535a",- "_gemma_parse_stripped_body": "b9ae7baf34cbff7fdbf0bb883417d77785d8246a703b160029e7297c0ecc0631",- "_gemma_parse_value": "480b71f46fd177c2fe4edeb8442ddc90c23cdf5188931e00cedbe81f63be2420",- "_glm_value_close": "1946084f6d174988db2ca06611bb07943d9c32cfa9c7323fbefcb1b02aa9a101",- "_has_execution_class_hint": "8006bffc9ce85fff9b4319ecc983d69f1a0f420caf17b60ad972ced597183f3d",- "_has_gemma_bare_trigger": "6c073a56a486f2df2b88d4c9f28aebd5739d47842f3ad5822f07c721e483d8dc",- "_inference_wrapper_spans": "df7e1ac9a4cdba2680444e1c5b77f2b3706f31fa2fa5b635d2de75d8b9b63a42",- "_inside_leading_markerless_body": "037db8ecbb7d4b080d730ccc2a9c0dc7374127af7d8575923a5131173220d785",- "_inside_open_parameter": "a0b25a3185a60cefe98162b3ccfd0872f53481beacc4c99571c2c04a3d3c09d4",- "_is_provisional_call": "b56e53c8d51ea6dce204465f6b53d7d0a6b8e9b6d4d859888b3da9795892e6fa",- "_last_bare_call_word": "6fd7aa3d3e8802e1f11296d2687af0c981eb2237c832f2f3afd6a1dff3909624",- "_leading_json_value_end": "65730eca2c69dcccfabe521051483c853939c27c91d2ff02e0e10654ab0a65d0",- "_llama3_kv_value": "9a358426c0018864e7fa5c041eb4b721006aae470456f95be7f8cea2c8314490",- "_loads_call_object": "4f59718464ebfce224f8df8891c9253619899ea4e797cd9e6751e57c9fcd2ce9",- "_marker_inside_leading_envelope": "9221375eecada36956b1d2ccc43dca17b34ded6de72c19e424a9902fc3bbe91a",- "_mask_blocked_bodies": "97cbc2bedcb6749064571cf3b3117e377d0e28b0b8acc3a97ecaae8b627a3aa6",- "_mistral_region_end": "4319a6b9f647d1623d8cedcfaa1fcdef1e661fde04d42a01ea3bb98f3726f9e1",- "_next_top_level_comma": "1f44b94c514b2189665de34a043f107dbeee0324c27db809594beb851e17b646",- "_normalize_for_repeat": "2548cc8fc8483a98540456d2d6fb138a2a168a84cdc780c38f4a71c34ec95f3a",- "_only_a_code_fence": "986a0b8d0c6d4abe8041da540909357131977dd7ba6a72d537440e44b383a32b",- "_open_inline_code_run": "2f27bf94223e8b14b8faf656fbe7b59f75a087118c516ff26366865179666517",- "_parse_bare_rehearsals": "c809e331067827ef1f773b2613bbcb9c9c1138f55e12bd37cbfe35919cceba54",- "_parse_closed_call_unescaped_quotes": "f5b2cba82abb209bd409fbe327b458c0177a2d09c18b0fab2cd75b6ea64e12bb",- "_parse_deepseek_envelope": "653199a9e3fcbd75f8bfddfc908daed5eb131bcee6a71604abd5d92e43ccacf5",- "_parse_deepseek_tool_calls": "0311aec4be4f82d360a9c5545e12ddfda8d8faec9ab1cd616a9be9b0d3cbe30d",- "_parse_function_xml": "8e47d9a73bea635e90c3a8c56b8be91b3e42d1bbf75c36795fad2bdefeb71696",- "_parse_gemma_tool_calls": "b2042d58638346a09c9f52674bb0b525a60bd2a442c8d7afb793faa790656654",- "_parse_glm_tool_calls": "a59501129afac2b10bf29a43097954b5f9cbcebbcf6202982e43f37c7510a190",- "_parse_glued_deepseek_envelopes": "c7cde49e1f179148c50e6122852a0ec6603c18ffd317ac7ef2ea81aa618102ae",- "_parse_kimi_section_body": "5dc402646fc4b4a4fa5c3221f341502911f8904b4248d3108e3c3d028ed85e0f",- "_parse_kimi_tool_calls": "5dc402646fc4b4a4fa5c3221f341502911f8904b4248d3108e3c3d028ed85e0f",- "_parse_llama3_bare_json": "09fc31f1a2b49be47fccc672ed6463d09db27903596373188a1752952f9be2be",- "_parse_llama3_kv_args": "a3053e3de3e94fad114a05d4c266bf0ab1b2c712603384a3e1d61e21a3e2e3d0",- "_parse_llama3_python_tag": "7f8a889c632b22d1fd13b1535ffa2da9d7bfb18214730d0463cc46ed4e3c6c53",- "_parse_mistral_array": "481160638c578972afe0e575dcf72d2df1652410aba44d7f368923479c615f33",- "_parse_mistral_tool_calls": "e1aaa16f45a71afcee02d862291600015041b72e90527ab7174b5f95c1ae7a56",- "_parse_tool_call_json": "ffc95932f00fb0d352cdf3e04cf273149d506a544e57ff4173765651dffb7916",- "_partial_call_word_len": "c636982f3ff4675a13c8ed5640e7d904c880a213ed702d652e7836bccf6ecbdd",- "_promotable_gemma_call_pos": "a46d934abc746c7a474ce3e8400b8f02d024795238493ebb73ba15c478459aad",- "_safe_cut": "94cc4fd4cac2a7dbdb65fbb2773fce741b1869b7a528fb1f35e416fe680bd858",- "_signal_inside_leading_wrapperless_gemma": "e86b5a942f855e7228d865031c7a2d03c60837a0c7d219475013295558ba19c1",- "_skip_mistral_call_id": "df19f4198fa8e5f7472a47ae59a8efe5aadf15737dacf7c8c0f2d8f367b45f34",- "_slot_gemma_values": "dbe726cc8ab182c5dce85444e996eed1de75a62d753b2ee6201ad5d3775895e7",- "_string_content_spans": "87ab6652018fa4bd7b4e986eadaa46f29362693f1eca52cb7cae130dd74ff4f1",- "_strip_function_xml_calls": "88b342ae0b8dad25cfbbaeaf2f77b5f3a1fea9c2553d03f7cad2e19b5230594a",- "_strip_gemma_wrapperless_calls": "16f797057d8fac12dd00950f3c172ba8a9ab7bad5918e9b905cbf2ffd25382ce",- "_strip_glm_calls": "5d2c536c4a3fbbc2e25525b266b06da99e469c10cd0551020f341c9c6f6d01a6",- "_strip_leading_code_fence": "f0d73fa03d83fd4a7b2cc11df48f2ebe922e968fee683eedb7833f3234e5bc63",- "_strip_mistral_closed_calls": "874d69e07bf2c7007ed945493c4e065bbdea740d4d9e1f64cbeda382cc8c90c8",- "_strip_mistral_reasoning": "3a97a231706b3ab23b3c7f28e69170eca6f749ed0388dd93bccc25150e97faf6",- "_top_level_args_values": "036fbdeb38e421150bb2f1467ac36604bdb5925018cb239c5b10b3af968b31ad",- "_top_level_bare_json_name": "317d91e7280b935658db9845a9a29af864a30bfd7093cf2cba83d2b8306c8049",- "_top_level_maskable_values": "8e54c802bf6e75de74716e6769d22d96933d9f96c9d962196ec8db6a0ab2fc66",- "_unmask_blocked_bodies": "3a97a231706b3ab23b3c7f28e69170eca6f749ed0388dd93bccc25150e97faf6",- "_unmatched_think_closer": "db7d6576fadb4fe097826883e15393030e13285d2fe78259e8d4d3149e484d30",- "_whole_content_is_json_value": "1003e41e9b5757df0cb1c3fb4e89530661b943862a18e4cbd68b05e4d343b9c4",- "_xml_signal_inside_leading_bare_json": "8afcc9274da009153406809ed2efafc2b707dc31e2a2329e8c618eb914083cd6",- "_xml_signal_inside_leading_mistral": "b346ddd33466b47998d03908992eb11091d4d5a4401902dd72561e95b3b3eb19",- "blocked_bare_json_chain_may_continue": "daaeeb773bb57cf7ff2571f54727c65b3f08a658695acc14ab379aa0954ce3d4",- "blocked_gemma_chain_may_continue": "cb1fd0d997284ddfa4d3679c1a98d25e1028d92052697abca4296f655338ec16",- "blocked_markerless_prefix_end": "aef0aa1d4107062b32df63d60e6f2175c0829dabedf99e3949a7576ef0cfd6e5",- "gemma_tail_may_hide_a_call": "5b8a073b57f49a8638effc62fc424a14964cd40dc3869e03854609ad689ca459",- "has_tool_signal": "67eabc78de657a33c4ae8502f0bccc9aa3d0c8d613eaebedb5b0443b7b3d8f36",- "held_bare_gemma_tail_len": "bf2ffdf439cce87a40752dad822ef258447825090b5129645fc3823f1f433cc7",- "is_reprompt_repeat": "5a3fe224ba657bf9ea1706ef997b81e5c97535b0e03d6699962f386ecbaf15a0",- "is_reprompt_restatement": "5a3fe224ba657bf9ea1706ef997b81e5c97535b0e03d6699962f386ecbaf15a0",- "is_short_intent_without_action": "1ed247c04b2b2bae560ef52224328500d36644b68274015b8efd2c2b9072ac4b",- "leading_bare_gemma_call_is_promotable": "f97184954908b5ae23160649f0aadf26a8f3f1b65534d9cc350d91504f478a94",- "parse_tool_calls_from_text": "0dafd418ab35c8d7e32de2114c01bc05f965d84369e001842cb8d77d15fcf1dd",- "promotable_gemma_call_pos": "9439dc754e212c8a7a203c6740a782e4885c2c61ba413fc4ff0948ea7200e966",- "repeated_result_message": "d6e89e731201e216a32e40ccaadc19eaf0f796cee28f4af73675b731666f7e27",- "reprompt_to_act_message": "27b5a6e3694684acde1db0e63b2415462f24ab5a5825e37a30f00912ebcac01f",- "starved_result_message": "0970549670906c513a1de39c5fb073a1b08b06919c14ba2b7dd1145cbd9caa51",- "strip_leading_bare_json_call": "99eb64662edae2a7404834def44076a021999fc257ef387d0032f1ccc69709b9",- "strip_llama3_leading_sentinels": "de12417a3603b3fca509343aae9c28b8ac19ae4f7ce440c42d2bdd766ef0cf15",- "strip_segment": "b147d755b81e75d1d1413fdc6adc58f9f4624200271f07e2c4ffe7b14b6a6b3b",- "strip_tool_markup": "138b118039304fc4494831a8d5f98a768232c3c0fff7d2f2029572d0f45825b2",- "unfinished_thought_progress": "9d557ae4ed87151307746a8c62575b4479aeb7130f1f5ebb78dd60c710e66f71"+ "_balanced_bracket_end": "8f1b11357e4248c9dba2590baf7bc96b4da5adcbe930c22cdabc4a622eb63110",+ "_balanced_paren_end": "d911331c423e51d73b8377b5583a52eb75b463ab11fbd08db53580c374c2515f",+ "_blocked_markerless_body_spans": "323845de99caba03d9b29bbe29d3c1040d8de91e49e493e28655705bc2a781be",+ "_call_object_end": "6ccf9f658dd3f085493201c1456be12c10eb7eb0691cf74501575417700b4213",+ "_consume_mistral_call": "c424d4f6dc79cb2cff83b966d0e9381a215b84614258562b8bada8277d009fce",+ "_decoded_key": "ad054d0653400970210824cd0a5dad62967912138f4afb451962d93341a3959e",+ "_disabled_gemma_call_end_containing_signal": "022f82efaa5d006ad8db5cad31b0d9b9ab3a6b1cfde0385aa05860824d8f899a",+ "_escape_bare_quotes": "812db9454a19d3306a94e24260dc85120fefb5a1d0cb6d5d439e5256a9a2fbc4",+ "_escaped_string_content_spans": "c2f7c2e4a54a87b22de872ba3b4176735be4ed47a0b510caaf153500b1b244c3",+ "_find_outside_json_strings": "9718692582164c6fe9c8d1fb77d4b633c409d5590ce6fff451a70c1c08fe4dfe",+ "_first_foreign_tool_signal": "1246d26fcbf756c26acf7fb0984cfaf1d4b46670f72a4a8f8ed323ebc09eaaa4",+ "_first_sentinel": "af5ca5df4890a57cee124602827dd2d105f5231b410da45e519368c1864108d3",+ "_gemma_balanced_brace_end": "6ad44078b08e87f1af92bb3277172b9aa95f0c72f84bcdf6c7dfc2dc5590cb0d",+ "_gemma_bare_body_arguments": "ef48e66f1900f3190cef13932808d0fb13eacd5726633aff9ddff4f1d652bc15",+ "_gemma_body_brace_end": "d9708f281a2ac44c5b5637ae4e04703dca655c696c226cbd064b9781dbd4a340",+ "_gemma_call_is_anchored": "923c626ebb90dac78b2d23c5dad022ccdd55f22fb3e7c7a7bacdd23b22c5bfaa",+ "_gemma_coerce_scalar": "9e906234993b23c6e522696a0772283b154ef2a8aa285b7be19e68430b8a1bd9",+ "_gemma_parse_array": "e574b6ae019ae2c3b1b8f8b4aae8c27e95884f55a0fb6de0813440e8810d9478",+ "_gemma_parse_mapping": "983aa69e5d608af5e64cc038c4e683f1d16c8ce11851f649a7aecb79fe84f426",+ "_gemma_parse_stripped_body": "ef48e66f1900f3190cef13932808d0fb13eacd5726633aff9ddff4f1d652bc15",+ "_gemma_parse_value": "e9e5ce899e2a273e2f1c28be7fc36288a6c931927c165bb875f1e2f16a921d25",+ "_glm_value_close": "3d4f5e23591c20720152be25f7ac678b1c9ee3d11eb35da4397a05e2d5b8789c",+ "_has_execution_class_hint": "a1f33138828c5297ab66eb44bc1a74f6d44f39fe2d47facba958e2ccf22f4f49",+ "_has_gemma_bare_trigger": "7205da70886ade8c2300d302dd2043bd12cc4313d3f49f6261667e328c795384",+ "_inference_wrapper_spans": "3ef2b840b2093c4aeda6e4f31403e0869bfd736c7447d5b5f73f79f53677220c",+ "_inside_leading_markerless_body": "fc2aeeb7d0dcb74d7e3cd1b8d43aa863e36598ea4033471dff960c004f79b378",+ "_inside_open_parameter": "6a138fb50b9db9126572821f5c75cd87e8fd78698a0faf04d95b6e6644c781ee",+ "_is_provisional_call": "de2db7f2160b806b254cc301622bef1c442b2b1caeb03ab96ab65fbd334bbe6d",+ "_last_bare_call_word": "1c8b5ad948b835ad3aaa6117cb0f8b321aa3c55ba31461035405bed6fb4798de",+ "_leading_json_value_end": "e2c73a4a601d95ef97ae91575142ed34187dd91338e735ec753c2806cf8dce53",+ "_llama3_kv_value": "25000c3a5830800dce875890ed056e434e6dae036df277eee3912901ad64df2f",+ "_loads_call_object": "f233a1b513eb5b7942f5d991b555037c88275551caae314d7a8843eba6a1d011",+ "_marker_inside_leading_envelope": "bbd9a11833ef6263c7a3cf9e856da591ab101e9e06e6709779b1ed69c6e8d86f",+ "_mask_blocked_bodies": "97002d7c2a75180325d2815658a24077637c29a01e4d4d7982ae4384661fd3c9",+ "_minimax_block_spans": "8e6019958ee64cc5fef9c616336dc5e27894369510eaa99faccbb0e6494701a6",+ "_mistral_region_end": "4d721cc6cdc7a11262e4ce366d8d953c79187bb206fab0127b89aba588f0604d",+ "_next_top_level_comma": "4e4397960c8b9fbc83d79aedc582d26329d17703c246dd9db1cd713928e163a7",+ "_normalize_for_repeat": "4c909acf67f6411429257941eb62fda9d1f87eb4e94ef29552246f6740f68d5e",+ "_only_a_code_fence": "eb535357f1d2ef4cfcc5124e1183d2aca4eb1d8536080acd5bbcc4cd053a3e83",+ "_open_inline_code_run": "15043d1c88f8d18aa16b17b91a5ec6f00a529aaa25456ad0a3201423a92012c4",+ "_parse_bare_rehearsals": "1a1f2e2851d2578576a981298c41facc2b2cbb406f71ac944bcda9a86ac7e824",+ "_parse_closed_call_unescaped_quotes": "1b536548bce58aff622cc96f0f06debbfa854ea750e5e4597575ab889cc8a3d7",+ "_parse_deepseek_envelope": "bd7e35fa92023b058d60239668fc609c1d1f0c255d02c5bc0c34ae84e0628e88",+ "_parse_deepseek_tool_calls": "836769244cf29cc43951a313d276f8129e7d3fc54cc0a6d4bc992d66cbcc6256",+ "_parse_function_xml": "8306b602139aad6c0748b289e1bf57bd655e50e57d0e18325cefec4835cdd2d2",+ "_parse_gemma_tool_calls": "1afd56e4d8aa4d3397873dd279514495772d3261ed5a805285c461955aa8636a",+ "_parse_glm_tool_calls": "c63aec558ad645749f117081aeaf6c73e46c8f9161085677485cdd54a5b68701",+ "_parse_glued_deepseek_envelopes": "fcdc824fe38233032bd735dd1d0e960ce662ed6b06e2a87d0c83b188cc663f40",+ "_parse_kimi_section_body": "d0b6cbf562eb64219014826d40a037b186f0aa1ad8ca60e57a4c5a67f8ba7c0b",+ "_parse_kimi_tool_calls": "d0b6cbf562eb64219014826d40a037b186f0aa1ad8ca60e57a4c5a67f8ba7c0b",+ "_parse_llama3_bare_json": "ed43e8a12a49e09cad514b14fb0ec0316fbcd431f67f4a01b08b1563559dcec6",+ "_parse_llama3_kv_args": "e2803b07d9187fca9b1d0a8fb280d2654a61c86fed48348387b73ea2310cf56a",+ "_parse_llama3_python_tag": "1fa6e26faf7f819d1e927065196e886d60d7f86d0f6eaedcd6fe8602e75667b9",+ "_parse_minimax_tool_calls": "48a7aaa17f0e8545bf2624400d3b93ebc06a3cb4cee2d714bb03236ca4b4180b",+ "_parse_mistral_array": "8ffc43e579c5b476de8f70aa0a320db0e889b040b86692ac28f7d580fda8a7bf",+ "_parse_mistral_tool_calls": "cb524f9c3fb2d0e2ec567161099e89e3057f4feabce7260c79bc1072c89970bd",+ "_parse_tool_call_json": "a974a7e2fb85de85093f337f55d358abde46ae6abdafc955849c1e8b962d3927",+ "_partial_call_word_len": "912be0eb694d69a048746b45a2512ddcb823b69c93661341057039ada479c77f",+ "_promotable_gemma_call_pos": "3d4d427c03ee405e216d1058d6334e8abbbd61c80024b487737bbea95a6ab65f",+ "_safe_cut": "04b8310e32ce7f5a92e23e4fd51369279b5343edd1feeae90fa8b7b1898778bd",+ "_signal_inside_leading_wrapperless_gemma": "debca143400814c101c0235815f7b4ddd4995e74778bef6be9dba06fc418c6e4",+ "_skip_mistral_call_id": "32c14a1fe6640f7f42696d70dc1ba9de21e86c1d1f3a6f00891e1b344889ae7a",+ "_slot_gemma_values": "465182b1fd7975691d9e54e5055a045e2a875b1e442d8667cb1c8782135fc4e0",+ "_string_content_spans": "d25e6113f0eef65eb6ce3a3886605c90926548d13adf09b81cc635c7187740b4",+ "_strip_function_xml_calls": "09ed322421f467dbddbecb000a7c97987e9b5a83ced2eb104e1dd6113675989f",+ "_strip_gemma_wrapperless_calls": "e42ac48f2781677857fa66035334f19af34dda4e16e641f8c33f4325709f0340",+ "_strip_glm_calls": "6548c9e7ba230900c99f5bd432120d86af3bfddddbd044ee587dd61e1d1cc635",+ "_strip_leading_code_fence": "08ebe8a71d39c4836c80d702e9b825c2169d45c7db0b05c506647b1fbc3946f5",+ "_strip_minimax_calls": "afa677cb78d3893f31ffc16176e45a6e583578e16001cf5ebb08fd1a88c0a1ad",+ "_strip_mistral_closed_calls": "f7453620298b776d0101528a5f6650e7ac1c6a88c21f1fa659618d886c5c9f87",+ "_strip_mistral_reasoning": "56c95819bc8be33099a79ab72f88189e8e8e0cc43e0d6b1649456bcbf175a495",+ "_top_level_args_values": "f53090934ae8e02b05628e70f8936a1f6365197aa7213f2e999430b8220fb5a7",+ "_top_level_bare_json_name": "5511d3a0fef7a1db68523531fc096015fb6c87ab597284f42980776265a560f9",+ "_top_level_maskable_values": "fa272cf93df21c95e79c38b6112a90a536996a0b26c29857e94f9edcc30e6d52",+ "_unmask_blocked_bodies": "56c95819bc8be33099a79ab72f88189e8e8e0cc43e0d6b1649456bcbf175a495",+ "_unmatched_think_closer": "811c86f8be92b909669b1c9dbce976ece7d7bf973cb9362be53dafdbdcde25d5",+ "_whole_content_is_json_value": "7ecf703016591ba701dc30dc753076275e320383df8fd35441e77e1f5bb9a828",+ "_xml_signal_inside_leading_bare_json": "95b26bc6555c64fe7c927f141ed515ea3addc5d672735d11dbf07cbe74e0eb9a",+ "_xml_signal_inside_leading_mistral": "8c5740b2e98e16844c253a64f08242df58a29047d3d6764db062632105fe0235",+ "blocked_bare_json_chain_may_continue": "52f1b42d1f768eb7df418f697e1ea15d4aa6469cae71fabe1a89ad3bf7ca5fb4",+ "blocked_gemma_chain_may_continue": "f9aedfc09937a19f626faf6712229061244cafdf598ef152ba88eb372516d2da",+ "blocked_markerless_prefix_end": "4bb6423a9b7d8830a083df1c510bb5bf3fb995463be154792843b67196f05b89",+ "gemma_tail_may_hide_a_call": "1dfc182bfba62c2cc98453a9982cb21bea0e6c72944509cf1244b1bf0e89c438",+ "has_tool_signal": "de3b4c2f1acc366f560a84f53b25fc51b90b7dad51bba2e33e9759817b7d5427",+ "held_bare_gemma_tail_len": "48bb5628db5f1e245d6a4151b89689293e9c8ebeca2f841fc6a7ec8a84ac56b4",+ "is_reprompt_repeat": "f91268b035d9d07358f4ec42f1e430a5cec1982e38fd5bd3ba6787ff43aeb992",+ "is_reprompt_restatement": "f91268b035d9d07358f4ec42f1e430a5cec1982e38fd5bd3ba6787ff43aeb992",+ "is_short_intent_without_action": "4be438ed0414b322fcba33803b4bcd2d7f2fcc85ee871211eab885b89fc0ddb1",+ "leading_bare_gemma_call_is_promotable": "5d8b892be71f5138fde6b49873013b5c97eb678f104851cb33454075a09e93dd",+ "parse_tool_calls_from_text": "d8d571b9972ec2891c746d24f11b8e0db94298227e7e95e8a98941f98a0e1ca5",+ "promotable_gemma_call_pos": "a28b384ec1495a89f9d079613adea43f484d8e57b0f810e3978a45046a475d33",+ "repeated_result_message": "f03f2f1ac61aa040a06fd79fb18d2dd972714a8ffa61040389009f5817b38088",+ "reprompt_to_act_message": "7a414efe3129641a83073b3b358367b01e169e3b9d7291a0c4d765caf6ab97ad",+ "starved_result_message": "9b0cef2d9155cbcb6cf895d4507bc559b74e8837ba5c5303aba3443662f24635",+ "strip_leading_bare_json_call": "d658bf70d1bfa97e0949cc66b22df09ceb9f3fd1389430e82a41c47b7d59b7d6",+ "strip_llama3_leading_sentinels": "7680bc038c1a4842887eedcc670dad85bfb0f4b9d5e4880a01eb633a3438d0d6",+ "strip_segment": "03763572c740babbe59b1648ed0c26e4d30c181ac570cdf63341e2527982619c",+ "strip_tool_markup": "705d1d59263427ba2209fb8d23d2d34556c75c45323f74beb6332bb68b2c79ab",+ "unfinished_thought_progress": "1810b890fbe4a17c7daccb8222bde8ffbac05239af486905bed0f8fc19aed47f"},"core.tool_healing": {- "_balanced_brace_end": "1cf820d9573369a82ae1e0f9779d811b23356c560e513b18a7cba09310fad565",- "_balanced_bracket_end": "bec99993e3c5ebb253631a67c97bd00e4f663a347ecfe1a534f471ad08e687c6",- "_balanced_json_span": "cfec2057d4e54053d458ebff0cb932134b11887c54be4d4e2104ff1740aa4fee",- "_build_markers": "8fbd44405566be8f184480cf803eb7640e96f5da9552f3bff032c82e5d6fef2b",- "_code_spans": "e3bf3b3588ccd0bad8277b1c58677661333a4742db599dea8b6698a2b8c2792f",- "_decode_array_items": "990eb766b6fa504706e37a4b8389c320a3f4af7055fbe3ffcc36b66d787beb3e",- "_func_close_index": "6acc50e8842fd97bd297b013f967ba710ccf25a0c1ba9fcd64eafaa7b71d410f",- "_gemma_arguments_to_json": "f8b51e3654421e8d545146d573ca46f4bce4a04749ce353547ef5d597ead481b",- "_gemma_span_ranges": "dec49cf5f9e60d5c68690be91e9897e66633abfaa821ee38558b4d83d40a4cd9",- "_glued_call_objects": "9ce70747ddc172e0c332061b57ec831c7d7029d58299ce4aa51153d3646e742a",- "_inside_open_parameter": "b94f91fd87588ec8c9dd80f2962c17644d1360ee57c456ea4ab6a90ca12420e7",- "_is_strict_json": "1003e41e9b5757df0cb1c3fb4e89530661b943862a18e4cbd68b05e4d343b9c4",- "_iter_bracket_spans": "2def0d358f3aa7790bcc69158040f1e685dde85b870d1b1c8feaa3f179df2188",- "_json_object_body": "e814b8ed198a73fe7f35306b15d5e796e453449a3d47e369c22732ba32adf18d",- "_loads_wrapped_call": "bf2c040c5c2e68222d018ecc7fd29a7062bcd12fabaaba7216e7887797d5497e",- "_marker_coverage": "f2332dd262243358dc4df45b96099bcdb29478cce0430cdacd81f38cce4286d0",- "_normalise_gemma_quoted_strings": "97fdc0d3c45e32ce3e7749ae1cccbba6bb2a82035dfe05138420684e7fc8fe27",- "_quote_gemma_array_elements": "d20585abf6d8721545c0a072aa9ae416bcf09aab6dc501c031481234dcb8bb71",- "_quote_gemma_object_keys": "4872ee71159b48755e78ee5388ce29344eef31f8280dc02b3555a433c20de559",- "_relaxed_allowed_at": "2952d84242c627b6a044a73947c2fc18db7ea07b3a7ab45a2b2fe99dff3a33c1",- "_relaxed_object_end": "f1e648a6cd1a53fa2b4c74b9b9033bbb603460de832d80d6f760d49839170c9d",- "_split_top_level_commas": "dc04334a5d7f2d98d9737d30e2e6ff0b2a163c6e413ec85d7124da441325ba47",- "_strip_bracket_tag_calls": "2af3b1d6e7c741417b5d2bed967e6417ffd1b7e006b90cdd33c340e5ab9e45ff",- "_strip_closed_blocks_outside_gemma": "c8e5641bfbd6b5fa3549f9cb5654de8a054af585ac946842b3c1ef4417765823",- "_strip_gemma_native_spans": "cae5e94ecd4ff46835ba95c08ef1c4d86b354d69d6b8e35c74140a0e0cfa535b",- "_strip_markup_segment": "3c32ed27c75f86702c05d4ee8bdef1e0c46d68276deee46b79bbb107f978f3d8",- "_think_spans_outside_tool_markup": "2faf4d5272952073b3783cbce2e8c603a60d0087888ac589c037d78a81cb822f",- "_tool_call_markup_spans": "f1344290f37f9d613ce5310ecf9c401a63d50b3898b7600f404eab82a03d2c47",- "_trim_param_value": "3f267257af04e72f01d55fdcc6a138ac4795993869ae0e31cebd3d67d6f4de36",- "apply_tool_strip_patterns": "d240e9d7f4aeb8a0de8b3c088ec5fba75199662485c8928bbcc48bbdd607441f",- "marker_coverage": "f2332dd262243358dc4df45b96099bcdb29478cce0430cdacd81f38cce4286d0",- "parse_tool_calls_from_text": "8eea9ebd03da248ba65bde8dcaa1faa9bedd1ec92f6c244a1be1e83edfd207bd",- "strip_outside_think": "3a97a231706b3ab23b3c7f28e69170eca6f749ed0388dd93bccc25150e97faf6",- "strip_tool_call_markup": "1e30f8bc5fc374b58de007afd10702e5d4e6c4017f4352f653f3590b2077bcdc",- "strip_tool_patterns": "80677e0f8c3a42f9c58dc6384581d72b7bd548643608011f0ffe5bc4369b2e92",- "tag_mention_spans": "dfc40db7931fd004fde1eb93afce5cb06b1ef0c0a17ae239299beac64ebab2dd"+ "_balanced_brace_end": "885c3283a738d1cbe60499033c9080b61b6d93fab66d0c97725dd503428b2c56",+ "_balanced_bracket_end": "2abc1d8d7879b1720b5d6da846a1c72d289a148234fd4495e3f654d0ec56885a",+ "_balanced_json_span": "cad6279a4d2a477beb600c044395ed5f70f83be0201359161db14968b71beb47",+ "_build_markers": "cccee88ebb67324f50dec162c711ed4198fefa2aabab38c523a2622872a6a87b",+ "_code_spans": "25364ce01d4a96d564062140454e69f4faaa5c05ab4e7bebbb77a821f32cdda5",+ "_decode_array_items": "e16f1cf1684d947f765b1c2d38997cf31d7b48c34c77aa741bbdeb80187d26f2",+ "_func_close_index": "db82c85ffa08599056c9a3de4bf6d9d38d711192850ff5a1ea7eb8abba10ed5a",+ "_gemma_arguments_to_json": "06edf3c17b5a78ba4ba7e2d292b269277ee0a84066b6d4b041d7995306b7bbd3",+ "_gemma_span_ranges": "6c1834190ed60009aeb84d5bf84dbb4a9e7239de86c5d12f02dfd48839a7f585",+ "_glued_call_objects": "2ba0b5cec868c00653aeebd0e48678fd93754cd7aa53413863588dd579e86bbc",+ "_inside_open_parameter": "0cc303e415fbe88cc5f2914011c71791d6489501f6ea3f3e44a0a92ad5046a1c",+ "_is_strict_json": "7ecf703016591ba701dc30dc753076275e320383df8fd35441e77e1f5bb9a828",+ "_iter_bracket_spans": "3831c80df3533df87b5d5ac4464a6c3e87973c0b515d3781f10b97b701d814d4",+ "_json_object_body": "5687db32c2b9cac18946a8dc12f94e3b215f5c5841b7e557e636e1afb51834b7",+ "_loads_wrapped_call": "eb9b2170a89e9f3af2d7d35c3d79a3b20fa60d8fd9df35fe1ddc97995a06decc",+ "_marker_coverage": "ded35d1b20c71a2af0b7d6f06982a0029b73044ae5f2220b75901c580545ad16",+ "_normalise_gemma_quoted_strings": "529117d9a4902a56d3b5111874552654b3e20692808f00571b2935cfa2b9b2e7",+ "_quote_gemma_array_elements": "8fdbbd0b163abe22a25b1b63df2a8394373c815f7012a1f3e9c522373d3d3364",+ "_quote_gemma_object_keys": "63efb40a333065ad60d6594d7f5804f2df6dd4078545af47f9fc0e4bcde6c5b8",+ "_relaxed_allowed_at": "9582e519c0c75710dec8864e7a1bbde0bc157bc44fc897265c1eb160232bb7fa",+ "_relaxed_object_end": "15450a68495604b9da65166e2129f88f1037ece1f6806fe692be736d6f0d0f9b",+ "_split_top_level_commas": "9833aa0ca5ea802a9bbfbeaa9855976cd8f50de259ecbf773e7e8ec96208437a",+ "_strip_bracket_tag_calls": "d0b5ac8e3d01d1d49d9a057b378ec9ab8bf61ea7dcd3d0eb6de0eefce5e5a3ac",+ "_strip_closed_blocks_outside_gemma": "3639f21fe1bf65899286650e7299c495c9331f7bf8e2a49a7b1090403952d1f9",+ "_strip_gemma_native_spans": "a4a8aa07826cfdd78f2442d0cb6d470aed514f19283d667fe6a90ac3163def8c",+ "_strip_markup_segment": "201529e1c4626c05447fb101f64c231de39c203649257b17acf5720ee18d8908",+ "_think_spans_outside_tool_markup": "89a7f8754421c28dd5c9559ac9d66825ebcb65178f97252e7d0f157a37e67fa2",+ "_tool_call_markup_spans": "2a9dc6bd620967703ac6a0d06a8b1ed3c739c8bf8ed589d3fdd6d05c06738f0a",+ "_trim_param_value": "34ea9c8573b5b932beafe71e494e1f6ddc929c451ee449b538050cbe4ce69fce",+ "apply_tool_strip_patterns": "7ac43d3f11dea1236269819f4eff57eb0b3cc0ee7e1479f9a85170a59998eb9c",+ "marker_coverage": "ded35d1b20c71a2af0b7d6f06982a0029b73044ae5f2220b75901c580545ad16",+ "parse_tool_calls_from_text": "08550eb10ff903b00d5bd961042546e5f80ecd42de97d3df522817e54bce37b6",+ "strip_outside_think": "56c95819bc8be33099a79ab72f88189e8e8e0cc43e0d6b1649456bcbf175a495",+ "strip_tool_call_markup": "92caecd45bad22ea9d173e7207823107a201acb974a25a8d204981829242896b",+ "strip_tool_patterns": "33623be71b543be7c4ebeb37c226b7a6ace3711c136d559e1340bd74bbdb97c4",+ "tag_mention_spans": "ec6a81d516905e2ac2b674f32268da96a959b5c90b736ae254203818b8f5189c"},- "corpus": "03bce2b8121055afd12bab57f8811206877d9fbbec3186b3ac5b3107b9e967b3"+ "corpus": "8785e9bc1cbf9dccb636cc8ba5397e47ab3cbd717a20b1a26cc96476e60d08e8"}diff --git a/studio/backend/tests/data/refactor_guard/runtime_inventory.json b/studio/backend/tests/data/refactor_guard/runtime_inventory.jsonindex b201c8cfe8b..2a783678257 100644--- a/studio/backend/tests/data/refactor_guard/runtime_inventory.json+++ b/studio/backend/tests/data/refactor_guard/runtime_inventory.json@@ -88,12 +88,17 @@"_MARKUP_OPENERS","_MAX_FENCE_CHARS","_MAX_GEMMA_PREFIX_TAIL",+ "_MINIMAX_BLOCK_CLOSE",+ "_MINIMAX_BLOCK_OPEN",+ "_MINIMAX_INVOKE_CLOSE",+ "_MINIMAX_INVOKE_OPEN_RE","_MISTRAL_ARGS_MARKER","_MISTRAL_CALL_ID_MARKER","_MISTRAL_THINK_CLOSE","_MISTRAL_THINK_OPEN","_MISTRAL_TRIGGER","_MISTRAL_V11_NAME_RE",+ "_MinimaxValueIndex","_ONE_STRING_ARG_CALL_RE","_OPEN_BODY_TRIGGERS","_OPEN_BODY_TRIGGER_MAX_LEN",@@ -163,6 +168,7 @@"_markerless_promotable","_mask_blocked_bodies","_merge_spans",+ "_minimax_block_spans","_mistral_region_end","_next_top_level_comma","_normalize_for_repeat",@@ -181,6 +187,7 @@"_parse_llama3_bare_json","_parse_llama3_kv_args","_parse_llama3_python_tag",+ "_parse_minimax_tool_calls","_parse_mistral_array","_parse_mistral_tool_calls","_parse_tool_call_json",@@ -197,6 +204,7 @@"_strip_gemma_wrapperless_calls","_strip_glm_calls","_strip_leading_code_fence",+ "_strip_minimax_calls","_strip_mistral_closed_calls","_strip_mistral_reasoning","_tool_healing",@@ -283,6 +291,7 @@"_markerless_promotable": "core.tool_healing._markerless_promotable(name, enabled_tool_names) -> 'bool'","_mask_blocked_bodies": "core.inference.tool_call_parser._mask_blocked_bodies(text: 'str', enabled_tool_names, *, think: 'bool' = False, mentions: 'bool' = False) -> 'tuple'","_merge_spans": "core.inference.tool_call_parser._merge_spans(spans: 'list') -> 'list'",+ "_minimax_block_spans": "core.inference.tool_call_parser._minimax_block_spans(text: 'str') -> 'list[tuple[int, int, bool]]'","_mistral_region_end": "core.inference.tool_call_parser._mistral_region_end(text: 'str', idx: 'int', *, open_envelope_runs_to_eof: 'bool' = False) -> 'int | None'","_next_top_level_comma": "core.inference.tool_call_parser._next_top_level_comma(text: 'str', start: 'int', end: 'int') -> \"'int | None'\"","_normalize_for_repeat": "core.inference.tool_call_parser._normalize_for_repeat(text: 'str') -> 'str'",@@ -301,6 +310,7 @@"_parse_llama3_bare_json": "core.inference.tool_call_parser._parse_llama3_bare_json(content: 'str', *, id_offset: 'int', allow_incomplete: 'bool' = True, enabled_tool_names: 'Optional[set]' = None) -> 'list[dict]'","_parse_llama3_kv_args": "core.inference.tool_call_parser._parse_llama3_kv_args(body: 'str') -> 'dict[str, Any]'","_parse_llama3_python_tag": "core.inference.tool_call_parser._parse_llama3_python_tag(content: 'str', *, id_offset: 'int', allow_incomplete: 'bool' = True) -> 'list[dict]'",+ "_parse_minimax_tool_calls": "core.inference.tool_call_parser._parse_minimax_tool_calls(content: 'str', *, id_offset: 'int', allow_incomplete: 'bool' = True) -> 'list[dict]'","_parse_mistral_array": "core.inference.tool_call_parser._parse_mistral_array(content: 'str', start: 'int', id_offset: 'int', allow_incomplete: 'bool' = True) -> 'list[dict]'","_parse_mistral_tool_calls": "core.inference.tool_call_parser._parse_mistral_tool_calls(content: 'str', *, id_offset: 'int', allow_incomplete: 'bool' = True) -> 'list[dict]'","_parse_tool_call_json": "core.inference.tool_call_parser._parse_tool_call_json(content: 'str', *, id_offset: 'int', allow_incomplete: 'bool' = True) -> 'list[dict]'",@@ -317,6 +327,7 @@"_strip_gemma_wrapperless_calls": "core.inference.tool_call_parser._strip_gemma_wrapperless_calls(text: 'str', enabled_tool_names: 'Optional[set]' = None) -> 'str'","_strip_glm_calls": "core.inference.tool_call_parser._strip_glm_calls(text: 'str', *, final: 'bool') -> 'str'","_strip_leading_code_fence": "core.inference.tool_call_parser._strip_leading_code_fence(text: 'str') -> 'str'",+ "_strip_minimax_calls": "core.inference.tool_call_parser._strip_minimax_calls(text: 'str', *, final: 'bool') -> 'str'","_strip_mistral_closed_calls": "core.inference.tool_call_parser._strip_mistral_closed_calls(text: 'str') -> 'str'","_strip_mistral_reasoning": "core.inference.tool_call_parser._strip_mistral_reasoning(content: 'str') -> 'str'","_top_level_args_values": "core.inference.tool_call_parser._top_level_args_values(text: 'str', start: 'int', end: 'int') -> 'list'",@@ -488,12 +499,12 @@"_tool_call_markup_spans": "core.tool_healing._tool_call_markup_spans(text: 'str') -> 'list[tuple[int, int]]'","_trim_param_value": "core.tool_healing._trim_param_value(val: 'str') -> 'str'","apply_tool_strip_patterns": "core.tool_healing.apply_tool_strip_patterns(text: 'str', patterns, enabled_tool_names=None) -> 'str'",+ "in_tag_mention": "core.tool_healing.in_tag_mention(spans, pos: 'int') -> 'bool'","marker_coverage": "core.tool_healing.marker_coverage(content: 'str') -> 'list[tuple[int, int]]'","parse_tool_calls_from_text": "core.tool_healing.parse_tool_calls_from_text(content: 'str', *, id_offset: 'int' = 0, allow_incomplete: 'bool' = True, enabled_tool_names=None, with_spans: 'bool' = False)","strip_outside_think": "core.tool_healing.strip_outside_think(text: 'str', strip_segment) -> 'str'","strip_tool_call_markup": "core.tool_healing.strip_tool_call_markup(text: 'str', *, final: 'bool' = False, enabled_tool_names=None) -> 'str'","strip_tool_patterns": "core.tool_healing.strip_tool_patterns(text: 'str', patterns) -> 'str'",- "in_tag_mention": "core.tool_healing.in_tag_mention(spans, pos: 'int') -> 'bool'","tag_mention_spans": "core.tool_healing.tag_mention_spans(text: 'str') -> 'list[tuple[int, int]]'"}}diff --git a/studio/backend/tests/test_minimax_text_tool_calls.py b/studio/backend/tests/test_minimax_text_tool_calls.pynew file mode 100644index 00000000000..002ec8c0827--- /dev/null+++ b/studio/backend/tests/test_minimax_text_tool_calls.py@@ -0,0 +1,391 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++"""MiniMax-M2 / M2.1 ``<minimax:tool_call>`` calls that reach Studio as text: llama-server leaves them+in content whenever its own tool parser does not run (tool_choice "none", the final answer pass)."""++import json+import random+import sys+import time+from pathlib import Path++import pytest++_TESTS_DIR = str(Path(__file__).resolve().parent)+_BACKEND_DIR = str(Path(__file__).resolve().parent.parent)+for _entry in (_BACKEND_DIR, _TESTS_DIR):+ if _entry not in sys.path:+ sys.path.insert(0, _entry)++from core.inference.chat_template_helpers import neutralize_control_markup # noqa: E402+from core import tool_healing # noqa: E402+from core.inference.tool_call_parser import ( # noqa: E402+ StreamingMarkupStripper,+ TOOL_XML_SIGNALS,+ _TC_PARAM_START_RE,+ _MinimaxValueIndex,+ parse_tool_calls_from_text,+ strip_tool_markup,+)+from test_llama_cpp_tool_loop import ( # noqa: E402+ _backend_and_payloads,+ _done,+ _record_tool_calls,+ _run_tool_loop,+ _sse,+)+++def _inside_minimax_value(text: str, pos: int) -> bool:+ return tool_healing._inside_open_parameter(+ text,+ pos,+ param_start_re = _TC_PARAM_START_RE,+ param_closers = ("</parameter>", "</param>"),+ func_closers = ("</invoke>", "</minimax:tool_call>"),+ )+++ENABLED = {"web_search", "python"}+SEARCH = (+ '<minimax:tool_call>\n<invoke name="web_search">\n'+ '<parameter name="query">weather in Paris</parameter>\n</invoke>\n</minimax:tool_call>'+)+++def _calls(text, **kwargs):+ return [+ (call["function"]["name"], json.loads(call["function"]["arguments"]))+ for call in parse_tool_calls_from_text(text, enabled_tool_names = ENABLED, **kwargs)+ ]+++def _streamed(text, enabled = ENABLED):+ stripper = StreamingMarkupStripper(enabled)+ out = ""+ for end in range(1, len(text) + 1):+ out = stripper.strip(text[:end])+ return out+++def test_a_well_formed_block_is_a_call():+ assert _calls(SEARCH) == [("web_search", {"query": "weather in Paris"})]+ assert _calls(SEARCH, allow_incomplete = False) == [("web_search", {"query": "weather in Paris"})]+++def test_the_block_opener_wakes_the_stream_buffer():+ assert "<minimax:tool_call>" in TOOL_XML_SIGNALS+++def test_the_compact_spelling_is_a_call():+ text = (+ '<minimax:tool_call><invoke name="web_search"><parameter name="query">weather in Paris'+ "</parameter></invoke></minimax:tool_call>"+ )+ assert _calls(text) == [("web_search", {"query": "weather in Paris"})]+++ "text",+ [+ SEARCH[: -len("</minimax:tool_call>")],+ SEARCH[: -len("</invoke>\n</minimax:tool_call>")],+ SEARCH[: -len("</parameter>\n</invoke>\n</minimax:tool_call>")],+ ],+ ids = ["no_block_close", "no_invoke_close", "no_parameter_close"],+)+def test_a_truncated_block_heals_and_strict_mode_keeps_only_closed_invokes(text):+ assert _calls(text) == [("web_search", {"query": "weather in Paris"})]+ strict = _calls(text, allow_incomplete = False)+ if text.rstrip().endswith("</invoke>"):+ assert strict == [("web_search", {"query": "weather in Paris"})]+ else:+ assert strict == []+++def test_two_invokes_and_two_blocks_are_two_calls():+ second = '<invoke name="python">\n<parameter name="code">print(1 + 1)</parameter>\n</invoke>\n'+ one_block = SEARCH.replace("</invoke>\n", "</invoke>\n" + second)+ two_blocks = SEARCH + "\n<minimax:tool_call>\n" + second + "</minimax:tool_call>"+ expected = [+ ("web_search", {"query": "weather in Paris"}),+ ("python", {"code": "print(1 + 1)"}),+ ]+ assert _calls(one_block) == expected+ assert _calls(two_blocks) == expected+++def test_a_multiline_code_value_keeps_its_text():+ code = 'a, b = 1, 2\nif a < b:\n print("a < b </invoke>")'+ text = (+ '<minimax:tool_call>\n<invoke name="python">\n<parameter name="code">'+ + code+ + "\n</parameter>\n</invoke>\n</minimax:tool_call>"+ )+ assert _calls(text) == [("python", {"code": code})]+ assert strip_tool_markup("Running it.\n" + text, final = True, enabled_tool_names = ENABLED) == (+ "Running it."+ )+++ "code",+ [+ 'print("<think>hello</think>")',+ 'print("</minimax:tool_call><think>hello</think>")',+ 'call:python{"code":"print(1)"}',+ 'python[ARGS]{"code":"print(1)"}',+ ],+ ids = ["think", "closer_then_think", "gemma_example", "rehearsal_example"],+)+def test_a_think_tag_in_a_value_is_argument_text(code):+ from routes.inference import _strip_tool_xml_for_display++ text = (+ 'Running it.\n<minimax:tool_call>\n<invoke name="python">\n<parameter name="code">'+ + code+ + "</parameter>\n</invoke>\n</minimax:tool_call>"+ )+ assert _calls(text) == [("python", {"code": code})]+ assert strip_tool_markup(text, final = True, enabled_tool_names = ENABLED) == "Running it."+ assert _streamed(text).strip() == "Running it."+ shown = _strip_tool_xml_for_display(text, auto_heal_tool_calls = True, enabled_tool_names = ENABLED)+ assert shown.strip() == "Running it."++[email protected]("literal", ["</think>", "<think>"], ids = ["closer", "opener"])+def test_a_think_tag_in_one_block_leaves_its_sibling_running(literal):+ code = 'print("' + literal + '")'+ python = SEARCH.replace("web_search", "python").replace(+ '<parameter name="query">weather in Paris', '<parameter name="code">' + code+ )+ calls = [("web_search", {"query": "weather in Paris"}), ("python", {"code": code})]+ assert _calls(SEARCH + "\n" + python) == calls+ assert _calls(python + "\n" + SEARCH) == calls[::-1]+++def test_values_stay_strings_like_the_function_xml_form():+ text = SEARCH.replace("</invoke>", '<parameter name="max_results">5</parameter>\n</invoke>')+ assert _calls(text) == [("web_search", {"query": "weather in Paris", "max_results": "5"})]+++def test_a_block_inside_reasoning_is_not_run():+ rehearsal = SEARCH.replace("web_search", "python").replace("query", "code")+ assert _calls("<think>I could do " + rehearsal + " instead</think>\n" + SEARCH) == [+ ("web_search", {"query": "weather in Paris"})+ ]+ # The template opens <think> in the prompt, so only a stray closer marks the reasoning.+ assert _calls("I could do " + rehearsal + "\n</think>\n\n" + SEARCH) == [+ ("web_search", {"query": "weather in Paris"})+ ]+ assert _calls("<think>I could do " + rehearsal) == []+++def test_the_displayed_answer_drops_the_block_and_keeps_the_prose():+ text = "Let me look that up.\n" + SEARCH+ assert strip_tool_markup(text, final = True, enabled_tool_names = ENABLED) == "Let me look that up."+ assert _streamed(text).strip() == "Let me look that up."+ # An unclosed block at the end of the turn is a truncated call, not prose.+ truncated = text[: -len("</invoke>\n</minimax:tool_call>")]+ assert strip_tool_markup(truncated, final = True, enabled_tool_names = ENABLED) == (+ "Let me look that up."+ )+ # Mid-stream (final answer pass) a closed block goes and an open one stays buffered.+ assert strip_tool_markup(text + "\nDone.") == "Let me look that up.\n\nDone."+++def test_a_quoted_block_inside_another_call_stays_data():+ qwen = (+ '<tool_call>{"name": "python", "arguments": {"code": '+ + json.dumps("s = '" + SEARCH + "'")+ + "}}</tool_call>"+ )+ assert [name for name, _ in _calls(qwen)] == ["python"]+ function_xml = (+ "<function=python><parameter=code>s = '''" + SEARCH + "'''</parameter></function>"+ )+ assert _calls(function_xml) == [("python", {"code": "s = '''" + SEARCH + "'''"})]+++def test_prose_naming_the_format_is_left_alone():+ text = 'MiniMax writes calls as `<invoke name="x">` blocks.'+ assert _calls(text) == []+ assert strip_tool_markup(text, final = True, enabled_tool_names = ENABLED) == text+ assert _streamed(text) == text+++def test_a_backticked_block_tag_is_prose_and_a_real_block_after_it_still_runs():+ from routes.inference import _strip_tool_xml_for_display+ mention = "Using the `<minimax:tool_call>` format, closed by `</minimax:tool_call>`."+ for text, shown, calls in (+ (mention, mention, []),+ (mention + "\n" + SEARCH, mention, [("web_search", {"query": "weather in Paris"})]),+ ):+ assert _calls(text) == calls+ assert strip_tool_markup(text, final = True, enabled_tool_names = ENABLED) == shown+ assert _streamed(text).strip() == shown+ route = _strip_tool_xml_for_display(+ text, auto_heal_tool_calls = True, enabled_tool_names = ENABLED+ )+ assert route.strip() == shown+++def test_a_pasted_block_opener_is_neutralized():+ assert "<minimax:tool_call>" not in neutralize_control_markup("a " + SEARCH + " b")+ assert "</minimax:tool_call>" not in neutralize_control_markup("a " + SEARCH + " b")+++def _content_snapshots(events):+ """Content events are cumulative snapshots of the visible answer."""+ return [event.get("text", "") for event in events if event.get("type") == "content"]++[email protected]("chunk", [None, 7], ids = ["one_delta", "seven_char_deltas"])+def test_the_gguf_tool_loop_runs_a_text_block_and_hides_it(monkeypatch, chunk):+ reply = "Let me look that up.\n" + SEARCH+ pieces = (+ [reply] if chunk is None else [reply[i : i + chunk] for i in range(0, len(reply), chunk)]+ )+ streams = [+ [_sse({"content": piece}) for piece in pieces] + [_done()],+ [_sse({"content": "It is sunny."}), _done()],+ ]+ backend, _payloads = _backend_and_payloads(monkeypatch, streams)+ calls = _record_tool_calls(monkeypatch, "result")++ events = _run_tool_loop(+ backend,+ [{"role": "user", "content": "weather in Paris?"}],+ [{"type": "function", "function": {"name": "web_search"}}],+ )++ assert calls == [("web_search", {"query": "weather in Paris"})]+ snapshots = _content_snapshots(events)+ # A half-streamed opener can show for one snapshot, as with every other format; a complete one never does.+ assert not any(+ "<minimax:tool_call>" in text or "<invoke" in text for text in snapshots+ ), snapshots+ assert "Let me look that up." in snapshots[-2]+ assert snapshots[-1] == "It is sunny."+++def test_the_value_index_answers_like_the_shared_helper():+ """The parser asks the index, not the per-tag scan; both must agree on every offset."""+ rng = random.Random(0)+ pieces = (+ "<minimax:tool_call>",+ "</minimax:tool_call>",+ '<invoke name="python">',+ "</invoke>",+ '<parameter name="code">',+ "<parameter=code>",+ '<param name="x">',+ "</parameter>",+ "</param>",+ "<param",+ " ",+ "\n",+ "a",+ "<",+ ">",+ )+ for _ in range(400):+ text = "".join(rng.choice(pieces) for _ in range(rng.randint(0, 24)))+ index = _MinimaxValueIndex(text)+ for pos in range(len(text) + 1):+ assert index.inside(pos) == _inside_minimax_value(text, pos), (text, pos)+++ "text",+ [+ '<parameter name="p">' + "<minimax:tool_call>" * 50000,+ '<minimax:tool_call><invoke name="python"><parameter name="code">'+ + '<invoke name="a">' * 50000,+ '<minimax:tool_call><invoke name="python">' + '<parameter name="p">' * 50000,+ "<think>a</think>" * 30000 + SEARCH * 3000,+ ],+ ids = ["openers_in_a_value", "invokes_in_a_value", "unclosed_params", "think_spans"],+)+def test_a_megabyte_of_adversarial_markup_parses_in_linear_time(text):+ start = time.perf_counter()+ parse_tool_calls_from_text(text, enabled_tool_names = ENABLED)+ strip_tool_markup(text, final = True, enabled_tool_names = ENABLED)+ assert time.perf_counter() - start < 5.0+++def _client_view(events, strip):+ """What the GGUF streaming route sends: each cumulative event goes through the display strip and only the+ growth is forwarded (append-only); an empty status or a tool_start starts a new turn."""+ shown, prev = "", ""+ for event in events:+ if event.get("type") == "tool_start" or (+ event.get("type") == "status" and not event.get("text")+ ):+ prev = ""+ elif event.get("type") == "content":+ clean = strip.strip(event.get("text", ""))+ shown += clean[len(prev) :]+ prev = clean+ return shown++[email protected]("closed", [True, False], ids = ["closed", "unclosed"])+def test_the_route_display_strip_hides_a_block(closed):+ from routes.inference import _strip_tool_xml_for_display++ text = "Let me look that up.\n" + (SEARCH if closed else SEARCH[: -len("</minimax:tool_call>")])+ shown = _strip_tool_xml_for_display(text, auto_heal_tool_calls = True, enabled_tool_names = ENABLED)+ assert shown == "Let me look that up.\n"+ prose = 'MiniMax writes calls as `<invoke name="x">` blocks.'+ assert (+ _strip_tool_xml_for_display(prose, auto_heal_tool_calls = True, enabled_tool_names = ENABLED)+ == prose+ )+++def test_a_block_in_the_final_answer_pass_never_reaches_the_client(monkeypatch):+ """The capped final pass sends tool_choice "none", so llama-server leaves the block in content; its+ streaming stripper keeps an open block and the route forwards growth only, so the route must hide it."""+ from routes.inference import _StreamingDisplayStrip++ reply = "Let me look that up.\n" + SEARCH+ streams = [+ [+ _sse(+ {+ "tool_calls": [+ {+ "index": 0,+ "id": "call_1",+ "type": "function",+ "function": {+ "name": "web_search",+ "arguments": json.dumps({"query": "weather in Paris"}),+ },+ }+ ]+ }+ ),+ _done(),+ ],+ [_sse({"content": reply[i : i + 7]}) for i in range(0, len(reply), 7)] + [_done()],+ ]+ backend, payloads = _backend_and_payloads(monkeypatch, streams)+ calls = _record_tool_calls(monkeypatch, "result")++ events = _run_tool_loop(+ backend,+ [{"role": "user", "content": "weather in Paris?"}],+ [{"type": "function", "function": {"name": "web_search"}}],+ )++ assert payloads[-1].get("tool_choice") == "none"+ assert calls == [("web_search", {"query": "weather in Paris"})]+ shown = _client_view(+ events, _StreamingDisplayStrip(auto_heal_tool_calls = True, enabled_tool_names = ENABLED)+ )+ assert "Let me look that up." in shown+ assert "<invoke" not in shown and "<parameter" not in shown, shown+ assert "</minimax:tool_call>" not in shown, showndiff --git a/studio/backend/tests/test_streaming_display_strip.py b/studio/backend/tests/test_streaming_display_strip.pyindex 4dac01640e4..8f87690e39d 100644--- a/studio/backend/tests/test_streaming_display_strip.py+++ b/studio/backend/tests/test_streaming_display_strip.py@@ -32,6 +32,10 @@ _TRANSCRIPTS = [_PROSE + "so we call : python with args" + _PROSE,_PROSE + "recall: this is prose, not a call" + _PROSE,"<think>" + _PROSE + '<tool_call>{"name": "python"}</tool_call></think>' + _PROSE,+ _PROSE+ + '<minimax:tool_call>\n<invoke name="python">\n<parameter name="code">print(6)</parameter>\n</invoke>\n'+ + "</minimax:tool_call>"+ + _PROSE,]diff --git a/studio/backend/tests/test_tool_xml_strip.py b/studio/backend/tests/test_tool_xml_strip.pyindex 9079f5e9494..b418bf09308 100644--- a/studio/backend/tests/test_tool_xml_strip.py+++ b/studio/backend/tests/test_tool_xml_strip.py@@ -32,6 +32,7 @@ from core.inference.tool_call_parser import (_strip_function_xml_calls,_strip_gemma_wrapperless_calls,_strip_glm_calls,+ _strip_minimax_calls,_strip_mistral_closed_calls,)@@ -46,6 +47,7 @@ _ns = {"_strip_mistral_closed_calls": _strip_mistral_closed_calls,"_strip_gemma_wrapperless_calls": _strip_gemma_wrapperless_calls,"_strip_glm_calls": _strip_glm_calls,+ "_strip_minimax_calls": _strip_minimax_calls,"_strip_function_xml_calls": _strip_function_xml_calls,}exec(f"_TOOL_XML_RE = _re.compile({_m.group(1)})", _ns)diff --git a/studio/backend/tests/tools/refactor_guard.py b/studio/backend/tests/tools/refactor_guard.pyindex d886e3122bd..7ca612716c1 100644--- a/studio/backend/tests/tools/refactor_guard.py+++ b/studio/backend/tests/tools/refactor_guard.py@@ -183,6 +183,9 @@ _FRAGMENTS = ('<|tool_call_argument_begin|>{"city": "Paris"}<|tool_call_end|>'"<|tool_calls_section_end|>","<tool_call>get_weather\n<arg_key>city</arg_key>\n<arg_value>Paris</arg_value>\n</tool_call>",+ '<minimax:tool_call>\n<invoke name="get_weather">\n<parameter name="city">Paris</parameter>\n'+ "</invoke>\n</minimax:tool_call>",+ '<minimax:tool_call>\n<invoke name="get_weather">\n<parameter name="city">Par',# Cross-format markup, so an arm swap inside strip_segment is visible."<function=x><tool_call> txt <arg_key>c</arg_key></function><parameter=p>",'<tool_call>{"name": "search", "arguments": {"q": "<function=get_weather>"}}</tool_call>',