@miller-tech/uap 1.96.6 → 1.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/benchmarks/paired/adapter.d.ts +15 -0
- package/dist/benchmarks/paired/adapter.d.ts.map +1 -1
- package/dist/benchmarks/paired/adapter.js +79 -20
- package/dist/benchmarks/paired/adapter.js.map +1 -1
- package/dist/benchmarks/paired/types.d.ts +9 -0
- package/dist/benchmarks/paired/types.d.ts.map +1 -1
- package/dist/benchmarks/paired/types.js +9 -0
- package/dist/benchmarks/paired/types.js.map +1 -1
- package/dist/bin/cli.js +4 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/bench.d.ts +2 -0
- package/dist/cli/bench.d.ts.map +1 -1
- package/dist/cli/bench.js +8 -2
- package/dist/cli/bench.js.map +1 -1
- package/dist/cli/deliver.d.ts +4 -0
- package/dist/cli/deliver.d.ts.map +1 -1
- package/dist/cli/deliver.js +88 -12
- package/dist/cli/deliver.js.map +1 -1
- package/dist/cli/verify.d.ts +6 -0
- package/dist/cli/verify.d.ts.map +1 -1
- package/dist/cli/verify.js +37 -2
- package/dist/cli/verify.js.map +1 -1
- package/dist/delivery/decompose.d.ts +9 -0
- package/dist/delivery/decompose.d.ts.map +1 -1
- package/dist/delivery/decompose.js +38 -4
- package/dist/delivery/decompose.js.map +1 -1
- package/dist/delivery/index.d.ts +2 -0
- package/dist/delivery/index.d.ts.map +1 -1
- package/dist/delivery/index.js +2 -0
- package/dist/delivery/index.js.map +1 -1
- package/dist/delivery/vision-judge.d.ts +28 -0
- package/dist/delivery/vision-judge.d.ts.map +1 -0
- package/dist/delivery/vision-judge.js +98 -0
- package/dist/delivery/vision-judge.js.map +1 -0
- package/dist/delivery/visual-gate.d.ts +112 -0
- package/dist/delivery/visual-gate.d.ts.map +1 -0
- package/dist/delivery/visual-gate.js +292 -0
- package/dist/delivery/visual-gate.js.map +1 -0
- package/dist/models/openai-compat-client.d.ts +1 -0
- package/dist/models/openai-compat-client.d.ts.map +1 -1
- package/dist/models/openai-compat-client.js +4 -0
- package/dist/models/openai-compat-client.js.map +1 -1
- package/package.json +1 -1
- package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
- package/src/policies/schemas/policies/visual-verification.md +52 -0
- package/tools/agents/config/json-response.gbnf +7 -0
- package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-312.pyc +0 -0
- package/tools/agents/scripts/anthropic_proxy.py +56 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
root ::= object | array
|
|
2
|
+
value ::= object | array | string | number | ("true" | "false" | "null") ws
|
|
3
|
+
object ::= "{" ws ( string ":" ws value ("," ws string ":" ws value)* )? "}" ws
|
|
4
|
+
array ::= "[" ws ( value ("," ws value)* )? "]" ws
|
|
5
|
+
string ::= "\"" ( [^"\\\x7F\x00-\x1F] | "\\" (["\\bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) )* "\"" ws
|
|
6
|
+
number ::= ("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? ws
|
|
7
|
+
ws ::= [ \t\n]*
|
|
Binary file
|
|
@@ -829,6 +829,55 @@ def _load_thinking_grammar(path: str) -> str:
|
|
|
829
829
|
|
|
830
830
|
THINKING_GBNF = _load_thinking_grammar(PROXY_THINKING_GRAMMAR_PATH)
|
|
831
831
|
|
|
832
|
+
# JSON-response grammar (evaluator verdicts): when a client marks a no-tool
|
|
833
|
+
# request with the x-uap-json-response header, constrain sampling to a bare
|
|
834
|
+
# JSON value. Kills the "<think> ate the verdict / unparseable judgment"
|
|
835
|
+
# failure class at the decoder. Default on; PROXY_JSON_RESPONSE_GRAMMAR=off.
|
|
836
|
+
PROXY_JSON_RESPONSE_GRAMMAR = os.environ.get(
|
|
837
|
+
"PROXY_JSON_RESPONSE_GRAMMAR", "on"
|
|
838
|
+
).lower() not in {"0", "false", "off", "no"}
|
|
839
|
+
PROXY_JSON_RESPONSE_GRAMMAR_PATH = os.path.abspath(
|
|
840
|
+
os.environ.get(
|
|
841
|
+
"PROXY_JSON_RESPONSE_GRAMMAR_PATH",
|
|
842
|
+
os.path.join(os.path.dirname(__file__), "..", "config", "json-response.gbnf"),
|
|
843
|
+
)
|
|
844
|
+
)
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
def _load_json_response_grammar(path: str) -> str:
|
|
848
|
+
if not PROXY_JSON_RESPONSE_GRAMMAR:
|
|
849
|
+
return ""
|
|
850
|
+
try:
|
|
851
|
+
with open(path, "r", encoding="utf-8") as fh:
|
|
852
|
+
return fh.read().strip()
|
|
853
|
+
except OSError as exc:
|
|
854
|
+
logger.warning("JSON-response grammar disabled: failed to read %s (%s)", path, exc)
|
|
855
|
+
return ""
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
JSON_RESPONSE_GBNF = _load_json_response_grammar(PROXY_JSON_RESPONSE_GRAMMAR_PATH)
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
def _apply_json_response_grammar(openai_body: dict, anthropic_body: dict) -> None:
|
|
862
|
+
"""Constrain a marked no-tool request to emit a bare JSON value.
|
|
863
|
+
|
|
864
|
+
Fires only when the client tagged the request (x-uap-json-response, staged
|
|
865
|
+
into the body as _uap_json_response), there are no tools, the grammar
|
|
866
|
+
loaded, and nothing upstream set a grammar already. Thinking is forced off
|
|
867
|
+
— the grammar forbids a <think> preamble by construction.
|
|
868
|
+
"""
|
|
869
|
+
if not anthropic_body.get("_uap_json_response"):
|
|
870
|
+
return
|
|
871
|
+
if not JSON_RESPONSE_GBNF:
|
|
872
|
+
return
|
|
873
|
+
if openai_body.get("tools") or openai_body.get("grammar"):
|
|
874
|
+
return
|
|
875
|
+
openai_body["grammar"] = JSON_RESPONSE_GBNF
|
|
876
|
+
openai_body["enable_thinking"] = False
|
|
877
|
+
ctk = openai_body.setdefault("chat_template_kwargs", {})
|
|
878
|
+
ctk["enable_thinking"] = False
|
|
879
|
+
logger.info("JSON-RESPONSE grammar applied (evaluator verdict turn)")
|
|
880
|
+
|
|
832
881
|
|
|
833
882
|
def _apply_thinking_grammar(request_body: dict) -> None:
|
|
834
883
|
"""Apply the structured-thinking GBNF grammar to non-tool turns.
|
|
@@ -4799,6 +4848,8 @@ def build_openai_request(
|
|
|
4799
4848
|
|
|
4800
4849
|
_apply_thinking_grammar(openai_body)
|
|
4801
4850
|
|
|
4851
|
+
_apply_json_response_grammar(openai_body, anthropic_body)
|
|
4852
|
+
|
|
4802
4853
|
# qwen3.5-enhanced.jinja (the MTP/130 config template) rejects an assistant
|
|
4803
4854
|
# PREFILL (trailing assistant message) unless thinking is disabled VIA
|
|
4804
4855
|
# chat_template_kwargs — the top-level `enable_thinking` flag is not read by
|
|
@@ -8803,6 +8854,11 @@ async def messages(request: Request):
|
|
|
8803
8854
|
model = body.get("model", "default")
|
|
8804
8855
|
client_id = resolve_client_id(request)
|
|
8805
8856
|
|
|
8857
|
+
# Evaluator-verdict marker: clients tag JSON-only completions via header;
|
|
8858
|
+
# stage it into the body so build_openai_request can grammar-constrain it.
|
|
8859
|
+
if request.headers.get("x-uap-json-response"):
|
|
8860
|
+
body["_uap_json_response"] = True
|
|
8861
|
+
|
|
8806
8862
|
# Periodically re-detect context window from upstream (handles server restarts)
|
|
8807
8863
|
await _maybe_recheck_context_window()
|
|
8808
8864
|
|