omniroute 2.7.7 → 2.7.9
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 +1 -0
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/prerender-manifest.json +3 -3
- package/app/.next/required-server-files.json +4 -0
- package/app/.next/routes-manifest.json +13 -0
- package/app/.next/server/app/(dashboard)/dashboard/a2a/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/a2a/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/agents/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/agents/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/api-manager/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/api-manager/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/audit-log/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/audit-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/auto-combo/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/auto-combo/page_client-reference-manifest.js +1 -1
- 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.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/costs/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/limits/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/logs/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mcp/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mcp/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js.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/playground/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.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.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.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/search-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/search-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.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.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/400/page.js.nft.json +1 -1
- package/app/.next/server/app/400/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/401/page.js.nft.json +1 -1
- package/app/.next/server/app/401/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/403/page.js.nft.json +1 -1
- package/app/.next/server/app/403/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/408/page.js.nft.json +1 -1
- package/app/.next/server/app/408/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/429/page.js.nft.json +1 -1
- package/app/.next/server/app/429/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/500/page.js.nft.json +1 -1
- package/app/.next/server/app/500/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/502/page.js.nft.json +1 -1
- package/app/.next/server/app/502/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/503/page.js.nft.json +1 -1
- package/app/.next/server/app/503/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +2 -2
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.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.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/acp/agents/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cache/route.js.nft.json +1 -1
- 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/claude-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/status/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/auth/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/compliance/audit-log/route.js.nft.json +1 -1
- package/app/.next/server/app/api/db-backups/export/route.js.nft.json +1 -1
- package/app/.next/server/app/api/db-backups/exportAll/route.js.nft.json +1 -1
- package/app/.next/server/app/api/db-backups/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/db-backups/route.js.nft.json +1 -1
- package/app/.next/server/app/api/fallback/chains/route.js.nft.json +1 -1
- package/app/.next/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next/server/app/api/logs/console/route.js.nft.json +1 -1
- package/app/.next/server/app/api/logs/detail/route.js.nft.json +1 -1
- package/app/.next/server/app/api/mcp/sse/route.js.nft.json +1 -1
- package/app/.next/server/app/api/mcp/status/route.js.nft.json +1 -1
- package/app/.next/server/app/api/mcp/stream/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/catalog/route.js +1 -1
- package/app/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/openrouter-catalog/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/monitoring/health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js.nft.json +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/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next/server/app/api/policies/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/sync/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-metrics/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-models/route.js.nft.json +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/route.js.nft.json +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]/refresh/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/rate-limits/route.js.nft.json +1 -1
- package/app/.next/server/app/api/resilience/reset/route.js.nft.json +1 -1
- package/app/.next/server/app/api/resilience/route.js.nft.json +1 -1
- package/app/.next/server/app/api/search/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/search/stats/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/background-degradation/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/codex-service-tier/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/combo-defaults/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/model-aliases/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxies/assignments/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxies/bulk-assign/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxies/health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxies/migrate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxies/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxy/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/system-prompt/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/task-routing/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/thinking-budget/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sync/cloud/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sync/initialize/route.js.nft.json +1 -1
- package/app/.next/server/app/api/system/version/route.js.nft.json +1 -1
- package/app/.next/server/app/api/token-health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/analytics/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/budget/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/call-logs/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/call-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/proxy-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/quota/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js +2 -2
- package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/completions/route.js +2 -2
- package/app/.next/server/app/api/v1/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/management/proxies/assignments/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/management/proxies/bulk-assign/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/management/proxies/health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/management/proxies/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/moderations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/music/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/providers/[provider]/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/rerank/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/[...path]/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/v1/responses/[...path]/route/build-manifest.json +11 -0
- package/app/.next/server/app/api/v1/responses/[...path]/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/v1/responses/[...path]/route.js +25 -0
- package/app/.next/server/app/api/v1/responses/[...path]/route.js.map +5 -0
- package/app/.next/server/app/api/v1/responses/[...path]/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v1/responses/[...path]/route_client-reference-manifest.js +2 -0
- package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- 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/docs/page.js.nft.json +1 -1
- package/app/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/forbidden/page.js.nft.json +1 -1
- package/app/.next/server/app/forbidden/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/forgot-password/page.js.nft.json +1 -1
- package/app/.next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/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/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/maintenance/page.js.nft.json +1 -1
- package/app/.next/server/app/maintenance/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/offline/page.js.nft.json +1 -1
- package/app/.next/server/app/offline/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/privacy/page.js.nft.json +1 -1
- package/app/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/status/page.js.nft.json +1 -1
- package/app/.next/server/app/status/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/terms/page.js.nft.json +1 -1
- package/app/.next/server/app/terms/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +1 -0
- package/app/.next/server/chunks/[root-of-the-server]__09c944b3._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__167585da._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__205783af._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__30456390._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__46fad57a._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__7d9b23e7._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__80e3bfc3._.js +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__84e445b2._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__92cb0def._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__c64c7cac._.js +3 -0
- package/app/.next/server/chunks/{[root-of-the-server]__d7914418._.js → [root-of-the-server]__daa26645._.js} +2 -2
- package/app/.next/server/chunks/[root-of-the-server]__db2f9fe0._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__dc47ee64._.js +1 -1
- package/app/.next/server/chunks/_05c48915._.js +1 -1
- package/app/.next/server/chunks/_1244636c._.js +4 -4
- package/app/.next/server/chunks/_2115d8de._.js +1 -1
- package/app/.next/server/chunks/_3ac953eb._.js +1 -1
- package/app/.next/server/chunks/_4b8fd853._.js +1 -1
- package/app/.next/server/chunks/_68683848._.js +1 -1
- package/app/.next/server/chunks/_ee9b677b._.js +1 -1
- package/app/.next/server/chunks/_next-internal_server_app_api_v1_responses_[___path]_route_actions_b27b9fcb.js +3 -0
- package/app/.next/server/chunks/open-sse_executors_01c3e95e._.js +2 -2
- package/app/.next/server/chunks/open-sse_executors_codex_ts_6d18ec4b._.js +2 -2
- package/app/.next/server/chunks/open-sse_services_826884e1._.js +2 -2
- package/app/.next/server/chunks/src_shared_validation_schemas_ts_4e63863a._.js +1 -1
- package/app/.next/server/chunks/ssr/[root-of-the-server]__9affb65e._.js +1 -1
- package/app/.next/server/chunks/ssr/[root-of-the-server]__a6942102._.js +1 -1
- package/app/.next/server/chunks/ssr/[root-of-the-server]__ea575754._.js +1 -1
- package/app/.next/server/chunks/ssr/src_55fa8e28._.js +1 -1
- package/app/.next/server/chunks/ssr/src_app_(dashboard)_dashboard_cc92bcad._.js +1 -1
- package/app/.next/server/pages/500.html +2 -2
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/{0jU8vYxZrKFHgyr318QmU → SceXD3Aq1CWSLd2QAWySF}/_buildManifest.js +4 -0
- package/app/.next/static/chunks/{cd0b93c0ed63a487.js → 3423ff268c85cc05.js} +1 -1
- package/app/.next/static/chunks/8c9234a3ed7f8c07.js +1 -0
- package/app/.next/static/chunks/{e28c38bcf2e8ef5f.js → d63812e51b4eb49f.js} +1 -1
- package/app/CHANGELOG.md +30 -0
- package/app/docs/openapi.yaml +1 -1
- package/app/next.config.mjs +4 -0
- package/app/open-sse/executors/base.ts +1 -0
- package/app/open-sse/executors/codex.ts +39 -4
- package/app/open-sse/handlers/chatCore.ts +8 -7
- package/app/open-sse/services/comboAgentMiddleware.ts +19 -0
- package/app/package-lock.json +2 -2
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/app/src/app/(dashboard)/dashboard/combos/page.tsx +80 -0
- package/app/src/app/(dashboard)/dashboard/usage/components/BudgetTab.tsx +7 -2
- package/app/src/app/api/v1/responses/[...path]/route.ts +33 -0
- package/app/src/shared/utils/machineId.ts +20 -14
- package/app/src/shared/validation/schemas.ts +10 -1
- package/app/tests/unit/plan3-p0.test.mjs +65 -0
- package/package.json +1 -1
- package/app/.next/static/chunks/c089b7e37ffa02b7.js +0 -1
- /package/app/.next/static/{0jU8vYxZrKFHgyr318QmU → SceXD3Aq1CWSLd2QAWySF}/_clientMiddlewareManifest.json +0 -0
- /package/app/.next/static/{0jU8vYxZrKFHgyr318QmU → SceXD3Aq1CWSLd2QAWySF}/_ssgManifest.js +0 -0
package/app/docs/openapi.yaml
CHANGED
package/app/next.config.mjs
CHANGED
|
@@ -9,6 +9,17 @@ type EffortLevel = (typeof EFFORT_ORDER)[number];
|
|
|
9
9
|
const CODEX_FAST_WIRE_VALUE = "priority";
|
|
10
10
|
let defaultFastServiceTierEnabled = false;
|
|
11
11
|
|
|
12
|
+
function getResponsesSubpath(endpointPath: unknown): string | null {
|
|
13
|
+
const normalizedEndpoint = String(endpointPath || "").replace(/\/+$/, "");
|
|
14
|
+
const match = normalizedEndpoint.match(/(?:^|\/)responses(?:(\/.*))?$/i);
|
|
15
|
+
if (!match) return null;
|
|
16
|
+
return match[1] || "";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isCompactResponsesEndpoint(endpointPath: unknown): boolean {
|
|
20
|
+
return getResponsesSubpath(endpointPath)?.toLowerCase() === "/compact";
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
function normalizeServiceTierValue(value: unknown): string | undefined {
|
|
13
24
|
if (typeof value !== "string") return undefined;
|
|
14
25
|
const normalized = value.trim().toLowerCase();
|
|
@@ -60,13 +71,31 @@ export class CodexExecutor extends BaseExecutor {
|
|
|
60
71
|
super("codex", PROVIDERS.codex);
|
|
61
72
|
}
|
|
62
73
|
|
|
74
|
+
buildUrl(model, stream, urlIndex = 0, credentials = null) {
|
|
75
|
+
void model;
|
|
76
|
+
void stream;
|
|
77
|
+
void urlIndex;
|
|
78
|
+
|
|
79
|
+
const responsesSubpath = getResponsesSubpath(credentials?.requestEndpointPath);
|
|
80
|
+
if (responsesSubpath !== null) {
|
|
81
|
+
const baseUrl = String(this.config.baseUrl || "").replace(/\/$/, "");
|
|
82
|
+
if (baseUrl.endsWith("/responses")) {
|
|
83
|
+
return `${baseUrl}${responsesSubpath}`;
|
|
84
|
+
}
|
|
85
|
+
return `${baseUrl}/responses${responsesSubpath}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return super.buildUrl(model, stream, urlIndex, credentials);
|
|
89
|
+
}
|
|
90
|
+
|
|
63
91
|
/**
|
|
64
92
|
* Codex Responses endpoint is SSE-first.
|
|
65
93
|
* Always request event-stream from upstream, even when client requested stream=false.
|
|
66
94
|
* Includes chatgpt-account-id header for strict workspace binding.
|
|
67
95
|
*/
|
|
68
96
|
buildHeaders(credentials, stream = true) {
|
|
69
|
-
const
|
|
97
|
+
const isCompactRequest = isCompactResponsesEndpoint(credentials?.requestEndpointPath);
|
|
98
|
+
const headers = super.buildHeaders(credentials, isCompactRequest ? false : true);
|
|
70
99
|
|
|
71
100
|
// Add workspace binding header if workspaceId is persisted
|
|
72
101
|
const workspaceId = credentials?.providerSpecificData?.workspaceId;
|
|
@@ -107,9 +136,15 @@ export class CodexExecutor extends BaseExecutor {
|
|
|
107
136
|
*/
|
|
108
137
|
transformRequest(model, body, stream, credentials) {
|
|
109
138
|
const nativeCodexPassthrough = body?._nativeCodexPassthrough === true;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
139
|
+
const isCompactRequest = isCompactResponsesEndpoint(credentials?.requestEndpointPath);
|
|
140
|
+
|
|
141
|
+
// Codex /responses rejects stream=false, but /responses/compact rejects the stream field entirely.
|
|
142
|
+
if (isCompactRequest) {
|
|
143
|
+
delete body.stream;
|
|
144
|
+
delete body.stream_options;
|
|
145
|
+
} else {
|
|
146
|
+
body.stream = true;
|
|
147
|
+
}
|
|
113
148
|
delete body._nativeCodexPassthrough;
|
|
114
149
|
|
|
115
150
|
const requestServiceTier = normalizeServiceTierValue(body.service_tier);
|
|
@@ -60,9 +60,8 @@ export function shouldUseNativeCodexPassthrough({
|
|
|
60
60
|
}): boolean {
|
|
61
61
|
if (provider !== "codex") return false;
|
|
62
62
|
if (sourceFormat !== FORMATS.OPENAI_RESPONSES) return false;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.endsWith("/responses");
|
|
63
|
+
const normalizedEndpoint = String(endpointPath || "").replace(/\/+$/, "");
|
|
64
|
+
return /(?:^|\/)responses(?:\/.*)?$/i.test(normalizedEndpoint);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
/**
|
|
@@ -140,8 +139,8 @@ export async function handleChatCore({
|
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
const sourceFormat = detectFormat(body);
|
|
143
|
-
const endpointPath = (clientRawRequest?.endpoint || "")
|
|
144
|
-
const isResponsesEndpoint =
|
|
142
|
+
const endpointPath = String(clientRawRequest?.endpoint || "");
|
|
143
|
+
const isResponsesEndpoint = /(?:^|\/)responses(?:\/.*)?$/i.test(endpointPath);
|
|
145
144
|
const nativeCodexPassthrough = shouldUseNativeCodexPassthrough({
|
|
146
145
|
provider,
|
|
147
146
|
sourceFormat,
|
|
@@ -385,6 +384,8 @@ export async function handleChatCore({
|
|
|
385
384
|
|
|
386
385
|
// Get executor for this provider
|
|
387
386
|
const executor = getExecutor(provider);
|
|
387
|
+
const getExecutionCredentials = () =>
|
|
388
|
+
nativeCodexPassthrough ? { ...credentials, requestEndpointPath: endpointPath } : credentials;
|
|
388
389
|
|
|
389
390
|
// Create stream controller for disconnect detection
|
|
390
391
|
const streamController = createStreamController({ onDisconnect, log, provider, model });
|
|
@@ -405,7 +406,7 @@ export async function handleChatCore({
|
|
|
405
406
|
model: modelToCall,
|
|
406
407
|
body: bodyToSend,
|
|
407
408
|
stream,
|
|
408
|
-
credentials,
|
|
409
|
+
credentials: getExecutionCredentials(),
|
|
409
410
|
signal: streamController.signal,
|
|
410
411
|
log,
|
|
411
412
|
extendedContext,
|
|
@@ -545,7 +546,7 @@ export async function handleChatCore({
|
|
|
545
546
|
model,
|
|
546
547
|
body: translatedBody,
|
|
547
548
|
stream,
|
|
548
|
-
credentials,
|
|
549
|
+
credentials: getExecutionCredentials(),
|
|
549
550
|
signal: streamController.signal,
|
|
550
551
|
log,
|
|
551
552
|
extendedContext,
|
|
@@ -123,6 +123,20 @@ export function applyToolFilter(
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Strip all <omniModel> tags from message content before forwarding to the provider.
|
|
128
|
+
* The tag is an internal OmniRoute marker; providers must never see it or their
|
|
129
|
+
* cache will treat every tagged request as a new session (#454).
|
|
130
|
+
*/
|
|
131
|
+
export function stripModelTags(messages: Message[]): Message[] {
|
|
132
|
+
return messages.map((msg) => {
|
|
133
|
+
if (typeof msg.content === "string" && CACHE_TAG_PATTERN.test(msg.content)) {
|
|
134
|
+
return { ...msg, content: msg.content.replace(CACHE_TAG_PATTERN, "").trimEnd() };
|
|
135
|
+
}
|
|
136
|
+
return msg;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
126
140
|
// ── Main Middleware ──────────────────────────────────────────────────────────
|
|
127
141
|
|
|
128
142
|
/**
|
|
@@ -158,6 +172,11 @@ export function applyComboAgentMiddleware(
|
|
|
158
172
|
comboConfig.tool_filter_regex
|
|
159
173
|
);
|
|
160
174
|
|
|
175
|
+
// 4. Strip internal <omniModel> tags before forwarding to provider (#454)
|
|
176
|
+
// These tags are OmniRoute-internal markers and must never reach the provider
|
|
177
|
+
// since providers would treat each tagged request as a new cache session.
|
|
178
|
+
messages = stripModelTags(messages);
|
|
179
|
+
|
|
161
180
|
return {
|
|
162
181
|
body: {
|
|
163
182
|
...body,
|
package/app/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omniroute",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.9",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omniroute",
|
|
9
|
-
"version": "2.7.
|
|
9
|
+
"version": "2.7.9",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"workspaces": [
|
package/app/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omniroute",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.9",
|
|
4
4
|
"description": "Smart AI Router with auto fallback — route to FREE & cheap models, zero downtime. Works with Cursor, Cline, Claude Desktop, Codex, and any OpenAI-compatible tool.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/app/server.js
CHANGED
|
@@ -15,7 +15,7 @@ const currentPort = parseInt(process.env.PORT, 10) || 3000
|
|
|
15
15
|
const hostname = process.env.HOSTNAME || '0.0.0.0'
|
|
16
16
|
|
|
17
17
|
let keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10)
|
|
18
|
-
const nextConfig = {"env":{},"typescript":{"ignoreBuildErrors":true},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.mjs","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":true},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":".","allowedDevOrigins":["localhost","127.0.0.1","192.168.*"],"cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"dynamicOnHover":false,"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":3,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"imgOptSkipMetadata":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"viewTransition":false,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":false,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":false,"serverComponentsHmrCache":true,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":false,"lockDistDir":true,"isolatedDevBuild":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":false,"turbopackInferModuleSideEffects":false,"optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.mjs","turbopack":{"resolveAlias":{"@/mitm/manager":"./src/mitm/manager.stub.ts","next-intl/config":"./src/i18n/request.ts"},"root":"."},"serverExternalPackages":["better-sqlite3","zod","child_process","fs","path","os","crypto","net","tls","http","https","stream","buffer","util"],"transpilePackages":["@omniroute/open-sse"],"distDirRoot":".next","_originalRewrites":{"beforeFiles":[],"afterFiles":[{"source":"/chat/completions","destination":"/api/v1/chat/completions"},{"source":"/responses","destination":"/api/v1/responses"},{"source":"/models","destination":"/api/v1/models"},{"source":"/v1/v1/:path*","destination":"/api/v1/:path*"},{"source":"/v1/v1","destination":"/api/v1"},{"source":"/codex/:path*","destination":"/api/v1/responses"},{"source":"/v1/:path*","destination":"/api/v1/:path*"},{"source":"/v1","destination":"/api/v1"}],"fallback":[]}}
|
|
18
|
+
const nextConfig = {"env":{},"typescript":{"ignoreBuildErrors":true},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.mjs","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":true},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":".","allowedDevOrigins":["localhost","127.0.0.1","192.168.*"],"cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"dynamicOnHover":false,"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":3,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"imgOptSkipMetadata":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"viewTransition":false,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":false,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":false,"serverComponentsHmrCache":true,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":false,"lockDistDir":true,"isolatedDevBuild":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":false,"turbopackInferModuleSideEffects":false,"optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.mjs","turbopack":{"resolveAlias":{"@/mitm/manager":"./src/mitm/manager.stub.ts","next-intl/config":"./src/i18n/request.ts"},"root":"."},"serverExternalPackages":["better-sqlite3","zod","child_process","fs","path","os","crypto","net","tls","http","https","stream","buffer","util"],"transpilePackages":["@omniroute/open-sse"],"distDirRoot":".next","_originalRewrites":{"beforeFiles":[],"afterFiles":[{"source":"/chat/completions","destination":"/api/v1/chat/completions"},{"source":"/responses","destination":"/api/v1/responses"},{"source":"/responses/:path*","destination":"/api/v1/responses/:path*"},{"source":"/models","destination":"/api/v1/models"},{"source":"/v1/v1/:path*","destination":"/api/v1/:path*"},{"source":"/v1/v1","destination":"/api/v1"},{"source":"/codex/:path*","destination":"/api/v1/responses"},{"source":"/v1/:path*","destination":"/api/v1/:path*"},{"source":"/v1","destination":"/api/v1"}],"fallback":[]}}
|
|
19
19
|
|
|
20
20
|
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
|
|
21
21
|
|
|
@@ -1181,6 +1181,12 @@ function ComboFormModal({ isOpen, combo, onClose, onSave, activeProviders }) {
|
|
|
1181
1181
|
const [config, setConfig] = useState(combo?.config || {});
|
|
1182
1182
|
const [showStrategyNudge, setShowStrategyNudge] = useState(false);
|
|
1183
1183
|
const strategyChangeMountedRef = useRef(false);
|
|
1184
|
+
// Agent features (#399 / #401 / #454)
|
|
1185
|
+
const [agentSystemMessage, setAgentSystemMessage] = useState<string>(combo?.system_message || "");
|
|
1186
|
+
const [agentToolFilter, setAgentToolFilter] = useState<string>(combo?.tool_filter_regex || "");
|
|
1187
|
+
const [agentContextCache, setAgentContextCache] = useState<boolean>(
|
|
1188
|
+
!!combo?.context_cache_protection
|
|
1189
|
+
);
|
|
1184
1190
|
|
|
1185
1191
|
// DnD state
|
|
1186
1192
|
const hasPricingForModel = useCallback(
|
|
@@ -1532,6 +1538,14 @@ function ComboFormModal({ isOpen, combo, onClose, onSave, activeProviders }) {
|
|
|
1532
1538
|
saveData.config = configToSave;
|
|
1533
1539
|
}
|
|
1534
1540
|
|
|
1541
|
+
// Agent features (#399 / #401 / #454)
|
|
1542
|
+
if (agentSystemMessage.trim()) saveData.system_message = agentSystemMessage.trim();
|
|
1543
|
+
else delete saveData.system_message;
|
|
1544
|
+
if (agentToolFilter.trim()) saveData.tool_filter_regex = agentToolFilter.trim();
|
|
1545
|
+
else delete saveData.tool_filter_regex;
|
|
1546
|
+
if (agentContextCache) saveData.context_cache_protection = true;
|
|
1547
|
+
else delete saveData.context_cache_protection;
|
|
1548
|
+
|
|
1535
1549
|
await onSave(saveData);
|
|
1536
1550
|
setSaving(false);
|
|
1537
1551
|
};
|
|
@@ -2052,6 +2066,72 @@ function ComboFormModal({ isOpen, combo, onClose, onSave, activeProviders }) {
|
|
|
2052
2066
|
</div>
|
|
2053
2067
|
)}
|
|
2054
2068
|
|
|
2069
|
+
{/* Agent Features (#399 / #401 / #454) */}
|
|
2070
|
+
<div className="flex flex-col gap-2 p-3 bg-black/[0.02] dark:bg-white/[0.02] rounded-lg border border-black/5 dark:border-white/5">
|
|
2071
|
+
<div className="flex items-center gap-1.5 mb-1">
|
|
2072
|
+
<span className="material-symbols-outlined text-[14px] text-primary">smart_toy</span>
|
|
2073
|
+
<p className="text-xs font-medium">Agent Features</p>
|
|
2074
|
+
<span className="text-[10px] text-text-muted">
|
|
2075
|
+
— optional, for agent/tool workflows
|
|
2076
|
+
</span>
|
|
2077
|
+
</div>
|
|
2078
|
+
|
|
2079
|
+
{/* System Message Override */}
|
|
2080
|
+
<div>
|
|
2081
|
+
<label className="text-[11px] font-medium text-text-muted block mb-0.5">
|
|
2082
|
+
System Message Override
|
|
2083
|
+
</label>
|
|
2084
|
+
<textarea
|
|
2085
|
+
rows={2}
|
|
2086
|
+
value={agentSystemMessage}
|
|
2087
|
+
onChange={(e) => setAgentSystemMessage(e.target.value)}
|
|
2088
|
+
placeholder="Override the system prompt for all requests routed through this combo…"
|
|
2089
|
+
className="w-full text-xs py-1.5 px-2 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none resize-none"
|
|
2090
|
+
/>
|
|
2091
|
+
<p className="text-[10px] text-text-muted mt-0.5">
|
|
2092
|
+
Replaces any system message sent by the client. Leave empty to pass through client
|
|
2093
|
+
system messages.
|
|
2094
|
+
</p>
|
|
2095
|
+
</div>
|
|
2096
|
+
|
|
2097
|
+
{/* Tool Filter Regex */}
|
|
2098
|
+
<div>
|
|
2099
|
+
<label className="text-[11px] font-medium text-text-muted block mb-0.5">
|
|
2100
|
+
Tool Filter Regex
|
|
2101
|
+
</label>
|
|
2102
|
+
<input
|
|
2103
|
+
type="text"
|
|
2104
|
+
value={agentToolFilter}
|
|
2105
|
+
onChange={(e) => setAgentToolFilter(e.target.value)}
|
|
2106
|
+
placeholder="e.g. ^(bash|computer)$"
|
|
2107
|
+
className="w-full text-xs py-1.5 px-2 rounded border border-black/10 dark:border-white/10 bg-transparent focus:border-primary focus:outline-none font-mono"
|
|
2108
|
+
/>
|
|
2109
|
+
<p className="text-[10px] text-text-muted mt-0.5">
|
|
2110
|
+
Only tools whose name matches this regex are forwarded to the provider. Leave empty
|
|
2111
|
+
to forward all tools.
|
|
2112
|
+
</p>
|
|
2113
|
+
</div>
|
|
2114
|
+
|
|
2115
|
+
{/* Context Cache Protection */}
|
|
2116
|
+
<div className="flex items-center justify-between gap-2">
|
|
2117
|
+
<div>
|
|
2118
|
+
<label className="text-[11px] font-medium text-text-muted block">
|
|
2119
|
+
Context Cache Protection
|
|
2120
|
+
</label>
|
|
2121
|
+
<p className="text-[10px] text-text-muted">
|
|
2122
|
+
Pins the provider/model across turns to preserve cache sessions. Internal tags are
|
|
2123
|
+
stripped before forwarding to the provider.
|
|
2124
|
+
</p>
|
|
2125
|
+
</div>
|
|
2126
|
+
<input
|
|
2127
|
+
type="checkbox"
|
|
2128
|
+
checked={agentContextCache}
|
|
2129
|
+
onChange={(e) => setAgentContextCache(e.target.checked)}
|
|
2130
|
+
className="accent-primary shrink-0"
|
|
2131
|
+
/>
|
|
2132
|
+
</div>
|
|
2133
|
+
</div>
|
|
2134
|
+
|
|
2055
2135
|
{/* Actions */}
|
|
2056
2136
|
<div className="flex gap-2 pt-1">
|
|
2057
2137
|
<Button onClick={onClose} variant="ghost" fullWidth size="sm">
|
|
@@ -83,7 +83,11 @@ export default function BudgetTab() {
|
|
|
83
83
|
if (data.monthlyLimitUsd)
|
|
84
84
|
setForm((f) => ({ ...f, monthlyLimitUsd: String(data.monthlyLimitUsd) }));
|
|
85
85
|
if (data.warningThreshold)
|
|
86
|
-
|
|
86
|
+
// stored as fraction (0–1), display as percentage (0–100)
|
|
87
|
+
setForm((f) => ({
|
|
88
|
+
...f,
|
|
89
|
+
warningThreshold: String(Math.round(data.warningThreshold * 100)),
|
|
90
|
+
}));
|
|
87
91
|
}
|
|
88
92
|
} catch {
|
|
89
93
|
// silent
|
|
@@ -104,7 +108,8 @@ export default function BudgetTab() {
|
|
|
104
108
|
apiKeyId: selectedKey,
|
|
105
109
|
dailyLimitUsd: form.dailyLimitUsd ? parseFloat(form.dailyLimitUsd) : null,
|
|
106
110
|
monthlyLimitUsd: form.monthlyLimitUsd ? parseFloat(form.monthlyLimitUsd) : null,
|
|
107
|
-
|
|
111
|
+
// schema expects a fraction (0–1); UI shows percentage (0–100)
|
|
112
|
+
warningThreshold: (parseInt(form.warningThreshold) || 80) / 100,
|
|
108
113
|
}),
|
|
109
114
|
});
|
|
110
115
|
if (res.ok) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CORS_ORIGIN } from "@/shared/utils/cors";
|
|
2
|
+
import { handleChat } from "@/sse/handlers/chat";
|
|
3
|
+
import { initTranslators } from "@omniroute/open-sse/translator/index.ts";
|
|
4
|
+
|
|
5
|
+
let initialized = false;
|
|
6
|
+
|
|
7
|
+
async function ensureInitialized() {
|
|
8
|
+
if (!initialized) {
|
|
9
|
+
await initTranslators();
|
|
10
|
+
initialized = true;
|
|
11
|
+
console.log("[SSE] Translators initialized for /v1/responses/*");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function OPTIONS() {
|
|
16
|
+
return new Response(null, {
|
|
17
|
+
headers: {
|
|
18
|
+
"Access-Control-Allow-Origin": CORS_ORIGIN,
|
|
19
|
+
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
20
|
+
"Access-Control-Allow-Headers": "*",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* POST /v1/responses/:path* - OpenAI Responses subpaths
|
|
27
|
+
* Reuses the shared chat handler so native Codex passthrough can keep
|
|
28
|
+
* arbitrary Responses suffixes all the way to the upstream provider.
|
|
29
|
+
*/
|
|
30
|
+
export async function POST(request) {
|
|
31
|
+
await ensureInitialized();
|
|
32
|
+
return await handleChat(request);
|
|
33
|
+
}
|
|
@@ -23,13 +23,16 @@ export async function getConsistentMachineId(salt = null) {
|
|
|
23
23
|
} catch (error) {
|
|
24
24
|
console.log("Error getting machine ID:", error);
|
|
25
25
|
// Fallback to random ID if node-machine-id fails
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
try {
|
|
27
|
+
const cryptoFallback = await import("crypto");
|
|
28
|
+
return cryptoFallback.randomUUID();
|
|
29
|
+
} catch {
|
|
30
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
31
|
+
const r = (Math.random() * 16) | 0;
|
|
32
|
+
const v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
33
|
+
return v.toString(16);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -44,13 +47,16 @@ export async function getRawMachineId() {
|
|
|
44
47
|
} catch (error) {
|
|
45
48
|
console.log("Error getting raw machine ID:", error);
|
|
46
49
|
// Fallback to random ID if node-machine-id fails
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
try {
|
|
51
|
+
const cryptoFallback = await import("crypto");
|
|
52
|
+
return cryptoFallback.randomUUID();
|
|
53
|
+
} catch {
|
|
54
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
55
|
+
const r = (Math.random() * 16) | 0;
|
|
56
|
+
const v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
57
|
+
return v.toString(16);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
|
|
@@ -80,6 +80,9 @@ export const createComboSchema = z.object({
|
|
|
80
80
|
strategy: comboStrategySchema.optional().default("priority"),
|
|
81
81
|
config: comboConfigSchema,
|
|
82
82
|
allowedProviders: z.array(z.string().max(200)).optional(),
|
|
83
|
+
system_message: z.string().max(50000).optional(),
|
|
84
|
+
tool_filter_regex: z.string().max(1000).optional(),
|
|
85
|
+
context_cache_protection: z.boolean().optional(),
|
|
83
86
|
});
|
|
84
87
|
|
|
85
88
|
// ──── Auto-Combo Schemas ────
|
|
@@ -813,6 +816,9 @@ export const updateComboSchema = z
|
|
|
813
816
|
config: comboRuntimeConfigSchema.optional(),
|
|
814
817
|
isActive: z.boolean().optional(),
|
|
815
818
|
allowedProviders: z.array(z.string().max(200)).optional(),
|
|
819
|
+
system_message: z.string().max(50000).optional(),
|
|
820
|
+
tool_filter_regex: z.string().max(1000).optional(),
|
|
821
|
+
context_cache_protection: z.boolean().optional(),
|
|
816
822
|
})
|
|
817
823
|
.superRefine((value, ctx) => {
|
|
818
824
|
if (
|
|
@@ -821,7 +827,10 @@ export const updateComboSchema = z
|
|
|
821
827
|
value.strategy === undefined &&
|
|
822
828
|
value.config === undefined &&
|
|
823
829
|
value.isActive === undefined &&
|
|
824
|
-
value.allowedProviders === undefined
|
|
830
|
+
value.allowedProviders === undefined &&
|
|
831
|
+
value.system_message === undefined &&
|
|
832
|
+
value.tool_filter_regex === undefined &&
|
|
833
|
+
value.context_cache_protection === undefined
|
|
825
834
|
) {
|
|
826
835
|
ctx.addIssue({
|
|
827
836
|
code: z.ZodIssueCode.custom,
|
|
@@ -108,6 +108,24 @@ test("shouldUseNativeCodexPassthrough only enables responses-native Codex reques
|
|
|
108
108
|
false
|
|
109
109
|
);
|
|
110
110
|
|
|
111
|
+
assert.equal(
|
|
112
|
+
shouldUseNativeCodexPassthrough({
|
|
113
|
+
provider: "codex",
|
|
114
|
+
sourceFormat: FORMATS.OPENAI_RESPONSES,
|
|
115
|
+
endpointPath: "/v1/responses/compact",
|
|
116
|
+
}),
|
|
117
|
+
true
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
assert.equal(
|
|
121
|
+
shouldUseNativeCodexPassthrough({
|
|
122
|
+
provider: "codex",
|
|
123
|
+
sourceFormat: FORMATS.OPENAI_RESPONSES,
|
|
124
|
+
endpointPath: "/v1/responses/items/history",
|
|
125
|
+
}),
|
|
126
|
+
true
|
|
127
|
+
);
|
|
128
|
+
|
|
111
129
|
assert.equal(
|
|
112
130
|
shouldUseNativeCodexPassthrough({
|
|
113
131
|
provider: "codex",
|
|
@@ -140,6 +158,18 @@ test("CodexExecutor always requests SSE accept header", () => {
|
|
|
140
158
|
assert.equal(headers.Accept, "text/event-stream");
|
|
141
159
|
});
|
|
142
160
|
|
|
161
|
+
test("CodexExecutor does not request SSE accept header for compact requests", () => {
|
|
162
|
+
const executor = new CodexExecutor();
|
|
163
|
+
const headers = executor.buildHeaders(
|
|
164
|
+
{
|
|
165
|
+
accessToken: "test-token",
|
|
166
|
+
requestEndpointPath: "/v1/responses/compact",
|
|
167
|
+
},
|
|
168
|
+
false
|
|
169
|
+
);
|
|
170
|
+
assert.equal(headers.Accept, undefined);
|
|
171
|
+
});
|
|
172
|
+
|
|
143
173
|
test("CodexExecutor preserves native responses payloads for Codex passthrough", () => {
|
|
144
174
|
const executor = new CodexExecutor();
|
|
145
175
|
const transformed = executor.transformRequest(
|
|
@@ -167,6 +197,41 @@ test("CodexExecutor preserves native responses payloads for Codex passthrough",
|
|
|
167
197
|
assert.ok(!("_nativeCodexPassthrough" in transformed));
|
|
168
198
|
});
|
|
169
199
|
|
|
200
|
+
test("CodexExecutor strips streaming fields for compact passthrough", () => {
|
|
201
|
+
const executor = new CodexExecutor();
|
|
202
|
+
const transformed = executor.transformRequest(
|
|
203
|
+
"gpt-5.1-codex",
|
|
204
|
+
{
|
|
205
|
+
model: "gpt-5.1-codex",
|
|
206
|
+
input: "compact this session",
|
|
207
|
+
stream: false,
|
|
208
|
+
stream_options: { include_usage: true },
|
|
209
|
+
_nativeCodexPassthrough: true,
|
|
210
|
+
},
|
|
211
|
+
false,
|
|
212
|
+
{
|
|
213
|
+
requestEndpointPath: "/v1/responses/compact",
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
assert.equal("stream" in transformed, false);
|
|
218
|
+
assert.equal("stream_options" in transformed, false);
|
|
219
|
+
assert.ok(!("_nativeCodexPassthrough" in transformed));
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
test("CodexExecutor routes responses subpaths to matching upstream paths", () => {
|
|
223
|
+
const executor = new CodexExecutor();
|
|
224
|
+
const compactUrl = executor.buildUrl("gpt-5.1-codex", true, 0, {
|
|
225
|
+
requestEndpointPath: "/v1/responses/compact",
|
|
226
|
+
});
|
|
227
|
+
assert.match(compactUrl, /\/responses\/compact$/);
|
|
228
|
+
|
|
229
|
+
const genericSubpathUrl = executor.buildUrl("gpt-5.1-codex", true, 0, {
|
|
230
|
+
requestEndpointPath: "/v1/responses/items/history",
|
|
231
|
+
});
|
|
232
|
+
assert.match(genericSubpathUrl, /\/responses\/items\/history$/);
|
|
233
|
+
});
|
|
234
|
+
|
|
170
235
|
test("translateNonStreamingResponse converts Responses API payload to OpenAI chat.completion", () => {
|
|
171
236
|
const responseBody = {
|
|
172
237
|
id: "resp_123",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omniroute",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.9",
|
|
4
4
|
"description": "Smart AI Router with auto fallback — route to FREE & cheap models, zero downtime. Works with Cursor, Cline, Claude Desktop, Codex, and any OpenAI-compatible tool.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,474078,e=>{"use strict";var t=e.i(342923);e.s(["Button",()=>t.default])},565650,e=>{"use strict";e.i(342923),e.i(80173),e.i(907714),e.i(393718),e.i(703166),e.i(454149),e.i(822124),e.i(969353),e.i(635055),e.i(897844),e.i(450222),e.i(647829),e.i(6998),e.i(982131),e.i(116016),e.i(279743),e.i(193464),e.i(548036),e.i(566770),e.i(953789),e.i(8839),e.i(227404),e.i(621745),e.i(567955),e.i(17517),e.i(419947),e.i(323060),e.i(642440),e.i(629342),e.i(816062),e.i(690777),e.i(563201),e.i(115243),e.i(165149),e.i(359505),e.s([],565650)},11477,e=>{"use strict";var t=e.i(393718);e.s(["Card",()=>t.default])},339971,e=>{"use strict";var t=e.i(80173);e.s(["Input",()=>t.default])},643953,e=>{"use strict";var t=e.i(323060);e.s(["SegmentedControl",()=>t.default])},11131,e=>{"use strict";var t=e.i(629342);e.s(["EmptyState",()=>t.default])},979765,e=>{"use strict";var t=e.i(843476),s=e.i(271645);e.i(565650);var a=e.i(643953),i=e.i(861745),l=e.i(948148),r=e.i(11477),n=e.i(474078),d=e.i(339971),o=e.i(11131),c=e.i(627949);function m({value:e,max:s,warningAt:a=.8,formatCurrency:i}){let l=s>0?Math.min(e/s*100,100):0,r=s>0?e/s:0;return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex justify-between text-xs mb-1",children:[(0,t.jsx)("span",{className:"text-text-muted",children:i(e)}),(0,t.jsx)("span",{className:"text-text-muted",children:i(s)})]}),(0,t.jsx)("div",{className:"w-full h-2 rounded-full bg-surface/50 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${l}%`,backgroundColor:r>=1?"#ef4444":r>=a?"#f59e0b":"#22c55e"}})})]})}function u(){let e=(0,l.useTranslations)("usage"),a=(0,i.useLocale)(),[u,x]=(0,s.useState)([]),[p,h]=(0,s.useState)(null),[g,b]=(0,s.useState)(null),[y,f]=(0,s.useState)(!0),[j,v]=(0,s.useState)(!1),[N,w]=(0,s.useState)({dailyLimitUsd:"",monthlyLimitUsd:"",warningThreshold:"80"}),C=(0,c.useNotificationStore)(),S=e=>new Intl.NumberFormat(a,{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e||0));(0,s.useEffect)(()=>{fetch("/api/keys").then(e=>e.json()).then(e=>{let t=Array.isArray(e)?e:e.keys||[];x(t),t.length>0&&h(t[0].id),f(!1)}).catch(()=>f(!1))},[]);let L=(0,s.useCallback)(async()=>{if(p)try{let e=await fetch(`/api/usage/budget?apiKeyId=${p}`);if(e.ok){let t=await e.json();b(t),t.dailyLimitUsd&&w(e=>({...e,dailyLimitUsd:String(t.dailyLimitUsd)})),t.monthlyLimitUsd&&w(e=>({...e,monthlyLimitUsd:String(t.monthlyLimitUsd)})),t.warningThreshold&&w(e=>({...e,warningThreshold:String(t.warningThreshold)}))}}catch{}},[p]);(0,s.useEffect)(()=>{L()},[L]);let k=async()=>{v(!0);try{(await fetch("/api/usage/budget",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKeyId:p,dailyLimitUsd:N.dailyLimitUsd?parseFloat(N.dailyLimitUsd):null,monthlyLimitUsd:N.monthlyLimitUsd?parseFloat(N.monthlyLimitUsd):null,warningThreshold:parseInt(N.warningThreshold)||80})})).ok?(C.success(e("budgetSaved")),await L()):C.error(e("budgetSaveFailed"))}catch{C.error(e("budgetSaveFailed"))}finally{v(!1)}};if(y)return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-text-muted p-8 animate-pulse",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"account_balance_wallet"}),e("loadingBudgetData")]});if(0===u.length)return(0,t.jsx)(o.EmptyState,{icon:"vpn_key",title:e("noApiKeysTitle"),description:e("noApiKeysDescription")});let T=g?.dailyLimitUsd||parseFloat(N.dailyLimitUsd)||0,U=g?.monthlyLimitUsd||parseFloat(N.monthlyLimitUsd)||0,P=g?.totalCostToday||0,$=g?.totalCostMonth||0,D=(parseInt(N.warningThreshold)||80)/100;return(0,t.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,t.jsxs)(r.Card,{className:"p-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,t.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/10 text-emerald-500",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",children:"account_balance_wallet"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold",children:e("budgetManagement")})]}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("label",{className:"text-sm text-text-muted mb-1 block",children:e("apiKey")}),(0,t.jsx)("select",{value:p||"",onChange:e=>h(e.target.value),className:"w-full md:w-auto px-3 py-2 rounded-lg border border-border/50 bg-surface/30 text-text-main text-sm focus:outline-none focus:ring-1 focus:ring-primary",children:u.map(e=>(0,t.jsxs)("option",{value:e.id,children:[e.name||e.id," ",e.provider?`(${e.provider})`:""]},e.id))})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[(0,t.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted mb-2",children:e("todaysSpend")}),(0,t.jsx)("p",{className:"text-2xl font-bold text-text-main",children:S(P)}),T>0&&(0,t.jsx)(m,{value:P,max:T,warningAt:D,formatCurrency:S})]}),(0,t.jsxs)("div",{className:"p-4 rounded-lg border border-border/30 bg-surface/20",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted mb-2",children:e("thisMonth")}),(0,t.jsx)("p",{className:"text-2xl font-bold text-text-main",children:S($)}),U>0&&(0,t.jsx)(m,{value:$,max:U,warningAt:D,formatCurrency:S})]})]}),(0,t.jsxs)("div",{className:"border-t border-border/30 pt-4",children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-3",children:e("setLimits")}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[(0,t.jsx)(d.Input,{label:e("dailyLimitUsd"),type:"number",step:"0.01",min:"0",placeholder:e("dailyLimitPlaceholder"),value:N.dailyLimitUsd,onChange:e=>w({...N,dailyLimitUsd:e.target.value})}),(0,t.jsx)(d.Input,{label:e("monthlyLimitUsd"),type:"number",step:"0.01",min:"0",placeholder:e("monthlyLimitPlaceholder"),value:N.monthlyLimitUsd,onChange:e=>w({...N,monthlyLimitUsd:e.target.value})}),(0,t.jsx)(d.Input,{label:e("warningThresholdPercent"),type:"number",min:"1",max:"100",placeholder:e("warningThresholdPlaceholder"),value:N.warningThreshold,onChange:e=>w({...N,warningThreshold:e.target.value})})]}),(0,t.jsx)(n.Button,{variant:"primary",onClick:k,loading:j,children:e("saveLimits")})]})]}),g?.budgetCheck&&(0,t.jsx)(r.Card,{className:"p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[20px]","aria-hidden":"true",style:{color:g.budgetCheck.allowed?"#22c55e":"#ef4444"},children:g.budgetCheck.allowed?"check_circle":"block"}),(0,t.jsx)("span",{className:"text-sm",children:g.budgetCheck.allowed?e("budgetOk",{remaining:S(g.budgetCheck.remaining||0)}):e("budgetExceeded")})]})})]})}let x=["input","output","cached","reasoning","cache_creation"],p={input:"input",output:"output",cached:"cached",reasoning:"reasoning",cache_creation:"cacheCreation"};function h(){let[e,a]=(0,s.useState)({}),[i,n]=(0,s.useState)({}),[d,o]=(0,s.useState)(!0),[c,m]=(0,s.useState)(!1),[u,x]=(0,s.useState)(""),[p,h]=(0,s.useState)(null),[b,y]=(0,s.useState)(new Set),[f,j]=(0,s.useState)(""),[v,N]=(0,s.useState)(new Set),w=(0,l.useTranslations)("settings");(0,s.useEffect)(()=>{C()},[]);let C=async()=>{o(!0);try{let[e,t]=await Promise.all([fetch("/api/pricing/models"),fetch("/api/pricing")]);e.ok&&a(await e.json()),t.ok&&n(await t.json())}catch(e){console.error("Failed to load pricing data:",e)}finally{o(!1)}},S=(0,s.useMemo)(()=>Object.entries(e).map(([e,t])=>({alias:e,...t,pricedModels:i[e]?Object.keys(i[e]).length:0})).sort((e,t)=>t.modelCount-e.modelCount),[e,i]),L=(0,s.useMemo)(()=>{if(!f.trim())return S;let e=f.toLowerCase();return S.filter(t=>t.alias.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.models.some(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)))},[S,f]),k=(0,s.useMemo)(()=>{let e=S.reduce((e,t)=>e+t.modelCount,0),t=Object.values(i).reduce((e,t)=>e+Object.keys(t).length,0);return{providers:S.length,totalModels:e,pricedCount:t}},[S,i]),T=(0,s.useCallback)(e=>{y(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),U=(0,s.useCallback)((e,t,s,a)=>{let i=parseFloat(a);isNaN(i)||i<0||(n(a=>{let l={...a};return l[e]||(l[e]={}),l[e][t]||(l[e][t]={input:0,output:0,cached:0,reasoning:0,cache_creation:0}),l[e][t]={...l[e][t],[s]:i},l}),N(t=>new Set(t).add(e)))},[]),P=(0,s.useCallback)(async e=>{m(!0),x("");try{let t=i[e]||{},s=await fetch("/api/pricing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(s.ok)x(`✅ ${e.toUpperCase()} ${w("saved")}`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>x(""),3e3);else{let e=await s.json();x(`❌ ${w("errorOccurred")}: ${e.error}`)}}catch(e){x(`❌ ${w("saveFailed")}: ${e.message}`)}finally{m(!1)}},[i,w]),$=(0,s.useCallback)(async e=>{if(confirm(w("resetPricingConfirm",{provider:e.toUpperCase()})))try{let t=await fetch(`/api/pricing?provider=${e}`,{method:"DELETE"});if(t.ok){let s=await t.json();n(s),x(`🔄 ${e.toUpperCase()} ${w("resetDefaults")}`),N(t=>{let s=new Set(t);return s.delete(e),s}),setTimeout(()=>x(""),3e3)}}catch(e){x(`❌ ${w("resetFailed")}: ${e.message}`)}},[w]),D=(0,s.useCallback)(e=>{h(t=>t===e?null:e)},[]),F=(0,s.useMemo)(()=>p?L.filter(e=>e.alias===p):L,[L,p]);return d?(0,t.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,t.jsx)("div",{className:"text-text-muted animate-pulse",children:w("loadingPricing")})}):(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between flex-wrap gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-bold",children:w("modelPricing")}),(0,t.jsx)("p",{className:"text-text-muted text-sm mt-1",children:w("modelPricingDesc")})]}),(0,t.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,t.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,t.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("providers")}),(0,t.jsx)("div",{className:"text-lg font-bold",children:k.providers})]}),(0,t.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,t.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("registry")}),(0,t.jsx)("div",{className:"text-lg font-bold",children:k.totalModels})]}),(0,t.jsxs)("div",{className:"bg-bg-subtle rounded-lg px-3 py-2 text-center",children:[(0,t.jsx)("div",{className:"text-text-muted text-xs font-semibold",children:w("priced")}),(0,t.jsx)("div",{className:"text-lg font-bold text-success",children:k.pricedCount})]})]})]}),u&&(0,t.jsx)("div",{className:"px-3 py-2 rounded-lg bg-bg-subtle border border-border text-sm",children:u}),(0,t.jsxs)("div",{className:"flex gap-3 items-center flex-wrap",children:[(0,t.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,t.jsx)("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-muted text-lg",children:"search"}),(0,t.jsx)("input",{type:"text",placeholder:w("searchProvidersModels"),value:f,onChange:e=>j(e.target.value),className:"w-full pl-10 pr-3 py-2 bg-bg-base border border-border rounded-lg focus:outline-none focus:border-primary text-sm"})]}),p&&(0,t.jsxs)("button",{onClick:()=>h(null),className:"px-3 py-2 text-xs bg-primary/10 text-primary border border-primary/20 rounded-lg hover:bg-primary/20 transition-colors flex items-center gap-1",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"}),p.toUpperCase()," — ",w("showAll")]})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:S.map(e=>(0,t.jsxs)("button",{onClick:()=>D(e.alias),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-all ${p===e.alias?"bg-primary text-white shadow-sm":v.has(e.alias)?"bg-yellow-500/15 text-yellow-400 border border-yellow-500/30":"bg-bg-subtle text-text-muted hover:bg-bg-hover border border-transparent"}`,children:[e.alias.toUpperCase()," ",(0,t.jsxs)("span",{className:"opacity-60",children:["(",e.modelCount,")"]})]},e.alias))}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[F.map(e=>(0,t.jsx)(g,{provider:e,pricingData:i[e.alias]||{},isExpanded:b.has(e.alias),isEdited:v.has(e.alias),onToggle:()=>T(e.alias),onPricingChange:(t,s,a)=>U(e.alias,t,s,a),onSave:()=>P(e.alias),onReset:()=>$(e.alias),saving:c},e.alias)),0===F.length&&(0,t.jsx)("div",{className:"text-center py-12 text-text-muted",children:w("noProvidersMatch")})]}),(0,t.jsxs)(r.Card,{className:"p-4 mt-2",children:[(0,t.jsxs)("h3",{className:"text-sm font-semibold mb-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),w("howPricingWorks")]}),(0,t.jsxs)("div",{className:"text-xs text-text-muted space-y-1",children:[(0,t.jsxs)("p",{children:[w("pricingDescInput")," • ",w("pricingDescOutput")," • ",w("pricingDescCached")," •"," ",w("pricingDescReasoning")," • ",w("pricingDescCacheWrite")]}),(0,t.jsx)("p",{children:w("pricingDescFormula")})]})]})]})}function g({provider:e,pricingData:s,isExpanded:a,isEdited:i,onToggle:r,onPricingChange:n,onSave:d,onReset:o,saving:c}){let m=(0,l.useTranslations)("settings"),u=(0,l.useTranslations)(),h=Object.keys(s).length,g="oauth"===e.authType?u("providers.oauthLabel"):"apikey"===e.authType?u("providers.apiKeyLabel"):e.authType;return(0,t.jsxs)("div",{className:`border rounded-lg overflow-hidden transition-colors ${i?"border-yellow-500/40 bg-yellow-500/5":"border-border"}`,children:[(0,t.jsxs)("button",{onClick:r,className:"w-full flex items-center justify-between px-4 py-3 hover:bg-bg-hover/50 transition-colors text-left",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:`material-symbols-outlined text-lg transition-transform ${a?"rotate-90":""}`,children:"chevron_right"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-semibold text-sm",children:e.id.charAt(0).toUpperCase()+e.id.slice(1)}),(0,t.jsxs)("span",{className:"text-text-muted text-xs ml-2",children:["(",e.alias.toUpperCase(),")"]})]}),(0,t.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:g}),(0,t.jsx)("span",{className:"px-1.5 py-0.5 bg-bg-subtle text-text-muted text-[10px] rounded uppercase font-semibold",children:e.format})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[i&&(0,t.jsx)("span",{className:"text-yellow-500 text-xs font-medium",children:m("unsaved")}),(0,t.jsxs)("span",{className:"text-text-muted text-xs",children:[h,"/",e.modelCount," ",m("withPricing")]}),(0,t.jsx)("div",{className:"w-16 h-1.5 bg-bg-subtle rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${e.modelCount>0?Math.round(h/e.modelCount*100):0}%`}})})]})]}),a&&(0,t.jsxs)("div",{className:"border-t border-border",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-bg-subtle/50",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[e.modelCount," ",m("models")," • ",h," ",m("withPricing")]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"px-2.5 py-1 text-[11px] text-red-400 hover:bg-red-500/10 rounded border border-red-500/20 transition-colors",children:m("resetDefaults")}),(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),d()},disabled:c||!i,className:"px-2.5 py-1 text-[11px] bg-primary text-white rounded hover:bg-primary/90 transition-colors disabled:opacity-40",children:c?m("saving"):m("saveProvider")})]})]}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-[11px] text-text-muted uppercase bg-bg-subtle/30",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"px-4 py-2 text-left font-semibold",children:m("model")}),x.map(e=>(0,t.jsx)("th",{className:"px-2 py-2 text-right font-semibold w-24",children:m(p[e])},e))]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/50",children:e.models.map(e=>(0,t.jsx)(b,{model:e,pricing:s[e.id],onPricingChange:(t,s)=>n(e.id,t,s)},e.id))})]})})]})]})}function b({model:e,pricing:s,onPricingChange:a}){let i=(0,l.useTranslations)("settings"),r=s&&Object.values(s).some(e=>e>0);return(0,t.jsxs)("tr",{className:"hover:bg-bg-hover/30 group",children:[(0,t.jsx)("td",{className:"px-4 py-1.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${r?"bg-success":"bg-text-muted/30"}`}),(0,t.jsx)("span",{className:"font-medium text-xs",children:e.name}),e.custom&&(0,t.jsx)("span",{className:"px-1 py-0.5 text-[8px] font-bold bg-blue-500/15 text-blue-400 border border-blue-500/20 rounded uppercase",children:i("custom")}),(0,t.jsx)("span",{className:"text-text-muted text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:e.id})]})}),x.map(e=>(0,t.jsx)("td",{className:"px-2 py-1.5",children:(0,t.jsx)("input",{type:"number",step:"0.01",min:"0",value:s?.[e]||0,onChange:t=>a(e,t.target.value),className:"w-full px-2 py-1 text-right text-xs bg-transparent border border-transparent hover:border-border focus:border-primary focus:bg-bg-base rounded transition-colors outline-none tabular-nums"})},e))]})}function y(){let[e,i]=(0,s.useState)("budget"),r=(0,l.useTranslations)("costs"),n=(0,l.useTranslations)("settings");return(0,t.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,t.jsx)(a.SegmentedControl,{options:[{value:"budget",label:r("budget")},{value:"pricing",label:n("pricing")}],value:e,onChange:i}),"budget"===e&&(0,t.jsx)(u,{}),"pricing"===e&&(0,t.jsx)(h,{})]})}e.s(["default",()=>y],979765)}]);
|