omniroute 0.8.0 → 0.8.8
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/README.md +69 -28
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +24 -23
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +27 -3
- package/app/.next/react-loadable-manifest.json +2 -2
- package/app/.next/required-server-files.json +1 -1
- package/app/.next/routes-manifest.json +6 -0
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +6 -6
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/costs/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/costs/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/health/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/limits/page.js +2 -0
- package/app/.next/server/app/(dashboard)/dashboard/limits/page.js.nft.json +1 -0
- package/app/.next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -0
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page.js +3 -3
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +2 -2
- package/app/.next/server/app/_global-error.rsc +3 -3
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js +2 -2
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +5 -5
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/auth/login/route.js +1 -1
- package/app/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route.js +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cache/route.js +2 -2
- package/app/.next/server/app/api/cache/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cache/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cache/stats/route.js +1 -1
- package/app/.next/server/app/api/cache/stats/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +4 -4
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/backups/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/backups/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/cline-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-profiles/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/codex-profiles/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/guide-settings/[toolId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/kilo-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/runtime/[toolId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/status/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/status/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/status/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/metrics/route.js +1 -1
- package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route.js +1 -1
- package/app/.next/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/test/route.js +1 -1
- package/app/.next/server/app/api/combos/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/compliance/audit-log/route.js +1 -1
- package/app/.next/server/app/api/compliance/audit-log/route.js.nft.json +1 -1
- package/app/.next/server/app/api/compliance/audit-log/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/db-backups/route.js +1 -1
- package/app/.next/server/app/api/db-backups/route.js.nft.json +1 -1
- package/app/.next/server/app/api/db-backups/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/evals/[suiteId]/route.js +1 -1
- package/app/.next/server/app/api/evals/[suiteId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/evals/[suiteId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/evals/route.js +1 -1
- package/app/.next/server/app/api/evals/route.js.nft.json +1 -1
- package/app/.next/server/app/api/evals/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/fallback/chains/route.js +2 -2
- package/app/.next/server/app/api/fallback/chains/route.js.nft.json +1 -1
- package/app/.next/server/app/api/fallback/chains/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route.js +1 -1
- package/app/.next/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/availability/route.js +1 -1
- package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/catalog/route.js +2 -2
- package/app/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/catalog/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route.js +2 -2
- package/app/.next/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/monitoring/health/route.js +2 -2
- package/app/.next/server/app/api/monitoring/health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/monitoring/health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +2 -2
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/policies/route.js +2 -2
- package/app/.next/server/app/api/policies/route.js.nft.json +1 -1
- package/app/.next/server/app/api/policies/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/defaults/route.js +1 -1
- package/app/.next/server/app/api/pricing/defaults/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/models/route.js +1 -1
- package/app/.next/server/app/api/pricing/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route.js +1 -1
- package/app/.next/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-metrics/route.js +2 -2
- package/app/.next/server/app/api/provider-metrics/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-metrics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-models/route.js +1 -1
- package/app/.next/server/app/api/provider-models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js +2 -2
- package/app/.next/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +2 -2
- package/app/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route.js +2 -2
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js +1 -2
- package/app/.next/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/rate-limit/route.js +1 -1
- package/app/.next/server/app/api/rate-limit/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/rate-limits/route.js +1 -1
- package/app/.next/server/app/api/rate-limits/route.js.nft.json +1 -1
- package/app/.next/server/app/api/rate-limits/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/resilience/reset/route.js +1 -1
- package/app/.next/server/app/api/resilience/reset/route.js.nft.json +1 -1
- package/app/.next/server/app/api/resilience/reset/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/resilience/route.js +1 -1
- package/app/.next/server/app/api/resilience/route.js.nft.json +1 -1
- package/app/.next/server/app/api/resilience/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/restart/route.js +1 -1
- package/app/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sessions/route.js +1 -1
- package/app/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/combo-defaults/route.js +1 -1
- package/app/.next/server/app/api/settings/combo-defaults/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/combo-defaults/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/ip-filter/route.js +1 -1
- package/app/.next/server/app/api/settings/ip-filter/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy/route.js +1 -1
- package/app/.next/server/app/api/settings/proxy/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxy/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy/test/route.js +1 -1
- package/app/.next/server/app/api/settings/proxy/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route.js +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/thinking-budget/route.js +1 -1
- package/app/.next/server/app/api/settings/thinking-budget/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/thinking-budget/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route.js +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/storage/health/route.js +1 -1
- package/app/.next/server/app/api/storage/health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route.js +1 -1
- package/app/.next/server/app/api/sync/cloud/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route.js +1 -1
- package/app/.next/server/app/api/sync/initialize/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/telemetry/summary/route.js +1 -1
- package/app/.next/server/app/api/telemetry/summary/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/token-health/route.js +1 -1
- package/app/.next/server/app/api/token-health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/token-health/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/detect/route.js +1 -1
- package/app/.next/server/app/api/translator/detect/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/detect/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/history/route.js +1 -1
- package/app/.next/server/app/api/translator/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/load/route.js +1 -1
- package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/save/route.js +1 -1
- package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/analytics/route.js +1 -1
- package/app/.next/server/app/api/usage/analytics/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/analytics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/budget/route.js +2 -2
- package/app/.next/server/app/api/usage/budget/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/budget/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/[id]/route.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/call-logs/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/route.js +1 -1
- package/app/.next/server/app/api/usage/call-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/call-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route.js +1 -1
- package/app/.next/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/logs/route.js +1 -1
- package/app/.next/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/proxy-logs/route.js +8 -1
- package/app/.next/server/app/api/usage/proxy-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/proxy-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js +2 -2
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/moderations/route.js +1 -1
- package/app/.next/server/app/api/v1/moderations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route.js +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/rerank/route.js +1 -1
- package/app/.next/server/app/api/v1/rerank/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/rerank/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js +2 -2
- package/app/.next/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page.js +2 -2
- package/app/.next/server/app/callback/page.js.nft.json +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +6 -6
- package/app/.next/server/app/callback.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/analytics.html +1 -1
- package/app/.next/server/app/dashboard/analytics.rsc +7 -7
- package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk/dashboard/analytics/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk/dashboard/analytics.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/analytics.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/analytics.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/analytics.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/analytics.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/analytics.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +7 -7
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +7 -7
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/costs.html +1 -1
- package/app/.next/server/app/dashboard/costs.rsc +7 -7
- package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk/dashboard/costs/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk/dashboard/costs.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/costs.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/costs.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/costs.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/costs.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +7 -7
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/health.html +1 -1
- package/app/.next/server/app/dashboard/health.rsc +7 -7
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/health.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/health.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/health.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/health.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/limits.html +2 -0
- package/app/.next/server/app/dashboard/limits.meta +17 -0
- package/app/.next/server/app/dashboard/limits.rsc +24 -0
- package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk/dashboard/limits/__PAGE__.segment.rsc +9 -0
- package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk/dashboard/limits.segment.rsc +4 -0
- package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +4 -0
- package/app/.next/server/app/dashboard/limits.segments/!KGRhc2hib2FyZCk.segment.rsc +5 -0
- package/app/.next/server/app/dashboard/limits.segments/_full.segment.rsc +24 -0
- package/app/.next/server/app/dashboard/limits.segments/_head.segment.rsc +6 -0
- package/app/.next/server/app/dashboard/limits.segments/_index.segment.rsc +9 -0
- package/app/.next/server/app/dashboard/limits.segments/_tree.segment.rsc +5 -0
- package/app/.next/server/app/dashboard/onboarding.html +1 -1
- package/app/.next/server/app/dashboard/onboarding.rsc +7 -7
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard/onboarding/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard/onboarding.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/onboarding.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/onboarding.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/onboarding.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +7 -7
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +7 -7
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +7 -7
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings.html +1 -1
- package/app/.next/server/app/dashboard/settings.rsc +7 -7
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard/settings/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/settings.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.html +2 -2
- package/app/.next/server/app/dashboard/translator.rsc +7 -7
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +7 -7
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/docs/page.js +3 -3
- package/app/.next/server/app/docs/page.js.nft.json +1 -1
- package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/docs.html +1 -1
- package/app/.next/server/app/docs.rsc +5 -5
- package/app/.next/server/app/docs.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/docs.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/app/.next/server/app/forbidden/page.js +2 -2
- package/app/.next/server/app/forbidden/page.js.nft.json +1 -1
- package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/forbidden.html +1 -1
- package/app/.next/server/app/forbidden.rsc +6 -6
- package/app/.next/server/app/forbidden.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/forbidden.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/forbidden.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/forbidden.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/forbidden.segments/forbidden/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/forbidden.segments/forbidden.segment.rsc +1 -1
- package/app/.next/server/app/forgot-password/page.js +2 -2
- package/app/.next/server/app/forgot-password/page.js.nft.json +1 -1
- package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/forgot-password.html +1 -1
- package/app/.next/server/app/forgot-password.rsc +6 -6
- package/app/.next/server/app/forgot-password.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/forgot-password.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/forgot-password.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/forgot-password.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/forgot-password.segments/forgot-password/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/forgot-password.segments/forgot-password.segment.rsc +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +5 -5
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page.js +2 -2
- package/app/.next/server/app/landing/page.js.nft.json +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +6 -6
- package/app/.next/server/app/landing.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +2 -2
- package/app/.next/server/app/login/page.js.nft.json +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +6 -6
- package/app/.next/server/app/login.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/page.js +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/privacy/page.js +2 -2
- package/app/.next/server/app/privacy/page.js.nft.json +1 -1
- package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/privacy.html +1 -1
- package/app/.next/server/app/privacy.rsc +5 -5
- package/app/.next/server/app/privacy.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/privacy.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/privacy.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/privacy.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/privacy.segments/privacy/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/privacy.segments/privacy.segment.rsc +1 -1
- package/app/.next/server/app/terms/page.js +2 -2
- package/app/.next/server/app/terms/page.js.nft.json +1 -1
- package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/terms.html +1 -1
- package/app/.next/server/app/terms.rsc +5 -5
- package/app/.next/server/app/terms.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/terms.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/terms.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/terms.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/terms.segments/terms/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/terms.segments/terms.segment.rsc +1 -1
- package/app/.next/server/app-paths-manifest.json +24 -23
- package/app/.next/server/chunks/1020.js +1 -0
- package/app/.next/server/chunks/1079.js +1 -0
- package/app/.next/server/chunks/1308.js +1 -0
- package/app/.next/server/chunks/{4469.js → 1549.js} +26 -3
- package/app/.next/server/chunks/2286.js +1 -0
- package/app/.next/server/chunks/239.js +3 -0
- package/app/.next/server/chunks/2391.js +1 -1
- package/app/.next/server/chunks/2620.js +3 -0
- package/app/.next/server/chunks/2767.js +26 -0
- package/app/.next/server/chunks/{3542.js → 2817.js} +2 -2
- package/app/.next/server/chunks/2867.js +1 -0
- package/app/.next/server/chunks/{651.js → 287.js} +2 -2
- package/app/.next/server/chunks/293.js +1 -0
- package/app/.next/server/chunks/{8108.js → 3596.js} +1 -1
- package/app/.next/server/chunks/{1746.js → 3699.js} +1 -1
- package/app/.next/server/chunks/4163.js +1 -0
- package/app/.next/server/chunks/4277.js +1 -0
- package/app/.next/server/chunks/438.js +1 -0
- package/app/.next/server/chunks/4568.js +1 -0
- package/app/.next/server/chunks/4755.js +1 -21
- package/app/.next/server/chunks/5248.js +1 -0
- package/app/.next/server/chunks/5583.js +2 -0
- package/app/.next/server/chunks/560.js +1 -0
- package/app/.next/server/chunks/595.js +1 -1
- package/app/.next/server/chunks/5994.js +1 -0
- package/app/.next/server/chunks/6120.js +1 -0
- package/app/.next/server/chunks/7109.js +8 -0
- package/app/.next/server/chunks/7230.js +36 -0
- package/app/.next/server/chunks/7544.js +143 -0
- package/app/.next/server/chunks/7669.js +3 -0
- package/app/.next/server/chunks/8369.js +2 -0
- package/app/.next/server/chunks/8429.js +1 -0
- package/app/.next/server/chunks/9342.js +1 -0
- package/app/.next/server/chunks/9343.js +5 -5
- package/app/.next/server/chunks/{1099.js → 9723.js} +2 -2
- package/app/.next/server/chunks/9824.js +21 -0
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/app/.next/server/middleware.js +27 -4
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +2 -2
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/server/webpack-runtime.js +1 -1
- package/app/.next/static/chunks/1149-fefe7f95f0e9842f.js +1 -0
- package/app/.next/static/chunks/5846-b70d10291438712b.js +2 -0
- package/app/.next/static/chunks/993-d43d3ceef35b3300.js +21 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-74ac2092c2a6b3dc.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-918d5f38d5cdbbc2.js +15 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-421e732016c49ee4.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-9495b294cfe54d73.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-623e54048b5d4f69.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-58ea3e55f475ea7b.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/limits/page-3b7083be8adedc57.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-207d4961e362eae5.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-3c840eaf6d7cd77d.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-26ec85a0bf8624f2.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-200bed170f9ee2b0.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-98c6b97d0c195a2c.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-3ac21c16bcfde2e4.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/pricing/page-1b3f14c99d3edf09.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-efca884c20a509a4.js +4 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-51a813eac9d71eed.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/layout-cf710bbfb7c3ba11.js +1 -0
- package/app/.next/static/chunks/app/callback/page-5c58a06902dd94ed.js +1 -0
- package/app/.next/static/chunks/app/forbidden/page-86b6392f80a3ff69.js +1 -0
- package/app/.next/static/chunks/app/forgot-password/page-373672767bb0aae4.js +1 -0
- package/app/.next/static/chunks/app/{global-error-6abc2976016d7bd1.js → global-error-ece0210f8bb4e441.js} +1 -1
- package/app/.next/static/chunks/app/landing/page-09741814aaca7548.js +1 -0
- package/app/.next/static/chunks/app/layout-3375493e8f9133db.js +1 -0
- package/app/.next/static/chunks/app/login/page-8a9aa887783f2370.js +1 -0
- package/app/.next/static/chunks/app/not-found-a1cabc3706cf5b84.js +1 -0
- package/app/.next/static/chunks/{webpack-a2b6b20e2db553f5.js → webpack-9837b0fbf7de0b62.js} +1 -1
- package/app/.next/static/css/1c99dc691f001331.css +1 -0
- package/app/.next/static/xW2ax6VohvDsTIIwd1zWK/_buildManifest.js +1 -0
- package/app/package.json +6 -3
- package/app/server.js +1 -1
- package/app/src/mitm/cert/{install.js → install.ts} +3 -3
- package/app/src/mitm/dns/{dnsConfig.js → dnsConfig.ts} +1 -1
- package/app/src/mitm/{manager.js → manager.ts} +3 -3
- package/app/src/mitm/{server.js → server.ts} +1 -1
- package/package.json +6 -3
- package/app/.next/server/chunks/1228.js +0 -3
- package/app/.next/server/chunks/1362.js +0 -1
- package/app/.next/server/chunks/152.js +0 -1
- package/app/.next/server/chunks/2399.js +0 -1
- package/app/.next/server/chunks/2951.js +0 -1
- package/app/.next/server/chunks/4004.js +0 -1
- package/app/.next/server/chunks/4832.js +0 -36
- package/app/.next/server/chunks/5040.js +0 -1
- package/app/.next/server/chunks/5727.js +0 -1
- package/app/.next/server/chunks/6599.js +0 -1
- package/app/.next/server/chunks/7093.js +0 -2
- package/app/.next/server/chunks/7136.js +0 -1
- package/app/.next/server/chunks/7271.js +0 -1
- package/app/.next/server/chunks/7615.js +0 -19
- package/app/.next/server/chunks/7763.js +0 -1
- package/app/.next/server/chunks/7802.js +0 -1
- package/app/.next/server/chunks/7968.js +0 -3
- package/app/.next/server/chunks/8392.js +0 -1
- package/app/.next/server/chunks/8400.js +0 -143
- package/app/.next/server/chunks/8757.js +0 -2
- package/app/.next/server/chunks/8847.js +0 -3
- package/app/.next/server/chunks/9081.js +0 -1
- package/app/.next/server/chunks/9263.js +0 -1
- package/app/.next/static/2kJ2zcrBE0joNQY9l6W0k/_buildManifest.js +0 -1
- package/app/.next/static/chunks/1525-5a69ef0a1ac4f962.js +0 -21
- package/app/.next/static/chunks/7013-718042994c9127fa.js +0 -1
- package/app/.next/static/chunks/7896-7250e5328afe298c.js +0 -2
- package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-a04417ebc8cf8378.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-a0d59a10c0c8cf03.js +0 -15
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-0ec8339a5e63e29b.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/page-38d9a3dbd2b14ce0.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-9f316bbfedf248e3.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-1c7f51c61cd1e699.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/onboarding/page-6f10b6cb468bdc21.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-b7f4f0bd54a35446.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0a52b0b6a790afd5.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-8d7182afc4e86131.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-8ecd49c8dede42af.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-9460e0e29ba0ca7d.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/pricing/page-834e40170968cf11.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-2889507d608ace80.js +0 -4
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-016d44203ff299ac.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/layout-5cca2595e89e770c.js +0 -1
- package/app/.next/static/chunks/app/callback/page-259c406ba4d2aeff.js +0 -1
- package/app/.next/static/chunks/app/forbidden/page-6806872971c364f0.js +0 -1
- package/app/.next/static/chunks/app/forgot-password/page-9cf548e06e388c72.js +0 -1
- package/app/.next/static/chunks/app/landing/page-24ee8d70cde143a9.js +0 -1
- package/app/.next/static/chunks/app/layout-6504ce60623b0a41.js +0 -1
- package/app/.next/static/chunks/app/login/page-7201e8e8c064cf3f.js +0 -1
- package/app/.next/static/chunks/app/not-found-e1af8b9c5785b71b.js +0 -1
- package/app/.next/static/css/c08bd521c418658c.css +0 -1
- /package/app/.next/static/{2kJ2zcrBE0joNQY9l6W0k → xW2ax6VohvDsTIIwd1zWK}/_ssgManifest.js +0 -0
- /package/app/src/mitm/cert/{generate.js → generate.ts} +0 -0
- /package/app/src/shared/utils/{apiKey.js → apiKey.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8192],{32424:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(95155),l=s(12115),r=s(40993),i=s(20909);function n(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}let c={CLOSED:{bg:"bg-green-500/10",text:"text-green-500",label:"Healthy"},OPEN:{bg:"bg-red-500/10",text:"text-red-500",label:"Open"},HALF_OPEN:{bg:"bg-amber-500/10",text:"text-amber-500",label:"Half-Open"}};function x(){var e;let t,s,x,d,m,o,[h,p]=(0,l.useState)(null),[u,j]=(0,l.useState)(null),[b,N]=(0,l.useState)(null),[g,f]=(0,l.useState)(null),[y,v]=(0,l.useState)(null),[w,$]=(0,l.useState)(null),[k,S]=(0,l.useState)(!1),C=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/monitoring/health");if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();p(t),j(null),N(new Date)}catch(e){j(e.message)}},[]),O=(0,l.useCallback)(async()=>{let e=await Promise.allSettled([fetch("/api/telemetry/summary").then(e=>e.json()),fetch("/api/cache/stats").then(e=>e.json()),fetch("/api/rate-limits").then(e=>e.json())]);"fulfilled"===e[0].status&&f(e[0].value),"fulfilled"===e[1].status&&v(e[1].value),"fulfilled"===e[2].status&&e[2].value.cacheStats&&$(e[2].value.cacheStats)},[]);(0,l.useEffect)(()=>{C(),O();let e=setInterval(()=>{C(),O()},15e3);return()=>clearInterval(e)},[C,O]);let E=async()=>{if(confirm("Reset all circuit breakers to healthy state? This will clear all failure counts and restore all providers to operational status.")){S(!0);try{let e=await fetch("/api/monitoring/health",{method:"DELETE"});if(!e.ok)throw Error(`HTTP ${e.status}`);await C(),await O()}catch(e){console.error("Failed to reset health:",e)}finally{S(!1)}}},L=e=>null!=e?`${Math.round(e)}ms`:"—";if(!h&&!u)return(0,a.jsx)("div",{className:"p-6 flex items-center justify-center min-h-[400px]",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),(0,a.jsx)("p",{className:"text-text-muted mt-4",children:"Loading health data..."})]})});if(u&&!h)return(0,a.jsx)("div",{className:"p-6",children:(0,a.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-xl p-6 text-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2",children:"error"}),(0,a.jsxs)("p",{className:"text-red-400",children:["Failed to load health data: ",u]}),(0,a.jsx)("button",{onClick:C,className:"mt-4 px-4 py-2 rounded-lg bg-primary/10 text-primary text-sm hover:bg-primary/20 transition-colors",children:"Retry"})]})});let{system:R,providerHealth:D,rateLimitStatus:_,lockouts:z}=h,F=Object.entries(D||{}),T=Object.entries(z||{});return(0,a.jsxs)("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-text-main",children:"System Health"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Real-time monitoring of your OmniRoute instance"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[b&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Updated ",b.toLocaleTimeString()]}),(0,a.jsx)("button",{onClick:()=>{C(),O()},className:"p-2 rounded-lg bg-surface hover:bg-surface/80 text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"refresh"})})]})]}),(0,a.jsxs)("div",{role:"status","aria-live":"polite",className:`rounded-xl p-4 flex items-center gap-3 ${"healthy"===h.status?"bg-green-500/10 border border-green-500/20":"bg-red-500/10 border border-red-500/20"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[24px] ${"healthy"===h.status?"text-green-500":"text-red-500"}`,children:"healthy"===h.status?"check_circle":"error"}),(0,a.jsx)("span",{className:"healthy"===h.status?"text-green-400":"text-red-400",children:"healthy"===h.status?"All systems operational":"System issues detected"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-primary/10 text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"timer"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Uptime"})]}),(0,a.jsx)("p",{className:"text-xl font-semibold text-text-main",children:(t=Math.floor((e=R.uptime)/86400),s=Math.floor(e%86400/3600),x=Math.floor(e%3600/60),t>0?`${t}d ${s}h ${x}m`:s>0?`${s}h ${x}m`:`${x}m`)})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-blue-500/10 text-blue-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"info"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Version"})]}),(0,a.jsxs)("p",{className:"text-xl font-semibold text-text-main",children:["v",R.version]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Node ",R.nodeVersion]})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-purple-500/10 text-purple-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"memory"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Memory (RSS)"})]}),(0,a.jsx)("p",{className:"text-xl font-semibold text-text-main",children:n(R.memoryUsage?.rss||0)}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Heap: ",n(R.memoryUsage?.heapUsed||0)," /"," ",n(R.memoryUsage?.heapTotal||0)]})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-amber-500/10 text-amber-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"dns"})}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Providers"})]}),(0,a.jsx)("p",{className:"text-xl font-semibold text-text-main",children:F.length}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:[F.filter(([,e])=>"CLOSED"===e.state).length," healthy"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-text-muted mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"speed"}),"Latency"]}),g?(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"p50"}),(0,a.jsx)("span",{className:"font-mono",children:L(g.p50)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"p95"}),(0,a.jsx)("span",{className:"font-mono",children:L(g.p95)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"p99"}),(0,a.jsx)("span",{className:"font-mono",children:L(g.p99)})]}),(0,a.jsxs)("div",{className:"flex justify-between border-t border-border pt-2 mt-2",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Total requests"}),(0,a.jsx)("span",{className:"font-mono",children:g.totalRequests??0})]})]}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No data yet"})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-text-muted mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"cached"}),"Prompt Cache"]}),y?(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Entries"}),(0,a.jsxs)("span",{className:"font-mono",children:[y.size,"/",y.maxSize]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Hit Rate"}),(0,a.jsxs)("span",{className:"font-mono",children:[y.hitRate?.toFixed(1)??0,"%"]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Hits / Misses"}),(0,a.jsxs)("span",{className:"font-mono",children:[y.hits??0," / ",y.misses??0]})]})]}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No data yet"})]}),(0,a.jsxs)(r.Zp,{className:"p-4",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-text-muted mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"database"}),"Signature Cache"]}),w?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{label:"Defaults",value:w.defaultCount,color:"text-text-muted"},{label:"Tool",value:`${w.tool.entries}/${w.tool.patterns}`,color:"text-blue-400"},{label:"Family",value:`${w.family.entries}/${w.family.patterns}`,color:"text-purple-400"},{label:"Session",value:`${w.session.entries}/${w.session.patterns}`,color:"text-cyan-400"}].map(({label:e,value:t,color:s})=>(0,a.jsxs)("div",{className:"text-center p-2 rounded-lg bg-surface/30 border border-border/30",children:[(0,a.jsx)("p",{className:`text-lg font-bold tabular-nums ${s}`,children:t}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e})]},e))}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No data yet"})]})]}),(0,a.jsxs)(r.Zp,{className:"p-5",role:"region","aria-label":"Provider health status",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] text-primary",children:"health_and_safety"}),"Provider Health"]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[F.some(([,e])=>"CLOSED"!==e.state)&&(0,a.jsx)("button",{onClick:E,disabled:k,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold transition-all ${k?"bg-surface/50 text-text-muted cursor-wait":"bg-red-500/10 text-red-400 hover:bg-red-500/20 hover:text-red-300 border border-red-500/20"}`,title:"Reset all circuit breakers to healthy state",children:k?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] animate-spin",children:"progress_activity"}),"Resetting..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"}),"Reset All"]})}),F.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-green-500"})," Healthy"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-amber-500"})," Recovering"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-red-500"})," Down"]})]})]})]}),0===F.length?(0,a.jsx)("p",{className:"text-sm text-text-muted text-center py-4",children:"No circuit breaker data available. Make some requests first."}):(d=F.filter(([,e])=>"CLOSED"!==e.state),m=F.filter(([,e])=>"CLOSED"===e.state),(0,a.jsxs)("div",{className:"space-y-4",children:[d.length>0&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-red-400 uppercase tracking-wide",children:"Issues Detected"}),d.map(([e,t])=>{let s=c[t.state]||c.OPEN,l=i.Q2[e],r=l?.name||e;return(0,a.jsxs)("div",{className:`rounded-lg p-3 ${s.bg} border border-white/5 flex items-center gap-3`,children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0 text-xs font-bold",style:{backgroundColor:`${l?.color||"#888"}15`,color:l?.color||"#888"},children:l?.textIcon||e.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"flex-1 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:r}),(0,a.jsx)("span",{className:`text-xs font-semibold px-1.5 py-0.5 rounded ${s.bg} ${s.text}`,children:s.label})]}),(0,a.jsxs)("div",{className:"text-xs text-text-muted mt-0.5",children:[t.failures," failure",1!==t.failures?"s":"",t.lastFailure&&(0,a.jsxs)("span",{className:"ml-2",children:["\xb7 Last: ",new Date(t.lastFailure).toLocaleTimeString()]})]})]})]},e)})]}),m.length>0&&(0,a.jsxs)("div",{children:[d.length>0&&(0,a.jsx)("p",{className:"text-xs font-medium text-green-400 uppercase tracking-wide mb-2",children:"Operational"}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-2",children:m.map(([e])=>{let t=i.Q2[e],s=t?.name||e;return(0,a.jsxs)("div",{className:"rounded-lg p-2.5 bg-green-500/5 border border-white/5 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-green-500 shrink-0"}),(0,a.jsx)("span",{className:"text-xs font-medium text-text-main truncate",title:s,children:s})]},e)})})]})]}))]}),_&&Object.keys(_).length>0&&((o=Object.entries(_).map(([e,t])=>({key:e,...(e=>{let t,s=e.split(":"),a=s[0],l=s[1]||"",r=s.slice(2).join(":")||null,n=i.Q2[a];if(a.startsWith("openai-compatible-")){let e=a.replace("openai-compatible-","");t="OpenAI Compatible",n={color:"#10A37F",textIcon:"OC"},e.length>12?t+=` (${e.slice(0,8)}…)`:e&&(t+=` (${e})`)}else if(a.startsWith("anthropic-compatible-")){let e=a.replace("anthropic-compatible-","");t="Anthropic Compatible",n={color:"#D97757",textIcon:"AC"},e.length>12?t+=` (${e.slice(0,8)}…)`:e&&(t+=` (${e})`)}else t=n?.name||a;return{providerId:a,displayName:t,providerInfo:n,connectionId:l,model:r}})(e),status:t}))).sort((e,t)=>{let s=(e.status.queued||0)+(e.status.running||0),a=(t.status.queued||0)+(t.status.running||0);return s!==a?a-s:e.displayName.localeCompare(t.displayName)}),(0,a.jsxs)(r.Zp,{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] text-amber-500",children:"speed"}),"Rate Limit Status"]}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[o.length," active limiter",1!==o.length?"s":""]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:o.map(({key:e,displayName:t,providerInfo:s,connectionId:l,model:r,status:i})=>{let n=(i.queued||0)+(i.running||0)>0,c=(i.queued||0)>0;return(0,a.jsxs)("div",{className:`rounded-lg p-3 border transition-colors ${c?"bg-amber-500/5 border-amber-500/20":n?"bg-blue-500/5 border-blue-500/15":"bg-surface/30 border-white/5"}`,title:e,children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 mb-2",children:[(0,a.jsx)("div",{className:"size-7 rounded-md flex items-center justify-center shrink-0 text-[10px] font-bold",style:{backgroundColor:`${s?.color||"#888"}15`,color:s?.color||"#888"},children:s?.textIcon||t.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-text-main truncate",children:t}),l&&(0,a.jsxs)("p",{className:"text-[10px] text-text-muted font-mono truncate",children:[l.length>12?l.slice(0,8)+"…":l,r&&(0,a.jsxs)("span",{className:"ml-1 text-text-muted/60",children:["\xb7 ",r]})]})]}),(0,a.jsx)("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold ${c?"bg-amber-500/15 text-amber-400":n?"bg-blue-500/15 text-blue-400":"bg-green-500/10 text-green-400"}`,children:c?"Queued":n?"Active":"OK"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-[11px] text-text-muted",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"schedule"}),i.queued||0," queued"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"play_arrow"}),i.running||0," running"]})]})]},e)})})]})),T.length>0&&(0,a.jsxs)(r.Zp,{className:"p-5",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-text-main mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] text-red-500",children:"lock"}),"Active Lockouts"]}),(0,a.jsx)("div",{className:"space-y-2",children:T.map(([e,t])=>(0,a.jsxs)("div",{className:"rounded-lg p-3 bg-red-500/5 border border-red-500/10 flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main",children:e}),t.reason&&(0,a.jsxs)("span",{className:"text-xs text-text-muted ml-2",children:["(",t.reason,")"]})]}),t.until&&(0,a.jsxs)("span",{className:"text-xs text-red-400",children:["Until ",new Date(t.until).toLocaleTimeString()]})]},e))})]})]})}},39449:(e,t,s)=>{Promise.resolve().then(s.bind(s,32424))}},e=>{e.O(0,[8500,9751,782,1149,5846,993,8441,3794,7358],()=>e(e.s=39449)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1066],{39387:(e,t,s)=>{Promise.resolve().then(s.bind(s,73732))},73732:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var a=s(95155),r=s(12115),l=s(40993),n=s(5772),i=s(35144);function c(e){let t="string"==typeof e?e.trim():"";if(!t)return{key:"unknown",label:"Unknown",variant:"default",rank:0,raw:null};let s=t.toUpperCase();return s.includes("ENTERPRISE")||s.includes("CORP")||s.includes("ORG")?{key:"enterprise",label:"Enterprise",variant:"info",rank:6,raw:t}:s.includes("BUSINESS")||s.includes("TEAM")||s.includes("STANDARD")?{key:"business",label:"Business",variant:"warning",rank:5,raw:t}:s.includes("ULTRA")?{key:"ultra",label:"Ultra",variant:"success",rank:4,raw:t}:s.includes("PRO")||s.includes("PLUS")||s.includes("PREMIUM")||s.includes("PAID")?{key:"pro",label:"Pro",variant:"primary",rank:3,raw:t}:s.includes("FREE")||s.includes("INDIVIDUAL")||s.includes("BASIC")||s.includes("TRIAL")||s.includes("LEGACY")?{key:"free",label:"Free",variant:"default",rank:1,raw:t}:{key:"unknown",label:t.toLowerCase().split(/[\s_-]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")||"Unknown",variant:"default",rank:0,raw:t}}var o=s(81060),d=s(80927),x=s(92542),u=s(20909);let m={antigravity:{label:"Antigravity",color:"#F59E0B"},github:{label:"GitHub Copilot",color:"#333"},kiro:{label:"Kiro AI",color:"#FF6B35"},codex:{label:"OpenAI Codex",color:"#10A37F"},claude:{label:"Claude Code",color:"#D97757"}},p=[{key:"all",label:"All"},{key:"enterprise",label:"Enterprise"},{key:"business",label:"Business"},{key:"ultra",label:"Ultra"},{key:"pro",label:"Pro"},{key:"free",label:"Free"},{key:"unknown",label:"Unknown"}];function h(){let[e,t]=(0,r.useState)([]),[s,l]=(0,r.useState)({}),[h,f]=(0,r.useState)({}),[b,g]=(0,r.useState)({}),[j,y]=(0,r.useState)(!0),[v,N]=(0,r.useState)(null),[k,w]=(0,r.useState)(!1),[A,E]=(0,r.useState)(120),[C,S]=(0,r.useState)(!0),[I,q]=(0,r.useState)("all"),M=(0,r.useRef)(null),P=(0,r.useRef)(null),$=(0,r.useRef)({}),T=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/providers/client");if(!e.ok)throw Error("Failed");let s=(await e.json()).connections||[];return t(s),s}catch{return t([]),[]}},[]),R=(0,r.useCallback)(async(e,t)=>{let s=Date.now();if(!(s-($.current[e]||0)<3e4)){$.current[e]=s,f(t=>({...t,[e]:!0})),g(t=>({...t,[e]:null}));try{let s=await fetch(`/api/usage/${e}`);if(!s.ok){let t=(await s.json().catch(()=>({}))).error||s.statusText;if(404===s.status)return;if(401===s.status)return void l(s=>({...s,[e]:{quotas:[],message:t}}));throw Error(`HTTP ${s.status}: ${t}`)}let a=await s.json(),r=function(e,t){if(!t||"object"!=typeof t)return[];let s=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"claude":t.message?s.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{s.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,i.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));s.sort((t,s)=>{let a=t.modelKey||t.name,r=s.modelKey||s.name;return(e.get(a)??999)-(e.get(r)??999)})}return s}(t,a);l(t=>({...t,[e]:{quotas:r,plan:a.plan||null,message:a.message||null,raw:a}}))}catch(t){g(s=>({...s,[e]:t.message||"Failed to fetch quota"}))}finally{f(t=>({...t,[e]:!1}))}}},[]),_=(0,r.useCallback)(async(e,t)=>{await R(e,t),N(new Date)},[R]),L=(0,r.useCallback)(async()=>{if(!k){w(!0),E(120);try{let e=(await T()).filter(e=>u.wb.includes(e.provider)&&"oauth"===e.authType);await Promise.all(e.map(e=>R(e.id,e.provider))),N(new Date)}catch(e){console.error("Error refreshing all:",e)}finally{w(!1)}}},[k,T,R]);(0,r.useEffect)(()=>{(async()=>{S(!0),await L(),S(!1)})()},[]),(0,r.useEffect)(()=>{if(!j){M.current&&clearInterval(M.current),P.current&&clearInterval(P.current);return}return M.current=setInterval(L,12e4),P.current=setInterval(()=>{E(e=>e<=1?120:e-1)},1e3),()=>{M.current&&clearInterval(M.current),P.current&&clearInterval(P.current)}},[j,L]),(0,r.useEffect)(()=>{let e=()=>{document.hidden?(M.current&&clearInterval(M.current),P.current&&clearInterval(P.current)):j&&(M.current=setInterval(L,12e4),P.current=setInterval(()=>{E(e=>e<=1?120:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[j,L]);let O=(0,r.useMemo)(()=>e.filter(e=>u.wb.includes(e.provider)&&"oauth"===e.authType),[e]),D=(0,r.useMemo)(()=>{let e={antigravity:1,github:2,codex:3,claude:4,kiro:5};return[...O].sort((t,s)=>(e[t.provider]||9)-(e[s.provider]||9))},[O]),U=(0,r.useMemo)(()=>{let e={};for(let t of D)e[t.id]=c(s[t.id]?.plan);return e},[D,s]),F=(0,r.useMemo)(()=>{let e={all:D.length,enterprise:0,business:0,ultra:0,pro:0,free:0,unknown:0};for(let t of D){let s=U[t.id]?.key||"unknown";e[s]=(e[s]||0)+1}return e},[D,U]),B=(0,r.useMemo)(()=>"all"===I?D:D.filter(e=>(U[e.id]?.key||"unknown")===I),[D,U,I]);return C?(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(x.CardSkeleton,{}),(0,a.jsx)(x.CardSkeleton,{})]}):0===D.length?(0,a.jsx)(o.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] opacity-15",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-main",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-[400px] mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main m-0",children:"Provider Limits"}),(0,a.jsxs)("span",{className:"text-[13px] text-text-muted",children:[B.length," account",1!==B.length?"s":"",B.length!==D.length?` (filtered from ${D.length})`:""]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>y(e=>!e),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-white/[0.08] bg-transparent cursor-pointer text-text-main text-[13px]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:{color:j?"#22c55e":"var(--text-muted)"},children:j?"toggle_on":"toggle_off"}),"Auto-refresh",j&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["(",A,"s)"]})]}),(0,a.jsxs)("button",{onClick:L,disabled:k,className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-lg bg-white/[0.06] border border-white/10 text-text-main text-[13px] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${k?"animate-spin":""}`,children:"refresh"}),"Refresh All"]})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:p.map(e=>{if("all"!==e.key&&!F[e.key])return null;let t=I===e.key;return(0,a.jsxs)("button",{onClick:()=>q(e.key),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold cursor-pointer",style:{border:t?"1px solid var(--primary, #E54D5E)":"1px solid rgba(255,255,255,0.12)",background:t?"rgba(249,120,21,0.14)":"transparent",color:t?"var(--primary, #E54D5E)":"var(--text-muted)"},children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{className:"opacity-85",children:F[e.key]||0})]},e.key)})}),(0,a.jsxs)("div",{className:"rounded-xl border border-white/[0.06] overflow-hidden bg-black/15",children:[(0,a.jsxs)("div",{className:"items-center px-4 py-2.5 border-b border-white/[0.06] text-[11px] font-semibold uppercase tracking-wider text-text-muted",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px"},children:[(0,a.jsx)("div",{children:"Account"}),(0,a.jsx)("div",{children:"Model Quotas"}),(0,a.jsx)("div",{className:"text-center",children:"Last Used"}),(0,a.jsx)("div",{className:"text-center",children:"Actions"})]}),B.map((e,t)=>{let r=s[e.id],l=h[e.id],i=b[e.id],o=m[e.provider]||{label:e.provider,color:"#666"},x=U[e.id]||c(null);return(0,a.jsxs)("div",{className:"items-center px-4 py-3.5 transition-[background] duration-150 hover:bg-white/[0.02]",style:{display:"grid",gridTemplateColumns:"280px 1fr 100px 48px",borderBottom:t<B.length-1?"1px solid rgba(255,255,255,0.04)":"none"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center overflow-hidden shrink-0",children:(0,a.jsx)(n.default,{src:`/providers/${e.provider}.png`,alt:e.provider,width:32,height:32,className:"object-contain",sizes:"32px"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-[13px] font-semibold text-text-main truncate",children:e.name||o.label}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,a.jsx)("span",{title:r?.plan?`Raw plan: ${r.plan}`:"No plan from provider",children:(0,a.jsx)(d.default,{variant:x.variant,size:"sm",dot:!0,children:x.label})}),(0,a.jsx)("span",{className:"text-[11px] text-text-muted",children:o.label})]})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1.5 pr-3",children:l?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted text-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),"Loading..."]}):i?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,a.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-[300px]",children:i})]}):r?.message&&(!r.quotas||0===r.quotas.length)?(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:r.message}):r?.quotas?.length>0?r.quotas.map((e,t)=>{var s,r,l;let n=void 0!==e.remainingPercentage?Math.round(e.remainingPercentage):(s=e.used,(r=e.total)&&0!==r?!s||s<0?100:s>=r?0:Math.round((r-s)/r*100):0),i=n>70?{bar:"#22c55e",text:"#22c55e",bg:"rgba(34,197,94,0.12)"}:n>=30?{bar:"#eab308",text:"#eab308",bg:"rgba(234,179,8,0.12)"}:{bar:"#ef4444",text:"#ef4444",bg:"rgba(239,68,68,0.12)"},c=function(e){if(!e)return null;try{let t=new Date(e)-new Date;if(t<=0)return null;let s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);if(s>=24){let e=Math.floor(s/24);return`${e}d ${s%24}h`}return`${s}h ${a}m`}catch{return null}}(e.resetAt),o={"gemini-3-pro-high":"G3 Pro","gemini-3-pro-low":"G3 Pro Low","gemini-3-flash":"G3 Flash","gemini-2.5-flash":"G2.5 Flash","claude-opus-4-6-thinking":"Opus 4.6 Tk","claude-opus-4-5-thinking":"Opus 4.5 Tk","claude-opus-4-5":"Opus 4.5","claude-sonnet-4-5-thinking":"Sonnet 4.5 Tk","claude-sonnet-4-5":"Sonnet 4.5",chat:"Chat",completions:"Completions",premium_interactions:"Premium",session:"Session",weekly:"Weekly",agentic_request:"Agentic",agentic_request_freetrial:"Agentic (Trial)"}[l=e.name]||l;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-[200px] shrink-0",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold py-0.5 px-2 rounded whitespace-nowrap min-w-[60px] text-center",style:{background:i.bg,color:i.text},children:o}),c&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted whitespace-nowrap",children:["⏱ ",c]}),(0,a.jsx)("div",{className:"flex-1 h-1.5 rounded-sm bg-white/[0.06] min-w-[60px] overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-sm transition-[width] duration-300 ease-out",style:{width:`${Math.min(n,100)}%`,background:i.bar}})}),(0,a.jsxs)("span",{className:"text-[11px] font-semibold min-w-[32px] text-right",style:{color:i.text},children:[n,"%"]})]},t)}):(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:"No quota data"})}),(0,a.jsx)("div",{className:"text-center text-[11px] text-text-muted",children:v?(0,a.jsx)("span",{children:v.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}):"-"}),(0,a.jsx)("div",{className:"flex justify-center gap-0.5",children:(0,a.jsx)("button",{onClick:()=>_(e.id,e.provider),disabled:l,title:"Refresh quota",className:"p-1 rounded-md border-none bg-transparent cursor-pointer disabled:cursor-not-allowed disabled:opacity-30 opacity-60 hover:opacity-100 flex items-center justify-center transition-opacity duration-150",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] text-text-muted ${l?"animate-spin":""}`,children:"refresh"})})})]},e.id)}),0===B.length&&(0,a.jsxs)("div",{className:"py-6 px-4 text-center text-text-muted text-[13px]",children:["No accounts found for tier filter"," ",(0,a.jsx)("strong",{children:p.find(e=>e.key===I)?.label||I}),"."]})]})]})}function f(){let[e,t]=(0,r.useState)({lockouts:[],cacheStats:null}),[s,n]=(0,r.useState)(!0),i=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/rate-limits");e.ok&&t(await e.json())}catch{}finally{n(!1)}},[]);return(0,r.useEffect)(()=>{i();let e=setInterval(i,1e4);return()=>clearInterval(e)},[i]),(0,a.jsx)("div",{className:"flex flex-col gap-4",children:(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"lock_clock"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Model Lockouts"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Per-model rate limit locks • Auto-refresh 10s"})]}),e.lockouts.length>0&&(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded-full text-xs font-semibold bg-orange-500/10 text-orange-400 border border-orange-500/20",children:[e.lockouts.length," locked"]})]}),0===e.lockouts.length?(0,a.jsxs)("div",{className:"text-center py-6 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] mb-2 block opacity-40",children:"lock_open"}),(0,a.jsx)("p",{className:"text-sm",children:"No models currently locked"})]}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:e.lockouts.map((e,t)=>{var s;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 rounded-lg bg-orange-500/5 border border-orange-500/15",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-orange-400",children:"lock"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.model}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Account:"," ",(0,a.jsx)("span",{className:"font-mono",children:e.accountId?.slice(0,12)||"N/A"}),e.reason&&(0,a.jsxs)(a.Fragment,{children:[" — ",e.reason]})]})]})]}),(0,a.jsxs)("span",{className:"text-xs font-mono tabular-nums text-orange-400",children:[(s=e.remainingMs)<1e3?`${s}ms`:s<6e4?`${Math.ceil(s/1e3)}s`:`${Math.ceil(s/6e4)}m`," left"]})]},t)})})]})})}function b(){let[e,t]=(0,r.useState)({count:0,sessions:[]}),[s,n]=(0,r.useState)(!0),i=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/sessions");e.ok&&t(await e.json())}catch{}finally{n(!1)}},[]);return(0,r.useEffect)(()=>{i();let e=setInterval(i,5e3);return()=>clearInterval(e)},[i]),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"fingerprint"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Active Sessions"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tracked via request fingerprinting • Auto-refresh 5s"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-cyan-500/10 border border-cyan-500/20",children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-500 animate-pulse"}),(0,a.jsx)("span",{className:"text-sm font-semibold tabular-nums text-cyan-400",children:e.count})]})})]}),0===e.sessions.length?(0,a.jsxs)("div",{className:"text-center py-8 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[40px] mb-2 block opacity-40",children:"fingerprint"}),(0,a.jsx)("p",{className:"text-sm",children:"No active sessions"}),(0,a.jsx)("p",{className:"text-xs mt-1",children:"Sessions appear as requests flow through the proxy"})]}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border/30",children:[(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Session"}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Age"}),(0,a.jsx)("th",{className:"text-right py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Requests"}),(0,a.jsx)("th",{className:"text-left py-2 px-3 text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Connection"})]})}),(0,a.jsx)("tbody",{children:e.sessions.map(e=>{var t;return(0,a.jsxs)("tr",{className:"border-b border-border/10 hover:bg-surface/20 transition-colors",children:[(0,a.jsx)("td",{className:"py-2.5 px-3",children:(0,a.jsxs)("span",{className:"font-mono text-xs px-2 py-1 rounded bg-surface/40 text-text-muted",children:[e.sessionId.slice(0,12),"…"]})}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-text-muted tabular-nums",children:(t=e.ageMs)<6e4?`${Math.floor(t/1e3)}s`:t<36e5?`${Math.floor(t/6e4)}m`:`${Math.floor(t/36e5)}h`}),(0,a.jsx)("td",{className:"py-2.5 px-3 text-right",children:(0,a.jsx)("span",{className:"font-semibold tabular-nums",children:e.requestCount})}),(0,a.jsx)("td",{className:"py-2.5 px-3",children:e.connectionId?(0,a.jsx)("span",{className:"text-xs font-mono text-cyan-400",children:e.connectionId.slice(0,10)}):(0,a.jsx)("span",{className:"text-text-muted/40",children:"—"})})]},e.sessionId)})})]})})]})}function g(){return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(l.Qv,{}),children:(0,a.jsx)(h,{})}),(0,a.jsx)(f,{}),(0,a.jsx)(b,{})]})}}},e=>{e.O(0,[8500,9751,782,1149,5846,993,8441,3794,7358],()=>e(e.s=39387)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9971],{4051:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var r=s(95155),i=s(12115),a=s(73321);let n=[{id:"welcome",title:"Welcome",icon:"waving_hand"},{id:"security",title:"Security",icon:"lock"},{id:"provider",title:"Provider",icon:"dns"},{id:"test",title:"Test",icon:"play_circle"},{id:"done",title:"Ready!",icon:"check_circle"}],o=[{id:"openai",name:"OpenAI",color:"#10A37F"},{id:"anthropic",name:"Anthropic",color:"#D97757"},{id:"google",name:"Google AI",color:"#4285F4"},{id:"openrouter",name:"OpenRouter",color:"#6B21A8"},{id:"groq",name:"Groq",color:"#F55036"},{id:"mistral",name:"Mistral",color:"#FF7000"}];function c(){let e=(0,a.useRouter)(),[t,s]=(0,i.useState)(0),[c,l]=(0,i.useState)(!0),[d,m]=(0,i.useState)(""),[x,u]=(0,i.useState)(""),[p,h]=(0,i.useState)(!1),[g,y]=(0,i.useState)(null),[b,f]=(0,i.useState)(""),[j,v]=(0,i.useState)(""),[N,w]=(0,i.useState)(""),[k,C]=(0,i.useState)("idle"),[S,P]=(0,i.useState)("");(0,i.useEffect)(()=>{(async()=>{try{let t=await fetch("/api/settings");if(t.ok&&(await t.json()).setupComplete)return void e.replace("/dashboard")}catch{}l(!1)})()},[e]);let A=n[t],O=t===n.length-1,T=()=>{t<n.length-1&&s(t+1)},_=async()=>{if(p)return void T();if(d===x)try{await fetch("/api/settings/require-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:!0,password:d})}),T()}catch{T()}},R=async()=>{if(g&&j)try{let e=o.find(e=>e.id===g);await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:g,name:N||e?.name||g,url:b||({openai:"https://api.openai.com",anthropic:"https://api.anthropic.com",google:"https://generativelanguage.googleapis.com",openrouter:"https://openrouter.ai/api",groq:"https://api.groq.com/openai",mistral:"https://api.mistral.ai"})[g]||"",apiKey:j,isActive:!0})}),T()}catch{T()}},I=async()=>{C("testing"),P("Testing connection...");try{let e=await fetch("/api/providers");if(!e.ok)throw Error("Failed to fetch");let t=await e.json(),s=t.connections?.[0];if(!s){C("error"),P("No provider found. You can add one from the dashboard later.");return}let r=await fetch(`/api/providers/${s.id}/test`,{method:"POST"});if(r.ok)C("success"),P("Connection successful! Your provider is ready.");else{let e=await r.json().catch(()=>({}));C("error"),P(e.error||"Test failed, but you can configure this later.")}}catch{C("error"),P("Could not test right now. You can test from the dashboard.")}},q=async()=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({setupComplete:!0})})}catch{}e.push("/dashboard")};return c?(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,r.jsx)("div",{className:"animate-pulse text-text-muted",children:"Loading..."})}):(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-4",children:(0,r.jsxs)("div",{className:"w-full max-w-lg",children:[(0,r.jsx)("div",{className:"flex items-center justify-center gap-2 mb-8",children:n.map((e,s)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-semibold transition-all duration-300 ${s<t?"bg-green-500/20 text-green-400":s===t?"bg-primary/20 text-primary ring-2 ring-primary/40":"bg-white/5 text-text-muted"}`,children:s<t?(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"check"}):s+1}),s<n.length-1&&(0,r.jsx)("div",{className:`w-8 h-0.5 rounded-full transition-colors ${s<t?"bg-green-500/40":"bg-white/10"}`})]},e.id))}),(0,r.jsxs)("div",{className:"bg-surface rounded-2xl border border-white/[0.06] p-8 shadow-xl",children:[(0,r.jsxs)("div",{className:"text-center mb-6",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[48px] mb-3 block ${"done"===A.id?"text-green-400":"text-primary"}`,children:A.icon}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-text-main mb-1",children:A.title})]}),(0,r.jsxs)("div",{className:"min-h-[200px]",children:["welcome"===A.id&&(0,r.jsxs)("div",{className:"text-center space-y-4",children:[(0,r.jsxs)("p",{className:"text-text-muted",children:[(0,r.jsx)("strong",{className:"text-text-main",children:"OmniRoute"})," is your local AI API proxy. It routes requests to multiple AI providers with load balancing, failover, and usage tracking."]}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-3 mt-6",children:[{icon:"swap_horiz",label:"Multi-Provider"},{icon:"monitoring",label:"Usage Tracking"},{icon:"shield",label:"API Key Mgmt"}].map(e=>(0,r.jsxs)("div",{className:"bg-white/[0.03] rounded-xl p-3 text-center border border-white/[0.06]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[24px] mb-1 block",children:e.icon}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:e.label})]},e.icon))})]}),"security"===A.id&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted text-center",children:"Set a password to protect your dashboard, or skip for now."}),(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-sm text-text-muted",children:[(0,r.jsx)("input",{type:"checkbox",checked:p,onChange:e=>h(e.target.checked),className:"accent-primary"}),"Skip password setup"]}),!p&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("input",{type:"password",placeholder:"Enter password",value:d,onChange:e=>m(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,r.jsx)("input",{type:"password",placeholder:"Confirm password",value:x,onChange:e=>u(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"}),d&&x&&d!==x&&(0,r.jsx)("p",{className:"text-xs text-red-400",children:"Passwords do not match"})]})]}),"provider"===A.id&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted text-center",children:"Connect your first AI provider. You can add more later."}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:o.map(e=>(0,r.jsx)("button",{onClick:()=>{y(e.id),w(e.name)},className:`p-3 rounded-xl border text-center text-xs font-medium transition-all cursor-pointer ${g===e.id?"border-primary/60 bg-primary/10 text-primary":"border-white/10 bg-white/[0.03] text-text-muted hover:border-white/20"}`,children:e.name},e.id))}),g&&(0,r.jsxs)("div",{className:"space-y-3 mt-4",children:[(0,r.jsx)("input",{type:"password",placeholder:"API Key (required)",value:j,onChange:e=>v(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,r.jsx)("input",{type:"text",placeholder:"Custom URL (optional)",value:b,onChange:e=>f(e.target.value),className:"w-full px-4 py-2.5 bg-white/[0.04] border border-white/10 rounded-lg text-text-main text-sm placeholder:text-text-muted/50 focus:outline-none focus:ring-2 focus:ring-primary/40"})]})]}),"test"===A.id&&(0,r.jsxs)("div",{className:"text-center space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Let's verify your provider connection works."}),"idle"===k&&(0,r.jsx)("button",{onClick:I,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors cursor-pointer",children:"Run Connection Test"}),"testing"===k&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:S})]}),"success"===k&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-green-400",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"check_circle"}),(0,r.jsx)("span",{className:"text-sm",children:S})]}),"error"===k&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-amber-400",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"warning"}),(0,r.jsx)("span",{className:"text-sm",children:S})]}),(0,r.jsx)("button",{onClick:I,className:"text-xs text-text-muted underline cursor-pointer",children:"Retry"})]})]}),"done"===A.id&&(0,r.jsxs)("div",{className:"text-center space-y-4",children:[(0,r.jsx)("p",{className:"text-text-muted",children:"You're all set! Your OmniRoute instance is configured and ready to proxy AI requests."}),(0,r.jsxs)("div",{className:"bg-white/[0.03] rounded-xl p-4 border border-white/[0.06] text-left",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2 font-medium",children:"Your endpoint:"}),(0,r.jsx)("code",{className:"text-sm text-primary",children:"http://localhost:20128/api/v1"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-white/[0.06]",children:[(0,r.jsx)("div",{children:t>0&&!O&&(0,r.jsx)("button",{onClick:()=>{t>0&&s(t-1)},className:"px-4 py-2 text-sm text-text-muted hover:text-text-main transition-colors cursor-pointer",children:"Back"})}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[!O&&t>0&&(0,r.jsx)("button",{onClick:T,className:"px-4 py-2 text-sm text-text-muted hover:text-text-main transition-colors cursor-pointer",children:"Skip"}),"welcome"===A.id&&(0,r.jsx)("button",{onClick:T,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors cursor-pointer",children:"Get Started"}),"security"===A.id&&(0,r.jsx)("button",{onClick:_,disabled:!p&&(!d||d!==x),className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:p?"Skip & Continue":"Set Password"}),"provider"===A.id&&(0,r.jsx)("button",{onClick:R,disabled:!g||!j,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:"Add Provider"}),"test"===A.id&&(0,r.jsx)("button",{onClick:T,className:"px-6 py-2.5 bg-primary rounded-lg text-white font-medium text-sm hover:bg-primary/90 transition-colors cursor-pointer",children:"success"===k?"Continue":"Skip"}),O&&(0,r.jsx)("button",{onClick:q,className:"px-6 py-2.5 bg-green-500 rounded-lg text-white font-medium text-sm hover:bg-green-500/90 transition-colors cursor-pointer",children:"Go to Dashboard →"})]})]})]}),!O&&(0,r.jsx)("div",{className:"text-center mt-4",children:(0,r.jsx)("button",{onClick:q,className:"text-xs text-text-muted/60 hover:text-text-muted transition-colors cursor-pointer",children:"Skip wizard entirely"})})]})})}},73321:(e,t,s)=>{"use strict";var r=s(74645);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},89848:(e,t,s)=>{Promise.resolve().then(s.bind(s,4051))}},e=>{e.O(0,[8441,3794,7358],()=>e(e.s=89848)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6337],{7153:(e,s,t)=>{Promise.resolve().then(t.bind(t,49433))},49433:(e,s,t)=>{"use strict";t.d(s,{default:()=>h});var r=t(95155),l=t(12115),a=t(14051),i=t.n(a),n=t(5772),o=t(98500),d=t.n(o),c=t(73321),x=t(40993),m=t(20909),u=t(67671);function h({machineId:e}){let[s,t]=(0,l.useState)([]),[a,i]=(0,l.useState)([]),[n,o]=(0,l.useState)(!0),[c,u]=(0,l.useState)("/v1"),[h,f]=(0,l.useState)(null),[g,j]=(0,l.useState)({});(0,l.useEffect)(()=>{u(`${window.location.origin}/v1`)},[]);let v=(0,l.useCallback)(async()=>{try{let[e,s,r]=await Promise.all([fetch("/api/providers"),fetch("/api/models"),fetch("/api/provider-metrics")]);if(e.ok){let s=await e.json();t(s.connections||[])}if(s.ok){let e=await s.json();i(e.models||[])}if(r.ok){let e=await r.json();j(e.metrics||{})}}catch(e){console.log("Error fetching data:",e)}finally{o(!1)}},[]);(0,l.useEffect)(()=>{v()},[v]);let N=(0,l.useMemo)(()=>Object.entries(m.Q2).map(([e,t])=>{let r=s.filter(s=>s.provider===e),l=r.filter(e=>!1!==e.isActive&&("active"===e.testStatus||"success"===e.testStatus||"unknown"===e.testStatus)).length,i=r.filter(e=>!1!==e.isActive&&("error"===e.testStatus||"expired"===e.testStatus||"unavailable"===e.testStatus)).length,n=new Set([e,t.alias].filter(Boolean)),o=a.filter(e=>n.has(e.provider)),d=m.IS[e]?"free":m.zN[e]?"oauth":"apikey";return{id:e,provider:t,total:r.length,connected:l,errors:i,modelCount:o.length,authType:d}}),[s,a]),y=(0,l.useMemo)(()=>{if(!h)return[];let e=new Set([h.id,h.provider?.alias].filter(Boolean));return a.filter(s=>e.has(s.provider))},[h,a]);return n?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(x.Qv,{}),(0,r.jsx)(x.Qv,{})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(x.Zp,{children:(0,r.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Quick Start"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Get up and running in 4 steps. Connect providers, route models, monitor everything."})]}),(0,r.jsxs)(d(),{href:"/docs",className:"hidden sm:inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"menu_book"}),"Full Docs"]})]}),(0,r.jsxs)("ol",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-primary/10 text-primary shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"key"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:"1. Create API key"}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Go to"," ",(0,r.jsx)(d(),{href:"/dashboard/settings",className:"text-primary hover:underline",children:"Settings"})," ","→ API Keys. Generate one key per environment."]})]})]}),(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-green-500/10 text-green-500 shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"dns"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:"2. Connect providers"}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Add accounts in"," ",(0,r.jsx)(d(),{href:"/dashboard/providers",className:"text-primary hover:underline",children:"Providers"}),". Supports OAuth, API Key, and free tiers."]})]})]}),(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-blue-500/10 text-blue-500 shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"link"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:"3. Point your client"}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Set base URL to"," ",(0,r.jsx)("code",{className:"px-1.5 py-0.5 rounded bg-surface text-xs font-mono",children:c})," ","in your IDE or API client."]})]})]}),(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-bg-subtle p-4 flex gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-amber-500/10 text-amber-500 shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"analytics"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold",children:"4. Monitor & optimize"}),(0,r.jsxs)("p",{className:"text-text-muted mt-0.5",children:["Track tokens, cost and errors in"," ",(0,r.jsx)(d(),{href:"/dashboard/usage",className:"text-primary hover:underline",children:"Request Logs"})," ","and"," ",(0,r.jsx)(d(),{href:"/dashboard/analytics",className:"text-primary hover:underline",children:"Analytics"}),"."]})]})]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:[{label:"Documentation",href:"/docs",icon:"menu_book"},{label:"Providers",href:"/dashboard/providers",icon:"dns"},{label:"Combos",href:"/dashboard/combos",icon:"layers"},{label:"Analytics",href:"/dashboard/analytics",icon:"analytics"},{label:"Health Monitor",href:"/dashboard/health",icon:"health_and_safety"},{label:"CLI Tools",href:"/dashboard/cli-tools",icon:"terminal"},{label:"Report issue",href:"https://github.com/diegosouzapw/OmniRoute/issues",external:!0,icon:"bug_report"}].map(e=>(0,r.jsxs)("a",{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:e.icon||(e.external?"open_in_new":"arrow_forward")}),e.label]},e.href))})]})}),(0,r.jsxs)(x.Zp,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Providers Overview"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:[N.filter(e=>e.total>0).length," configured of"," ",N.length," available providers"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("div",{className:"hidden sm:flex items-center gap-3 text-[11px] text-text-muted",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"size-2 rounded-full bg-green-500"})," Free"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"size-2 rounded-full bg-blue-500"})," OAuth"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"size-2 rounded-full bg-amber-500"})," API Key"]})]}),(0,r.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"settings"}),"Manage"]})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:N.map(e=>(0,r.jsx)(p,{item:e,metrics:g[e.provider.alias]||g[e.id],onClick:()=>f(e)},e.id))})]}),h&&(0,r.jsx)(b,{provider:h,models:y,onClose:()=>f(null)})]})}function p({item:e,metrics:s,onClick:t}){let[a,i]=(0,l.useState)(!1),o=e.errors>0?"text-red-500":e.connected>0?"text-green-500":"text-text-muted",d={free:{color:"bg-green-500",label:"Free"},oauth:{color:"bg-blue-500",label:"OAuth"},apikey:{color:"bg-amber-500",label:"API Key"}},c=d[e.authType]||d.apikey;return(0,r.jsx)("button",{onClick:t,className:"border border-border rounded-lg p-3 hover:bg-surface/40 transition-colors text-left cursor-pointer w-full",children:(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.provider.color||"#888"}15`},children:a?(0,r.jsx)("span",{className:"text-[10px] font-bold",style:{color:e.provider.color||"#888"},children:e.provider.textIcon||e.provider.id.slice(0,2).toUpperCase()}):(0,r.jsx)(n.default,{src:`/providers/${e.provider.id}.png`,alt:e.provider.name,width:26,height:26,className:"object-contain rounded-lg",sizes:"26px",onError:()=>i(!0)})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("p",{className:"text-sm font-semibold truncate",children:e.provider.name}),(0,r.jsx)("span",{className:`size-2 rounded-full ${c.color} shrink-0`,title:c.label})]}),(0,r.jsx)("p",{className:`text-xs ${o}`,children:0===e.total?"Not configured":`${e.connected} active \xb7 ${e.errors} error`}),s&&s.totalRequests>0&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[(0,r.jsx)("span",{className:"text-emerald-500",children:s.totalSuccesses}),"/",s.totalRequests," reqs"]}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[s.successRate,"%"]}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["~",s.avgLatencyMs,"ms"]})]})]}),(0,r.jsxs)("div",{className:"text-right shrink-0",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-text-main",children:e.modelCount}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted",children:"models"})]})]})})}function b({provider:e,models:s,onClose:t}){let[a,i]=(0,l.useState)(null),n=(0,u.i)(),o=(0,c.useRouter)(),d=e=>{t(),o.push(e)};return(0,r.jsx)(x.aF,{isOpen:!0,title:`${e.provider.name} — Models`,onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"token"}),s.length," model",1!==s.length?"s":""," available",e.total>0&&(0,r.jsxs)("span",{className:"ml-auto text-xs text-green-500",children:["● ",e.connected," connection",1!==e.connected?"s":""," active"]})]}),0===s.length?(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"search_off"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"No models available for this provider."}),(0,r.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Configure a connection first in"," ",(0,r.jsx)("button",{onClick:()=>d("/dashboard/providers"),className:"text-primary hover:underline cursor-pointer",children:"Providers"})]})]}):(0,r.jsx)("div",{className:"flex flex-col gap-1 max-h-[400px] overflow-y-auto",children:s.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg hover:bg-surface/50 transition-colors group",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("p",{className:"font-mono text-sm text-text-main truncate",children:e.fullModel}),e.alias!==e.model&&(0,r.jsxs)("p",{className:"text-[10px] text-text-muted",children:["alias: ",e.alias]})]}),(0,r.jsx)("button",{onClick:()=>{var s;return s=e.fullModel,void(navigator.clipboard.writeText(s),i(s),n.success(`Copied: ${s}`),setTimeout(()=>i(null),2e3))},className:"shrink-0 ml-2 p-1.5 rounded-lg text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors opacity-0 group-hover:opacity-100",title:"Copy model name",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:a===e.fullModel?"check":"content_copy"})})]},e.fullModel))}),(0,r.jsxs)("div",{className:"flex gap-2 pt-2 border-t border-border",children:[(0,r.jsxs)(x.$n,{variant:"secondary",fullWidth:!0,size:"sm",onClick:()=>d(`/dashboard/providers/${e.id}`),className:"flex-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"settings"}),"Configure Provider"]}),(0,r.jsx)(x.$n,{variant:"ghost",size:"sm",onClick:t,children:"Close"})]})]})})}h.propTypes={machineId:i().string},p.propTypes={item:i().shape({id:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string,alias:i().string}).isRequired,total:i().number.isRequired,connected:i().number.isRequired,errors:i().number.isRequired,modelCount:i().number.isRequired,authType:i().string.isRequired}).isRequired,metrics:i().shape({totalRequests:i().number,totalSuccesses:i().number,successRate:i().number,avgLatencyMs:i().number}),onClick:i().func.isRequired},b.propTypes={provider:i().object.isRequired,models:i().array.isRequired,onClose:i().func.isRequired}}},e=>{e.O(0,[8500,9751,782,1149,5846,993,8441,3794,7358],()=>e(e.s=7153)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-26ec85a0bf8624f2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{56411:(e,t,s)=>{Promise.resolve().then(s.bind(s,88618))},88618:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var r=s(95155),a=s(12115),i=s(14051),l=s.n(i),n=s(73321),o=s(98500),d=s.n(o),c=s(5772),m=s(40993),p=s(20909),u=s(81135),x=s(30949);function h(){let e=(0,n.useParams)(),t=(0,n.useRouter)(),s=e.id,[i,l]=(0,a.useState)([]),[o,h]=(0,a.useState)(!0),[y,j]=(0,a.useState)(null),[N,S]=(0,a.useState)(!1),[$,T]=(0,a.useState)(!1),[I,E]=(0,a.useState)(!1),[R,O]=(0,a.useState)(!1),[P,_]=(0,a.useState)(null),[q,U]=(0,a.useState)(null),[D,K]=(0,a.useState)({}),[L,F]=(0,a.useState)(!1),{copied:M,copy:z}=(0,x.C)(),J=(0,a.useRef)(!1),V=(0,a.useRef)(!1),[W,B]=(0,a.useState)(null),[Z,G]=(0,a.useState)(null),[Q,H]=(0,a.useState)(!1),[X,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)({current:0,total:0,phase:"idle",status:"",logs:[],error:"",importedCount:0}),es=y?{id:y.id,name:y.name||("anthropic-compatible"===y.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===y.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===y.type?"AC":"OC",apiType:y.apiType,baseUrl:y.baseUrl,type:y.type}:p.IS[s]||p.zN[s]||p.fg[s],er=!!p.IS[s]||!!p.zN[s],ea=(0,u.KC)(s),ei=(0,p.wG)(s),el=(0,p.mq)(s),en=(0,p.gb)(s),eo=el||en,ed=eo?s:ei,ec=eo?y?.prefix||s:ei,em=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),ep=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"})]),r=await e.json(),a=await t.json();if(e.ok){let e=(r.connections||[]).filter(e=>e.provider===s);l(e)}if(t.ok){let e=(a.nodes||[]).find(e=>e.id===s)||null;if(!e&&eo)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===s)||null))break}j(e)}}catch(e){console.log("Error fetching connections:",e)}finally{h(!1)}},[s,eo]),eu=async e=>{try{let t=await fetch(`/api/provider-nodes/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();t.ok&&(j(r.node),await ep(),O(!1))}catch(e){console.log("Error updating provider node:",e)}};(0,a.useEffect)(()=>{ep(),em(),fetch("/api/settings/proxy").then(e=>e.ok?e.json():null).then(e=>G(e)).catch(()=>{})},[ep,em]),(0,a.useEffect)(()=>{o||0!==i.length||!es||eo||J.current||V.current||(J.current=!0,er?S(!0):T(!0))},[o]);let ex=async(e,t,s=ei)=>{let r=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:r,alias:t})});if(e.ok)await em();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},eh=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await em()}catch(e){console.log("Error deleting alias:",e)}},ef=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&l(i.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},eg=(0,a.useCallback)(()=>{ep(),S(!1)},[ep]),ey=async e=>{try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,...e})});if(t.ok)return await ep(),T(!1),null;let r=await t.json().catch(()=>({}));return r.error?.message||r.error||"Failed to save connection"}catch(e){return console.log("Error saving connection:",e),"Failed to save connection. Please try again."}},eb=async e=>{try{(await fetch(`/api/providers/${P.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await ep(),E(!1))}catch(e){console.log("Error updating connection:",e)}},ev=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&l(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},ej=async(e,t)=>{try{(await fetch("/api/rate-limits",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:e,enabled:t})})).ok&&l(s=>s.map(s=>s.id===e?{...s,rateLimitProtection:t}:s))}catch(e){console.error("Error toggling rate limit:",e)}},eN=async e=>{if(e&&!q){U(e);try{let t=await fetch(`/api/providers/${e}/test`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>({}));alert(e.error||"Failed to retest connection");return}await ep()}catch(e){console.error("Error retesting connection:",e)}finally{U(null)}}},ew=async(e,t)=>{if(e&&t)try{let s=t.priority,r=e.priority;s===r&&(s=i.indexOf(e)>i.indexOf(t)?t.priority-.5:t.priority+.5),await Promise.all([fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:s})}),fetch(`/api/providers/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:r})})]),await ep()}catch(e){console.log("Error swapping priority:",e)}},ek=async()=>{if(Q)return;let e=i.find(e=>!1!==e.isActive);if(e){H(!0),Y(!0),et({current:0,total:0,phase:"fetching",status:"Fetching available models...",logs:[],error:"",importedCount:0});try{let t=await fetch(`/api/providers/${e.id}/models`),r=await t.json();if(!t.ok)return void et(e=>({...e,phase:"error",status:"Failed to fetch models",error:r.error||"Failed to import models"}));let a=r.models||[];if(0===a.length)return void et(e=>({...e,phase:"done",status:"No models found",logs:["No models returned from /models endpoint."]}));et(e=>({...e,phase:"importing",total:a.length,status:`Importing 0 of ${a.length} models...`,logs:[`Found ${a.length} models. Starting import...`]}));let i=0;for(let e=0;e<a.length;e++){let t=a[e],r=t.id||t.name||t.model;if(!r)continue;let l=r.split("/"),n=l[l.length-1];et(t=>({...t,current:e+1,status:`Importing ${e+1} of ${a.length} models...`,logs:[...t.logs,`Importing ${r}...`]})),await fetch("/api/provider-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,modelId:r,modelName:t.name||r,source:"imported"})}),D[n]||await ex(r,n,ed),i+=1}await em(),et(e=>({...e,phase:"done",current:a.length,status:i>0?`Successfully imported ${i} model${1===i?"":"s"}!`:"No new models were added (all already exist).",logs:[...e.logs,i>0?`✓ Done! ${i} model${1===i?"":"s"} imported.`:"No new models were added."],importedCount:i})),i>0&&setTimeout(()=>{window.location.reload()},2e3)}catch(e){console.log("Error importing models:",e),et(t=>({...t,phase:"error",status:"Import failed",error:e instanceof Error?e.message:"An unexpected error occurred"}))}finally{H(!1)}}},eC=async(e,t)=>{Y(!0),et({current:0,total:0,phase:"fetching",status:"Fetching available models...",logs:[],error:"",importedCount:0});try{let s=(await e()).models||[];if(0===s.length)return void et(e=>({...e,phase:"done",status:"No models found",logs:["No models returned from /models endpoint."]}));et(e=>({...e,phase:"importing",total:s.length,status:`Importing 0 of ${s.length} models...`,logs:[`Found ${s.length} models. Starting import...`]}));let r=0;for(let e=0;e<s.length;e++){let a=s[e],i=a.id||a.name||a.model;i&&(et(t=>({...t,current:e+1,status:`Importing ${e+1} of ${s.length} models...`,logs:[...t.logs,`Importing ${i}...`]})),await t(a)&&(r+=1))}et(e=>({...e,phase:"done",current:s.length,status:r>0?`Successfully imported ${r} model${1===r?"":"s"}!`:"No new models were added.",logs:[...e.logs,r>0?`✓ Done! ${r} model${1===r?"":"s"} imported.`:"No new models were added."],importedCount:r})),r>0&&setTimeout(()=>{window.location.reload()},2e3)}catch(e){console.log("Error importing models:",e),et(t=>({...t,phase:"error",status:"Import failed",error:e instanceof Error?e.message:"An unexpected error occurred"}))}},eA=i.some(e=>!1!==e.isActive);return o?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(m.Qv,{}),(0,r.jsx)(m.Qv,{})]}):es?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${es.color}15`},children:L?(0,r.jsx)("span",{className:"text-sm font-bold",style:{color:es.color},children:es.textIcon||es.id.slice(0,2).toUpperCase()}):(0,r.jsx)(c.default,{src:el&&es.apiType?"responses"===es.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":en?"/providers/anthropic-m.png":`/providers/${es.id}.png`,alt:es.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>F(!0)})}),(0,r.jsxs)("div",{children:[es.website?(0,r.jsxs)("a",{href:es.website,target:"_blank",rel:"noopener noreferrer",className:"text-3xl font-semibold tracking-tight hover:underline inline-flex items-center gap-2",style:{color:es.color},children:[es.name,(0,r.jsx)("span",{className:"material-symbols-outlined text-lg opacity-60",children:"open_in_new"})]}):(0,r.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:es.name}),(0,r.jsxs)("p",{className:"text-text-muted",children:[i.length," connection",1===i.length?"":"s"]})]})]})]}),eo&&y&&(0,r.jsxs)(m.Zp,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:en?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:[en?"Messages API":"responses"===y.apiType?"Responses API":"Chat Completions"," ","\xb7 ",(y.baseUrl||"").replace(/\/$/,""),"/",en?"messages":"responses"===y.apiType?"responses":"chat/completions"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(m.$n,{size:"sm",icon:"add",onClick:()=>T(!0),disabled:i.length>0,children:"Add"}),(0,r.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>O(!0),children:"Edit"}),(0,r.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${en?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${s}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),i.length>0&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),(0,r.jsxs)(m.Zp,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),!eo&&(0,r.jsx)(m.$n,{size:"sm",icon:"add",onClick:()=>er?S(!0):T(!0),children:"Add"})]}),0===i.length?(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:er?"lock":"key"})}),(0,r.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!eo&&(0,r.jsx)(m.$n,{icon:"add",onClick:()=>er?S(!0):T(!0),children:"Add Connection"})]}):(0,r.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:i.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,t)=>(0,r.jsx)(w,{connection:e,isOAuth:er,isFirst:0===t,isLast:t===i.length-1,onMoveUp:()=>ew(e,i[t-1]),onMoveDown:()=>ew(e,i[t+1]),onToggleActive:t=>ev(e.id,t),onToggleRateLimit:t=>ej(e.id,t),onRetest:()=>eN(e.id),isRetesting:q===e.id,onEdit:()=>{_(e),E(!0)},onDelete:()=>ef(e.id),onReauth:er?()=>S(!0):void 0,onProxy:()=>B({level:"key",id:e.id,label:e.name||e.email||e.id}),hasProxy:!!Z?.keys?.[e.id]},e.id))})]}),(0,r.jsxs)(m.Zp,{children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Available Models"}),(()=>{if(eo)return(0,r.jsx)(v,{providerStorageAlias:ed,providerDisplayAlias:ec,modelAliases:D,copied:M,onCopy:z,onSetAlias:ex,onDeleteAlias:eh,connections:i,isAnthropic:en,onImportWithProgress:eC});if(es.passthroughModels)return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"download",onClick:ek,disabled:!eA||Q,children:Q?"Importing...":"Import from /models"}),!eA&&(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"Add a connection to enable importing."})]}),(0,r.jsx)(g,{providerAlias:ei,modelAliases:D,copied:M,onCopy:z,onSetAlias:ex,onDeleteAlias:eh})]});let e=(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"download",onClick:ek,disabled:!eA||Q,children:Q?"Importing...":"Import from /models"}),!eA&&(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"Add a connection to enable importing."})]});return 0===ea.length?(0,r.jsxs)("div",{children:[e,(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"No models configured"})]}):(0,r.jsxs)("div",{children:[e,(0,r.jsx)("div",{className:"flex flex-wrap gap-3",children:ea.map(e=>{let t=`${ed}/${e.id}`,a=`${s}/${e.id}`,i=Object.entries(D).find(([,e])=>e===t||e===a)?.[0];return(0,r.jsx)(f,{model:e,fullModel:`${ec}/${e.id}`,alias:i,copied:M,onCopy:z,onSetAlias:t=>ex(e.id,t,ed),onDeleteAlias:()=>eh(i)},e.id)})})]})})(),!eo&&(0,r.jsx)(b,{providerId:s,providerAlias:ec,copied:M,onCopy:z})]}),"kiro"===s?(0,r.jsx)(m.Mh,{isOpen:N,providerInfo:es,onSuccess:eg,onClose:()=>{V.current=!0,S(!1)}}):"cursor"===s?(0,r.jsx)(m.G9,{isOpen:N,onSuccess:eg,onClose:()=>{V.current=!0,S(!1)}}):(0,r.jsx)(m.LF,{isOpen:N,provider:s,providerInfo:es,onSuccess:eg,onClose:()=>{V.current=!0,S(!1)}}),(0,r.jsx)(k,{isOpen:$,provider:s,providerName:es.name,isCompatible:eo,isAnthropic:en,onSave:ey,onClose:()=>T(!1)}),(0,r.jsx)(C,{isOpen:I,connection:P,onSave:eb,onClose:()=>E(!1)}),eo&&(0,r.jsx)(A,{isOpen:R,node:y,onSave:eu,onClose:()=>O(!1),isAnthropic:en}),W&&(0,r.jsx)(m.KN,{isOpen:!!W,onClose:()=>B(null),level:W.level,levelId:W.id,levelLabel:W.label}),(0,r.jsx)(m.aF,{isOpen:X,onClose:()=>{("done"===ee.phase||"error"===ee.phase)&&Y(!1)},title:"Importing Models",size:"md",closeOnOverlay:!1,showCloseButton:"done"===ee.phase||"error"===ee.phase,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:["fetching"===ee.phase&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary animate-spin",children:"progress_activity"}),"importing"===ee.phase&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary animate-spin",children:"progress_activity"}),"done"===ee.phase&&(0,r.jsx)("span",{className:"material-symbols-outlined text-green-500",children:"check_circle"}),"error"===ee.phase&&(0,r.jsx)("span",{className:"material-symbols-outlined text-red-500",children:"error"}),(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:ee.status})]}),("importing"===ee.phase||"done"===ee.phase)&&ee.total>0&&(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:[ee.current," / ",ee.total]}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:[Math.round(ee.current/ee.total*100),"%"]})]}),(0,r.jsx)("div",{className:"w-full h-2.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all duration-300 ease-out",style:{width:`${ee.current/ee.total*100}%`,background:"done"===ee.phase?"linear-gradient(90deg, #22c55e, #16a34a)":"linear-gradient(90deg, var(--color-primary), var(--color-primary-hover, var(--color-primary)))"}})})]}),"fetching"===ee.phase&&(0,r.jsx)("div",{className:"w-full h-2.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded-full animate-pulse",style:{width:"60%",background:"linear-gradient(90deg, var(--color-primary), var(--color-primary-hover, var(--color-primary)))"}})}),"error"===ee.phase&&ee.error&&(0,r.jsx)("div",{className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:ee.error})}),ee.logs.length>0&&(0,r.jsx)("div",{className:"max-h-48 overflow-y-auto rounded-lg bg-black/5 dark:bg-white/5 p-3 border border-black/5 dark:border-white/5",children:(0,r.jsx)("div",{className:"flex flex-col gap-1",children:ee.logs.map((e,t)=>(0,r.jsx)("p",{className:`text-xs font-mono ${e.startsWith("✓")?"text-green-500 font-semibold":"text-text-muted"}`,children:e},t))})}),"done"===ee.phase&&ee.importedCount>0&&(0,r.jsx)("p",{className:"text-xs text-text-muted text-center animate-pulse",children:"Page will refresh automatically..."})]})})]}):(0,r.jsxs)("div",{className:"text-center py-20",children:[(0,r.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,r.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function f({model:e,fullModel:t,alias:s,copied:a,onCopy:i,onSetAlias:l,onDeleteAlias:n}){return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,r.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,r.jsx)("button",{onClick:()=>i(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})})]})}function g({providerAlias:e,modelAliases:t,copied:s,onCopy:i,onSetAlias:l,onDeleteAlias:n}){let[o,d]=(0,a.useState)(""),[c,p]=(0,a.useState)(!1),u=Object.entries(t).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),x=async()=>{let e;if(!o.trim()||c)return;let s=o.trim(),r=(e=s.split("/"))[e.length-1];if(t[r])return void alert(`Alias "${r}" already exists. Please use a different model or edit existing alias.`);p(!0);try{await l(s,r),d("")}catch(e){console.log("Error adding model:",e)}finally{p(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,r.jsxs)("div",{className:"flex items-end gap-2",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("label",{htmlFor:"new-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,r.jsx)("input",{id:"new-model-input",type:"text",value:o,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,r.jsx)(m.$n,{size:"sm",icon:"add",onClick:x,disabled:!o.trim()||c,children:c?"Adding...":"Add"})]}),u.length>0&&(0,r.jsx)("div",{className:"flex flex-col gap-3",children:u.map(({modelId:e,fullModel:t,alias:a})=>(0,r.jsx)(y,{modelId:e,fullModel:t,copied:s,onCopy:i,onDeleteAlias:()=>n(a)},t))})]})}function y({modelId:e,fullModel:t,copied:s,onCopy:a,onDeleteAlias:i}){return(0,r.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,r.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,r.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,r.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})})]})]}),(0,r.jsx)("button",{onClick:i,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function b({providerId:e,providerAlias:t,copied:s,onCopy:i}){let[l,n]=(0,a.useState)([]),[o,d]=(0,a.useState)(""),[c,p]=(0,a.useState)(""),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!0),g=(0,a.useCallback)(async()=>{try{let t=await fetch(`/api/provider-models?provider=${e}`);if(t.ok){let e=await t.json();n(e.models||[])}}catch(e){console.error("Failed to fetch custom models:",e)}finally{f(!1)}},[e]);(0,a.useEffect)(()=>{g()},[g]);let y=async()=>{if(o.trim()&&!u){x(!0);try{(await fetch("/api/provider-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,modelId:o.trim(),modelName:c.trim()||void 0})})).ok&&(d(""),p(""),await g())}catch(e){console.error("Failed to add custom model:",e)}finally{x(!1)}}},b=async t=>{try{await fetch(`/api/provider-models?provider=${e}&model=${encodeURIComponent(t)}`,{method:"DELETE"}),await g()}catch(e){console.error("Failed to remove custom model:",e)}};return(0,r.jsxs)("div",{className:"mt-6 pt-6 border-t border-border",children:[(0,r.jsxs)("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary",children:"tune"}),"Custom Models"]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Add model IDs not in the default list. These will be available for routing."}),(0,r.jsxs)("div",{className:"flex items-end gap-2 mb-3",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("label",{htmlFor:"custom-model-id",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,r.jsx)("input",{id:"custom-model-id",type:"text",value:o,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&y(),placeholder:"e.g. gpt-4.5-turbo",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,r.jsxs)("div",{className:"w-40",children:[(0,r.jsx)("label",{htmlFor:"custom-model-name",className:"text-xs text-text-muted mb-1 block",children:"Display Name"}),(0,r.jsx)("input",{id:"custom-model-name",type:"text",value:c,onChange:e=>p(e.target.value),onKeyDown:e=>"Enter"===e.key&&y(),placeholder:"Optional",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,r.jsx)(m.$n,{size:"sm",icon:"add",onClick:y,disabled:!o.trim()||u,children:u?"Adding...":"Add"})]}),h?(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Loading..."}):l.length>0?(0,r.jsx)("div",{className:"flex flex-col gap-2",children:l.map(e=>{let a=`${t}/${e.id}`,l=`custom-${e.id}`;return(0,r.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary",children:"tune"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:e.name||e.id}),(0,r.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,r.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:a}),(0,r.jsx)("button",{onClick:()=>i(a,l),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===l?"check":"content_copy"})})]})]}),(0,r.jsx)("button",{onClick:()=>b(e.id),className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove custom model",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]},e.id)})}):(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"No custom models added yet."})]})}function v({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:i,onCopy:l,onSetAlias:n,onDeleteAlias:o,connections:d,isAnthropic:c,onImportWithProgress:p}){let[u,x]=(0,a.useState)(""),[h,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),v=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),j=e=>{let r,a=(r=e.split("/"))[r.length-1];if(!s[a])return a;let i=`${t}-${a}`;return s[i]?null:i},N=async()=>{if(!u.trim()||h)return;let t=u.trim(),s=j(t);if(!s)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");f(!0);try{await n(t,s,e),x("")}catch(e){console.log("Error adding model:",e)}finally{f(!1)}},w=async()=>{if(g)return;let t=d.find(e=>!1!==e.isActive);if(t){b(!0);try{await p(async()=>{let e=await fetch(`/api/providers/${t.id}/models`),s=await e.json();if(!e.ok)throw Error(s.error||"Failed to import models");return s},async t=>{let s=t.id||t.name||t.model;if(!s)return!1;let r=j(s);return!!r&&(await n(s,r,e),!0)})}catch(e){console.log("Error importing models:",e)}finally{b(!1)}}},k=d.some(e=>!1!==e.isActive);return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",c?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,r.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,r.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,r.jsx)("input",{id:"new-compatible-model-input",type:"text",value:u,onChange:e=>x(e.target.value),onKeyDown:e=>"Enter"===e.key&&N(),placeholder:c?"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,r.jsx)(m.$n,{size:"sm",icon:"add",onClick:N,disabled:!u.trim()||h,children:h?"Adding...":"Add"}),(0,r.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"download",onClick:w,disabled:!k||g,children:g?"Importing...":"Import from /models"})]}),!k&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),v.length>0&&(0,r.jsx)("div",{className:"flex flex-col gap-3",children:v.map(({modelId:e,fullModel:s,alias:a})=>(0,r.jsx)(y,{modelId:e,fullModel:`${t}/${e}`,copied:i,onCopy:l,onDeleteAlias:()=>o(a)},s))})]})}function j({until:e}){let[t,s]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let r=Math.floor(t/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 r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t)?(0,r.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}f.propTypes={model:l().shape({id:l().string.isRequired}).isRequired,fullModel:l().string.isRequired,alias:l().string,copied:l().string,onCopy:l().func.isRequired},g.propTypes={providerAlias:l().string.isRequired,modelAliases:l().object.isRequired,copied:l().string,onCopy:l().func.isRequired,onSetAlias:l().func.isRequired,onDeleteAlias:l().func.isRequired},y.propTypes={modelId:l().string.isRequired,fullModel:l().string.isRequired,copied:l().string,onCopy:l().func.isRequired,onDeleteAlias:l().func.isRequired},b.propTypes={providerId:l().string.isRequired,providerAlias:l().string.isRequired,copied:l().string,onCopy:l().func.isRequired},v.propTypes={providerStorageAlias:l().string.isRequired,providerDisplayAlias:l().string.isRequired,modelAliases:l().object.isRequired,copied:l().string,onCopy:l().func.isRequired,onSetAlias:l().func.isRequired,onDeleteAlias:l().func.isRequired,connections:l().arrayOf(l().shape({id:l().string,isActive:l().bool})).isRequired,isAnthropic:l().bool,onImportWithProgress:l().func.isRequired},j.propTypes={until:l().string.isRequired};let N={runtime_error:{label:"Local runtime",variant:"warning"},upstream_auth_error:{label:"Upstream auth",variant:"error"},auth_missing:{label:"Missing credential",variant:"warning"},token_refresh_failed:{label:"Refresh failed",variant:"warning"},token_expired:{label:"Token expired",variant:"warning"},upstream_rate_limited:{label:"Rate limited",variant:"warning"},upstream_unavailable:{label:"Upstream unavailable",variant:"error"},network_error:{label:"Network error",variant:"warning"},unsupported:{label:"Test unsupported",variant:"default"},upstream_error:{label:"Upstream error",variant:"error"}};function w({connection:e,isOAuth:t,isFirst:s,isLast:i,onMoveUp:l,onMoveDown:n,onToggleActive:o,onToggleRateLimit:d,onRetest:c,isRetesting:p,onEdit:u,onDelete:x,onReauth:h,onProxy:f,hasProxy:g}){let y=t?e.name||e.email||e.displayName||"OAuth Account":e.name,[b,v]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=()=>{v(e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now())};t();let s=e.rateLimitedUntil?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[e.rateLimitedUntil]);let w="unavailable"!==e.testStatus||b?e.testStatus:"active",k=function(e,t,s){if(!1===e.isActive)return{statusVariant:"default",statusLabel:"disabled",errorType:null,errorBadge:null,errorTextClass:"text-text-muted"};if("active"===t||"success"===t)return{statusVariant:"success",statusLabel:"connected",errorType:null,errorBadge:null,errorTextClass:"text-text-muted"};let r=function(e,t){if(t)return"upstream_rate_limited";if(e.lastErrorType)return e.lastErrorType;let s=Number(e.errorCode);if(401===s||403===s)return"upstream_auth_error";if(429===s)return"upstream_rate_limited";if(s>=500)return"upstream_unavailable";let r=(e.lastError||"").toLowerCase();return r?r.includes("runtime")||r.includes("not runnable")||r.includes("not installed")||r.includes("healthcheck")?"runtime_error":r.includes("refresh failed")?"token_refresh_failed":r.includes("token expired")||r.includes("expired")?"token_expired":r.includes("invalid api key")||r.includes("token invalid")||r.includes("revoked")||r.includes("access denied")||r.includes("unauthorized")?"upstream_auth_error":r.includes("rate limit")||r.includes("quota")||r.includes("too many requests")||r.includes("429")?"upstream_rate_limited":r.includes("fetch failed")||r.includes("network")||r.includes("timeout")||r.includes("econn")||r.includes("enotfound")?"network_error":r.includes("not supported")?"unsupported":"upstream_error":null}(e,s),a=r&&N[r]||null;return"runtime_error"===r?{statusVariant:"warning",statusLabel:"runtime issue",errorType:r,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"upstream_auth_error"===r||"auth_missing"===r||"token_refresh_failed"===r||"token_expired"===r?{statusVariant:"error",statusLabel:"auth failed",errorType:r,errorBadge:a,errorTextClass:"text-red-500"}:"upstream_rate_limited"===r?{statusVariant:"warning",statusLabel:"rate limited",errorType:r,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"network_error"===r?{statusVariant:"warning",statusLabel:"network issue",errorType:r,errorBadge:a,errorTextClass:"text-yellow-600 dark:text-yellow-400"}:"unsupported"===r?{statusVariant:"default",statusLabel:"test unsupported",errorType:r,errorBadge:a,errorTextClass:"text-text-muted"}:{statusVariant:"error",statusLabel:t||"error",errorType:r,errorBadge:a,errorTextClass:"text-red-500"}}(e,w,b),C=!!e.rateLimitProtection;return(0,r.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("button",{onClick:l,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,r.jsx)("button",{onClick:n,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,r.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:t?"lock":"key"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:y}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[(0,r.jsx)(m.Ex,{variant:k.statusVariant,size:"sm",dot:!0,children:k.statusLabel}),b&&!1!==e.isActive&&(0,r.jsx)(j,{until:e.rateLimitedUntil}),k.errorBadge&&!1!==e.isActive&&(0,r.jsx)(m.Ex,{variant:k.errorBadge.variant,size:"sm",children:k.errorBadge.label}),e.lastError&&!1!==e.isActive&&(0,r.jsx)("span",{className:`text-xs truncate max-w-[300px] ${k.errorTextClass}`,title:e.lastError,children:e.lastError}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),(0,r.jsx)("span",{className:"text-text-muted/30 select-none",children:"|"}),(0,r.jsxs)("button",{onClick:()=>d(!C),className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium transition-all cursor-pointer ${C?"bg-emerald-500/15 text-emerald-500 hover:bg-emerald-500/25":"bg-black/[0.03] dark:bg-white/[0.03] text-text-muted/50 hover:text-text-muted hover:bg-black/[0.06] dark:hover:bg-white/[0.06]"}`,title:C?"Click to disable rate limit protection":"Click to enable rate limit protection",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"shield"}),C?"Protected":"Unprotected"]}),g&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-text-muted/30 select-none",children:"|"}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium bg-primary/15 text-primary",title:"Proxy configured",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"vpn_lock"}),"Proxy"]})]})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(m.$n,{size:"sm",variant:"ghost",icon:"refresh",loading:p,disabled:!1===e.isActive,onClick:c,className:"!h-7 !px-2 text-xs",title:"Retest authentication",children:"Retest"}),(0,r.jsx)(m.lM,{size:"sm",checked:e.isActive??!0,onChange:o,title:e.isActive??!0?"Disable connection":"Enable connection"}),(0,r.jsxs)("div",{className:"flex gap-1 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h&&(0,r.jsx)("button",{onClick:h,className:"p-2 hover:bg-amber-500/10 rounded text-amber-600 hover:text-amber-500",title:"Re-authenticate this connection",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"passkey"})}),(0,r.jsx)("button",{onClick:u,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,r.jsx)("button",{onClick:f,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",title:"Proxy config",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"vpn_lock"})}),(0,r.jsx)("button",{onClick:x,className:"p-2 hover:bg-red-500/10 rounded text-red-500",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})]})}function k({isOpen:e,provider:t,providerName:s,isCompatible:i,isAnthropic:l,onSave:n,onClose:o}){let[d,c]=(0,a.useState)({name:"",apiKey:"",priority:1}),[p,u]=(0,a.useState)(!1),[x,h]=(0,a.useState)(null),[f,g]=(0,a.useState)(!1),[y,b]=(0,a.useState)(null),v=async()=>{u(!0),b(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})}),s=await e.json();h(s.valid?"success":"failed")}catch{h("failed")}finally{u(!1)}},j=async()=>{if(t&&d.apiKey){g(!0),b(null);try{let e=!1;try{u(!0),h(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})});e=!!(await s.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{u(!1)}if(!e)return void b("API key validation failed. Please check your key and try again.");let s=await n({name:d.name,apiKey:d.apiKey,priority:d.priority,testStatus:"active"});s&&b("string"==typeof s?s:"Failed to save connection")}finally{g(!1)}}};return t?(0,r.jsx)(m.aF,{isOpen:e,title:`Add ${s||t} API Key`,onClose:o,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(m.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:"Production Key"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(m.pd,{label:"API Key",type:"password",value:d.apiKey,onChange:e=>c({...d,apiKey:e.target.value}),className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(m.$n,{onClick:v,disabled:!d.apiKey||p||f,variant:"secondary",children:p?"Checking...":"Check"})})]}),x&&(0,r.jsx)(m.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),y&&(0,r.jsx)("div",{className:"text-sm text-red-500 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2",children:y}),i&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:l?`Validation checks ${s||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${s||"OpenAI Compatible"} via /models on your base URL.`}),(0,r.jsx)(m.pd,{label:"Priority",type:"number",value:d.priority,onChange:e=>c({...d,priority:Number.parseInt(e.target.value)||1})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(m.$n,{onClick:j,fullWidth:!0,disabled:!d.name||!d.apiKey||f,children:f?"Saving...":"Save"}),(0,r.jsx)(m.$n,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function C({isOpen:e,connection:t,onSave:s,onClose:i}){let[l,n]=(0,a.useState)({name:"",priority:1,apiKey:"",healthCheckInterval:60}),[o,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),[y,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(n({name:t.name||"",priority:t.priority||1,apiKey:"",healthCheckInterval:t.healthCheckInterval??60}),u(null),g(null))},[t]);let v=async()=>{if(t?.provider){d(!0),u(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),s=await e.json();u({valid:!!s.valid,diagnosis:s.diagnosis||null,message:s.error||null})}catch{u({valid:!1,diagnosis:{type:"network_error"},message:"Failed to test connection"})}finally{d(!1)}}},j=async()=>{if(t?.provider&&l.apiKey){h(!0),g(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:l.apiKey})}),s=await e.json();g(s.valid?"success":"failed")}catch{g("failed")}finally{h(!1)}}},w=async()=>{b(!0);try{let e={name:l.name,priority:l.priority,healthCheckInterval:l.healthCheckInterval};if(!k&&l.apiKey){e.apiKey=l.apiKey;let s="success"===f;if(!s)try{h(!0),g(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:l.apiKey})});s=!!(await e.json()).valid,g(s?"success":"failed")}catch{g("failed")}finally{h(!1)}s&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null,e.lastErrorType=null,e.lastErrorSource=null,e.errorCode=null,e.rateLimitedUntil=null)}await s(e)}finally{b(!1)}};if(!t)return null;let k="oauth"===t.authType,C=(0,p.mq)(t.provider)||(0,p.gb)(t.provider),A=!c?.valid&&c?.diagnosis?.type&&N[c.diagnosis.type]||null;return(0,r.jsx)(m.aF,{isOpen:e,title:"Edit Connection",onClose:i,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(m.pd,{label:"Name",value:l.name,onChange:e=>n({...l,name:e.target.value}),placeholder:k?"Account name":"Production Key"}),k&&t.email&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,r.jsx)("p",{className:"font-medium",children:t.email})]}),k&&(0,r.jsx)(m.pd,{label:"Health Check (min)",type:"number",value:l.healthCheckInterval,onChange:e=>n({...l,healthCheckInterval:Math.max(0,Number.parseInt(e.target.value)||0)}),hint:"Proactive token refresh interval. 0 = disabled."}),(0,r.jsx)(m.pd,{label:"Priority",type:"number",value:l.priority,onChange:e=>n({...l,priority:Number.parseInt(e.target.value)||1})}),!k&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(m.pd,{label:"API Key",type:"password",value:l.apiKey,onChange:e=>n({...l,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(m.$n,{onClick:j,disabled:!l.apiKey||x||y,variant:"secondary",children:x?"Checking...":"Check"})})]}),f&&(0,r.jsx)(m.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"})]}),!C&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(m.$n,{onClick:v,variant:"secondary",disabled:o,children:o?"Testing...":"Test Connection"}),c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.Ex,{variant:c.valid?"success":"error",children:c.valid?"Valid":"Failed"}),A&&(0,r.jsx)(m.Ex,{variant:A.variant,children:A.label})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(m.$n,{onClick:w,fullWidth:!0,disabled:y,children:y?"Saving...":"Save"}),(0,r.jsx)(m.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function A({isOpen:e,node:t,onSave:s,onClose:i,isAnthropic:l}){let[n,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[p,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(l?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,l]);let y=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){c(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};l||(e.apiType=n.apiType),await s(e)}finally{c(!1)}}},b=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:p,type:l?"anthropic-compatible":"openai-compatible"})}),t=await e.json();g(t.valid?"success":"failed")}catch{g("failed")}finally{h(!1)}};return t?(0,r.jsx)(m.aF,{isOpen:e,title:`Edit ${l?"Anthropic":"OpenAI"} Compatible`,onClose:i,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(m.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${l?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,r.jsx)(m.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:l?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!l&&(0,r.jsx)(m.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,r.jsx)(m.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:l?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${l?"Anthropic":"OpenAI"}-compatible API.`}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(m.pd,{label:"API Key (for Check)",type:"password",value:p,onChange:e=>u(e.target.value),className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(m.$n,{onClick:b,disabled:!p||x||!n.baseUrl.trim(),variant:"secondary",children:x?"Checking...":"Check"})})]}),f&&(0,r.jsx)(m.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(m.$n,{onClick:y,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,r.jsx)(m.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}w.propTypes={connection:l().shape({id:l().string,name:l().string,email:l().string,displayName:l().string,rateLimitedUntil:l().string,rateLimitProtection:l().bool,testStatus:l().string,isActive:l().bool,priority:l().number,lastError:l().string,lastErrorType:l().string,lastErrorSource:l().string,errorCode:l().oneOfType([l().string,l().number]),globalPriority:l().number}).isRequired,isOAuth:l().bool.isRequired,isFirst:l().bool.isRequired,isLast:l().bool.isRequired,onMoveUp:l().func.isRequired,onMoveDown:l().func.isRequired,onToggleActive:l().func.isRequired,onToggleRateLimit:l().func.isRequired,onRetest:l().func.isRequired,isRetesting:l().bool,onEdit:l().func.isRequired,onDelete:l().func.isRequired,onReauth:l().func},k.propTypes={isOpen:l().bool.isRequired,provider:l().string,providerName:l().string,isCompatible:l().bool,isAnthropic:l().bool,onSave:l().func.isRequired,onClose:l().func.isRequired},C.propTypes={isOpen:l().bool.isRequired,connection:l().shape({id:l().string,name:l().string,email:l().string,priority:l().number,authType:l().string,provider:l().string}),onSave:l().func.isRequired,onClose:l().func.isRequired},A.propTypes={isOpen:l().bool.isRequired,node:l().shape({id:l().string,name:l().string,prefix:l().string,apiType:l().string,baseUrl:l().string}),onSave:l().func.isRequired,onClose:l().func.isRequired,isAnthropic:l().bool}}},e=>{e.O(0,[8500,9751,782,1149,5846,993,8441,3794,7358],()=>e(e.s=56411)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/page-200bed170f9ee2b0.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{4346:(e,r,a)=>{Promise.resolve().then(a.bind(a,91241))},91241:(e,r,a)=>{"use strict";a.r(r),a.d(r,{default:()=>u});var t=a(95155),s=a(12115),i=a(73321),l=a(98500),d=a.n(l),o=a(40993),n=a(52529);let c=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),p=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function u(){let e=(0,i.useRouter)(),[r,a]=(0,s.useState)(!1),[l,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[h,m]=(0,s.useState)({}),x=(e,r)=>{u(a=>({...a,[e]:r})),h[e]&&m(r=>({...r,[e]:null}))},b=async r=>{let t;if(r.preventDefault(),t={},l.provider||(t.provider="Please select a provider"),"api_key"!==l.authMethod||l.apiKey||(t.apiKey="API Key is required"),m(t),0===Object.keys(t).length){a(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();m({submit:e.error||"Failed to create provider"})}}catch(e){m({submit:"An error occurred. Please try again."})}finally{a(!1)}}},v=n.Q2[l.provider];return(0,t.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,t.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,t.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,t.jsx)(o.Zp,{children:(0,t.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,t.jsx)(o.l6,{label:"Provider",options:c,value:l.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:h.provider,required:!0}),v&&(0,t.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:v.name}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("div",{className:"flex gap-3",children:p.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${l.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,t.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===l.authMethod&&(0,t.jsx)(o.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:l.apiKey,onChange:e=>x("apiKey",e.target.value),error:h.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===l.authMethod&&(0,t.jsxs)(o.Zp.Section,{className:"",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,t.jsx)(o.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,t.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:l.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,t.jsx)(o.lM,{checked:l.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),h.submit&&(0,t.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:h.submit}),(0,t.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,t.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,t.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,t.jsx)(o.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}}},e=>{e.O(0,[8500,9751,782,1149,5846,993,8441,3794,7358],()=>e(e.s=4346)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{37667:(e,t,s)=>{Promise.resolve().then(s.bind(s,75926))},75926:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>f});var r=s(95155),a=s(12115),l=s(5772),i=s(14051),n=s.n(i),o=s(40993),d=s(52529),c=s(20909),p=s(98500),m=s.n(p),x=s(67671);let u={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 h(){let[e,t]=(0,a.useState)(null),[s,l]=(0,a.useState)(!0),[i,n]=(0,a.useState)(!1),[d,c]=(0,a.useState)(null),p=(0,a.useRef)(null),m=(0,x.i)(),h=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,a.useEffect)(()=>{h();let e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),(0,a.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&n(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let b=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?(m.success(`Cooldown cleared for ${t}`),await h()):m.error("Failed to clear cooldown")}catch{m.error("Failed to clear cooldown")}finally{c(null)}};if(s)return null;let f=e?.models||[],g=e?.unavailableCount||f.filter(e=>"available"!==e.status).length,y=0===g,v={};return f.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";v[t]||(v[t]=[]),v[t].push(e)}),(0,r.jsxs)("div",{className:"relative",ref:p,children:[(0,r.jsxs)("button",{onClick:()=>n(!i),className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${y?"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:y?"verified":"warning"}),y?"All models operational":`${g} model${1!==g?"s":""} with issues`]}),i&&(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:y?"#22c55e":"#f59e0b"},children:y?"verified":"warning"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,r.jsx)("button",{onClick:h,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:y?(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(v).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=u[e.status]||u.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)(o.$n,{size:"sm",variant:"ghost",onClick:()=>b(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))})})]})]})}function b(e,t,s){let a=[];if(e>0&&a.push((0,r.jsxs)(o.Ex,{variant:"success",size:"sm",dot:!0,children:[e," Connected"]},"connected")),t>0){let e=s?`${t} Error (${s})`:`${t} Error`;a.push((0,r.jsx)(o.Ex,{variant:"error",size:"sm",dot:!0,children:e},"error"))}return 0===a.length?(0,r.jsx)("span",{className:"text-text-muted",children:"No connections"}):a}function f(){let[e,t]=(0,a.useState)([]),[s,l]=(0,a.useState)([]),[i,n]=(0,a.useState)(!0),[p,m]=(0,a.useState)(!1),[u,b]=(0,a.useState)(!1),[f,C]=(0,a.useState)(null),[w,k]=(0,a.useState)(null),T=(0,x.i)();(0,a.useEffect)(()=>{(async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),r=await e.json(),a=await s.json();e.ok&&t(r.connections||[]),s.ok&&l(a.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{n(!1)}})()},[]);let A=(t,s)=>{let r=e.filter(e=>e.provider===t&&e.authType===s),a=e=>{let t=e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now();return"unavailable"!==e.testStatus||t?e.testStatus:"active"},l=r.filter(e=>{let t=a(e);return"active"===t||"success"===t}).length,i=r.filter(e=>{let t=a(e);return"error"===t||"expired"===t||"unavailable"===t}),n=i.length,o=r.length,d=i.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:l,error:n,total:o,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=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(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?function(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`}(d.lastErrorAt):null}},I=async(e,t=null)=>{if(!f){C("provider"===e?t:e),k(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(k(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?T.success(`All ${s} tests passed`):T.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){k({error:"Test request failed"}),T.error("Provider test failed")}finally{C(null)}}},U=s.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})),$=s.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"}));return i?(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(o.Qv,{}),(0,r.jsx)(o.Qv,{})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:["OAuth Providers ",(0,r.jsx)("span",{className:"size-2.5 rounded-full bg-blue-500",title:"OAuth"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(h,{}),(0,r.jsxs)("button",{onClick:()=>I("oauth"),disabled:!!f,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"oauth"===f?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary 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]",children:"oauth"===f?"sync":"play_arrow"}),"oauth"===f?"Testing...":"Test All"]})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(d.zN).map(([e,t])=>(0,r.jsx)(g,{providerId:e,provider:t,stats:A(e,"oauth"),authType:"oauth"},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:["Free Providers ",(0,r.jsx)("span",{className:"size-2.5 rounded-full bg-green-500",title:"Free"})]}),(0,r.jsxs)("button",{onClick:()=>I("free"),disabled:!!f,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"free"===f?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary 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]",children:"free"===f?"sync":"play_arrow"}),"free"===f?"Testing...":"Test All"]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(c.IS).map(([e,t])=>(0,r.jsx)(g,{providerId:e,provider:t,stats:A(e,"oauth"),authType:"free"},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:["API Key Providers"," ",(0,r.jsx)("span",{className:"size-2.5 rounded-full bg-amber-500",title:"API Key"})]}),(0,r.jsxs)("button",{onClick:()=>I("apikey"),disabled:!!f,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"apikey"===f?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary 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]",children:"apikey"===f?"sync":"play_arrow"}),"apikey"===f?"Testing...":"Test All"]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Object.entries(d.fg).map(([e,t])=>(0,r.jsx)(y,{providerId:e,provider:t,stats:A(e,"apikey"),authType:"apikey"},e))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:["API Key Compatible Providers"," ",(0,r.jsx)("span",{className:"size-2.5 rounded-full bg-orange-500",title:"Compatible"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(U.length>0||$.length>0)&&(0,r.jsxs)("button",{onClick:()=>I("compatible"),disabled:!!f,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${"compatible"===f?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"}`,title:"Test all Compatible connections",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"compatible"===f?"sync":"play_arrow"}),"compatible"===f?"Testing...":"Test All"]}),(0,r.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>b(!0),children:"Add Anthropic Compatible"}),(0,r.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>m(!0),className:"!bg-white !text-black hover:!bg-gray-100",children:"Add OpenAI Compatible"})]})]}),0===U.length&&0===$.length?(0,r.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"extension"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"No compatible providers added yet"}),(0,r.jsx)("p",{className:"text-text-muted text-xs mt-1",children:"Use the buttons above to add OpenAI or Anthropic compatible endpoints"})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[...U,...$].map(e=>(0,r.jsx)(y,{providerId:e.id,provider:e,stats:A(e.id,"apikey"),authType:"compatible"},e.id))})]}),(0,r.jsx)(v,{isOpen:p,onClose:()=>m(!1),onCreated:e=>{l(t=>[...t,e]),m(!1)}}),(0,r.jsx)(j,{isOpen:u,onClose:()=>b(!1),onCreated:e=>{l(t=>[...t,e]),b(!1)}}),w&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[10vh]",onClick:()=>k(null),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,r.jsxs)("div",{className:"relative bg-bg-primary border border-border rounded-xl w-full max-w-[600px] 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-bg-primary/95 backdrop-blur-sm rounded-t-xl",children:[(0,r.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,r.jsx)("button",{onClick:()=>k(null),className:"p-1 rounded-lg hover:bg-bg-subtle text-text-muted hover:text-text-primary 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)(N,{results:w})})]})]})]})}function g({providerId:e,provider:t,stats:s,authType:i}){let{connected:n,error:d,errorCode:c,errorTime:p}=s,[x,u]=(0,a.useState)(!1),h={free:"bg-green-500",oauth:"bg-blue-500",apikey:"bg-amber-500",compatible:"bg-orange-500"};return(0,r.jsx)(m(),{href:`/dashboard/providers/${e}`,className:"group",children:(0,r.jsx)(o.Zp,{padding:"xs",className:"h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}15`},children:x?(0,r.jsx)("span",{className:"text-xs font-bold",style:{color:t.color},children:t.textIcon||t.id.slice(0,2).toUpperCase()}):(0,r.jsx)(l.default,{src:`/providers/${t.id}.png`,alt:t.name,width:30,height:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",sizes:"32px",onError:()=>u(!0)})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h3",{className:"font-semibold flex items-center gap-1.5",children:[t.name,(0,r.jsx)("span",{className:`size-2 rounded-full ${h[i]||h.oauth} shrink-0`,title:{free:"Free",oauth:"OAuth",apikey:"API Key",compatible:"Compatible"}[i]||"OAuth"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:[b(n,d,c),p&&(0,r.jsxs)("span",{className:"text-text-muted",children:["• ",p]})]})]})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"chevron_right"})]})})})}function y({providerId:e,provider:t,stats:s,authType:i}){let{connected:n,error:d,errorCode:p,errorTime:x}=s,u=e.startsWith(c.JH),h=e.startsWith(c.DI),[f,g]=(0,a.useState)(!1),y={free:"bg-green-500",oauth:"bg-blue-500",apikey:"bg-amber-500",compatible:"bg-orange-500"};return(0,r.jsx)(m(),{href:`/dashboard/providers/${e}`,className:"group",children:(0,r.jsx)(o.Zp,{padding:"xs",className:"h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}15`},children:f?(0,r.jsx)("span",{className:"text-xs font-bold",style:{color:t.color},children:t.textIcon||t.id.slice(0,2).toUpperCase()}):(0,r.jsx)(l.default,{src:u?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":h?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:t.name,width:30,height:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",sizes:"30px",onError:()=>g(!0)})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h3",{className:"font-semibold flex items-center gap-1.5",children:[t.name,(0,r.jsx)("span",{className:`size-2 rounded-full ${y[i]||y.apikey} shrink-0`,title:{free:"Free",oauth:"OAuth",apikey:"API Key",compatible:"Compatible"}[i]||"API Key"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs flex-wrap",children:[b(n,d,p),u&&(0,r.jsx)(o.Ex,{variant:"default",size:"sm",children:"responses"===t.apiType?"Responses":"Chat"}),h&&(0,r.jsx)(o.Ex,{variant:"default",size:"sm",children:"Messages"}),x&&(0,r.jsxs)("span",{className:"text-text-muted",children:["• ",x]})]})]})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"chevron_right"})]})})})}function v({isOpen:e,onClose:t,onCreated:s}){let[l,i]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[n,d]=(0,a.useState)(!1),[c,p]=(0,a.useState)(""),[m,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{i(e=>({...e,baseUrl:"https://api.openai.com/v1"}))},[l.apiType]);let b=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){d(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l.name,prefix:l.prefix,apiType:l.apiType,baseUrl:l.baseUrl,type:"openai-compatible"})}),t=await e.json();e.ok&&(s(t.node),i({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),p(""),h(null))}catch(e){console.log("Error creating OpenAI Compatible node:",e)}finally{d(!1)}}},f=async()=>{x(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:c,type:"openai-compatible"})}),t=await e.json();h(t.valid?"success":"failed")}catch{h("failed")}finally{x(!1)}};return(0,r.jsx)(o.aF,{isOpen:e,title:"Add OpenAI Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.pd,{label:"Name",value:l.name,onChange:e=>i({...l,name:e.target.value}),placeholder:"OpenAI Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(o.pd,{label:"Prefix",value:l.prefix,onChange:e=>i({...l,prefix:e.target.value}),placeholder:"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(o.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:l.apiType,onChange:e=>i({...l,apiType:e.target.value})}),(0,r.jsx)(o.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>i({...l,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.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>p(e.target.value),className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(o.$n,{onClick:f,disabled:!c||m||!l.baseUrl.trim(),variant:"secondary",children:m?"Checking...":"Check"})})]}),u&&(0,r.jsx)(o.Ex,{variant:"success"===u?"success":"error",children:"success"===u?"Valid":"Invalid"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.$n,{onClick:b,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||n,children:n?"Creating...":"Create"}),(0,r.jsx)(o.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function j({isOpen:e,onClose:t,onCreated:s}){let[l,i]=(0,a.useState)({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),[n,d]=(0,a.useState)(!1),[c,p]=(0,a.useState)(""),[m,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(h(null),p(""))},[e]);let b=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){d(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l.name,prefix:l.prefix,baseUrl:l.baseUrl,type:"anthropic-compatible"})}),t=await e.json();e.ok&&(s(t.node),i({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),p(""),h(null))}catch(e){console.log("Error creating Anthropic Compatible node:",e)}finally{d(!1)}}},f=async()=>{x(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:c,type:"anthropic-compatible"})}),t=await e.json();h(t.valid?"success":"failed")}catch{h("failed")}finally{x(!1)}};return(0,r.jsx)(o.aF,{isOpen:e,title:"Add Anthropic Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.pd,{label:"Name",value:l.name,onChange:e=>i({...l,name:e.target.value}),placeholder:"Anthropic Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(o.pd,{label:"Prefix",value:l.prefix,onChange:e=>i({...l,prefix:e.target.value}),placeholder:"ac-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(o.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>i({...l,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.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>p(e.target.value),className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(o.$n,{onClick:f,disabled:!c||m||!l.baseUrl.trim(),variant:"secondary",children:m?"Checking...":"Check"})})]}),u&&(0,r.jsx)(o.Ex,{variant:"success"===u?"success":"error",children:"success"===u?"Valid":"Invalid"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.$n,{onClick:b,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||n,children:n?"Creating...":"Create"}),(0,r.jsx)(o.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function N({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 flex-col gap-3",children:[t&&(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs mb-1",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 ml-auto",children:[t.total," tested"]})]}),a.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs px-3 py-2 rounded-lg bg-black/[0.03] dark:bg-white/[0.03]",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:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"font-medium",children:e.connectionName}),(0,r.jsxs)("span",{className:"text-text-muted ml-1.5",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,r.jsxs)("span",{className:"text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,r.jsx)("span",{className:`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."})]})}g.propTypes={providerId:n().string.isRequired,provider:n().shape({id:n().string.isRequired,name:n().string.isRequired,color:n().string,textIcon:n().string}).isRequired,stats:n().shape({connected:n().number,error:n().number,errorCode:n().string,errorTime:n().string}).isRequired,authType:n().string},y.propTypes={providerId:n().string.isRequired,provider:n().shape({id:n().string.isRequired,name:n().string.isRequired,color:n().string,textIcon:n().string,apiType:n().string}).isRequired,stats:n().shape({connected:n().number,error:n().number,errorCode:n().string,errorTime:n().string}).isRequired,authType:n().string},v.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func.isRequired},j.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func.isRequired},N.propTypes={results:n().shape({mode:n().string,results:n().array,summary:n().shape({total:n().number,passed:n().number,failed:n().number}),error:n().string}).isRequired}}},e=>{e.O(0,[8500,9751,782,1149,5846,993,8441,3794,7358],()=>e(e.s=37667)),_N_E=e.O()}]);
|