@thangnm.nip/irouter 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +3 -1
- package/app/.next/build-manifest.json +4 -4
- package/app/.next/prerender-manifest.json +27 -3
- package/app/.next/required-server-files.json +6 -3
- package/app/.next/routes-manifest.json +12 -0
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -0
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -0
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -0
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/employees/[keyId]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/employees/[keyId]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/employees/[keyId]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/employees/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/employees/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/employees/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page.js +3 -3
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +1 -1
- 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.js +2 -2
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +5 -4
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +5 -4
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/api/auth/login/route.js +1 -1
- package/app/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route.js +1 -1
- package/app/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/copilot-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/opencode-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route.js +1 -1
- package/app/.next/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/employees/[keyId]/stats/route.js +66 -1
- package/app/.next/server/app/api/employees/[keyId]/stats/route.js.nft.json +1 -1
- package/app/.next/server/app/api/employees/[keyId]/stats/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/employees/stats/route.js +66 -1
- package/app/.next/server/app/api/employees/stats/route.js.nft.json +1 -1
- package/app/.next/server/app/api/employees/stats/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route.js +1 -1
- package/app/.next/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/locale/route.js +1 -1
- package/app/.next/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next/server/app/api/locale/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/availability/route.js +1 -0
- package/app/.next/server/app/api/models/availability/route.js.nft.json +1 -0
- package/app/.next/server/app/api/models/availability/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/test/route.js +1 -1
- package/app/.next/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +2 -2
- package/app/.next/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/iflow/cookie/route.js +1 -1
- package/app/.next/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/iflow/cookie/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route.js +1 -1
- package/app/.next/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/proxy-pools/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next/server/app/api/proxy-pools/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/database/route.js +1 -1
- package/app/.next/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/database/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/proxy-test/route.js +1 -1
- package/app/.next/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxy-test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route.js +1 -1
- package/app/.next/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/console-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/stream/route.js +2 -2
- package/app/.next/server/app/api/translator/console-logs/stream/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/load/route.js +1 -1
- package/app/.next/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/save/route.js +1 -1
- package/app/.next/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next/server/app/api/tunnel/disable/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next/server/app/api/tunnel/enable/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next/server/app/api/tunnel/status/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/chart/route.js +66 -1
- package/app/.next/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/chart/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route.js +66 -1
- package/app/.next/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/logs/route.js +66 -1
- package/app/.next/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/providers/route.js +66 -1
- package/app/.next/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-details/[id]/route.js +1 -1
- package/app/.next/server/app/api/usage/request-details/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/request-details/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-details/route.js +66 -1
- package/app/.next/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route.js +66 -1
- package/app/.next/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/stats/route.js +66 -1
- package/app/.next/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/stats/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/stream/route.js +69 -4
- package/app/.next/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/stream/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1internal/route.js +1 -1
- package/app/.next/server/app/api/v1internal/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1internal/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/version/route.js +1 -1
- package/app/.next/server/app/api/version/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page.js +2 -2
- package/app/.next/server/app/callback/page.js.nft.json +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +6 -5
- package/app/.next/server/app/callback.segments/_full.segment.rsc +6 -5
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.html +1 -0
- package/app/.next/server/app/dashboard/basic-chat.meta +17 -0
- package/app/.next/server/app/dashboard/basic-chat.rsc +24 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +6 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +5 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +5 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +6 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +24 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +6 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +9 -0
- package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +6 -0
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +8 -7
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +8 -7
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +7 -6
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/employees.html +1 -1
- package/app/.next/server/app/dashboard/employees.rsc +7 -6
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk/dashboard/employees/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk/dashboard/employees.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/employees.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/employees.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/employees.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/employees.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/employees.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +8 -7
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +8 -7
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/mitm.html +1 -1
- package/app/.next/server/app/dashboard/mitm.rsc +7 -6
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +7 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +7 -6
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +7 -6
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.rsc +7 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/quota.html +2 -2
- package/app/.next/server/app/dashboard/quota.rsc +8 -7
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +8 -7
- package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/settings/pricing/page.js +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +6 -5
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -5
- 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 +5 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +7 -6
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +7 -6
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +7 -6
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +6 -5
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -5
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/favicon.ico/route.js +1 -1
- package/app/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +5 -4
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +5 -4
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/landing/page.js +2 -2
- package/app/.next/server/app/landing/page.js.nft.json +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +6 -5
- package/app/.next/server/app/landing.segments/_full.segment.rsc +6 -5
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +2 -2
- package/app/.next/server/app/login/page.js.nft.json +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +6 -5
- package/app/.next/server/app/login.segments/_full.segment.rsc +6 -5
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +5 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +3 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/app/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/page.js +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +3 -1
- package/app/.next/server/chunks/1130.js +1 -1
- package/app/.next/server/chunks/118.js +1 -0
- package/app/.next/server/chunks/1220.js +1 -1
- package/app/.next/server/chunks/1424.js +1 -1
- package/app/.next/server/chunks/2664.js +1 -0
- package/app/.next/server/chunks/3093.js +72 -7
- package/app/.next/server/chunks/336.js +66 -1
- package/app/.next/server/chunks/412.js +2 -2
- package/app/.next/server/chunks/5270.js +1 -1
- package/app/.next/server/chunks/5708.js +1 -0
- package/app/.next/server/chunks/6072.js +43 -0
- package/app/.next/server/chunks/6182.js +4 -4
- package/app/.next/server/chunks/63.js +3 -3
- package/app/.next/server/chunks/649.js +1 -1
- package/app/.next/server/chunks/6828.js +1 -1
- package/app/.next/server/chunks/7774.js +2 -2
- package/app/.next/server/chunks/8895.js +2 -2
- package/app/.next/server/chunks/9201.js +1 -1
- package/app/.next/server/chunks/9718.js +1 -1
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/middleware.js +3 -3
- package/app/.next/server/next-font-manifest.js +1 -1
- package/app/.next/server/next-font-manifest.json +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/5242-250aca99680a5860.js +1 -0
- package/app/.next/static/chunks/5497-c246d6c185ae4515.js +7 -0
- package/app/.next/static/chunks/5772-901f1092d831ec37.js +3 -0
- package/app/.next/static/chunks/6902-135c924f2deafe46.js +1 -0
- package/app/.next/static/chunks/{9242-b33771537db21368.js → 9242-35c67551a31e8ed3.js} +2 -2
- package/app/.next/static/chunks/app/(dashboard)/dashboard/basic-chat/page-dbf8fae8c8837130.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-89c2a22ca02ca0d8.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-db322270ec972db0.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/console-log/page-7b0d61cbbe1a47c2.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/employees/[keyId]/page-260c2e244f08d44e.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/employees/{page-8eb8511823bab5a8.js → page-1186beab09df32f8.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/{page-5c259d7d447b6aee.js → page-11d04ce754400525.js} +2 -2
- package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/{page-2346c1fbdc93e171.js → page-7bb014b116bacd70.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-f113b1a6fd5bf364.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-4d697847e773ee9f.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/new/{page-f38b4a179ec6ebeb.js → page-7d54c03780f36a77.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-07b03df6908bbfc0.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-e4f676cf79e465b1.js → page-5268c095e868ce3d.js} +2 -2
- package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-f33a92ade5e4806e.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-2bb6f99a3d1d9206.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-527700ed764617bf.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/{layout-0c70201c7bb15ab5.js → layout-fc4ee3669b9e2432.js} +1 -1
- package/app/.next/static/chunks/app/_global-error/page-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/_not-found/page-277ff0ac5be7dff3.js +1 -0
- package/app/.next/static/chunks/app/api/auth/login/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/auth/logout/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/auth/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/credentials/update/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/model/resolve/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/models/alias/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/combos/[id]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/combos/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/employees/[keyId]/stats/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/employees/stats/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/init/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/keys/[id]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/keys/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/locale/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/models/alias/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/models/availability/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/models/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/models/test/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/pricing/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/client/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/test-batch/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/providers/validate/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/settings/database/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/settings/proxy-test/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/settings/require-login/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/settings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/shutdown/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/tags/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/translator/console-logs/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/translator/load/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/translator/save/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/translator/send/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/translator/translate/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/disable/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/enable/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/status/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/chart/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/history/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/logs/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/providers/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-details/[id]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-details/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-logs/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/stats/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/usage/stream/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/api/chat/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/embeddings/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/responses/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/v1internal/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/api/version/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/callback/{page-9d25f25730ec1a87.js → page-a288ef2f47fd5eb3.js} +1 -1
- package/app/.next/static/chunks/app/dashboard/settings/pricing/{page-107a395e4ebca682.js → page-f94017840394ebe8.js} +1 -1
- package/app/.next/static/chunks/app/landing/page-1d109564bc0bc007.js +1 -0
- package/app/.next/static/chunks/app/{layout-24366c741111b3ce.js → layout-372932853e1ca466.js} +1 -1
- package/app/.next/static/chunks/app/login/page-60dcddda96a06c28.js +1 -0
- package/app/.next/static/chunks/app/manifest.webmanifest/route-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/app/page-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/{main-app-d65284096ddebd50.js → main-app-825c409f56c59467.js} +1 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/global-error-45c792615bbed600.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-bc93a8fd4c287f29.js +1 -0
- package/app/.next/static/chunks/{webpack-1094c4a28660424b.js → webpack-a2cf08368369c277.js} +1 -1
- package/app/.next/static/css/081a0afca5a9bd20.css +1 -0
- package/app/.next/static/css/bc7b15f1fd95fc16.css +1 -0
- package/app/.next/static/jte_Hfgy-t_AHpT39tLxg/_buildManifest.js +1 -0
- package/app/i18n/README.ja-JP.md +1209 -0
- package/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/app/node_modules/better-sqlite3/lib/database.js +90 -0
- package/app/node_modules/better-sqlite3/lib/index.js +3 -0
- package/app/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
- package/app/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
- package/app/node_modules/better-sqlite3/lib/methods/function.js +31 -0
- package/app/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
- package/app/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
- package/app/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
- package/app/node_modules/better-sqlite3/lib/methods/table.js +189 -0
- package/app/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
- package/app/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
- package/app/node_modules/better-sqlite3/lib/sqlite-error.js +20 -0
- package/app/node_modules/better-sqlite3/lib/util.js +12 -0
- package/app/node_modules/better-sqlite3/package.json +59 -0
- package/app/node_modules/bindings/bindings.js +221 -0
- package/app/node_modules/bindings/package.json +28 -0
- package/app/node_modules/file-uri-to-path/index.js +66 -0
- package/app/node_modules/file-uri-to-path/package.json +32 -0
- package/app/open-sse/executors/iflow.js +5 -1
- package/app/open-sse/handlers/chatCore/nonStreamingHandler.js +10 -0
- package/app/open-sse/handlers/chatCore/sseToJsonHandler.js +61 -4
- package/app/open-sse/services/accountFallback.js +6 -0
- package/app/open-sse/services/combo.js +59 -7
- package/app/open-sse/translator/helpers/geminiHelper.js +9 -1
- package/app/open-sse/translator/request/openai-to-claude.js +5 -0
- package/app/open-sse/translator/request/openai-to-gemini.js +4 -2
- package/app/open-sse/translator/request/openai-to-kiro.js +32 -19
- package/app/open-sse/translator/response/openai-responses.js +6 -3
- package/app/package.json +3 -2
- package/app/public/providers/assemblyai.png +0 -0
- package/app/public/providers/deepgram.png +0 -0
- package/app/public/providers/hyperbolic.png +0 -0
- package/app/public/providers/nanobanana.png +0 -0
- package/app/server.js +1 -1
- package/hooks/postinstall.js +94 -43
- package/package.json +1 -1
- package/app/.next/server/chunks/4755.js +0 -1
- package/app/.next/server/chunks/4989.js +0 -2
- package/app/.next/server/chunks/5984.js +0 -1
- package/app/.next/server/chunks/6649.js +0 -1
- package/app/.next/server/chunks/6836.js +0 -1
- package/app/.next/static/6NQ1tUqoUU-Vnz_TZ3Qh-/_buildManifest.js +0 -1
- package/app/.next/static/chunks/5497-9d0bc17e435a8c93.js +0 -7
- package/app/.next/static/chunks/5772-81f907ca6ec17897.js +0 -3
- package/app/.next/static/chunks/6902-59c9bd4da89daa6c.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-498aa76895400b7f.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-a2900807101b8a33.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/console-log/page-6f9b44a8af082c71.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/employees/[keyId]/page-349626384b53a093.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/page-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-493eb2eac64153a5.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7efc5c1ea19f02ec.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-cd17e15c22790e9b.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-a6bd29ee2d2672c6.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-173679dc8c62c4a0.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-de3fbce2b737ec72.js +0 -1
- package/app/.next/static/chunks/app/_global-error/page-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/_not-found/page-7e26da6572c546ac.js +0 -1
- package/app/.next/static/chunks/app/api/auth/login/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/auth/logout/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/auth/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/credentials/update/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/model/resolve/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/models/alias/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/combos/[id]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/combos/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/employees/[keyId]/stats/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/employees/stats/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/init/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/keys/[id]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/keys/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/locale/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/models/alias/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/models/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/models/test/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/pricing/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/client/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/test-batch/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/providers/validate/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/settings/database/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/settings/proxy-test/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/settings/require-login/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/settings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/shutdown/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/tags/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/translator/console-logs/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/translator/load/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/translator/save/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/translator/send/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/translator/translate/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/disable/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/enable/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/status/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/chart/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/history/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/logs/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/providers/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-details/[id]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-details/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-logs/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/stats/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/usage/stream/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/api/chat/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/embeddings/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/models/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/responses/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/v1internal/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/api/version/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/landing/page-a9fde23d5773613c.js +0 -1
- package/app/.next/static/chunks/app/login/page-650676272c54863b.js +0 -1
- package/app/.next/static/chunks/app/manifest.webmanifest/route-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/app/page-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/global-error-3c2797dc10ec6327.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-aed1b231bb49a704.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-aed1b231bb49a704.js +0 -1
- package/app/.next/static/css/d8615a67dff78a65.css +0 -3
- /package/app/.next/static/{6NQ1tUqoUU-Vnz_TZ3Qh- → jte_Hfgy-t_AHpT39tLxg}/_ssgManifest.js +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"model": "{{model}}",
|
|
5
5
|
"provider": "openai",
|
|
6
6
|
"apiKey": "{{apiKey}}"
|
|
7
|
-
}`}}}},97397:(e,t,s)=>{s.d(t,{Tk:()=>o,Ah:()=>d,a7:()=>p,ZM:()=>x,tA:()=>h,kn:()=>g,yZ:()=>m,qO:()=>u});var l=s(95155),a=s(12115),r=s(35497),i=s(5772);let n=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function o({tool:e,isExpanded:t,onToggle:s,activeProviders:d,modelMappings:c,onModelMappingChange:x,baseUrl:m,hasActiveProviders:p,apiKeys:u,cloudEnabled:h,initialStatus:g}){let f,y,b,[j,N]=(0,a.useState)(g||null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(null),[O,I]=(0,a.useState)(!1),[P,M]=(0,a.useState)(!1),[T,R]=(0,a.useState)(null),[$,L]=(0,a.useState)(""),[K,U]=(0,a.useState)({}),[D,F]=(0,a.useState)(!1),[z,H]=(0,a.useState)(""),[B,q]=(0,a.useState)(!1),W=(0,a.useRef)(!1),G=(()=>{if(!j?.installed)return null;let e=j.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=h&&n&&e.startsWith(n),l=m&&e.startsWith(m);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{u?.length>0&&!$&&L(u[0].key)},[u,$]),(0,a.useEffect)(()=>{g&&N(g)},[g]),(0,a.useEffect)(()=>{t&&!j&&(Y(),Z()),t&&Z()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{q(!!e.ccFilterNaming)}).catch(()=>{})},[]);let J=async e=>{let t=e.target.checked;q(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(j?.installed&&!W.current){W.current=!0;let t=j.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&x(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&u?.some(e=>e.key===s)&&L(s)}},[j,u,e.defaultModels,x]);let Y=async()=>{w(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{w(!1)}},V=()=>{let e=z||m;return e.endsWith("/v1")?e:`${e}/v1`},X=async()=>{C(!0),E(null);try{let t={ANTHROPIC_BASE_URL:V()},s=$?.trim()||(u?.length>0?u[0].key:null)||(h?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=c[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(E({type:"success",text:"Settings applied successfully!"}),N(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):E({type:"error",text:a.error||"Failed to apply settings"})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}},Q=async()=>{_(!0),E(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(E({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>x(e.alias,e.defaultValue||"")),L("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({type:"error",text:e.message})}finally{_(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!v&&j&&!j.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Claude CLI to use this feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>I(!O),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:O?"expand_less":"help"}),O?"Hide":"How to Install"]})]}),O&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!v&&j?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(f=z||m).endsWith("/v1")?f:`${f}/v1`,onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),z&&z!==m&&(0,l.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),u.length>0?(0,l.jsx)("select",{value:$,onChange:e=>L(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:u.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:h?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:c[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{R(e.alias),M(!0)},disabled:!p,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),c[e.alias]&&(0,l.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:B,onChange:J,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),A&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,l.jsx)("span",{children:A.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:!p,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!j?.has9Router,loading:S,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>F(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:P,onClose:()=>M(!1),onSelect:e=>{T&&x(T,e.value)},selectedModel:T?c[T]:null,activeProviders:d,modelAliases:K,title:`Select model for ${T}`}),(0,l.jsx)(r.uR,{isOpen:D,onClose:()=>F(!1),title:"Claude CLI - Manual Configuration",configs:(y=$&&$.trim()?$:h?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b={ANTHROPIC_BASE_URL:V(),ANTHROPIC_AUTH_TOKEN:y},e.defaultModels.forEach(e=>{let t=c[e.alias];t&&e.envKey&&(b[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({env:b},null,2)}])})]})}function d({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:c,cloudEnabled:x,initialStatus:m}){let p,u,h,[g,f]=(0,a.useState)(m||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(""),[P,M]=(0,a.useState)(!1),[T,R]=(0,a.useState)({}),[$,L]=(0,a.useState)(!1),[K,U]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!A&&E(o[0].key)},[o,A]),(0,a.useEffect)(()=>{m&&f(m)},[m]),(0,a.useEffect)(()=>{t&&!g&&(H(),D()),t&&D()},[t]);let D=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&R(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.config){let e=g.config.match(/^model\s*=\s*"([^"]+)"/m);e&&I(e[1])}},[g]);let F=g?.installed?g.config?g.config.includes(n)||g.config.includes("localhost")||g.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,z=()=>{let e=K||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},H=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},B=async()=>{N(!0),C(null);try{let e=A&&A.trim()||x?A:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:z(),apiKey:e,model:O})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),H()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},q=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),I(""),H()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===F&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===F&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===F&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!y&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Codex CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>_(!S),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:S?"expand_less":"help"}),S?"Hide":"How to Install"]})]}),S&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.config&&((u=(p=g.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:u})]}):null),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:K||`${n}/v1`,onChange:e=>U(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),K&&K!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>U(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:A,onChange:e=>E(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:O,onChange:e=>I(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>M(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),O&&(0,l.jsx)("button",{onClick:()=>I(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:B,disabled:!A||!O,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:q,disabled:!g.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:P,onClose:()=>M(!1),onSelect:e=>{I(e.value),M(!1)},selectedModel:O,activeProviders:c,modelAliases:T,title:"Select Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:$,onClose:()=>L(!1),title:"Codex CLI - Manual Configuration",configs:(h=A&&A.trim()?A:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
|
|
7
|
+
}`}}}},97397:(e,t,s)=>{s.d(t,{Tk:()=>o,Ah:()=>d,a7:()=>p,ZM:()=>x,tA:()=>h,kn:()=>g,yZ:()=>m,qO:()=>u});var l=s(95155),a=s(12115),r=s(35497),i=s(5772);let n=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function o({tool:e,isExpanded:t,onToggle:s,activeProviders:d,modelMappings:c,onModelMappingChange:x,baseUrl:m,hasActiveProviders:p,apiKeys:u,cloudEnabled:h,initialStatus:g}){let f,y,b,[j,N]=(0,a.useState)(g||null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(null),[O,I]=(0,a.useState)(!1),[M,P]=(0,a.useState)(!1),[R,T]=(0,a.useState)(null),[$,L]=(0,a.useState)(""),[K,U]=(0,a.useState)({}),[D,F]=(0,a.useState)(!1),[z,H]=(0,a.useState)(""),[B,q]=(0,a.useState)(!1),W=(0,a.useRef)(!1),G=(()=>{if(!j?.installed)return null;let e=j.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=h&&n&&e.startsWith(n),l=m&&e.startsWith(m);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{u?.length>0&&!$&&L(u[0].key)},[u,$]),(0,a.useEffect)(()=>{g&&N(g)},[g]),(0,a.useEffect)(()=>{t&&!j&&(Y(),Z()),t&&Z()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{q(!!e.ccFilterNaming)}).catch(()=>{})},[]);let J=async e=>{let t=e.target.checked;q(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(j?.installed&&!W.current){W.current=!0;let t=j.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&x(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&u?.some(e=>e.key===s)&&L(s)}},[j,u,e.defaultModels,x]);let Y=async()=>{w(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{w(!1)}},V=()=>{let e=z||m;return e.endsWith("/v1")?e:`${e}/v1`},X=async()=>{C(!0),E(null);try{let t={ANTHROPIC_BASE_URL:V()},s=$?.trim()||(u?.length>0?u[0].key:null)||(h?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=c[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(E({type:"success",text:"Settings applied successfully!"}),N(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):E({type:"error",text:a.error||"Failed to apply settings"})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}},Q=async()=>{_(!0),E(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(E({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>x(e.alias,e.defaultValue||"")),L("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({type:"error",text:e.message})}finally{_(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!v&&j&&!j.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Claude CLI to use this feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>I(!O),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:O?"expand_less":"help"}),O?"Hide":"How to Install"]})]}),O&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!v&&j?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(f=z||m).endsWith("/v1")?f:`${f}/v1`,onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),z&&z!==m&&(0,l.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),u.length>0?(0,l.jsx)("select",{value:$,onChange:e=>L(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:u.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:h?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:c[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{T(e.alias),P(!0)},disabled:!p,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),c[e.alias]&&(0,l.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:B,onChange:J,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),A&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,l.jsx)("span",{children:A.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:!p,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!j?.has9Router,loading:S,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>F(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:M,onClose:()=>P(!1),onSelect:e=>{R&&x(R,e.value)},selectedModel:R?c[R]:null,activeProviders:d,modelAliases:K,title:`Select model for ${R}`}),(0,l.jsx)(r.uR,{isOpen:D,onClose:()=>F(!1),title:"Claude CLI - Manual Configuration",configs:(y=$&&$.trim()?$:h?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b={ANTHROPIC_BASE_URL:V(),ANTHROPIC_AUTH_TOKEN:y},e.defaultModels.forEach(e=>{let t=c[e.alias];t&&e.envKey&&(b[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({env:b},null,2)}])})]})}function d({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:c,cloudEnabled:x,initialStatus:m}){let p,u,h,[g,f]=(0,a.useState)(m||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(""),[M,P]=(0,a.useState)(!1),[R,T]=(0,a.useState)({}),[$,L]=(0,a.useState)(!1),[K,U]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!A&&E(o[0].key)},[o,A]),(0,a.useEffect)(()=>{m&&f(m)},[m]),(0,a.useEffect)(()=>{t&&!g&&(H(),D()),t&&D()},[t]);let D=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&T(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.config){let e=g.config.match(/^model\s*=\s*"([^"]+)"/m);e&&I(e[1])}},[g]);let F=g?.installed?g.config?g.config.includes(n)||g.config.includes("localhost")||g.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,z=()=>{let e=K||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},H=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},B=async()=>{N(!0),C(null);try{let e=A&&A.trim()||x?A:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:z(),apiKey:e,model:O})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),H()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},q=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),I(""),H()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===F&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===F&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===F&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!y&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Codex CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>_(!S),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:S?"expand_less":"help"}),S?"Hide":"How to Install"]})]}),S&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.config&&((u=(p=g.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:u})]}):null),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:K||`${n}/v1`,onChange:e=>U(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),K&&K!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>U(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:A,onChange:e=>E(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:O,onChange:e=>I(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>P(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),O&&(0,l.jsx)("button",{onClick:()=>I(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:B,disabled:!A||!O,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:q,disabled:!g.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:M,onClose:()=>P(!1),onSelect:e=>{I(e.value),P(!1)},selectedModel:O,activeProviders:c,modelAliases:R,title:"Select Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:$,onClose:()=>L(!1),title:"Codex CLI - Manual Configuration",configs:(h=A&&A.trim()?A:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
|
|
8
8
|
model = "${O}"
|
|
9
9
|
model_provider = "9router"
|
|
10
10
|
|
|
@@ -12,4 +12,4 @@ model_provider = "9router"
|
|
|
12
12
|
name = "9Router"
|
|
13
13
|
base_url = "${z()}"
|
|
14
14
|
wire_api = "responses"
|
|
15
|
-
`},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:h},null,2)}])})]})}let c=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function x({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:p,initialStatus:u}){let h,g,f,y,[b,j]=(0,a.useState)(u||null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[_,A]=(0,a.useState)(null),[E,O]=(0,a.useState)(""),[I,P]=(0,a.useState)(""),[M,T]=(0,a.useState)(!1),[R,$]=(0,a.useState)({}),[L,K]=(0,a.useState)(!1),[U,D]=(0,a.useState)(""),F=(0,a.useRef)(!1),z=(()=>{if(!b?.installed)return null;let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=p&&c&&e.baseUrl?.startsWith(c),l=n&&e.baseUrl?.startsWith(n);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!E&&O(d[0].key)},[d,E]),(0,a.useEffect)(()=>{u&&j(u)},[u]),(0,a.useEffect)(()=>{t&&!b&&(B(),H()),t&&H()},[t]);let H=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&$(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(b?.installed&&!F.current){F.current=!0;let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e&&(e.model&&P(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&O(e.apiKey))}},[b,d]);let B=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();j(t)}catch(e){j({installed:!1,error:e.message})}finally{v(!1)}},q=()=>{let e=U||n;return e.endsWith("/v1")?e:`${e}/v1`},W=async()=>{k(!0),A(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(p?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:q(),apiKey:e,model:I})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),B()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}},G=async()=>{S(!0),A(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(A({type:"success",text:"Settings reset successfully!"}),P(""),O(""),B()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({type:"error",text:e.message})}finally{S(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[N&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!N&&b&&!b.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Factory Droid CLI to use this feature."})]})]}),!N&&b?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[b?.settings?.customModels?.find(e=>"custom:9Router-0"===e.id)?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:b.settings.customModels.find(e=>"custom:9Router-0"===e.id).baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(h=U||n).endsWith("/v1")?h:`${h}/v1`,onChange:e=>D(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),U&&U!==n&&(0,l.jsx)("button",{onClick:()=>D(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:E,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:p?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:I,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>T(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),I&&(0,l.jsx)("button",{onClick:()=>P(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),_&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===_.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===_.type?"check_circle":"error"}),(0,l.jsx)("span",{children:_.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:W,disabled:!I,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:G,disabled:!b?.has9Router,loading:C,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>K(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:M,onClose:()=>T(!1),onSelect:e=>{P(e.value),T(!1)},selectedModel:I,activeProviders:m,modelAliases:R,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:L,onClose:()=>K(!1),title:"Factory Droid - Manual Configuration",configs:(g=E&&E.trim()?E:p?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f={customModels:[{model:I||"provider/model-id",id:"custom:9Router-0",index:0,baseUrl:q(),apiKey:g,displayName:I||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},y="u">typeof navigator&&navigator.platform,[{filename:y?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(f,null,2)}])})]})}function m({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:p}){let u,h,[g,f]=(0,a.useState)(p||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(!1),[P,M]=(0,a.useState)({}),[T,R]=(0,a.useState)(!1),[$,L]=(0,a.useState)(""),K=(0,a.useRef)(!1),U=(()=>{if(!g?.installed)return null;let e=g.settings?.models?.providers?.["9router"];if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1")||e.baseUrl?.includes("0.0.0.0"),s=n&&e.baseUrl?.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,a.useEffect)(()=>{p&&f(p)},[p]),(0,a.useEffect)(()=>{t&&!g&&(F(),D()),t&&D()},[t]);let D=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.installed&&!K.current){K.current=!0;let e=g.settings?.models?.providers?.["9router"];if(e){let t=g.settings?.agents?.defaults?.model?.primary;t&&E(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&_(e.apiKey)}}},[g,d]);let F=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},z=()=>window.location.origin.replace("://localhost","://127.0.0.1"),H=()=>{let e=$||z();return e.endsWith("/v1")?e:`${e}/v1`},B=async()=>{N(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:H(),apiKey:e,model:A})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),F()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},q=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),_(""),F()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!y&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Open Claw CLI to use this feature."})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.models.providers["9router"].baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(u=$||z()).endsWith("/v1")?u:`${u}/v1`,onChange:e=>L(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),$&&$!==n&&(0,l.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>I(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:B,disabled:!A,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:q,disabled:!g?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>R(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{E(e.value),I(!1)},selectedModel:A,activeProviders:c,modelAliases:P,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:T,onClose:()=>R(!1),title:"Open Claw - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${A||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:H(),apiKey:h,api:"openai-completions",models:[{id:A||"provider/model-id",name:(A||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}function p({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:o,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1,tunnelEnabled:m=!1}){let[u,h]=(0,a.useState)(null),[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(""),[j,N]=(0,a.useState)(()=>d?.length>0?d[0].key:""),v=e=>{let t=j&&j.trim()?j:x?"your-api-key":"sk_9router",s=o||"http://localhost:20128",l=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,l).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,y||"provider/model-id")},w=async(e,t)=>{await navigator.clipboard.writeText(v(e)),h(t),setTimeout(()=>h(null),2e3)},k=c.length>0,C=()=>(!t.requiresExternalUrl||!!x||!!m)&&(!t.requiresCloud||!!x);return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,l.jsx)(i.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):t.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,l.jsx)(i.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&(x||m))return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!x&&!m,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):a&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,l.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,l.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,C()&&t.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:j,onChange:e=>N(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>w(j,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===u?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:y,onChange:e=>b(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>f(!0),disabled:!k,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${k?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),y&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>w(y,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===u?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>b(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:v(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>w(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:u===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),C()&&t.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>w(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===u?"check":"content_copy"}),"codeblock"===u?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:v(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:g,onClose:()=>f(!1),onSelect:e=>{b(e.value)},selectedModel:y,activeProviders:c,title:"Select Model"})]})}function u({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:x}){let m,[p,h]=(0,a.useState)(x||null),[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(!1),[P,M]=(0,a.useState)({}),[T,R]=(0,a.useState)(!1),[$,L]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!S&&_(o[0].key)},[o,S]),(0,a.useEffect)(()=>{x&&h(x)},[x]),(0,a.useEffect)(()=>{t&&!p&&(F(),K()),t&&K()},[t]),(0,a.useEffect)(()=>{p?.config?.model?.startsWith("9router/")&&E(p.config.model.replace("9router/",""))},[p]);let K=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},U=(()=>{if(!p?.installed)return null;if(!p.config)return"not_configured";let e=p.config?.provider?.["9router"]?.options?.baseURL||"",t=e.includes("localhost")||e.includes("127.0.0.1");return p.has9Router&&(t||e.includes(n))?"configured":p.has9Router?"other":"not_configured"})(),D=()=>{let e=$||n;return e.endsWith("/v1")?e:`${e}/v1`},F=async()=>{f(!0);try{let e=await fetch("/api/cli-tools/opencode-settings"),t=await e.json();h(t)}catch(e){h({installed:!1,error:e.message})}finally{f(!1)}},z=async()=>{b(!0),w(null);try{let e=S&&S.trim()||c?S:"sk_9router",t=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:D(),apiKey:e,model:A})}),s=await t.json();t.ok?(w({type:"success",text:"Settings applied successfully!"}),F()):w({type:"error",text:s.error||"Failed to apply settings"})}catch(e){w({type:"error",text:e.message})}finally{b(!1)}},H=async()=>{N(!0),w(null);try{let e=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:"Settings reset successfully!"}),E(""),F()):w({type:"error",text:t.error||"Failed to reset settings"})}catch(e){w({type:"error",text:e.message})}finally{N(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/opencode.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!g&&p&&!p.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install OpenCode CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>C(!k),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:k?"expand_less":"help"}),k?"Hide":"How to Install"]})]}),k&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!g&&p?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[p?.config?.provider?.["9router"]?.options?.baseURL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:p.config.provider["9router"].options.baseURL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:$||`${n}/v1`,onChange:e=>L(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),$&&$!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:c?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>I(!0),disabled:!d?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),v&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===v.type?"check_circle":"error"}),(0,l.jsx)("span",{children:v.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:z,disabled:!A,loading:y,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:H,disabled:!p.has9Router,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>R(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{E(e.value),I(!1)},selectedModel:A,activeProviders:d,modelAliases:P,title:"Select Model for OpenCode"}),(0,l.jsx)(r.uR,{isOpen:T,onClose:()=>R(!1),title:"OpenCode - Manual Configuration",configs:(m=S&&S.trim()?S:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:D(),apiKey:m},models:{[A||"provider/model-id"]:{name:A||"provider/model-id"}}}},model:`9router/${A||"provider/model-id"}`},null,2)}])})]})}function h({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[u,g]=(0,a.useState)(""),[f,y]=(0,a.useState)(null),[b,j]=(0,a.useState)(null),N="u">typeof navigator&&navigator.userAgent?.includes("Windows"),v=i?.isAdmin!==!1;(0,a.useEffect)(()=>{e?.length>0&&!u&&g(e[0].key)},[e,u]),(0,a.useEffect)(()=>{w()},[]);let w=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();n(t),s?.(t)}}catch{n({running:!1,certExists:!1,dnsStatus:{}})}},k=e=>{N||i?.hasCachedPassword?C(e,""):(j(e),x(!0),y(null))},C=async(s,l)=>{d(!0),y(null);try{if("trust-cert"===s){let e=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:l})}),t=await e.json();e.ok?y({type:"success",text:"Certificate trusted successfully"}):y({type:"error",text:t.error||"Failed to trust certificate"})}else if("start"===s){let s=u?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router"),a=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l})}),r=await a.json();a.ok?y({type:"success",text:"Server started"}):y({type:"error",text:r.error||"Failed to start server"})}else{let e=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})}),t=await e.json();e.ok?y({type:"success",text:"Server stopped — all DNS cleared"}):y({type:"error",text:t.error||"Failed to stop server"})}x(!1),p(""),await w()}catch(e){y({type:"error",text:e.message})}finally{d(!1),j(null)}},S=()=>{m.trim()?C(b,m):y({type:"error",text:"Sudo password is required"})},_=i?.running;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,l.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),_?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Running"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,l.jsx)("div",{className:"flex items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:i?.certExists},{label:"Trusted",ok:i?.certTrusted},{label:"Server",ok:_}].map(({label:e,ok:t})=>(0,l.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,l.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from iRouter"]}),(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → iRouter → response to Antigravity/Copilot"]})]}),!_&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"API Key"}),e?.length>0?(0,l.jsx)("select",{value:u,onChange:e=>g(e.target.value),className:"flex-1 px-2 py-1 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"text-xs text-text-muted",children:t?"No API keys — create one in Keys page":"sk_9router (default)"})]}),f&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===f.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===f.type?"check_circle":"error"}),(0,l.jsx)("span",{children:f.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>k("trust-cert"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),_?(0,l.jsxs)("button",{onClick:()=>k("stop"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>k("start"),disabled:o||N&&!v,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),_&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),N&&!v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,l.jsx)("span",{children:"Administrator required — restart iRouter as Administrator to use MITM"})]})]})}),c&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||S()}}),f&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:f.text})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),p(""),y(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:S,loading:o,children:"Confirm"})]})]})})]})}function g({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,apiKeys:c,activeProviders:x,hasActiveProviders:m,modelAliases:p={},cloudEnabled:u,onDnsChange:h}){let[f,y]=(0,a.useState)(!1),[b,j]=(0,a.useState)(null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(""),[C,S]=(0,a.useState)(null),[_,A]=(0,a.useState)({}),[E,O]=(0,a.useState)(!1),[I,P]=(0,a.useState)(null),M="u">typeof navigator&&navigator.userAgent?.includes("Windows");(0,a.useEffect)(()=>{t&&T()},[t]);let T=async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e.id}`);if(t.ok){let e=await t.json();Object.keys(e.aliases||{}).length>0&&A(e.aliases)}}catch{}},R=(0,a.useCallback)(async t=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,mappings:t})})}catch{}},[e.id]),$=(e,t)=>{A(s=>({...s,[e]:t}))},L=()=>{if(!n)return;let e=o?"disable":"enable";M||d?K(e,""):(S(e),v(!0),j(null))},K=async(t,s)=>{y(!0),j(null);try{let l=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),a=await l.json();if(!l.ok)throw Error(a.error||"Failed to toggle DNS");"enable"===t?j({type:"success",text:"DNS enabled successfully.",warning:`Please restart ${e.name} to apply changes.`}):j({type:"success",text:"DNS disabled — traffic restored"}),v(!1),k(""),h?.(a)}catch(e){j({type:"error",text:e.message})}finally{y(!1),S(null)}},U=()=>{w.trim()?K(C,w):j({type:"error",text:"Sudo password is required"})};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),n?o?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:["Intercept ",e.name," requests via MITM proxy"]})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,l.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through iRouter via MITM."]}),!o&&(0,l.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),b&&(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===b.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===b.type?"check_circle":"error"}),(0,l.jsx)("span",{children:b.text})]}),b.warning&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-amber-500/10 text-amber-600 border border-amber-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,l.jsx)("span",{className:"font-medium",children:b.warning})]})]}),e.defaultModels?.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-36 shrink-0 text-xs font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:_[e.alias]||"",onChange:t=>$(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void R({..._,[s]:l})},placeholder:"provider/model-id",disabled:!o,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${!o?"opacity-50 cursor-not-allowed":""}`}),(0,l.jsx)("button",{onClick:()=>{P(e.alias),O(!0)},disabled:!m||!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 ${m&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),_[e.alias]&&(0,l.jsx)("button",{onClick:()=>{$(e.alias,""),R({..._,[e.alias]:""})},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))}),e.defaultModels?.length===0&&(0,l.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,l.jsx)("div",{children:o?(0,l.jsxs)("button",{onClick:L,disabled:!n||f,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:L,loading:f,disabled:!n||f,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"play_circle"}),"Start DNS"]})})]})]}),N&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:w,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"!==e.key||f||U()}}),b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:b.text})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{v(!1),k(""),j(null)},disabled:f,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:U,loading:f,children:"Confirm"})]})]})}),(0,l.jsx)(r.rq,{isOpen:E,onClose:()=>O(!1),onSelect:e=>{if(!I||e.isPlaceholder)return;let t={..._,[I]:e.value};A(t),R(t)},selectedModel:I?_[I]:null,activeProviders:x,modelAliases:p,title:`Select model for ${I}`})]})}}}]);
|
|
15
|
+
`},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:h},null,2)}])})]})}let c=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function x({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:p,initialStatus:u}){let h,g,f,y,[b,j]=(0,a.useState)(u||null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[_,A]=(0,a.useState)(null),[E,O]=(0,a.useState)(""),[I,M]=(0,a.useState)(""),[P,R]=(0,a.useState)(!1),[T,$]=(0,a.useState)({}),[L,K]=(0,a.useState)(!1),[U,D]=(0,a.useState)(""),F=(0,a.useRef)(!1),z=(()=>{if(!b?.installed)return null;let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=p&&c&&e.baseUrl?.startsWith(c),l=n&&e.baseUrl?.startsWith(n);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!E&&O(d[0].key)},[d,E]),(0,a.useEffect)(()=>{u&&j(u)},[u]),(0,a.useEffect)(()=>{t&&!b&&(B(),H()),t&&H()},[t]);let H=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&$(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(b?.installed&&!F.current){F.current=!0;let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e&&(e.model&&M(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&O(e.apiKey))}},[b,d]);let B=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();j(t)}catch(e){j({installed:!1,error:e.message})}finally{v(!1)}},q=()=>{let e=U||n;return e.endsWith("/v1")?e:`${e}/v1`},W=async()=>{k(!0),A(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(p?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:q(),apiKey:e,model:I})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),B()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}},G=async()=>{S(!0),A(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(A({type:"success",text:"Settings reset successfully!"}),M(""),O(""),B()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({type:"error",text:e.message})}finally{S(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[N&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!N&&b&&!b.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Factory Droid CLI to use this feature."})]})]}),!N&&b?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[b?.settings?.customModels?.find(e=>"custom:9Router-0"===e.id)?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:b.settings.customModels.find(e=>"custom:9Router-0"===e.id).baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(h=U||n).endsWith("/v1")?h:`${h}/v1`,onChange:e=>D(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),U&&U!==n&&(0,l.jsx)("button",{onClick:()=>D(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:E,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:p?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:I,onChange:e=>M(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>R(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),I&&(0,l.jsx)("button",{onClick:()=>M(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),_&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===_.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===_.type?"check_circle":"error"}),(0,l.jsx)("span",{children:_.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:W,disabled:!I,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:G,disabled:!b?.has9Router,loading:C,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>K(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:P,onClose:()=>R(!1),onSelect:e=>{M(e.value),R(!1)},selectedModel:I,activeProviders:m,modelAliases:T,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:L,onClose:()=>K(!1),title:"Factory Droid - Manual Configuration",configs:(g=E&&E.trim()?E:p?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f={customModels:[{model:I||"provider/model-id",id:"custom:9Router-0",index:0,baseUrl:q(),apiKey:g,displayName:I||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},y="u">typeof navigator&&navigator.platform,[{filename:y?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(f,null,2)}])})]})}function m({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:p}){let u,h,[g,f]=(0,a.useState)(p||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(!1),[M,P]=(0,a.useState)({}),[R,T]=(0,a.useState)(!1),[$,L]=(0,a.useState)(""),K=(0,a.useRef)(!1),U=(()=>{if(!g?.installed)return null;let e=g.settings?.models?.providers?.["9router"];if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1")||e.baseUrl?.includes("0.0.0.0"),s=n&&e.baseUrl?.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,a.useEffect)(()=>{p&&f(p)},[p]),(0,a.useEffect)(()=>{t&&!g&&(F(),D()),t&&D()},[t]);let D=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&P(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.installed&&!K.current){K.current=!0;let e=g.settings?.models?.providers?.["9router"];if(e){let t=g.settings?.agents?.defaults?.model?.primary;t&&E(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&_(e.apiKey)}}},[g,d]);let F=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},z=()=>window.location.origin.replace("://localhost","://127.0.0.1"),H=()=>{let e=$||z();return e.endsWith("/v1")?e:`${e}/v1`},B=async()=>{N(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:H(),apiKey:e,model:A})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),F()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},q=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),_(""),F()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!y&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Open Claw CLI to use this feature."})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.models.providers["9router"].baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(u=$||z()).endsWith("/v1")?u:`${u}/v1`,onChange:e=>L(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),$&&$!==n&&(0,l.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>I(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:B,disabled:!A,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:q,disabled:!g?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{E(e.value),I(!1)},selectedModel:A,activeProviders:c,modelAliases:M,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:R,onClose:()=>T(!1),title:"Open Claw - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${A||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:H(),apiKey:h,api:"openai-completions",models:[{id:A||"provider/model-id",name:(A||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}function p({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:o,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1,tunnelEnabled:m=!1}){let[u,h]=(0,a.useState)(null),[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(""),[j,N]=(0,a.useState)(()=>d?.length>0?d[0].key:""),v=e=>{let t=j&&j.trim()?j:x?"your-api-key":"sk_9router",s=o||"http://localhost:20128",l=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,l).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,y||"provider/model-id")},w=async(e,t)=>{await navigator.clipboard.writeText(v(e)),h(t),setTimeout(()=>h(null),2e3)},k=c.length>0,C=()=>(!t.requiresExternalUrl||!!x||!!m)&&(!t.requiresCloud||!!x);return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,l.jsx)(i.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):t.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,l.jsx)(i.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&(x||m))return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!x&&!m,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):a&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,l.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,l.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,C()&&t.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:j,onChange:e=>N(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>w(j,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===u?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:y,onChange:e=>b(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>f(!0),disabled:!k,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${k?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),y&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>w(y,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===u?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>b(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:v(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>w(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:u===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),C()&&t.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>w(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===u?"check":"content_copy"}),"codeblock"===u?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:v(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:g,onClose:()=>f(!1),onSelect:e=>{b(e.value)},selectedModel:y,activeProviders:c,title:"Select Model"})]})}function u({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:x}){let m,[p,h]=(0,a.useState)(x||null),[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(!1),[M,P]=(0,a.useState)({}),[R,T]=(0,a.useState)(!1),[$,L]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!S&&_(o[0].key)},[o,S]),(0,a.useEffect)(()=>{x&&h(x)},[x]),(0,a.useEffect)(()=>{t&&!p&&(F(),K()),t&&K()},[t]),(0,a.useEffect)(()=>{p?.config?.model?.startsWith("9router/")&&E(p.config.model.replace("9router/",""))},[p]);let K=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&P(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},U=(()=>{if(!p?.installed)return null;if(!p.config)return"not_configured";let e=p.config?.provider?.["9router"]?.options?.baseURL||"",t=e.includes("localhost")||e.includes("127.0.0.1");return p.has9Router&&(t||e.includes(n))?"configured":p.has9Router?"other":"not_configured"})(),D=()=>{let e=$||n;return e.endsWith("/v1")?e:`${e}/v1`},F=async()=>{f(!0);try{let e=await fetch("/api/cli-tools/opencode-settings"),t=await e.json();h(t)}catch(e){h({installed:!1,error:e.message})}finally{f(!1)}},z=async()=>{b(!0),w(null);try{let e=S&&S.trim()||c?S:"sk_9router",t=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:D(),apiKey:e,model:A})}),s=await t.json();t.ok?(w({type:"success",text:"Settings applied successfully!"}),F()):w({type:"error",text:s.error||"Failed to apply settings"})}catch(e){w({type:"error",text:e.message})}finally{b(!1)}},H=async()=>{N(!0),w(null);try{let e=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:"Settings reset successfully!"}),E(""),F()):w({type:"error",text:t.error||"Failed to reset settings"})}catch(e){w({type:"error",text:e.message})}finally{N(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/opencode.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===U&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!g&&p&&!p.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install OpenCode CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>C(!k),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:k?"expand_less":"help"}),k?"Hide":"How to Install"]})]}),k&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!g&&p?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[p?.config?.provider?.["9router"]?.options?.baseURL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:p.config.provider["9router"].options.baseURL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:$||`${n}/v1`,onChange:e=>L(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),$&&$!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:c?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>I(!0),disabled:!d?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),v&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===v.type?"check_circle":"error"}),(0,l.jsx)("span",{children:v.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:z,disabled:!A,loading:y,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:H,disabled:!p.has9Router,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{E(e.value),I(!1)},selectedModel:A,activeProviders:d,modelAliases:M,title:"Select Model for OpenCode"}),(0,l.jsx)(r.uR,{isOpen:R,onClose:()=>T(!1),title:"OpenCode - Manual Configuration",configs:(m=S&&S.trim()?S:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:D(),apiKey:m},models:{[A||"provider/model-id"]:{name:A||"provider/model-id"}}}},model:`9router/${A||"provider/model-id"}`},null,2)}])})]})}function h({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[u,g]=(0,a.useState)(""),[f,y]=(0,a.useState)(null),[b,j]=(0,a.useState)(null),N="u">typeof navigator&&navigator.userAgent?.includes("Windows"),v=i?.isAdmin!==!1;(0,a.useEffect)(()=>{e?.length>0&&!u&&g(e[0].key)},[e,u]),(0,a.useEffect)(()=>{w()},[]);let w=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();n(t),s?.(t)}}catch{n({running:!1,certExists:!1,dnsStatus:{}})}},k=e=>{N||i?.hasCachedPassword?C(e,""):(y(e),x(!0),j(null))},C=async(s,l)=>{d(!0);try{if("trust-cert"===s)await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:l})});else if("start"===s){let s=u?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l})})}else await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})});x(!1),p(""),await w()}catch{}finally{d(!1),y(null)}},S=()=>{m.trim()?C(f,m):j("Sudo password is required")},_=i?.running;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,l.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),_?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Running"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,l.jsx)("div",{className:"flex items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:i?.certExists},{label:"Trusted",ok:i?.certTrusted},{label:"Server",ok:_}].map(({label:e,ok:t})=>(0,l.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,l.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from iRouter"]}),(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → iRouter → response to Antigravity/Copilot"]})]}),!_&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"API Key"}),e?.length>0?(0,l.jsx)("select",{value:u,onChange:e=>g(e.target.value),className:"flex-1 px-2 py-1 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"text-xs text-text-muted",children:t?"No API keys — create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>k("trust-cert"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),_?(0,l.jsxs)("button",{onClick:()=>k("stop"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>k("start"),disabled:o||N&&!v,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),_&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),N&&!v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,l.jsx)("span",{children:"Administrator required — restart iRouter as Administrator to use MITM"})]})]})}),c&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||S()}}),b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:b})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),p(""),j(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:S,loading:o,children:"Confirm"})]})]})})]})}function g({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,apiKeys:c,activeProviders:x,hasActiveProviders:m,modelAliases:p={},cloudEnabled:u,onDnsChange:h}){let[f,y]=(0,a.useState)(!1),[b,j]=(0,a.useState)(null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(""),[C,S]=(0,a.useState)(null),[_,A]=(0,a.useState)(null),[E,O]=(0,a.useState)({}),[I,M]=(0,a.useState)(!1),[P,R]=(0,a.useState)(null),T="u">typeof navigator&&navigator.userAgent?.includes("Windows");(0,a.useEffect)(()=>{t&&$()},[t]);let $=async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e.id}`);if(t.ok){let e=await t.json();Object.keys(e.aliases||{}).length>0&&O(e.aliases)}}catch{}},L=(0,a.useCallback)(async t=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,mappings:t})})}catch{}},[e.id]),K=(e,t)=>{O(s=>({...s,[e]:t}))},U=()=>{if(!n)return;let e=o?"disable":"enable";T||d?D(e,""):(S(e),v(!0),A(null))},D=async(t,s)=>{y(!0),j(null);try{let l=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),a=await l.json();if(!l.ok)throw Error(a.error||"Failed to toggle DNS");"enable"===t&&j(`Restart ${e.name} to apply changes`),v(!1),k(""),h?.(a)}catch{}finally{y(!1),S(null)}},F=()=>{w.trim()?D(C,w):A("Sudo password is required")};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),n?o?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:["Intercept ",e.name," requests via MITM proxy"]})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,l.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through iRouter via MITM."]}),!o&&(0,l.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),e.defaultModels?.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-36 shrink-0 text-xs font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:E[e.alias]||"",onChange:t=>K(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void L({...E,[s]:l})},placeholder:"provider/model-id",disabled:!o,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${!o?"opacity-50 cursor-not-allowed":""}`}),(0,l.jsx)("button",{onClick:()=>{R(e.alias),M(!0)},disabled:!m||!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 ${m&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),E[e.alias]&&(0,l.jsx)("button",{onClick:()=>{K(e.alias,""),L({...E,[e.alias]:""})},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))}),e.defaultModels?.length===0&&(0,l.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 items-start",children:[o?(0,l.jsxs)("button",{onClick:U,disabled:!n||f,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)("button",{onClick:U,disabled:!n||f,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-amber-500/10 text-amber-600 border border-amber-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,l.jsx)("span",{children:b})]})]})]})]}),N&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:w,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"!==e.key||f||F()}}),_&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:_})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{v(!1),k(""),A(null)},disabled:f,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:F,loading:f,children:"Confirm"})]})]})}),(0,l.jsx)(r.rq,{isOpen:I,onClose:()=>M(!1),onSelect:e=>{if(!P||e.isPlaceholder)return;let t={...E,[P]:e.value};O(t),L(t)},selectedModel:P?E[P]:null,activeProviders:x,modelAliases:p,title:`Select model for ${P}`})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4465],{1828:(e,t,r)=>{Promise.resolve().then(r.bind(r,88512))},88512:(e,t,r)=>{"use strict";r.d(t,{default:()=>g});var a=r(95155),s=r(12115),i=r(35497),l=r(28777),n=r(52679);let o="basic-chat.sessions",d="basic-chat.activeSessionId",c="basic-chat.activeProviderId",m="basic-chat.draft";function u(){return globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`chat_${Date.now()}_${Math.random().toString(16).slice(2)}`}function h(e){if("string"==typeof e)return e;if(null==e)return"";if(Array.isArray(e))return e.map(h).filter(Boolean).join(" ");if("object"==typeof e){if("string"==typeof e.message)return e.message;if("string"==typeof e.error)return e.error;try{return JSON.stringify(e)}catch{}}return String(e)}function p(e=""){let t=h(e).replace(/\s+/g," ").trim();return t?t.length>52?`${t.slice(0,52).trimEnd()}…`:t:"New chat"}async function x(e){return await new Promise((t,r)=>{let a=new FileReader;a.onload=()=>t(String(a.result||"")),a.onerror=()=>r(a.error||Error("Failed to read file")),a.readAsDataURL(e)})}function f(e){return e?.name||function(e=""){return String(e).replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()||"Unknown"}(e?.provider||e?.id||"provider")}function g(){let[e,t]=(0,s.useState)([]),[r,g]=(0,s.useState)(!0),[w,v]=(0,s.useState)(""),[b,N]=(0,s.useState)([]),[y,j]=(0,s.useState)(""),[S,I]=(0,s.useState)(""),[A,k]=(0,s.useState)(""),[C,D]=(0,s.useState)(""),[$,O]=(0,s.useState)([]),[_,M]=(0,s.useState)(!1),[E,T]=(0,s.useState)(""),[U,R]=(0,s.useState)(""),[z,q]=(0,s.useState)(!1),[P,J]=(0,s.useState)(!1),[K,B]=(0,s.useState)(!1),L=(0,s.useRef)(null),F=(0,s.useRef)(null),W=(0,s.useRef)(!1),H=(0,s.useRef)(null),Y=(0,s.useRef)(null);(0,s.useEffect)(()=>{try{let e=function(e,t){try{return JSON.parse(e)}catch{return t}}(globalThis.localStorage.getItem(o),[]);N(Array.isArray(e)?e.map(e=>({...e,messages:Array.isArray(e.messages)?e.messages:[]})):[]),j(globalThis.localStorage.getItem(d)||""),I(globalThis.localStorage.getItem(c)||""),D(globalThis.localStorage.getItem(m)||"")}catch{}finally{q(!0)}},[]),(0,s.useEffect)(()=>{let e=!1;return async function(){g(!0),v("");try{let r=await fetch("/api/providers",{cache:"no-store"}),a=await r.json().catch(()=>({})),s=Array.isArray(a.connections)?a.connections.filter(e=>e?.isActive!==!1):[];if(0===s.length){e||(t([]),v("Chưa c\xf3 provider n\xe0o được connect."));return}let i=new Map;for(let e of s){let t=e.provider||e.id,r=f(e),a=(0,n.mq)(t)?"openai-compatible":(0,n.gb)(t)?"anthropic-compatible":t;i.has(t)||i.set(t,{providerId:t,providerName:r,providerType:a,connections:[],models:[]});let s=i.get(t);s.providerName=s.providerName||r,s.providerType=s.providerType||a,s.connections.push(e);let o=(0,l.KC)(t).map(t=>t?.id?{id:`${e.provider}/${t.id}`,requestModel:`${e.provider}/${t.id}`,name:t.name||t.id,providerId:e.provider,providerName:f(e),source:"static"}:null).filter(Boolean);s.models.push(...o)}for(let e of(await Promise.all(s.map(async e=>{try{let t=await fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)return{connection:e,models:[]};let a=(Array.isArray(r?.models)?r.models:Array.isArray(r?.data)?r.data:Array.isArray(r?.results)?r.results:Array.isArray(r)?r:[]).map(t=>(function(e,t){let r="string"==typeof e?e:e?.id||e?.name||e?.model||"";if(!r)return null;let a="string"==typeof e?e:e?.name||e?.displayName||r,s=r;return((0,n.mq)(t.provider)||(0,n.gb)(t.provider))&&!r.includes("/")&&(s=`${t.provider}/${r}`),{id:s,requestModel:s,name:a,providerId:t.provider,providerName:f(t),source:"live"}})(t,e)).filter(Boolean);return{connection:e,models:a}}catch{return{connection:e,models:[]}}})))){let t=e.connection.provider||e.connection.id,r=i.get(t);r&&r.models.push(...e.models)}let o=Array.from(i.values()).map(e=>({...e,models:(function(e){let t=new Map;for(let r of e)r?.id&&(t.has(r.id)||t.set(r.id,r));return Array.from(t.values())})(e.models).sort((e,t)=>e.name.localeCompare(t.name))})).filter(e=>e.models.length>0).sort((e,t)=>e.providerName.localeCompare(t.providerName));e||(t(o),0===o.length&&v("Đ\xe3 c\xf3 provider connect nhưng chưa lấy được model n\xe0o."))}catch(r){e||(v(h(r?.message)||"Kh\xf4ng thể tải danh s\xe1ch provider/model."),t([]))}finally{e||g(!1)}}(),()=>{e=!0}},[]),(0,s.useEffect)(()=>{let e=e=>{H.current&&!H.current.contains(e.target)&&J(!1),Y.current&&!Y.current.contains(e.target)&&B(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let G=(0,s.useMemo)(()=>{let t=new Map;for(let r of e)for(let e of r.models)t.set(e.id,{...e,providerId:r.providerId,providerName:r.providerName});return t},[e]),Q=(0,s.useMemo)(()=>e.find(e=>e.providerId===S)||e[0]||null,[e,S]),V=(0,s.useMemo)(()=>{if(A&&G.has(A))return G.get(A);if(y){let e=b.find(e=>e.id===y);if(e?.modelId&&G.has(e.modelId))return G.get(e.modelId)}return Q?.models?.[0]||null},[A,G,Q,b,y]),X=(0,s.useMemo)(()=>b.find(e=>e.id===y)||null,[b,y]),Z=X?.messages||[],ee=(0,s.useMemo)(()=>[...b].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),[b]),et=!_&&!!V&&(C.trim().length>0||$.length>0);(0,s.useEffect)(()=>{if(z)try{globalThis.localStorage.setItem(o,JSON.stringify(b)),globalThis.localStorage.setItem(d,y),globalThis.localStorage.setItem(c,S),globalThis.localStorage.setItem(m,C)}catch{}},[z,b,y,S,C]),(0,s.useEffect)(()=>{if(!z||r||W.current||0===e.length)return;let t=e.find(e=>e.providerId===S)||e[0],a=A&&G.has(A)?G.get(A):t.models[0];if(b.length>0){let e=b.find(e=>e.id===y)||b[0],r=e?.modelId&&G.has(e.modelId)?G.get(e.modelId):a;W.current=!0,j(e.id),I(r?.providerId||t.providerId),k(r?.id||a.id);return}let s={id:u(),title:"New chat",providerId:t.providerId,providerName:t.providerName,modelId:a.id,modelName:a.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]};W.current=!0,N([s]),j(s.id),I(t.providerId),k(a.id)},[z,r,e,G,b,y,S,A]);let er=(e,t)=>{N(r=>r.map(r=>r.id===e?t({...r,messages:Array.isArray(r.messages)?r.messages.map(e=>({...e})):[]}):r))},ea=e=>e?{id:u(),title:"New chat",providerId:e.providerId,providerName:e.providerName,modelId:e.id,modelName:e.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]}:null,es=async e=>{let t=Array.from(e.target.files||[]);if(0===t.length)return;let r=t.filter(e=>e.type.startsWith("image/"));if(0===r.length){e.target.value="";return}let a=await Promise.all(r.map(async e=>({id:u(),name:e.name,type:e.type,size:e.size,dataUrl:await x(e)})));O(e=>[...e,...a]),e.target.value=""},ei=async()=>{let e=V||Q?.models?.[0]||null;if(!e)return;let t=C.trim();if(!t&&0===$.length)return;let r=y,a=b.find(e=>e.id===r);if(!a){if(!(a=ea(e)))return;r=a.id,N(e=>[a,...e]),j(r)}let s={id:u(),role:"user",content:t,attachments:$.map(e=>({id:e.id,name:e.name,type:e.type,dataUrl:e.dataUrl})),createdAt:new Date().toISOString()},i=u(),l={id:i,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"streaming"},n=[...a.messages||[],s,l];N(a=>a.map(a=>a.id===r?{...a,providerId:e.providerId,providerName:e.providerName,modelId:e.id,modelName:e.name,messages:n,updatedAt:new Date().toISOString(),title:"New chat"===a.title?p(t):a.title}:a)),D(""),O([]),M(!0),T(i),R(""),F.current?.abort(),F.current=new AbortController;let o=n.filter(e=>"assistant"!==e.role||e.id!==i).map(e=>({role:e.role,content:"user"===e.role?function(e){let t=h(e.content).trim(),r=Array.isArray(e.attachments)?e.attachments:[];if(0===r.length)return t;let a=[];for(let e of(t&&a.push({type:"text",text:t}),r))e?.dataUrl&&a.push({type:"image_url",image_url:{url:e.dataUrl}});return a.length>0?a:t}(e):e.content}));try{var d;let a,s=await fetch("/api/dashboard/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({model:e.requestModel||e.id,messages:o,stream:!0}),signal:F.current.signal});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(h(e.error||e.message||`Request failed (${s.status})`))}let l=s.body?.getReader();if(!l){let e=await s.json().catch(()=>({})),t=h(e?.choices?.[0]?.message?.content||e?.output_text||e?.error||e?.message||"");er(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:t,status:"done"}:e),updatedAt:new Date().toISOString()}));return}let n=new TextDecoder,c="",m="";for(;;){let{value:e,done:t}=await l.read();if(t)break;let a=(c+=n.decode(e,{stream:!0})).split(/\r?\n/);for(let e of(c=a.pop()||"",a)){let t=e.trim();if(!t.startsWith("data:"))continue;let a=t.slice(5).trim();if(a&&"[DONE]"!==a)try{let e=JSON.parse(a),t=function(e){if(!e||"object"!=typeof e)return"";let t=e.choices?.[0];return[(t?.delta||{}).content,t?.message?.content,e.output_text,e.text].map(h).filter(Boolean)[0]||""}(e);if(!t)continue;m+=t,R(m),er(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:m,status:"streaming"}:e),updatedAt:new Date().toISOString()}))}catch{}}}er(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:m||e.content,status:"done"}:e),updatedAt:new Date().toISOString()})),d=r,a=p(t),er(d,e=>({...e,title:"New chat"===e.title?a:e.title,updatedAt:new Date().toISOString()}))}catch(e){if("AbortError"!==e.name){let t=h(e?.message||e);er(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:e.content||`Error: ${t}`,status:"error"}:e),updatedAt:new Date().toISOString()})),v(t||"Kh\xf4ng thể gửi tin nhắn.")}}finally{M(!1),T(""),R(""),F.current=null}},el=V?`${V.name}`:"Select model",en=V?V.requestModel:"Choose from connected providers";return(0,a.jsx)("div",{className:"relative flex-1 flex flex-col h-full min-h-0 min-w-0 bg-[#212121] text-white overflow-hidden",children:(0,a.jsxs)("div",{className:"relative mx-auto flex flex-1 h-full min-h-0 w-full max-w-4xl flex-col",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 px-4 py-3 lg:px-6",children:[(0,a.jsxs)("div",{ref:H,className:"relative",children:[(0,a.jsx)("button",{type:"button",onClick:()=>J(e=>!e),className:"flex items-center gap-3 rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-left transition hover:bg-white/8",children:(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:el}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-white/70",children:"expand_more"})]}),(0,a.jsx)("p",{className:"truncate text-xs text-white/55",children:en})]})}),P?(0,a.jsxs)("div",{className:"absolute left-0 top-[calc(100%+10px)] z-30 w-[min(520px,calc(100vw-2rem))] overflow-hidden rounded-[20px] border border-white/10 bg-[#262626] shadow-2xl shadow-black/50",children:[(0,a.jsxs)("div",{className:"border-b border-white/10 px-4 py-3",children:[(0,a.jsx)("p",{className:"text-xs uppercase tracking-[0.22em] text-white/45",children:"Models"}),(0,a.jsx)("p",{className:"text-sm text-white/75",children:"Chỉ lấy từ provider đ\xe3 connect"})]}),(0,a.jsx)("div",{className:"max-h-[60vh] overflow-y-auto p-2 custom-scrollbar",children:e.map(e=>(0,a.jsxs)("div",{className:"mb-2 rounded-[16px] border border-white/10 bg-black/20 p-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-2 py-2",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-white",children:e.providerName}),(0,a.jsx)(i.Ex,{size:"sm",variant:"default",children:e.models.length})]}),(0,a.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:e.models.map(e=>{let t=e.id===A;return(0,a.jsx)("button",{type:"button",onClick:()=>(e=>{let t=G.get(e);if(!t)return;let r=b.find(e=>e.id===y);if(r&&r.messages.length>0){let e=ea(t);if(!e)return;N(t=>[e,...t]),j(e.id)}else if(r)N(e=>e.map(e=>e.id===r.id?{...e,providerId:t.providerId,providerName:t.providerName,modelId:t.id,modelName:t.name}:e)),j(r.id);else{let e=ea(t);if(!e)return;N(t=>[e,...t]),j(e.id)}I(t.providerId),k(t.id),J(!1)})(e.id),className:`rounded-[14px] border px-3 py-3 text-left transition ${t?"border-blue-400/40 bg-blue-500/15":"border-white/10 bg-white/5 hover:bg-white/8"}`,children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-white",children:e.name}),(0,a.jsx)("p",{className:"truncate text-[11px] text-white/45",children:e.requestModel})]}),t?(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-blue-300",children:"check_circle"}):null]})},e.id)})})]},e.providerId))})]}):null]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>B(e=>!e),className:"rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white/80 transition hover:bg-white/8",children:"History"}),(0,a.jsx)(i.$n,{variant:"ghost",size:"sm",icon:"delete",onClick:()=>{if(!y)return;let e=b.filter(e=>e.id!==y),t=e[0]||null;N(e),t?(j(t.id),I(t.providerId),k(t.modelId)):(j(""),I(""),k(""))},disabled:!y||0===b.length,children:"Clear"})]})]}),K?(0,a.jsxs)("div",{ref:Y,className:"absolute right-4 top-[72px] z-20 w-[min(360px,calc(100vw-2rem))] rounded-[20px] border border-white/10 bg-[#262626] p-2 shadow-2xl shadow-black/50 lg:right-6",children:[(0,a.jsx)("div",{className:"px-3 py-2",children:(0,a.jsx)("p",{className:"text-xs uppercase tracking-[0.22em] text-white/45",children:"Recent chats"})}),(0,a.jsx)("div",{className:"max-h-[48vh] space-y-2 overflow-y-auto p-1 custom-scrollbar",children:0===ee.length?(0,a.jsx)("div",{className:"rounded-[16px] border border-dashed border-white/10 bg-white/5 p-4 text-sm text-white/55",children:"Chưa c\xf3 cuộc tr\xf2 chuyện n\xe0o."}):ee.map(e=>{let t=e.id===y,r=[...e.messages||[]].reverse().find(e=>"user"===e.role)||e.messages?.[0];return(0,a.jsx)("button",{type:"button",onClick:()=>{var t;let r;return t=e.id,void((r=b.find(e=>e.id===t))&&(j(t),I(r.providerId||S),k(r.modelId||A),B(!1)))},className:`w-full rounded-[16px] border px-3 py-3 text-left transition ${t?"border-blue-400/40 bg-blue-500/15":"border-white/10 bg-white/5 hover:bg-white/8"}`,children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-white",children:e.title}),(0,a.jsx)("p",{className:"mt-1 truncate text-xs text-white/50",children:h(r?.content)||"Empty chat"})]}),(0,a.jsx)("span",{className:"text-[10px] text-white/40 shrink-0",children:function(e){if(!e)return"Now";let t=new Date(e).getTime();if(Number.isNaN(t))return"Now";let r=Math.max(1,Math.round((Date.now()-t)/6e4));if(r<60)return`${r}m`;let a=Math.round(r/60);return a<24?`${a}h`:`${Math.round(a/24)}d`}(e.updatedAt)})]})},e.id)})})]}):null,w?(0,a.jsx)("div",{className:"mt-4 rounded-[18px] border border-rose-500/20 bg-rose-500/10 px-4 py-3 text-rose-100",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"error"}),(0,a.jsx)("p",{className:"text-sm leading-6",children:w})]})}):null,(0,a.jsxs)("div",{className:"flex flex-1 flex-col min-h-0",children:[(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 custom-scrollbar",children:[0===Z.length?(0,a.jsx)("div",{className:"flex min-h-[50vh] items-center justify-center px-4 text-center",children:(0,a.jsxs)("div",{className:"max-w-xl space-y-4",children:[(0,a.jsx)("div",{className:"mx-auto flex size-16 items-center justify-center rounded-[20px] border border-white/10 bg-white/5 text-white/80",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[30px]",children:"chat"})}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold text-white",children:"Start a conversation"}),(0,a.jsx)("p",{className:"text-sm leading-6 text-white/60",children:"Simple chat interface to interact with any AI model from connected providers. Select a model and start chatting!"})]})]})}):null,(0,a.jsx)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4",children:Z.map(e=>{let t="user"===e.role,r="assistant"===e.role,s=r&&e.id===E&&"streaming"===e.status,i=h(e.content)||(r?U:"");return(0,a.jsx)("div",{className:`flex w-full ${t?"justify-end":"justify-start"} mb-6`,children:(0,a.jsxs)("div",{className:`max-w-[min(88%,42rem)] ${t?"rounded-3xl bg-[#2f2f2f] px-5 py-3.5 text-white":"text-white/90"}`,children:[(0,a.jsx)("div",{className:"mb-1 flex items-center justify-between gap-3",children:(0,a.jsx)("span",{className:"text-xs font-semibold",children:t?"You":V?.name||"Assistant"})}),e.attachments?.length?(0,a.jsx)("div",{className:"mb-3 grid grid-cols-2 gap-2 sm:grid-cols-3 mt-2",children:e.attachments.map(e=>(0,a.jsx)("a",{href:e.dataUrl,target:"_blank",rel:"noreferrer",className:"overflow-hidden rounded-[18px] border border-white/10 bg-black/20",children:(0,a.jsx)("img",{src:e.dataUrl,alt:e.name,className:"h-28 w-full object-cover"})},e.id))}):null,(0,a.jsxs)("div",{className:"whitespace-pre-wrap break-words text-[15px] leading-7",children:[i,r&&s&&!U?(0,a.jsx)("span",{className:"inline-block animate-pulse",children:"▋"}):null]})]})},e.id)})})]}),(0,a.jsxs)("div",{className:"shrink-0 pt-2",children:[$.length>0?(0,a.jsx)("div",{className:"mx-auto mb-3 flex w-full max-w-3xl flex-wrap gap-2 px-4",children:$.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-3 py-2",children:[(0,a.jsx)("span",{className:"text-xs text-white/80 max-w-[12rem] truncate",children:e.name}),(0,a.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void O(e=>e.filter(e=>e.id!==t))},className:"text-white/55 hover:text-white","aria-label":"Remove attachment",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]},e.id))}):null,(0,a.jsx)("div",{className:"mx-auto w-full max-w-3xl px-4 pb-2",children:(0,a.jsxs)("div",{className:"rounded-[26px] bg-[#2f2f2f] px-3 pt-3 pb-2 shadow-[0_0_15px_rgba(0,0,0,0.10)] ring-1 ring-white/5",children:[(0,a.jsx)("textarea",{value:C,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),et&&ei())},placeholder:"Message AI",rows:1,className:"w-full resize-none bg-transparent px-2 text-[15px] leading-6 text-white outline-none placeholder:text-white/40 custom-scrollbar max-h-[25vh] overflow-y-auto"}),(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>L.current?.click(),disabled:!V||r,className:"p-2 text-white/50 hover:text-white transition rounded-full hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"attach_file"})}),(0,a.jsx)("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:es}),(0,a.jsx)("span",{className:"text-xs font-medium text-white/30 truncate max-w-[120px]",children:V?V.name:"No model"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[_?(0,a.jsx)("button",{type:"button",onClick:()=>{F.current?.abort()},className:"p-2 text-white bg-white/10 hover:bg-white/20 transition rounded-full h-8 w-8 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop"})}):null,(0,a.jsx)("button",{onClick:ei,disabled:!et,className:`h-8 w-8 rounded-full flex items-center justify-center transition ${et?"bg-white text-black hover:opacity-90":"bg-white/10 text-white/30 cursor-not-allowed"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})})]})]})]})})]}),(0,a.jsx)("p",{className:"mx-auto mt-2 max-w-3xl px-4 pb-4 text-center text-[11px] text-white/30",children:"Model list is filtered from connected providers."})]})]})})}}},e=>{e.O(0,[2574,3862,6902,2652,5497,8441,3794,7358],()=>e(e.s=1828)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{75228:(e,t,a)=>{"use strict";a.d(t,{default:()=>u});var s=a(95155),l=a(12115),i=a(35497),o=a(3534),r=a(28777),n=a(97397);let c=a(41463).env.NEXT_PUBLIC_CLOUD_URL,d={claude:"/api/cli-tools/claude-settings",codex:"/api/cli-tools/codex-settings",opencode:"/api/cli-tools/opencode-settings",droid:"/api/cli-tools/droid-settings",openclaw:"/api/cli-tools/openclaw-settings"};function u({machineId:e}){let t,a,p,[v,h]=(0,l.useState)([]),[x,f]=(0,l.useState)(!0),[g,j]=(0,l.useState)(null),[w,m]=(0,l.useState)({}),[b,y]=(0,l.useState)(!1),[E,P]=(0,l.useState)(!1),[S,k]=(0,l.useState)(""),[N,_]=(0,l.useState)([]),[C,O]=(0,l.useState)({});(0,l.useEffect)(()=>{U(),I(),M(),A()},[]);let A=async()=>{try{let e=await Promise.all(Object.entries(d).map(async([e,t])=>{try{let a=await fetch(t),s=await a.json();return[e,s]}catch{return[e,null]}}));O(Object.fromEntries(e))}catch(e){console.log("Error fetching tool statuses:",e)}},I=async()=>{try{let[e,t]=await Promise.all([fetch("/api/settings"),fetch("/api/tunnel/status")]);if(e.ok){let t=await e.json();y(t.cloudEnabled||!1)}if(t.ok){let e=await t.json();P(e.enabled||!1),k(e.tunnelUrl||"")}}catch(e){console.log("Error loading settings:",e)}},M=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();_(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},U=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&h(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{f(!1)}},L=()=>v.filter(e=>!1!==e.isActive),$=(0,l.useCallback)((e,t,a)=>{m(s=>s[e]?.[t]===a?s:{...s,[e]:{...s[e],[t]:a}})},[]);if(x)return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(i.Qv,{}),(0,s.jsx)(i.Qv,{}),(0,s.jsx)(i.Qv,{})]});let Q=(t=L(),a=[],p=new Set,t.forEach(e=>{let t=r.Xg[e.provider]||e.provider;(0,r.KC)(e.provider).forEach(s=>{let l=`${t}/${s.id}`;p.has(l)||(p.add(l),a.push({value:l,label:`${t}/${s.id}`,provider:e.provider,alias:t,connectionName:e.name,modelId:s.id}))})}),a).length>0,T=Object.entries(o.dM);return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[!Q&&(0,s.jsx)(i.Zp,{className:"border-yellow-500/50 bg-yellow-500/5",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"No active providers"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Please add and connect providers first to configure CLI tools."})]})]})}),(0,s.jsx)("div",{className:"flex flex-col gap-4",children:T.map(([e,t])=>((e,t)=>{let a={tool:t,isExpanded:g===e,onToggle:()=>j(g===e?null:e),baseUrl:E&&S?S:b&&c?c:window.location.origin,apiKeys:N};switch(e){case"claude":return(0,s.jsx)(n.Tk,{...a,activeProviders:L(),modelMappings:w[e]||{},onModelMappingChange:(t,a)=>$(e,t,a),hasActiveProviders:Q,cloudEnabled:b,initialStatus:C.claude},e);case"codex":return(0,s.jsx)(n.Ah,{...a,activeProviders:L(),cloudEnabled:b,initialStatus:C.codex},e);case"opencode":return(0,s.jsx)(n.qO,{...a,activeProviders:L(),cloudEnabled:b,initialStatus:C.opencode},e);case"droid":return(0,s.jsx)(n.ZM,{...a,activeProviders:L(),hasActiveProviders:Q,cloudEnabled:b,initialStatus:C.droid},e);case"openclaw":return(0,s.jsx)(n.yZ,{...a,activeProviders:L(),hasActiveProviders:Q,cloudEnabled:b,initialStatus:C.openclaw},e);default:return(0,s.jsx)(n.a7,{toolId:e,...a,activeProviders:L(),cloudEnabled:b,tunnelEnabled:E},e)}})(e,t))})]})}},77756:(e,t,a)=>{Promise.resolve().then(a.bind(a,75228))}},e=>{e.O(0,[2574,3862,6902,5772,2652,5497,9242,8441,3794,7358],()=>e(e.s=77756)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{47295:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>n});var a=s(95155),o=s(12115),l=s(35497),r=s(11059);s(52679);let i=/^[a-zA-Z0-9_.\-]+$/;function n(){let[e,t]=(0,o.useState)([]),[s,i]=(0,o.useState)(!0),[n,d]=(0,o.useState)(!1),[x,h]=(0,o.useState)(null),[p,u]=(0,o.useState)([]),[b,f]=(0,o.useState)({}),{copied:g,copy:j}=(0,r.C)();(0,o.useEffect)(()=>{y()},[]);let y=async()=>{try{let[e,s,a]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),o=await e.json(),l=await s.json(),r=a.ok?await a.json():{};e.ok&&t(o.combos||[]),s.ok&&u(l.connections||[]),f(r.comboStrategies||{})}catch(e){console.log("Error fetching data:",e)}finally{i(!1)}},v=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await y(),d(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},N=async(e,t)=>{try{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await y(),h(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},k=async s=>{if(confirm("Delete this combo?"))try{(await fetch(`/api/combos/${s}`,{method:"DELETE"})).ok&&t(e.filter(e=>e.id!==s))}catch(e){console.log("Error deleting combo:",e)}},w=async(e,t)=>{try{let s={...b};t?s[e]={fallbackStrategy:"round-robin"}:delete s[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})}),f(s)}catch(e){console.log("Error updating combo strategy:",e)}};return s?(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(l.Qv,{}),(0,a.jsx)(l.Qv,{})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-6",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-semibold",children:"Combos"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Create model combos with fallback support"})]}),(0,a.jsx)(l.$n,{icon:"add",onClick:()=>d(!0),children:"Create Combo"})]}),0===e.length?(0,a.jsx)(l.Zp,{children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,a.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,a.jsx)(l.$n,{icon:"add",onClick:()=>d(!0),children:"Create Combo"})]})}):(0,a.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>(0,a.jsx)(c,{combo:e,copied:g,onCopy:j,onEdit:()=>h(e),onDelete:()=>k(e.id),roundRobinEnabled:b[e.name]?.fallbackStrategy==="round-robin",onToggleRoundRobin:t=>w(e.name,t)},e.id))}),(0,a.jsx)(m,{isOpen:n,onClose:()=>d(!1),onSave:v,activeProviders:p},"create"),(0,a.jsx)(m,{isOpen:!!x,combo:x,onClose:()=>h(null),onSave:e=>N(x.id,e),activeProviders:p},x?.id||"new")]})}function c({combo:e,copied:t,onCopy:s,onEdit:o,onDelete:r,roundRobinEnabled:i,onToggleRoundRobin:n}){return(0,a.jsx)(l.Zp,{padding:"sm",className:"group",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"text-sm font-medium font-mono truncate",children:e.name}),(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),s(e.name,`combo-${e.id}`)},className:"p-0.5 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors opacity-0 group-hover:opacity-100",title:"Copy combo name",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:t===`combo-${e.id}`?"check":"content_copy"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[0===e.models.length?(0,a.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,a.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1.5 py-0.5 rounded text-text-muted",children:e},t)),e.models.length>3&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(l.lM,{size:"sm",checked:i,onChange:n})]}),(0,a.jsxs)("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,a.jsx)("button",{onClick:o,className:"p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors",title:"Edit",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"edit"})}),(0,a.jsx)("button",{onClick:r,className:"p-1.5 hover:bg-red-500/10 rounded text-red-500 transition-colors",title:"Delete",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]})]})})}function d({index:e,model:t,isFirst:s,isLast:l,onEdit:r,onMoveUp:i,onMoveDown:n,onRemove:c}){let[m,x]=(0,o.useState)(!1),[h,p]=(0,o.useState)(t),u=()=>{let e=h.trim();e&&e!==t?r(e):p(t),x(!1)};return(0,a.jsxs)("div",{className:"group flex items-center gap-1.5 px-2 py-1 rounded-md bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors",children:[(0,a.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,a.jsx)("input",{autoFocus:!0,value:h,onChange:e=>p(e.target.value),onBlur:u,onKeyDown:e=>{"Enter"===e.key&&u(),"Escape"===e.key&&(p(t),x(!1))},className:"flex-1 min-w-0 px-1.5 py-0.5 text-xs font-mono bg-white dark:bg-black/20 border border-primary/40 rounded outline-none text-text-main"}):(0,a.jsx)("div",{className:"flex-1 min-w-0 px-1.5 py-0.5 text-xs font-mono text-text-main truncate cursor-text hover:bg-black/5 dark:hover:bg-white/5 rounded",onClick:()=>x(!0),title:"Click to edit",children:t}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:i,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:n,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,a.jsx)("button",{onClick:c,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:s,onSave:r,activeProviders:n}){let[c,x]=(0,o.useState)(t?.name||""),[h,p]=(0,o.useState)(t?.models||[]),[u,b]=(0,o.useState)(!1),[f,g]=(0,o.useState)(!1),[j,y]=(0,o.useState)(""),[v,N]=(0,o.useState)({}),k=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();N(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,o.useEffect)(()=>{e&&k()},[e]);let w=e=>e.trim()?i.test(e)?(y(""),!0):(y("Only letters, numbers, -, _ and . allowed"),!1):(y("Name is required"),!1),C=async()=>{w(c)&&(g(!0),await r({name:c.trim(),models:h}),g(!1))},S=!!t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.aF,{isOpen:e,onClose:s,title:S?"Edit Combo":"Create Combo",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(l.pd,{label:"Combo Name",value:c,onChange:e=>{let t=e.target.value;x(t),t?w(t):y("")},placeholder:"my-combo",error:j}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===h.length?(0,a.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,a.jsx)("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:h.map((e,t)=>(0,a.jsx)(d,{index:t,model:e,isFirst:0===t,isLast:t===h.length-1,onEdit:e=>{let s=[...h];s[t]=e,p(s)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...h];[t[e-1],t[e]]=[t[e],t[e-1]],p(t)})(t),onMoveDown:()=>(e=>{if(e===h.length-1)return;let t=[...h];[t[e],t[e+1]]=[t[e+1],t[e]],p(t)})(t),onRemove:()=>{p(h.filter((e,s)=>s!==t))}},t))}),(0,a.jsxs)("button",{onClick:()=>b(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-text-muted hover:text-primary hover:border-primary/30 transition-colors flex items-center justify-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(l.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(l.$n,{onClick:C,fullWidth:!0,size:"sm",disabled:!c.trim()||!!j||f,children:f?"Saving...":S?"Save":"Create"})]})]})}),(0,a.jsx)(l.rq,{isOpen:u,onClose:()=>b(!1),onSelect:e=>{h.includes(e.value)||p([...h,e.value])},activeProviders:n,modelAliases:v,title:"Add Model to Combo"})]})}},61114:(e,t,s)=>{Promise.resolve().then(s.bind(s,47295))}},e=>{e.O(0,[2574,3862,6902,2652,5497,8441,3794,7358],()=>e(e.s=61114)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/console-log/page-7b0d61cbbe1a47c2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[712],{44493:(e,t,l)=>{"use strict";l.d(t,{default:()=>o});var s=l(95155),n=l(12115),r=l(35497),a=l(90620);let c={LOG:"text-green-400",INFO:"text-blue-400",WARN:"text-yellow-400",ERROR:"text-red-400",DEBUG:"text-purple-400"};function o(){let[e,t]=(0,n.useState)([]),[l,o]=(0,n.useState)(!1),i=(0,n.useRef)(null),u=async()=>{try{await fetch("/api/translator/console-logs",{method:"DELETE"})}catch(e){console.error("Failed to clear console logs:",e)}};return(0,n.useEffect)(()=>{let e=new EventSource("/api/translator/console-logs/stream");return e.onopen=()=>o(!0),e.onmessage=e=>{let l=JSON.parse(e.data);"init"===l.type?t(l.logs.slice(-a.UY.maxLines)):"line"===l.type?t(e=>{let t=[...e,l.line];return t.length>a.UY.maxLines?t.slice(-a.UY.maxLines):t}):"clear"===l.type&&t([])},e.onerror=()=>o(!1),()=>e.close()},[]),(0,n.useEffect)(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e]),(0,s.jsx)("div",{className:"",children:(0,s.jsxs)(r.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-end px-4 pt-3 pb-2",children:(0,s.jsx)(r.$n,{size:"sm",variant:"outline",icon:"delete",onClick:u,children:"Clear"})}),(0,s.jsx)("div",{ref:i,className:"bg-black rounded-b-lg p-4 text-xs font-mono h-[calc(100vh-220px)] overflow-y-auto",children:0===e.length?(0,s.jsx)("span",{className:"text-text-muted",children:"No console logs yet."}):(0,s.jsx)("div",{className:"space-y-0.5",children:e.map((e,t)=>{let l,n;return(0,s.jsx)("div",{children:(n=c[(l=e.match(/\[(\w+)\]/g))?l[1]?.replace(/\[|\]/g,""):null]||"text-green-400",(0,s.jsx)("span",{className:n,children:e}))},t)})})})]})})}},99685:(e,t,l)=>{Promise.resolve().then(l.bind(l,44493))}},e=>{e.O(0,[2574,3862,6902,2652,5497,8441,3794,7358],()=>e(e.s=99685)),_N_E=e.O()}]);
|