@jsonstudio/rcc 0.89.683 → 0.89.873
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/build-info.js +2 -2
- package/dist/cli.js +164 -116
- package/dist/cli.js.map +1 -1
- package/dist/client/anthropic/anthropic-protocol-client.js +42 -1
- package/dist/client/anthropic/anthropic-protocol-client.js.map +1 -1
- package/dist/client/gemini-cli/gemini-cli-protocol-client.js +4 -1
- package/dist/client/gemini-cli/gemini-cli-protocol-client.js.map +1 -1
- package/dist/commands/camoufox-backfill.d.ts +2 -0
- package/dist/commands/camoufox-backfill.js +33 -0
- package/dist/commands/camoufox-backfill.js.map +1 -0
- package/dist/commands/camoufox-fp.d.ts +2 -0
- package/dist/commands/camoufox-fp.js +86 -0
- package/dist/commands/camoufox-fp.js.map +1 -0
- package/dist/commands/oauth.d.ts +2 -0
- package/dist/commands/oauth.js +170 -0
- package/dist/commands/oauth.js.map +1 -0
- package/dist/commands/provider-update.js +439 -2
- package/dist/commands/provider-update.js.map +1 -1
- package/dist/commands/quota-status.d.ts +2 -0
- package/dist/commands/quota-status.js +80 -0
- package/dist/commands/quota-status.js.map +1 -0
- package/dist/commands/token-daemon.js +12 -1
- package/dist/commands/token-daemon.js.map +1 -1
- package/dist/config/provider-v2-loader.d.ts +16 -0
- package/dist/config/provider-v2-loader.js +84 -0
- package/dist/config/provider-v2-loader.js.map +1 -0
- package/dist/config/routecodex-config-loader.js +27 -4
- package/dist/config/routecodex-config-loader.js.map +1 -1
- package/dist/config/system-prompts/codex-cli.txt +1 -0
- package/dist/config/virtual-router-builder.d.ts +9 -0
- package/dist/config/virtual-router-builder.js +34 -0
- package/dist/config/virtual-router-builder.js.map +1 -0
- package/dist/config/virtual-router-types.d.ts +25 -0
- package/dist/config/virtual-router-types.js +30 -0
- package/dist/config/virtual-router-types.js.map +1 -0
- package/dist/manager/index.d.ts +10 -0
- package/dist/manager/index.js +27 -0
- package/dist/manager/index.js.map +1 -0
- package/dist/manager/modules/health/index.d.ts +22 -0
- package/dist/manager/modules/health/index.js +82 -0
- package/dist/manager/modules/health/index.js.map +1 -0
- package/dist/manager/modules/quota/index.d.ts +57 -0
- package/dist/manager/modules/quota/index.js +426 -0
- package/dist/manager/modules/quota/index.js.map +1 -0
- package/dist/manager/modules/routing/index.d.ts +17 -0
- package/dist/manager/modules/routing/index.js +61 -0
- package/dist/manager/modules/routing/index.js.map +1 -0
- package/dist/manager/modules/token/index.d.ts +10 -0
- package/dist/manager/modules/token/index.js +58 -0
- package/dist/manager/modules/token/index.js.map +1 -0
- package/dist/manager/storage/base-store.d.ts +6 -0
- package/dist/manager/storage/base-store.js +2 -0
- package/dist/manager/storage/base-store.js.map +1 -0
- package/dist/manager/storage/file-store.d.ts +25 -0
- package/dist/manager/storage/file-store.js +117 -0
- package/dist/manager/storage/file-store.js.map +1 -0
- package/dist/manager/types.d.ts +9 -0
- package/dist/manager/types.js +2 -0
- package/dist/manager/types.js.map +1 -0
- package/dist/message-center/index.d.ts +5 -0
- package/dist/message-center/index.js +6 -0
- package/dist/message-center/index.js.map +1 -0
- package/dist/message-center/message-center.d.ts +93 -0
- package/dist/message-center/message-center.js +189 -0
- package/dist/message-center/message-center.js.map +1 -0
- package/dist/providers/auth/antigravity-userinfo-helper.d.ts +2 -0
- package/dist/providers/auth/antigravity-userinfo-helper.js +102 -0
- package/dist/providers/auth/antigravity-userinfo-helper.js.map +1 -1
- package/dist/providers/auth/iflow-cookie-auth.d.ts +27 -0
- package/dist/providers/auth/iflow-cookie-auth.js +209 -0
- package/dist/providers/auth/iflow-cookie-auth.js.map +1 -0
- package/dist/providers/auth/oauth-lifecycle.js +29 -22
- package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
- package/dist/providers/auth/token-scanner/index.js +16 -1
- package/dist/providers/auth/token-scanner/index.js.map +1 -1
- package/dist/providers/core/config/camoufox-launcher.d.ts +16 -0
- package/dist/providers/core/config/camoufox-launcher.js +314 -0
- package/dist/providers/core/config/camoufox-launcher.js.map +1 -0
- package/dist/providers/core/config/oauth-flows.d.ts +9 -0
- package/dist/providers/core/config/oauth-flows.js +50 -19
- package/dist/providers/core/config/oauth-flows.js.map +1 -1
- package/dist/providers/core/config/provider-oauth-configs.d.ts +6 -0
- package/dist/providers/core/config/provider-oauth-configs.js +12 -0
- package/dist/providers/core/config/provider-oauth-configs.js.map +1 -1
- package/dist/providers/core/config/service-profiles.js +26 -3
- package/dist/providers/core/config/service-profiles.js.map +1 -1
- package/dist/providers/core/runtime/antigravity-quota-client.d.ts +10 -0
- package/dist/providers/core/runtime/antigravity-quota-client.js +88 -0
- package/dist/providers/core/runtime/antigravity-quota-client.js.map +1 -0
- package/dist/providers/core/runtime/base-provider.d.ts +2 -1
- package/dist/providers/core/runtime/base-provider.js +93 -34
- package/dist/providers/core/runtime/base-provider.js.map +1 -1
- package/dist/providers/core/runtime/gemini-cli-http-provider.js +42 -10
- package/dist/providers/core/runtime/gemini-cli-http-provider.js.map +1 -1
- package/dist/providers/core/runtime/http-request-executor.js +24 -0
- package/dist/providers/core/runtime/http-request-executor.js.map +1 -1
- package/dist/providers/core/runtime/http-transport-provider.d.ts +0 -3
- package/dist/providers/core/runtime/http-transport-provider.js +32 -136
- package/dist/providers/core/runtime/http-transport-provider.js.map +1 -1
- package/dist/providers/core/runtime/provider-error-classifier.js +18 -10
- package/dist/providers/core/runtime/provider-error-classifier.js.map +1 -1
- package/dist/providers/core/runtime/rate-limit-manager.d.ts +6 -0
- package/dist/providers/core/runtime/rate-limit-manager.js +23 -0
- package/dist/providers/core/runtime/rate-limit-manager.js.map +1 -1
- package/dist/providers/core/strategies/oauth-auth-code-flow.d.ts +1 -0
- package/dist/providers/core/strategies/oauth-auth-code-flow.js +3 -2
- package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
- package/dist/providers/core/strategies/oauth-device-flow.d.ts +1 -0
- package/dist/providers/core/strategies/oauth-device-flow.js +3 -2
- package/dist/providers/core/strategies/oauth-device-flow.js.map +1 -1
- package/dist/providers/core/strategies/oauth-hybrid-flow.d.ts +1 -0
- package/dist/providers/core/strategies/oauth-hybrid-flow.js +3 -2
- package/dist/providers/core/strategies/oauth-hybrid-flow.js.map +1 -1
- package/dist/providers/core/utils/http-client.js +43 -1
- package/dist/providers/core/utils/http-client.js.map +1 -1
- package/dist/providers/mock/mock-provider-runtime.js +4 -4
- package/dist/providers/mock/mock-provider-runtime.js.map +1 -1
- package/dist/providers/profile/provider-profile-loader.js +13 -1
- package/dist/providers/profile/provider-profile-loader.js.map +1 -1
- package/dist/providers/profile/provider-profile.d.ts +5 -0
- package/dist/scripts/camoufox/gen-fingerprint-env.py +171 -0
- package/dist/scripts/camoufox/launch-auth.mjs +617 -0
- package/dist/server/runtime/http-server/executor-provider.d.ts +1 -0
- package/dist/server/runtime/http-server/executor-provider.js +26 -0
- package/dist/server/runtime/http-server/executor-provider.js.map +1 -1
- package/dist/server/runtime/http-server/executor-response.d.ts +16 -0
- package/dist/server/runtime/http-server/executor-response.js +164 -0
- package/dist/server/runtime/http-server/executor-response.js.map +1 -0
- package/dist/server/runtime/http-server/index.d.ts +1 -0
- package/dist/server/runtime/http-server/index.js +88 -53
- package/dist/server/runtime/http-server/index.js.map +1 -1
- package/dist/server/runtime/http-server/request-executor.js +5 -19
- package/dist/server/runtime/http-server/request-executor.js.map +1 -1
- package/dist/server/runtime/http-server/routes.d.ts +2 -0
- package/dist/server/runtime/http-server/routes.js +33 -1
- package/dist/server/runtime/http-server/routes.js.map +1 -1
- package/dist/server/runtime/http-server/types.d.ts +1 -0
- package/dist/server/utils/client-connection-state.d.ts +8 -0
- package/dist/server/utils/client-connection-state.js +52 -0
- package/dist/server/utils/client-connection-state.js.map +1 -0
- package/dist/server/utils/request-id-manager.js +21 -3
- package/dist/server/utils/request-id-manager.js.map +1 -1
- package/dist/token-daemon/history-store.d.ts +2 -0
- package/dist/token-daemon/history-store.js +6 -2
- package/dist/token-daemon/history-store.js.map +1 -1
- package/dist/token-daemon/index.js +36 -5
- package/dist/token-daemon/index.js.map +1 -1
- package/dist/token-daemon/leader-lock.d.ts +11 -0
- package/dist/token-daemon/leader-lock.js +79 -0
- package/dist/token-daemon/leader-lock.js.map +1 -0
- package/dist/token-daemon/message-bus-integrator.d.ts +98 -0
- package/dist/token-daemon/message-bus-integrator.js +144 -0
- package/dist/token-daemon/message-bus-integrator.js.map +1 -0
- package/dist/token-daemon/provider-registry.d.ts +22 -0
- package/dist/token-daemon/provider-registry.js +201 -0
- package/dist/token-daemon/provider-registry.js.map +1 -0
- package/dist/token-daemon/token-daemon.d.ts +8 -0
- package/dist/token-daemon/token-daemon.js +196 -11
- package/dist/token-daemon/token-daemon.js.map +1 -1
- package/dist/token-portal/local-token-portal.d.ts +1 -0
- package/dist/token-portal/local-token-portal.js +18 -0
- package/dist/token-portal/local-token-portal.js.map +1 -1
- package/dist/token-portal/render.js +1 -0
- package/dist/token-portal/render.js.map +1 -1
- package/dist/tools/error-log.d.ts +31 -0
- package/dist/tools/error-log.js +117 -0
- package/dist/tools/error-log.js.map +1 -0
- package/dist/tools/stats-request-events.d.ts +2 -0
- package/dist/tools/stats-request-events.js +16 -0
- package/dist/tools/stats-request-events.js.map +1 -0
- package/dist/tools/stats-usage.d.ts +31 -0
- package/dist/tools/stats-usage.js +206 -0
- package/dist/tools/stats-usage.js.map +1 -0
- package/package.json +8 -4
- package/scripts/analyze-codex-error-failures.mjs +109 -0
- package/scripts/camoufox/gen-fingerprint-env.py +171 -0
- package/scripts/camoufox/launch-auth.mjs +617 -0
- package/scripts/classify-codex-samples.mjs +251 -0
- package/scripts/cleanup-codex-error-samples.mjs +88 -0
- package/scripts/compare-codex-rccx.mjs +268 -0
- package/scripts/copy-compat-assets.mjs +18 -0
- package/scripts/install-release.sh +1 -1
- package/scripts/local-replay-openai-response.mjs +1 -2
- package/scripts/pack-mode.mjs +16 -6
- package/scripts/replay-codex-sample.mjs +24 -2
- package/scripts/responses-compare-server.mjs +119 -0
- package/scripts/verify-apply-patch.mjs +28 -17
- package/scripts/verify-codex-error-samples.mjs +99 -0
- package/scripts/verify-e2e-toolcall.mjs +19 -4
- package/scripts/virtual-router-shadow-v2-real.mjs +143 -0
- package/scripts/virtual-router-shadow-v2.mjs +122 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Generate and persist a Camoufox fingerprint env config for a given profile.
|
|
4
|
+
|
|
5
|
+
This script is invoked by RouteCodex to create a stable, per-profile
|
|
6
|
+
fingerprint configuration using Camoufox's own launch_options helper.
|
|
7
|
+
|
|
8
|
+
Behavior:
|
|
9
|
+
- Uses camoufox.utils.launch_options with:
|
|
10
|
+
- geoip=True (so region / timezone come from geoip)
|
|
11
|
+
- os=<policy> (windows / macos / linux / random / list)
|
|
12
|
+
- Computes the delta between the current environment and the env
|
|
13
|
+
returned in launch_options, and persists only that diff.
|
|
14
|
+
- Writes JSON to <output_dir>/<profile_id>.json of the form:
|
|
15
|
+
{ "env": { "KEY": "VALUE", ... } }
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import argparse
|
|
21
|
+
import json
|
|
22
|
+
import os
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
import sys
|
|
25
|
+
from typing import Dict, Any, List
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def parse_args() -> argparse.Namespace:
|
|
29
|
+
parser = argparse.ArgumentParser(description="Generate Camoufox fingerprint env for a profile.")
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"--profile-id",
|
|
32
|
+
required=True,
|
|
33
|
+
help="Logical profile identifier (e.g. rc-gemini.geetasamodgeetasamoda).",
|
|
34
|
+
)
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
"--os",
|
|
37
|
+
dest="os_name",
|
|
38
|
+
default=None,
|
|
39
|
+
help="Camoufox OS policy: windows | macos | linux | random | comma list.",
|
|
40
|
+
)
|
|
41
|
+
parser.add_argument(
|
|
42
|
+
"--output-dir",
|
|
43
|
+
required=True,
|
|
44
|
+
help="Directory to store the generated fingerprint JSON file.",
|
|
45
|
+
)
|
|
46
|
+
return parser.parse_args()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def ensure_output_dir(path_str: str) -> Path:
|
|
50
|
+
path = Path(os.path.expanduser(path_str)).resolve()
|
|
51
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
52
|
+
return path
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _force_us_region(env: Dict[str, str]) -> None:
|
|
56
|
+
"""
|
|
57
|
+
Override timezone / locale / geo fields in CAMOU_CONFIG_* to point to a US
|
|
58
|
+
region while keeping all other fingerprint details (canvas, fonts, UA shape, etc.)
|
|
59
|
+
intact.
|
|
60
|
+
"""
|
|
61
|
+
parts: List[str] = []
|
|
62
|
+
for key in sorted(env.keys()):
|
|
63
|
+
if key.startswith("CAMOU_CONFIG_"):
|
|
64
|
+
value = env.get(key)
|
|
65
|
+
if isinstance(value, str):
|
|
66
|
+
parts.append(value)
|
|
67
|
+
|
|
68
|
+
if not parts:
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
blob = "".join(parts)
|
|
72
|
+
try:
|
|
73
|
+
cfg = json.loads(blob)
|
|
74
|
+
except Exception:
|
|
75
|
+
return
|
|
76
|
+
|
|
77
|
+
# Force US timezone / locale / geo (single region for all accounts)
|
|
78
|
+
cfg["timezone"] = "America/Los_Angeles"
|
|
79
|
+
cfg["locale:language"] = cfg.get("locale:language", "en")
|
|
80
|
+
cfg["locale:region"] = "US"
|
|
81
|
+
cfg.setdefault("locale:script", "Latn")
|
|
82
|
+
cfg["geolocation:latitude"] = 37.7749
|
|
83
|
+
cfg["geolocation:longitude"] = -122.4194
|
|
84
|
+
|
|
85
|
+
payload = json.dumps(cfg, ensure_ascii=False, separators=(",", ":"))
|
|
86
|
+
|
|
87
|
+
# Replace any existing CAMOU_CONFIG_* entries with a single updated chunk.
|
|
88
|
+
for key in list(env.keys()):
|
|
89
|
+
if key.startswith("CAMOU_CONFIG_"):
|
|
90
|
+
env.pop(key, None)
|
|
91
|
+
env["CAMOU_CONFIG_1"] = payload
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def generate_env_delta(os_name: str | None) -> Dict[str, str]:
|
|
95
|
+
"""
|
|
96
|
+
Call camoufox.utils.launch_options and compute the delta env vars.
|
|
97
|
+
|
|
98
|
+
We only keep keys whose values differ from the original os.environ,
|
|
99
|
+
so that RouteCodex can safely merge them into its own process.env.
|
|
100
|
+
"""
|
|
101
|
+
try:
|
|
102
|
+
from camoufox.utils import launch_options # type: ignore
|
|
103
|
+
except Exception as exc:
|
|
104
|
+
print(f"[gen-fingerprint-env] Failed to import camoufox.utils.launch_options: {exc}", file=sys.stderr)
|
|
105
|
+
sys.exit(1)
|
|
106
|
+
|
|
107
|
+
# Snapshot original environment
|
|
108
|
+
original_env = dict(os.environ)
|
|
109
|
+
|
|
110
|
+
try:
|
|
111
|
+
opts: Dict[str, Any] = launch_options(
|
|
112
|
+
os=os_name,
|
|
113
|
+
geoip=True,
|
|
114
|
+
headless=False,
|
|
115
|
+
window=(1440, 900),
|
|
116
|
+
)
|
|
117
|
+
except Exception as exc:
|
|
118
|
+
print(f"[gen-fingerprint-env] launch_options() failed: {exc}", file=sys.stderr)
|
|
119
|
+
sys.exit(1)
|
|
120
|
+
|
|
121
|
+
env = opts.get("env") or {}
|
|
122
|
+
if not isinstance(env, dict):
|
|
123
|
+
print("[gen-fingerprint-env] launch_options() returned invalid env payload", file=sys.stderr)
|
|
124
|
+
sys.exit(1)
|
|
125
|
+
|
|
126
|
+
# Normalize region/timezone/geo to a fixed US profile so that all accounts
|
|
127
|
+
# share the same region while still having distinct device fingerprints.
|
|
128
|
+
try:
|
|
129
|
+
_force_us_region(env)
|
|
130
|
+
except Exception as exc:
|
|
131
|
+
print(f"[gen-fingerprint-env] failed to force US region: {exc}", file=sys.stderr)
|
|
132
|
+
|
|
133
|
+
delta: Dict[str, str] = {}
|
|
134
|
+
for key, value in env.items():
|
|
135
|
+
try:
|
|
136
|
+
value_str = str(value)
|
|
137
|
+
except Exception:
|
|
138
|
+
continue
|
|
139
|
+
if original_env.get(key) != value_str:
|
|
140
|
+
delta[key] = value_str
|
|
141
|
+
return delta
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def write_fingerprint_file(profile_id: str, output_dir: Path, env_delta: Dict[str, str]) -> Path:
|
|
145
|
+
output_path = output_dir / f"{profile_id}.json"
|
|
146
|
+
tmp_path = output_path.with_suffix(output_path.suffix + ".tmp")
|
|
147
|
+
payload = {"env": env_delta}
|
|
148
|
+
|
|
149
|
+
with tmp_path.open("w", encoding="utf-8") as f:
|
|
150
|
+
json.dump(payload, f, ensure_ascii=False, separators=(",", ":"))
|
|
151
|
+
|
|
152
|
+
tmp_path.replace(output_path)
|
|
153
|
+
return output_path
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def main() -> None:
|
|
157
|
+
args = parse_args()
|
|
158
|
+
profile_id: str = args.profile_id.strip()
|
|
159
|
+
if not profile_id:
|
|
160
|
+
print("[gen-fingerprint-env] Missing profile id", file=sys.stderr)
|
|
161
|
+
sys.exit(1)
|
|
162
|
+
|
|
163
|
+
output_dir = ensure_output_dir(args.output_dir)
|
|
164
|
+
env_delta = generate_env_delta(args.os_name)
|
|
165
|
+
path = write_fingerprint_file(profile_id, output_dir, env_delta)
|
|
166
|
+
# Print the absolute path for callers that care.
|
|
167
|
+
print(str(path))
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
if __name__ == "__main__":
|
|
171
|
+
main()
|