zevairouter 1.1.33 → 1.1.34
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/CHANGELOG.md +35 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +13 -13
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/prerender-manifest.json +4 -4
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cache/stats/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/changelog/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -16
- package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
- package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +3 -15
- package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -3
- package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/context/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/context/bulk/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/context/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/cli-tools/keys/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/enable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/health/ready/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/init/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/keys/[id]/rotate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/metrics/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/quota-cookie/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/quota-cookie/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-token/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/latest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/bulk-delete/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/codebuddy/discover-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/auth/setup/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/auth/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/auth/unlock/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/input/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/resize/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/terminal/session/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/quota-stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/quota-stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/routing-stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/provider-icons/[provider]/route.js.nft.json +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +13 -13
- package/cli/app/.next-cli-build/server/chunks/1131.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1133.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1283.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/1350.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/2238.js +1 -0
- package/cli/app/.next-cli-build/server/chunks/2442.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/2456.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/{440.js → 3294.js} +3 -4
- package/cli/app/.next-cli-build/server/chunks/3477.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3593.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3721.js +4 -4
- package/cli/app/.next-cli-build/server/chunks/3792.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3949.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3999.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/40.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4055.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/412.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4322.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/437.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4493.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4586.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/4780.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4827.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4897.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5024.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5217.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5330.js +9 -11
- package/cli/app/.next-cli-build/server/chunks/5434.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5436.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5681.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5800.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5949.js +2 -2
- package/cli/app/.next-cli-build/server/chunks/6182.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/6252.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6846.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6936.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/7170.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7319.js +24 -27
- package/cli/app/.next-cli-build/server/chunks/773.js +1 -0
- package/cli/app/.next-cli-build/server/chunks/8239.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8255.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8306.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8655.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8895.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/891.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/9489.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/{2750.js → 9528.js} +3 -2
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/middleware.js +2 -2
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/server/preview-props.json +3 -3
- package/cli/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/cli/app/.next-cli-build/static/chunks/{5497-a9a321ee476bd2ce.js → 5497-00e385b36b5faf04.js} +2 -2
- package/cli/app/.next-cli-build/static/chunks/620-f497c666bb6c6074.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9c505cf411125a6a.js +3 -0
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-4bd92dec9d25dff3.js +1 -0
- package/cli/app/CHANGELOG.md +35 -0
- package/cli/app/cli/hooks/postinstall.js +0 -12
- package/cli/app/cli/hooks/startupRuntime.js +0 -10
- package/cli/app/package.json +1 -1
- package/cli/app/src/lib/db/adapters/sqljsAdapter.js +82 -15
- package/cli/app/src/lib/db/migrate.js +27 -3
- package/cli/app/src/mitm/server.js +32 -34
- package/cli/cli.js +3 -7
- package/cli/hooks/postinstall.js +0 -12
- package/cli/hooks/startupRuntime.js +0 -10
- package/cli/package.json +1 -1
- package/cli/src/cli/terminalUI.js +21 -5
- package/package.json +1 -1
- package/cli/app/.next-cli-build/server/chunks/1585.js +0 -1
- package/cli/app/.next-cli-build/server/chunks/3912.js +0 -2
- package/cli/app/.next-cli-build/static/chunks/620-46999209a961b94a.js +0 -1
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-e9fcb79ca412ea2c.js +0 -3
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-7b3b291fb9d2dc65.js +0 -1
- package/cli/app/cli/hooks/notionTlsRuntime.js +0 -57
- package/cli/app/public/providers/notion-ai.png +0 -0
- package/cli/hooks/notionTlsRuntime.js +0 -57
- /package/cli/app/.next-cli-build/static/{5wTkpSETl1nKGKUkK-OM5 → QnZGjZBbNqQkbGSTiHVnz}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{5wTkpSETl1nKGKUkK-OM5 → QnZGjZBbNqQkbGSTiHVnz}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{28915:(e,t,s)=>{"use strict";s.d(t,{x6:()=>a.fetchJson,E2:()=>r,gs:()=>i});var a=s(68211);function r(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}function i(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}},42911:(e,t,s)=>{Promise.resolve().then(s.bind(s,91433))},68211:(e,t,s)=>{"use strict";s.d(t,{fetchJson:()=>r});let a={"Content-Type":"application/json"};async function r(e,t={}){let{body:s,headers:i,...n}=t,l={...n,headers:{...a,...i}};void 0!==s&&"string"!=typeof s?l.body=JSON.stringify(s):void 0!==s&&(l.body=s);let o=await fetch(e,l),d=await o.text(),c=null;if(d)try{c=JSON.parse(d)}catch{let t=Error(`Non-JSON response from ${e} (HTTP ${o.status})`);throw t.status=o.status,t.rawBody=d.slice(0,300),t}if(!o.ok){let e=c&&(c.error?.message||c.error||c.message)||`Request failed (HTTP ${o.status})`,t=Error("string"==typeof e?e:`HTTP ${o.status}`);throw t.status=o.status,t.data=c,t}return c}r.get=(e,t)=>r(e,{...t,method:"GET"}),r.post=(e,t,s)=>r(e,{...s,method:"POST",body:t}),r.put=(e,t,s)=>r(e,{...s,method:"PUT",body:t}),r.patch=(e,t,s)=>r(e,{...s,method:"PATCH",body:t}),r.del=(e,t)=>r(e,{...t,method:"DELETE"})},70217:(e,t,s)=>{"use strict";s.d(t,{BU:()=>u,G9:()=>l,d4:()=>d,gJ:()=>a,i2:()=>c});let a=[{id:"all",label:"All"},{id:"active",label:"Active",keys:["active"]},{id:"errors",label:"Errors",keys:["connection_error","auth_error","quota_exhausted","rate_limited","banned","cooldown","unknown"]},{id:"connection",label:"Connection",keys:["connection_error"]},{id:"auth",label:"Auth",keys:["auth_error"]},{id:"limit",label:"Limit",keys:["rate_limited","cooldown"]},{id:"exhausted",label:"Exhausted",keys:["quota_exhausted"]},{id:"banned",label:"Banned",keys:["banned"]},{id:"disabled",label:"Disabled",keys:["disabled"]}],r={active:{label:"active",severity:"success",terminal:!1},disabled:{label:"disabled",severity:"default",terminal:!1},connection_error:{label:"connection error",severity:"error",terminal:!1},auth_error:{label:"auth error",severity:"error",terminal:!0},quota_exhausted:{label:"exhausted",severity:"error",terminal:!0},rate_limited:{label:"rate limited",severity:"warning",terminal:!1},banned:{label:"banned",severity:"error",terminal:!0},cooldown:{label:"cooldown",severity:"warning",terminal:!1},unknown:{label:"unknown",severity:"default",terminal:!1}},i={policy_suspended:"banned",account_validation_required:"auth_error",credential_rejected:"auth_error",reauth_required:"auth_error",authentication:"auth_error",entitlement_or_quota:"quota_exhausted",rate_limited:"rate_limited",permission_denied:"auth_error",upstream_transient:"connection_error"};function n(e){if(!e)return"";if("string"==typeof e)return e.toLowerCase();try{return JSON.stringify(e).toLowerCase()}catch{return String(e).toLowerCase()}}function l(e={},t=Date.now()){let s=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>new Date(e).getTime()).filter(e=>Number.isFinite(e)&&e>t);return s.length>0?new Date(Math.min(...s)).toISOString():null}function o(e,t=""){let s=r[e]||r.unknown;return{key:e,...s,reason:t}}function d(e={}){var t;let s=(t=e).quarantinedAt?o(i[n(t.failureClass)]||"unknown",t.quarantineReason||t.lastError||"Connection is quarantined"):null;if(s)return s;if(!1===e.isActive)return o("disabled","Connection is disabled");if(function(e={}){return null!==l(e)}(e))return o("cooldown","Model cooldown is active");if(function(e){if(!e)return!1;let t=new Date(e).getTime();return Number.isFinite(t)&&t>Date.now()}(e.rateLimitedUntil))return o("rate_limited","Rate limit cooldown is active");let a=n(e.testStatus||e.status),r=n(e.lastErrorType||e.errorType),c=n(e.errorCode||e.statusCode),u=n(e.lastError||e.error),m=`${a} ${r} ${c} ${u}`.trim();return!m||["active","success","ok"].includes(a)?o("active",""):m.includes("ban")||m.includes("suspend")||m.includes("restricted")?o("banned",e.lastError||"Account appears restricted"):m.includes("exhaust")||m.includes("quota exceeded")||m.includes("insufficient_quota")||m.includes("payment required")||"402"===c?o("quota_exhausted",e.lastError||"Quota exhausted"):r.includes("rate_limited")||m.includes("rate limit")||m.includes("too many requests")||"429"===c?o("rate_limited",e.lastError||"Rate limited"):r.includes("auth")||r.includes("token")||m.includes("unauthorized")||m.includes("invalid api key")||m.includes("token invalid")||m.includes("token expired")||m.includes("revoked")||"401"===c||"403"===c?o("auth_error",e.lastError||"Authentication failed"):r.includes("network")||m.includes("network")||m.includes("timeout")||m.includes("fetch failed")||m.includes("econn")||m.includes("dns")||m.includes("proxy")?o("connection_error",e.lastError||"Connection failed"):["error","expired","unavailable","failed"].includes(a)?o("connection_error",e.lastError||e.testStatus||"Connection failed"):o("unknown",e.lastError||e.testStatus||"")}function c(e,t){if(!t||"all"===t)return!0;let s=a.find(e=>e.id===t);return!s||s.keys.includes(d(e).key)}function u(e){return e?.severity==="success"?"success":e?.severity==="error"?"error":"default"}},81277:(e,t,s)=>{"use strict";s.d(t,{c:()=>i});var a=s(12115),r=s(70217);function i(e={}){let[t,s]=(0,a.useState)(null),n=JSON.stringify(Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).sort(([e],[t])=>e.localeCompare(t)));return(0,a.useEffect)(()=>(function(e,t,s={}){let a=s.now||Date.now,i=s.setTimer||globalThis.setTimeout,n=s.clearTimer||globalThis.clearTimeout,l=!1,o=null,d=()=>{if(o=null,l)return;let s=a(),n=(0,r.G9)(e,s);t(n),n&&(o=i(d,Math.min(Math.max(1,new Date(n).getTime()-s+1),0x7fffffff)))};return o=i(d,0),()=>{l=!0,null!==o&&n(o),o=null}})(Object.fromEntries(JSON.parse(n)),s),[n]),t}},91433:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>ea});var a=s(95155),r=s(12115),i=s(73321),n=s(98500),l=s.n(n),o=s(5772),d=s(35497),c=s(52679);let u=["kiro","codebuddy","codebuddy-cn","qoder","antigravity","cloudflare-ai","grok-cli"];function m(e){return u.includes(String(e||""))}function p(e){let t=String(e||"").trim();return t&&m(t)?`/dashboard/automation?provider=${encodeURIComponent(t)}`:"/dashboard/automation"}var x=s(28777),h=s(11059),f=s(73006);let b=new Map;async function g(e){if(!e?.url||!e?.type)return[];let t=b.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let a=(await s.json()).data??[];return b.set(e.url,{data:a,expiresAt:Date.now()+6e5}),a}catch{return[]}}var y=s(70217),v=s(51716);let j=Object.freeze({oauth:Object.freeze({id:"oauth",label:"OAuth",icon:"lock",description:"Connect through the provider sign-in flow."}),apikey:Object.freeze({id:"apikey",label:"API Key",icon:"key",description:"Connect with an API key or provider credential."}),cookie:Object.freeze({id:"cookie",label:"Browser Cookie",icon:"cookie",description:"Connect with a signed-in browser session cookie."}),"quota-cookie":Object.freeze({id:"quota-cookie",label:"Quota Cookie",icon:"cookie",description:"Attach a web session so Quota Tracker can read credits."})}),w=Object.freeze({codebuddy:Object.freeze(["quota-cookie"]),iflow:Object.freeze(["cookie"])}),k=Object.freeze({qoder:Object.freeze({apikey:Object.freeze({label:"Qoder PAT"})}),xai:Object.freeze({oauth:Object.freeze({label:"Grok Build OAuth"}),apikey:Object.freeze({label:"xAI API Key"})})});function N(e,t){e.includes(t)||e.push(t)}var C=s(65921),S=s(14051),A=s.n(S);function $({model:e,fullModel:t,alias:s,copied:r,onCopy:i,testStatus:n,isCustom:l,isFree:o,onDeleteAlias:d,onTest:c,isTesting:u,onDisable:m,thinkingSuffix:p}){let x="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0,h=p?`${t}(${p})`:t;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:x?{color:x}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,a.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:h}),e.name&&(0,a.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:e.name})]}),c&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:c,disabled:u,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${u?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:u?{animation:"spin 1s linear infinite"}:void 0,children:u?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:u?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:()=>i(h,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:r===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:r===`model-${e.id}`?"Copied!":"Copy"})]}),l?(0,a.jsx)("button",{onClick:d,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,a.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function T({models:e,modelAliases:t,providerStorageAlias:s,providerDisplayAlias:a}){let r={...t||{}},i=new Set(Object.values(r)),n=[];for(let t of Array.isArray(e)?e:[]){let e=function(e){if(!e)return"";if("string"==typeof e)return e.trim();let t=e.id||e.name||e.model;return"string"==typeof t?t.trim():""}(t);if(!e)continue;let l=`${s}/${e}`;if(i.has(l))continue;let o=function(e,t,s){let a=e.split("/"),r=a[a.length-1];if(!r)return"";if(!t[r])return r;let i=`${s}-${r}`;if(!t[i])return i;let n=2;for(;t[`${i}-${n}`];)n+=1;return`${i}-${n}`}(e,r,a);o&&(n.push({alias:o,model:l,modelId:e}),r[o]=l,i.add(l))}return n}function E({modelId:e,fullModel:t,copied:s,onCopy:r,onDeleteAlias:i,onTest:n,testStatus:l,isTesting:o}){let d="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>r(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),n&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:n,disabled:o,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:o?"Testing...":"Test"})]})]})]}),(0,a.jsx)("button",{onClick:i,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function O({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:i,onCopy:n,onSetAlias:l,onDeleteAlias:o,onAliasesChanged:c,connections:u,isAnthropic:m}){let[p,x]=(0,r.useState)(""),[h,f]=(0,r.useState)(!1),[b,g]=(0,r.useState)(!1),[y,v]=(0,r.useState)(()=>new Set),[j,w]=(0,r.useState)({}),k=async t=>{let s=`${e}/${t}`;v(e=>new Set(e).add(t));try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s})}),t=await e.json();w(e=>({...e,[s]:t.ok?"ok":"error"}))}catch{w(e=>({...e,[s]:"error"}))}finally{v(e=>{let s=new Set(e);return s.delete(t),s})}},N=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),C=async()=>{if(!p.trim()||h)return;let a=p.trim(),[r]=T({models:[{id:a}],modelAliases:s,providerStorageAlias:e,providerDisplayAlias:t});if(!r)return void alert("This model already exists.");f(!0);try{await l(a,r.alias,e),x("")}catch(e){console.log("Error adding model:",e),alert(e?.message||`Failed to add model "${a}".`)}finally{f(!1)}},S=async()=>{if(b)return;let a=u.find(e=>!1!==e.isActive);if(a){g(!0);try{let r=await fetch(`/api/providers/${a.id}/models`),i=await r.json();if(!r.ok)return void alert(i.error||"Failed to import models");let n=i.models||[];if(0===n.length)return void alert("No models returned from /models.");let l=T({models:n,modelAliases:s,providerStorageAlias:e,providerDisplayAlias:t});if(0===l.length)return void alert("No new models were added.");let o=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({aliases:l.map(({alias:e,model:t})=>({alias:e,model:t}))})}),d=await o.json();if(!o.ok)throw Error(d.error||"Failed to save imported models.");await c(),alert(`Successfully added ${d.count||l.length} models.`)}catch(e){console.log("Error importing models:",e),alert(e?.message||"Failed to import models from /models.")}finally{g(!1)}}},A=u.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",m?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:p,onChange:e=>x(e.target.value),onKeyDown:e=>"Enter"===e.key&&C(),placeholder:m?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:C,disabled:!p.trim()||h,children:h?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:S,disabled:!A||b,children:b?"Importing...":"Import from /models"})]}),!A&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),N.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:N.map(({modelId:s,fullModel:r,alias:l})=>(0,a.jsx)(E,{modelId:s,fullModel:`${t}/${s}`,copied:i,onCopy:n,onDeleteAlias:()=>o(l),onTest:u.length>0?()=>k(s):void 0,testStatus:j[`${e}/${s}`],isTesting:y.has(s)},r))})]})}$.propTypes={model:A().shape({id:A().string.isRequired}).isRequired,fullModel:A().string.isRequired,alias:A().string,copied:A().string,onCopy:A().func.isRequired,testStatus:A().oneOf(["ok","error"]),isCustom:A().bool,isFree:A().bool,onDeleteAlias:A().func,onTest:A().func,isTesting:A().bool,onDisable:A().func,thinkingSuffix:A().string},A().string.isRequired,A().string.isRequired,A().string,A().func.isRequired,A().func.isRequired,A().func,A().oneOf(["ok","error"]),A().bool,A().string.isRequired,A().object.isRequired,A().string,A().func.isRequired,A().func.isRequired,A().func.isRequired,O.propTypes={providerStorageAlias:A().string.isRequired,providerDisplayAlias:A().string.isRequired,modelAliases:A().object.isRequired,copied:A().string,onCopy:A().func.isRequired,onSetAlias:A().func.isRequired,onDeleteAlias:A().func.isRequired,onAliasesChanged:A().func.isRequired,connections:A().arrayOf(A().shape({id:A().string,isActive:A().bool})).isRequired,isAnthropic:A().bool};var P=s(81277);function R({until:e}){let[t,s]=(0,r.useState)("");return((0,r.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime();if(!Number.isFinite(t))return void s("");let a=t-Date.now();if(a<=0)return void s("");let r=Math.floor(a/1e3);if(r<60)s(`${r}s`);else if(r<3600)s(`${Math.floor(r/60)}m ${r%60}s`);else{let e=Math.floor(r/3600),t=Math.floor(r%3600/60);s(`${e}h ${t}m`)}};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function I({connection:e,proxyPools:t,isOAuth:s,isFirst:i,isLast:n,onMoveUp:l,onMoveDown:o,onToggleActive:c,onUpdateProxy:u,onEdit:m,onDelete:p,autoPingEnabled:x=!1,onToggleAutoPing:h,oneByOneStatus:f=null}){let[b,g]=(0,r.useState)(!1),[v,j]=(0,r.useState)(!1),w=(0,r.useRef)(null),k=(0,r.useMemo)(()=>new Map((t||[]).map(e=>[e.id,e])),[t]),N=(0,r.useMemo)(()=>t||[],[t]),C=e.providerSpecificData?.proxyPoolId||null,S=C?k.get(C):null,A=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,$=!!C||A,T=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:A?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",E="";if(S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);E=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{E=t}}let O=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",_="default";S?.isActive===!0?_="success":(C||A)&&(_="error"),(0,r.useEffect)(()=>{if(!b)return;let e=e=>{w.current&&!w.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[b]);let z=async e=>{j(!0);try{await u("__none__"===e?null:e)}finally{j(!1),g(!1)}},q=e.authType||(s?"oauth":"apikey"),D="oauth"===q,M="cookie"===q,U=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),L=D?U(e.email)?e.email:U(e.name)?e.name:e.name||e.email||e.displayName||"OAuth Account":e.name||e.email||e.displayName||"API Key",F=(0,P.c)(e),J=null!==F,K="unavailable"!==e.testStatus||J?e.testStatus:"active",B=(0,y.d4)(e),G=!!e.quarantinedAt,H={policy_suspended:"Policy suspension",account_validation_required:"Account verification required",credential_rejected:"Credential rejected",reauth_required:"Sign-in required",authentication:"Repeated authentication failure"}[e.failureClass]||e.quarantineReason||"Account quarantined",V=Number.isFinite(Date.parse(e.quarantinedAt))?new Date(e.quarantinedAt).toLocaleString():e.quarantinedAt||null,Q=e.modelLockReason?.resetsAt,W=Number.isFinite(Date.parse(Q))?new Date(Q).toLocaleString():Q||null,Z=()=>f?"queued"===f.state?"queued":"testing"===f.state?"testing":"success"===f.state?"success":"failed"===f.state?f.error?`failed: ${f.error}`:"failed":null:null;return(0,a.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive&&!G?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,a.jsx)("button",{onClick:l,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:o,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:M?"cookie":D?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:L}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,a.jsx)(d.Ex,{variant:(()=>{if(!1===e.isActive)return"default";let t=(0,y.BU)(B);return"active"!==B.key?t:"active"===K||"success"===K?"success":"error"===K||"expired"===K||"unavailable"===K?"error":"default"})(),size:"sm",dot:!0,children:B.label||K||"unknown"}),(0,a.jsx)(d.Ex,{variant:"default",size:"sm",children:D?"OAuth":M?"Cookie":"API Key"}),G&&(0,a.jsx)(d.Ex,{variant:"error",size:"sm",children:"Quarantined"}),$&&(0,a.jsx)(d.Ex,{variant:_,size:"sm",children:"Proxy"}),e.autoDisabledAt&&!G&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["token_expired"===e.autoDisabledReason?"Token expired":"banned"===e.autoDisabledReason?"Banned":"quota_exhausted"===e.autoDisabledReason?"Quota exhausted":"Auto-disabled"," — ",new Date(e.autoDisabledAt).toLocaleDateString()]}),G&&(0,a.jsxs)("span",{className:"max-w-full truncate text-xs text-red-600 dark:text-red-400 sm:max-w-[420px]",title:`${e.quarantineReason||H}${V?` - ${V}`:""}`,children:[H,V?` - ${V}`:""]}),J&&!1!==e.isActive&&(0,a.jsx)(R,{until:F}),J&&e.modelLockReason&&!1!==e.isActive&&(0,a.jsxs)("span",{className:"max-w-full truncate text-xs text-amber-600 dark:text-amber-400 sm:max-w-[360px]",title:`${e.modelLockReason.reason}${W?` — resets ${W}`:""}`,children:[e.modelLockReason.model,e.modelLockReason.providerErrorCode?` (${e.modelLockReason.providerErrorCode})`:"",W?` — resets ${W}`:""]}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),Z()&&(0,a.jsx)(d.Ex,{variant:f?"success"===f.state?"success":"failed"===f.state?"error":"testing"===f.state?"primary":"default":"default",size:"sm",children:Z()})]}),$&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:T,children:T}),E&&(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:E}),O&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:O,children:["no_proxy: ",O]})]}),G&&!1===e.isActive&&(0,a.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Re-enable only permits router requests again; it does not change the account's upstream status."})]})]}),(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[N.length>0&&(0,a.jsxs)("div",{className:"relative",ref:w,children:[(0,a.jsxs)("button",{onClick:()=>g(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${$?"text-primary":"text-text-muted hover:text-primary"}`,disabled:v,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:v?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),b&&(0,a.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 max-w-[78vw] min-w-[160px] rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,a.jsx)("button",{onClick:()=>z("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),N.map(e=>(0,a.jsx)("button",{onClick:()=>z(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),h&&(0,a.jsxs)("button",{onClick:()=>h(!x),className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${x?"text-primary":"text-text-muted hover:text-primary"}`,title:x?"Disable quota auto-ping for this account":"Warm the 5-hour quota window after reset with a tiny request",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]}),(0,a.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:p,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,a.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":G?"Re-enable routing only; upstream suspension or credential status is unchanged":"Enable connection"})]})]})}R.propTypes={until:A().string.isRequired},I.propTypes={connection:A().shape({id:A().string,name:A().string,email:A().string,displayName:A().string,modelLockUntil:A().string,testStatus:A().string,isActive:A().bool,lastError:A().string,failureClass:A().string,quarantinedAt:A().string,quarantineReason:A().string,priority:A().number,globalPriority:A().number}).isRequired,proxyPools:A().arrayOf(A().shape({id:A().string,name:A().string,proxyUrl:A().string,noProxy:A().string,isActive:A().bool})),isOAuth:A().bool.isRequired,isFirst:A().bool.isRequired,isLast:A().bool.isRequired,onMoveUp:A().func.isRequired,onMoveDown:A().func.isRequired,onToggleActive:A().func.isRequired,onUpdateProxy:A().func,autoPingEnabled:A().bool,onToggleAutoPing:A().func,onEdit:A().func.isRequired,onDelete:A().func.isRequired,oneByOneStatus:A().shape({state:A().string,error:A().string})};var _=s(28915);let z=`name1|sk-key1
|
|
2
|
+
name2|sk-key2
|
|
3
|
+
sk-key-only-auto-named`;function q({isOpen:e,provider:t,providerName:s,isCompatible:i,isAnthropic:n,authType:l,authHint:o,website:u,proxyPools:m,error:p,onSave:x,onBulkDone:h,onClose:f}){let b="__none__",g="ollama-local"===t,y="cookie"===l,v="xai"===t&&!y,j=y?"Cookie Value":"qoder"===t?"Personal Access Token (PAT)":"API Key",w=y?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":v?"xai-...":"qoder"===t?"pt-...":"",k="azure"===t,N="cloudflare-ai"===t,C=c.Q2?.[t]?.regions||null,S=c.Q2?.[t]?.defaultRegion||C?.[0]?.id||"",[A,$]=(0,r.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:b,ollamaHostUrl:""}),[T,E]=(0,r.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[O,P]=(0,r.useState)({accountId:""}),[R,I]=(0,r.useState)(S),[D,M]=(0,r.useState)(!1),[U,L]=(0,r.useState)(null),[F,J]=(0,r.useState)(!1),[K,B]=(0,r.useState)("single"),[G,H]=(0,r.useState)(""),[V,Q]=(0,r.useState)(null),W=(0,r.useRef)(!1);(0,r.useEffect)(()=>{e&&!W.current&&($({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:b,ollamaHostUrl:""}),E({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),P({accountId:""}),I(S),L(null),B("single"),H(""),Q(null)),W.current=e},[e]);let Z=()=>g&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:k?{azureEndpoint:T.azureEndpoint,apiVersion:T.apiVersion,deployment:T.deployment,organization:T.organization}:N?{accountId:O.accountId}:C&&R?{region:R}:void 0,X=async()=>{M(!0);try{let e=await (0,_.x6)("/api/providers/validate",{method:"POST",body:{provider:t,apiKey:A.apiKey,providerSpecificData:Z()}});L(e.valid?"success":"failed")}catch{L("unknown")}finally{M(!1)}},Y=async()=>{if(t&&(g||A.apiKey)&&(g||A.name)&&(!i||A.defaultModel.trim())){J(!0);try{let e=!1;try{M(!0),L(null),e=!!(await (0,_.x6)("/api/providers/validate",{method:"POST",body:{provider:t,apiKey:A.apiKey,providerSpecificData:Z()}})).valid,L(e?"success":"failed")}catch{L("unknown")}finally{M(!1)}let s=Number.parseInt(A.priority,10);await x({name:A.name||(g?"Ollama Local":""),apiKey:A.apiKey,defaultModel:i?A.defaultModel.trim():void 0,priority:Number.isFinite(s)?s:1,proxyPoolId:A.proxyPoolId===b?null:A.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:Z()})}finally{J(!1)}}},ee=async()=>{let e=G.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;J(!0),Q(null);let s=0,a=0,r=[],i=[];for(let n=0;n<e.length;n++){let l=e[n].split("|"),o=l.length>=2?l.slice(1).join("|").trim():l[0].trim(),d=l.length>=2?l[0].trim():"Key",c=`${d} ${n+1}`;try{await (0,_.x6)("/api/providers",{method:"POST",body:{provider:t,apiKey:o,name:c,priority:1,testStatus:"unknown"}}),s++}catch(t){a++,r.push({line:e[n],message:t?.message||"Request failed"}),i.push(e[n])}}J(!1),Q({success:s,failed:a,failedRows:r}),H(i.join("\n")),s>0&&h&&h()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${j}`,onClose:f,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"single"===K?"primary":"ghost",onClick:()=>{B("single"),Q(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===K?"primary":"ghost",onClick:()=>{B("bulk"),Q(null)},children:"Bulk Add"})]}),"bulk"===K&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,a.jsx)("code",{children:"name|apiKey"})," or just ",(0,a.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:z,value:G,onChange:e=>H(e.target.value)}),V&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${V.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",V.success," added",V.failed>0?`, ✗ ${V.failed} failed`:""]}),V.failedRows?.length>0&&(0,a.jsx)("ul",{className:"text-xs text-red-500 flex flex-col gap-0.5",children:V.failedRows.map((e,t)=>(0,a.jsxs)("li",{className:"break-words",children:[(0,a.jsx)("span",{className:"font-mono",children:e.line.length>40?`${e.line.slice(0,40)}…`:e.line}),` — ${e.message}`]},t))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:ee,fullWidth:!0,disabled:F||!G.trim(),children:F?"Adding...":"Add All Keys"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===K&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.pd,{label:"Name",value:A.name,onChange:e=>$({...A,name:e.target.value}),placeholder:g?"Ollama Local":"Production Key"}),g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>$({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:X,disabled:D||F,variant:"secondary",children:D?"Checking...":"Check"})})]}),!g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:j,type:y?"text":"password",value:A.apiKey,onChange:e=>$({...A,apiKey:e.target.value}),placeholder:w,className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:X,disabled:!A.apiKey||D||F,variant:"secondary",children:D?"Checking...":"Check"})})]}),v&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),y&&o&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[o,u&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",u.replace(/^https?:\/\//,"")]})]})]}),C&&(0,a.jsx)(d.l6,{label:"Region",value:R,onChange:e=>I(e.target.value),options:C.map(e=>({value:e.id,label:e.label}))}),i&&(0,a.jsx)(d.pd,{label:"Default Model",value:A.defaultModel,onChange:e=>$({...A,defaultModel:e.target.value}),placeholder:n?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),g&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),U&&(0,a.jsx)(d.Ex,{variant:"success"===U?"success":"failed"===U?"error":"default",children:"success"===U?"Valid":"failed"===U?"Invalid":"Could not validate"}),p&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:p}),i&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),N&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,a.jsx)(d.pd,{label:"Account ID",value:O.accountId,onChange:e=>P({...O,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,a.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),k&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Azure Endpoint",value:T.azureEndpoint,onChange:e=>E({...T,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:T.deployment,onChange:e=>E({...T,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:T.apiVersion,onChange:e=>E({...T,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:T.organization,onChange:e=>E({...T,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:A.priority,onChange:e=>$({...A,priority:e.target.value}),onBlur:e=>{let t=Number.parseInt(e.target.value,10);$(e=>({...e,priority:Number.isFinite(t)?t:1}))}}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>$({...A,proxyPoolId:e.target.value}),options:[{value:b,label:"None"},...(m||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(m||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:Y,fullWidth:!0,disabled:F||!g&&(!A.name||!A.apiKey)||i&&!A.defaultModel.trim()||k&&(!T.azureEndpoint||!T.deployment||!T.organization)||N&&!O.accountId,children:F?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function D({isOpen:e,node:t,onSave:s,onClose:i,isAnthropic:n}){let[l,o]=(0,r.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(""),[x,h]=(0,r.useState)(""),[f,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)(null);(0,r.useEffect)(()=>{t&&(o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(n?"https://api.anthropic.com/v1":"https://api.openai.com/v1")}),p(""),h(""),y(null))},[t,n]);let v=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){u(!0);try{let e={name:l.name,prefix:l.prefix,baseUrl:l.baseUrl};n||(e.apiType=l.apiType),await s(e)}finally{u(!1)}}},j=async()=>{b(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:m,type:n?"anthropic-compatible":"openai-compatible",modelId:x.trim()||void 0})}),t=await e.json();y(t.valid?"success":"failed")}catch{y("failed")}finally{b(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${n?"Anthropic":"OpenAI"} Compatible`,onClose:i,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.pd,{label:"Name",value:l.name,onChange:e=>o({...l,name:e.target.value}),placeholder:`${n?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:l.prefix,onChange:e=>o({...l,prefix:e.target.value}),placeholder:n?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!n&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:l.apiType,onChange:e=>o({...l,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>o({...l,baseUrl:e.target.value}),placeholder:n?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${n?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>p(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:j,disabled:!m||f||!l.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(d.pd,{label:"Model ID (optional)",value:x,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),g&&(0,a.jsx)(d.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function M({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:i,onClose:n}){let[l,o]=(0,r.useState)(""),[c,u]=(0,r.useState)(null),[m,p]=(0,r.useState)(""),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&(o(""),u(null),p(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},b=async()=>{let e=f(l.trim());if(e){u("testing"),p("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),a=await s.json();u(a.ok?"ok":"error"),p(a.error||"")}catch(e){u("error"),p(e.message)}}},g=async()=>{let e=f(l.trim());if(e&&!x){h(!0);try{await i(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:n,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:l,onChange:e=>{o(e.target.value),u(null),p("")},onKeyDown:e=>{"Enter"===e.key&&b()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:b,disabled:!l.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,a.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:f(l.trim())||"model-id"})]})]}),"ok"===c&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,a.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,a.jsx)("span",{children:m||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:n,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!l.trim()||x,children:x?"Adding...":"Add Model"})]})]})})}q.propTypes={isOpen:A().bool.isRequired,provider:A().string,providerName:A().string,isCompatible:A().bool,isAnthropic:A().bool,authType:A().string,authHint:A().string,website:A().string,proxyPools:A().arrayOf(A().shape({id:A().string,name:A().string})),error:A().string,onSave:A().func.isRequired,onBulkDone:A().func,onClose:A().func.isRequired},D.propTypes={isOpen:A().bool.isRequired,node:A().shape({id:A().string,name:A().string,prefix:A().string,apiType:A().string,baseUrl:A().string}),onSave:A().func.isRequired,onClose:A().func.isRequired,isAnthropic:A().bool},M.propTypes={isOpen:A().bool.isRequired,providerAlias:A().string.isRequired,providerDisplayAlias:A().string.isRequired,onSave:A().func.isRequired,onClose:A().func.isRequired};let U="/api/providers/codebuddy/discover-models",L={verified:"Verified",recognized:"Recognized",unavailable:"Unavailable",credential_rejected:"Credential rejected",error:"Inconclusive",skipped:"Skipped"},F={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",recognized:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",unavailable:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]"};function J(e,t){return e?.error||t}function K({isOpen:e,connections:t,onModelsAdded:s,onClose:i}){let n=(0,r.useMemo)(()=>t.filter(e=>"codebuddy"===e.provider&&!1!==e.isActive),[t]),[l,o]=(0,r.useState)(null),[c,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(""),[x,h]=(0,r.useState)(""),[f,b]=(0,r.useState)(()=>new Set),[g,y]=(0,r.useState)(""),[v,j]=(0,r.useState)(!1),[w,k]=(0,r.useState)(!1),[N,C]=(0,r.useState)([]),[S,A]=(0,r.useState)(()=>new Set),$=(0,r.useCallback)(async()=>{u(!0),p(""),h(""),j(!1),C([]);try{let e=await fetch(U,{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(J(t,"Could not refresh model candidates"));o(t),b(new Set((t.hidden||[]).map(e=>e.id)))}catch(e){p(e.message)}finally{u(!1)}},[]);(0,r.useEffect)(()=>{e&&(y(e=>n.some(t=>t.id===e)?e:n[0]?.id||""),$())},[n,e,$]);let T=async()=>{if(g&&0!==f.size&&!w){k(!0),p(""),h("");try{let e=await fetch(U,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:g,models:[...f]})}),t=await e.json();if(!e.ok)throw Error(J(t,"Hidden model scan failed"));C(t.results||[]),j(!1)}catch(e){p(e.message)}finally{k(!1)}}},E=(0,r.useMemo)(()=>new Map(N.map(e=>[e.id,e])),[N]),O=(0,r.useMemo)(()=>(l?.hidden||[]).filter(e=>{let t=E.get(e.id)?.status;return e.previouslyVerified||"verified"===t||"recognized"===t}),[l,E]),P=async e=>{let t=e.filter(e=>!S.has(e.id));if(!t.length)return;A(e=>new Set([...e,...t.map(e=>e.id)])),p(""),h("");let a=[];try{for(let e of t){let t=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:"cb",id:e.id,type:"llm",name:e.name})}),s=await t.json();if(!t.ok)throw Error(J(s,`Could not add ${e.id}`));a.push(e)}window.dispatchEvent(new Event("customModelChanged")),await s?.(a),h(`${a.length} model${1===a.length?"":"s"} added to CodeBuddy Global.`)}catch(e){a.length&&(window.dispatchEvent(new Event("customModelChanged")),await s?.(a)),p(e.message)}finally{A(e=>{let s=new Set(e);return t.forEach(e=>s.delete(e.id)),s})}},R=O.filter(e=>f.has(e.id));return(0,a.jsx)(d.aF,{isOpen:e,onClose:i,title:"Discover CodeBuddy Global Models",size:"full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsx)("div",{className:"overflow-hidden rounded-xl border border-cyan-500/20 bg-gradient-to-br from-cyan-500/[0.10] via-transparent to-amber-500/[0.08] p-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Live package candidates"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"Refreshing reads Tencent's current CLI manifests and does not call a model or use credits."}),l?.version&&(0,a.jsxs)("p",{className:"mt-2 font-mono text-xs text-cyan-700 dark:text-cyan-300",children:["codebuddy-code@",l.version]})]}),(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:c,onClick:$,children:"Refresh Candidates"})]})}),m&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:m}),x&&(0,a.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:x}),l?.warnings?.map(e=>(0,a.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-300",children:e},e)),l&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.official?.length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Official Global"})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.hidden?.length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Hidden candidates"})]}),(0,a.jsxs)("div",{className:"col-span-2 rounded-lg border border-border bg-surface-2 px-3 py-2 sm:col-span-1",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.hidden?.filter(e=>e.previouslyVerified).length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Previously verified"})]})]}),(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Hidden route candidates"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"From alternate official manifests; availability is not guaranteed on Global SaaS."})]}),(0,a.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>b(f.size===(l.hidden?.length||0)?new Set:new Set(l.hidden.map(e=>e.id))),children:f.size===(l.hidden?.length||0)?"Clear":"Select all"})]}),(0,a.jsx)("div",{className:"max-h-64 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:(l.hidden||[]).map(e=>{let t=E.get(e.id);return(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:f.has(e.id),onChange:()=>{var t;return t=e.id,void b(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"mt-1 accent-primary"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-sm font-medium text-text-main",children:e.name}),(0,a.jsx)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:e.id}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:e.sources.length?e.sources.join(" + "):"request history"})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[e.previouslyVerified&&(0,a.jsx)("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-[10px] font-medium text-green-700 dark:text-green-300",children:"previous success"}),t&&(0,a.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${F[t.status]||F.error}`,children:L[t.status]||t.status}),(e.previouslyVerified||["verified","recognized"].includes(t?.status))&&(0,a.jsx)("button",{type:"button",onClick:t=>{t.preventDefault(),P([e])},className:"text-xs font-semibold text-primary hover:underline",disabled:S.has(e.id),children:S.has(e.id)?"Adding...":"Add"})]})]},e.id)})})]}),(0,a.jsxs)("section",{className:"rounded-xl border border-amber-500/25 bg-amber-500/[0.07] p-4",children:[(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,a.jsx)(d.l6,{label:"CodeBuddy Global connection",value:g,onChange:e=>y(e.target.value),options:n.map(e=>({value:e.id,label:e.name||e.email||e.id})),placeholder:"No active Global connection",disabled:!n.length||w,hint:"Every probe is pinned to this connection."}),(0,a.jsxs)(d.$n,{size:"sm",icon:"radar",onClick:()=>j(!0),disabled:!g||0===f.size||w,children:["Scan Hidden Models (",f.size,")"]})]}),!n.length&&(0,a.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a CodeBuddy Global connection before scanning."}),v&&(0,a.jsxs)("div",{className:"mt-4 rounded-lg border border-amber-500/40 bg-surface px-3 py-3",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm credit-using scan"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"These are real completion probes and may consume CodeBuddy credits. Scanning uses at most 3 concurrent requests and stops scheduling if the selected credential is rejected."}),(0,a.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>j(!1),disabled:w,children:"Cancel"}),(0,a.jsx)(d.$n,{size:"sm",icon:"science",loading:w,onClick:T,children:"Start Credit Scan"})]})]})]}),N.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[N.filter(e=>"verified"===e.status).length," verified, ",N.filter(e=>"recognized"===e.status).length," recognized, ",N.filter(e=>"unavailable"===e.status).length," unavailable"]}),(0,a.jsxs)(d.$n,{size:"sm",icon:"playlist_add",onClick:()=>P(R),disabled:!R.length||S.size>0,children:["Add Selected Available (",R.length,")"]})]})]})]})})}K.propTypes={isOpen:A().bool.isRequired,connections:A().arrayOf(A().object).isRequired,onModelsAdded:A().func,onClose:A().func.isRequired};let B="/api/providers/opencode/discover-models",G={verified:"Verified (200 OK)",overloaded:"Overloaded (503)",unavailable:"Unavailable",deprecated:"Deprecated (410)",unsupported:"Protocol Unsupported",error:"Error"},H={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",overloaded:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",unavailable:"border-zinc-500/30 bg-zinc-500/[0.08] text-zinc-600 dark:text-zinc-400",deprecated:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",unsupported:"border-purple-500/30 bg-purple-500/[0.08] text-purple-700 dark:text-purple-300",error:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300"};function V({isOpen:e,onModelsAdded:t,onClose:s}){let[i,n]=(0,r.useState)([]),[l,o]=(0,r.useState)(!1),[c,u]=(0,r.useState)(""),[m,p]=(0,r.useState)(""),[x,h]=(0,r.useState)(()=>new Set),[f,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)([]),[v,j]=(0,r.useState)(()=>new Set),[w,k]=(0,r.useState)(()=>new Set),N=(0,r.useCallback)(async()=>{o(!0),u(""),p(""),y([]);try{let e=await fetch(B,{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(t?.error||"Could not fetch OpenCode models");let s=t.candidates||[];n(s),h(new Set(s.map(e=>e.id))),k(new Set(s.filter(e=>e.isConfigured).map(e=>e.id)))}catch(e){u(e.message)}finally{o(!1)}},[]);(0,r.useEffect)(()=>{e&&N()},[e,N]);let C=async()=>{if(0!==x.size&&!f){b(!0),u(""),p("");try{let e=await fetch(B,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:[...x]})}),t=await e.json();if(!e.ok)throw Error(t?.error||"Live probe failed");y(t.results||[])}catch(e){u(e.message)}finally{b(!1)}}},S=(0,r.useMemo)(()=>new Map(g.map(e=>[e.id,e])),[g]),A=async e=>{let s=e.filter(e=>!v.has(e.id)&&!w.has(e.id));if(!s.length)return;j(e=>new Set([...e,...s.map(e=>e.id)])),u(""),p("");let a=[];try{for(let e of s){let t=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:"oc",id:e.id,type:"llm",name:e.name||e.id})}),s=await t.json();if(!t.ok)throw Error(s?.error||`Could not add ${e.id}`);a.push(e)}window.dispatchEvent(new Event("customModelChanged")),k(e=>new Set([...e,...a.map(e=>e.id)])),await t?.(a),p(`${a.length} model${1===a.length?"":"s"} added to OpenCode Free!`)}catch(e){a.length&&(window.dispatchEvent(new Event("customModelChanged")),k(e=>new Set([...e,...a.map(e=>e.id)])),await t?.(a)),u(e.message)}finally{j(e=>{let t=new Set(e);return s.forEach(e=>t.delete(e.id)),t})}},$=(0,r.useMemo)(()=>i.filter(e=>{let t=S.get(e.id);return t?.ok&&!w.has(e.id)}),[i,S,w]);return(0,a.jsx)(d.aF,{isOpen:e,onClose:s,title:"Live Probe OpenCode Free Models",size:"full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsx)("div",{className:"overflow-hidden rounded-xl border border-orange-500/20 bg-gradient-to-br from-orange-500/[0.10] via-transparent to-amber-500/[0.08] p-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Upstream Catalog Live Probe"}),(0,a.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:["Pulls candidates directly from ",(0,a.jsx)("span",{className:"font-mono",children:"opencode.ai/zen/v1/models"})," and tests real-time completions to verify which free models are alive."]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:l,onClick:N,children:"Refresh Catalog"}),(0,a.jsx)(d.$n,{size:"sm",icon:"radar",loading:f,disabled:0===x.size||f,onClick:C,className:"bg-orange-600 hover:bg-orange-700 text-white",children:f?"Probing Upstream...":`Live Probe (${x.size})`})]})]})}),c&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:c}),m&&(0,a.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:m}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Total Candidates: ",(0,a.jsx)("strong",{className:"text-text-main",children:i.length})]}),g.length>0&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["• Verified Live: ",(0,a.jsx)("strong",{className:"text-green-600",children:g.filter(e=>e.ok).length})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[$.length>0&&(0,a.jsxs)("button",{type:"button",onClick:()=>A($),disabled:v.size>0,className:"text-xs font-semibold text-primary hover:underline",children:["+ Add All Verified (",$.length,")"]}),(0,a.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>h(x.size===i.length?new Set:new Set(i.map(e=>e.id))),children:x.size===i.length?"Deselect All":"Select All"})]})]}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:i.map(e=>{let t=S.get(e.id),s=w.has(e.id),r=v.has(e.id);return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,a.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3",children:[(0,a.jsx)("input",{type:"checkbox",checked:x.has(e.id),onChange:()=>{var t;return t=e.id,void h(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"accent-orange-500"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main truncate",children:e.name}),s&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-medium text-blue-600 dark:text-blue-400",children:"Active in Router"})]}),(0,a.jsxs)("span",{className:"block font-mono text-[11px] text-text-muted truncate",children:["oc/",e.id]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[t?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11px] font-medium ${H[t.status]||H.error}`,title:t.message,children:G[t.status]||t.statusText}),t.latencyMs>0&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted font-mono",children:[t.latencyMs,"ms"]})]}):(0,a.jsx)("span",{className:"text-[11px] text-text-muted italic",children:"Ready to probe"}),!s&&(0,a.jsx)("button",{type:"button",onClick:()=>A([e]),disabled:r,className:"text-xs font-semibold text-primary hover:underline disabled:opacity-50",children:r?"Adding...":"+ Add"})]})]},e.id)})}),(0,a.jsx)("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:s,children:"Close"})})]})})}function Q({showAutomation:e,showAddConnection:t,onOpenAutomation:s,onAddConnection:r}){return e||t?(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap sm:justify-end",children:[e?(0,a.jsx)(d.$n,{size:"sm",icon:"automation",variant:"secondary",onClick:s,className:"w-full sm:w-auto",children:"Open Automation"}):null,t?(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:r,className:"w-full sm:w-auto",children:"Add Connection"}):null]}):null}V.propTypes={isOpen:A().bool.isRequired,onModelsAdded:A().func,onClose:A().func.isRequired},Q.propTypes={showAutomation:A().bool.isRequired,showAddConnection:A().bool.isRequired,onOpenAutomation:A().func.isRequired,onAddConnection:A().func.isRequired};let W="kiro-bulk-import-active-job",Z="Bulk import progress expired or was cleared.",X={claude:"claudeAutoPing",codex:"codexAutoPing"};function Y(e){return["completed","cancelled","failed"].includes(e)}async function ee(e){if(!e)return null;let t=await fetch(`/api/oauth/kiro/bulk-import/${e}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function et(e="active"){let t=await fetch(`/api/oauth/kiro/bulk-import/latest?scope=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function es(e){let t=new AbortController,s=window.setTimeout(()=>t.abort(),8e3);try{let s=await fetch(e,{cache:"no-store",signal:t.signal}),a=null;try{a=await s.json()}catch{a=null}return{response:s,data:a}}finally{window.clearTimeout(s)}}function ea(){let e,t=(0,i.useParams)(),s=(0,i.useRouter)(),n=t.id,[u,b]=(0,r.useState)([]),[S,A]=(0,r.useState)(!0),[T,E]=(0,r.useState)(""),[P,R]=(0,r.useState)(null),[_,z]=(0,r.useState)([]),[U,L]=(0,r.useState)(!1),[F,J]=(0,r.useState)(!1),[B,G]=(0,r.useState)(!1),[H,ea]=(0,r.useState)(!1),[er,ei]=(0,r.useState)(!1),[en,el]=(0,r.useState)(""),[eo,ed]=(0,r.useState)(!1),[ec,eu]=(0,r.useState)(!1),[em,ep]=(0,r.useState)(!1),[ex,eh]=(0,r.useState)(null),[ef,eb]=(0,r.useState)({}),[eg,ey]=(0,r.useState)(!1),[ev,ej]=(0,r.useState)({}),[ew,ek]=(0,r.useState)({}),[eN,eC]=(0,r.useState)(()=>new Set),[eS,eA]=(0,r.useState)(!1),[e$,eT]=(0,r.useState)(!1),[eE,eO]=(0,r.useState)(!1),[eP,eR]=(0,r.useState)([]),[eI,e_]=(0,r.useState)("__none__"),[ez,eq]=(0,r.useState)(!1),[eD,eM]=(0,r.useState)(!1),[eU,eL]=(0,r.useState)(null),[eF,eJ]=(0,r.useState)(""),[eK,eB]=(0,r.useState)("auto"),[eG,eH]=(0,r.useState)({}),[eV,eQ]=(0,r.useState)([]),[eW,eZ]=(0,r.useState)([]),[eX,eY]=(0,r.useState)([]),[e0,e1]=(0,r.useState)(null),[e2,e5]=(0,r.useState)(!1),[e3,e4]=(0,r.useState)(null),[e6,e7]=(0,r.useState)(!1),[e8,e9]=(0,r.useState)(!1),[te,tt]=(0,r.useState)(null),[ts,ta]=(0,r.useState)({}),[tr,ti]=(0,r.useState)(null),tn=(0,r.useRef)(!1),tl=(0,r.useRef)(null),to=(0,r.useRef)("1"),[td,tc]=(0,r.useState)(!1),[tu,tm]=(0,r.useState)(null),[tp,tx]=(0,r.useState)(""),[th,tf]=(0,r.useState)(1),[tb,tg]=(0,r.useState)(20),[ty,tv]=(0,r.useState)("all"),[tj,tw]=(0,r.useState)(""),[tk,tN]=(0,r.useState)(1),[tC,tS]=(0,r.useState)(20),{copied:tA,copy:t$}=(0,h.C)(),tT=(0,r.useRef)(0),tE=(0,r.useRef)([]),tO=(0,r.useRef)(!0),tP=(0,r.useRef)(null),tR=(0,C.i)(e=>e.error),tI="ag_risk_confirmed",t_=(0,r.useCallback)(()=>{tm(null),tx(""),tT.current=0,window.localStorage.removeItem(W)},[]),tz=()=>{L(!0)},tq=()=>{"kiro"===n&&tu?.jobId&&Y(tu.status)&&t_(),s.push(p(n))},tD=P?{id:P.id,name:P.name||("anthropic-compatible"===P.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===P.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===P.type?"AC":"OC",apiType:P.apiType,baseUrl:P.baseUrl,type:P.type}:c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n]||c.br[n],tM=tD?.authModes||[],tU=!!c.zN[n]||!!c.IS[n]||tM.includes("oauth"),tL=!!c.fg[n]||tM.includes("apikey"),tF=!!c.IS[n]?.noAuth,tJ=(0,x.KC)(n),tK=(0,c.wG)(n),tB=(0,c.mq)(n),tG=(0,c.gb)(n),tH=tB||tG,tV=m(n),tQ=function({providerId:e,providerInfo:t,isOAuth:s,supportsApiKeyAuth:a,isCompatible:r}){if(!t||t.noAuth||t.authModes?.includes("none"))return[];let i=[];for(let n of(s&&N(i,"oauth"),(a||r||"cookie"===t.authType||!s)&&N(i,"apikey"),w[e]||[]))N(i,n);return i.map(t=>{let s=j[t];return s?{...s,...k[e]?.[t]}:null}).filter(Boolean)}({providerId:n,providerInfo:tD,isOAuth:tU,supportsApiKeyAuth:tL,isCompatible:tB||tG}),tW=function(e,{specializedChooser:t=!1}={}){return e.length?t?{type:"specialized"}:1===e.length?{type:"method",methodId:e[0].id}:{type:"chooser"}:{type:"none"}}(tQ,{specializedChooser:"kiro"===n}),tZ=tQ.map(e=>"quota-cookie"===e.id&&0===u.length?{...e,disabled:!0,description:"Add a CodeBuddy connection before attaching its quota cookie."}:e),tX=c.Q2[n]?.thinkingConfig||c.s9.extended,tY=tH?n:tK,t0=tH?P?.prefix||n:tK,t1=(0,r.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tY)}`,{cache:"no-store"}),t=await e.json();e.ok&&eY(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tY]),t2=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tY,ids:[e]})})).ok&&await t1()}catch(e){console.log("Error disabling model:",e)}},t5=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tY)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await t1()}catch(e){console.log("Error enabling model:",e)}},t3=async e=>{e.length&&e1({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{e1(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tY,ids:e})})).ok&&await t1()}catch(e){console.log("Error disabling all models:",e)}}})},t4=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tY)}`,{method:"DELETE"})).ok&&await t1()}catch(e){console.log("Error enabling all models:",e)}},t6=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&eb(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,r.useEffect)(()=>{"kilocode"===n&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eZ(e.models)}).catch(()=>{})},[n]);let t7=(0,r.useCallback)(async()=>{try{E("");let[e,t,s,a]=await Promise.allSettled([es("/api/providers"),es("/api/provider-nodes"),es("/api/proxy-pools?isActive=true"),es("/api/settings")]),r="fulfilled"===e.status?e.value.response:null,i="fulfilled"===e.status?e.value.data:{},l="fulfilled"===t.status?t.value.response:null,o="fulfilled"===t.status?t.value.data:{},d="fulfilled"===s.status?s.value.response:null,u="fulfilled"===s.status?s.value.data:{},m="fulfilled"===a.status?a.value.response:null,p=m?.ok&&a.value.data||{};if(r?.ok){let e=(i.connections||[]).filter(e=>e.provider===n);tE.current=e,b(e)}else E("Connections could not be loaded.");d?.ok&&z(u.proxyPools||[]);let x=(p.providerStrategies||{})[n]||{};eL(x.fallbackStrategy||null),eJ(null!=x.stickyRoundRobinLimit?String(x.stickyRoundRobinLimit):"1"),to.current=null!=x.stickyRoundRobinLimit?String(x.stickyRoundRobinLimit):"1";let h=(p.providerThinking||{})[n]||{};eB(h.mode||"auto");let f=X[n];if(eH(f&&p?.[f]?.connections||{}),l?.ok){let e=(o.nodes||[]).find(e=>e.id===n)||null;if(!e&&((0,c.mq)(n)||(0,c.gb)(n)))for(let t=0;t<3;t+=1){if(await new Promise(e=>setTimeout(e,150)),!tO.current)return;let{response:t,data:s}=await es("/api/provider-nodes");if(!tO.current)return;if(t.ok&&(e=(s.nodes||[]).find(e=>e.id===n)||null))break}R(e)}}catch(e){console.log("Error fetching connections:",e),tO.current&&E("Connections could not be loaded.")}finally{tO.current&&A(!1)}},[n]),t8=async e=>{try{let t=await fetch(`/api/provider-nodes/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(R(s.node),await t7(),eu(!1))}catch(e){console.log("Error updating provider node:",e)}},t9=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},r={};e&&(r.fallbackStrategy=e),"round-robin"===e&&""!==t&&(r.stickyRoundRobinLimit=Number(t)||3);let i={...a};0===Object.keys(r).length?delete i[n]:i[n]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})})}catch(e){console.log("Error saving provider strategy:",e)}},se=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[n]={mode:e}:delete s[n],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},st=async(e,t)=>{let s=X[n];if(!s)return;let a={...eG,[e]:t};eH(a);try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[s]||{},connections:a};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:t})})).ok)throw Error("Failed to save auto-ping setting")}catch(e){eH(eG),console.log("Error saving auto-ping config:",e)}};(0,r.useEffect)(()=>{t7(),t6(),t1()},[t7,t6,t1]),(0,r.useEffect)(()=>(tO.current=!0,()=>{tO.current=!1,null!==tP.current&&window.cancelAnimationFrame(tP.current)}),[]),(0,r.useEffect)(()=>{e1(null),ej({}),ek({}),eC(new Set),eQ([]),ta({}),ti(null),tt(null),e7(!1),e9(!1),tn.current=!0,tx("")},[n]),(0,r.useEffect)(()=>{tf(1),tN(1),tv("all"),tw("")},[n]),(0,r.useEffect)(()=>{tf(1)},[ty,tb,tj]),(0,r.useEffect)(()=>{ey(!1)},[n]),(0,r.useEffect)(()=>{tN(1)},[tC,eX.length,tJ.length,eW.length]),(0,r.useEffect)(()=>{if("kiro"!==n)return;let e=window.localStorage.getItem(W),t=!1;return(async()=>{try{if(tx(""),tu?.jobId)return;let a=await et();if(!t&&a.res.ok&&a.data?.job){tm(a.data.job),tT.current=a.data.job.summary?.success||0,window.localStorage.setItem(W,a.data.job.jobId);return}if(e){var s;let a=await ee(e);if(!t&&a?.res.ok&&a.data?.job&&(s=a.data.job.status,["queued","running","needs_manual"].includes(s))){tm(a.data.job),tT.current=a.data.job.summary?.success||0;return}t_(),tx(Z)}}catch{t||tx(Z)}})(),()=>{t=!0}},[t_,tu?.jobId,n]),(0,r.useEffect)(()=>{if(!("kiro"!==n||!tu?.jobId||Y(tu.status)))return(0,v.M)(async e=>{let t=await ee(tu.jobId);if(!e()){if(t?.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>tT.current&&(tT.current=s,await t7(),e()))return;tx(""),tm(t.data.job);return}if(t?.res.status===404){let t=await et();if(e())return;if(t.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>tT.current&&(tT.current=s,await t7(),e()))return;tx(""),tm(t.data.job),window.localStorage.setItem(W,t.data.job.jobId);return}t_(),tx(Z)}}},2e3)},[t_,t7,tu?.jobId,tu?.status,n]),(0,r.useEffect)(()=>{let e=(c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n])?.modelsFetcher;e&&g(e).then(eQ)},[n]);let ss=async(e,t,s=tK)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await t6();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},sa=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await t6()}catch(e){console.log("Error deleting alias:",e)}},sr=async()=>{if(td)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,f.Tl)("Please add an active Qoder connection first"));tc(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,f.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,f.Tl)("No models returned"));let r={...ef},i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,""),a=`${tY}/${s}`;!Object.values(r).includes(a)&&(r[s]||(await ss(s,s,tY),r[s]=a,i+=1))}0===i?alert((0,f.Tl)("All models already exist, no new models added")):alert((0,f.Tl)("Successfully added")+` ${i} `+(0,f.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,f.Tl)("Error fetching models")+": "+e.message)}finally{tc(!1)}},si=async()=>{let e=[...u];if(e6||0===e.length)return;let t=Object.fromEntries(e.map(e=>[e.id,{state:"queued",error:null}]));tn.current=!1,e7(!0),e9(!1),tt(null),ta(t),ti({total:e.length,completed:0,passed:0,failed:0,stopped:!1});let s=0,a=0;try{for(let t=0;t<e.length;t+=1){if(tn.current){ti({total:e.length,completed:t,passed:s,failed:a,stopped:!0});break}let r=e[t];if(!tE.current.some(e=>e.id===r.id)){ta(e=>({...e,[r.id]:{state:"skipped",error:null}})),ti({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1});continue}tt(r.id),ta(e=>({...e,[r.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${r.id}/test`,{method:"POST"}),t=await e.json(),i=!!t.valid;i?s+=1:a+=1,ta(e=>({...e,[r.id]:{state:i?"success":"failed",error:i?null:t.error||null}}))}catch(e){a+=1,ta(t=>({...t,[r.id]:{state:"failed",error:e.message||"Test failed"}}))}ti({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1}),t<e.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{tt(null),e7(!1),e9(!1),tn.current=!1}},sn=async e=>{e1({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{e1(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&b(u.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},sl=()=>{t7(),L(!1)},so=(0,r.useCallback)(e=>{(tm(e),tx(""),e?.jobId)?(window.localStorage.setItem(W,e.jobId),tT.current=Math.max(tT.current,e.summary?.success||0)):t_()},[t_]),sd=async e=>{el("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await t7(),ei(!1);return}el(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),el("Failed to save connection")}},sc=async e=>{try{(await fetch(`/api/providers/${ex.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await t7(),ed(!1))}catch(e){console.log("Error updating connection:",e)}},su=async(e,t)=>{try{let s=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(s.ok){let a=await s.json().catch(()=>null);b(s=>s.map(s=>s.id===e?{...s,isActive:t,...a?.connection||{}}:s))}}catch(e){console.log("Error updating connection status:",e)}},sm=async(e,t)=>{let s=[...u];[s[e],s[t]]=[s[t],s[e]],b(s);try{let[a,r]=await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);a.ok&&r.ok||(console.log("Priority swap rejected:",a.status,r.status),await t7())}catch(e){console.log("Error swapping priority:",e),await t7()}},sp=(0,r.useMemo)(()=>{let e=tj.trim().toLowerCase();return u.filter(t=>!!(0,y.i2)(t,ty)&&(!e||[t.name,t.email,t.id,t.account,t.username,t.label,t.authType,t.notes,t.proxyPoolId].filter(Boolean).join(" ").toLowerCase().includes(e)))},[u,ty,tj]),sx=(0,r.useMemo)(()=>y.gJ.reduce((e,t)=>(e[t.id]="all"===t.id?u.length:u.filter(e=>(0,y.i2)(e,t.id)).length,e),{}),[u]),sh=eP.filter(e=>u.some(t=>t.id===e)),sf=u.filter(e=>sh.includes(e.id)),sb="codebuddy"===n?(sf.length>0?sf:u).map(e=>e.id):[],sg=sp.length>0&&sp.every(e=>sh.includes(e.id)),sy=e=>{switch(e){case"oauth":if("antigravity"===n&&"true"!==window.localStorage.getItem(tI)){e4(e),e5(!0);return}tz();return;case"apikey":el(""),ei(!0);return;case"cookie":J(!0);return;case"quota-cookie":u.length>1&&0===sf.length?alert("Select the CodeBuddy connection(s) that should use this quota cookie first."):G(!0);return;default:tR(`Unsupported connection method: ${e}`,"Add Connection")}},sv=e=>{null!==tP.current&&window.cancelAnimationFrame(tP.current),tP.current=window.requestAnimationFrame(()=>{tP.current=null,sy(e)})},sj=()=>{"specialized"===tW.type?tz():"method"===tW.type?sy(tW.methodId):"chooser"===tW.type&&ea(!0)},sw=(()=>{if(0===sf.length)return"";let e=new Set(sf.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=_.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),sk=()=>{ez||ep(!1)},sN=async e=>{eq(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await t7(),ep(!1)}finally{eq(!1)}},sC=e=>sN(sf.map(t=>({connectionId:t.id,proxyPoolId:e}))),sS=e=>{let t="gsuite"===e?"GSuite (non-Gmail)":"Gmail (@gmail.com)";e1({title:`Delete ${t}`,message:`Delete ALL ${t} accounts for this provider? This cannot be undone.`,onConfirm:async()=>{e1(null);try{(await fetch("/api/providers/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:tD?.id||n,emailFilter:e})})).ok&&(eR([]),await t7())}catch(e){console.error("bulk delete error:",e)}}})},sA=Math.max(1,Math.ceil(sp.length/tb)),s$=Math.min(th,sA),sT=sp.slice((s$-1)*tb,s$*tb),sE=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:sT.map((e,t)=>{let s,r=u.findIndex(t=>t.id===e.id);return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("label",{className:"flex w-8 shrink-0 items-center justify-center",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,sh.includes(s)),onChange:()=>{var t;return t=e.id,void eR(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"size-4 rounded border-black/20 dark:border-white/20","aria-label":`Select ${e.name||e.email||e.id}`})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(I,{connection:e,proxyPools:_,isOAuth:tU,isFirst:0===r,isLast:r===u.length-1,onMoveUp:()=>sm(r,r-1),onMoveDown:()=>sm(r,r+1),onToggleActive:t=>su(e.id,t),autoPingEnabled:!0===eG[e.id],onToggleAutoPing:X[n]&&"oauth"===e.authType?t=>st(e.id,t):void 0,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&b(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{eh(e),ed(!0)},onDelete:()=>sn(e.id),oneByOneStatus:ts[e.id]||null})})]},e.id)})}),sO=_.filter(e=>!0===e.isActive),sP=(0,a.jsx)(d.aF,{isOpen:em,onClose:sk,title:`Apply Proxy (${sf.length} selected)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=_.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):sN(sf.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ez||0===sO.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>sC(null),disabled:ez,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),_.map(e=>(0,a.jsxs)("button",{onClick:()=>sC(e.id),disabled:ez||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),ez&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:sk,variant:"ghost",fullWidth:!0,disabled:ez,children:"Cancel"})]})}),sR=async e=>{eC(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tY}/${e}`})}),s=await t.json();ej(t=>({...t,[e]:s.ok?"ok":"error"})),ek(t=>({...t,[e]:s.ok?"":s.error||"Model not reachable"}))}catch{ej(t=>({...t,[e]:"error"})),ek(t=>({...t,[e]:"Network error"}))}finally{eC(t=>{let s=new Set(t);return s.delete(e),s})}};return S?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):tD?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(l(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${tD.color}15`},children:eg?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:tD.color},children:tD.textIcon||tD.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.A,{src:tB&&tD.apiType?"responses"===tD.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tG?"/providers/anthropic-m.png":`/providers/${tD.id}.png`,alt:tD.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>ey(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:tD.name}),(tD.notice?.apiKeyUrl||tD.notice?.signupUrl||tD.website)&&(0,a.jsxs)("a",{href:tD.notice?.apiKeyUrl||tD.notice?.signupUrl||tD.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),tD.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),tD.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:tD.deprecationNotice})]}),tD.notice?.text&&!tD.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:tD.notice.text}),tD.notice.apiKeyUrl&&(0,a.jsx)("a",{href:tD.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),tH&&P&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:tG?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tG?"Messages API":"responses"===P.apiType?"Responses API":"Chat Completions"," \xb7 ",(P.baseUrl||"").replace(/\/$/,""),"/",tG?"messages":"responses"===P.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{el(""),ei(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>eu(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{e1({title:"Delete Compatible Node",message:`Delete this ${tG?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{e1(null);try{(await fetch(`/api/provider-nodes/${n}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tF?(0,a.jsx)(d.gw,{providerId:n}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[u.length>0&&_.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{if(0===sf.length)return;let e=[...new Set(sf.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"))];e_(1===e.length?e[0]:"__none__"),ep(!0)},disabled:0===sf.length,children:"Apply Proxy"}),u.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:si,disabled:e6,children:e6?"Testing Connection One-by-One...":"Test Connection One-by-One"}),e6&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{e6&&(tn.current=!0,e9(!0))},disabled:e8,children:e8?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Thinking"}),(0,a.jsx)("select",{value:eK,onChange:e=>{var t;eB(t=e.target.value),se(t)},className:"text-xs px-2 py-1 border border-border rounded-md bg-background focus:outline-none focus:border-primary",title:"Forces reasoning_effort on requests; model chips copy as alias/model(level)",children:(tX?.options||c.mt).map(e=>(0,a.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===eU,onChange:e=>{let t=e?"round-robin":null,s=e?eF||"1":eF;e&&!eF&&eJ("1"),to.current=s,tl.current&&(clearTimeout(tl.current),tl.current=null),eL(t),t9(t,s)}}),"round-robin"===eU&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:eF,onChange:e=>{var t;eJ(t=e.target.value),to.current=t,tl.current&&clearTimeout(tl.current),tl.current=setTimeout(()=>{t9("round-robin",to.current)},500)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),u.length>0&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-black/5 bg-black/[0.02] p-3 dark:border-white/5 dark:bg-white/[0.02]",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:sg,onChange:()=>{sg?eR(e=>e.filter(e=>!sp.some(t=>t.id===e))):eR(e=>Array.from(new Set([...e,...sp.map(e=>e.id)])))},className:"size-4 rounded border-black/20 dark:border-white/20"}),sg?"Unselect visible":"Select visible"]}),(0,a.jsxs)(d.Ex,{variant:"default",children:[sp.length," visible"]}),sf.length>0&&(0,a.jsxs)(d.Ex,{variant:"default",children:[sf.length," selected"]}),sw&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:sw}),sf.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>{eR([]),e_("__none__")},children:"Clear"}),sf.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:()=>{0!==sf.length&&e1({title:"Delete Selected Connections",message:`Delete ${sf.length} selected connection(s)? This permanently removes the selected accounts.`,onConfirm:async()=>{e1(null);let e=[],t=0;for(let s of sf)try{(await fetch(`/api/providers/${s.id}`,{method:"DELETE"})).ok?e.push(s.id):t+=1}catch(e){console.log("Error deleting selected connection:",e),t+=1}eR(t=>t.filter(t=>!e.includes(t))),t>0&&alert(`Deleted ${e.length} connection(s); ${t} failed.`),await t7()}})},children:["Delete Selected (",sf.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"domain",onClick:()=>sS("gsuite"),children:"Delete GSuite"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"mail",onClick:()=>sS("gmail"),children:"Delete Gmail"})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:y.gJ.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>tv(e.id),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${ty===e.id?"border-primary/50 bg-primary/10 text-primary":"border-border text-text-muted hover:border-primary/30 hover:text-text-main"}`,children:[e.label,(0,a.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:sx[e.id]||0})]},e.id))}),u.length>=20&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,a.jsx)("input",{type:"search",value:tj,onChange:e=>tw(e.target.value),placeholder:`Search ${u.length} connections (email, name, id)…`,className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-xs text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),T?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:T})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{A(!0),t7()},children:"Retry"})]}):0===u.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:tU?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tQ.length>1?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add Connection lists every available authentication method."}):null]})]}),(0,a.jsx)(Q,{showAutomation:tV,showAddConnection:"none"!==tW.type,onOpenAutomation:tq,onAddConnection:sj})]}),"kiro"===n&&tu?.jobId&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tu.status," | Success: ",tu.summary?.success||0," | Running: ",tu.summary?.running||0," | Queued: ",tu.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),Y(tu.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:t_,children:"Clear"})]})]}),"kiro"===n&&!tu?.jobId&&tp&&(0,a.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tp})]}):(0,a.jsxs)(a.Fragment,{children:[tr&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",tr.total]}),(0,a.jsxs)("span",{children:["Completed: ",tr.completed]}),(0,a.jsxs)("span",{children:["Passed: ",tr.passed]}),(0,a.jsxs)("span",{children:["Failed: ",tr.failed]}),tr.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),e6&&te&&(0,a.jsxs)("span",{children:["Running: ",u.find(e=>e.id===te)?.name||te]})]})}),"kiro"===n&&tu?.jobId&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tu.status," | Success: ",tu.summary?.success||0," | Running: ",tu.summary?.running||0," | Queued: ",tu.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),Y(tu.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:t_,children:"Clear"})]})]}),"kiro"===n&&!tu?.jobId&&tp&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tp}),sE,"kiro"===n&&sA>1&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Page ",s$," of ",sA," • Showing ",(s$-1)*tb+1,"-",Math.min(s$*tb,sp.length)," of ",sp.length," connections"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:s$<=1,onClick:()=>tf(e=>Math.max(1,e-1)),children:"Previous"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:s$>=sA,onClick:()=>tf(e=>Math.min(sA,e+1)),children:"Next"})]})]}),"kiro"!==n&&sp.length>0&&(0,a.jsx)(d.dK,{currentPage:s$,pageSize:tb,totalItems:sp.length,onPageChange:tf,onPageSizeChange:e=>{tg(e),tf(1)},className:"mt-2"}),u.length>0&&0===sp.length&&(0,a.jsx)("div",{className:"py-8 text-center text-sm text-text-muted",children:"No connections match this status filter."}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(Q,{showAutomation:tV,showAddConnection:"none"!==tW.type,onOpenAutomation:tq,onAddConnection:sj})})]})]}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!tH&&(e=[...tJ,...eW.filter(e=>!tJ.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!eX.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eX.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:t4,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>t3(e),children:"Disable All"})]}))]}),Object.values(ew).some(Boolean)&&(0,a.jsx)("div",{className:"mb-3 flex flex-col gap-1",children:Object.entries(ew).filter(([,e])=>!!e).map(([e,t])=>(0,a.jsxs)("p",{className:"text-xs text-red-500 break-words",children:[e,": ",t]},e))}),(()=>{let e,t,s;if(tH)return(0,a.jsx)(O,{providerStorageAlias:tY,providerDisplayAlias:t0,modelAliases:ef,copied:tA,onCopy:t$,onSetAlias:ss,onDeleteAlias:sa,onAliasesChanged:t6,connections:u,isAnthropic:tG});let r=[...tJ,...eW.filter(e=>!tJ.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),i=new Set(eX),l=r.filter(e=>!i.has(e.id)),o=r.filter(e=>i.has(e.id)),c=Object.entries(ef).filter(([e,t])=>{let s=`${tY}/`;if(!t.startsWith(s))return!1;let a=t.slice(s.length);return tD.passthroughModels?!tJ.some(e=>e.id===a):!tJ.some(e=>e.id===a)&&e===a}).map(([e,t])=>({id:t.slice(`${tY}/`.length),alias:e,fullModel:t})),m=Math.min(tk,Math.max(1,Math.ceil(l.length/tC))),p=l.slice((m-1)*tC,m*tC);return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[c.map(e=>(0,a.jsx)($,{model:{id:e.id},fullModel:`${t0}/${e.id}`,alias:e.alias,copied:tA,onCopy:t$,onSetAlias:()=>{},onDeleteAlias:()=>sa(e.alias),testStatus:ev[e.id],onTest:u.length>0||tF?()=>sR(e.id):void 0,isTesting:eN.has(e.id),isCustom:!0,isFree:!1,thinkingSuffix:eK&&"auto"!==eK&&"off"!==eK&&"none"!==eK?eK:null},e.id)),p.map(e=>{let t=`${tY}/${e.id}`,s=`${n}/${e.id}`,r=Object.entries(ef).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)($,{model:e,fullModel:`${t0}/${e.id}`,alias:r,copied:tA,onCopy:t$,onSetAlias:t=>ss(e.id,t,tY),onDeleteAlias:()=>sa(r),testStatus:ev[e.id],onTest:u.length>0||tF?()=>sR(e.id):void 0,isTesting:eN.has(e.id),isFree:e.isFree,onDisable:()=>t2(e.id),thinkingSuffix:eK&&"auto"!==eK&&"off"!==eK&&"none"!==eK?eK:null},e.id)}),l.length>tC&&(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(d.dK,{currentPage:m,pageSize:tC,totalItems:l.length,onPageChange:tN,onPageSizeChange:e=>{tS(e),tN(1)}})}),(0,a.jsxs)("button",{onClick:()=>eA(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"codebuddy"===n&&(0,a.jsxs)("button",{onClick:()=>eT(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-cyan-500/50 px-3 py-2 text-xs text-cyan-700 transition-colors hover:border-cyan-500 hover:bg-cyan-500/[0.07] dark:text-cyan-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Discover Models"]}),"opencode"===n&&(0,a.jsxs)("button",{onClick:()=>eO(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-orange-500/50 px-3 py-2 text-xs text-orange-700 transition-colors hover:border-orange-500 hover:bg-orange-500/[0.07] dark:text-orange-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"qoder"===n&&u.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:sr,disabled:td,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:td?{animation:"spin 1s linear infinite"}:void 0,children:td?"progress_activity":"download"}),td?(0,f.Tl)("Fetching..."):(0,f.Tl)("Fetch Qoder Models")]}),eV.length>0&&(e=new Set(Object.values(ef)),t=new Set(tJ.map(e=>e.id)),0===(s=eV.filter(s=>!e.has(`${tY}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await ss(e.id,t,tY)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)("button",{onClick:()=>t5(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),em&&sP,H&&(0,a.jsx)(d.mz,{isOpen:!0,providerName:tD.name,methods:tZ,onSelect:e=>{ea(!1),sv(e)},onClose:()=>ea(!1)}),U&&("kiro"===n?(0,a.jsx)(d.Mh,{isOpen:!0,providerInfo:tD,onSuccess:sl,onRefresh:t7,initialBulkJobId:tu?.jobId||null,onBulkJobChange:so,onClose:()=>L(!1)}):"cursor"===n?(0,a.jsx)(d.G9,{isOpen:!0,onSuccess:sl,onClose:()=>L(!1)}):"gitlab"===n?(0,a.jsx)(d.vj,{isOpen:!0,providerInfo:tD,onSuccess:sl,onClose:()=>L(!1)}):(0,a.jsx)(d.LF,{isOpen:!0,provider:n,providerInfo:tD,onSuccess:sl,onClose:()=>L(!1)})),"iflow"===n&&F&&(0,a.jsx)(d.vE,{isOpen:!0,onSuccess:()=>{t7(),J(!1)},onClose:()=>J(!1)}),"codebuddy"===n&&B&&(0,a.jsx)(d.xl,{isOpen:!0,connectionIds:sb,onSuccess:()=>{t7(),G(!1)},onClose:()=>G(!1)}),er&&(0,a.jsx)(q,{isOpen:!0,provider:n,providerName:tD.name,isCompatible:tH,isAnthropic:tG,authType:tD?.authType,authHint:tD?.authHint,website:tD?.website,proxyPools:_,error:en,onSave:sd,onBulkDone:t7,onClose:()=>{el(""),ei(!1)}}),eo&&ex&&(0,a.jsx)(d.wI,{isOpen:!0,connection:ex,proxyPools:_,onSave:sc,onClose:()=>ed(!1)}),tH&&ec&&(0,a.jsx)(D,{isOpen:!0,node:P,onSave:t8,onClose:()=>eu(!1),isAnthropic:tG}),!tH&&eS&&(0,a.jsx)(M,{isOpen:!0,providerAlias:tY,providerDisplayAlias:t0,onSave:async e=>{let t=tD?.passthroughModels?e.split("/").pop():e;await ss(e,t,tY),eA(!1)},onClose:()=>eA(!1)}),"codebuddy"===n&&e$&&(0,a.jsx)(K,{isOpen:!0,connections:u,onModelsAdded:async e=>{for(let t of e)await ss(t.id,t.id,"cb");await t6()},onClose:()=>eT(!1)}),"opencode"===n&&eE&&(0,a.jsx)(V,{isOpen:!0,onModelsAdded:async e=>{for(let t of e)await ss(t.id,t.id,"oc");await t6()},onClose:()=>eO(!1)}),e2&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>e5(!1),onConfirm:()=>{window.localStorage.setItem(tI,"true"),e5(!1),e4(null),sv(e3||"oauth")},title:"Risk Notice",message:tD?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),e0&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>{eD||e1(null)},onConfirm:async()=>{if(eD)return;let e=e0?.onConfirm;if(e){eM(!0);try{await e()}finally{eM(!1)}}},title:e0?.title||"Confirm",message:e0?.message,variant:"danger",loading:eD})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(l(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=42911)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{20490:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>w});var r=s(95155),a=s(12115),i=s(14051),l=s.n(i),n=s(35497),o=s(57250),d=s(90620),c=s(52679),m=s(98500),p=s.n(m),u=s(28915),x=s(65921),h=s(38003);let f={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function g(){let[e,t]=(0,a.useState)(null),[s,i]=(0,a.useState)(!0),[l,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(null),m=(0,a.useRef)(null),p=(0,x.i)(),u=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{i(!1)}},[]);(0,a.useEffect)(()=>{u();let e=setInterval(u,3e4);return()=>clearInterval(e)},[u]),(0,a.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&o(!1)};return l&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l]);let h=async(e,t)=>{c(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(p.success(`Cooldown cleared for ${t}`),await u()):p.error("Failed to clear cooldown")}catch{p.error("Failed to clear cooldown")}finally{c(null)}};if(s)return null;let g=e?.models||[],b=e?.unavailableCount||g.filter(e=>"available"!==e.status).length,v=0===b,y={};return g.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";y[t]||(y[t]=[]),y[t].push(e)}),(0,r.jsxs)("div",{className:"relative",ref:m,children:[(0,r.jsxs)("button",{onClick:()=>o(!l),className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${v?"bg-emerald-500/10 border-emerald-500/20 text-emerald-500 hover:bg-emerald-500/15":"bg-amber-500/10 border-amber-500/20 text-amber-500 hover:bg-amber-500/15"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:v?"verified":"warning"}),v?"All models operational":`${b} model${1!==b?"s":""} with issues`]}),l&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:v?"#22c55e":"#f59e0b"},children:v?"verified":"warning"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,r.jsx)("button",{onClick:u,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,r.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:v?(0,r.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,r.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(y).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,r.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=f[e.status]||f.unknown,s=d===`${e.provider}:${e.model}`;return(0,r.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,r.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:()=>h(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})]})}var b=s(66430),v=s(40728);function y(e,t,s){if(e>0)return(0,r.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[11px] font-medium text-success",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-success"}),e," connected"]});if(t>0){let e=s?`${t} Error (${s})`:`${t} Error`;return(0,r.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[11px] font-medium text-error",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-error"}),e]})}return(0,r.jsx)("span",{className:"text-[11px] text-text-muted",children:"No connections"})}let j=[{value:"all",label:"All"},{value:"connected",label:"Connected"},{value:"ready",label:"Ready"},{value:"setup",label:"Needs setup"}];async function N(e){let t=new AbortController,s=window.setTimeout(()=>t.abort(),8e3);try{let s=await fetch(e,{cache:"no-store",signal:t.signal}),r=null;try{r=await s.json()}catch{r=null}return{response:s,data:r}}finally{window.clearTimeout(s)}}function w(){let e,t,[s,i]=(0,a.useState)([]),[l,o]=(0,a.useState)([]),[m,p]=(0,a.useState)(!0),[f,y]=(0,a.useState)(""),[w,A]=(0,a.useState)(1),[E,I]=(0,a.useState)(20),[P,O]=(0,a.useState)(!1),[_,U]=(0,a.useState)(!1),[q,z]=(0,a.useState)(()=>new Set),[M,D]=(0,a.useState)(null),[F,L]=(0,a.useState)("all"),[J,H]=(0,a.useState)({custom:!1,oauth:!1,free:!0,apikey:!0}),K=(0,x.i)(),W=(0,h.C)(e=>e.query),B=(0,h.C)(e=>e.setQuery),Q=(0,h.C)(e=>e.unregister);(0,a.useEffect)(()=>()=>Q(),[Q]),(0,a.useEffect)(()=>{A(1)},[W,E,F]);let G=e=>!W.trim()||e.toLowerCase().includes(W.trim().toLowerCase());(0,a.useEffect)(()=>{(async()=>{try{y("");let[e,t]=await Promise.allSettled([(0,b.b7)("providers:list",v.t7),N("/api/provider-nodes")]);"fulfilled"===e.status?i(e.value?.connections||[]):(i([]),y("Provider connection stats could not be loaded. The provider catalog is still available.")),"fulfilled"===t.status&&t.value.response.ok?o(t.value.data?.nodes||[]):(o([]),y(e=>e||"Custom provider data could not be loaded. The provider catalog is still available."))}catch(e){console.log("Error fetching data:",e),y("Provider data could not be loaded. The provider catalog is still available.")}finally{p(!1)}})()},[]);let V=(0,a.useMemo)(()=>{let e=new Map;for(let t of s){let s=t.provider||t.id;e.has(s)||e.set(s,[]),e.get(s).push(t)}return e},[s]),X=s.length,Z=(0,a.useMemo)(()=>s.filter(e=>!1!==e.isActive).length,[s]),Y=V.size,ee=Math.max(0,X-Z),et=X>0?Math.round(Z/X*100):0,es=(e,t)=>{let s=Array.isArray(t)?t:[t],r=(V.get(e)||[]).filter(e=>s.includes(e.authType)),a=r.filter(e=>{let t,s=(t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now()),"unavailable"!==e.testStatus||t?e.testStatus:"active");return"error"===s||"expired"===s||"unavailable"===s}),i=r.length>0?r.length:0,l=r.length>0?0:a.length,n=r.length,o=n>0&&r.every(e=>!1===e.isActive),d=a.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:i,error:l,total:n,errorCode:d?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let r=(0,u.E2)(e.lastError);if("401"===r||"403"===r)return"AUTH";if(r&&"ERR"!==r)return r;let a=(e.lastError||"").toLowerCase();return a.includes("runtime")||a.includes("not runnable")||a.includes("not installed")?"RUNTIME":a.includes("invalid api key")||a.includes("token invalid")||a.includes("revoked")||a.includes("unauthorized")?"AUTH":"ERR"}(d):null,errorTime:d?.lastErrorAt?(0,u.gs)(d.lastErrorAt):null,allDisabled:o}},er=(e,t,s)=>{if("all"===F)return!0;let r=es(e,s);return"connected"===F?r.connected>0:"ready"===F?0===r.connected&&!0===t.noAuth:0===r.connected&&!0!==t.noAuth},ea=e=>{H(t=>({...t,[e]:!t[e]}))},ei=async(e,t,r)=>{let a=s.filter(s=>s.provider===e&&s.authType===t);i(s=>s.map(s=>s.provider===e&&s.authType===t?{...s,isActive:r}:s));let l=(await Promise.allSettled(a.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e})))).filter(e=>"rejected"===e.status).length;l>0?(i(s=>s.map(s=>s.provider===e&&s.authType===t?{...s,isActive:!r}:s)),K.error(`Failed to update ${l} connection${l>1?"s":""} — reverted`)):(0,b.au)("providers:list")},el=async(e,t=null)=>{let s="provider"===e?t:e;if(s){z(e=>new Set(e).add(s)),D(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),r=await s.json();if(D(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?K.success(`All ${s} tests passed`):K.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){D({error:"Test request failed"}),K.error("Provider test failed")}finally{z(e=>{let t=new Set(e);return t.delete(s),t})}}},en=l.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})).filter(e=>G(e.name)&&er(e.id,e,"apikey")),eo=l.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>G(e.name)&&er(e.id,e,"apikey")),ed=Object.entries(d.zN).filter(([e,t])=>{let s=t?.authModes?.includes("apikey")?["oauth","apikey"]:"oauth";return!t.hidden&&G(t.name)&&er(e,t,s)}),ec=Object.entries(c.IS).filter(([e,t])=>{let s=Array.isArray(t?.authModes)&&t.authModes.includes("apikey");return!t.hidden&&G(t.name)&&er(e,t,s?["oauth","apikey"]:"oauth")}),em=Object.entries(c.nJ).filter(([e,t])=>!t.hidden&&G(t.name)&&er(e,t,"apikey")),ep=(e=Object.entries(d.fg).filter(([e,t])=>!t.hidden&&(t.serviceKinds??["llm"]).includes("llm")&&G(t.name)&&er(e,t,"apikey")),t="apikey",[...e].sort(([e,s],[r,a])=>{let i=es(e,t),l=es(r,t),n=+(i.connected>0),o=+(l.connected>0);return n!==o?o-n:(s.name||"").localeCompare(a.name||"")})),eu=Math.min(w,Math.max(1,Math.ceil(ep.length/E))),ex=ep.slice((eu-1)*E,eu*E);if(m)return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(n.Qv,{}),(0,r.jsx)(n.Qv,{})]});let eh=ed.length>0||ec.length>0||em.length>0||ep.length>0||en.length>0||eo.length>0,ef=en.length>0||eo.length>0||"all"===F&&!W.trim();return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[X>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border bg-surface/80 shadow-sm",children:(0,r.jsxs)("div",{className:"grid grid-cols-3 divide-x divide-y divide-border-subtle sm:grid-cols-4 sm:divide-y-0",children:[(0,r.jsxs)("div",{className:"col-span-3 flex items-center gap-3 px-4 py-3 sm:col-span-1",children:[(0,r.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/[0.08] text-primary",children:(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined",style:{fontSize:18},children:"dns"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Connection health"}),(0,r.jsxs)("p",{className:"mt-0.5 text-sm font-semibold tabular-nums text-text-main",children:[et,"% active"]})]})]}),(0,r.jsxs)("div",{className:"px-4 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Connections"}),(0,r.jsx)("p",{className:"mt-0.5 text-lg font-semibold tabular-nums text-text-main",children:X})]}),(0,r.jsxs)("div",{className:"px-4 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Active"}),(0,r.jsxs)("div",{className:"mt-0.5 flex items-baseline gap-2",children:[(0,r.jsx)("p",{className:"text-lg font-semibold tabular-nums text-success",children:Z}),ee>0&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[ee," paused"]})]})]}),(0,r.jsxs)("div",{className:"px-4 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Providers"}),(0,r.jsx)("p",{className:"mt-0.5 text-lg font-semibold tabular-nums text-info",children:Y})]})]})}),f&&(0,r.jsx)(n.Gi,{tone:"warning",title:"Some provider status is unavailable",children:f}),(0,r.jsxs)(n.i5,{label:"Provider search and filters",children:[(0,r.jsx)(n.pd,{"aria-label":"Search providers",icon:"search",placeholder:"Search providers...",value:W,onChange:e=>B(e.target.value),className:"w-full sm:min-w-56 sm:max-w-72",inputClassName:"h-11 sm:h-9"}),(0,r.jsx)("div",{className:"flex w-full min-w-0 gap-1 overflow-x-auto rounded-xl bg-bg/70 p-1 [scrollbar-width:none] sm:w-auto [&::-webkit-scrollbar]:hidden",children:j.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>{L(e.value),A(1),H({custom:!1,oauth:!1,free:!1,apikey:!1})},"aria-pressed":F===e.value,className:`flex h-11 flex-1 items-center justify-center whitespace-nowrap rounded-lg px-3 text-xs font-medium transition-colors sm:h-8 sm:flex-none sm:px-3 ${F===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-black/5 hover:text-text-main dark:hover:bg-white/5"}`,children:e.label},e.value))})]}),!eh&&(0,r.jsx)(n.pp,{icon:"search_off",title:W.trim()?"No providers match your search":"No providers match this filter",description:"Adjust the search or status filter to see more providers.",action:(0,r.jsx)(n.$n,{variant:"secondary",onClick:()=>{B(""),L("all")},children:"Clear filters"})}),ef&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(k,{icon:"extension",title:"Custom Providers",description:"OpenAI and Anthropic-compatible endpoints",count:en.length+eo.length,collapsed:J.custom&&!W.trim(),onToggle:()=>ea("custom"),children:(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:w-auto",children:[(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>U(!0),className:"min-h-11 w-full sm:min-h-0 sm:w-auto",children:"Add Anthropic Compatible"}),(0,r.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>O(!0),className:"min-h-11 w-full sm:min-h-0 sm:w-auto",children:"Add OpenAI Compatible"})]})}),(0,r.jsx)("div",{className:J.custom&&!W.trim()?"hidden sm:block":"",children:0===en.length&&0===eo.length?(0,r.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border border-dashed border-border bg-surface/45 px-4 py-3 text-text-muted",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-[18px]",children:"add_link"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-text-main",children:"No custom endpoints yet"}),(0,r.jsx)("p",{className:"mt-0.5 text-xs",children:"Add an OpenAI or Anthropic-compatible endpoint when you need one."})]})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4",children:[...en,...eo].map(e=>(0,r.jsx)(T,{providerId:e.id,provider:e,stats:es(e.id,"apikey"),onToggle:t=>ei(e.id,"apikey",t)},e.id))})})]}),ed.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(k,{icon:"passkey",title:"OAuth Providers",description:"Connect existing provider accounts securely",count:ed.length,collapsed:J.oauth&&!W.trim(),onToggle:()=>ea("oauth"),children:(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsx)(g,{}),(0,r.jsxs)("button",{onClick:()=>el("oauth"),disabled:q.has("oauth"),className:`flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border px-3 text-xs font-medium transition-colors sm:h-8 sm:w-auto sm:rounded-lg ${q.has("oauth")?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all OAuth connections","aria-label":"Test all OAuth connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${q.has("oauth")?" animate-spin":""}`,children:"play_arrow"}),q.has("oauth")?"Testing...":"Test All"]})]})}),(0,r.jsx)("div",{className:`${J.oauth&&!W.trim()?"hidden sm:grid":"grid"} grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4`,children:ed.map(([e,t])=>{let s=t?.authModes?.includes("apikey")?["oauth","apikey"]:"oauth";return(0,r.jsx)(C,{providerId:e,provider:t,stats:es(e,s),onToggle:t=>ei(e,"oauth",t)},e)})})]}),(ec.length>0||em.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(k,{icon:"savings",title:"Free Tier Providers",description:"Ready-to-use and free-tier routing options",count:ec.length+em.length,collapsed:J.free&&!W.trim(),onToggle:()=>ea("free"),children:(0,r.jsxs)("button",{onClick:()=>el("free"),disabled:q.has("free"),className:`flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border px-3 text-xs font-medium transition-colors sm:h-8 sm:w-auto sm:rounded-lg ${q.has("free")?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all Free connections","aria-label":"Test all Free provider connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${q.has("free")?" animate-spin":""}`,children:"play_arrow"}),q.has("free")?"Testing...":"Test All"]})}),(0,r.jsxs)("div",{className:`${J.free&&!W.trim()?"hidden sm:grid":"grid"} grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4`,children:[ec.map(([e,t])=>{let s=Array.isArray(t?.authModes)&&t.authModes.includes("apikey");return(0,r.jsx)(C,{providerId:e,provider:t,stats:es(e,s?["oauth","apikey"]:"oauth"),onToggle:t=>ei(e,s?"apikey":"oauth",t)},e)}),em.map(([e,t])=>(0,r.jsx)(T,{providerId:e,provider:t,stats:es(e,"apikey"),onToggle:t=>ei(e,"apikey",t)},e))]})]}),ep.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(k,{icon:"key",title:"API Key Providers",description:"Bring your own provider credentials",count:ep.length,collapsed:J.apikey&&!W.trim(),onToggle:()=>ea("apikey"),children:(0,r.jsxs)("button",{onClick:()=>el("apikey"),disabled:q.has("apikey"),className:`flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border px-3 text-xs font-medium transition-colors sm:h-8 sm:w-auto sm:rounded-lg ${q.has("apikey")?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all API Key connections","aria-label":"Test all API Key connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${q.has("apikey")?" animate-spin":""}`,children:"play_arrow"}),q.has("apikey")?"Testing...":"Test All"]})}),(0,r.jsx)("div",{className:`${J.apikey&&!W.trim()?"hidden sm:grid":"grid"} grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4`,children:ex.map(([e,t])=>(0,r.jsx)(T,{providerId:e,provider:t,stats:es(e,"apikey"),onToggle:t=>ei(e,"apikey",t)},e))}),ep.length>0&&(0,r.jsx)("div",{className:J.apikey&&!W.trim()?"hidden sm:block":"",children:(0,r.jsx)(n.dK,{currentPage:eu,pageSize:E,totalItems:ep.length,onPageChange:A,onPageSizeChange:e=>{I(e),A(1)}})})]}),(0,r.jsx)(S,{isOpen:P,onClose:()=>O(!1),onCreated:e=>{o(t=>[...t,e]),O(!1)}}),(0,r.jsx)($,{isOpen:_,onClose:()=>U(!1),onCreated:e=>{o(t=>[...t,e]),U(!1)}}),M&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>D(null),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,r.jsxs)("div",{className:"relative bg-surface border border-border rounded-xl w-full max-w-[600px] max-h-[86vh] sm:max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-xl",children:[(0,r.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,r.jsx)("button",{onClick:()=>D(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("div",{className:"p-5",children:(0,r.jsx)(R,{results:M})})]})]})]})}function k({icon:e,title:t,description:s,count:a,collapsed:i,onToggle:l,children:n}){return(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex w-full min-w-0 items-center gap-2.5 sm:w-auto",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 sm:flex-none",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/[0.08] text-[17px] text-primary",children:e}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h2",{className:"truncate text-lg font-semibold leading-tight",children:t}),(0,r.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold tabular-nums text-text-muted",children:a})]}),(0,r.jsx)("p",{className:"mt-0.5 truncate text-[11px] text-text-muted sm:text-xs",children:s})]})]}),(0,r.jsx)("button",{type:"button",onClick:l,className:"flex size-11 shrink-0 items-center justify-center rounded-xl border border-border text-text-muted transition-colors hover:border-primary/30 hover:text-primary sm:hidden","aria-expanded":!i,"aria-label":`${i?"Expand":"Collapse"} ${t}`,children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:i?"expand_more":"expand_less"})})]}),n&&(0,r.jsx)("div",{className:i?"hidden sm:block":"block",children:n})]})}function C({providerId:e,provider:t,stats:s,onToggle:a}){let{connected:i,error:l,errorCode:d,allDisabled:c}=s,m=!!t.noAuth;return(0,r.jsx)("div",{className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"none",className:`relative h-[76px] min-h-[76px] cursor-pointer overflow-hidden transition-[border-color,box-shadow,opacity] group-hover:border-primary/30 group-hover:shadow-[0_10px_26px_-22px_rgba(229,106,74,0.55)] sm:h-[78px] sm:min-h-[78px] ${c?"opacity-55":""}`,children:(0,r.jsxs)("div",{className:"flex h-full min-w-0 items-center justify-between gap-2.5 p-3",children:[(0,r.jsxs)(p(),{href:`/dashboard/providers/${e}`,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg ring-1 ring-black/[0.04] dark:ring-white/[0.06]",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:`/providers/${t.id}.png`,alt:"",size:28,className:"max-h-7 max-w-7 rounded-md object-contain",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate text-sm font-semibold text-text-main",children:t.name}),(0,r.jsx)("div",{className:"mt-1 flex min-w-0 items-center overflow-hidden whitespace-nowrap",children:c?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[13px]",children:"pause_circle"}),"Disabled"]}):m?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium text-success",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-success"}),"Ready"]}):y(i,l,d)})]})]}),(0,r.jsxs)("div",{className:"hidden shrink-0 items-center gap-2 sm:flex",children:[s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!!c)},children:(0,r.jsx)(n.lM,{size:"sm",touchTarget:!0,checked:!c,onChange:()=>{},title:c?"Enable provider":"Disable provider"})}),(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[17px] text-text-subtle transition-[transform,color] group-hover:translate-x-0.5 group-hover:text-primary",children:"chevron_right"})]}),(0,r.jsx)(A,{providerId:e,hasConnections:s.total>0,active:!c,onToggle:a})]})})})}function T({providerId:e,provider:t,stats:s,onToggle:a}){let{connected:i,error:l,errorCode:d,allDisabled:m}=s,u=e.startsWith(c.JH),x=e.startsWith(c.DI);return(0,r.jsx)("div",{className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"none",className:`relative h-[76px] min-h-[76px] cursor-pointer overflow-hidden transition-[border-color,box-shadow,opacity] group-hover:border-primary/30 group-hover:shadow-[0_10px_26px_-22px_rgba(229,106,74,0.55)] sm:h-[78px] sm:min-h-[78px] ${m?"opacity-55":""}`,children:(0,r.jsxs)("div",{className:"flex h-full min-w-0 items-center justify-between gap-2.5 p-3",children:[(0,r.jsxs)(p(),{href:`/dashboard/providers/${e}`,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg ring-1 ring-black/[0.04] dark:ring-white/[0.06]",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:u?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":x?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:"",size:28,className:"max-h-7 max-w-7 rounded-md object-contain",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate text-sm font-semibold text-text-main",children:t.name}),(0,r.jsx)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap",children:m?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[13px]",children:"pause_circle"}),"Disabled"]}):(0,r.jsxs)(r.Fragment,{children:[y(i,l,d),u&&(0,r.jsxs)("span",{className:"text-[10px] text-text-subtle",children:["\xb7 ","responses"===t.apiType?"Responses":"Chat"]}),x&&(0,r.jsx)("span",{className:"text-[10px] text-text-subtle",children:"\xb7 Messages"})]})})]})]}),(0,r.jsxs)("div",{className:"hidden shrink-0 items-center gap-2 sm:flex",children:[s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!!m)},children:(0,r.jsx)(n.lM,{size:"sm",touchTarget:!0,checked:!m,onChange:()=>{},title:m?"Enable provider":"Disable provider"})}),(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[17px] text-text-subtle transition-[transform,color] group-hover:translate-x-0.5 group-hover:text-primary",children:"chevron_right"})]}),(0,r.jsx)(A,{providerId:e,hasConnections:s.total>0,active:!m,onToggle:a})]})})})}function A({providerId:e,hasConnections:t,active:s,onToggle:i}){let[l,n]=(0,a.useState)(!1),o=(0,a.useRef)(null),d=(0,a.useId)();return(0,a.useEffect)(()=>{if(!l)return;let e=e=>{"Escape"!==e.key&&o.current?.contains(e.target)||n(!1)};return document.addEventListener("keydown",e),document.addEventListener("pointerdown",e),()=>{document.removeEventListener("keydown",e),document.removeEventListener("pointerdown",e)}},[l]),(0,r.jsxs)("div",{ref:o,className:"relative shrink-0 sm:hidden",children:[(0,r.jsx)("button",{type:"button","aria-label":"Provider actions","aria-expanded":l,"aria-controls":d,onClick:()=>n(e=>!e),className:"grid size-11 place-items-center rounded-xl text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined",children:"more_vert"})}),l&&(0,r.jsxs)("div",{id:d,className:"absolute right-0 top-full z-20 mt-1 w-48 overflow-hidden rounded-xl border border-border bg-surface p-1 shadow-[var(--shadow-elev)]",children:[(0,r.jsxs)(p(),{href:`/dashboard/providers/${e}`,className:"flex min-h-11 items-center gap-2 rounded-lg px-3 text-sm text-text-main hover:bg-surface-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:"arrow_forward"}),"Open provider"]}),t&&(0,r.jsxs)("button",{type:"button",onClick:()=>{i(!s),n(!1)},className:"flex min-h-11 w-full items-center gap-2 rounded-lg px-3 text-left text-sm text-text-main hover:bg-surface-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:s?"pause_circle":"play_circle"}),s?"Disable provider":"Enable provider"]})]})]})}function S({isOpen:e,onClose:t,onCreated:s}){let[i,l]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[o,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(""),[p,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),[b,v]=(0,a.useState)("");(0,a.useEffect)(()=>{let e="https://api.openai.com/v1";l(t=>t.baseUrl&&t.baseUrl!==e?t:{...t,baseUrl:e})},[i.apiType]);let y=async()=>{if(i.name.trim()&&i.prefix.trim()&&i.baseUrl.trim()){d(!0),v("");try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.name,prefix:i.prefix,apiType:i.apiType,baseUrl:i.baseUrl,type:"openai-compatible"})}),t=await e.json().catch(()=>({}));e.ok?(s(t.node),l({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),m(""),g(null)):v(t?.error||`Failed to create node (HTTP ${e.status})`)}catch(e){console.log("Error creating OpenAI Compatible node:",e),v("Network error — could not create the node")}finally{d(!1)}}},j=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:i.baseUrl,apiKey:c,type:"openai-compatible",modelId:p.trim()||void 0})}),t=await e.json();g(t)}catch{g({valid:!1,error:"Network error"})}finally{h(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add OpenAI Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:i.name,onChange:e=>l({...i,name:e.target.value}),placeholder:"OpenAI Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:i.prefix,onChange:e=>l({...i,prefix:e.target.value}),placeholder:"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:i.apiType,onChange:e=>l({...i,apiType:e.target.value})}),(0,r.jsx)(n.pd,{label:"Base URL",value:i.baseUrl,onChange:e=>l({...i,baseUrl:e.target.value}),placeholder:"https://api.openai.com/v1",hint:"Use the base URL (ending in /v1) for your OpenAI-compatible API."}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>m(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:p,onChange:e=>u(e.target.value),placeholder:"e.g. gpt-4, claude-3-opus",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),b&&(0,r.jsx)("p",{className:"text-sm text-red-500 break-words",children:b}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsx)(n.$n,{onClick:j,disabled:!c||x||!i.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:x?"Checking...":"Check"}),(()=>{if(!f)return null;let{valid:e,error:t,method:s}=f;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(n.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,r.jsx)(n.$n,{onClick:y,fullWidth:!0,disabled:!i.name.trim()||!i.prefix.trim()||!i.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function $({isOpen:e,onClose:t,onCreated:s}){let[i,l]=(0,a.useState)({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),[o,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(""),[p,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),[b,v]=(0,a.useState)("");(0,a.useEffect)(()=>{e&&(g(null),m(""),u(""),v(""))},[e]);let y=async()=>{if(i.name.trim()&&i.prefix.trim()&&i.baseUrl.trim()){d(!0),v("");try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.name,prefix:i.prefix,baseUrl:i.baseUrl,type:"anthropic-compatible"})}),t=await e.json().catch(()=>({}));e.ok?(s(t.node),l({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),m(""),g(null)):v(t?.error||`Failed to create node (HTTP ${e.status})`)}catch(e){console.log("Error creating Anthropic Compatible node:",e),v("Network error — could not create the node")}finally{d(!1)}}},j=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:i.baseUrl,apiKey:c,type:"anthropic-compatible",modelId:p.trim()||void 0})}),t=await e.json();g(t)}catch{g({valid:!1,error:"Network error"})}finally{h(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add Anthropic Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:i.name,onChange:e=>l({...i,name:e.target.value}),placeholder:"Anthropic Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:i.prefix,onChange:e=>l({...i,prefix:e.target.value}),placeholder:"ac-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.pd,{label:"Base URL",value:i.baseUrl,onChange:e=>l({...i,baseUrl:e.target.value}),placeholder:"https://api.anthropic.com/v1",hint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages."}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>m(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:p,onChange:e=>u(e.target.value),placeholder:"e.g. claude-3-opus",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),b&&(0,r.jsx)("p",{className:"text-sm text-red-500 break-words",children:b}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsx)(n.$n,{onClick:j,disabled:!c||x||!i.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:x?"Checking...":"Check"}),(()=>{if(!f)return null;let{valid:e,error:t,method:s}=f;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(n.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,r.jsx)(n.$n,{onClick:y,fullWidth:!0,disabled:!i.name.trim()||!i.prefix.trim()||!i.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function R({results:e}){if(e.error&&!e.results)return(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,r.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,a=e.results||[];return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[t&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs mb-1 sm:gap-3",children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,r.jsxs)("span",{className:"text-text-muted sm:ml-auto",children:[t.total," tested"]})]}),a.map((e,t)=>(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-lg bg-black/[0.03] px-3 py-2 text-xs dark:bg-white/[0.03] sm:flex-nowrap",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,r.jsxs)("div",{className:"min-w-0 flex-[1_1_160px]",children:[(0,r.jsx)("span",{className:"block truncate font-medium sm:inline",children:e.connectionName}),(0,r.jsxs)("span",{className:"block truncate text-text-muted sm:ml-1.5 sm:inline",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,r.jsxs)("span",{className:"shrink-0 text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,r.jsx)("span",{className:`shrink-0 text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===a.length&&(0,r.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}k.propTypes={icon:l().string.isRequired,title:l().string.isRequired,description:l().string.isRequired,count:l().number.isRequired,collapsed:l().bool.isRequired,onToggle:l().func.isRequired,children:l().node},C.propTypes={providerId:l().string.isRequired,provider:l().shape({id:l().string.isRequired,name:l().string.isRequired,color:l().string,textIcon:l().string}).isRequired,stats:l().shape({connected:l().number,error:l().number,errorCode:l().string,errorTime:l().string,total:l().number,allDisabled:l().bool}).isRequired,onToggle:l().func},A.propTypes={providerId:l().string.isRequired,hasConnections:l().bool.isRequired,active:l().bool.isRequired,onToggle:l().func.isRequired},T.propTypes={providerId:l().string.isRequired,provider:l().shape({id:l().string.isRequired,name:l().string.isRequired,color:l().string,textIcon:l().string,apiType:l().string}).isRequired,stats:l().shape({connected:l().number,error:l().number,errorCode:l().string,errorTime:l().string,total:l().number,allDisabled:l().bool}).isRequired,onToggle:l().func},S.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired,onCreated:l().func.isRequired},$.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired,onCreated:l().func.isRequired},R.propTypes={results:l().shape({mode:l().string,results:l().array,summary:l().shape({total:l().number,passed:l().number,failed:l().number}),error:l().string}).isRequired}},28915:(e,t,s)=>{"use strict";s.d(t,{x6:()=>r.fetchJson,E2:()=>a,gs:()=>i});var r=s(68211);function a(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}function i(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let r=Math.floor(s/24);return`${r}d ago`}},31703:(e,t,s)=>{Promise.resolve().then(s.bind(s,20490))},68211:(e,t,s)=>{"use strict";s.d(t,{fetchJson:()=>a});let r={"Content-Type":"application/json"};async function a(e,t={}){let{body:s,headers:i,...l}=t,n={...l,headers:{...r,...i}};void 0!==s&&"string"!=typeof s?n.body=JSON.stringify(s):void 0!==s&&(n.body=s);let o=await fetch(e,n),d=await o.text(),c=null;if(d)try{c=JSON.parse(d)}catch{let t=Error(`Non-JSON response from ${e} (HTTP ${o.status})`);throw t.status=o.status,t.rawBody=d.slice(0,300),t}if(!o.ok){let e=c&&(c.error?.message||c.error||c.message)||`Request failed (HTTP ${o.status})`,t=Error("string"==typeof e?e:`HTTP ${o.status}`);throw t.status=o.status,t.data=c,t}return c}a.get=(e,t)=>a(e,{...t,method:"GET"}),a.post=(e,t,s)=>a(e,{...s,method:"POST",body:t}),a.put=(e,t,s)=>a(e,{...s,method:"PUT",body:t}),a.patch=(e,t,s)=>a(e,{...s,method:"PATCH",body:t}),a.del=(e,t)=>a(e,{...t,method:"DELETE"})}},e=>{e.O(0,[2574,3862,3745,3339,620,5497,8441,3794,7358],()=>e(e.s=31703)),_N_E=e.O()}]);
|
package/cli/app/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Unreleased
|
|
2
2
|
|
|
3
|
+
# v1.1.34 (2026-10-23)
|
|
4
|
+
|
|
5
|
+
## Removed
|
|
6
|
+
- **Notion AI (Experimental) provider.** The `notion-ai` provider and its `na/` models, the "Experimental Web Providers" dashboard section, the Notion workspace fields in the connection dialogs, and the optional `tls-client-node` runtime that postinstall and every launch tried to install are gone. Existing Notion connections stay in the database but no longer route; delete them from the dashboard if you added one.
|
|
7
|
+
|
|
8
|
+
## Security
|
|
9
|
+
- **Requests for an unknown provider no longer go to OpenAI.** The default executor fell back to the OpenAI endpoint for any provider it did not recognize, so a stored connection for a removed provider (for example a Notion `token_v2` cookie) would be sent as a Bearer token to `api.openai.com`. Unknown providers now fail with `400 Unknown provider` and no outbound request; `openai-compatible-*` and `anthropic-compatible-*` are unaffected.
|
|
10
|
+
- **Grok Build config is owner-only and written atomically.** `~/.grok/config.toml` holds the API key, but `0600` was only applied when the file was created, so an existing `0644` file stayed world-readable, and a crash or two concurrent saves could truncate it.
|
|
11
|
+
- **`/codex/*` now requires an API key like `/v1/*`.** The path is rewritten to `/api/v1/responses` after the guard runs, and the guard did not list `/codex`, so a remote caller reached the Responses API with only the handler's own check. With **Require API key** off, that check passes without a key.
|
|
12
|
+
- **Root CA private key is owner-only.** `~/.zevai/mitm/rootCA.key` was written with default permissions (usually `0644`). That CA is installed as a trusted root, so any local user could mint certificates the machine trusts. New keys are written `0600` in a `0700` directory, and existing keys are repaired on startup.
|
|
13
|
+
- **Database and backups are owner-only.** `data.sqlite`, its `-wal`/`-shm` files, the sql.js temp file and every backup hold provider tokens and API keys but used default permissions. The `db` and `backups` directories are now `0700` and the files `0600`, repaired on startup.
|
|
14
|
+
- **Update and Shutdown only kill the router's own processes.** Process cleanup matched any `ps` line containing `zevai`, `next-server` or `cloudflared` and sent `kill -9`, which killed unrelated dev servers, the user's own tunnels, and editors with files open under the repo. It now kills the process tree of the CLI that launched the server, plus binaries the router installed under `~/.zevai/bin` and `~/.zevai/runtime`.
|
|
15
|
+
- **`/v1/models` no longer advertises hidden no-auth providers.** Devin CLI (`dv/`), Coqui and Tortoise are hidden from the Providers page but need no connection, so every client that discovers models from the list (Hermes, OMP) picked up all 35 `dv/` models. Picking one runs the local `devin acp` binary on the router host, which can execute shell commands. They are now left out of the list; an explicit `devin-cli/<model>` request still resolves.
|
|
16
|
+
|
|
17
|
+
## Fixes
|
|
18
|
+
- **Adaptive routing no longer freezes a circuit until restart.** A half-open circuit's recovery probe was released only by the attempt lease. A failed token refresh, a planner error, or an exhausted attempt budget skipped that, the probe stayed "in flight" forever, and every candidate behind that circuit was rejected until the process restarted. Those paths now hand the probe back.
|
|
19
|
+
- **Budgeted keys no longer get 429 for a minute after a failed embeddings, image, audio or video request.** When one of those handlers threw, the key's budget slot stayed held until the 60s idle reclaim. The slot is now released immediately, as chat already did.
|
|
20
|
+
- **Streamed Claude responses report real prompt tokens.** Anthropic sends input and cache tokens in `message_start` and only output tokens in `message_delta`, so OpenAI-format clients and usage/cost accounting saw `prompt_tokens: 0` on every streamed Claude request.
|
|
21
|
+
- **A revoked refresh token no longer turns embeddings and image requests into a 500.** The refresh error escaped the handler, so the account was never marked unavailable and the next request picked it again. The upstream 401 now reaches the normal account fallback.
|
|
22
|
+
- **Background token refresh resumes after re-authorization.** One permanent refresh failure parked the connection until restart, even after the user reconnected it. A new refresh token now makes it eligible again.
|
|
23
|
+
- **MITM hosts entries never delete the user's own lines.** Matching used substrings, so stopping MITM removed any line mentioning a target host (blocklists, comments), and `cloudcode-pa.googleapis.com` counted as active when only `daily-cloudcode-pa.googleapis.com` was present. Hosts are matched exactly, router lines are tagged `# zevairouter`, and only router lines are removed.
|
|
24
|
+
- **A corrupt legacy `db.json` no longer loses all accounts.** A file that failed to parse was treated as missing; the import committed without providers, keys or settings and was marked done, so a repaired file was never imported. The import is now skipped with an error and retried on the next start.
|
|
25
|
+
- **Grok Build settings no longer corrupt `config.toml`.** The editor only recognized double-quoted values and bare `[section]` headers, so `default = 'x'` gained a duplicate key and `[models] # comment` a second `[models]` table, and Grok could no longer read the file. It now parses and writes real TOML; comments other than ZevaiRouter's restore markers are not preserved.
|
|
26
|
+
- **sql.js startup no longer stays locked after a crash.** An empty lock file, or one holding the current PID after a restart (PID 1 in Docker), was treated as owned by a live process and the database refused to open. Stale locks are reclaimed; a lock held by another live process is still respected.
|
|
27
|
+
- **Linux re-trusts a regenerated MITM root CA.** The install check only tested that the anchor file existed, so after the CA was regenerated the old one stayed trusted and every intercepted connection failed. It now compares fingerprints.
|
|
28
|
+
- **A crash while saving tunnel state no longer changes the public tunnel URL.** `state.json` was written in place and a parse error read as "no state", so a new tunnel ID was generated. It is now written atomically with mode `0600`, and a corrupt file falls back to the last good copy.
|
|
29
|
+
- **Claude-format clients get the provider's real usage from OpenAI-style streams.** Providers that send usage in a separate final chunk after `finish_reason` (qwen and iflow request this) had that chunk dropped, so Claude Code saw estimated token counts. `message_delta` and `message_stop` now wait for the usage chunk or the end of the stream, and are still sent exactly once when no usage arrives.
|
|
30
|
+
- **A 401 from a provider that cannot refresh no longer waits 3s before failing over.** Cursor, Qoder, Trae, Windsurf, Zed and connections without a refresh token went through two retry delays for a refresh that could never succeed. The refresh is now skipped; providers that can refresh keep their retries.
|
|
31
|
+
- **Terminal UI works with `--host <address>`.** It always called `localhost`, so a server bound to a specific address answered every menu with "Failed to fetch".
|
|
32
|
+
- **IPv6 loopback is recognized.** `HOSTNAME=::1` and `Host: [::1]:port` were never treated as local, so local-only routes and the login-disabled shortcut were refused.
|
|
33
|
+
- **`PATCH /api/settings` answers 400 for a non-object body** instead of a 500 with the raw error.
|
|
34
|
+
|
|
35
|
+
## Internal
|
|
36
|
+
- **`npm run release` refuses to run outside `main`.** The release commit was made on the current branch but `main` was pushed, so a release from another branch published a tree whose commit never reached `origin/main`.
|
|
37
|
+
|
|
3
38
|
# v1.1.33 (2026-10-22)
|
|
4
39
|
|
|
5
40
|
## Features
|
|
@@ -29,7 +29,6 @@ process.env.NPM_CONFIG_LOGLEVEL = process.env.NPM_CONFIG_LOGLEVEL || "error";
|
|
|
29
29
|
const { ensureSqliteRuntime, runNpmInstall, getRuntimeDir } = require("./sqliteRuntime");
|
|
30
30
|
const { ensureTrayRuntime } = require("./trayRuntime");
|
|
31
31
|
const { ensureCloakbrowserRuntime } = require("./cloakbrowserRuntime");
|
|
32
|
-
const { ensureNotionTlsRuntime } = require("./notionTlsRuntime");
|
|
33
32
|
const { hasBuiltInNodeSqlite } = require("./startupRuntime");
|
|
34
33
|
|
|
35
34
|
const minimalSetting = String(process.env.ZEVAI_MINIMAL_POSTINSTALL || "").toLowerCase();
|
|
@@ -124,17 +123,6 @@ async function main() {
|
|
|
124
123
|
warn(`Tray warm-up skipped: ${error.message}`);
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
// Notion inference needs the Chrome-TLS transport even in bounded/minimal
|
|
128
|
-
// installs. It is a small provider runtime, not the browser automation
|
|
129
|
-
// bundle that MINIMAL intentionally defers.
|
|
130
|
-
try {
|
|
131
|
-
const notionTls = ensureNotionTlsRuntime({ silent: true });
|
|
132
|
-
if (notionTls.ok) log("✓ Notion Chrome TLS transport ready");
|
|
133
|
-
else warn("Notion Chrome TLS transport unavailable — the HTTP fallback remains available");
|
|
134
|
-
} catch (error) {
|
|
135
|
-
warn(`Notion TLS warm-up skipped: ${error.message}`);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
126
|
if (MINIMAL) {
|
|
139
127
|
log("Done (minimal). Automation downloads CloakBrowser on first use.");
|
|
140
128
|
return;
|
|
@@ -9,7 +9,6 @@ function prepareStartupRuntime({
|
|
|
9
9
|
modules = builtinModules,
|
|
10
10
|
loadSqliteRuntime = () => require("./sqliteRuntime"),
|
|
11
11
|
loadTrayRuntime = () => require("./trayRuntime"),
|
|
12
|
-
loadNotionTlsRuntime = null,
|
|
13
12
|
} = {}) {
|
|
14
13
|
const sqliteRuntime = loadSqliteRuntime();
|
|
15
14
|
|
|
@@ -19,15 +18,6 @@ function prepareStartupRuntime({
|
|
|
19
18
|
try { sqliteRuntime.ensureSqliteRuntime({ silent: true }); } catch {}
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
// Repair interrupted/minimal installs before the router can dispatch a
|
|
23
|
-
// Notion request. Keep startup bounded when the registry is unavailable;
|
|
24
|
-
// notionTlsClient still has its HTTP fallback.
|
|
25
|
-
if (loadNotionTlsRuntime) {
|
|
26
|
-
try {
|
|
27
|
-
loadNotionTlsRuntime().ensureNotionTlsRuntime({ silent: true, timeout: 30_000 });
|
|
28
|
-
} catch {}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
21
|
if (trayMode) {
|
|
32
22
|
try { loadTrayRuntime().ensureTrayRuntime({ silent: true }); } catch {}
|
|
33
23
|
}
|