9router 0.3.46 → 0.3.48
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/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +41 -41
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/prerender-manifest.json +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +2 -2
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/copilot-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/opencode-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/locale/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/iflow/cookie/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/proxy-pools/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/database/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy-test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/stream/route.js +2 -2
- package/app/.next/server/app/api/translator/console-logs/stream/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js +1 -1
- package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/disable/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/chart/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/providers/route.js +1 -1
- package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/stats/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/stream/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js +1 -1
- package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/version/route.js +1 -1
- package/app/.next/server/app/api/version/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +4 -4
- package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.html +1 -1
- package/app/.next/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.html +2 -2
- package/app/.next/server/app/dashboard/quota.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +4 -4
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +4 -4
- package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +5 -5
- package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +41 -41
- package/app/.next/server/chunks/1114.js +1 -1
- package/app/.next/server/chunks/1424.js +1 -1
- package/app/.next/server/chunks/318.js +3 -3
- package/app/.next/server/chunks/3832.js +1 -1
- package/app/.next/server/chunks/412.js +1 -1
- package/app/.next/server/chunks/5297.js +1 -1
- package/app/.next/server/chunks/649.js +1 -1
- package/app/.next/server/chunks/6968.js +1 -0
- package/app/.next/server/chunks/8895.js +2 -2
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +2 -2
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/2652-67b8cc047a3efcc9.js +1 -0
- package/app/.next/static/chunks/{5497-060113ffa02e3f6b.js → 5497-e51ea33e5c739a33.js} +2 -2
- package/app/.next/static/chunks/{9242-b217d166d0bd8f13.js → 9242-911fd2719103a7fa.js} +2 -2
- package/app/.next/static/chunks/app/(dashboard)/{layout-15fa2bf848d48a45.js → layout-2ea88f0d24d7423a.js} +1 -1
- package/app/.next/static/chunks/app/{layout-40f3bfe47a0090da.js → layout-8f69df46423ca2cf.js} +1 -1
- package/app/.next/static/css/0c4f3a92a0a64981.css +3 -0
- package/app/package.json +1 -1
- package/app/public/providers/ollama-local.png +0 -0
- package/app/src/mitm/server copy.js +737 -0
- package/package.json +1 -1
- package/app/.next/server/chunks/7132.js +0 -1
- package/app/.next/static/chunks/2652-e43e251f93764341.js +0 -1
- package/app/.next/static/css/d29dc22cd7e0030f.css +0 -3
- /package/app/.next/static/{cjNFQ0OriShU8hXhdekpg → eVGIe8IcaLlfBhBZM9a5U}/_buildManifest.js +0 -0
- /package/app/.next/static/{cjNFQ0OriShU8hXhdekpg → eVGIe8IcaLlfBhBZM9a5U}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
const https = require("https");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const dns = require("dns");
|
|
5
|
+
const { promisify } = require("util");
|
|
6
|
+
|
|
7
|
+
const INTERNAL_REQUEST_HEADER = { name: "x-request-source", value: "local" };
|
|
8
|
+
|
|
9
|
+
// All intercepted domains across all tools
|
|
10
|
+
const TARGET_HOSTS = [
|
|
11
|
+
"daily-cloudcode-pa.googleapis.com",
|
|
12
|
+
"cloudcode-pa.googleapis.com",
|
|
13
|
+
"api.individual.githubcopilot.com",
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const LOCAL_PORT = 443;
|
|
17
|
+
const ROUTER_URL = "http://localhost:20128/v1/chat/completions";
|
|
18
|
+
const API_KEY = process.env.ROUTER_API_KEY;
|
|
19
|
+
const { DATA_DIR, MITM_DIR } = require("./paths");
|
|
20
|
+
const DB_FILE = path.join(DATA_DIR, "db.json");
|
|
21
|
+
|
|
22
|
+
const ENABLE_FILE_LOG = false;
|
|
23
|
+
const CURSOR_LOG_DIR = path.join(__dirname, "../../logs/cursor");
|
|
24
|
+
if (!fs.existsSync(CURSOR_LOG_DIR)) fs.mkdirSync(CURSOR_LOG_DIR, { recursive: true });
|
|
25
|
+
const CURSOR_JSONL = path.join(CURSOR_LOG_DIR, "cursor_messages.jsonl");
|
|
26
|
+
|
|
27
|
+
const CURSOR_ENDPOINTS = [
|
|
28
|
+
"/agent.v1.AgentService/RunPoll",
|
|
29
|
+
"/aiserver.v1.BidiService/BidiAppend",
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Decode Connect-RPC frame: [1 byte flags][4 bytes length][protobuf body]
|
|
34
|
+
* Then walk raw protobuf fields and extract readable strings/numbers.
|
|
35
|
+
*/
|
|
36
|
+
function decodeConnectFrame(buf) {
|
|
37
|
+
if (!buf || buf.length < 5) return null;
|
|
38
|
+
const msgLen = buf.readUInt32BE(1);
|
|
39
|
+
if (buf.length < 5 + msgLen) return null;
|
|
40
|
+
return decodeProtoRaw(buf.slice(5, 5 + msgLen));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function decodeProtoRaw(buf, depth = 0) {
|
|
44
|
+
if (depth > 6) return {};
|
|
45
|
+
const result = {};
|
|
46
|
+
let offset = 0;
|
|
47
|
+
try {
|
|
48
|
+
while (offset < buf.length) {
|
|
49
|
+
const tag = readVarint(buf, offset);
|
|
50
|
+
if (!tag) break;
|
|
51
|
+
offset += tag.bytes;
|
|
52
|
+
const fieldNum = tag.value >> 3;
|
|
53
|
+
const wireType = tag.value & 0x7;
|
|
54
|
+
|
|
55
|
+
if (wireType === 0) {
|
|
56
|
+
// varint
|
|
57
|
+
const v = readVarint(buf, offset);
|
|
58
|
+
if (!v) break;
|
|
59
|
+
offset += v.bytes;
|
|
60
|
+
result[`f${fieldNum}`] = v.value;
|
|
61
|
+
} else if (wireType === 2) {
|
|
62
|
+
// length-delimited: string, bytes, or nested message
|
|
63
|
+
const lenV = readVarint(buf, offset);
|
|
64
|
+
if (!lenV) break;
|
|
65
|
+
offset += lenV.bytes;
|
|
66
|
+
const data = buf.slice(offset, offset + lenV.value);
|
|
67
|
+
offset += lenV.value;
|
|
68
|
+
// Try as UTF-8 string first
|
|
69
|
+
const str = data.toString("utf8");
|
|
70
|
+
const isPrintable = /^[\x20-\x7E\n\r\t]*$/.test(str) && str.length > 0;
|
|
71
|
+
if (isPrintable) {
|
|
72
|
+
result[`f${fieldNum}`] = str;
|
|
73
|
+
} else if (data.length > 0 && data.length < 4096) {
|
|
74
|
+
// Try nested decode
|
|
75
|
+
const nested = decodeProtoRaw(data, depth + 1);
|
|
76
|
+
result[`f${fieldNum}`] = Object.keys(nested).length ? nested : data.toString("hex").substring(0, 64);
|
|
77
|
+
}
|
|
78
|
+
} else if (wireType === 5) {
|
|
79
|
+
offset += 4;
|
|
80
|
+
} else if (wireType === 1) {
|
|
81
|
+
offset += 8;
|
|
82
|
+
} else {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
} catch { /* best effort */ }
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function readVarint(buf, offset) {
|
|
91
|
+
let value = 0, shift = 0, bytes = 0;
|
|
92
|
+
while (offset + bytes < buf.length) {
|
|
93
|
+
const b = buf[offset + bytes++];
|
|
94
|
+
value |= (b & 0x7f) << shift;
|
|
95
|
+
shift += 7;
|
|
96
|
+
if (!(b & 0x80)) return { value, bytes };
|
|
97
|
+
if (shift >= 28) break;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const zlib = require("zlib");
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Deep decode protobuf buffer — returns structured object.
|
|
106
|
+
* Tries to interpret each length-delimited field as:
|
|
107
|
+
* 1. UTF-8 string (if fully printable)
|
|
108
|
+
* 2. Nested proto message (recursive)
|
|
109
|
+
* 3. Hex string fallback
|
|
110
|
+
*/
|
|
111
|
+
function deepDecodeProto(buf, depth = 0) {
|
|
112
|
+
if (depth > 10 || buf.length === 0) return null;
|
|
113
|
+
const result = {};
|
|
114
|
+
let off = 0;
|
|
115
|
+
try {
|
|
116
|
+
while (off < buf.length) {
|
|
117
|
+
// Read varint tag
|
|
118
|
+
let tag = 0, shift = 0;
|
|
119
|
+
while (off < buf.length) {
|
|
120
|
+
const b = buf[off++];
|
|
121
|
+
tag |= (b & 0x7f) << shift;
|
|
122
|
+
shift += 7;
|
|
123
|
+
if (!(b & 0x80)) break;
|
|
124
|
+
if (shift > 28) break;
|
|
125
|
+
}
|
|
126
|
+
if (tag === 0) break;
|
|
127
|
+
const field = tag >> 3;
|
|
128
|
+
const wire = tag & 7;
|
|
129
|
+
const key = `f${field}`;
|
|
130
|
+
|
|
131
|
+
if (wire === 0) {
|
|
132
|
+
// varint
|
|
133
|
+
let v = 0, s = 0;
|
|
134
|
+
while (off < buf.length) {
|
|
135
|
+
const b = buf[off++];
|
|
136
|
+
v |= (b & 0x7f) << s;
|
|
137
|
+
s += 7;
|
|
138
|
+
if (!(b & 0x80)) break;
|
|
139
|
+
}
|
|
140
|
+
result[key] = v;
|
|
141
|
+
} else if (wire === 2) {
|
|
142
|
+
// length-delimited
|
|
143
|
+
let len = 0, s = 0;
|
|
144
|
+
while (off < buf.length) {
|
|
145
|
+
const b = buf[off++];
|
|
146
|
+
len |= (b & 0x7f) << s;
|
|
147
|
+
s += 7;
|
|
148
|
+
if (!(b & 0x80)) break;
|
|
149
|
+
}
|
|
150
|
+
if (off + len > buf.length || len < 0) break;
|
|
151
|
+
const data = buf.slice(off, off + len);
|
|
152
|
+
off += len;
|
|
153
|
+
|
|
154
|
+
if (len === 0) {
|
|
155
|
+
result[key] = "";
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Try UTF-8 string
|
|
160
|
+
const str = data.toString("utf8");
|
|
161
|
+
const isPrintable = str.length > 0 && !/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(str);
|
|
162
|
+
if (isPrintable) {
|
|
163
|
+
// Accumulate repeated fields as array
|
|
164
|
+
if (key in result) {
|
|
165
|
+
result[key] = [].concat(result[key], str);
|
|
166
|
+
} else {
|
|
167
|
+
result[key] = str;
|
|
168
|
+
}
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Try nested proto
|
|
173
|
+
if (len >= 2 && len <= 500000) {
|
|
174
|
+
const nested = deepDecodeProto(data, depth + 1);
|
|
175
|
+
if (nested && Object.keys(nested).length > 0) {
|
|
176
|
+
if (key in result) {
|
|
177
|
+
result[key] = [].concat(result[key], [nested]);
|
|
178
|
+
} else {
|
|
179
|
+
result[key] = nested;
|
|
180
|
+
}
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Fallback: hex (truncate at 64 bytes)
|
|
186
|
+
result[key] = data.slice(0, 64).toString("hex");
|
|
187
|
+
} else if (wire === 5) {
|
|
188
|
+
off += 4;
|
|
189
|
+
} else if (wire === 1) {
|
|
190
|
+
off += 8;
|
|
191
|
+
} else {
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
} catch { /* best effort */ }
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// ── Proto helpers ──────────────────────────────────────────────
|
|
200
|
+
function protoReadVarint(buf, off) {
|
|
201
|
+
let v = 0, shift = 0;
|
|
202
|
+
while (off < buf.length) {
|
|
203
|
+
const b = buf[off++];
|
|
204
|
+
v |= (b & 0x7f) << shift;
|
|
205
|
+
shift += 7;
|
|
206
|
+
if (!(b & 0x80)) return { v, off };
|
|
207
|
+
if (shift > 49) break;
|
|
208
|
+
}
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function protoWalkFields(buf) {
|
|
213
|
+
const fields = [];
|
|
214
|
+
let off = 0;
|
|
215
|
+
while (off < buf.length) {
|
|
216
|
+
const t = protoReadVarint(buf, off);
|
|
217
|
+
if (!t || t.v === 0) break;
|
|
218
|
+
off = t.off;
|
|
219
|
+
const field = t.v >> 3, wire = t.v & 7;
|
|
220
|
+
if (wire === 0) {
|
|
221
|
+
const r = protoReadVarint(buf, off);
|
|
222
|
+
if (!r) break;
|
|
223
|
+
off = r.off;
|
|
224
|
+
fields.push({ field, wire, value: r.v });
|
|
225
|
+
} else if (wire === 2) {
|
|
226
|
+
const r = protoReadVarint(buf, off);
|
|
227
|
+
if (!r) break;
|
|
228
|
+
off = r.off;
|
|
229
|
+
if (off + r.v > buf.length) break;
|
|
230
|
+
fields.push({ field, wire, data: buf.slice(off, off + r.v) });
|
|
231
|
+
off += r.v;
|
|
232
|
+
} else if (wire === 5) { off += 4; }
|
|
233
|
+
else if (wire === 1) { off += 8; }
|
|
234
|
+
else break;
|
|
235
|
+
}
|
|
236
|
+
return fields;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function protoStr(buf) {
|
|
240
|
+
if (!buf || buf.length === 0) return null;
|
|
241
|
+
const s = buf.toString("utf8");
|
|
242
|
+
return /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(s) ? null : s;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// ── Schema-aware decoders ──────────────────────────────────────
|
|
246
|
+
|
|
247
|
+
// BidiAppendRequest: f1=data(hex-encoded AgentClientMessage), f2=requestId{f1=uuid}, f3=seqno
|
|
248
|
+
function decodeBidiAppend(buf) {
|
|
249
|
+
const fields = protoWalkFields(buf);
|
|
250
|
+
const result = {};
|
|
251
|
+
for (const f of fields) {
|
|
252
|
+
if (f.field === 1 && f.data) {
|
|
253
|
+
// f1.data is ASCII hex string → decode to actual proto bytes
|
|
254
|
+
try {
|
|
255
|
+
const hexStr = f.data.toString("utf8");
|
|
256
|
+
const protoBytes = Buffer.from(hexStr, "hex");
|
|
257
|
+
result.agentMsg = decodeAgentClientMsg(protoBytes);
|
|
258
|
+
} catch { result.agentMsg = { type: "hex_decode_error" }; }
|
|
259
|
+
} else if (f.field === 2 && f.data) {
|
|
260
|
+
const inner = protoWalkFields(f.data);
|
|
261
|
+
const id = inner.find(x => x.field === 1 && x.data);
|
|
262
|
+
result.requestId = id ? protoStr(id.data) : null;
|
|
263
|
+
} else if (f.field === 3) result.seqno = f.value;
|
|
264
|
+
}
|
|
265
|
+
return result;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// AgentClientMessage oneof: f1=AgentRunRequest, f4=ConversationAction, f7=ClientHeartbeat
|
|
269
|
+
function decodeAgentClientMsg(buf) {
|
|
270
|
+
const fields = protoWalkFields(buf);
|
|
271
|
+
for (const f of fields) {
|
|
272
|
+
if (!f.data) continue;
|
|
273
|
+
if (f.field === 1) return { type: "AgentRunRequest", ...decodeAgentRunRequest(f.data) };
|
|
274
|
+
if (f.field === 4) return { type: "ConversationAction", ...decodeConversationAction(f.data) };
|
|
275
|
+
if (f.field === 7) return { type: "ClientHeartbeat" };
|
|
276
|
+
if (f.field === 2) return { type: "ExecClientMessage" };
|
|
277
|
+
}
|
|
278
|
+
return { type: "unknown" };
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// AgentRunRequest: f1=conversation_state, f2=action, f3=model_details, f5=conversation_id
|
|
282
|
+
function decodeAgentRunRequest(buf) {
|
|
283
|
+
const fields = protoWalkFields(buf);
|
|
284
|
+
const result = {};
|
|
285
|
+
|
|
286
|
+
for (const f of fields) {
|
|
287
|
+
if (f.field === 3 && f.data) result.model = decodeModelDetails(f.data);
|
|
288
|
+
if (f.field === 5 && f.data) result.conversationId = protoStr(f.data);
|
|
289
|
+
if (f.field === 2 && f.data) result.action = decodeConversationAction(f.data);
|
|
290
|
+
if (f.field === 1 && f.data) result.state = decodeConversationState(f.data);
|
|
291
|
+
}
|
|
292
|
+
return result;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ModelDetails — scan all string fields
|
|
296
|
+
function decodeModelDetails(buf) {
|
|
297
|
+
const fields = protoWalkFields(buf);
|
|
298
|
+
const result = {};
|
|
299
|
+
for (const f of fields) {
|
|
300
|
+
if (f.data) {
|
|
301
|
+
const s = protoStr(f.data);
|
|
302
|
+
if (s && s.length > 0) result[`f${f.field}`] = s;
|
|
303
|
+
} else if (f.value !== undefined) {
|
|
304
|
+
result[`f${f.field}`] = f.value;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return result;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// ConversationAction: f1 → f1 → f1=text, f2=uuid, f8=lexical_json
|
|
311
|
+
// f1 → f2 → repeated f2=turns, f7=selected_context, f23=system_prompt
|
|
312
|
+
function decodeConversationAction(buf) {
|
|
313
|
+
const result = {};
|
|
314
|
+
const topFields = protoWalkFields(buf);
|
|
315
|
+
|
|
316
|
+
// action.f1 wrapper
|
|
317
|
+
const f1 = topFields.find(f => f.field === 1 && f.data);
|
|
318
|
+
if (!f1) return result;
|
|
319
|
+
const f1Fields = protoWalkFields(f1.data);
|
|
320
|
+
|
|
321
|
+
// ── User message: action.f1.f1 ──────────────────────────────
|
|
322
|
+
const f1f1 = f1Fields.find(f => f.field === 1 && f.data);
|
|
323
|
+
if (f1f1) {
|
|
324
|
+
for (const f of protoWalkFields(f1f1.data)) {
|
|
325
|
+
if (!f.data) continue;
|
|
326
|
+
const s = protoStr(f.data);
|
|
327
|
+
if (f.field === 1 && s) result.text = s;
|
|
328
|
+
if (f.field === 2 && s) result.messageId = s;
|
|
329
|
+
if (f.field === 8 && s) {
|
|
330
|
+
try {
|
|
331
|
+
const lex = JSON.parse(s);
|
|
332
|
+
const texts = [];
|
|
333
|
+
function extractLexText(node) {
|
|
334
|
+
if (node?.text) texts.push(node.text);
|
|
335
|
+
(node?.children || []).forEach(extractLexText);
|
|
336
|
+
}
|
|
337
|
+
extractLexText(lex?.root);
|
|
338
|
+
result.textFull = texts.join("");
|
|
339
|
+
} catch { result.lexical = s.substring(0, 300); }
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// ── Conversation history: action.f1.f2 ──────────────────────
|
|
345
|
+
const f1f2 = f1Fields.find(f => f.field === 2 && f.data);
|
|
346
|
+
if (f1f2) {
|
|
347
|
+
const histFields = protoWalkFields(f1f2.data);
|
|
348
|
+
|
|
349
|
+
// f2 repeated = context files (rules, open files...)
|
|
350
|
+
result.contextFiles = histFields
|
|
351
|
+
.filter(f => f.field === 2 && f.data)
|
|
352
|
+
.map(t => {
|
|
353
|
+
const tf = protoWalkFields(t.data);
|
|
354
|
+
const name = tf.find(f => f.field === 1 && f.data);
|
|
355
|
+
const content = tf.find(f => f.field === 2 && f.data);
|
|
356
|
+
return {
|
|
357
|
+
path: name ? protoStr(name.data) : null,
|
|
358
|
+
content: content ? protoStr(content.data)?.substring(0, 500) : null,
|
|
359
|
+
};
|
|
360
|
+
})
|
|
361
|
+
.filter(x => x.path);
|
|
362
|
+
|
|
363
|
+
// f7 repeated = MCP tools
|
|
364
|
+
result.tools = histFields
|
|
365
|
+
.filter(f => f.field === 7 && f.data)
|
|
366
|
+
.map(t => {
|
|
367
|
+
const tf = protoWalkFields(t.data);
|
|
368
|
+
const name = tf.find(f => f.field === 1 && f.data);
|
|
369
|
+
const desc = tf.find(f => f.field === 2 && f.data);
|
|
370
|
+
return {
|
|
371
|
+
name: name ? protoStr(name.data) : null,
|
|
372
|
+
description: desc ? protoStr(desc.data) : null,
|
|
373
|
+
};
|
|
374
|
+
})
|
|
375
|
+
.filter(x => x.name);
|
|
376
|
+
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return result;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Recursively decode any proto buffer into a plain JS object for debugging.
|
|
384
|
+
* Each field: try UTF-8 string → nested proto → hex fallback.
|
|
385
|
+
* Repeated fields become arrays.
|
|
386
|
+
*/
|
|
387
|
+
function protoTreeToObj(buf, depth = 0) {
|
|
388
|
+
if (depth > 12 || !buf || buf.length === 0) return null;
|
|
389
|
+
const result = {};
|
|
390
|
+
const fields = protoWalkFields(buf);
|
|
391
|
+
for (const f of fields) {
|
|
392
|
+
const key = `f${f.field}`;
|
|
393
|
+
let val;
|
|
394
|
+
if (f.data !== undefined) {
|
|
395
|
+
const s = protoStr(f.data);
|
|
396
|
+
if (s !== null) {
|
|
397
|
+
// Detect hex-encoded proto (BidiAppend.data field)
|
|
398
|
+
if (/^[0-9a-f]{20,}$/i.test(s)) {
|
|
399
|
+
try {
|
|
400
|
+
const dec = protoTreeToObj(Buffer.from(s, "hex"), depth + 1);
|
|
401
|
+
val = (dec && Object.keys(dec).length > 0) ? dec : s;
|
|
402
|
+
} catch { val = s; }
|
|
403
|
+
} else {
|
|
404
|
+
try { val = JSON.parse(s); } catch { val = s; }
|
|
405
|
+
}
|
|
406
|
+
} else if (f.data.length > 0) {
|
|
407
|
+
const nested = protoTreeToObj(f.data, depth + 1);
|
|
408
|
+
val = (nested && Object.keys(nested).length > 0)
|
|
409
|
+
? nested
|
|
410
|
+
: f.data.toString("hex");
|
|
411
|
+
} else {
|
|
412
|
+
val = "";
|
|
413
|
+
}
|
|
414
|
+
} else {
|
|
415
|
+
val = f.value;
|
|
416
|
+
}
|
|
417
|
+
// Accumulate repeated fields as array
|
|
418
|
+
if (key in result) {
|
|
419
|
+
result[key] = [].concat(result[key], [val]);
|
|
420
|
+
} else {
|
|
421
|
+
result[key] = val;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return result;
|
|
425
|
+
|
|
426
|
+
return result;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// ConversationStateStructure: f1=root_prompt_messages_json(bytes[]), f8=turns(bytes[])
|
|
430
|
+
function decodeConversationState(buf) {
|
|
431
|
+
const fields = protoWalkFields(buf);
|
|
432
|
+
const messages = [], turns = [];
|
|
433
|
+
for (const f of fields) {
|
|
434
|
+
if (!f.data) continue;
|
|
435
|
+
if (f.field === 1) {
|
|
436
|
+
// root_prompt_messages_json — each is a bytes field containing JSON string
|
|
437
|
+
const s = protoStr(f.data);
|
|
438
|
+
if (s) { try { messages.push(JSON.parse(s)); } catch { messages.push(s.substring(0, 500)); } }
|
|
439
|
+
} else if (f.field === 8) {
|
|
440
|
+
// turns — bytes, try get readable strings
|
|
441
|
+
const inner = protoWalkFields(f.data);
|
|
442
|
+
const strs = inner.filter(x => x.data && protoStr(x.data)).map(x => protoStr(x.data)).filter(s => s.length > 5);
|
|
443
|
+
if (strs.length) turns.push(strs.slice(0, 5));
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return { messages: messages.slice(0, 10), turns: turns.slice(0, 5) };
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// ── Save per-chat JSON file ────────────────────────────────────
|
|
450
|
+
function saveCursorLogFull(url, headers, buf) {
|
|
451
|
+
try {
|
|
452
|
+
if (!url.includes("BidiAppend") || buf.length < 2 || buf[0] !== 0x1f || buf[1] !== 0x8b) return;
|
|
453
|
+
|
|
454
|
+
const decompressed = zlib.gunzipSync(buf);
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
const decoded = decodeBidiAppend(decompressed);
|
|
458
|
+
|
|
459
|
+
const action = decoded?.agentMsg?.action || {};
|
|
460
|
+
const userMessage = action.textFull || action.text || null;
|
|
461
|
+
|
|
462
|
+
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
463
|
+
const base = path.join(CURSOR_LOG_DIR, ts);
|
|
464
|
+
|
|
465
|
+
// _chat.json — structured decoded
|
|
466
|
+
fs.writeFileSync(`${base}_chat.json`, JSON.stringify({
|
|
467
|
+
ts: new Date().toISOString(),
|
|
468
|
+
version: headers["x-cursor-client-version"],
|
|
469
|
+
sizeGzip: buf.length,
|
|
470
|
+
sizeRaw: decompressed.length,
|
|
471
|
+
userMessage,
|
|
472
|
+
decoded,
|
|
473
|
+
}, null, 2));
|
|
474
|
+
|
|
475
|
+
// _decoded.json — full proto tree, no filtering
|
|
476
|
+
const tree = protoTreeToObj(decompressed);
|
|
477
|
+
fs.writeFileSync(`${base}_decoded.json`, JSON.stringify(tree, null, 2));
|
|
478
|
+
|
|
479
|
+
console.log(`[CURSOR] ${ts}_chat.json | type=${decoded?.agentMsg?.type} | msg=${userMessage || "(none)"}`);
|
|
480
|
+
} catch (e) {
|
|
481
|
+
console.error(`[CURSOR] decode error: ${e.message}`);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if (!API_KEY) {
|
|
486
|
+
console.error("❌ ROUTER_API_KEY required");
|
|
487
|
+
process.exit(1);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const { getCertForDomain } = require("./cert/generate");
|
|
491
|
+
|
|
492
|
+
// Certificate cache for performance
|
|
493
|
+
const certCache = new Map();
|
|
494
|
+
|
|
495
|
+
// SNI callback for dynamic certificate generation
|
|
496
|
+
function sniCallback(servername, cb) {
|
|
497
|
+
try {
|
|
498
|
+
// Check cache first
|
|
499
|
+
if (certCache.has(servername)) {
|
|
500
|
+
const cached = certCache.get(servername);
|
|
501
|
+
return cb(null, cached);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Generate new cert for this domain
|
|
505
|
+
const certData = getCertForDomain(servername);
|
|
506
|
+
if (!certData) {
|
|
507
|
+
return cb(new Error(`Failed to generate cert for ${servername}`));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// Create secure context
|
|
511
|
+
const ctx = require("tls").createSecureContext({
|
|
512
|
+
key: certData.key,
|
|
513
|
+
cert: certData.cert
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
// Cache it
|
|
517
|
+
certCache.set(servername, ctx);
|
|
518
|
+
console.log(`✅ Generated cert for: ${servername}`);
|
|
519
|
+
|
|
520
|
+
cb(null, ctx);
|
|
521
|
+
} catch (error) {
|
|
522
|
+
console.error(`❌ SNI error for ${servername}:`, error.message);
|
|
523
|
+
cb(error);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Load Root CA for default context
|
|
528
|
+
const certDir = MITM_DIR;
|
|
529
|
+
const rootCAKeyPath = path.join(certDir, "rootCA.key");
|
|
530
|
+
const rootCACertPath = path.join(certDir, "rootCA.crt");
|
|
531
|
+
|
|
532
|
+
let sslOptions;
|
|
533
|
+
try {
|
|
534
|
+
sslOptions = {
|
|
535
|
+
key: fs.readFileSync(rootCAKeyPath),
|
|
536
|
+
cert: fs.readFileSync(rootCACertPath),
|
|
537
|
+
SNICallback: sniCallback
|
|
538
|
+
};
|
|
539
|
+
} catch (e) {
|
|
540
|
+
console.error(`❌ Root CA not found in ${certDir}: ${e.message}`);
|
|
541
|
+
process.exit(1);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Antigravity: Gemini generateContent endpoints
|
|
545
|
+
const ANTIGRAVITY_URL_PATTERNS = [":generateContent", ":streamGenerateContent"];
|
|
546
|
+
// Copilot: OpenAI-compatible + Anthropic endpoints
|
|
547
|
+
const COPILOT_URL_PATTERNS = ["/chat/completions", "/v1/messages", "/responses"];
|
|
548
|
+
|
|
549
|
+
const LOG_DIR = path.join(__dirname, "../../logs/mitm");
|
|
550
|
+
if (ENABLE_FILE_LOG && !fs.existsSync(LOG_DIR)) fs.mkdirSync(LOG_DIR, { recursive: true });
|
|
551
|
+
|
|
552
|
+
function saveRequestLog(url, bodyBuffer) {
|
|
553
|
+
if (!ENABLE_FILE_LOG) return;
|
|
554
|
+
try {
|
|
555
|
+
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
556
|
+
const urlSlug = url.replace(/[^a-zA-Z0-9]/g, "_").substring(0, 60);
|
|
557
|
+
const filePath = path.join(LOG_DIR, `${ts}_${urlSlug}.json`);
|
|
558
|
+
const body = JSON.parse(bodyBuffer.toString());
|
|
559
|
+
fs.writeFileSync(filePath, JSON.stringify(body, null, 2));
|
|
560
|
+
} catch { /* ignore */ }
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const cachedTargetIPs = {};
|
|
564
|
+
async function resolveTargetIP(hostname) {
|
|
565
|
+
if (cachedTargetIPs[hostname]) return cachedTargetIPs[hostname];
|
|
566
|
+
const resolver = new dns.Resolver();
|
|
567
|
+
resolver.setServers(["8.8.8.8"]);
|
|
568
|
+
const resolve4 = promisify(resolver.resolve4.bind(resolver));
|
|
569
|
+
const addresses = await resolve4(hostname);
|
|
570
|
+
cachedTargetIPs[hostname] = addresses[0];
|
|
571
|
+
return cachedTargetIPs[hostname];
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function collectBodyRaw(req) {
|
|
575
|
+
return new Promise((resolve, reject) => {
|
|
576
|
+
const chunks = [];
|
|
577
|
+
req.on("data", chunk => chunks.push(chunk));
|
|
578
|
+
req.on("end", () => resolve(Buffer.concat(chunks)));
|
|
579
|
+
req.on("error", reject);
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// Extract model from URL path (Gemini) or body (OpenAI/Anthropic)
|
|
584
|
+
function extractModel(url, body) {
|
|
585
|
+
const urlMatch = url.match(/\/models\/([^/:]+)/);
|
|
586
|
+
if (urlMatch) return urlMatch[1];
|
|
587
|
+
try { return JSON.parse(body.toString()).model || null; } catch { return null; }
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function getMappedModel(tool, model) {
|
|
591
|
+
if (!model) return null;
|
|
592
|
+
try {
|
|
593
|
+
if (!fs.existsSync(DB_FILE)) return null;
|
|
594
|
+
const db = JSON.parse(fs.readFileSync(DB_FILE, "utf-8"));
|
|
595
|
+
return db.mitmAlias?.[tool]?.[model] || null;
|
|
596
|
+
} catch {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Determine which tool this request belongs to based on hostname
|
|
603
|
+
*/
|
|
604
|
+
function getToolForHost(host) {
|
|
605
|
+
const h = (host || "").split(":")[0];
|
|
606
|
+
if (h === "api.individual.githubcopilot.com") return "copilot";
|
|
607
|
+
if (h === "daily-cloudcode-pa.googleapis.com" || h === "cloudcode-pa.googleapis.com") return "antigravity";
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
async function passthrough(req, res, bodyBuffer) {
|
|
612
|
+
const targetHost = (req.headers.host || TARGET_HOSTS[0]).split(":")[0];
|
|
613
|
+
const targetIP = await resolveTargetIP(targetHost);
|
|
614
|
+
|
|
615
|
+
const forwardReq = https.request({
|
|
616
|
+
hostname: targetIP,
|
|
617
|
+
port: 443,
|
|
618
|
+
path: req.url,
|
|
619
|
+
method: req.method,
|
|
620
|
+
headers: { ...req.headers, host: targetHost },
|
|
621
|
+
servername: targetHost,
|
|
622
|
+
rejectUnauthorized: false
|
|
623
|
+
}, (forwardRes) => {
|
|
624
|
+
res.writeHead(forwardRes.statusCode, forwardRes.headers);
|
|
625
|
+
forwardRes.pipe(res);
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
forwardReq.on("error", (err) => {
|
|
629
|
+
console.error(`❌ Passthrough error: ${err.message}`);
|
|
630
|
+
if (!res.headersSent) res.writeHead(502);
|
|
631
|
+
res.end("Bad Gateway");
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
if (bodyBuffer.length > 0) forwardReq.write(bodyBuffer);
|
|
635
|
+
forwardReq.end();
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
async function intercept(req, res, bodyBuffer, mappedModel) {
|
|
639
|
+
try {
|
|
640
|
+
const body = JSON.parse(bodyBuffer.toString());
|
|
641
|
+
body.model = mappedModel;
|
|
642
|
+
|
|
643
|
+
const response = await fetch(ROUTER_URL, {
|
|
644
|
+
method: "POST",
|
|
645
|
+
headers: {
|
|
646
|
+
"Content-Type": "application/json",
|
|
647
|
+
"Authorization": `Bearer ${API_KEY}`
|
|
648
|
+
},
|
|
649
|
+
body: JSON.stringify(body)
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
if (!response.ok) {
|
|
653
|
+
const errText = await response.text().catch(() => "");
|
|
654
|
+
throw new Error(`9Router ${response.status}: ${errText}`);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const ct = response.headers.get("content-type") || "application/json";
|
|
658
|
+
const resHeaders = { "Content-Type": ct, "Cache-Control": "no-cache", "Connection": "keep-alive" };
|
|
659
|
+
if (ct.includes("text/event-stream")) resHeaders["X-Accel-Buffering"] = "no";
|
|
660
|
+
res.writeHead(200, resHeaders);
|
|
661
|
+
|
|
662
|
+
const reader = response.body.getReader();
|
|
663
|
+
const decoder = new TextDecoder();
|
|
664
|
+
while (true) {
|
|
665
|
+
const { done, value } = await reader.read();
|
|
666
|
+
if (done) { res.end(); break; }
|
|
667
|
+
res.write(decoder.decode(value, { stream: true }));
|
|
668
|
+
}
|
|
669
|
+
} catch (error) {
|
|
670
|
+
console.error(`❌ ${error.message}`);
|
|
671
|
+
if (!res.headersSent) res.writeHead(500, { "Content-Type": "application/json" });
|
|
672
|
+
res.end(JSON.stringify({ error: { message: error.message, type: "mitm_error" } }));
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
const server = https.createServer(sslOptions, async (req, res) => {
|
|
677
|
+
if (req.url === "/_mitm_health") {
|
|
678
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
679
|
+
res.end(JSON.stringify({ ok: true, pid: process.pid }));
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
console.log(`[MITM] ${req.method} https://${req.headers.host}${req.url}`);
|
|
684
|
+
|
|
685
|
+
const bodyBuffer = await collectBodyRaw(req);
|
|
686
|
+
if (bodyBuffer.length > 0) saveRequestLog(req.url, bodyBuffer);
|
|
687
|
+
|
|
688
|
+
// Decode and log Cursor protobuf endpoints
|
|
689
|
+
if (CURSOR_ENDPOINTS.some(e => req.url.includes(e))) {
|
|
690
|
+
saveCursorLogFull(req.url, req.headers, bodyBuffer);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// Anti-loop: requests originating from 9Router bypass interception
|
|
694
|
+
if (req.headers[INTERNAL_REQUEST_HEADER.name] === INTERNAL_REQUEST_HEADER.value) {
|
|
695
|
+
return passthrough(req, res, bodyBuffer);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
const tool = getToolForHost(req.headers.host);
|
|
699
|
+
if (!tool) return passthrough(req, res, bodyBuffer);
|
|
700
|
+
|
|
701
|
+
// Check if this URL should be intercepted based on tool
|
|
702
|
+
const isChat = tool === "antigravity"
|
|
703
|
+
? ANTIGRAVITY_URL_PATTERNS.some(p => req.url.includes(p))
|
|
704
|
+
: COPILOT_URL_PATTERNS.some(p => req.url.includes(p));
|
|
705
|
+
|
|
706
|
+
if (!isChat) return passthrough(req, res, bodyBuffer);
|
|
707
|
+
|
|
708
|
+
const model = extractModel(req.url, bodyBuffer);
|
|
709
|
+
console.log("Extracted model:", model)
|
|
710
|
+
const mappedModel = getMappedModel(tool, model);
|
|
711
|
+
|
|
712
|
+
if (!mappedModel) return passthrough(req, res, bodyBuffer);
|
|
713
|
+
|
|
714
|
+
return intercept(req, res, bodyBuffer, mappedModel);
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
server.listen(LOCAL_PORT, () => {
|
|
718
|
+
console.log(`🚀 MITM ready on :${LOCAL_PORT}`);
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
server.on("error", (error) => {
|
|
722
|
+
if (error.code === "EADDRINUSE") {
|
|
723
|
+
console.error(`❌ Port ${LOCAL_PORT} already in use`);
|
|
724
|
+
} else if (error.code === "EACCES") {
|
|
725
|
+
console.error(`❌ Permission denied for port ${LOCAL_PORT}`);
|
|
726
|
+
} else {
|
|
727
|
+
console.error(`❌ ${error.message}`);
|
|
728
|
+
}
|
|
729
|
+
process.exit(1);
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
const shutdown = () => { server.close(() => process.exit(0)); };
|
|
733
|
+
process.on("SIGTERM", shutdown);
|
|
734
|
+
process.on("SIGINT", shutdown);
|
|
735
|
+
if (process.platform === "win32") {
|
|
736
|
+
process.on("SIGBREAK", shutdown);
|
|
737
|
+
}
|