omniroute 0.8.5 → 0.9.0
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.de.md +995 -0
- package/README.es.md +995 -0
- package/README.fr.md +995 -0
- package/README.it.md +995 -0
- package/README.md +725 -101
- package/README.pt-BR.md +995 -0
- package/README.ru.md +995 -0
- package/README.zh-CN.md +995 -0
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +25 -24
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/prerender-manifest.json +27 -3
- package/app/.next/routes-manifest.json +6 -0
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js +1 -1
- 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 +5 -5
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/costs/page.js +1 -1
- 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 +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/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 +1 -1
- 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 +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/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 +1 -1
- 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 +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +2 -2
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +3 -3
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cache/route_client-reference-manifest.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 +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 +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/backups/route.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
- 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 +1 -1
- 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_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 +1 -1
- 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 +1 -1
- 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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/metrics/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/test/route_client-reference-manifest.js +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_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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/monitoring/health/route.js +2 -2
- 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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/policies/route.js +2 -2
- package/app/.next/server/app/api/policies/route_client-reference-manifest.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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-metrics/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.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_client-reference-manifest.js +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_client-reference-manifest.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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route_client-reference-manifest.js +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_client-reference-manifest.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_client-reference-manifest.js +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_client-reference-manifest.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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/moderations/route_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +3 -3
- package/app/.next/server/app/callback.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/analytics.html +1 -1
- package/app/.next/server/app/dashboard/analytics.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/analytics.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/analytics.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- 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 +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/costs.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/costs.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/health.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/health.segments/_index.segment.rsc +3 -3
- 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 +4 -4
- package/app/.next/server/app/dashboard/onboarding.segments/!KGRhc2hib2FyZCk/dashboard/onboarding/__PAGE__.segment.rsc +1 -1
- 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 +4 -4
- package/app/.next/server/app/dashboard/onboarding.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/onboarding.segments/_index.segment.rsc +3 -3
- 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 +4 -4
- 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 +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- 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 +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- 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 +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- 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 +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/settings.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- 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 +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/docs/page.js +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 +3 -3
- package/app/.next/server/app/docs.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/docs.segments/_index.segment.rsc +3 -3
- 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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/forbidden.html +1 -1
- package/app/.next/server/app/forbidden.rsc +3 -3
- package/app/.next/server/app/forbidden.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/forbidden.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/forbidden.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/forbidden.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/forbidden.segments/forbidden/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/forbidden.segments/forbidden.segment.rsc +1 -1
- package/app/.next/server/app/forgot-password/page.js +1 -1
- 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 +4 -4
- package/app/.next/server/app/forgot-password.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/forgot-password.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/forgot-password.segments/_index.segment.rsc +3 -3
- 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 +3 -3
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +3 -3
- package/app/.next/server/app/landing.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +1 -1
- 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 +4 -4
- package/app/.next/server/app/login.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +3 -3
- 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_client-reference-manifest.js +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 +3 -3
- package/app/.next/server/app/privacy.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/privacy.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/privacy.segments/_index.segment.rsc +3 -3
- 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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/terms.html +1 -1
- package/app/.next/server/app/terms.rsc +3 -3
- package/app/.next/server/app/terms.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/terms.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/terms.segments/_index.segment.rsc +3 -3
- 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 +25 -24
- package/app/.next/server/chunks/1020.js +1 -1
- package/app/.next/server/chunks/239.js +2 -2
- package/app/.next/server/chunks/2620.js +2 -2
- package/app/.next/server/chunks/4277.js +1 -0
- package/app/.next/server/chunks/438.js +1 -0
- package/app/.next/server/chunks/5583.js +1 -1
- package/app/.next/server/chunks/7669.js +2 -2
- package/app/.next/server/chunks/8369.js +1 -1
- package/app/.next/server/chunks/9824.js +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +2 -2
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/8ACUE6hz9uxBNe_Q_ZH6y/_buildManifest.js +1 -0
- package/app/.next/static/chunks/1149-fefe7f95f0e9842f.js +1 -0
- package/app/.next/static/chunks/{5846-2708fad522c4092b.js → 5846-0541241939d8c7e3.js} +1 -1
- package/app/.next/static/chunks/{993-6be0cd05a02eb09b.js → 993-b74bac8c882e8d1a.js} +2 -2
- 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-2cf4a7b419667452.js → page-421e732016c49ee4.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/costs/{page-6913ad5d715dcc3f.js → page-9495b294cfe54d73.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/{page-a446f6fd8dc64f29.js → page-623e54048b5d4f69.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-58ea3e55f475ea7b.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/{usage/page-8e19076a0d9227ca.js → limits/page-3b7083be8adedc57.js} +1 -1
- 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-521cffebf9da74b1.js → page-200bed170f9ee2b0.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/{page-627628d3588d56d0.js → page-98c6b97d0c195a2c.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-038687bc5d2c3bb5.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/{page-c3cbea97c4f3a3b3.js → page-efca884c20a509a4.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-51a813eac9d71eed.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/{layout-c498dd9c790d0115.js → layout-cf710bbfb7c3ba11.js} +1 -1
- package/app/.next/static/chunks/app/forgot-password/{page-3682163d66078655.js → page-373672767bb0aae4.js} +1 -1
- package/app/.next/static/chunks/app/login/{page-319adaa570f7cef2.js → page-8a9aa887783f2370.js} +1 -1
- package/app/.next/static/css/1c99dc691f001331.css +1 -0
- package/app/package.json +1 -1
- package/app/public/providers/ironclaw.png +0 -0
- package/app/public/providers/nanobot.png +0 -0
- package/app/public/providers/opencode.svg +18 -0
- package/app/public/providers/picoclaw.jpg +0 -0
- package/app/public/providers/zeroclaw.png +0 -0
- package/package.json +1 -1
- package/app/.next/server/chunks/2951.js +0 -1
- package/app/.next/static/4zh9cgkOJsay7eUxfk-tb/_buildManifest.js +0 -1
- package/app/.next/static/chunks/7013-718042994c9127fa.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/analytics/page-a7a7e3485f278504.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-1c6897612e762e03.js +0 -15
- package/app/.next/static/chunks/app/(dashboard)/dashboard/health/page-d3f501b59334c3d5.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-7312e2dd8b5feff0.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-a9c594cf56c3465e.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/settings/page-ae5e43ea2a576094.js +0 -1
- package/app/.next/static/css/c08bd521c418658c.css +0 -1
- /package/app/.next/static/{4zh9cgkOJsay7eUxfk-tb → 8ACUE6hz9uxBNe_Q_ZH6y}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6099],{10373:(e,t,s)=>{Promise.resolve().then(s.bind(s,40877))},40877:(e,t,s)=>{"use strict";s.d(t,{default:()=>x});var i=s(95155),r=s(12115),l=s(14051),a=s.n(l),n=(s(5772),s(40993)),o=s(30949),d=s(20909);let c=s(41463).env.NEXT_PUBLIC_CLOUD_URL,m=15e3;function x({machineId:e}){let[t,s]=(0,r.useState)([]),[l,a]=(0,r.useState)([]),[x,h]=(0,r.useState)(!0),[g,y]=(0,r.useState)(!1),[b,f]=(0,r.useState)(""),[j,v]=(0,r.useState)(null),[N,k]=(0,r.useState)([]),[w,C]=(0,r.useState)(null),[S,_]=(0,r.useState)(!1),[T,$]=(0,r.useState)(!1),[E,R]=(0,r.useState)(!1),[q,P]=(0,r.useState)(!1),[A,O]=(0,r.useState)(null),[I,D]=(0,r.useState)(""),[U,F]=(0,r.useState)(!1),[W,B]=(0,r.useState)(null),{copied:M,copy:K}=(0,o.C)();(0,r.useEffect)(()=>{J(),G(),z()},[]);let z=async()=>{try{let e=await fetch("/v1/models");if(e.ok){let t=await e.json();k(t.data||[])}}catch(e){console.log("Error fetching models:",e)}},L=(0,r.useMemo)(()=>{let e=N.filter(e=>!e.type),t=N.filter(e=>"embedding"===e.type),s=N.filter(e=>"image"===e.type),i=N.filter(e=>"rerank"===e.type),r=N.filter(e=>"audio"===e.type&&"transcription"===e.subtype);return{chat:e,embeddings:t,images:s,rerank:i,audioTranscription:r,audioSpeech:N.filter(e=>"audio"===e.type&&"speech"===e.subtype),moderation:N.filter(e=>"moderation"===e.type)}},[N]);(0,r.useMemo)(()=>Object.entries(d.Q2).map(([e,t])=>{let s=l.filter(t=>t.provider===e),i=s.filter(e=>!1!==e.isActive&&("active"===e.testStatus||"success"===e.testStatus||"unknown"===e.testStatus)).length,r=s.filter(e=>!1!==e.isActive&&("error"===e.testStatus||"expired"===e.testStatus||"unavailable"===e.testStatus)).length;return{id:e,provider:t,total:s.length,connected:i,errors:r}}),[l]);let Q=async(e,t=m)=>{let s=new AbortController,i=setTimeout(()=>s.abort(),t);try{let t=await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e}),signal:s.signal}),i=await t.json().catch(()=>({}));return{ok:t.ok,status:t.status,data:i}}catch(e){if(e?.name==="AbortError")return{ok:!1,status:408,data:{error:"Cloud request timeout"}};return{ok:!1,status:500,data:{error:e.message||"Cloud request failed"}}}finally{clearTimeout(i)}},G=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();_(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},J=async()=>{try{let[e,t]=await Promise.all([fetch("/api/keys"),fetch("/api/providers")]),[i,r]=await Promise.all([e.json(),t.json()]);e.ok&&s(i.keys||[]),t.ok&&a(r.connections||[])}catch(e){console.log("Error fetching data:",e)}finally{h(!1)}},V=e=>{e?$(!0):R(!0)};(0,r.useEffect)(()=>{if(A){let e=setTimeout(()=>O(null),5e3);return()=>clearTimeout(e)}},[A]);let Z=()=>{globalThis.dispatchEvent(new Event("cloud-status-changed"))},X=async()=>{P(!0),F(!1),D("syncing");try{let{ok:e,status:t,data:s}=await Q("enable");if(e)D("verifying"),await new Promise(e=>setTimeout(e,600)),_(!0),D("done"),F(!0),P(!1),Z(),await new Promise(e=>setTimeout(e,1200)),$(!1),F(!1),s.verified?O({type:"success",message:"Cloud Proxy connected and verified!"}):O({type:"warning",message:s.verifyError?`Connected — verification pending: ${s.verifyError}`:"Connected — verification pending"}),s.createdKey&&await J(),await G();else{let e=s.error||"Failed to enable cloud";(502===t||408===t)&&(e="Could not reach cloud worker. Make sure the cloud service is running (npm run dev in /cloud)."),O({type:"error",message:e}),$(!1)}}catch(e){O({type:"error",message:e.message||"Connection failed"}),$(!1)}finally{P(!1),D("")}},H=async()=>{P(!0),D("syncing");try{await Q("sync"),D("disabling");let{ok:e,data:t}=await Q("disable");e?(_(!1),O({type:"success",message:"Cloud disabled successfully"}),R(!1),Z(),await G()):O({type:"error",message:t.error||"Failed to disable cloud"})}catch(e){console.log("Error disabling cloud:",e),O({type:"error",message:"Failed to disable cloud"})}finally{P(!1),D("")}},Y=async()=>{if(b.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b})}),t=await e.json();e.ok&&(v(t.key),await J(),f(""),y(!1))}catch(e){console.log("Error creating key:",e)}},ee=async e=>{if(confirm("Delete this API key?"))try{(await fetch(`/api/keys/${e}`,{method:"DELETE"})).ok&&s(t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting key:",e)}},[et,es]=(0,r.useState)("/v1"),ei=`${c}/v1`;if((0,r.useEffect)(()=>{es(`${window.location.origin}/v1`)},[]),x)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(n.Qv,{}),(0,i.jsx)(n.Qv,{})]});let er=S?ei:et;return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsxs)(n.Zp,{className:"",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"API Endpoint"}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:S?"Using Cloud Proxy":"Using Local Server"}),e&&(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Machine ID: ",e.slice(0,8),"..."]})]}),(0,i.jsx)("div",{className:"flex items-center gap-2",children:S?(0,i.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"cloud_off",onClick:()=>V(!1),disabled:q,className:"bg-red-500/10! text-red-500! hover:bg-red-500/20! border-red-500/30!",children:"Disable Cloud"}):(0,i.jsx)(n.$n,{variant:"primary",icon:"cloud_upload",onClick:()=>V(!0),disabled:q,className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600",children:"Enable Cloud"})})]}),A&&(0,i.jsxs)("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg mb-4 text-sm font-medium animate-in fade-in slide-in-from-top-2 duration-300 ${"success"===A.type?"bg-green-500/10 border border-green-500/30 text-green-400":"warning"===A.type?"bg-amber-500/10 border border-amber-500/30 text-amber-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"success"===A.type?"check_circle":"warning"===A.type?"warning":"error"}),(0,i.jsx)("span",{className:"flex-1",children:A.message}),(0,i.jsx)("button",{onClick:()=>O(null),className:"p-0.5 hover:bg-white/10 rounded transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}),(0,i.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,i.jsx)(n.pd,{value:er,readOnly:!0,className:`flex-1 font-mono text-sm ${S?"animate-border-glow":""}`}),(0,i.jsx)(n.$n,{variant:"secondary",icon:"endpoint_url"===M?"check":"content_copy",onClick:()=>K(er,"endpoint_url"),children:"endpoint_url"===M?"Copied!":"Copy"})]}),(0,i.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden mt-4",children:[(0,i.jsxs)("button",{onClick:()=>C("keys"===w?null:"keys"),className:"w-full flex items-center gap-3 p-4 hover:bg-surface/50 transition-colors text-left",children:[(0,i.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-amber-500/10 shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-xl text-amber-500",children:"vpn_key"})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"font-semibold text-sm",children:"Registered Keys"}),(0,i.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-surface text-text-muted font-medium",children:[t.length," ",1===t.length?"key":"keys"]})]}),(0,i.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Manage API keys used to authenticate requests to this endpoint"})]}),(0,i.jsx)("span",{className:`material-symbols-outlined text-text-muted text-lg transition-transform ${"keys"===w?"rotate-180":""}`,children:"expand_more"})]}),"keys"===w&&(0,i.jsxs)("div",{className:"border-t border-border px-4 pb-4",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mt-3 mb-3",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Each key isolates usage tracking and can be revoked independently."}),(0,i.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>y(!0),children:"Create Key"})]}),0===t.length?(0,i.jsxs)("div",{className:"text-center py-8",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 text-primary mb-3",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"vpn_key"})}),(0,i.jsx)("p",{className:"text-text-main font-medium mb-1 text-sm",children:"No API keys yet"}),(0,i.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Create your first API key to get started"}),(0,i.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>y(!0),children:"Create Key"})]}):(0,i.jsx)("div",{className:"flex flex-col",children:t.map(e=>(0,i.jsxs)("div",{className:"group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono",children:e.key}),(0,i.jsx)("button",{onClick:()=>K(e.key,e.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:M===e.id?"check":"content_copy"})})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(e.createdAt).toLocaleDateString()]})]}),(0,i.jsx)("button",{onClick:()=>ee(e.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-0 group-hover:opacity-100 transition-all",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},e.id))})]})]})]}),(0,i.jsxs)(n.Zp,{children:[(0,i.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Available Endpoints"}),(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:[N.length," models across"," ",[L.chat,L.embeddings,L.images,L.rerank,L.audioTranscription,L.audioSpeech,L.moderation].filter(e=>e.length>0).length," ","endpoints"]})]})}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(u,{icon:"chat",iconColor:"text-blue-500",iconBg:"bg-blue-500/10",title:"Chat Completions",path:"/v1/chat/completions",description:"Streaming & non-streaming chat with all providers",models:L.chat,expanded:"chat"===w,onToggle:()=>C("chat"===w?null:"chat"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"data_array",iconColor:"text-emerald-500",iconBg:"bg-emerald-500/10",title:"Embeddings",path:"/v1/embeddings",description:"Text embeddings for search & RAG pipelines",models:L.embeddings,expanded:"embeddings"===w,onToggle:()=>C("embeddings"===w?null:"embeddings"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"image",iconColor:"text-purple-500",iconBg:"bg-purple-500/10",title:"Image Generation",path:"/v1/images/generations",description:"Generate images from text prompts",models:L.images,expanded:"images"===w,onToggle:()=>C("images"===w?null:"images"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"sort",iconColor:"text-amber-500",iconBg:"bg-amber-500/10",title:"Rerank",path:"/v1/rerank",description:"Rerank documents by relevance to a query",models:L.rerank,expanded:"rerank"===w,onToggle:()=>C("rerank"===w?null:"rerank"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"mic",iconColor:"text-rose-500",iconBg:"bg-rose-500/10",title:"Audio Transcription",path:"/v1/audio/transcriptions",description:"Transcribe audio files to text (Whisper)",models:L.audioTranscription,expanded:"audioTranscription"===w,onToggle:()=>C("audioTranscription"===w?null:"audioTranscription"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"record_voice_over",iconColor:"text-cyan-500",iconBg:"bg-cyan-500/10",title:"Text to Speech",path:"/v1/audio/speech",description:"Convert text to natural-sounding speech",models:L.audioSpeech,expanded:"audioSpeech"===w,onToggle:()=>C("audioSpeech"===w?null:"audioSpeech"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"shield",iconColor:"text-orange-500",iconBg:"bg-orange-500/10",title:"Moderations",path:"/v1/moderations",description:"Content moderation and safety classification",models:L.moderation,expanded:"moderation"===w,onToggle:()=>C("moderation"===w?null:"moderation"),copy:K,copied:M,baseUrl:er})]})]}),!1,(0,i.jsx)(n.aF,{isOpen:T,title:"Enable Cloud Proxy",onClose:()=>$(!1),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium mb-2",children:"What you will get"}),(0,i.jsxs)("ul",{className:"text-sm text-blue-700 dark:text-blue-300 space-y-1",children:[(0,i.jsx)("li",{children:"• Access your API from anywhere in the world"}),(0,i.jsx)("li",{children:"• Share endpoint with your team easily"}),(0,i.jsx)("li",{children:"• No need to open ports or configure firewall"}),(0,i.jsx)("li",{children:"• Fast global edge network"})]})]}),(0,i.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-1",children:"Note"}),(0,i.jsxs)("ul",{className:"text-sm text-yellow-700 dark:text-yellow-300 space-y-1",children:[(0,i.jsx)("li",{children:"• Cloud will keep your auth session for 1 day. If not used, it will be automatically deleted."}),(0,i.jsx)("li",{children:"• Cloud is currently unstable with Claude Code OAuth in some cases."})]})]}),(q||U)&&(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border transition-all duration-300 ${U?"bg-green-500/10 border-green-500/30":"bg-primary/10 border-primary/30"}`,children:[U?(0,i.jsx)("span",{className:"material-symbols-outlined text-green-500 text-xl",children:"check_circle"}):(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:`text-sm font-medium ${U?"text-green-500":"text-primary"}`,children:[U&&"Cloud Proxy connected!",!U&&"syncing"===I&&"Connecting to cloud...",!U&&"verifying"===I&&"Verifying connection..."]})})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:X,fullWidth:!0,disabled:q||U,children:q?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===I?"Connecting...":"Verifying..."]}):U?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"}),"Connected!"]}):"Enable Cloud"}),(0,i.jsx)(n.$n,{onClick:()=>$(!1),variant:"ghost",fullWidth:!0,disabled:q||U,children:"Cancel"})]})]})}),(0,i.jsx)(n.aF,{isOpen:g,title:"Create API Key",onClose:()=>{y(!1),f("")},children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(n.pd,{label:"Key Name",value:b,onChange:e=>f(e.target.value),placeholder:"Production Key"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:Y,fullWidth:!0,disabled:!b.trim(),children:"Create"}),(0,i.jsx)(n.$n,{onClick:()=>{y(!1),f("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,i.jsx)(n.aF,{isOpen:!!j,title:"API Key Created",onClose:()=>v(null),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,i.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.pd,{value:j||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,i.jsx)(n.$n,{variant:"secondary",icon:"created_key"===M?"check":"content_copy",onClick:()=>K(j,"created_key"),children:"created_key"===M?"Copied!":"Copy"})]}),(0,i.jsx)(n.$n,{onClick:()=>v(null),fullWidth:!0,children:"Done"})]})}),(0,i.jsx)(n.aF,{isOpen:E,title:"Disable Cloud Proxy",onClose:()=>!q&&R(!1),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,i.jsxs)("div",{className:"flex items-start gap-3",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-red-600 dark:text-red-400",children:"warning"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-1",children:"Warning"}),(0,i.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300",children:"All auth sessions will be deleted from cloud."})]})]})}),q&&(0,i.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/30 rounded-lg",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:"text-sm font-medium text-primary",children:["syncing"===I&&"Syncing latest data...","disabling"===I&&"Disabling cloud..."]})})]}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"Are you sure you want to disable cloud proxy?"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:H,fullWidth:!0,disabled:q,className:"bg-red-500! hover:bg-red-600! text-white!",children:q?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===I?"Syncing...":"Disabling..."]}):"Disable Cloud"}),(0,i.jsx)(n.$n,{onClick:()=>R(!1),variant:"ghost",fullWidth:!0,disabled:q,children:"Cancel"})]})]})}),W&&(0,i.jsx)(p,{provider:W,models:N,copy:K,copied:M,onClose:()=>B(null)})]})}function p({provider:e,models:t,copy:s,copied:l,onClose:a}){let o=e.provider.alias||e.id,d=(0,r.useMemo)(()=>t.filter(t=>t.owned_by===o||t.owned_by===e.id),[t,o,e.id]),c=d.filter(e=>!e.type),m=d.filter(e=>"embedding"===e.type),x=d.filter(e=>"image"===e.type),p=(e,t,r)=>0===r.length?null:(0,i.jsxs)("div",{className:"mb-4",children:[(0,i.jsxs)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2 flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:t}),e," (",r.length,")"]}),(0,i.jsx)("div",{className:"flex flex-col gap-1",children:r.map(e=>{let t=`modal-${e.id}`;return(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg hover:bg-surface/60 group",children:[(0,i.jsx)("code",{className:"text-sm font-mono flex-1 truncate",children:e.id}),e.custom&&(0,i.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary",children:"custom"}),(0,i.jsx)("button",{onClick:()=>s(e.id,t),className:"p-1 hover:bg-sidebar rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy model ID",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:l===t?"check":"content_copy"})})]},e.id)})})]});return(0,i.jsx)(n.aF,{isOpen:!0,onClose:a,title:`${e.provider.name} — Models`,children:(0,i.jsx)("div",{className:"max-h-[60vh] overflow-y-auto",children:0===d.length?(0,i.jsx)("p",{className:"text-sm text-text-muted py-4 text-center",children:"No models available for this provider."}):(0,i.jsxs)(i.Fragment,{children:[p("Chat","chat",c),p("Embedding","data_array",m),p("Image","image",x)]})})})}function u({icon:e,iconColor:t,iconBg:s,title:l,path:a,description:n,models:o,expanded:c,onToggle:m,copy:x,copied:p,baseUrl:u}){let h=(0,r.useMemo)(()=>{let e={};for(let t of o){let s=t.owned_by||"unknown";e[s]||(e[s]=[]),e[s].push(t)}return Object.entries(e).sort((e,t)=>t[1].length-e[1].length)},[o]),g=e=>d.Q2[e]||(0,d.zt)(e),y=`endpoint_${a}`;return(0,i.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,i.jsxs)("button",{onClick:m,className:"w-full flex items-center gap-3 p-4 hover:bg-surface/50 transition-colors text-left",children:[(0,i.jsx)("div",{className:`flex items-center justify-center size-10 rounded-lg ${s} shrink-0`,children:(0,i.jsx)("span",{className:`material-symbols-outlined text-xl ${t}`,children:e})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"font-semibold text-sm",children:l}),(0,i.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-surface text-text-muted font-medium",children:[o.length," ",1===o.length?"model":"models"]})]}),(0,i.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:n})]}),(0,i.jsx)("span",{className:`material-symbols-outlined text-text-muted text-lg transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,i.jsxs)("div",{className:"border-t border-border px-4 pb-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-3 mb-3",children:[(0,i.jsxs)("code",{className:"flex-1 text-xs font-mono text-text-muted bg-surface/80 px-3 py-1.5 rounded-lg truncate",children:[u.replace(/\/v1$/,""),a]}),(0,i.jsx)("button",{onClick:()=>x(`${u.replace(/\/v1$/,"")}${a}`,y),className:"p-1.5 hover:bg-surface rounded-lg text-text-muted hover:text-primary transition-colors shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:p===y?"check":"content_copy"})})]}),(0,i.jsx)("div",{className:"flex flex-col gap-2",children:h.map(([e,t])=>(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,i.jsx)("div",{className:"size-2.5 rounded-full shrink-0",style:{backgroundColor:g(e)?.color||"#888"}}),(0,i.jsx)("span",{className:"text-xs font-semibold text-text-main",children:g(e)?.name||e}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["(",t.length,")"]})]}),(0,i.jsx)("div",{className:"ml-5 flex flex-wrap gap-1.5",children:t.map(e=>(0,i.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-md bg-surface/80 text-text-muted font-mono",title:e.id,children:e.root||e.id.split("/").pop()},e.id))})]},e))})]})]})}x.propTypes={machineId:a().string.isRequired},a().shape({id:a().string.isRequired,provider:a().shape({id:a().string.isRequired,name:a().string.isRequired,color:a().string,textIcon:a().string}).isRequired,total:a().number.isRequired,connected:a().number.isRequired,errors:a().number.isRequired}).isRequired,a().func,p.propTypes={provider:a().object.isRequired,models:a().array.isRequired,copy:a().func.isRequired,copied:a().string,onClose:a().func.isRequired},u.propTypes={icon:a().string.isRequired,iconColor:a().string.isRequired,iconBg:a().string.isRequired,title:a().string.isRequired,path:a().string.isRequired,description:a().string.isRequired,models:a().array.isRequired,expanded:a().bool.isRequired,onToggle:a().func.isRequired,copy:a().func.isRequired,copied:a().string,baseUrl:a().string.isRequired}}},e=>{e.O(0,[8500,9751,782,7013,5846,993,8441,3794,7358],()=>e(e.s=10373)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6099],{10373:(e,t,s)=>{Promise.resolve().then(s.bind(s,40877))},40877:(e,t,s)=>{"use strict";s.d(t,{default:()=>x});var i=s(95155),r=s(12115),l=s(14051),a=s.n(l),n=(s(5772),s(40993)),o=s(30949),d=s(20909);let c=s(41463).env.NEXT_PUBLIC_CLOUD_URL,m=15e3;function x({machineId:e}){let[t,s]=(0,r.useState)([]),[l,a]=(0,r.useState)([]),[x,h]=(0,r.useState)(!0),[g,y]=(0,r.useState)(!1),[b,f]=(0,r.useState)(""),[j,v]=(0,r.useState)(null),[N,k]=(0,r.useState)([]),[w,C]=(0,r.useState)(null),[S,_]=(0,r.useState)(!1),[T,$]=(0,r.useState)(!1),[E,R]=(0,r.useState)(!1),[q,P]=(0,r.useState)(!1),[A,O]=(0,r.useState)(null),[I,D]=(0,r.useState)(""),[U,F]=(0,r.useState)(!1),[W,B]=(0,r.useState)(null),{copied:M,copy:K}=(0,o.C)();(0,r.useEffect)(()=>{J(),G(),z()},[]);let z=async()=>{try{let e=await fetch("/v1/models");if(e.ok){let t=await e.json();k(t.data||[])}}catch(e){console.log("Error fetching models:",e)}},L=(0,r.useMemo)(()=>{let e=N.filter(e=>!e.type),t=N.filter(e=>"embedding"===e.type),s=N.filter(e=>"image"===e.type),i=N.filter(e=>"rerank"===e.type),r=N.filter(e=>"audio"===e.type&&"transcription"===e.subtype);return{chat:e,embeddings:t,images:s,rerank:i,audioTranscription:r,audioSpeech:N.filter(e=>"audio"===e.type&&"speech"===e.subtype),moderation:N.filter(e=>"moderation"===e.type)}},[N]);(0,r.useMemo)(()=>Object.entries(d.Q2).map(([e,t])=>{let s=l.filter(t=>t.provider===e),i=s.filter(e=>!1!==e.isActive&&("active"===e.testStatus||"success"===e.testStatus||"unknown"===e.testStatus)).length,r=s.filter(e=>!1!==e.isActive&&("error"===e.testStatus||"expired"===e.testStatus||"unavailable"===e.testStatus)).length;return{id:e,provider:t,total:s.length,connected:i,errors:r}}),[l]);let Q=async(e,t=m)=>{let s=new AbortController,i=setTimeout(()=>s.abort(),t);try{let t=await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e}),signal:s.signal}),i=await t.json().catch(()=>({}));return{ok:t.ok,status:t.status,data:i}}catch(e){if(e?.name==="AbortError")return{ok:!1,status:408,data:{error:"Cloud request timeout"}};return{ok:!1,status:500,data:{error:e.message||"Cloud request failed"}}}finally{clearTimeout(i)}},G=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();_(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},J=async()=>{try{let[e,t]=await Promise.all([fetch("/api/keys"),fetch("/api/providers")]),[i,r]=await Promise.all([e.json(),t.json()]);e.ok&&s(i.keys||[]),t.ok&&a(r.connections||[])}catch(e){console.log("Error fetching data:",e)}finally{h(!1)}},V=e=>{e?$(!0):R(!0)};(0,r.useEffect)(()=>{if(A){let e=setTimeout(()=>O(null),5e3);return()=>clearTimeout(e)}},[A]);let Z=()=>{globalThis.dispatchEvent(new Event("cloud-status-changed"))},X=async()=>{P(!0),F(!1),D("syncing");try{let{ok:e,status:t,data:s}=await Q("enable");if(e)D("verifying"),await new Promise(e=>setTimeout(e,600)),_(!0),D("done"),F(!0),P(!1),Z(),await new Promise(e=>setTimeout(e,1200)),$(!1),F(!1),s.verified?O({type:"success",message:"Cloud Proxy connected and verified!"}):O({type:"warning",message:s.verifyError?`Connected — verification pending: ${s.verifyError}`:"Connected — verification pending"}),s.createdKey&&await J(),await G();else{let e=s.error||"Failed to enable cloud";(502===t||408===t)&&(e="Could not reach cloud worker. Make sure the cloud service is running (npm run dev in /cloud)."),O({type:"error",message:e}),$(!1)}}catch(e){O({type:"error",message:e.message||"Connection failed"}),$(!1)}finally{P(!1),D("")}},H=async()=>{P(!0),D("syncing");try{await Q("sync"),D("disabling");let{ok:e,data:t}=await Q("disable");e?(_(!1),O({type:"success",message:"Cloud disabled successfully"}),R(!1),Z(),await G()):O({type:"error",message:t.error||"Failed to disable cloud"})}catch(e){console.log("Error disabling cloud:",e),O({type:"error",message:"Failed to disable cloud"})}finally{P(!1),D("")}},Y=async()=>{if(b.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b})}),t=await e.json();e.ok&&(v(t.key),await J(),f(""),y(!1))}catch(e){console.log("Error creating key:",e)}},ee=async e=>{if(confirm("Delete this API key?"))try{(await fetch(`/api/keys/${e}`,{method:"DELETE"})).ok&&s(t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting key:",e)}},[et,es]=(0,r.useState)("/v1"),ei=`${c}/v1`;if((0,r.useEffect)(()=>{es(`${window.location.origin}/v1`)},[]),x)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(n.Qv,{}),(0,i.jsx)(n.Qv,{})]});let er=S?ei:et;return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsxs)(n.Zp,{className:"",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"API Endpoint"}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:S?"Using Cloud Proxy":"Using Local Server"}),e&&(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Machine ID: ",e.slice(0,8),"..."]})]}),(0,i.jsx)("div",{className:"flex items-center gap-2",children:S?(0,i.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"cloud_off",onClick:()=>V(!1),disabled:q,className:"bg-red-500/10! text-red-500! hover:bg-red-500/20! border-red-500/30!",children:"Disable Cloud"}):(0,i.jsx)(n.$n,{variant:"primary",icon:"cloud_upload",onClick:()=>V(!0),disabled:q,className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600",children:"Enable Cloud"})})]}),A&&(0,i.jsxs)("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg mb-4 text-sm font-medium animate-in fade-in slide-in-from-top-2 duration-300 ${"success"===A.type?"bg-green-500/10 border border-green-500/30 text-green-400":"warning"===A.type?"bg-amber-500/10 border border-amber-500/30 text-amber-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"success"===A.type?"check_circle":"warning"===A.type?"warning":"error"}),(0,i.jsx)("span",{className:"flex-1",children:A.message}),(0,i.jsx)("button",{onClick:()=>O(null),className:"p-0.5 hover:bg-white/10 rounded transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}),(0,i.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,i.jsx)(n.pd,{value:er,readOnly:!0,className:`flex-1 font-mono text-sm ${S?"animate-border-glow":""}`}),(0,i.jsx)(n.$n,{variant:"secondary",icon:"endpoint_url"===M?"check":"content_copy",onClick:()=>K(er,"endpoint_url"),children:"endpoint_url"===M?"Copied!":"Copy"})]}),(0,i.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden mt-4",children:[(0,i.jsxs)("button",{onClick:()=>C("keys"===w?null:"keys"),className:"w-full flex items-center gap-3 p-4 hover:bg-surface/50 transition-colors text-left",children:[(0,i.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-amber-500/10 shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-xl text-amber-500",children:"vpn_key"})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"font-semibold text-sm",children:"Registered Keys"}),(0,i.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-surface text-text-muted font-medium",children:[t.length," ",1===t.length?"key":"keys"]})]}),(0,i.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Manage API keys used to authenticate requests to this endpoint"})]}),(0,i.jsx)("span",{className:`material-symbols-outlined text-text-muted text-lg transition-transform ${"keys"===w?"rotate-180":""}`,children:"expand_more"})]}),"keys"===w&&(0,i.jsxs)("div",{className:"border-t border-border px-4 pb-4",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mt-3 mb-3",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Each key isolates usage tracking and can be revoked independently."}),(0,i.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>y(!0),children:"Create Key"})]}),0===t.length?(0,i.jsxs)("div",{className:"text-center py-8",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 text-primary mb-3",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"vpn_key"})}),(0,i.jsx)("p",{className:"text-text-main font-medium mb-1 text-sm",children:"No API keys yet"}),(0,i.jsx)("p",{className:"text-xs text-text-muted mb-3",children:"Create your first API key to get started"}),(0,i.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>y(!0),children:"Create Key"})]}):(0,i.jsx)("div",{className:"flex flex-col",children:t.map(e=>(0,i.jsxs)("div",{className:"group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono",children:e.key}),(0,i.jsx)("button",{onClick:()=>K(e.key,e.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:M===e.id?"check":"content_copy"})})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(e.createdAt).toLocaleDateString()]})]}),(0,i.jsx)("button",{onClick:()=>ee(e.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-0 group-hover:opacity-100 transition-all",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},e.id))})]})]})]}),(0,i.jsxs)(n.Zp,{children:[(0,i.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Available Endpoints"}),(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:[N.length," models across"," ",[L.chat,L.embeddings,L.images,L.rerank,L.audioTranscription,L.audioSpeech,L.moderation].filter(e=>e.length>0).length," ","endpoints"]})]})}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(u,{icon:"chat",iconColor:"text-blue-500",iconBg:"bg-blue-500/10",title:"Chat Completions",path:"/v1/chat/completions",description:"Streaming & non-streaming chat with all providers",models:L.chat,expanded:"chat"===w,onToggle:()=>C("chat"===w?null:"chat"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"data_array",iconColor:"text-emerald-500",iconBg:"bg-emerald-500/10",title:"Embeddings",path:"/v1/embeddings",description:"Text embeddings for search & RAG pipelines",models:L.embeddings,expanded:"embeddings"===w,onToggle:()=>C("embeddings"===w?null:"embeddings"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"image",iconColor:"text-purple-500",iconBg:"bg-purple-500/10",title:"Image Generation",path:"/v1/images/generations",description:"Generate images from text prompts",models:L.images,expanded:"images"===w,onToggle:()=>C("images"===w?null:"images"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"sort",iconColor:"text-amber-500",iconBg:"bg-amber-500/10",title:"Rerank",path:"/v1/rerank",description:"Rerank documents by relevance to a query",models:L.rerank,expanded:"rerank"===w,onToggle:()=>C("rerank"===w?null:"rerank"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"mic",iconColor:"text-rose-500",iconBg:"bg-rose-500/10",title:"Audio Transcription",path:"/v1/audio/transcriptions",description:"Transcribe audio files to text (Whisper)",models:L.audioTranscription,expanded:"audioTranscription"===w,onToggle:()=>C("audioTranscription"===w?null:"audioTranscription"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"record_voice_over",iconColor:"text-cyan-500",iconBg:"bg-cyan-500/10",title:"Text to Speech",path:"/v1/audio/speech",description:"Convert text to natural-sounding speech",models:L.audioSpeech,expanded:"audioSpeech"===w,onToggle:()=>C("audioSpeech"===w?null:"audioSpeech"),copy:K,copied:M,baseUrl:er}),(0,i.jsx)(u,{icon:"shield",iconColor:"text-orange-500",iconBg:"bg-orange-500/10",title:"Moderations",path:"/v1/moderations",description:"Content moderation and safety classification",models:L.moderation,expanded:"moderation"===w,onToggle:()=>C("moderation"===w?null:"moderation"),copy:K,copied:M,baseUrl:er})]})]}),!1,(0,i.jsx)(n.aF,{isOpen:T,title:"Enable Cloud Proxy",onClose:()=>$(!1),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium mb-2",children:"What you will get"}),(0,i.jsxs)("ul",{className:"text-sm text-blue-700 dark:text-blue-300 space-y-1",children:[(0,i.jsx)("li",{children:"• Access your API from anywhere in the world"}),(0,i.jsx)("li",{children:"• Share endpoint with your team easily"}),(0,i.jsx)("li",{children:"• No need to open ports or configure firewall"}),(0,i.jsx)("li",{children:"• Fast global edge network"})]})]}),(0,i.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-1",children:"Note"}),(0,i.jsxs)("ul",{className:"text-sm text-yellow-700 dark:text-yellow-300 space-y-1",children:[(0,i.jsx)("li",{children:"• Cloud will keep your auth session for 1 day. If not used, it will be automatically deleted."}),(0,i.jsx)("li",{children:"• Cloud is currently unstable with Claude Code OAuth in some cases."})]})]}),(q||U)&&(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border transition-all duration-300 ${U?"bg-green-500/10 border-green-500/30":"bg-primary/10 border-primary/30"}`,children:[U?(0,i.jsx)("span",{className:"material-symbols-outlined text-green-500 text-xl",children:"check_circle"}):(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:`text-sm font-medium ${U?"text-green-500":"text-primary"}`,children:[U&&"Cloud Proxy connected!",!U&&"syncing"===I&&"Connecting to cloud...",!U&&"verifying"===I&&"Verifying connection..."]})})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:X,fullWidth:!0,disabled:q||U,children:q?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===I?"Connecting...":"Verifying..."]}):U?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"}),"Connected!"]}):"Enable Cloud"}),(0,i.jsx)(n.$n,{onClick:()=>$(!1),variant:"ghost",fullWidth:!0,disabled:q||U,children:"Cancel"})]})]})}),(0,i.jsx)(n.aF,{isOpen:g,title:"Create API Key",onClose:()=>{y(!1),f("")},children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(n.pd,{label:"Key Name",value:b,onChange:e=>f(e.target.value),placeholder:"Production Key"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:Y,fullWidth:!0,disabled:!b.trim(),children:"Create"}),(0,i.jsx)(n.$n,{onClick:()=>{y(!1),f("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,i.jsx)(n.aF,{isOpen:!!j,title:"API Key Created",onClose:()=>v(null),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,i.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.pd,{value:j||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,i.jsx)(n.$n,{variant:"secondary",icon:"created_key"===M?"check":"content_copy",onClick:()=>K(j,"created_key"),children:"created_key"===M?"Copied!":"Copy"})]}),(0,i.jsx)(n.$n,{onClick:()=>v(null),fullWidth:!0,children:"Done"})]})}),(0,i.jsx)(n.aF,{isOpen:E,title:"Disable Cloud Proxy",onClose:()=>!q&&R(!1),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,i.jsxs)("div",{className:"flex items-start gap-3",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-red-600 dark:text-red-400",children:"warning"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-1",children:"Warning"}),(0,i.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300",children:"All auth sessions will be deleted from cloud."})]})]})}),q&&(0,i.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/30 rounded-lg",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:"text-sm font-medium text-primary",children:["syncing"===I&&"Syncing latest data...","disabling"===I&&"Disabling cloud..."]})})]}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"Are you sure you want to disable cloud proxy?"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(n.$n,{onClick:H,fullWidth:!0,disabled:q,className:"bg-red-500! hover:bg-red-600! text-white!",children:q?(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===I?"Syncing...":"Disabling..."]}):"Disable Cloud"}),(0,i.jsx)(n.$n,{onClick:()=>R(!1),variant:"ghost",fullWidth:!0,disabled:q,children:"Cancel"})]})]})}),W&&(0,i.jsx)(p,{provider:W,models:N,copy:K,copied:M,onClose:()=>B(null)})]})}function p({provider:e,models:t,copy:s,copied:l,onClose:a}){let o=e.provider.alias||e.id,d=(0,r.useMemo)(()=>t.filter(t=>t.owned_by===o||t.owned_by===e.id),[t,o,e.id]),c=d.filter(e=>!e.type),m=d.filter(e=>"embedding"===e.type),x=d.filter(e=>"image"===e.type),p=(e,t,r)=>0===r.length?null:(0,i.jsxs)("div",{className:"mb-4",children:[(0,i.jsxs)("h4",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider mb-2 flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:t}),e," (",r.length,")"]}),(0,i.jsx)("div",{className:"flex flex-col gap-1",children:r.map(e=>{let t=`modal-${e.id}`;return(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg hover:bg-surface/60 group",children:[(0,i.jsx)("code",{className:"text-sm font-mono flex-1 truncate",children:e.id}),e.custom&&(0,i.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary",children:"custom"}),(0,i.jsx)("button",{onClick:()=>s(e.id,t),className:"p-1 hover:bg-sidebar rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy model ID",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:l===t?"check":"content_copy"})})]},e.id)})})]});return(0,i.jsx)(n.aF,{isOpen:!0,onClose:a,title:`${e.provider.name} — Models`,children:(0,i.jsx)("div",{className:"max-h-[60vh] overflow-y-auto",children:0===d.length?(0,i.jsx)("p",{className:"text-sm text-text-muted py-4 text-center",children:"No models available for this provider."}):(0,i.jsxs)(i.Fragment,{children:[p("Chat","chat",c),p("Embedding","data_array",m),p("Image","image",x)]})})})}function u({icon:e,iconColor:t,iconBg:s,title:l,path:a,description:n,models:o,expanded:c,onToggle:m,copy:x,copied:p,baseUrl:u}){let h=(0,r.useMemo)(()=>{let e={};for(let t of o){let s=t.owned_by||"unknown";e[s]||(e[s]=[]),e[s].push(t)}return Object.entries(e).sort((e,t)=>t[1].length-e[1].length)},[o]),g=e=>d.Q2[e]||(0,d.zt)(e),y=`endpoint_${a}`;return(0,i.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,i.jsxs)("button",{onClick:m,className:"w-full flex items-center gap-3 p-4 hover:bg-surface/50 transition-colors text-left",children:[(0,i.jsx)("div",{className:`flex items-center justify-center size-10 rounded-lg ${s} shrink-0`,children:(0,i.jsx)("span",{className:`material-symbols-outlined text-xl ${t}`,children:e})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"font-semibold text-sm",children:l}),(0,i.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-surface text-text-muted font-medium",children:[o.length," ",1===o.length?"model":"models"]})]}),(0,i.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:n})]}),(0,i.jsx)("span",{className:`material-symbols-outlined text-text-muted text-lg transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,i.jsxs)("div",{className:"border-t border-border px-4 pb-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-3 mb-3",children:[(0,i.jsxs)("code",{className:"flex-1 text-xs font-mono text-text-muted bg-surface/80 px-3 py-1.5 rounded-lg truncate",children:[u.replace(/\/v1$/,""),a]}),(0,i.jsx)("button",{onClick:()=>x(`${u.replace(/\/v1$/,"")}${a}`,y),className:"p-1.5 hover:bg-surface rounded-lg text-text-muted hover:text-primary transition-colors shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:p===y?"check":"content_copy"})})]}),(0,i.jsx)("div",{className:"flex flex-col gap-2",children:h.map(([e,t])=>(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,i.jsx)("div",{className:"size-2.5 rounded-full shrink-0",style:{backgroundColor:g(e)?.color||"#888"}}),(0,i.jsx)("span",{className:"text-xs font-semibold text-text-main",children:g(e)?.name||e}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["(",t.length,")"]})]}),(0,i.jsx)("div",{className:"ml-5 flex flex-wrap gap-1.5",children:t.map(e=>(0,i.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-md bg-surface/80 text-text-muted font-mono",title:e.id,children:e.root||e.id.split("/").pop()},e.id))})]},e))})]})]})}x.propTypes={machineId:a().string.isRequired},a().shape({id:a().string.isRequired,provider:a().shape({id:a().string.isRequired,name:a().string.isRequired,color:a().string,textIcon:a().string}).isRequired,total:a().number.isRequired,connected:a().number.isRequired,errors:a().number.isRequired}).isRequired,a().func,p.propTypes={provider:a().object.isRequired,models:a().array.isRequired,copy:a().func.isRequired,copied:a().string,onClose:a().func.isRequired},u.propTypes={icon:a().string.isRequired,iconColor:a().string.isRequired,iconBg:a().string.isRequired,title:a().string.isRequired,path:a().string.isRequired,description:a().string.isRequired,models:a().array.isRequired,expanded:a().bool.isRequired,onToggle:a().func.isRequired,copy:a().func.isRequired,copied:a().string,baseUrl:a().string.isRequired}}},e=>{e.O(0,[8500,9751,782,1149,5846,993,8441,3794,7358],()=>e(e.s=10373)),_N_E=e.O()}]);
|
|
@@ -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()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{39608:(e,t,s)=>{Promise.resolve().then(s.bind(s,82665))},82665:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var a=s(95155),l=s(12115),r=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,l.useState)([]),[s,r]=(0,l.useState)({}),[h,f]=(0,l.useState)({}),[g,b]=(0,l.useState)({}),[j,y]=(0,l.useState)(!0),[v,N]=(0,l.useState)(null),[k,w]=(0,l.useState)(!1),[A,C]=(0,l.useState)(120),[E,S]=(0,l.useState)(!0),[I,q]=(0,l.useState)("all"),M=(0,l.useRef)(null),P=(0,l.useRef)(null),$=(0,l.useRef)({}),L=(0,l.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([]),[]}},[]),T=(0,l.useCallback)(async(e,t)=>{let s=Date.now();if(!(s-($.current[e]||0)<3e4)){$.current[e]=s,f(t=>({...t,[e]:!0})),b(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 r(s=>({...s,[e]:{quotas:[],message:t}}));throw Error(`HTTP ${s.status}: ${t}`)}let a=await s.json(),l=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,l=s.modelKey||s.name;return(e.get(a)??999)-(e.get(l)??999)})}return s}(t,a);r(t=>({...t,[e]:{quotas:l,plan:a.plan||null,message:a.message||null,raw:a}}))}catch(t){b(s=>({...s,[e]:t.message||"Failed to fetch quota"}))}finally{f(t=>({...t,[e]:!1}))}}},[]),R=(0,l.useCallback)(async(e,t)=>{await T(e,t),N(new Date)},[T]),_=(0,l.useCallback)(async()=>{if(!k){w(!0),C(120);try{let e=(await L()).filter(e=>u.wb.includes(e.provider)&&"oauth"===e.authType);await Promise.all(e.map(e=>T(e.id,e.provider))),N(new Date)}catch(e){console.error("Error refreshing all:",e)}finally{w(!1)}}},[k,L,T]);(0,l.useEffect)(()=>{(async()=>{S(!0),await _(),S(!1)})()},[]),(0,l.useEffect)(()=>{if(!j){M.current&&clearInterval(M.current),P.current&&clearInterval(P.current);return}return M.current=setInterval(_,12e4),P.current=setInterval(()=>{C(e=>e<=1?120:e-1)},1e3),()=>{M.current&&clearInterval(M.current),P.current&&clearInterval(P.current)}},[j,_]),(0,l.useEffect)(()=>{let e=()=>{document.hidden?(M.current&&clearInterval(M.current),P.current&&clearInterval(P.current)):j&&(M.current=setInterval(_,12e4),P.current=setInterval(()=>{C(e=>e<=1?120:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[j,_]);let O=(0,l.useMemo)(()=>e.filter(e=>u.wb.includes(e.provider)&&"oauth"===e.authType),[e]),D=(0,l.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,l.useMemo)(()=>{let e={};for(let t of D)e[t.id]=c(s[t.id]?.plan);return e},[D,s]),F=(0,l.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,l.useMemo)(()=>"all"===I?D:D.filter(e=>(U[e.id]?.key||"unknown")===I),[D,U,I]);return E?(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:_,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 l=s[e.id],r=h[e.id],i=g[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:l?.plan?`Raw plan: ${l.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:r?(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})]}):l?.message&&(!l.quotas||0===l.quotas.length)?(0,a.jsx)("div",{className:"text-xs text-text-muted italic",children:l.message}):l?.quotas?.length>0?l.quotas.map((e,t)=>{var s,l,r;let n=void 0!==e.remainingPercentage?Math.round(e.remainingPercentage):(s=e.used,(l=e.total)&&0!==l?!s||s<0?100:s>=l?0:Math.round((l-s)/l*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)"}[r=e.name]||r;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:()=>R(e.id,e.provider),disabled:r,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 ${r?"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,l.useState)({count:0,sessions:[]}),[s,n]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/sessions");e.ok&&t(await e.json())}catch{}finally{n(!1)}},[]);return(0,l.useEffect)(()=>{i();let e=setInterval(i,5e3);return()=>clearInterval(e)},[i]),(0,a.jsxs)(r.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(){let[e,t]=(0,l.useState)({lockouts:[],cacheStats:null}),[s,n]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/rate-limits");e.ok&&t(await e.json())}catch{}finally{n(!1)}},[]);return(0,l.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)(r.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,l.useState)("logs");return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(r.Iz,{options:[{value:"logs",label:"Logger"},{value:"proxy-logs",label:"Proxy"},{value:"limits",label:"Limits"}],value:e,onChange:t}),"limits"===e&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(h,{})}),(0,a.jsx)(g,{}),(0,a.jsx)(f,{})]}),"logs"===e&&(0,a.jsx)(r.y7,{}),"proxy-logs"===e&&(0,a.jsx)(r.Lo,{})]})}}},e=>{e.O(0,[8500,9751,782,7013,5846,993,8441,3794,7358],()=>e(e.s=39608)),_N_E=e.O()}]);
|
|
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([[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()}]);
|
|
@@ -1 +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,
|
|
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()}]);
|