Reasoning models (e.g. foundation-sec-8b) emit valid JSON then repeat it inside a markdown fence block. json.loads() fails on the combined text. extract_first_json_array() scans for the first '[' and walks to its matching ']' with proper string/escape/nesting handling, then returns just that slice. Combined with strip_json_fences(), this handles all observed output patterns: - bare JSON array (standard models) - fenced JSON array (fence-wrapping models) - bare array followed by fenced repeat (reasoning models) |
||
|---|---|---|
| .. | ||
| api | ||
| context | ||
| glean | ||
| services | ||
| tasks | ||
| watch | ||
| __init__.py | ||
| mcp_server.py | ||
| rest.py | ||