feat: add multi-engine regex flavour support

This commit is contained in:
2026-07-27 11:43:51 +02:00
parent 7079cde15f
commit 7f3a91ad37
340 changed files with 643286 additions and 483 deletions

View File

@@ -5,6 +5,7 @@ Pyodide runtime starts. User-controlled values are passed as function
arguments; they are never evaluated as Python source.
"""
import base64
import json
import re
import sys
@@ -256,9 +257,16 @@ def _regex_tools_run(
"resultsTruncated": results_truncated,
}
if operation == "replace":
output = "".join(output_chunks).encode("utf-8")
if len(output) != output_bytes:
return _error(
"bridge",
"output-byte-count-mismatch",
"The bounded Python output byte count is inconsistent.",
)
result.update(
{
"output": "".join(output_chunks),
"outputBase64": base64.b64encode(output).decode("ascii"),
"outputBytes": output_bytes,
"outputTruncated": output_truncated,
}