switchboard-router 0.9.39 → 0.9.42
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/static/chunks/{1321-227ff10ac053e663.js → 1321-b1d92a764bdc4978.js} +1 -1
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +11 -11
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-full-catalog/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-picker-labels/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/picker-labels/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/metrics/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/routable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/routable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/defaults/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/learn/route.js +1 -1
- package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/login/page.js +1 -1
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +11 -11
- package/app/.next-cli-build/server/chunks/1274.js +1 -1
- package/app/.next-cli-build/server/chunks/1350.js +1 -1
- package/app/.next-cli-build/server/chunks/2619.js +1 -0
- package/app/.next-cli-build/server/chunks/2847.js +1 -1
- package/app/.next-cli-build/server/chunks/369.js +2 -2
- package/app/.next-cli-build/server/chunks/4330.js +1 -1
- package/app/.next-cli-build/server/chunks/5139.js +1 -1
- package/app/.next-cli-build/server/chunks/5350.js +1 -1
- package/app/.next-cli-build/server/chunks/5565.js +1 -1
- package/app/.next-cli-build/server/chunks/5624.js +1 -1
- package/app/.next-cli-build/server/chunks/5717.js +1 -1
- package/app/.next-cli-build/server/chunks/5781.js +2 -2
- package/app/.next-cli-build/server/chunks/6533.js +1 -0
- package/app/.next-cli-build/server/chunks/7201.js +1 -1
- package/app/.next-cli-build/server/chunks/7828.js +4 -0
- package/app/.next-cli-build/server/chunks/8400.js +1 -1
- package/app/.next-cli-build/server/chunks/869.js +1 -1
- package/app/.next-cli-build/server/chunks/8789.js +1 -1
- package/app/.next-cli-build/server/chunks/8915.js +1 -1
- package/app/.next-cli-build/server/chunks/8998.js +21 -21
- package/app/.next-cli-build/server/chunks/9261.js +9 -9
- package/app/.next-cli-build/server/chunks/9264.js +1 -1
- package/app/.next-cli-build/server/chunks/9421.js +2 -2
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js +2 -2
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/{1321-227ff10ac053e663.js → 1321-b1d92a764bdc4978.js} +1 -1
- package/app/open-sse/identity/tls/bin/darwin/arm64/switchboard-claude-tls +0 -0
- package/app/open-sse/identity/tls/bin/darwin/x64/switchboard-claude-tls +0 -0
- package/app/open-sse/identity/tls/bin/linux/arm64/switchboard-claude-tls +0 -0
- package/app/open-sse/identity/tls/bin/linux/x64/switchboard-claude-tls +0 -0
- package/app/open-sse/identity/tls/bin/win32/arm64/switchboard-claude-tls.exe +0 -0
- package/app/open-sse/identity/tls/bin/win32/x64/switchboard-claude-tls.exe +0 -0
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/.next-cli-build/server/chunks/1351.js +0 -1
- package/app/.next-cli-build/server/chunks/3735.js +0 -4
- package/app/.next-cli-build/server/chunks/403.js +0 -1
- /package/app/.next/static/{NvDkTo00u9NnH7x0us5x_ → _QJazGP3H6y4MJykGD5aW}/_buildManifest.js +0 -0
- /package/app/.next/static/{NvDkTo00u9NnH7x0us5x_ → _QJazGP3H6y4MJykGD5aW}/_ssgManifest.js +0 -0
- /package/app/.next-cli-build/static/{NvDkTo00u9NnH7x0us5x_ → _QJazGP3H6y4MJykGD5aW}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{NvDkTo00u9NnH7x0us5x_ → _QJazGP3H6y4MJykGD5aW}/_ssgManifest.js +0 -0
|
@@ -144,7 +144,7 @@ data: [DONE]
|
|
|
144
144
|
`)}function l(){return(0,e.v8)({event:"response.failed",data:{type:"response.failed",response:{id:`resp_${Date.now()}`,status:"failed",error:{type:"stream_error",code:"stream_disconnected",message:"stream timeout: closed before response.completed"}}}},d.h.OPENAI_RESPONSES)}},48400:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{getExecutor:()=>B});var e=c(7274),f=c(52939),g=c(99898),h=c(75405),i=c(26951),j=c(76004),k=c(42053),l=c(1773),m=c(14601),n=c(99396),o=c(23436),p=c(23553),q=c(98883),r=c(92330),s=c(50607),t=c(90910),u=c(88508),v=c(27864),w=c(76791),x=c(75621),y=c(99193),z=c(77151);c(65833);var A=a([n]);n=(A.then?(await A)():A)[0];let C={antigravity:new e.c,azure:new f.P,"gemini-cli":new g.VG,github:new h.x,iflow:new i.r,qoder:new j.DH,kiro:new k.B,kimchi:new l.BL,codex:new m.T,cursor:new n.ou,cu:new n.ou,vertex:new o.w("vertex"),"vertex-partner":new o.w("vertex-partner"),qwen:new p.R,opencode:new q.j,"grok-web":new r.$,"perplexity-web":new s.Ay,"ollama-local":new t.D,commandcode:new u.A,"xiaomi-tokenplan":new v.F,"mimo-free":new w.Yh,mmf:new w.Yh,"codebuddy-cn":new x.v,"grok-cli":new z.h},D=new Map;function B(a){return C[a]?C[a]:(D.has(a)||D.set(a,new y.L(a)),D.get(a))}d()}catch(a){d(a)}})},49462:(a,b,c)=>{function d(a){return`data: ${JSON.stringify(a)}
|
|
145
145
|
|
|
146
146
|
`}function e({id:a,created:b,model:c,delta:f,finishReason:g=null}){return d({id:a,object:"chat.completion.chunk",created:b,model:c,choices:[{index:0,delta:f,finish_reason:g}]})}c.d(b,{N:()=>d,z:()=>e})},50607:(a,b,c)=>{c.d(b,{Ay:()=>A});var d=c(65833),e=c(4630),f=c(4905),g=c(49462),h=c(46052);let i=e.xq["perplexity-web"].baseUrl,j="2.18",k={"pplx-auto":["concise","pplx_pro"],"pplx-sonar":["copilot","experimental"],"pplx-gpt":["copilot","gpt54"],"pplx-gemini":["copilot","gemini31pro_high"],"pplx-sonnet":["copilot","claude46sonnet"],"pplx-opus":["copilot","claude46opus"],"pplx-nemotron":["copilot","nv_nemotron_3_super"]},l={"pplx-gpt":"gpt54_thinking","pplx-sonnet":"claude46sonnetthinking","pplx-opus":"claude46opusthinking"},m=/\[\d+\]/g,n=/<grok:[^>]*>.*?<\/grok:[^>]*>/gs,o=/<grok:[^>]*\/>/g,p=/<[?]xml[^?]*[?]>/g,q=/<\/?response\b[^>]*>/gi,r=/ {2,}/g,s=/\n{3,}/g,t=new Map;function u(a){let b=a.map(a=>`${a.role}:${a.content}`).join("\n"),c=0x811c9dc5;for(let a=0;a<b.length;a++)c^=b.charCodeAt(a),c=0x1000193*c>>>0;return c.toString(16).padStart(8,"0")}function v(a,b,c,d){if(!d)return;let e=u([...a,{role:"user",content:b},{role:"assistant",content:c}]);if(t.set(e,{backendUuid:d,ts:Date.now()}),t.size>200){let a=null,b=1/0;for(let[c,d]of t)d.ts<b&&(b=d.ts,a=c);a&&t.delete(a)}}function w(a,b=!0){let c=a;return c=(c=(c=(c=(c=c.replace(p,"")).replace(m,"")).replace(n,"")).replace(o,"")).replace(q,""),b&&(c=(c=(c=c.replace(r," ")).replace(s,"\n\n")).trim()),c}async function*x(a,b){let c=a.getReader(),d=new TextDecoder,e="",f=[];function g(){if(0===f.length)return null;let a=f.join("\n");f=[];let b=a.trim();if(!b||"[DONE]"===b)return"done";try{return JSON.parse(b)}catch{return null}}try{for(;;){if(b?.aborted)return;let{value:a,done:h}=await c.read();if(h)break;for(e+=d.decode(a,{stream:!0});;){let a=e.indexOf("\n");if(a<0)break;let b=e.slice(0,a);e=e.slice(a+1);let c=b.endsWith("\r")?b.slice(0,-1):b;if(""===c){let a=g();if("done"===a)return;a&&(yield a);continue}if(c.startsWith("data:")&&f.push(c.slice(5).trimStart()),"event: end_of_stream"===c)return}}(e+=d.decode()).trim().startsWith("data:")&&f.push(e.trim().slice(5).trimStart());let a=g();a&&"done"!==a&&(yield a)}finally{c.releaseLock()}}async function*y(a,b){let c="",d=null,e=0,f=new Set;for await(let g of x(a,b)){if(g.error_code||g.error_message)return void(yield{error:g.error_message||`Perplexity error: ${g.error_code}`,done:!0});g.backend_uuid&&(d=g.backend_uuid);let a=g.blocks??[];for(let b of a){let a=b.intended_usage??"";if("pro_search_steps"===a&&b.plan_block?.steps){for(let a of b.plan_block.steps)if("SEARCH_WEB"===a.step_type)for(let b of a.search_web_content?.queries??[]){let a=b.query??"";a&&!f.has(a)&&(f.add(a),yield{thinking:`Searching: ${a}`,backendUuid:d??void 0})}else if("READ_RESULTS"===a.step_type)for(let b of(a.read_results_content?.urls??[]).slice(0,3))b&&!f.has(b)&&(f.add(b),yield{thinking:`Reading: ${b}`,backendUuid:d??void 0})}if("plan"===a&&b.plan_block?.goals)for(let a of b.plan_block.goals){let b=a.description??"";b&&!f.has(b)&&(f.add(b),yield{thinking:b,backendUuid:d??void 0})}if(!a.includes("markdown"))continue;let g=b.markdown_block;if(!g)continue;let h=g.chunks??[];if(0!==h.length)if("DONE"===g.progress)c=h.join("");else{let a=c+h.join("");if(a.length>e){let b=a.slice(e);c=a,e=a.length,yield{delta:b,answer:c,backendUuid:d??void 0}}}}if(0===a.length&&g.text){let a=g.text.trim();if(a.length>e){let b=a.slice(e);c=a,e=a.length,yield{delta:b,answer:c,backendUuid:d??void 0}}}if(g.final||"COMPLETED"===g.status)break}yield{delta:"",answer:c,backendUuid:d??void 0,done:!0}}async function z(a,b,c,d,e,f,g){let h="",i=null,j=[];for await(let b of y(a,g)){if(b.backendUuid&&(i=b.backendUuid),b.error)return new Response(JSON.stringify({error:{message:b.error,type:"upstream_error",code:"PPLX_ERROR"}}),{status:502,headers:{"Content-Type":"application/json"}});if(b.thinking){j.push(b.thinking);continue}if(b.done){h=b.answer||h;break}b.answer&&(h=b.answer)}v(e,f,h=w(h),i);let k=j.length>0?j.join("\n"):void 0,l={role:"assistant",content:h};k&&(l.reasoning_content=k);let m=Math.ceil(f.length/4),n=Math.ceil(h.length/4);return new Response(JSON.stringify({id:c,object:"chat.completion",created:d,model:b,system_fingerprint:null,choices:[{index:0,message:l,finish_reason:"stop",logprobs:null}],usage:{prompt_tokens:m,completion_tokens:n,total_tokens:m+n}}),{status:200,headers:{"Content-Type":"application/json"}})}class A extends d.Hv{constructor(){super("perplexity-web",e.xq["perplexity-web"])}async execute({model:a,body:b,stream:c,credentials:d,signal:e,log:m,proxyOptions:n=null}){var o,p,q,r,s;let x,A,B,C,D,E=b?.messages;if(!E||!Array.isArray(E)||0===E.length)return{response:new Response(JSON.stringify({error:{message:"Missing or empty messages array",type:"invalid_request"}}),{status:400,headers:{"Content-Type":"application/json"}}),url:i,headers:{},transformedBody:b};(b?.thinking===!0||b?.reasoning_effort!=null&&"none"!==b.reasoning_effort)&&l[a]?(x="copilot",A=l[a],m?.info?.("PPLX-WEB",`Thinking mode → ${a} using ${A}`)):k[a]?[x,A]=k[a]:(x="copilot",A=a,m?.info?.("PPLX-WEB",`Unmapped model ${a}, using as raw preference`));let F=function(a){let b="",c=[];for(let d of a){let a=String(d.role||"user");"developer"===a&&(a="system");let e="";"string"==typeof d.content?e=d.content:Array.isArray(d.content)&&(e=d.content.filter(a=>"text"===a.type).map(a=>String(a.text||"")).join(" ")),e.trim()&&("system"===a?b+=e+"\n":("user"===a||"assistant"===a)&&c.push({role:a,content:e}))}let d="";return c.length>0&&"user"===c[c.length-1].role&&(d=c.pop().content),{systemMsg:b,history:c,currentMsg:d}}(E),G=function(a){if(0===a.length)return null;let b=u(a),c=t.get(b);return c?Date.now()-c.ts>36e5?(t.delete(b),null):c.backendUuid:null}(F.history);G&&m?.info?.("PPLX-WEB",`Session continue: ${G.slice(0,12)}...`);let H=function(a,b,c){if(b)return a.currentMsg;let d={},e=[];a.systemMsg.trim()&&e.push(a.systemMsg.trim());let f=function(a){if(!Array.isArray(a)||0===a.length)return"";let b=a.map(a=>{let b=a?.function||a||{},c=b.name||"unnamed",d=(b.description||"").split("\n")[0].slice(0,200);return`- ${c}: ${d}`});return`Available tools (reference only, cannot invoke):
|
|
147
|
-
${b.join("\n")}`}(c);f&&e.push(f),e.push("You have built-in web search. Answer questions directly using search results."),d.instructions=e,a.history.length>0&&(d.history=a.history),a.currentMsg?d.query=a.currentMsg:0===a.history.length&&(d.query="");let g=JSON.stringify(d);return g.length>96e3?g.slice(-96e3):g}(F,G,b?.tools);if(!H.trim())return{response:new Response(JSON.stringify({error:{message:"Empty query after processing",type:"invalid_request"}}),{status:400,headers:{"Content-Type":"application/json"}}),url:i,headers:{},transformedBody:b};let I=(o=x,p=A,D="u">typeof Intl?Intl.DateTimeFormat().resolvedOptions().timeZone:"UTC",{query_str:H,params:{query_str:H,search_focus:"internet",mode:o,model_preference:p,sources:["web"],attachments:[],frontend_uuid:crypto.randomUUID(),frontend_context_uuid:crypto.randomUUID(),version:j,language:"en-US",timezone:D,search_recency_filter:null,is_incognito:!0,use_schematized_api:!0,last_backend_uuid:G}}),J={"Content-Type":"application/json",Accept:"text/event-stream",Origin:"https://www.perplexity.ai",Referer:"https://www.perplexity.ai/","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36","X-App-ApiClient":"default","X-App-ApiVersion":j};d.accessToken?J.Authorization=`Bearer ${d.accessToken}`:d.apiKey&&(J.Cookie=`__Secure-next-auth.session-token=${d.apiKey}`),m?.info?.("PPLX-WEB",`Query to ${a} (pref=${A}, mode=${x}), len=${H.length}`);let K={method:"POST",headers:J,body:JSON.stringify(I),identity:this.config.identity,provider:this.provider,format:this.config.format};e&&(K.signal=e);try{B=await (0,h.Fm)(i,K,n)}catch(a){return m?.error?.("PPLX-WEB",`Fetch failed: ${a.message||String(a)}`),{response:new Response(JSON.stringify({error:{message:`Perplexity connection failed: ${a.message||String(a)}`,type:"upstream_error"}}),{status:502,headers:{"Content-Type":"application/json"}}),url:i,headers:J,transformedBody:I}}if(!B.ok){let a=B.status,b=`Perplexity returned HTTP ${a}`;return 401===a||403===a?b="Perplexity auth failed — session cookie may be expired. Re-paste your __Secure-next-auth.session-token.":429===a&&(b="Perplexity rate limited. Wait a moment and retry."),m?.warn?.("PPLX-WEB",b),{response:new Response(JSON.stringify({error:{message:b,type:"upstream_error",code:`HTTP_${a}`}}),{status:a,headers:{"Content-Type":"application/json"}}),url:i,headers:J,transformedBody:I}}if(!B.body)return{response:new Response(JSON.stringify({error:{message:"Perplexity returned empty response body",type:"upstream_error"}}),{status:502,headers:{"Content-Type":"application/json"}}),url:i,headers:J,transformedBody:I};let L=`chatcmpl-pplx-${crypto.randomUUID().slice(0,12)}`,M=Math.floor(Date.now()/1e3);if(c){let b;C=new Response((q=B.body,r=F.history,s=F.currentMsg,b=new TextEncoder,new ReadableStream({async start(c){try{c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{role:"assistant"},finish_reason:null,logprobs:null}]})));let d="",h=null;for await(let f of y(q,e)){if(f.backendUuid&&(h=f.backendUuid),f.error){c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{content:`[Error: ${f.error}]`},finish_reason:null,logprobs:null}]})));break}if(f.thinking){c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{reasoning_content:f.thinking+"\n"},finish_reason:null,logprobs:null}]})));continue}if(f.done){d=f.answer||d;break}let e=f.delta||"";e&&(e=w(e,!1))&&c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{content:e},finish_reason:null,logprobs:null}]}))),f.answer&&(d=f.answer)}c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{},finish_reason:"stop",logprobs:null}]}))),c.enqueue(b.encode(f.$U)),v(r,s,w(d),h)}catch(d){c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{content:`[Stream error: ${d.message||String(d)}]`},finish_reason:"stop",logprobs:null}]}))),c.enqueue(b.encode(f.$U))}finally{c.close()}}})),{status:200,headers:{...f.uB}})}else C=await z(B.body,a,L,M,F.history,F.currentMsg,e);return{response:C,url:i,headers:J,transformedBody:I}}}},51154:(a,b,c)=>{c.d(b,{au:()=>m});var d=c(10640);let e="<|tool▁calls▁begin|>",f="<|tool▁call▁begin|>",g="<|tool▁sep|>",h="<|tool▁call▁end|>",i="<|tool▁calls▁end|>",j="<|DSML|tool_calls>",k=/(<|tool▁calls▁begin|>|<|DSML|tool_calls>)/,l=[[/deepseek|composer/i,{name:"deepseek",detect:a=>k.test(a),parse(a){let b=function(a){let b=a.indexOf(e);if(b<0)return null;let c=a.slice(0,b).trim(),j=a.indexOf(i,b),k=j>=0?a.slice(b+e.length,j):a.slice(b+e.length),l=j>=0?a.slice(j+i.length).trim():"",m=[],n=k.split(f).filter(Boolean);for(let a=0;a<n.length;a++){let b=n[a],c=function(a,b){let c=a;c.startsWith(f)&&(c=c.slice(f.length)),c.endsWith(h)&&(c=c.slice(0,-h.length));let e=c.indexOf(g);if(e<0)return null;let i=c.slice(e+g.length),j=i.search(/[\n`]/),k=j>0?i.slice(0,j).trim():i.trim();if(!k)return null;let l="{}",m=i.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);if(m)l=m[1].trim();else{let a=i.slice(j>=0?j:0).trim();(a.startsWith("{")||a.startsWith("["))&&(l=a)}try{JSON.parse(l)}catch{l=JSON.stringify({_raw:l})}return{id:(0,d.J4)(0,b,k),type:"function",function:{name:k,arguments:l}}}(b=f+b,a);c&&m.push(c)}return 0===m.length?null:{content:[c,l].filter(Boolean).join("\n").trim()||null,toolCalls:m}}(a);if(b)return b;let c=function(a){let b,c=a.indexOf(j);if(c<0)return null;let e=a.slice(0,c).trim(),f=a.slice(c+j.length);if(f.length>5e5)return null;let g=/<|DSML|invoke\s+name="([^"]+)">([\s\S]*?)(?:<\/|DSML|invoke>|$)/g,h=/<|DSML|parameter\s+name="([^"]+)"\s+string="(true|false)">([\s\S]*?)(?=<|DSML|parameter|<\/|DSML|invoke>|$)/g,i=[];for(;null!==(b=g.exec(f));){let a,c=b[1],e=b[2],f={};for(h.lastIndex=0;null!==(a=h.exec(e));){let b=a[1],c="true"===a[2],d=a[3].trim();if(c)f[b]=d;else try{f[b]=JSON.parse(d)}catch{f[b]=d}}i.push({id:(0,d.J4)(0,i.length,c),type:"function",function:{name:c,arguments:JSON.stringify(f)}})}return 0===i.length?null:{content:e||null,toolCalls:i}}(a);return c||null}}]];function m(a,b){if(!a||!b)return null;let c=function(a){if(!a)return null;for(let[b,c]of l)if(b.test(a))return c;return null}(b);return c&&c.detect(a)?c.parse(a):null}},52939:(a,b,c)=>{c.d(b,{P:()=>e});var d=c(99193);class e extends d.L{constructor(){super("azure")}isUserConfiguredBase(a){return super.isUserConfiguredBase(a)||!!a?.providerSpecificData?.azureEndpoint||!!process.env.AZURE_ENDPOINT}buildUrl(a,b,c=0,d=null){let e=d?.providerSpecificData?.azureEndpoint||process.env.AZURE_ENDPOINT||"https://api.openai.com",f=d?.providerSpecificData?.apiVersion||process.env.AZURE_API_VERSION||"2024-10-01-preview",g=d?.providerSpecificData?.deployment||a||process.env.AZURE_DEPLOYMENT||"gpt-4",h=e.replace(/\/$/,"");return`${h}/openai/deployments/${g}/chat/completions?api-version=${f}`}buildHeaders(a,b=!0){let c={"Content-Type":"application/json",...this.config.headers},d=a?.apiKey||a?.accessToken||process.env.AZURE_API_KEY;d&&(c["api-key"]=d);let e=a?.providerSpecificData?.organization||process.env.AZURE_ORGANIZATION;return e&&(c["OpenAI-Organization"]=e),b&&(c.Accept="text/event-stream"),c}transformRequest(a,b,c,d){return super.transformRequest(a,b,c,d)}}},75405:(a,b,c)=>{c.d(b,{x:()=>p});var d=c(65833),e=c(4630),f=c(28730),g=c(60290),h=c(97579),i=c(86711),j=c(48664),k=c(45894),l=c(46052),m=c(79666),n=c(4905),o=c(55511);class p extends d.Hv{constructor(){super("github",e.xq.github),this.knownCodexModels=new Set}buildUrl(a,b,c=0){return this.config.baseUrl}buildHeaders(a,b=!0){let c=a.copilotToken||a.accessToken;return{Authorization:`Bearer ${c}`,"Content-Type":"application/json","x-request-id":o.randomUUID?.()||`${Date.now()}-${Math.random().toString(36).slice(2)}`,Accept:b?"text/event-stream":"application/json"}}sanitizeMessagesForChatCompletions(a){if(!a?.messages)return a;let b={...a};if(a.response_format&&a.model?.includes("claude")){let b=a.response_format,c="";if("json_schema"===b.type&&b.json_schema?.schema?c="CRITICAL: You must ONLY output raw JSON. Never use markdown code blocks. Never use backticks. Never wrap JSON in triple backticks. Output ONLY the raw JSON object.":"json_object"===b.type&&(c="CRITICAL: You must ONLY output raw JSON. Never use markdown code blocks. Never use backticks."),c){let b=a.messages.findIndex(a=>"system"===a.role);b>=0?a.messages[b].content=c+"\n\n"+a.messages[b].content:a.messages.unshift({role:"system",content:c});let d=a.messages.map((a,b)=>"user"===a.role?b:-1).filter(a=>a>=0).pop();if(d>=0){let b=a.messages[d],c="string"==typeof b.content?b.content:JSON.stringify(b.content);b.content="Respond with ONLY raw JSON (no markdown, no backticks, no code blocks): "+c}}}return b.messages=a.messages.map(a=>{if(!a.content||"string"==typeof a.content)return a;if(Array.isArray(a.content)){let b=a.content.map(a=>{if("text"===a.type||"image_url"===a.type)return a;let b=a.text||a.content||JSON.stringify(a);return{type:"text",text:"string"==typeof b?b:JSON.stringify(b)}}).filter(a=>""!==a.text);return{...a,content:b.length>0?b:null}}return a}),b}requiresMaxCompletionTokens(a){return/gpt-5|o[134]-/i.test(a)}transformRequest(a,b,c,d){super.transformRequest(a,b,c,d);let e=b&&"object"==typeof b?b:{...b};return this.requiresMaxCompletionTokens(a)&&void 0!==e.max_tokens&&(e.max_completion_tokens=e.max_tokens,delete e.max_tokens),"none"===e.reasoning_effort&&delete e.reasoning_effort,(0,m.c)("github",a,e),e}supportsResponsesEndpoint(a){let b=(a||"").toLowerCase();return!(b.includes("gemini")||b.includes("claude"))}async execute(a){let{model:b,log:c}=a;if(this.knownCodexModels.has(b)&&this.supportsResponsesEndpoint(b))return c?.debug("GITHUB",`Using cached /responses route for ${b}`),this.executeWithResponsesEndpoint(a);let d={...a,body:this.sanitizeMessagesForChatCompletions(a.body)},e=await super.execute({...d,proxyOptions:a.proxyOptions||null});if(e.response.status===g.gx.BAD_REQUEST&&this.supportsResponsesEndpoint(b)){let d=await e.response.clone().text();if(d.includes("not accessible via the /chat/completions endpoint")||d.includes("The requested model is not supported"))return c?.warn("GITHUB",`Model ${b} requires /responses. Switching...`),this.knownCodexModels.add(b),this.executeWithResponsesEndpoint(a)}return e}async executeWithResponsesEndpoint({model:a,body:b,stream:d,credentials:e,signal:f,log:g,proxyOptions:m=null}){let o=this.config.responsesUrl,p=this.buildHeaders(e,d),q=(0,h.h)(a,b,d,e);g?.debug("GITHUB","Sending translated request to /responses");let r=await (0,l.Fm)(o,{method:"POST",headers:p,body:JSON.stringify(q),signal:f,identity:this.config?.identity,provider:this.provider,format:this.config?.format,stream:d},m);if(!r.ok)return{response:r,url:o,headers:p,transformedBody:q};if(!d&&r.body)try{let{convertResponsesStreamToJson:b}=await c.e(4176).then(c.bind(c,94176)),d=await b(r.body),e=function(a,b){let c=Array.isArray(a?.output)?a.output:[],d="",e=[];for(let a of c){if(a?.type==="message"&&Array.isArray(a.content))for(let b of a.content)b?.type==="output_text"&&"string"==typeof b.text?d+=b.text:"string"==typeof b?.text&&(d+=b.text);a?.type==="function_call"&&e.push({id:a.call_id||`call_${a.name}_${e.length}`,type:"function",function:{name:a.name,arguments:"string"==typeof a.arguments?a.arguments:JSON.stringify(a.arguments||{})}})}let f={role:"assistant",content:d||(e.length?null:"")};e.length&&(f.tool_calls=e);let g=a?.usage||{};return{id:a?.id||`chatcmpl-${Date.now()}`,object:"chat.completion",created:a?.created_at||Math.floor(Date.now()/1e3),model:a?.model||b,choices:[{index:0,message:f,finish_reason:e.length?"tool_calls":"stop"}],usage:{prompt_tokens:g.input_tokens||0,completion_tokens:g.output_tokens||0,total_tokens:(g.input_tokens||0)+(g.output_tokens||0)}}}(d,a);return{response:new Response(JSON.stringify(e),{status:200,headers:{"Content-Type":"application/json"}}),url:o,headers:p,transformedBody:q}}catch(a){g?.warn?.("GITHUB",`non-stream responses aggregate failed: ${a.message}`)}let s=(0,j.Ws)("openai-responses");s.model=a;let t=new TextDecoder,u="",v=new TransformStream({async transform(a,b){let c=(u+=t.decode(a,{stream:!0})).split("\n");for(let a of(u=c.pop()||"",c)){let c=a.trim();if(!c)continue;let e=(0,k.tV)(c);if(!e)continue;if(e.done&&!0===d){b.enqueue(new TextEncoder().encode(n.$U));continue}let f=(0,i.v)(e,s);if(f){let a=(0,k.v8)(f,"openai");b.enqueue(new TextEncoder().encode(a))}}},flush(a){if(u.trim()){let b=(0,k.tV)(u.trim());if(b&&!b.done){let c=(0,i.v)(b,s);c&&a.enqueue(new TextEncoder().encode((0,k.v8)(c,"openai")))}}}});return r.body?{response:new Response(r.body.pipeThrough(v),{status:r.status,statusText:r.statusText,headers:r.headers}),url:o,headers:p,transformedBody:q}:{response:new Response("",{status:r.status,headers:r.headers}),url:o,headers:p,transformedBody:q}}async refreshCopilotToken(a,b,c=null){try{let d=await (0,l.Fm)("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:`token ${a}`,Accept:"application/json"},identity:this.config?.identity,provider:this.provider,format:this.config?.format},c);if(!d.ok){let a=await d.text();return b?.error?.("TOKEN",`Copilot token refresh failed: ${d.status} ${a}`),null}let e=await d.json();return b?.info?.("TOKEN","Copilot token refreshed"),{token:e.token,expiresAt:e.expires_at}}catch(a){return b?.error?.("TOKEN",`Copilot refresh error: ${a.message}`),null}}async refreshGitHubToken(a,b,c=null){try{let d={grant_type:"refresh_token",refresh_token:a,client_id:this.config.clientId};this.config.clientSecret&&(d.client_secret=this.config.clientSecret);let e=await (0,l.Fm)(f.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(d),identity:this.config?.identity,provider:this.provider,format:this.config?.format},c);if(!e.ok)return null;let g=await e.json();return b?.info?.("TOKEN","GitHub token refreshed"),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return b?.error?.("TOKEN",`GitHub refresh error: ${a.message}`),null}}async refreshCredentials(a,b,c=null){let d=await this.refreshCopilotToken(a.accessToken,b,c);if(!d&&a.refreshToken){let e=await this.refreshGitHubToken(a.refreshToken,b,c);if(e?.accessToken)return(d=await this.refreshCopilotToken(e.accessToken,b,c))?{...e,copilotToken:d.token,copilotTokenExpiresAt:d.expiresAt}:e}return d?{accessToken:a.accessToken,refreshToken:a.refreshToken,copilotToken:d.token,copilotTokenExpiresAt:d.expiresAt}:null}needsRefresh(a){if(!a.copilotToken)return!0;if(a.copilotTokenExpiresAt){let b=a.copilotTokenExpiresAt;if("number"==typeof b&&b<1e12?b*=1e3:"string"==typeof b&&(b=new Date(b).getTime()),!Number.isFinite(b)||b-Date.now()<3e5)return!0}return super.needsRefresh(a)}}},75621:(a,b,c)=>{c.d(b,{v:()=>e});var d=c(99193);class e extends d.L{constructor(){super("codebuddy-cn")}transformRequest(a,b,c,d){let e=super.transformRequest(a,b,c,d);e.stream=!0;let f=e.reasoning_effort;return"none"===f||"off"===f?delete e.reasoning_effort:f&&(e.reasoning_summary="auto"),e}}},76004:(a,b,c)=>{c.d(b,{DH:()=>q});let d=(()=>{let a=new Int16Array(128).fill(-1);for(let b=0;b<64;b++)a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(b)]="_doRTgHZBKcGVjlvpC,@aFSx#DPuNJme&i*MzLOEn)sUrthbf%Y^w.(kIQyXqWA!".charCodeAt(b);return a[61]=36,a})();var e=c(99393),f=c(47293),g=c(55511),h=c(65833),i=c(4630),j=c(46052),k=c(4905),l=c(60290),m=c(8298),n=c(9155);function o(a,b){return a&&a.length>b?`${a.slice(0,b)}...`:a||""}async function p({model:a,body:b,credentials:c,log:d,proxyOptions:e,signal:h}){let i=String(a||"").replace(/^qoder\//,""),j=await (0,n.X5)(c,i,{log:d,proxyOptions:e,signal:h});if(!j){let a=await (0,n.EV)(c,{forceRefresh:!0,log:d,proxyOptions:e,signal:h}),b=a?.rawConfigs.get(i);if(!b)throw Error(`qoder: model_config for "${i}" not yet known (run a model list fetch or check upstream connectivity)`);j={...b,key:i}}let{messages:k,systemText:l}=function(a){if(!Array.isArray(a)||0===a.length)return{messages:[],systemText:""};let b=[],c=[];for(let d of a){if(!d||"object"!=typeof d)continue;let a=function(a){if("string"==typeof a)return a;if(null==a)return"";if(Array.isArray(a)){let b=[];for(let c of a)c&&"object"==typeof c&&("text"===c.type&&"string"==typeof c.text?b.push(c.text):"string"==typeof c.text&&b.push(c.text));return b.join("\n")}return String(a)}(d.content);if("system"===d.role){a&&b.push(a);continue}let e={...d};e.content=a,c.push(e)}return{messages:c,systemText:b.join("\n\n")}}(b.messages||[]),m=b.tools,q=!!j.is_reasoning,r=Number(j.max_output_tokens)||0,s=32768;r>0&&(s=r),"number"==typeof b.max_tokens&&b.max_tokens>0&&b.max_tokens<s&&(s=b.max_tokens),"number"==typeof b.max_completion_tokens&&b.max_completion_tokens>0&&b.max_completion_tokens<s&&(s=b.max_completion_tokens);let t=function(a){for(let b=a.length-1;b>=0;b--){let c=a[b];if(c?.role==="user"&&"string"==typeof c.content)return c.content}return""}(k),u=function(a,...b){let c=(0,g.createHash)("sha256");for(let d of(c.update(a),b))c.update("\0"),c.update(String(d??""));return c.digest("hex").slice(0,16)}("qoder-session",(c.providerSpecificData||{}).userId,i),v=function(a,b,c,d){let e=(0,g.createHash)("sha256");for(let c of(e.update("qoder-record\0"),e.update(String(a)),b))c&&"object"==typeof c&&(c.role&&(e.update("\0"),e.update(c.role)),"string"==typeof c.content&&c.content&&(e.update("\0"),e.update(c.content)));if(c){e.update("\0");try{e.update(JSON.stringify(c))}catch{}}return e.update(`\0mt=${d}`),e.digest("hex").slice(0,16)}(i,k,m,s);return{qoderKey:i,payload:{request_id:(0,f.A)(),request_set_id:v,chat_record_id:v,session_id:u,stream:!0,chat_task:"FREE_INPUT",is_reply:!0,is_retry:!1,source:1,version:"3",session_type:"qodercli",agent_id:"agent_common",task_id:"common",code_language:"",chat_prompt:"",image_urls:null,aliyun_user_type:"",system:l,messages:k,tools:Array.isArray(m)?m:[],parameters:{max_tokens:s},chat_context:{chatPrompt:"",imageUrls:null,extra:{context:[],modelConfig:{key:i,is_reasoning:q},originalContent:t},features:[],text:t},model_config:j,business:{product:"cli",version:"1.0.0",type:"agent",stage:"start",id:(0,f.A)(),name:o(t,30),begin_at:Date.now()}},modelConfig:j}}class q extends h.Hv{constructor(){super("qoder",i.xq.qoder)}buildUrl(){return m.KC}async execute({model:a,body:b,stream:c,credentials:f,signal:g,log:h,proxyOptions:i=null}){let m,n,q,r,s=this.buildUrl(),t=f?.providerSpecificData||{};if(!t.userId)return{response:new Response(JSON.stringify({error:{message:"qoder credential is missing userId; reconnect the account"}}),{status:401,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b};if(!f?.accessToken)return{response:new Response(JSON.stringify({error:{message:"qoder credential is missing accessToken; reconnect the account"}}),{status:401,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b};try{({qoderKey:m,payload:n}=await p({model:a,body:b,credentials:f,log:h,proxyOptions:i,signal:g}))}catch(a){return{response:new Response(JSON.stringify({error:{message:a.message}}),{status:400,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b}}let u=function(a){let b=(Buffer.isBuffer(a)?a:"string"==typeof a?Buffer.from(a,"utf8"):Buffer.from(a)).toString("base64"),c=b.length,e=Math.floor(c/3),f=b.slice(c-e)+b.slice(e,c-e)+b.slice(0,e),g=Buffer.alloc(c);for(let a=0;a<c;a++){let b=f.charCodeAt(a);b<128&&d[b]>=0?g[a]=d[b]:g[a]=b}return g.toString("latin1")}(Buffer.from(JSON.stringify(n),"utf8")),v=Buffer.from(u,"latin1");try{q=(0,e.d)(v,s,{userId:t.userId,authToken:f.accessToken,name:f.displayName||"",email:f.email||"",machineId:t.machineId||""})}catch(a){return{response:new Response(JSON.stringify({error:{message:`qoder cosy signing failed: ${a.message}`}}),{status:401,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b}}let w={"Content-Type":"application/json",Accept:"text/event-stream","Cache-Control":"no-cache","X-Model-Key":m,"X-Model-Source":n.model_config&&n.model_config.source||"system","Accept-Encoding":"identity",...q},x=this.config?.timeoutMs||l.pH,y=new AbortController,z=setTimeout(()=>y.abort(Error("fetch connect timeout")),x),A=g?AbortSignal.any([g,y.signal]):y.signal;try{r=await (0,j.Fm)(s,{method:"POST",headers:w,body:v,signal:A,identity:this.resolveIdentity(f),provider:this.provider,format:this.config?.format},i)}finally{clearTimeout(z)}return r.ok?{response:function(a,b){if(!a.ok||!a.body)return a;let c=new TextDecoder,d=new TextEncoder,e="",f=!1,g=(a,c)=>{let e,g=a.replace(/\r$/,"").trim();if(!g||!g.startsWith("data:")||f)return;let h=g.slice(5).trimStart();if("[DONE]"===h){c.enqueue(d.encode(k.$U)),f=!0;return}try{e=JSON.parse(h)}catch{return}let i="number"==typeof e.statusCodeValue?e.statusCodeValue:200,j="string"==typeof e.body?e.body:"";if(200!==i){let a=j||`upstream status ${i}`,e=JSON.stringify({id:`qoder-error-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:b,choices:[{index:0,delta:{content:`
|
|
147
|
+
${b.join("\n")}`}(c);f&&e.push(f),e.push("You have built-in web search. Answer questions directly using search results."),d.instructions=e,a.history.length>0&&(d.history=a.history),a.currentMsg?d.query=a.currentMsg:0===a.history.length&&(d.query="");let g=JSON.stringify(d);return g.length>96e3?g.slice(-96e3):g}(F,G,b?.tools);if(!H.trim())return{response:new Response(JSON.stringify({error:{message:"Empty query after processing",type:"invalid_request"}}),{status:400,headers:{"Content-Type":"application/json"}}),url:i,headers:{},transformedBody:b};let I=(o=x,p=A,D="u">typeof Intl?Intl.DateTimeFormat().resolvedOptions().timeZone:"UTC",{query_str:H,params:{query_str:H,search_focus:"internet",mode:o,model_preference:p,sources:["web"],attachments:[],frontend_uuid:crypto.randomUUID(),frontend_context_uuid:crypto.randomUUID(),version:j,language:"en-US",timezone:D,search_recency_filter:null,is_incognito:!0,use_schematized_api:!0,last_backend_uuid:G}}),J={"Content-Type":"application/json",Accept:"text/event-stream",Origin:"https://www.perplexity.ai",Referer:"https://www.perplexity.ai/","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36","X-App-ApiClient":"default","X-App-ApiVersion":j};d.accessToken?J.Authorization=`Bearer ${d.accessToken}`:d.apiKey&&(J.Cookie=`__Secure-next-auth.session-token=${d.apiKey}`),m?.info?.("PPLX-WEB",`Query to ${a} (pref=${A}, mode=${x}), len=${H.length}`);let K={method:"POST",headers:J,body:JSON.stringify(I),identity:this.config.identity,provider:this.provider,format:this.config.format};e&&(K.signal=e);try{B=await (0,h.Fm)(i,K,n)}catch(a){return m?.error?.("PPLX-WEB",`Fetch failed: ${a.message||String(a)}`),{response:new Response(JSON.stringify({error:{message:`Perplexity connection failed: ${a.message||String(a)}`,type:"upstream_error"}}),{status:502,headers:{"Content-Type":"application/json"}}),url:i,headers:J,transformedBody:I}}if(!B.ok){let a=B.status,b=`Perplexity returned HTTP ${a}`;return 401===a||403===a?b="Perplexity auth failed — session cookie may be expired. Re-paste your __Secure-next-auth.session-token.":429===a&&(b="Perplexity rate limited. Wait a moment and retry."),m?.warn?.("PPLX-WEB",b),{response:new Response(JSON.stringify({error:{message:b,type:"upstream_error",code:`HTTP_${a}`}}),{status:a,headers:{"Content-Type":"application/json"}}),url:i,headers:J,transformedBody:I}}if(!B.body)return{response:new Response(JSON.stringify({error:{message:"Perplexity returned empty response body",type:"upstream_error"}}),{status:502,headers:{"Content-Type":"application/json"}}),url:i,headers:J,transformedBody:I};let L=`chatcmpl-pplx-${crypto.randomUUID().slice(0,12)}`,M=Math.floor(Date.now()/1e3);if(c){let b;C=new Response((q=B.body,r=F.history,s=F.currentMsg,b=new TextEncoder,new ReadableStream({async start(c){try{c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{role:"assistant"},finish_reason:null,logprobs:null}]})));let d="",h=null;for await(let f of y(q,e)){if(f.backendUuid&&(h=f.backendUuid),f.error){c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{content:`[Error: ${f.error}]`},finish_reason:null,logprobs:null}]})));break}if(f.thinking){c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{reasoning_content:f.thinking+"\n"},finish_reason:null,logprobs:null}]})));continue}if(f.done){d=f.answer||d;break}let e=f.delta||"";e&&(e=w(e,!1))&&c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{content:e},finish_reason:null,logprobs:null}]}))),f.answer&&(d=f.answer)}c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{},finish_reason:"stop",logprobs:null}]}))),c.enqueue(b.encode(f.$U)),v(r,s,w(d),h)}catch(d){c.enqueue(b.encode((0,g.N)({id:L,object:"chat.completion.chunk",created:M,model:a,system_fingerprint:null,choices:[{index:0,delta:{content:`[Stream error: ${d.message||String(d)}]`},finish_reason:"stop",logprobs:null}]}))),c.enqueue(b.encode(f.$U))}finally{c.close()}}})),{status:200,headers:{...f.uB}})}else C=await z(B.body,a,L,M,F.history,F.currentMsg,e);return{response:C,url:i,headers:J,transformedBody:I}}}},51154:(a,b,c)=>{c.d(b,{au:()=>m});var d=c(10640);let e="<|tool▁calls▁begin|>",f="<|tool▁call▁begin|>",g="<|tool▁sep|>",h="<|tool▁call▁end|>",i="<|tool▁calls▁end|>",j="<|DSML|tool_calls>",k=/(<|tool▁calls▁begin|>|<|DSML|tool_calls>)/,l=[[/deepseek|composer/i,{name:"deepseek",detect:a=>k.test(a),parse(a){let b=function(a){let b=a.indexOf(e);if(b<0)return null;let c=a.slice(0,b).trim(),j=a.indexOf(i,b),k=j>=0?a.slice(b+e.length,j):a.slice(b+e.length),l=j>=0?a.slice(j+i.length).trim():"",m=[],n=k.split(f).filter(Boolean);for(let a=0;a<n.length;a++){let b=n[a],c=function(a,b){let c=a;c.startsWith(f)&&(c=c.slice(f.length)),c.endsWith(h)&&(c=c.slice(0,-h.length));let e=c.indexOf(g);if(e<0)return null;let i=c.slice(e+g.length),j=i.search(/[\n`]/),k=j>0?i.slice(0,j).trim():i.trim();if(!k)return null;let l="{}",m=i.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);if(m)l=m[1].trim();else{let a=i.slice(j>=0?j:0).trim();(a.startsWith("{")||a.startsWith("["))&&(l=a)}try{JSON.parse(l)}catch{l=JSON.stringify({_raw:l})}return{id:(0,d.J4)(0,b,k),type:"function",function:{name:k,arguments:l}}}(b=f+b,a);c&&m.push(c)}return 0===m.length?null:{content:[c,l].filter(Boolean).join("\n").trim()||null,toolCalls:m}}(a);if(b)return b;let c=function(a){let b,c=a.indexOf(j);if(c<0)return null;let e=a.slice(0,c).trim(),f=a.slice(c+j.length);if(f.length>5e5)return null;let g=/<|DSML|invoke\s+name="([^"]+)">([\s\S]*?)(?:<\/|DSML|invoke>|$)/g,h=/<|DSML|parameter\s+name="([^"]+)"\s+string="(true|false)">([\s\S]*?)(?=<|DSML|parameter|<\/|DSML|invoke>|$)/g,i=[];for(;null!==(b=g.exec(f));){let a,c=b[1],e=b[2],f={};for(h.lastIndex=0;null!==(a=h.exec(e));){let b=a[1],c="true"===a[2],d=a[3].trim();if(c)f[b]=d;else try{f[b]=JSON.parse(d)}catch{f[b]=d}}i.push({id:(0,d.J4)(0,i.length,c),type:"function",function:{name:c,arguments:JSON.stringify(f)}})}return 0===i.length?null:{content:e||null,toolCalls:i}}(a);return c||null}}]];function m(a,b){if(!a||!b)return null;let c=function(a){if(!a)return null;for(let[b,c]of l)if(b.test(a))return c;return null}(b);return c&&c.detect(a)?c.parse(a):null}},52939:(a,b,c)=>{c.d(b,{P:()=>e});var d=c(99193);class e extends d.L{constructor(){super("azure")}isUserConfiguredBase(a){return super.isUserConfiguredBase(a)||!!a?.providerSpecificData?.azureEndpoint||!!process.env.AZURE_ENDPOINT}buildUrl(a,b,c=0,d=null){let e=d?.providerSpecificData?.azureEndpoint||process.env.AZURE_ENDPOINT||"https://api.openai.com",f=d?.providerSpecificData?.apiVersion||process.env.AZURE_API_VERSION||"2024-10-01-preview",g=d?.providerSpecificData?.deployment||a||process.env.AZURE_DEPLOYMENT||"gpt-4",h=e.replace(/\/$/,"");return`${h}/openai/deployments/${g}/chat/completions?api-version=${f}`}buildHeaders(a,b=!0){let c={"Content-Type":"application/json",...this.config.headers},d=a?.apiKey||a?.accessToken||process.env.AZURE_API_KEY;d&&(c["api-key"]=d);let e=a?.providerSpecificData?.organization||process.env.AZURE_ORGANIZATION;return e&&(c["OpenAI-Organization"]=e),b&&(c.Accept="text/event-stream"),c}transformRequest(a,b,c,d){return super.transformRequest(a,b,c,d)}}},75405:(a,b,c)=>{c.d(b,{x:()=>p});var d=c(65833),e=c(4630),f=c(28730),g=c(60290),h=c(97579),i=c(86711),j=c(48664),k=c(45894),l=c(46052),m=c(79666),n=c(4905),o=c(55511);class p extends d.Hv{constructor(){super("github",e.xq.github),this.knownCodexModels=new Set}buildUrl(a,b,c=0){return this.config.baseUrl}buildHeaders(a,b=!0){let c=a.copilotToken||a.accessToken;return{Authorization:`Bearer ${c}`,"Content-Type":"application/json","x-request-id":o.randomUUID?.()||`${Date.now()}-${Math.random().toString(36).slice(2)}`,Accept:b?"text/event-stream":"application/json"}}sanitizeMessagesForChatCompletions(a){if(!a?.messages)return a;let b={...a};if(a.response_format&&a.model?.includes("claude")){let b=a.response_format,c="";if("json_schema"===b.type&&b.json_schema?.schema?c="CRITICAL: You must ONLY output raw JSON. Never use markdown code blocks. Never use backticks. Never wrap JSON in triple backticks. Output ONLY the raw JSON object.":"json_object"===b.type&&(c="CRITICAL: You must ONLY output raw JSON. Never use markdown code blocks. Never use backticks."),c){let b=a.messages.findIndex(a=>"system"===a.role);b>=0?a.messages[b].content=c+"\n\n"+a.messages[b].content:a.messages.unshift({role:"system",content:c});let d=a.messages.map((a,b)=>"user"===a.role?b:-1).filter(a=>a>=0).pop();if(d>=0){let b=a.messages[d],c="string"==typeof b.content?b.content:JSON.stringify(b.content);b.content="Respond with ONLY raw JSON (no markdown, no backticks, no code blocks): "+c}}}return b.messages=a.messages.map(a=>{if(!a.content||"string"==typeof a.content)return a;if(Array.isArray(a.content)){let b=a.content.map(a=>{if("text"===a.type||"image_url"===a.type)return a;let b=a.text||a.content||JSON.stringify(a);return{type:"text",text:"string"==typeof b?b:JSON.stringify(b)}}).filter(a=>""!==a.text);return{...a,content:b.length>0?b:null}}return a}),b}requiresMaxCompletionTokens(a){return/gpt-5|o[134]-/i.test(a)}transformRequest(a,b,c,d){super.transformRequest(a,b,c,d);let e=b&&"object"==typeof b?b:{...b};return this.requiresMaxCompletionTokens(a)&&void 0!==e.max_tokens&&(e.max_completion_tokens=e.max_tokens,delete e.max_tokens),"none"===e.reasoning_effort&&delete e.reasoning_effort,(0,m.c)("github",a,e),e}supportsResponsesEndpoint(a){let b=(a||"").toLowerCase();return!(b.includes("gemini")||b.includes("claude"))}async execute(a){let{model:b,log:c}=a;if(this.knownCodexModels.has(b)&&this.supportsResponsesEndpoint(b))return c?.debug("GITHUB",`Using cached /responses route for ${b}`),this.executeWithResponsesEndpoint(a);let d={...a,body:this.sanitizeMessagesForChatCompletions(a.body)},e=await super.execute({...d,proxyOptions:a.proxyOptions||null});if(e.response.status===g.gx.BAD_REQUEST&&this.supportsResponsesEndpoint(b)){let d=await e.response.clone().text();if(d.includes("not accessible via the /chat/completions endpoint")||d.includes("The requested model is not supported"))return c?.warn("GITHUB",`Model ${b} requires /responses. Switching...`),this.knownCodexModels.add(b),this.executeWithResponsesEndpoint(a)}return e}async executeWithResponsesEndpoint({model:a,body:b,stream:d,credentials:e,signal:f,log:g,proxyOptions:m=null}){let o=this.config.responsesUrl,p=this.buildHeaders(e,d),q=(0,h.h_)(a,b,d,e);g?.debug("GITHUB","Sending translated request to /responses");let r=await (0,l.Fm)(o,{method:"POST",headers:p,body:JSON.stringify(q),signal:f,identity:this.config?.identity,provider:this.provider,format:this.config?.format,stream:d},m);if(!r.ok)return{response:r,url:o,headers:p,transformedBody:q};if(!d&&r.body)try{let{convertResponsesStreamToJson:b}=await c.e(4176).then(c.bind(c,94176)),d=await b(r.body),e=function(a,b){let c=Array.isArray(a?.output)?a.output:[],d="",e=[];for(let a of c){if(a?.type==="message"&&Array.isArray(a.content))for(let b of a.content)b?.type==="output_text"&&"string"==typeof b.text?d+=b.text:"string"==typeof b?.text&&(d+=b.text);a?.type==="function_call"&&e.push({id:a.call_id||`call_${a.name}_${e.length}`,type:"function",function:{name:a.name,arguments:"string"==typeof a.arguments?a.arguments:JSON.stringify(a.arguments||{})}})}let f={role:"assistant",content:d||(e.length?null:"")};e.length&&(f.tool_calls=e);let g=a?.usage||{};return{id:a?.id||`chatcmpl-${Date.now()}`,object:"chat.completion",created:a?.created_at||Math.floor(Date.now()/1e3),model:a?.model||b,choices:[{index:0,message:f,finish_reason:e.length?"tool_calls":"stop"}],usage:{prompt_tokens:g.input_tokens||0,completion_tokens:g.output_tokens||0,total_tokens:(g.input_tokens||0)+(g.output_tokens||0)}}}(d,a);return{response:new Response(JSON.stringify(e),{status:200,headers:{"Content-Type":"application/json"}}),url:o,headers:p,transformedBody:q}}catch(a){g?.warn?.("GITHUB",`non-stream responses aggregate failed: ${a.message}`)}let s=(0,j.Ws)("openai-responses");s.model=a;let t=new TextDecoder,u="",v=new TransformStream({async transform(a,b){let c=(u+=t.decode(a,{stream:!0})).split("\n");for(let a of(u=c.pop()||"",c)){let c=a.trim();if(!c)continue;let e=(0,k.tV)(c);if(!e)continue;if(e.done&&!0===d){b.enqueue(new TextEncoder().encode(n.$U));continue}let f=(0,i.v)(e,s);if(f){let a=(0,k.v8)(f,"openai");b.enqueue(new TextEncoder().encode(a))}}},flush(a){if(u.trim()){let b=(0,k.tV)(u.trim());if(b&&!b.done){let c=(0,i.v)(b,s);c&&a.enqueue(new TextEncoder().encode((0,k.v8)(c,"openai")))}}}});return r.body?{response:new Response(r.body.pipeThrough(v),{status:r.status,statusText:r.statusText,headers:r.headers}),url:o,headers:p,transformedBody:q}:{response:new Response("",{status:r.status,headers:r.headers}),url:o,headers:p,transformedBody:q}}async refreshCopilotToken(a,b,c=null){try{let d=await (0,l.Fm)("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:`token ${a}`,Accept:"application/json"},identity:this.config?.identity,provider:this.provider,format:this.config?.format},c);if(!d.ok){let a=await d.text();return b?.error?.("TOKEN",`Copilot token refresh failed: ${d.status} ${a}`),null}let e=await d.json();return b?.info?.("TOKEN","Copilot token refreshed"),{token:e.token,expiresAt:e.expires_at}}catch(a){return b?.error?.("TOKEN",`Copilot refresh error: ${a.message}`),null}}async refreshGitHubToken(a,b,c=null){try{let d={grant_type:"refresh_token",refresh_token:a,client_id:this.config.clientId};this.config.clientSecret&&(d.client_secret=this.config.clientSecret);let e=await (0,l.Fm)(f.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(d),identity:this.config?.identity,provider:this.provider,format:this.config?.format},c);if(!e.ok)return null;let g=await e.json();return b?.info?.("TOKEN","GitHub token refreshed"),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return b?.error?.("TOKEN",`GitHub refresh error: ${a.message}`),null}}async refreshCredentials(a,b,c=null){let d=await this.refreshCopilotToken(a.accessToken,b,c);if(!d&&a.refreshToken){let e=await this.refreshGitHubToken(a.refreshToken,b,c);if(e?.accessToken)return(d=await this.refreshCopilotToken(e.accessToken,b,c))?{...e,copilotToken:d.token,copilotTokenExpiresAt:d.expiresAt}:e}return d?{accessToken:a.accessToken,refreshToken:a.refreshToken,copilotToken:d.token,copilotTokenExpiresAt:d.expiresAt}:null}needsRefresh(a){if(!a.copilotToken)return!0;if(a.copilotTokenExpiresAt){let b=a.copilotTokenExpiresAt;if("number"==typeof b&&b<1e12?b*=1e3:"string"==typeof b&&(b=new Date(b).getTime()),!Number.isFinite(b)||b-Date.now()<3e5)return!0}return super.needsRefresh(a)}}},75621:(a,b,c)=>{c.d(b,{v:()=>e});var d=c(99193);class e extends d.L{constructor(){super("codebuddy-cn")}transformRequest(a,b,c,d){let e=super.transformRequest(a,b,c,d);e.stream=!0;let f=e.reasoning_effort;return"none"===f||"off"===f?delete e.reasoning_effort:f&&(e.reasoning_summary="auto"),e}}},76004:(a,b,c)=>{c.d(b,{DH:()=>q});let d=(()=>{let a=new Int16Array(128).fill(-1);for(let b=0;b<64;b++)a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(b)]="_doRTgHZBKcGVjlvpC,@aFSx#DPuNJme&i*MzLOEn)sUrthbf%Y^w.(kIQyXqWA!".charCodeAt(b);return a[61]=36,a})();var e=c(99393),f=c(47293),g=c(55511),h=c(65833),i=c(4630),j=c(46052),k=c(4905),l=c(60290),m=c(8298),n=c(9155);function o(a,b){return a&&a.length>b?`${a.slice(0,b)}...`:a||""}async function p({model:a,body:b,credentials:c,log:d,proxyOptions:e,signal:h}){let i=String(a||"").replace(/^qoder\//,""),j=await (0,n.X5)(c,i,{log:d,proxyOptions:e,signal:h});if(!j){let a=await (0,n.EV)(c,{forceRefresh:!0,log:d,proxyOptions:e,signal:h}),b=a?.rawConfigs.get(i);if(!b)throw Error(`qoder: model_config for "${i}" not yet known (run a model list fetch or check upstream connectivity)`);j={...b,key:i}}let{messages:k,systemText:l}=function(a){if(!Array.isArray(a)||0===a.length)return{messages:[],systemText:""};let b=[],c=[];for(let d of a){if(!d||"object"!=typeof d)continue;let a=function(a){if("string"==typeof a)return a;if(null==a)return"";if(Array.isArray(a)){let b=[];for(let c of a)c&&"object"==typeof c&&("text"===c.type&&"string"==typeof c.text?b.push(c.text):"string"==typeof c.text&&b.push(c.text));return b.join("\n")}return String(a)}(d.content);if("system"===d.role){a&&b.push(a);continue}let e={...d};e.content=a,c.push(e)}return{messages:c,systemText:b.join("\n\n")}}(b.messages||[]),m=b.tools,q=!!j.is_reasoning,r=Number(j.max_output_tokens)||0,s=32768;r>0&&(s=r),"number"==typeof b.max_tokens&&b.max_tokens>0&&b.max_tokens<s&&(s=b.max_tokens),"number"==typeof b.max_completion_tokens&&b.max_completion_tokens>0&&b.max_completion_tokens<s&&(s=b.max_completion_tokens);let t=function(a){for(let b=a.length-1;b>=0;b--){let c=a[b];if(c?.role==="user"&&"string"==typeof c.content)return c.content}return""}(k),u=function(a,...b){let c=(0,g.createHash)("sha256");for(let d of(c.update(a),b))c.update("\0"),c.update(String(d??""));return c.digest("hex").slice(0,16)}("qoder-session",(c.providerSpecificData||{}).userId,i),v=function(a,b,c,d){let e=(0,g.createHash)("sha256");for(let c of(e.update("qoder-record\0"),e.update(String(a)),b))c&&"object"==typeof c&&(c.role&&(e.update("\0"),e.update(c.role)),"string"==typeof c.content&&c.content&&(e.update("\0"),e.update(c.content)));if(c){e.update("\0");try{e.update(JSON.stringify(c))}catch{}}return e.update(`\0mt=${d}`),e.digest("hex").slice(0,16)}(i,k,m,s);return{qoderKey:i,payload:{request_id:(0,f.A)(),request_set_id:v,chat_record_id:v,session_id:u,stream:!0,chat_task:"FREE_INPUT",is_reply:!0,is_retry:!1,source:1,version:"3",session_type:"qodercli",agent_id:"agent_common",task_id:"common",code_language:"",chat_prompt:"",image_urls:null,aliyun_user_type:"",system:l,messages:k,tools:Array.isArray(m)?m:[],parameters:{max_tokens:s},chat_context:{chatPrompt:"",imageUrls:null,extra:{context:[],modelConfig:{key:i,is_reasoning:q},originalContent:t},features:[],text:t},model_config:j,business:{product:"cli",version:"1.0.0",type:"agent",stage:"start",id:(0,f.A)(),name:o(t,30),begin_at:Date.now()}},modelConfig:j}}class q extends h.Hv{constructor(){super("qoder",i.xq.qoder)}buildUrl(){return m.KC}async execute({model:a,body:b,stream:c,credentials:f,signal:g,log:h,proxyOptions:i=null}){let m,n,q,r,s=this.buildUrl(),t=f?.providerSpecificData||{};if(!t.userId)return{response:new Response(JSON.stringify({error:{message:"qoder credential is missing userId; reconnect the account"}}),{status:401,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b};if(!f?.accessToken)return{response:new Response(JSON.stringify({error:{message:"qoder credential is missing accessToken; reconnect the account"}}),{status:401,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b};try{({qoderKey:m,payload:n}=await p({model:a,body:b,credentials:f,log:h,proxyOptions:i,signal:g}))}catch(a){return{response:new Response(JSON.stringify({error:{message:a.message}}),{status:400,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b}}let u=function(a){let b=(Buffer.isBuffer(a)?a:"string"==typeof a?Buffer.from(a,"utf8"):Buffer.from(a)).toString("base64"),c=b.length,e=Math.floor(c/3),f=b.slice(c-e)+b.slice(e,c-e)+b.slice(0,e),g=Buffer.alloc(c);for(let a=0;a<c;a++){let b=f.charCodeAt(a);b<128&&d[b]>=0?g[a]=d[b]:g[a]=b}return g.toString("latin1")}(Buffer.from(JSON.stringify(n),"utf8")),v=Buffer.from(u,"latin1");try{q=(0,e.d)(v,s,{userId:t.userId,authToken:f.accessToken,name:f.displayName||"",email:f.email||"",machineId:t.machineId||""})}catch(a){return{response:new Response(JSON.stringify({error:{message:`qoder cosy signing failed: ${a.message}`}}),{status:401,headers:{"Content-Type":"application/json"}}),url:s,headers:{},transformedBody:b}}let w={"Content-Type":"application/json",Accept:"text/event-stream","Cache-Control":"no-cache","X-Model-Key":m,"X-Model-Source":n.model_config&&n.model_config.source||"system","Accept-Encoding":"identity",...q},x=this.config?.timeoutMs||l.pH,y=new AbortController,z=setTimeout(()=>y.abort(Error("fetch connect timeout")),x),A=g?AbortSignal.any([g,y.signal]):y.signal;try{r=await (0,j.Fm)(s,{method:"POST",headers:w,body:v,signal:A,identity:this.resolveIdentity(f),provider:this.provider,format:this.config?.format},i)}finally{clearTimeout(z)}return r.ok?{response:function(a,b){if(!a.ok||!a.body)return a;let c=new TextDecoder,d=new TextEncoder,e="",f=!1,g=(a,c)=>{let e,g=a.replace(/\r$/,"").trim();if(!g||!g.startsWith("data:")||f)return;let h=g.slice(5).trimStart();if("[DONE]"===h){c.enqueue(d.encode(k.$U)),f=!0;return}try{e=JSON.parse(h)}catch{return}let i="number"==typeof e.statusCodeValue?e.statusCodeValue:200,j="string"==typeof e.body?e.body:"";if(200!==i){let a=j||`upstream status ${i}`,e=JSON.stringify({id:`qoder-error-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:b,choices:[{index:0,delta:{content:`
|
|
148
148
|
[qoder error ${i}: ${o(a,200)}]`},finish_reason:"stop"}]});c.enqueue(d.encode(`data: ${e}
|
|
149
149
|
|
|
150
150
|
`)),c.enqueue(d.encode(k.$U)),f=!0;return}if(!j)return;if("[DONE]"===j){c.enqueue(d.encode(k.$U)),f=!0;return}let l=j.replace(/\r?\n/g,"");c.enqueue(d.encode(`data: ${l}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=869,exports.ids=[869],exports.modules={4489:(a,b,c)=>{c.d(b,{ki:()=>
|
|
1
|
+
"use strict";exports.id=869,exports.ids=[869],exports.modules={4489:(a,b,c)=>{c.d(b,{ki:()=>f}),c(29696);let d=new Set(["chat","text","language","model"]),e=new Map(["imageToText","webSearch","webFetch"].map(a=>[a.toLowerCase(),a]));function f(a){if("string"!=typeof a||!a)return a;let b=a.toLowerCase();return d.has(b)?"llm":e.get(b)||b}},27335:(a,b,c)=>{c.d(b,{Xg:()=>r,vq:()=>f.vq,fZ:()=>j,cY:()=>t,ez:()=>n,ux:()=>m,OA:()=>o,kt:()=>p,KC:()=>s,SM:()=>i});var d=c(4630),e=c(39698),f=c(45350),g=c(6595);let h="-review";function i(a){return f.vq[a]||[]}function j(a){let b=f.vq[a];return b?.[0]?.id||null}let k=new Set(["kr","kiro"]);function l(a,b,c){if(!a)return;let d=a.find(a=>a.id===b);if(d)return d;if(!k.has(c))return;let e=(0,g.Kq)(b);if(e!==b)return a.find(a=>a.id===e)}function m(a,b){let c=f.vq[a];return c?(0,g.gr)(l(c,b,a)):null}function n(a,b){let c=f.vq[a];return c?(0,g.ec)(l(c,b,a)):null}function o(a,b){let c=f.vq[a];if(!c)return null;let d=l(c,b,a);return d?.kind||d?.type||null}function p(a,b){let c="string"==typeof b?b.match(/\([^()]+\)\s*$/):null,d=c?c[0]:"",e=d?b.slice(0,c.index).trim():b,g=l(f.vq[a],e,a);return g?.upstreamModelId?g.upstreamModelId+d:g?.id?g.id+d:"cx"===a&&"string"==typeof e&&e.endsWith(h)?e.slice(0,-h.length)+d:e+d}let q=Object.fromEntries(e.A.filter(a=>a.alias&&a.alias!==a.id).map(a=>[a.id,a.alias])),r=Object.fromEntries(Object.keys(d.xq).map(a=>[a,q[a]||a]));function s(a){let b=r[a]||a;return f.vq[b]||[]}function t(a,b){return(0,g.g5)(l(f.vq[a],b,a))}},29696:(a,b,c)=>{function d(a){return!(!a||"object"!=typeof a||Array.isArray(a))&&"boolean"==typeof a.supported&&(null==a.effort||"flat"===a.effort||"nested"===a.effort)}c.d(b,{K5:()=>d,ml:()=>f});let e=[{suffix:"aliyuncs.com",format:"qwen"},{suffix:"opencode.ai",format:"flat"},{suffix:"api.surplusintelligence.ai",format:"flat"},{suffix:"inference-api.nousresearch.com",format:"none"}];function f(a){let b="";try{b=new URL(String(a||"")).hostname.toLowerCase()}catch{return null}if(!b)return null;for(let a of e)if(b===a.suffix||b.endsWith(`.${a.suffix}`))return a.format;return null}},30869:(a,b,c)=>{c.d(b,{UY:()=>h,eh:()=>f.eh,fg:()=>e.fg,h0:()=>g,oc:()=>i});var d=c(39006),e=c(40615),f=c(81329);d.rE;let g={npmPackageName:"switchboard-router",installCmd:"npm i -g switchboard-router",installCmdLatest:"npm i -g switchboard-router@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:2200,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,statusStartupTimeoutMs:2e3,appPort:20128},h={maxLines:200,pollIntervalMs:1e3},i={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingModel:"gpt-5.5",pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}}},39006:a=>{a.exports=JSON.parse('{"UU":"switchboard-app","rE":"0.9.42"}')},40615:(a,b,c)=>{c.d(b,{Q2:()=>s,js:()=>w,DI:()=>n,fg:()=>k,Pd:()=>o,IS:()=>h,nJ:()=>i,zN:()=>j,JH:()=>m,jO:()=>y,wb:()=>x,br:()=>l,wG:()=>v,zt:()=>t,gb:()=>q,gC:()=>r,mq:()=>p,rs:()=>u});var d=c(39698);let e="⚠️ Risk Notice: This provider uses a subscription/OAuth session not officially licensed for proxy/router use. Account may be restricted or banned. Use at your own risk.";Object.fromEntries(d.A.filter(a=>a.display).map(a=>{let b;return[a.id,"RISK_NOTICE"===(b=a.display).deprecationNotice?{...b,deprecationNotice:e}:b]}));let f=["serviceKinds","ttsConfig","sttConfig","embeddingConfig","imageConfig","imageToTextConfig","videoConfig","musicConfig","searchViaChat","searchConfig","fetchConfig","modelsFetcher","mediaPriority","hiddenKinds"],g=a=>Object.fromEntries(d.A.filter(b=>b.category===a).map(a=>[a.id,function(a){let b={};for(let c of(a.media&&Object.assign(b,a.media),f))void 0!==a[c]&&(b[c]=a[c]);let c={...a.display||{}};return"RISK_NOTICE"===c.deprecationNotice&&(c.deprecationNotice=e),{...c,id:a.id,alias:a.uiAlias||a.alias,...a.aliases?.length?{aliases:a.aliases}:{},...a.hidden?{hidden:!0}:{},...b,...void 0!==a.priority?{priority:a.priority}:{},...a.hasFree?{hasFree:!0}:{},...a.thinkingConfig?{thinkingConfig:a.thinkingConfig}:{},...a.regions?{regions:a.regions,defaultRegion:a.defaultRegion}:{},...a.hasProviderSpecificData?{hasProviderSpecificData:!0}:{},...a.noAuth?{noAuth:!0}:{},...a.passthroughModels?{passthroughModels:!0}:{},...a.hasOAuth?{hasOAuth:!0}:{},...a.authModes?{authModes:a.authModes}:{},...a.authType?{authType:a.authType}:{},...a.authHint?{authHint:a.authHint}:{}}}(a)])),h=g("free"),i=g("freeTier"),j=g("oauth"),k=g("apikey"),l=g("webCookie"),m="openai-compatible-",n="anthropic-compatible-",o="custom-embedding-";function p(a){return"string"==typeof a&&a.startsWith(m)}function q(a){return"string"==typeof a&&a.startsWith(n)}function r(a){return"string"==typeof a&&a.startsWith(o)}let s={...h,...i,...j,...k,...l};function t(a){for(let b of Object.values(s))if(b.alias===a||b.id===a||b.aliases?.includes(a))return b;return null}function u(a){let b=t(a);return b?.id||a}function v(a){let b=s[a];return b?.alias||a}let w=Object.values(s).reduce((a,b)=>(a[b.alias]=b.id,a),{});Object.values(s).reduce((a,b)=>(a[b.id]=b.alias,a),{});let x=d.A.filter(a=>a.features?.usage).map(a=>a.id),y=d.A.filter(a=>a.features?.usageApikey).map(a=>a.id)},81329:(a,b,c)=>{c.d(b,{CP:()=>h,PROVIDER_MODELS:()=>d.vq,Xg:()=>d.Xg,eh:()=>g});var d=c(27335),e=c(40615),f=c(4489);Object.entries(e.Q2).filter(([,a])=>a.passthroughModels).map(([a])=>a);let g=Object.entries(d.vq).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name}))),h=(a,b=null)=>{let c=a?.kind||a?.type||b;return c?(0,f.ki)(c):c}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=8789,exports.ids=[8789],exports.modules={12407:(a,b,c)=>{c.d(b,{$s:()=>r,E5:()=>i,GU:()=>m,Hr:()=>o,Kx:()=>l,M8:()=>q,f8:()=>p,oC:()=>g,ox:()=>j,p3:()=>n,qd:()=>f,sZ:()=>k,uw:()=>h});let d=async()=>{},e={getSettings:async()=>({}),trackPendingRequest:()=>{},appendRequestLog:d,saveRequestDetail:d,saveRequestUsage:d,getRoutingEvents:async()=>[],getClusterWorkerStats:async()=>({}),getPromotedLearningVersion:async()=>null,createLearningVersion:d,countRoutingEvents:async()=>0,listCombosWithRoutingEvents:async()=>[],getLastScheduledLearnAt:async()=>null,getClusterLatencyP50:async()=>null,getComboModels:async()=>null,putVaultEntry:async()=>!1,searchVault:async()=>[],getVaultEntry:async()=>null,cleanupExpiredVault:async()=>0,buildExternalIdpRefreshParams:null,createXaiService:null,fetchKiroProfileArn:null};function f(a={}){return e={...e,...a}}function g(){return e}function h(...a){return e.trackPendingRequest?.(...a)}function i(...a){return e.appendRequestLog?.(...a)??Promise.resolve()}function j(...a){return e.saveRequestDetail?.(...a)??Promise.resolve()}function k(...a){return e.saveRequestUsage?.(...a)??Promise.resolve()}async function l(...a){return e.getRoutingEvents(...a)}async function m(...a){return e.getClusterWorkerStats(...a)}async function n(...a){return e.getPromotedLearningVersion(...a)}async function o(...a){return e.createLearningVersion(...a)}async function p(...a){return e.countRoutingEvents(...a)}async function q(...a){return!!e.putVaultEntry&&e.putVaultEntry(...a)}async function r(...a){return e.searchVault?e.searchVault(...a):[]}},18129:(a,b,c)=>{c.d(b,{MF:()=>k,Vq:()=>l,fp:()=>i,hJ:()=>j});var d=c(41029),e=c(45350);let f=e.sr.codex?.maxRefreshAgeMs,g=new Map;function h(a){if(null==a||""===a)return null;if("number"==typeof a)return a<1e12?1e3*a:a;let b=new Date(a).getTime();return Number.isFinite(b)?b:null}function i(a,b,c=Date.now()){if(!b)return!1;let g=h(b?.expiresAt??b?.tokenExpiresAt);if(null!==g&&g-c<(0,d.Og)(a))return!0;let j=e.sr[a]?.maxRefreshAgeMs;return!!(j&&b.refreshToken&&function(a,b=Date.now(),c=f){let d=h(a?.lastRefreshAt??a?.lastRefresh??a?.providerSpecificData?.lastRefreshAt);return!d||b-d>=c}(b,c,j))}function j(a,b,c,f=Date.now()){var g,h;if(!c)return null;if((0,d.jT)(c))return c;let i={},k=new Date(f).toISOString();c.accessToken&&(i.accessToken=c.accessToken),c.apiKey&&(i.apiKey=c.apiKey),c.token&&(i.token=c.token);let l=c.refreshToken??b?.refreshToken;l&&(i.refreshToken=l);let m=c.idToken??b?.idToken;return m&&(i.idToken=m),c.expiresIn?(i.expiresIn=c.expiresIn,i.expiresAt=function(a,b=Date.now()){return a?new Date(b+1e3*a).toISOString():null}(c.expiresIn,f)):c.expiresAt&&(i.expiresAt=c.expiresAt),c.projectId&&(i.projectId=c.projectId),c.providerSpecificData&&(g=b?.providerSpecificData,i.providerSpecificData=(h=c.providerSpecificData)&&"object"==typeof h?{...g||{},...h}:g),c.copilotToken&&(i.copilotToken=c.copilotToken),c.copilotTokenExpiresAt&&(i.copilotTokenExpiresAt=c.copilotTokenExpiresAt),(e.sr[a]?.trackRefreshAt||i.accessToken||i.apiKey||i.token||i.refreshToken||i.copilotToken)&&(i.lastRefreshAt=c.lastRefreshAt||k),i}async function k(a,b,c){let d,e=(d=b?.connectionId||b?.id||b?.email||b?.name||b?.refreshToken?.slice?.(-16)||"default",`${a}:${d}`),f=g.get(e);if(f)return f;let h=Promise.resolve().then(c).finally(()=>{g.delete(e)});return g.set(e,h),h}async function l(a,b,c,e=null){return b?k(a,b,async()=>{let f=await (0,d.$B)(a,b,c,e);return j(a,b,f)}):null}},28730:(a,b,c)=>{c.d(b,{$V:()=>v,Cn:()=>l,Co:()=>u,Ic:()=>s,J5:()=>q,NA:()=>x,QH:()=>o,VK:()=>y,Wu:()=>w,fC:()=>m,go:()=>i,nZ:()=>r,qk:()=>n,sX:()=>j,uR:()=>p,zv:()=>t});var d=c(21820),e=c(4630),f=c(35570);function g(){try{return(0,f.zi)("gemini-cli")||null}catch{return null}}let h=e.xq["gemini-cli"]?.cliVersion||g()?.version||"0.56.0",i=e.xq["gemini-cli"]?.apiClient||g()?.apiClient||"google-genai-sdk/1.41.0 gl-node/v22.19.0";function j(a="unknown"){let b,c=g()?.version||h;return`GeminiCLI/${c}/${a||"unknown"} (${(0,d.platform)()}; ${"ia32"===(b=(0,d.arch)())?"x86":b}; terminal)`}function k(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let l={ideType:9,platform:k(),pluginType:2},m=Object.freeze(["authorization","x-api-key","x-goog-api-key","x-switchboard-key","cookie","token","set-cookie","session-id","session_id","x-session-id","x-amp-thread-id","x-client-request-id"]),n=Object.freeze(["authorization","x-switchboard-key","x-api-key","x-goog-api-key","session-id","session_id","x-session-id","x-amp-thread-id","x-client-request-id"]),o="_ide",p="_ide",q=new Set(["browser_subagent","command_status","find_by_name","generate_image","grep_search","list_dir","list_resources","multi_replace_file_content","notify_user","read_resource","read_terminal","read_url_content","replace_file_content","run_command","search_web","send_command_input","task_boundary","view_content_chunk","view_file","write_to_file"]),r={loadCodeAssist:"https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",onboardUser:"https://cloudcode-pa.googleapis.com/v1internal:onboardUser"},s={"Content-Type":"application/json","User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"google-cloud-sdk vscode_cloudshelleditor/0.1","Client-Metadata":JSON.stringify({ideType:9,platform:k(),pluginType:2})},t={ideType:9,platform:k(),pluginType:2},u="You are Claude Code, Anthropic's official CLI for Claude.",v="You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.**Absolute paths only****Proactiveness**",w=Object.fromEntries(Object.entries(e.sr).filter(([,a])=>a.refreshLeadMs).map(([a,b])=>[a,b.refreshLeadMs])),x={google:{token:"https://oauth2.googleapis.com/token",auth:"https://accounts.google.com/o/oauth2/auth"},openai:{token:e.sr.codex?.tokenUrl,auth:e.sr.codex?.authorizeUrl},anthropic:{token:e.sr.claude?.tokenUrl,auth:"https://api.anthropic.com/v1/oauth/authorize"},qwen:{token:e.sr.qwen?.tokenUrl,auth:e.sr.qwen?.deviceCodeUrl},iflow:{token:e.sr.iflow?.tokenUrl,auth:e.sr.iflow?.authorizeUrl},github:{token:e.sr.github?.tokenUrl,auth:e.sr.github?.authorizeUrl,deviceCode:e.sr.github?.deviceCodeUrl}};function y(a){let b="string"==typeof a&&a.trim()?a.trim():`kimi-${Date.now()}`;return{"X-Msh-Platform":"switchboard","X-Msh-Version":"2.1.2","X-Msh-Device-Model":"u">typeof process?`${process.platform} ${process.arch}`:"unknown","X-Msh-Device-Id":b}}},41029:(a,b,c)=>{c.d(b,{oD:()=>B,Og:()=>D,jT:()=>C,Sc:()=>E,jR:()=>z,I9:()=>r,AH:()=>x,Ql:()=>w,$B:()=>K,pb:()=>G,qZ:()=>L});var d=c(4630),e=c(28730),f=c(46052);let g=new Map;function h(a,b){g.get(a)===b&&(g.delete(a),b.cleanupTimer&&clearTimeout(b.cleanupTimer))}async function i(a,b,c,d){if(!b)return c();let e=`${a}:${b}`,f=g.get(e);if(f){if(f.promise)return d?.info?.("TOKEN_REFRESH",`Reusing in-flight refresh for ${a}`),f.promise;if(f.expiresAt>Date.now())return d?.info?.("TOKEN_REFRESH",`Reusing recent refresh result for ${a}`),f.result;h(e,f)}let i={promise:null},j=(async()=>{try{let a=await c();if(a&&(a.accessToken||a.copilotToken||a.refreshToken)){let b;(b={result:a,expiresAt:Date.now()+1e4,cleanupTimer:null}).cleanupTimer=setTimeout(()=>{g.get(e)===b&&(g.delete(e),b.cleanupTimer=null)},1e4),b.cleanupTimer.unref?.(),g.set(e,b)}else h(e,i);return a}catch(a){throw h(e,i),a}})();return i.promise=j,g.set(e,i),j}var j=c(12407),k=c(57034);function l(a,b,c,d){let e=t(c,d);return e.permanent?(a?.error?.("TOKEN_REFRESH",`${b} refresh token revoked or expired. Re-auth required.`,{status:d,code:e.code}),{error:"unrecoverable_refresh_error",code:e.code}):null}function m(a="",b=0){let c="";try{let b=a?JSON.parse(a):null;c=b?.error||b?.error_code||b?.code||""}catch{}return{status:b,errorCode:c||void 0,bodyLen:a?.length||0}}let n=null;async function o(a,b){return a?i("xai",a,async()=>{try{if(!n){let a=(0,j.oC)().createXaiService;if(!a)return b?.warn?.("TOKEN_REFRESH","xAI service not wired (setOpenSseDeps)"),null;n=await a()}let c=await n.refreshAccessToken(a);return{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,idToken:c.id_token}}catch(d){let a=String(d?.message||""),c=a.includes("invalid_grant")?"invalid_grant":a.includes("invalid_request")?"invalid_request":null;if(b?.warn?.("TOKEN_REFRESH","xai refresh failed",c?{errorCode:c}:void 0),c)return{error:c};return null}},b):null}async function p(a,b,c,e,g=null){let h=d.xq[a],j=h?.refreshUrl||d.sr[a]?.refreshUrl||d.sr[a]?.tokenUrl;return h&&j?b?i(a,b,async()=>{try{let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:b,client_id:h.clientId});h.clientSecret&&c.set("client_secret",h.clientSecret);let d=await (0,f.Fm)(j,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:c,identity:h.identity,provider:a,format:h.format},g);if(!d.ok){let b=await d.text(),c=l(e,a,b,d.status);if(c)return c;return e?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${a}`,{status:d.status,error:m(b,d.status)}),null}let i=await d.json();return e?.info?.("TOKEN_REFRESH",`Successfully refreshed token for ${a}`,{hasNewAccessToken:!!i.access_token,hasNewRefreshToken:!!i.refresh_token,expiresIn:i.expires_in}),{accessToken:i.access_token,refreshToken:i.refresh_token||b,expiresIn:i.expires_in}}catch(b){return e?.error?.("TOKEN_REFRESH",`Error refreshing token for ${a}`,{error:b.message}),null}},e):(e?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null):(e?.warn?.("TOKEN_REFRESH",`No refresh URL configured for provider: ${a}`),null)}async function q(a,b){return a?i("claude",a,async()=>{try{let c=await (0,f.Fm)(e.NA.anthropic.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.claude.clientId}),identity:d.xq.claude?.identity,provider:"claude",format:d.xq.claude?.format});if(!c.ok){let a=await c.text(),d=l(b,"Claude",a,c.status);if(d)return d;return b?.error?.("TOKEN_REFRESH","Failed to refresh Claude OAuth token",{status:c.status,error:m(a,c.status)}),null}let g=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Claude OAuth token",{hasNewAccessToken:!!g.access_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Claude token: ${a.message}`),null}},b):null}async function r(a,b,c,g,h=null,j=null){if(!a)return null;let k=h||(b===d.xq.antigravity?.clientId?"antigravity":"gemini-cli"),n=d.xq[k];return i(`google:${b}`,a,async()=>{try{let d=await (0,f.Fm)(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:b,client_secret:c}),identity:n?.identity,provider:k,format:n?.format},j);if(!d.ok){let a=await d.text(),b=l(g,"Google",a,d.status);if(b)return b;return g?.error?.("TOKEN_REFRESH","Failed to refresh Google token",{status:d.status,error:m(a,d.status)}),null}let h=await d.json();return g?.info?.("TOKEN_REFRESH","Successfully refreshed Google token",{hasNewAccessToken:!!h.access_token,expiresIn:h.expires_in}),{accessToken:h.access_token,refreshToken:h.refresh_token||a,expiresIn:h.expires_in}}catch(a){return g?.error?.("TOKEN_REFRESH",`Network error refreshing Google token: ${a.message}`),null}},g)}async function s(a,b){return a?i("qwen",a,async()=>{let c=e.NA.qwen.token;try{let e=await (0,f.Fm)(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.qwen.clientId}),identity:d.xq.qwen?.identity,provider:"qwen",format:d.xq.qwen?.format});if(200===e.status){let c=await e.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Qwen token",{hasNewAccessToken:!!c.access_token,hasNewRefreshToken:!!c.refresh_token,expiresIn:c.expires_in}),{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,providerSpecificData:c.resource_url?{resourceUrl:c.resource_url}:void 0}}{let a=await e.text().catch(()=>""),c=l(b,"Qwen",a,e.status);if(c)return c;b?.warn?.("TOKEN_REFRESH","Error with Qwen endpoint",{status:e.status,error:m(a,e.status)})}}catch(a){b?.warn?.("TOKEN_REFRESH","Network error trying Qwen endpoint",{error:a.message})}return b?.error?.("TOKEN_REFRESH","Failed to refresh Qwen token"),null},b):null}function t(a="",b=0){let c=null;try{c=a?JSON.parse(a):null}catch{c=null}let d=c?.error,e=("string"==typeof d?d:d?.code||d?.type)||c?.error_code||"",f=c?.error_description||c?.message||d?.message||a||"",g=`${e} ${f}`.toLowerCase(),h=b<500&&["refresh_token_expired","refresh_token_reused","refresh_token_invalidated","invalid_grant","bad_refresh_token"].some(a=>g.includes(a));return{status:b,code:e,description:f,permanent:h}}async function u(a,b){return a?i("codex",a,async()=>{try{let c=await (0,f.Fm)(e.NA.openai.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({client_id:d.xq.codex.clientId,grant_type:"refresh_token",refresh_token:a}),identity:d.xq.codex?.identity,provider:"codex",format:d.xq.codex?.format});if(!c.ok){let a=await c.text(),d=t(a,c.status);if(d.permanent)return b?.error?.("TOKEN_REFRESH","Codex refresh token already used or invalid. Re-auth required.",{status:c.status,code:d.code}),{error:"unrecoverable_refresh_error",code:d.code};return b?.error?.("TOKEN_REFRESH","Failed to refresh Codex token",{status:c.status,error:m(a,c.status),code:d.code,permanent:d.permanent}),null}let g=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Codex token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,hasIdToken:!!g.id_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,idToken:g.id_token,expiresIn:g.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Codex token: ${a.message}`),null}},b):null}async function v(a,b,c){if(a?.profileArn)return{};let d=c?.trim?.()||null;if(!d){let c=(0,j.oC)().fetchKiroProfileArn;c&&(d=await c(b,a?.region))}return d?{providerSpecificData:{profileArn:d}}:{}}async function w(a,b,c,e=null){return a?i("kiro",a,async()=>{let g=b?.authMethod,h=b?.clientId,i=b?.clientSecret,l=b?.region;if("external_idp"===g){let g;try{let c=(0,j.oC)().buildExternalIdpRefreshParams;if(!c)throw Error("buildExternalIdpRefreshParams not wired");g=await c(a,b)}catch(a){return c?.warn?.("TOKEN_REFRESH",`Invalid Kiro external_idp refresh config: ${a.message}`),null}let h=await (0,f.Fm)(g.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:g.body,identity:d.xq.kiro?.identity,provider:"kiro",format:d.xq.kiro?.format},e);if(!h.ok){let a=await h.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro external_idp token",{status:h.status,error:m(a,h.status)}),null}let i=await h.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro external_idp token",{hasNewAccessToken:!!i.access_token,hasNewRefreshToken:!!i.refresh_token,expiresIn:i.expires_in}),{accessToken:i.access_token,refreshToken:i.refresh_token||a,expiresIn:i.expires_in,providerSpecificData:g.providerSpecificData}}if(h&&i){let j="idc"===g&&(0,k.i7)(l)?`https://oidc.${l}.amazonaws.com/token`:"https://oidc.us-east-1.amazonaws.com/token",n=await (0,f.Fm)(j,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:h,clientSecret:i,refreshToken:a,grantType:"refresh_token"}),identity:d.xq.kiro?.identity,provider:"kiro",format:d.xq.kiro?.format},e);if(!n.ok){let a=await n.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro AWS token",{status:n.status,error:m(a,n.status)}),null}let o=await n.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro AWS token",{hasNewAccessToken:!!o.accessToken,expiresIn:o.expiresIn}),{accessToken:o.accessToken,refreshToken:o.refreshToken||a,expiresIn:o.expiresIn,...await v(b,o.accessToken,o.profileArn)}}let n=await (0,f.Fm)(d.xq.kiro.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:a}),identity:d.xq.kiro?.identity,provider:"kiro",format:d.xq.kiro?.format},e);if(!n.ok){let a=await n.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro social token",{status:n.status,error:m(a,n.status)}),null}let o=await n.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro social token",{hasNewAccessToken:!!o.accessToken,expiresIn:o.expiresIn}),{accessToken:o.accessToken,refreshToken:o.refreshToken||a,expiresIn:o.expiresIn,...await v(b,o.accessToken,o.profileArn)}},c):null}async function x(a,b){return a?i("iflow",a,async()=>{let c=btoa(`${d.xq.iflow.clientId}:${d.xq.iflow.clientSecret}`),g=await (0,f.Fm)(e.NA.iflow.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${c}`},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.iflow.clientId,client_secret:d.xq.iflow.clientSecret}),identity:d.xq.iflow?.identity,provider:"iflow",format:d.xq.iflow?.format});if(!g.ok){let a=await g.text(),c=l(b,"iFlow",a,g.status);return c||(b?.error?.("TOKEN_REFRESH","Failed to refresh iFlow token",{status:g.status,error:m(a,g.status)}),null)}let h=await g.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed iFlow token",{hasNewAccessToken:!!h.access_token,hasNewRefreshToken:!!h.refresh_token,expiresIn:h.expires_in}),{accessToken:h.access_token,refreshToken:h.refresh_token||a,expiresIn:h.expires_in}},b):null}async function y(a,b){return a?i("github",a,async()=>{let c={grant_type:"refresh_token",refresh_token:a,client_id:d.xq.github.clientId};d.xq.github.clientSecret&&(c.client_secret=d.xq.github.clientSecret);let g=await (0,f.Fm)(e.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(c),identity:d.xq.github?.identity,provider:"github",format:d.xq.github?.format});if(!g.ok){let a=await g.text(),c=l(b,"GitHub",a,g.status);return c||(b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:g.status,error:m(a,g.status)}),null)}let h=await g.json();if(h.error||!h.access_token){let a=JSON.stringify(h),c=l(b,"GitHub",a,g.status);return c||(b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:g.status,error:m(a,g.status)}),null)}return b?.info?.("TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!h.access_token,hasNewRefreshToken:!!h.refresh_token,expiresIn:h.expires_in}),{accessToken:h.access_token,refreshToken:h.refresh_token||a,expiresIn:h.expires_in}},b):null}async function z(a,b){return a?i("copilot",a,async()=>{try{let c=await (0,f.Fm)(d.sr.github?.copilotTokenUrl,{headers:{Authorization:`token ${a}`,Accept:"application/json"},identity:d.xq.github?.identity,provider:"github",format:d.xq.github?.format});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Copilot token",{status:c.status,error:m(a,c.status)}),null}let e=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!e.token,expiresAt:e.expires_at}),{token:e.token,expiresAt:e.expires_at}}catch(a){return b?.error?.("TOKEN_REFRESH","Error refreshing Copilot token",{error:a.message}),null}},b):null}async function A(a,b){return a?i("codebuddy-cn",a,async()=>{let c=d.sr["codebuddy-cn"]||{},e=await (0,f.Fm)(c.refreshUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":c.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":"copilot.tencent.com","X-Refresh-Token":a},body:JSON.stringify({refreshToken:a}),identity:d.xq["codebuddy-cn"]?.identity,provider:"codebuddy-cn",format:d.xq["codebuddy-cn"]?.format});if(!e.ok){let a=await e.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh CodeBuddy token",{status:e.status,error:m(a,e.status)}),null}let g=await e.json();return 0===g.code&&g.data?.accessToken?(b?.info?.("TOKEN_REFRESH","Successfully refreshed CodeBuddy token",{hasNewAccessToken:!!g.data.accessToken,hasNewRefreshToken:!!g.data.refreshToken,expiresIn:g.data.expiresIn}),{accessToken:g.data.accessToken,refreshToken:g.data.refreshToken||a,expiresIn:g.data.expiresIn}):(b?.error?.("TOKEN_REFRESH","CodeBuddy token refresh returned no token",{code:g.code,msg:g.msg}),null)},b):null}let B=3e5;function C(a){return a&&"object"==typeof a&&("unrecoverable_refresh_error"===a.error||"refresh_token_reused"===a.error||"invalid_request"===a.error||"invalid_grant"===a.error)}function D(a){return e.Wu[a]||B}function E(a){if("string"!=typeof a)return null;try{let b=JSON.parse(a);if("service_account"===b.type&&b.client_email&&b.private_key&&b.project_id)return b;return null}catch{return null}}let F=new Map;async function G(a,b,g="vertex",h=null){let i=a.client_email,j=F.get(i);if(j&&j.expiresAt-Date.now()>3e5)return{accessToken:j.token,expiresAt:j.expiresAt};try{let{SignJWT:j,importPKCS8:k}=await c.e(9078).then(c.bind(c,9078));b?.debug?.("TOKEN_REFRESH",`Vertex minting token for ${a.client_email}`);let l=await k(a.private_key.replace(/\\n/g,"\n"),"RS256"),m=Math.floor(Date.now()/1e3),n=await new j({scope:"https://www.googleapis.com/auth/cloud-platform"}).setProtectedHeader({alg:"RS256"}).setIssuer(a.client_email).setAudience(e.NA.google.token).setIssuedAt(m).setExpirationTime(m+3600).sign(l),o=d.xq[g]||d.xq.vertex,p=await (0,f.Fm)(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:n}),identity:o.identity,provider:g,format:o.format},h);if(!p.ok){let a=await p.text();return b?.error?.("TOKEN_REFRESH",`Vertex token mint failed: ${a}`),null}let{access_token:q,expires_in:r}=await p.json(),s=Date.now()+(r??3600)*1e3;return F.set(i,{token:q,expiresAt:s}),b?.info?.("TOKEN_REFRESH",`Vertex token minted for ${a.client_email}`),{accessToken:q,expiresAt:s}}catch(a){return b?.error?.("TOKEN_REFRESH",`Vertex token error: ${a.message}`),null}}function H(a,b,c="vertex"){let d=E(a.apiKey);if(d)return G(d,b,c);try{let d="string"==typeof a.apiKey?JSON.parse(a.apiKey):null;if(d?.type==="authorized_user"&&d.refresh_token&&d.client_id&&d.client_secret)return r(d.refresh_token,d.client_id,d.client_secret,b,c)}catch{}return null}let I={"gemini-cli":(a,b)=>r(a.refreshToken,d.xq["gemini-cli"].clientId,d.xq["gemini-cli"].clientSecret,b),antigravity:(a,b)=>r(a.refreshToken,d.xq.antigravity.clientId,d.xq.antigravity.clientSecret,b),claude:(a,b)=>q(a.refreshToken,b),codex:(a,b)=>u(a.refreshToken,b),qwen:(a,b)=>s(a.refreshToken,b),iflow:(a,b)=>x(a.refreshToken,b),github:(a,b)=>y(a.refreshToken,b),kiro:(a,b)=>w(a.refreshToken,a.providerSpecificData,b),xai:(a,b)=>o(a.refreshToken,b),"grok-cli":(a,b,c)=>p("grok-cli",a.refreshToken,a,b,c),"codebuddy-cn":(a,b)=>A(a.refreshToken,b),muse:(a,b)=>J(a.providerSpecificData?.dcaToken||a.refreshToken,b),vertex:(a,b)=>H(a,b,"vertex"),"vertex-partner":(a,b)=>H(a,b,"vertex-partner")};async function J(a,b){if(!a)return null;try{let c=process.env.META_MINT_URL||"https://api.meta.ai/muse-code/key",d=await (0,f.Fm)(c,{method:"POST",headers:{Authorization:`Bearer ${a}`,"User-Agent":"muse-code/1.0.2","Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({dca_token:a}),identity:"muse-code",provider:"muse"});if(!d.ok)return b?.warn?.("TOKEN_REFRESH",`Failed to re-mint Meta Muse API key: ${d.status}`),null;let e=await d.json();return{accessToken:e.api_key,apiKey:e.api_key,providerSpecificData:{apiKey:e.api_key,baseUrl:e.base_url||"https://api.meta.ai/v1"}}}catch(a){return b?.warn?.("TOKEN_REFRESH",`Error re-minting Meta Muse API key: ${a?.message}`),null}}async function K(a,b,c,d=null){let e="vertex"===a||"vertex-partner"===a;if(!b.refreshToken&&!(e&&b?.apiKey))return null;let f=I[a];return f?f(b,c,d):p(a,b.refreshToken,b,c,d)}async function L(a,b=3,c=null){for(let d=0;d<b;d++){if(d>0){let a=1e3*d;c?.debug?.("TOKEN_REFRESH",`Retry ${d}/${b} after ${a}ms`),await new Promise(b=>setTimeout(b,a))}try{let b=await a();if(C(b)||b)return b}catch(a){c?.warn?.("TOKEN_REFRESH",`Attempt ${d+1}/${b} failed: ${a.message}`)}}return c?.error?.("TOKEN_REFRESH",`All ${b} retry attempts failed`),null}},47293:(a,b,c)=>{c.d(b,{A:()=>f});let d=new Uint8Array(16);var e=c(50122);let f=function(a,b,c){return b||a||!crypto.randomUUID?function(a,b,c){let f=(a=a||{}).random??a.rng?.()??crypto.getRandomValues(d);if(f.length<16)throw Error("Random bytes length must be >= 16");if(f[6]=15&f[6]|64,f[8]=63&f[8]|128,b){if((c=c||0)<0||c+16>b.length)throw RangeError(`UUID byte range ${c}:${c+15} is out of buffer bounds`);for(let a=0;a<16;++a)b[c+a]=f[a];return b}return(0,e.k)(f)}(a,b,c):crypto.randomUUID()}},50122:(a,b,c)=>{c.d(b,{k:()=>e});let d=[];for(let a=0;a<256;++a)d.push((a+256).toString(16).slice(1));function e(a,b=0){return(d[a[b+0]]+d[a[b+1]]+d[a[b+2]]+d[a[b+3]]+"-"+d[a[b+4]]+d[a[b+5]]+"-"+d[a[b+6]]+d[a[b+7]]+"-"+d[a[b+8]]+d[a[b+9]]+"-"+d[a[b+10]]+d[a[b+11]]+d[a[b+12]]+d[a[b+13]]+d[a[b+14]]+d[a[b+15]]).toLowerCase()}},57034:(a,b,c)=>{c.d(b,{i7:()=>e,l6:()=>f});let d=/^[a-z]{2}(?:-[a-z0-9]+)+-\d{1,2}$/;function e(a){return"string"==typeof a&&d.test(a)}function f(a,b="us-east-1"){return e(a)?a:b}}};
|
|
1
|
+
"use strict";exports.id=8789,exports.ids=[8789],exports.modules={12407:(a,b,c)=>{c.d(b,{$s:()=>r,E5:()=>i,GU:()=>m,Hr:()=>o,Kx:()=>l,M8:()=>q,f8:()=>p,oC:()=>g,ox:()=>j,p3:()=>n,qd:()=>f,sZ:()=>k,uw:()=>h});let d=async()=>{},e={getSettings:async()=>({}),loadProviderQuotaState:null,saveProviderQuotaState:null,trackPendingRequest:()=>{},appendRequestLog:d,saveRequestDetail:d,saveRequestUsage:d,getRoutingEvents:async()=>[],getClusterWorkerStats:async()=>({}),getPromotedLearningVersion:async()=>null,createLearningVersion:d,countRoutingEvents:async()=>0,listCombosWithRoutingEvents:async()=>[],getLastScheduledLearnAt:async()=>null,getClusterLatencyP50:async()=>null,getComboModels:async()=>null,putVaultEntry:async()=>!1,searchVault:async()=>[],getVaultEntry:async()=>null,cleanupExpiredVault:async()=>0,buildExternalIdpRefreshParams:null,createXaiService:null,fetchKiroProfileArn:null};function f(a={}){return e={...e,...a}}function g(){return e}function h(...a){return e.trackPendingRequest?.(...a)}function i(...a){return e.appendRequestLog?.(...a)??Promise.resolve()}function j(...a){return e.saveRequestDetail?.(...a)??Promise.resolve()}function k(...a){return e.saveRequestUsage?.(...a)??Promise.resolve()}async function l(...a){return e.getRoutingEvents(...a)}async function m(...a){return e.getClusterWorkerStats(...a)}async function n(...a){return e.getPromotedLearningVersion(...a)}async function o(...a){return e.createLearningVersion(...a)}async function p(...a){return e.countRoutingEvents(...a)}async function q(...a){return!!e.putVaultEntry&&e.putVaultEntry(...a)}async function r(...a){return e.searchVault?e.searchVault(...a):[]}},18129:(a,b,c)=>{c.d(b,{Hf:()=>o,Jj:()=>q,MF:()=>v,Vq:()=>w,fp:()=>t,hJ:()=>u});var d=c(16698),e=c(77598),f=c(60290),g=c(41029),h=c(45350);let i=h.sr.codex?.maxRefreshAgeMs,j=new Map,k=new Map,l=new d.AsyncLocalStorage,m=new WeakMap,n=new WeakMap;function o(a){return m.get(a)||a?.providerSpecificData||{}}function p(a){return{accessToken:a?.accessToken,refreshToken:a?.refreshToken,idToken:a?.idToken,copilotToken:a?.copilotToken??a?.providerSpecificData?.copilotToken}}function q(a,b){let c=n.get(b);if(c&&(c.source.connectionId||c.source.id)===a)return c;let d=p(b),e=Object.keys(d).filter(a=>d[a]);if(0===e.length)return null;for(let b of[...k.values()].reverse()){if((b.source.connectionId||b.source.id)!==a)continue;let c={...p(b.source),...Object.fromEntries(Object.entries(p(b.result)).filter(([,a])=>a))};if(e.every(a=>c[a]===d[a]))return b}return null}function r(a){if(null==a||""===a)return null;if("number"==typeof a)return a<1e12?1e3*a:a;let b=new Date(a).getTime();return Number.isFinite(b)?b:null}function s(a){return r(a?.expiresAt??a?.tokenExpiresAt)}function t(a,b,c=Date.now()){if(!b)return!1;let d=s(b);if(null!==d&&d-c<(0,g.Og)(a))return!0;let e=h.sr[a]?.maxRefreshAgeMs;return!!(e&&b.refreshToken&&function(a,b=Date.now(),c=i){let d=r(a?.lastRefreshAt??a?.lastRefresh??a?.providerSpecificData?.lastRefreshAt);return!d||b-d>=c}(b,c,e))}function u(a,b,c,d=Date.now()){var e,f;if(!c)return null;if((0,g.jT)(c))return c;let i={},j=new Date(d).toISOString();c.accessToken&&(i.accessToken=c.accessToken),c.apiKey&&(i.apiKey=c.apiKey),c.token&&(i.token=c.token);let k=c.refreshToken??b?.refreshToken;k&&(i.refreshToken=k);let l=c.idToken??b?.idToken;return l&&(i.idToken=l),c.expiresIn?(i.expiresIn=c.expiresIn,i.expiresAt=function(a,b=Date.now()){return a?new Date(b+1e3*a).toISOString():null}(c.expiresIn,d)):c.expiresAt&&(i.expiresAt=c.expiresAt),c.projectId&&(i.projectId=c.projectId),c.providerSpecificData&&(e=b?.providerSpecificData,i.providerSpecificData=(f=c.providerSpecificData)&&"object"==typeof f?{...e||{},...f}:e),c.copilotToken&&(i.copilotToken=c.copilotToken),c.copilotTokenExpiresAt&&(i.copilotTokenExpiresAt=c.copilotTokenExpiresAt),(h.sr[a]?.trackRefreshAt||i.accessToken||i.apiKey||i.token||i.refreshToken||i.copilotToken)&&(i.lastRefreshAt=c.lastRefreshAt||j),m.set(i,c.providerSpecificData||{}),i}async function v(a,b,c){let d,g,h,i=(d=[b?.accessToken,b?.refreshToken,b?.idToken,b?.copilotToken??b?.providerSpecificData?.copilotToken],g=(0,e.createHash)("sha256").update(JSON.stringify(d)).digest("hex"),`${h=b?.connectionId||b?.id||b?.email||b?.name||b?.refreshToken?.slice?.(-16)||"default",`${a}:${h}`}:${g}`);if(l.getStore()===i)return c();let q=j.get(i);if(q)return q;let r=k.get(i);if(r?.reusable){let a;return a=r.result,Number.isFinite(r.expiresAt)&&(a={...a,expiresAt:new Date(r.expiresAt).toISOString(),expiresIn:Math.max(0,Math.ceil((r.expiresAt-Date.now())/1e3))},m.set(a,r.providerSpecificUpdates),n.set(a,r)),a}let t={...b?._connection||{},...b,provider:a,authType:b?.authType||b?._connection?.authType||"oauth"},u=Promise.resolve().then(()=>l.run(i,c)).then(a=>{if(a&&!a.error&&Object.values(p(a)).some(Boolean)){let b={result:a,source:t,reusable:!!a&&!a.error&&(["accessToken","refreshToken","idToken"].some(b=>a[b]&&a[b]!==t?.[b])||a.copilotToken&&a.copilotToken!==(t?.copilotToken??t?.providerSpecificData?.copilotToken)),providerSpecificUpdates:Object.fromEntries(Object.entries(o(a)).filter(([a,b])=>JSON.stringify(b)!==JSON.stringify(t.providerSpecificData?.[a]))),expiresAt:s(a)??(Number.isFinite(Number(a.expiresIn))&&Number(a.expiresIn)>0?Date.now()+1e3*Number(a.expiresIn):null)};for(m.set(a,b.providerSpecificUpdates),n.set(a,b),k.delete(i),k.set(i,b);k.size>f.v1.credentialRefreshResultsMaxSize;)k.delete(k.keys().next().value)}return a}).finally(()=>{j.delete(i)});return j.set(i,u),u}async function w(a,b,c,d=null){return b?v(a,b,async()=>{let e=await (0,g.$B)(a,b,c,d);return u(a,b,e)}):null}},28730:(a,b,c)=>{c.d(b,{$V:()=>v,Cn:()=>l,Co:()=>u,Ic:()=>s,J5:()=>q,NA:()=>x,QH:()=>o,VK:()=>y,Wu:()=>w,fC:()=>m,go:()=>i,nZ:()=>r,qk:()=>n,sX:()=>j,uR:()=>p,zv:()=>t});var d=c(21820),e=c(4630),f=c(35570);function g(){try{return(0,f.zi)("gemini-cli")||null}catch{return null}}let h=e.xq["gemini-cli"]?.cliVersion||g()?.version||"0.56.0",i=e.xq["gemini-cli"]?.apiClient||g()?.apiClient||"google-genai-sdk/1.41.0 gl-node/v22.19.0";function j(a="unknown"){let b,c=g()?.version||h;return`GeminiCLI/${c}/${a||"unknown"} (${(0,d.platform)()}; ${"ia32"===(b=(0,d.arch)())?"x86":b}; terminal)`}function k(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let l={ideType:9,platform:k(),pluginType:2},m=Object.freeze(["authorization","x-api-key","x-goog-api-key","x-switchboard-key","cookie","token","set-cookie","session-id","session_id","x-session-id","x-amp-thread-id","x-client-request-id"]),n=Object.freeze(["authorization","x-switchboard-key","x-api-key","x-goog-api-key","session-id","session_id","x-session-id","x-amp-thread-id","x-client-request-id"]),o="_ide",p="_ide",q=new Set(["browser_subagent","command_status","find_by_name","generate_image","grep_search","list_dir","list_resources","multi_replace_file_content","notify_user","read_resource","read_terminal","read_url_content","replace_file_content","run_command","search_web","send_command_input","task_boundary","view_content_chunk","view_file","write_to_file"]),r={loadCodeAssist:"https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",onboardUser:"https://cloudcode-pa.googleapis.com/v1internal:onboardUser"},s={"Content-Type":"application/json","User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"google-cloud-sdk vscode_cloudshelleditor/0.1","Client-Metadata":JSON.stringify({ideType:9,platform:k(),pluginType:2})},t={ideType:9,platform:k(),pluginType:2},u="You are Claude Code, Anthropic's official CLI for Claude.",v="You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.**Absolute paths only****Proactiveness**",w=Object.fromEntries(Object.entries(e.sr).filter(([,a])=>a.refreshLeadMs).map(([a,b])=>[a,b.refreshLeadMs])),x={google:{token:"https://oauth2.googleapis.com/token",auth:"https://accounts.google.com/o/oauth2/auth"},openai:{token:e.sr.codex?.tokenUrl,auth:e.sr.codex?.authorizeUrl},anthropic:{token:e.sr.claude?.tokenUrl,auth:"https://api.anthropic.com/v1/oauth/authorize"},qwen:{token:e.sr.qwen?.tokenUrl,auth:e.sr.qwen?.deviceCodeUrl},iflow:{token:e.sr.iflow?.tokenUrl,auth:e.sr.iflow?.authorizeUrl},github:{token:e.sr.github?.tokenUrl,auth:e.sr.github?.authorizeUrl,deviceCode:e.sr.github?.deviceCodeUrl}};function y(a){let b="string"==typeof a&&a.trim()?a.trim():`kimi-${Date.now()}`;return{"X-Msh-Platform":"switchboard","X-Msh-Version":"2.1.2","X-Msh-Device-Model":"u">typeof process?`${process.platform} ${process.arch}`:"unknown","X-Msh-Device-Id":b}}},41029:(a,b,c)=>{c.d(b,{oD:()=>B,Og:()=>D,jT:()=>C,Sc:()=>E,jR:()=>z,I9:()=>r,AH:()=>x,Ql:()=>w,$B:()=>K,pb:()=>G,qZ:()=>L});var d=c(4630),e=c(28730),f=c(46052);let g=new Map;function h(a,b){g.get(a)===b&&(g.delete(a),b.cleanupTimer&&clearTimeout(b.cleanupTimer))}async function i(a,b,c,d){if(!b)return c();let e=`${a}:${b}`,f=g.get(e);if(f){if(f.promise)return d?.info?.("TOKEN_REFRESH",`Reusing in-flight refresh for ${a}`),f.promise;if(f.expiresAt>Date.now())return d?.info?.("TOKEN_REFRESH",`Reusing recent refresh result for ${a}`),f.result;h(e,f)}let i={promise:null},j=(async()=>{try{let a=await c();if(a&&(a.accessToken||a.copilotToken||a.refreshToken)){let b;(b={result:a,expiresAt:Date.now()+1e4,cleanupTimer:null}).cleanupTimer=setTimeout(()=>{g.get(e)===b&&(g.delete(e),b.cleanupTimer=null)},1e4),b.cleanupTimer.unref?.(),g.set(e,b)}else h(e,i);return a}catch(a){throw h(e,i),a}})();return i.promise=j,g.set(e,i),j}var j=c(12407),k=c(57034);function l(a,b,c,d){let e=t(c,d);return e.permanent?(a?.error?.("TOKEN_REFRESH",`${b} refresh token revoked or expired. Re-auth required.`,{status:d,code:e.code}),{error:"unrecoverable_refresh_error",code:e.code}):null}function m(a="",b=0){let c="";try{let b=a?JSON.parse(a):null;c=b?.error||b?.error_code||b?.code||""}catch{}return{status:b,errorCode:c||void 0,bodyLen:a?.length||0}}let n=null;async function o(a,b){return a?i("xai",a,async()=>{try{if(!n){let a=(0,j.oC)().createXaiService;if(!a)return b?.warn?.("TOKEN_REFRESH","xAI service not wired (setOpenSseDeps)"),null;n=await a()}let c=await n.refreshAccessToken(a);return{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,idToken:c.id_token}}catch(d){let a=String(d?.message||""),c=a.includes("invalid_grant")?"invalid_grant":a.includes("invalid_request")?"invalid_request":null;if(b?.warn?.("TOKEN_REFRESH","xai refresh failed",c?{errorCode:c}:void 0),c)return{error:c};return null}},b):null}async function p(a,b,c,e,g=null){let h=d.xq[a],j=h?.refreshUrl||d.sr[a]?.refreshUrl||d.sr[a]?.tokenUrl;return h&&j?b?i(a,b,async()=>{try{let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:b,client_id:h.clientId});h.clientSecret&&c.set("client_secret",h.clientSecret);let d=await (0,f.Fm)(j,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:c,identity:h.identity,provider:a,format:h.format},g);if(!d.ok){let b=await d.text(),c=l(e,a,b,d.status);if(c)return c;return e?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${a}`,{status:d.status,error:m(b,d.status)}),null}let i=await d.json();return e?.info?.("TOKEN_REFRESH",`Successfully refreshed token for ${a}`,{hasNewAccessToken:!!i.access_token,hasNewRefreshToken:!!i.refresh_token,expiresIn:i.expires_in}),{accessToken:i.access_token,refreshToken:i.refresh_token||b,expiresIn:i.expires_in}}catch(b){return e?.error?.("TOKEN_REFRESH",`Error refreshing token for ${a}`,{error:b.message}),null}},e):(e?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null):(e?.warn?.("TOKEN_REFRESH",`No refresh URL configured for provider: ${a}`),null)}async function q(a,b){return a?i("claude",a,async()=>{try{let c=await (0,f.Fm)(e.NA.anthropic.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.claude.clientId}),identity:d.xq.claude?.identity,provider:"claude",format:d.xq.claude?.format});if(!c.ok){let a=await c.text(),d=l(b,"Claude",a,c.status);if(d)return d;return b?.error?.("TOKEN_REFRESH","Failed to refresh Claude OAuth token",{status:c.status,error:m(a,c.status)}),null}let g=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Claude OAuth token",{hasNewAccessToken:!!g.access_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Claude token: ${a.message}`),null}},b):null}async function r(a,b,c,g,h=null,j=null){if(!a)return null;let k=h||(b===d.xq.antigravity?.clientId?"antigravity":"gemini-cli"),n=d.xq[k];return i(`google:${b}`,a,async()=>{try{let d=await (0,f.Fm)(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:b,client_secret:c}),identity:n?.identity,provider:k,format:n?.format},j);if(!d.ok){let a=await d.text(),b=l(g,"Google",a,d.status);if(b)return b;return g?.error?.("TOKEN_REFRESH","Failed to refresh Google token",{status:d.status,error:m(a,d.status)}),null}let h=await d.json();return g?.info?.("TOKEN_REFRESH","Successfully refreshed Google token",{hasNewAccessToken:!!h.access_token,expiresIn:h.expires_in}),{accessToken:h.access_token,refreshToken:h.refresh_token||a,expiresIn:h.expires_in}}catch(a){return g?.error?.("TOKEN_REFRESH",`Network error refreshing Google token: ${a.message}`),null}},g)}async function s(a,b){return a?i("qwen",a,async()=>{let c=e.NA.qwen.token;try{let e=await (0,f.Fm)(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.qwen.clientId}),identity:d.xq.qwen?.identity,provider:"qwen",format:d.xq.qwen?.format});if(200===e.status){let c=await e.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Qwen token",{hasNewAccessToken:!!c.access_token,hasNewRefreshToken:!!c.refresh_token,expiresIn:c.expires_in}),{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,providerSpecificData:c.resource_url?{resourceUrl:c.resource_url}:void 0}}{let a=await e.text().catch(()=>""),c=l(b,"Qwen",a,e.status);if(c)return c;b?.warn?.("TOKEN_REFRESH","Error with Qwen endpoint",{status:e.status,error:m(a,e.status)})}}catch(a){b?.warn?.("TOKEN_REFRESH","Network error trying Qwen endpoint",{error:a.message})}return b?.error?.("TOKEN_REFRESH","Failed to refresh Qwen token"),null},b):null}function t(a="",b=0){let c=null;try{c=a?JSON.parse(a):null}catch{c=null}let d=c?.error,e=("string"==typeof d?d:d?.code||d?.type)||c?.error_code||"",f=c?.error_description||c?.message||d?.message||a||"",g=`${e} ${f}`.toLowerCase(),h=b<500&&["refresh_token_expired","refresh_token_reused","refresh_token_invalidated","invalid_grant","bad_refresh_token"].some(a=>g.includes(a));return{status:b,code:e,description:f,permanent:h}}async function u(a,b){return a?i("codex",a,async()=>{try{let c=await (0,f.Fm)(e.NA.openai.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({client_id:d.xq.codex.clientId,grant_type:"refresh_token",refresh_token:a}),identity:d.xq.codex?.identity,provider:"codex",format:d.xq.codex?.format});if(!c.ok){let a=await c.text(),d=t(a,c.status);if(d.permanent)return b?.error?.("TOKEN_REFRESH","Codex refresh token already used or invalid. Re-auth required.",{status:c.status,code:d.code}),{error:"unrecoverable_refresh_error",code:d.code};return b?.error?.("TOKEN_REFRESH","Failed to refresh Codex token",{status:c.status,error:m(a,c.status),code:d.code,permanent:d.permanent}),null}let g=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Codex token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,hasIdToken:!!g.id_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,idToken:g.id_token,expiresIn:g.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Codex token: ${a.message}`),null}},b):null}async function v(a,b,c){if(a?.profileArn)return{};let d=c?.trim?.()||null;if(!d){let c=(0,j.oC)().fetchKiroProfileArn;c&&(d=await c(b,a?.region))}return d?{providerSpecificData:{profileArn:d}}:{}}async function w(a,b,c,e=null){return a?i("kiro",a,async()=>{let g=b?.authMethod,h=b?.clientId,i=b?.clientSecret,l=b?.region;if("external_idp"===g){let g;try{let c=(0,j.oC)().buildExternalIdpRefreshParams;if(!c)throw Error("buildExternalIdpRefreshParams not wired");g=await c(a,b)}catch(a){return c?.warn?.("TOKEN_REFRESH",`Invalid Kiro external_idp refresh config: ${a.message}`),null}let h=await (0,f.Fm)(g.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:g.body,identity:d.xq.kiro?.identity,provider:"kiro",format:d.xq.kiro?.format},e);if(!h.ok){let a=await h.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro external_idp token",{status:h.status,error:m(a,h.status)}),null}let i=await h.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro external_idp token",{hasNewAccessToken:!!i.access_token,hasNewRefreshToken:!!i.refresh_token,expiresIn:i.expires_in}),{accessToken:i.access_token,refreshToken:i.refresh_token||a,expiresIn:i.expires_in,providerSpecificData:g.providerSpecificData}}if(h&&i){let j="idc"===g&&(0,k.i7)(l)?`https://oidc.${l}.amazonaws.com/token`:"https://oidc.us-east-1.amazonaws.com/token",n=await (0,f.Fm)(j,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:h,clientSecret:i,refreshToken:a,grantType:"refresh_token"}),identity:d.xq.kiro?.identity,provider:"kiro",format:d.xq.kiro?.format},e);if(!n.ok){let a=await n.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro AWS token",{status:n.status,error:m(a,n.status)}),null}let o=await n.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro AWS token",{hasNewAccessToken:!!o.accessToken,expiresIn:o.expiresIn}),{accessToken:o.accessToken,refreshToken:o.refreshToken||a,expiresIn:o.expiresIn,...await v(b,o.accessToken,o.profileArn)}}let n=await (0,f.Fm)(d.xq.kiro.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:a}),identity:d.xq.kiro?.identity,provider:"kiro",format:d.xq.kiro?.format},e);if(!n.ok){let a=await n.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro social token",{status:n.status,error:m(a,n.status)}),null}let o=await n.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro social token",{hasNewAccessToken:!!o.accessToken,expiresIn:o.expiresIn}),{accessToken:o.accessToken,refreshToken:o.refreshToken||a,expiresIn:o.expiresIn,...await v(b,o.accessToken,o.profileArn)}},c):null}async function x(a,b){return a?i("iflow",a,async()=>{let c=btoa(`${d.xq.iflow.clientId}:${d.xq.iflow.clientSecret}`),g=await (0,f.Fm)(e.NA.iflow.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${c}`},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.iflow.clientId,client_secret:d.xq.iflow.clientSecret}),identity:d.xq.iflow?.identity,provider:"iflow",format:d.xq.iflow?.format});if(!g.ok){let a=await g.text(),c=l(b,"iFlow",a,g.status);return c||(b?.error?.("TOKEN_REFRESH","Failed to refresh iFlow token",{status:g.status,error:m(a,g.status)}),null)}let h=await g.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed iFlow token",{hasNewAccessToken:!!h.access_token,hasNewRefreshToken:!!h.refresh_token,expiresIn:h.expires_in}),{accessToken:h.access_token,refreshToken:h.refresh_token||a,expiresIn:h.expires_in}},b):null}async function y(a,b){return a?i("github",a,async()=>{let c={grant_type:"refresh_token",refresh_token:a,client_id:d.xq.github.clientId};d.xq.github.clientSecret&&(c.client_secret=d.xq.github.clientSecret);let g=await (0,f.Fm)(e.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(c),identity:d.xq.github?.identity,provider:"github",format:d.xq.github?.format});if(!g.ok){let a=await g.text(),c=l(b,"GitHub",a,g.status);return c||(b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:g.status,error:m(a,g.status)}),null)}let h=await g.json();if(h.error||!h.access_token){let a=JSON.stringify(h),c=l(b,"GitHub",a,g.status);return c||(b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:g.status,error:m(a,g.status)}),null)}return b?.info?.("TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!h.access_token,hasNewRefreshToken:!!h.refresh_token,expiresIn:h.expires_in}),{accessToken:h.access_token,refreshToken:h.refresh_token||a,expiresIn:h.expires_in}},b):null}async function z(a,b){return a?i("copilot",a,async()=>{try{let c=await (0,f.Fm)(d.sr.github?.copilotTokenUrl,{headers:{Authorization:`token ${a}`,Accept:"application/json"},identity:d.xq.github?.identity,provider:"github",format:d.xq.github?.format});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Copilot token",{status:c.status,error:m(a,c.status)}),null}let e=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!e.token,expiresAt:e.expires_at}),{token:e.token,expiresAt:e.expires_at}}catch(a){return b?.error?.("TOKEN_REFRESH","Error refreshing Copilot token",{error:a.message}),null}},b):null}async function A(a,b){return a?i("codebuddy-cn",a,async()=>{let c=d.sr["codebuddy-cn"]||{},e=await (0,f.Fm)(c.refreshUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":c.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":"copilot.tencent.com","X-Refresh-Token":a},body:JSON.stringify({refreshToken:a}),identity:d.xq["codebuddy-cn"]?.identity,provider:"codebuddy-cn",format:d.xq["codebuddy-cn"]?.format});if(!e.ok){let a=await e.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh CodeBuddy token",{status:e.status,error:m(a,e.status)}),null}let g=await e.json();return 0===g.code&&g.data?.accessToken?(b?.info?.("TOKEN_REFRESH","Successfully refreshed CodeBuddy token",{hasNewAccessToken:!!g.data.accessToken,hasNewRefreshToken:!!g.data.refreshToken,expiresIn:g.data.expiresIn}),{accessToken:g.data.accessToken,refreshToken:g.data.refreshToken||a,expiresIn:g.data.expiresIn}):(b?.error?.("TOKEN_REFRESH","CodeBuddy token refresh returned no token",{code:g.code,msg:g.msg}),null)},b):null}let B=3e5;function C(a){return a&&"object"==typeof a&&("unrecoverable_refresh_error"===a.error||"refresh_token_reused"===a.error||"invalid_request"===a.error||"invalid_grant"===a.error)}function D(a){return e.Wu[a]||B}function E(a){if("string"!=typeof a)return null;try{let b=JSON.parse(a);if("service_account"===b.type&&b.client_email&&b.private_key&&b.project_id)return b;return null}catch{return null}}let F=new Map;async function G(a,b,g="vertex",h=null){let i=a.client_email,j=F.get(i);if(j&&j.expiresAt-Date.now()>3e5)return{accessToken:j.token,expiresAt:j.expiresAt};try{let{SignJWT:j,importPKCS8:k}=await c.e(9078).then(c.bind(c,9078));b?.debug?.("TOKEN_REFRESH",`Vertex minting token for ${a.client_email}`);let l=await k(a.private_key.replace(/\\n/g,"\n"),"RS256"),m=Math.floor(Date.now()/1e3),n=await new j({scope:"https://www.googleapis.com/auth/cloud-platform"}).setProtectedHeader({alg:"RS256"}).setIssuer(a.client_email).setAudience(e.NA.google.token).setIssuedAt(m).setExpirationTime(m+3600).sign(l),o=d.xq[g]||d.xq.vertex,p=await (0,f.Fm)(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:n}),identity:o.identity,provider:g,format:o.format},h);if(!p.ok){let a=await p.text();return b?.error?.("TOKEN_REFRESH",`Vertex token mint failed: ${a}`),null}let{access_token:q,expires_in:r}=await p.json(),s=Date.now()+(r??3600)*1e3;return F.set(i,{token:q,expiresAt:s}),b?.info?.("TOKEN_REFRESH",`Vertex token minted for ${a.client_email}`),{accessToken:q,expiresAt:s}}catch(a){return b?.error?.("TOKEN_REFRESH",`Vertex token error: ${a.message}`),null}}function H(a,b,c="vertex"){let d=E(a.apiKey);if(d)return G(d,b,c);try{let d="string"==typeof a.apiKey?JSON.parse(a.apiKey):null;if(d?.type==="authorized_user"&&d.refresh_token&&d.client_id&&d.client_secret)return r(d.refresh_token,d.client_id,d.client_secret,b,c)}catch{}return null}let I={"gemini-cli":(a,b)=>r(a.refreshToken,d.xq["gemini-cli"].clientId,d.xq["gemini-cli"].clientSecret,b),antigravity:(a,b)=>r(a.refreshToken,d.xq.antigravity.clientId,d.xq.antigravity.clientSecret,b),claude:(a,b)=>q(a.refreshToken,b),codex:(a,b)=>u(a.refreshToken,b),qwen:(a,b)=>s(a.refreshToken,b),iflow:(a,b)=>x(a.refreshToken,b),github:(a,b)=>y(a.refreshToken,b),kiro:(a,b)=>w(a.refreshToken,a.providerSpecificData,b),xai:(a,b)=>o(a.refreshToken,b),"grok-cli":(a,b,c)=>p("grok-cli",a.refreshToken,a,b,c),"codebuddy-cn":(a,b)=>A(a.refreshToken,b),muse:(a,b)=>J(a.providerSpecificData?.dcaToken||a.refreshToken,b),vertex:(a,b)=>H(a,b,"vertex"),"vertex-partner":(a,b)=>H(a,b,"vertex-partner")};async function J(a,b){if(!a)return null;try{let c=process.env.META_MINT_URL||"https://api.meta.ai/muse-code/key",d=await (0,f.Fm)(c,{method:"POST",headers:{Authorization:`Bearer ${a}`,"User-Agent":"muse-code/1.0.2","Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({dca_token:a}),identity:"muse-code",provider:"muse"});if(!d.ok)return b?.warn?.("TOKEN_REFRESH",`Failed to re-mint Meta Muse API key: ${d.status}`),null;let e=await d.json();return{accessToken:e.api_key,apiKey:e.api_key,providerSpecificData:{apiKey:e.api_key,baseUrl:e.base_url||"https://api.meta.ai/v1"}}}catch(a){return b?.warn?.("TOKEN_REFRESH",`Error re-minting Meta Muse API key: ${a?.message}`),null}}async function K(a,b,c,d=null){let e="vertex"===a||"vertex-partner"===a;if(!b.refreshToken&&!(e&&b?.apiKey))return null;let f=I[a];return f?f(b,c,d):p(a,b.refreshToken,b,c,d)}async function L(a,b=3,c=null,d=null){for(let e=0;e<b;e++){if(d?.throwIfAborted(),e>0){let a=1e3*e;c?.debug?.("TOKEN_REFRESH",`Retry ${e}/${b} after ${a}ms`),await new Promise(b=>{let c=()=>{clearTimeout(e),d?.removeEventListener("abort",c),b()},e=setTimeout(c,a);d?.addEventListener("abort",c,{once:!0}),d?.aborted&&c()}),d?.throwIfAborted()}try{let b=await a();if(C(b)||b)return b}catch(a){d?.throwIfAborted(),c?.warn?.("TOKEN_REFRESH",`Attempt ${e+1}/${b} failed: ${a.message}`)}}return c?.error?.("TOKEN_REFRESH",`All ${b} retry attempts failed`),null}},47293:(a,b,c)=>{c.d(b,{A:()=>f});let d=new Uint8Array(16);var e=c(50122);let f=function(a,b,c){return b||a||!crypto.randomUUID?function(a,b,c){let f=(a=a||{}).random??a.rng?.()??crypto.getRandomValues(d);if(f.length<16)throw Error("Random bytes length must be >= 16");if(f[6]=15&f[6]|64,f[8]=63&f[8]|128,b){if((c=c||0)<0||c+16>b.length)throw RangeError(`UUID byte range ${c}:${c+15} is out of buffer bounds`);for(let a=0;a<16;++a)b[c+a]=f[a];return b}return(0,e.k)(f)}(a,b,c):crypto.randomUUID()}},50122:(a,b,c)=>{c.d(b,{k:()=>e});let d=[];for(let a=0;a<256;++a)d.push((a+256).toString(16).slice(1));function e(a,b=0){return(d[a[b+0]]+d[a[b+1]]+d[a[b+2]]+d[a[b+3]]+"-"+d[a[b+4]]+d[a[b+5]]+"-"+d[a[b+6]]+d[a[b+7]]+"-"+d[a[b+8]]+d[a[b+9]]+"-"+d[a[b+10]]+d[a[b+11]]+d[a[b+12]]+d[a[b+13]]+d[a[b+14]]+d[a[b+15]]).toLowerCase()}},57034:(a,b,c)=>{c.d(b,{i7:()=>e,l6:()=>f});let d=/^[a-z]{2}(?:-[a-z0-9]+)+-\d{1,2}$/;function e(a){return"string"==typeof a&&d.test(a)}function f(a,b="us-east-1"){return e(a)?a:b}}};
|