@rulemetric/proxy 0.7.18 → 0.7.20

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.
@@ -16,6 +16,7 @@
16
16
  "allow": [
17
17
  "(^|\\.)api\\.anthropic\\.com:",
18
18
  "(^|\\.)generativelanguage\\.googleapis\\.com:",
19
+ "(^|[.-])cloudcode-pa\\.googleapis\\.com:",
19
20
  "bedrock-runtime[^:]*:",
20
21
  "\\.snowflakecomputing\\.com:",
21
22
  "(^|\\.)copilot-proxy\\.githubusercontent\\.com:",
@@ -622,6 +622,39 @@ class RuleMetricAddon:
622
622
 
623
623
  def request(self, flow: http.HTTPFlow) -> None:
624
624
  """Called for each HTTP request passing through the proxy."""
625
+ # Endpoint-discovery probe for Antigravity / Gemini Code Assist.
626
+ #
627
+ # Antigravity routes LLM traffic to cloudcode-pa.googleapis.com with
628
+ # `/v1internal:<method>` paths, and mitmproxy's console log truncates
629
+ # the method name (`v1internal:fe…`), so we cannot tell a metadata call
630
+ # from a generation call — which is exactly what blocks writing the
631
+ # parser (plan 2026-06-02). Static discovery does NOT work: neither the
632
+ # app bundle nor the 118 MB language_server binary contains the literal
633
+ # strings (checked 2026-07-19), so the method names are built at
634
+ # runtime. This logs the untruncated URL + body size for one live
635
+ # session so the parser can be written against the real shape.
636
+ #
637
+ # Deliberately placed BEFORE the `flow.request.stream` early-return:
638
+ # generation calls are the ones most likely to be streamed, so a probe
639
+ # after that check would silently skip the exact traffic we need.
640
+ # Off unless RULEMETRIC_PROXY_DEBUG_CLOUDCODE=1; delete once the parser
641
+ # lands.
642
+ if os.environ.get("RULEMETRIC_PROXY_DEBUG_CLOUDCODE") == "1":
643
+ try:
644
+ if "cloudcode-pa.googleapis.com" in flow.request.pretty_host:
645
+ body_len = 0 if flow.request.stream else len(flow.request.raw_content or b"")
646
+ logger.warning(
647
+ "[cloudcode-probe] %s https://%s%s streamed=%s body_bytes=%d ctype=%s",
648
+ flow.request.method,
649
+ flow.request.pretty_host,
650
+ flow.request.path,
651
+ bool(flow.request.stream),
652
+ body_len,
653
+ flow.request.headers.get("content-type", "-"),
654
+ )
655
+ except Exception as exc: # never let a probe break capture
656
+ logger.warning("[cloudcode-probe] failed: %s", exc)
657
+
625
658
  # Streamed flows have no buffered body to read — and by construction
626
659
  # they're flows we don't parse anyway.
627
660
  if flow.request.stream:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulemetric/proxy",
3
- "version": "0.7.18",
3
+ "version": "0.7.20",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"