9router 0.2.94 → 0.2.96

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.
Files changed (261) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +33 -33
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/prerender-manifest.json +3 -3
  5. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/_global-error.html +2 -2
  17. package/app/.next/server/app/_global-error.rsc +1 -1
  18. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  19. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  20. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  21. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  22. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  23. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  24. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  25. package/app/.next/server/app/_not-found.html +1 -1
  26. package/app/.next/server/app/_not-found.rsc +2 -2
  27. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  28. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  29. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  30. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  31. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  32. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  33. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  34. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  35. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  36. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  37. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +2 -2
  38. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
  40. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
  42. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  43. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  44. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  46. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  48. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  52. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  54. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  57. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  58. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  60. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  61. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  63. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  64. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  66. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  67. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  69. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  72. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  73. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  75. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  78. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  79. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  81. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  82. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/tunnel/disable/route_client-reference-manifest.js +1 -1
  85. package/app/.next/server/app/api/tunnel/enable/route_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/api/tunnel/status/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  88. package/app/.next/server/app/api/usage/chart/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  90. package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  93. package/app/.next/server/app/api/usage/stream/route_client-reference-manifest.js +1 -1
  94. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  96. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  97. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  98. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  99. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  100. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  101. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  102. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  103. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  104. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  105. package/app/.next/server/app/callback.html +1 -1
  106. package/app/.next/server/app/callback.rsc +3 -3
  107. package/app/.next/server/app/callback.segments/_full.segment.rsc +3 -3
  108. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  109. package/app/.next/server/app/callback.segments/_index.segment.rsc +2 -2
  110. package/app/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
  111. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
  112. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  113. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  114. package/app/.next/server/app/dashboard/cli-tools.rsc +4 -4
  115. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  116. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  117. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  118. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  119. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +4 -4
  120. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  121. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +2 -2
  122. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  123. package/app/.next/server/app/dashboard/combos.html +1 -1
  124. package/app/.next/server/app/dashboard/combos.rsc +4 -4
  125. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  126. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  127. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  128. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  129. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +4 -4
  130. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  131. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +2 -2
  132. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  133. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  134. package/app/.next/server/app/dashboard/endpoint.rsc +4 -4
  135. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  136. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  137. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  138. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  139. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +4 -4
  140. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  141. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +2 -2
  142. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  143. package/app/.next/server/app/dashboard/profile.html +1 -1
  144. package/app/.next/server/app/dashboard/profile.rsc +4 -4
  145. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  146. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  147. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  148. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  149. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +4 -4
  150. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  151. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +2 -2
  152. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  153. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  154. package/app/.next/server/app/dashboard/providers/new.rsc +4 -4
  155. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  156. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  157. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  158. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  159. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  160. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +4 -4
  161. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  162. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +2 -2
  163. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  164. package/app/.next/server/app/dashboard/providers.html +1 -1
  165. package/app/.next/server/app/dashboard/providers.rsc +4 -4
  166. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  167. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  168. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  169. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  170. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
  171. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  172. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +2 -2
  173. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  174. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  175. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  176. package/app/.next/server/app/dashboard/settings/pricing.rsc +2 -2
  177. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
  178. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  179. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +2 -2
  180. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  181. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  182. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  183. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  184. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  185. package/app/.next/server/app/dashboard/translator.html +1 -1
  186. package/app/.next/server/app/dashboard/translator.rsc +4 -4
  187. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  188. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  189. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  190. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  191. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +4 -4
  192. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  193. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +2 -2
  194. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  195. package/app/.next/server/app/dashboard/usage.html +1 -1
  196. package/app/.next/server/app/dashboard/usage.rsc +4 -4
  197. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  198. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  199. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  200. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  201. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +4 -4
  202. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  203. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +2 -2
  204. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  205. package/app/.next/server/app/dashboard.html +1 -1
  206. package/app/.next/server/app/dashboard.rsc +4 -4
  207. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  208. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  209. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  210. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +4 -4
  211. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  212. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +2 -2
  213. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  214. package/app/.next/server/app/index.html +1 -1
  215. package/app/.next/server/app/index.rsc +2 -2
  216. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  217. package/app/.next/server/app/index.segments/_full.segment.rsc +2 -2
  218. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  219. package/app/.next/server/app/index.segments/_index.segment.rsc +2 -2
  220. package/app/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  221. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  222. package/app/.next/server/app/landing.html +1 -1
  223. package/app/.next/server/app/landing.rsc +2 -2
  224. package/app/.next/server/app/landing.segments/_full.segment.rsc +2 -2
  225. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  226. package/app/.next/server/app/landing.segments/_index.segment.rsc +2 -2
  227. package/app/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
  228. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  229. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  230. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  231. package/app/.next/server/app/login.html +1 -1
  232. package/app/.next/server/app/login.rsc +3 -3
  233. package/app/.next/server/app/login.segments/_full.segment.rsc +3 -3
  234. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  235. package/app/.next/server/app/login.segments/_index.segment.rsc +2 -2
  236. package/app/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  237. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  238. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  239. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  240. package/app/.next/server/app-paths-manifest.json +33 -33
  241. package/app/.next/server/chunks/3110.js +9 -5
  242. package/app/.next/server/chunks/412.js +1 -1
  243. package/app/.next/server/chunks/6186.js +4 -4
  244. package/app/.next/server/chunks/8694.js +1 -1
  245. package/app/.next/server/pages/404.html +1 -1
  246. package/app/.next/server/pages/500.html +2 -2
  247. package/app/.next/server/server-reference-manifest.js +1 -1
  248. package/app/.next/server/server-reference-manifest.json +1 -1
  249. package/app/.next/static/chunks/{5497-73d76264957574ca.js → 5497-9fb26dc0ebdf83cc.js} +2 -2
  250. package/app/.next/static/chunks/{8729-a400665e59674a47.js → 8729-26ca587447e2da6c.js} +1 -1
  251. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-8f7c6d4b94a4391b.js +1 -0
  252. package/app/.next/static/chunks/app/callback/page-ee4b675286e5ac54.js +1 -0
  253. package/app/package.json +1 -1
  254. package/app/src/mitm/dns/dnsConfig.js +13 -3
  255. package/app/src/mitm/manager.js +97 -63
  256. package/app/src/mitm/server.js +7 -0
  257. package/package.json +1 -1
  258. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-ccad74632e355e04.js +0 -1
  259. package/app/.next/static/chunks/app/callback/page-358b85864d879fcc.js +0 -1
  260. /package/app/.next/static/{BrLPf6yJlpsLD6WkIP0hO → WTsalv1ovvnjokmboNSkD}/_buildManifest.js +0 -0
  261. /package/app/.next/static/{BrLPf6yJlpsLD6WkIP0hO → WTsalv1ovvnjokmboNSkD}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8729],{13097:(e,i,a)=>{a.d(i,{KC:()=>m,Xg:()=>o,vq:()=>n});let n={cc:[{id:"claude-opus-4-6",name:"Claude Opus 4.6"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4-5-20251101",name:"Claude 4.5 Opus"},{id:"claude-sonnet-4-5-20250929",name:"Claude 4.5 Sonnet"},{id:"claude-haiku-4-5-20251001",name:"Claude 4.5 Haiku"}],cx:[{id:"gpt-5.3-codex",name:"GPT 5.3 Codex"},{id:"gpt-5.3-codex-xhigh",name:"GPT 5.3 Codex (xHigh)"},{id:"gpt-5.3-codex-high",name:"GPT 5.3 Codex (High)"},{id:"gpt-5.3-codex-low",name:"GPT 5.3 Codex (Low)"},{id:"gpt-5.3-codex-none",name:"GPT 5.3 Codex (None)"},{id:"gpt-5.3-codex-spark",name:"GPT 5.3 Codex Spark"},{id:"gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini"},{id:"gpt-5.1-codex-mini-high",name:"GPT 5.1 Codex Mini (High)"},{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"},{id:"gpt-5.2",name:"GPT 5.2"},{id:"gpt-5.1-codex-max",name:"GPT 5.1 Codex Max"},{id:"gpt-5.1-codex",name:"GPT 5.1 Codex"},{id:"gpt-5.1",name:"GPT 5.1"},{id:"gpt-5-codex",name:"GPT 5 Codex"},{id:"gpt-5-codex-mini",name:"GPT 5 Codex Mini"}],gc:[{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"}],qw:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash"},{id:"vision-model",name:"Qwen3 Vision Model"},{id:"coder-model",name:"Qwen3.5 Coder Model"}],if:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"kimi-k2",name:"Kimi K2"},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"deepseek-r1",name:"DeepSeek R1"},{id:"deepseek-v3.2-chat",name:"DeepSeek V3.2 Chat"},{id:"minimax-m2.1",name:"MiniMax M2.1"},{id:"minimax-m2.5",name:"MiniMax M2.5"},{id:"glm-4.7",name:"GLM 4.7"},{id:"glm-4.6",name:"GLM 4.6"},{id:"glm-5",name:"GLM 5"}],ag:[{id:"gemini-3.1-pro-high",name:"Gemini 3 Pro High"},{id:"gemini-3.1-pro-low",name:"Gemini 3 Pro Low"},{id:"gemini-3-flash",name:"Gemini 3 Flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium"}],gh:[{id:"gpt-3.5-turbo",name:"GPT-3.5 Turbo"},{id:"gpt-4",name:"GPT-4"},{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o mini"},{id:"gpt-4.1",name:"GPT-4.1"},{id:"gpt-5",name:"GPT-5"},{id:"gpt-5-mini",name:"GPT-5 Mini"},{id:"gpt-5-codex",name:"GPT-5 Codex"},{id:"gpt-5.1",name:"GPT-5.1"},{id:"gpt-5.1-codex",name:"GPT-5.1 Codex"},{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini"},{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max"},{id:"gpt-5.2",name:"GPT-5.2"},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex"},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5"},{id:"claude-opus-4.1",name:"Claude Opus 4.1"},{id:"claude-opus-4.5",name:"Claude Opus 4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4"},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5"},{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4.6",name:"Claude Opus 4.6"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro"},{id:"grok-code-fast-1",name:"Grok Code Fast 1"},{id:"oswe-vscode-prime",name:"Raptor Mini"}],kr:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5"}],cu:[{id:"default",name:"Auto (Server Picks)"},{id:"claude-4.5-opus-high-thinking",name:"Claude 4.5 Opus High Thinking"},{id:"claude-4.5-opus-high",name:"Claude 4.5 Opus High"},{id:"claude-4.5-sonnet-thinking",name:"Claude 4.5 Sonnet Thinking"},{id:"claude-4.5-sonnet",name:"Claude 4.5 Sonnet"},{id:"claude-4.5-haiku",name:"Claude 4.5 Haiku"},{id:"claude-4.5-opus",name:"Claude 4.5 Opus"},{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"}],kmc:[{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"kimi-k2.5-thinking",name:"Kimi K2.5 Thinking"},{id:"kimi-latest",name:"Kimi Latest"}],kc:[{id:"anthropic/claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"anthropic/claude-opus-4-20250514",name:"Claude Opus 4"},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"openai/gpt-4.1",name:"GPT-4.1"},{id:"openai/o3",name:"o3"},{id:"deepseek/deepseek-chat",name:"DeepSeek Chat"},{id:"deepseek/deepseek-reasoner",name:"DeepSeek Reasoner"}],cl:[{id:"anthropic/claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"anthropic/claude-opus-4-20250514",name:"Claude Opus 4"},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"openai/gpt-4.1",name:"GPT-4.1"},{id:"openai/o3",name:"o3"},{id:"deepseek/deepseek-chat",name:"DeepSeek Chat"}],openai:[{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o Mini"},{id:"gpt-4-turbo",name:"GPT-4 Turbo"},{id:"o1",name:"O1"},{id:"o1-mini",name:"O1 Mini"}],anthropic:[{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"claude-opus-4-20250514",name:"Claude Opus 4"},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet"}],gemini:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"},{id:"gemini-embedding-001",name:"Gemini Embedding 001",type:"embedding"},{id:"text-embedding-005",name:"Text Embedding 005",type:"embedding"},{id:"text-embedding-004",name:"Text Embedding 004 (Legacy)",type:"embedding"}],openrouter:[{id:"auto",name:"Auto (Best Available)"}],glm:[{id:"glm-5",name:"GLM 5"},{id:"glm-4.7",name:"GLM 4.7"},{id:"glm-4.6v",name:"GLM 4.6V (Vision)"}],"glm-cn":[{id:"glm-5",name:"GLM 5"},{id:"glm-4.7",name:"GLM-4.7"},{id:"glm-4.6",name:"GLM-4.6"},{id:"glm-4.5-air",name:"GLM-4.5-Air"}],kimi:[{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"kimi-k2.5-thinking",name:"Kimi K2.5 Thinking"},{id:"kimi-latest",name:"Kimi Latest"}],minimax:[{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"MiniMax-M2.1",name:"MiniMax M2.1"}],"minimax-cn":[{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"MiniMax-M2.1",name:"MiniMax M2.1"}],deepseek:[{id:"deepseek-chat",name:"DeepSeek V3.2 Chat"},{id:"deepseek-reasoner",name:"DeepSeek V3.2 Reasoner"}],groq:[{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B"},{id:"meta-llama/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick"},{id:"qwen/qwen3-32b",name:"Qwen3 32B"},{id:"openai/gpt-oss-120b",name:"GPT-OSS 120B"}],xai:[{id:"grok-4",name:"Grok 4"},{id:"grok-4-fast-reasoning",name:"Grok 4 Fast Reasoning"},{id:"grok-code-fast-1",name:"Grok Code Fast"},{id:"grok-3",name:"Grok 3"}],mistral:[{id:"mistral-large-latest",name:"Mistral Large 3"},{id:"codestral-latest",name:"Codestral"},{id:"mistral-medium-latest",name:"Mistral Medium 3"}],perplexity:[{id:"sonar-pro",name:"Sonar Pro"},{id:"sonar",name:"Sonar"}],together:[{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B Turbo"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"Qwen/Qwen3-235B-A22B",name:"Qwen3 235B"},{id:"meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",name:"Llama 4 Maverick"}],fireworks:[{id:"accounts/fireworks/models/deepseek-v3p1",name:"DeepSeek V3.1"},{id:"accounts/fireworks/models/llama-v3p3-70b-instruct",name:"Llama 3.3 70B"},{id:"accounts/fireworks/models/qwen3-235b-a22b",name:"Qwen3 235B"}],cerebras:[{id:"gpt-oss-120b",name:"GPT OSS 120B"},{id:"zai-glm-4.7",name:"ZAI GLM 4.7"},{id:"llama-3.3-70b",name:"Llama 3.3 70B"},{id:"llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout"},{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen3 235B A22B"},{id:"qwen-3-32b",name:"Qwen3 32B"}],cohere:[{id:"command-r-plus-08-2024",name:"Command R+ (Aug 2024)"},{id:"command-r-08-2024",name:"Command R (Aug 2024)"},{id:"command-a-03-2025",name:"Command A (Mar 2025)"}],nvidia:[{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5"},{id:"z-ai/glm4.7",name:"GLM 4.7"},{id:"deepseek-ai/deepseek-v3.2",name:"DeepSeek V3.2"},{id:"nvidia/llama-3.3-70b-instruct",name:"Llama 3.3 70B"},{id:"meta/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick"},{id:"deepseek/deepseek-r1",name:"DeepSeek R1"}],nebius:[{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B Instruct"}],siliconflow:[{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek V3.2"},{id:"deepseek-ai/DeepSeek-V3.1",name:"DeepSeek V3.1"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"Qwen/Qwen3-235B-A22B-Instruct-2507",name:"Qwen3 235B"},{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3 Coder 480B"},{id:"Qwen/Qwen3-32B",name:"Qwen3 32B"},{id:"moonshotai/Kimi-K2.5",name:"Kimi K2.5"},{id:"zai-org/GLM-4.7",name:"GLM 4.7"},{id:"openai/gpt-oss-120b",name:"GPT OSS 120B"},{id:"baidu/ERNIE-4.5-300B-A47B",name:"ERNIE 4.5 300B"}],hyperbolic:[{id:"Qwen/QwQ-32B",name:"QwQ 32B"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3"},{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B"},{id:"meta-llama/Llama-3.2-3B-Instruct",name:"Llama 3.2 3B"},{id:"Qwen/Qwen2.5-72B-Instruct",name:"Qwen 2.5 72B"},{id:"Qwen/Qwen2.5-Coder-32B-Instruct",name:"Qwen 2.5 Coder 32B"},{id:"NousResearch/Hermes-3-Llama-3.1-70B",name:"Hermes 3 70B"}]},o={claude:"cc",codex:"cx","gemini-cli":"gc",qwen:"qw",iflow:"if",antigravity:"ag",github:"gh",kiro:"kr",cursor:"cu","kimi-coding":"kmc",kilocode:"kc",cline:"cl",openai:"openai",anthropic:"anthropic",gemini:"gemini",openrouter:"openrouter",glm:"glm","glm-cn":"glm-cn",kimi:"kimi",minimax:"minimax","minimax-cn":"minimax-cn",deepseek:"deepseek",groq:"groq",xai:"xai",mistral:"mistral",perplexity:"perplexity",together:"together",fireworks:"fireworks",cerebras:"cerebras",cohere:"cohere",nvidia:"nvidia",nebius:"nebius",siliconflow:"siliconflow",hyperbolic:"hyperbolic"};function m(e){return n[o[e]||e]||[]}},21110:(e,i,a)=>{a.d(i,{ThemeProvider:()=>d});var n=a(95155),o=a(12115),m=a(90085);function d({children:e}){let{initTheme:i}=(0,m.A)();return(0,o.useEffect)(()=>{i()},[i]),(0,n.jsx)(n.Fragment,{children:e})}},28777:(e,i,a)=>{a.d(i,{KC:()=>n.KC,Xg:()=>n.Xg});var n=a(13097);Object.entries(a(52679).Q2).filter(([,e])=>e.passthroughModels).map(([e])=>e),Object.entries(n.vq).flatMap(([e,i])=>i.map(i=>({provider:e,model:i.id,name:i.name})))},52679:(e,i,a)=>{a.d(i,{DI:()=>t,IS:()=>n,JH:()=>d,MA:()=>c,Q2:()=>s,fg:()=>m,gb:()=>l,mq:()=>r,wG:()=>u,wb:()=>g,zN:()=>o,zt:()=>p});let n={iflow:{id:"iflow",alias:"if",name:"iFlow AI",icon:"water_drop",color:"#6366F1"},qwen:{id:"qwen",alias:"qw",name:"Qwen Code",icon:"psychology",color:"#10B981"},"gemini-cli":{id:"gemini-cli",alias:"gc",name:"Gemini CLI",icon:"terminal",color:"#4285F4"},kiro:{id:"kiro",alias:"kr",name:"Kiro AI",icon:"psychology_alt",color:"#FF6B35"}},o={claude:{id:"claude",alias:"cc",name:"Claude Code",icon:"smart_toy",color:"#D97757"},antigravity:{id:"antigravity",alias:"ag",name:"Antigravity",icon:"rocket_launch",color:"#F59E0B"},codex:{id:"codex",alias:"cx",name:"OpenAI Codex",icon:"code",color:"#3B82F6"},github:{id:"github",alias:"gh",name:"GitHub Copilot",icon:"code",color:"#333333"},cursor:{id:"cursor",alias:"cu",name:"Cursor IDE",icon:"edit_note",color:"#00D4AA"}},m={openrouter:{id:"openrouter",alias:"openrouter",name:"OpenRouter",icon:"router",color:"#F97316",textIcon:"OR",passthroughModels:!0,website:"https://openrouter.ai"},glm:{id:"glm",alias:"glm",name:"GLM Coding",icon:"code",color:"#2563EB",textIcon:"GL",website:"https://open.bigmodel.cn"},kimi:{id:"kimi",alias:"kimi",name:"Kimi",icon:"psychology",color:"#1E3A8A",textIcon:"KM",website:"https://kimi.moonshot.cn"},minimax:{id:"minimax",alias:"minimax",name:"Minimax Coding",icon:"memory",color:"#7C3AED",textIcon:"MM",website:"https://www.minimaxi.com"},"minimax-cn":{id:"minimax-cn",alias:"minimax-cn",name:"Minimax (China)",icon:"memory",color:"#DC2626",textIcon:"MC",website:"https://www.minimaxi.com"},openai:{id:"openai",alias:"openai",name:"OpenAI",icon:"auto_awesome",color:"#10A37F",textIcon:"OA",website:"https://platform.openai.com"},anthropic:{id:"anthropic",alias:"anthropic",name:"Anthropic",icon:"smart_toy",color:"#D97757",textIcon:"AN",website:"https://console.anthropic.com"},gemini:{id:"gemini",alias:"gemini",name:"Gemini",icon:"diamond",color:"#4285F4",textIcon:"GE",website:"https://ai.google.dev"},deepseek:{id:"deepseek",alias:"ds",name:"DeepSeek",icon:"bolt",color:"#4D6BFE",textIcon:"DS",website:"https://deepseek.com"},groq:{id:"groq",alias:"groq",name:"Groq",icon:"speed",color:"#F55036",textIcon:"GQ",website:"https://groq.com"},xai:{id:"xai",alias:"xai",name:"xAI (Grok)",icon:"auto_awesome",color:"#1DA1F2",textIcon:"XA",website:"https://x.ai"},mistral:{id:"mistral",alias:"mistral",name:"Mistral",icon:"air",color:"#FF7000",textIcon:"MI",website:"https://mistral.ai"},perplexity:{id:"perplexity",alias:"pplx",name:"Perplexity",icon:"search",color:"#20808D",textIcon:"PP",website:"https://www.perplexity.ai"},together:{id:"together",alias:"together",name:"Together AI",icon:"group_work",color:"#0F6FFF",textIcon:"TG",website:"https://www.together.ai"},fireworks:{id:"fireworks",alias:"fireworks",name:"Fireworks AI",icon:"local_fire_department",color:"#7B2EF2",textIcon:"FW",website:"https://fireworks.ai"},cerebras:{id:"cerebras",alias:"cerebras",name:"Cerebras",icon:"memory",color:"#FF4F00",textIcon:"CB",website:"https://www.cerebras.ai"},cohere:{id:"cohere",alias:"cohere",name:"Cohere",icon:"hub",color:"#39594D",textIcon:"CO",website:"https://cohere.com"},nvidia:{id:"nvidia",alias:"nvidia",name:"NVIDIA NIM",icon:"developer_board",color:"#76B900",textIcon:"NV",website:"https://developer.nvidia.com/nim"},nebius:{id:"nebius",alias:"nebius",name:"Nebius AI",icon:"cloud",color:"#6C5CE7",textIcon:"NB",website:"https://nebius.com"},siliconflow:{id:"siliconflow",alias:"siliconflow",name:"SiliconFlow",icon:"cloud_queue",color:"#5B6EF5",textIcon:"SF",website:"https://cloud.siliconflow.com"},hyperbolic:{id:"hyperbolic",alias:"hyp",name:"Hyperbolic",icon:"bolt",color:"#00D4FF",textIcon:"HY",website:"https://hyperbolic.xyz"},deepgram:{id:"deepgram",alias:"dg",name:"Deepgram",icon:"mic",color:"#13EF93",textIcon:"DG",website:"https://deepgram.com"},assemblyai:{id:"assemblyai",alias:"aai",name:"AssemblyAI",icon:"record_voice_over",color:"#0062FF",textIcon:"AA",website:"https://assemblyai.com"},nanobanana:{id:"nanobanana",alias:"nb",name:"NanoBanana",icon:"image",color:"#FFD700",textIcon:"NB",website:"https://nanobananaapi.ai"}},d="openai-compatible-",t="anthropic-compatible-";function r(e){return"string"==typeof e&&e.startsWith(d)}function l(e){return"string"==typeof e&&e.startsWith(t)}let s={...n,...o,...m},c={oauth:{id:"oauth",name:"OAuth",icon:"lock"},apikey:{id:"apikey",name:"API Key",icon:"key"}};function p(e){for(let i of Object.values(s))if(i.alias===e||i.id===e)return i;return null}function u(e){let i=s[e];return i?.alias||e}Object.values(s).reduce((e,i)=>(e[i.alias]=i.id,e),{}),Object.values(s).reduce((e,i)=>(e[i.id]=i.alias,e),{});let g=["antigravity","kiro","github","codex"]},90085:(e,i,a)=>{a.d(i,{A:()=>t});var n=a(1934),o=a(31692),m=a(90620);function d(e){let i=document.documentElement,a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"dark"===("system"===e?a:e)?i.classList.add("dark"):i.classList.remove("dark")}let t=(0,n.v)((0,o.Zr)((e,i)=>({theme:m.B2.defaultTheme,setTheme:i=>{e({theme:i}),d(i)},toggleTheme:()=>{let a="dark"===i().theme?"light":"dark";e({theme:a}),d(a)},initTheme:()=>{d(i().theme)}}),{name:m.B2.storageKey}))},90620:(e,i,a)=>{a.d(i,{Q2:()=>n.Q2,fg:()=>n.fg,vQ:()=>o,MA:()=>n.MA,zN:()=>n.zN,B2:()=>m});var n=a(52679);a(28777);let o={name:"Endpoint Proxy",description:"AI Infrastructure Management",version:"0.2.94"},m={storageKey:"theme",defaultTheme:"system"}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8729],{13097:(e,i,a)=>{a.d(i,{KC:()=>m,Xg:()=>o,vq:()=>n});let n={cc:[{id:"claude-opus-4-6",name:"Claude Opus 4.6"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4-5-20251101",name:"Claude 4.5 Opus"},{id:"claude-sonnet-4-5-20250929",name:"Claude 4.5 Sonnet"},{id:"claude-haiku-4-5-20251001",name:"Claude 4.5 Haiku"}],cx:[{id:"gpt-5.3-codex",name:"GPT 5.3 Codex"},{id:"gpt-5.3-codex-xhigh",name:"GPT 5.3 Codex (xHigh)"},{id:"gpt-5.3-codex-high",name:"GPT 5.3 Codex (High)"},{id:"gpt-5.3-codex-low",name:"GPT 5.3 Codex (Low)"},{id:"gpt-5.3-codex-none",name:"GPT 5.3 Codex (None)"},{id:"gpt-5.3-codex-spark",name:"GPT 5.3 Codex Spark"},{id:"gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini"},{id:"gpt-5.1-codex-mini-high",name:"GPT 5.1 Codex Mini (High)"},{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"},{id:"gpt-5.2",name:"GPT 5.2"},{id:"gpt-5.1-codex-max",name:"GPT 5.1 Codex Max"},{id:"gpt-5.1-codex",name:"GPT 5.1 Codex"},{id:"gpt-5.1",name:"GPT 5.1"},{id:"gpt-5-codex",name:"GPT 5 Codex"},{id:"gpt-5-codex-mini",name:"GPT 5 Codex Mini"}],gc:[{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"}],qw:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash"},{id:"vision-model",name:"Qwen3 Vision Model"},{id:"coder-model",name:"Qwen3.5 Coder Model"}],if:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"kimi-k2",name:"Kimi K2"},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"deepseek-r1",name:"DeepSeek R1"},{id:"deepseek-v3.2-chat",name:"DeepSeek V3.2 Chat"},{id:"minimax-m2.1",name:"MiniMax M2.1"},{id:"minimax-m2.5",name:"MiniMax M2.5"},{id:"glm-4.7",name:"GLM 4.7"},{id:"glm-4.6",name:"GLM 4.6"},{id:"glm-5",name:"GLM 5"}],ag:[{id:"gemini-3.1-pro-high",name:"Gemini 3 Pro High"},{id:"gemini-3.1-pro-low",name:"Gemini 3 Pro Low"},{id:"gemini-3-flash",name:"Gemini 3 Flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium"}],gh:[{id:"gpt-3.5-turbo",name:"GPT-3.5 Turbo"},{id:"gpt-4",name:"GPT-4"},{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o mini"},{id:"gpt-4.1",name:"GPT-4.1"},{id:"gpt-5",name:"GPT-5"},{id:"gpt-5-mini",name:"GPT-5 Mini"},{id:"gpt-5-codex",name:"GPT-5 Codex"},{id:"gpt-5.1",name:"GPT-5.1"},{id:"gpt-5.1-codex",name:"GPT-5.1 Codex"},{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini"},{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max"},{id:"gpt-5.2",name:"GPT-5.2"},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex"},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5"},{id:"claude-opus-4.1",name:"Claude Opus 4.1"},{id:"claude-opus-4.5",name:"Claude Opus 4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4"},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5"},{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4.6",name:"Claude Opus 4.6"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro"},{id:"grok-code-fast-1",name:"Grok Code Fast 1"},{id:"oswe-vscode-prime",name:"Raptor Mini"}],kr:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5"}],cu:[{id:"default",name:"Auto (Server Picks)"},{id:"claude-4.5-opus-high-thinking",name:"Claude 4.5 Opus High Thinking"},{id:"claude-4.5-opus-high",name:"Claude 4.5 Opus High"},{id:"claude-4.5-sonnet-thinking",name:"Claude 4.5 Sonnet Thinking"},{id:"claude-4.5-sonnet",name:"Claude 4.5 Sonnet"},{id:"claude-4.5-haiku",name:"Claude 4.5 Haiku"},{id:"claude-4.5-opus",name:"Claude 4.5 Opus"},{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"}],kmc:[{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"kimi-k2.5-thinking",name:"Kimi K2.5 Thinking"},{id:"kimi-latest",name:"Kimi Latest"}],kc:[{id:"anthropic/claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"anthropic/claude-opus-4-20250514",name:"Claude Opus 4"},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"openai/gpt-4.1",name:"GPT-4.1"},{id:"openai/o3",name:"o3"},{id:"deepseek/deepseek-chat",name:"DeepSeek Chat"},{id:"deepseek/deepseek-reasoner",name:"DeepSeek Reasoner"}],cl:[{id:"anthropic/claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"anthropic/claude-opus-4-20250514",name:"Claude Opus 4"},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"openai/gpt-4.1",name:"GPT-4.1"},{id:"openai/o3",name:"o3"},{id:"deepseek/deepseek-chat",name:"DeepSeek Chat"}],openai:[{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o Mini"},{id:"gpt-4-turbo",name:"GPT-4 Turbo"},{id:"o1",name:"O1"},{id:"o1-mini",name:"O1 Mini"}],anthropic:[{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"claude-opus-4-20250514",name:"Claude Opus 4"},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet"}],gemini:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"},{id:"gemini-embedding-001",name:"Gemini Embedding 001",type:"embedding"},{id:"text-embedding-005",name:"Text Embedding 005",type:"embedding"},{id:"text-embedding-004",name:"Text Embedding 004 (Legacy)",type:"embedding"}],openrouter:[{id:"auto",name:"Auto (Best Available)"}],glm:[{id:"glm-5",name:"GLM 5"},{id:"glm-4.7",name:"GLM 4.7"},{id:"glm-4.6v",name:"GLM 4.6V (Vision)"}],"glm-cn":[{id:"glm-5",name:"GLM 5"},{id:"glm-4.7",name:"GLM-4.7"},{id:"glm-4.6",name:"GLM-4.6"},{id:"glm-4.5-air",name:"GLM-4.5-Air"}],kimi:[{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"kimi-k2.5-thinking",name:"Kimi K2.5 Thinking"},{id:"kimi-latest",name:"Kimi Latest"}],minimax:[{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"MiniMax-M2.1",name:"MiniMax M2.1"}],"minimax-cn":[{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"MiniMax-M2.1",name:"MiniMax M2.1"}],deepseek:[{id:"deepseek-chat",name:"DeepSeek V3.2 Chat"},{id:"deepseek-reasoner",name:"DeepSeek V3.2 Reasoner"}],groq:[{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B"},{id:"meta-llama/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick"},{id:"qwen/qwen3-32b",name:"Qwen3 32B"},{id:"openai/gpt-oss-120b",name:"GPT-OSS 120B"}],xai:[{id:"grok-4",name:"Grok 4"},{id:"grok-4-fast-reasoning",name:"Grok 4 Fast Reasoning"},{id:"grok-code-fast-1",name:"Grok Code Fast"},{id:"grok-3",name:"Grok 3"}],mistral:[{id:"mistral-large-latest",name:"Mistral Large 3"},{id:"codestral-latest",name:"Codestral"},{id:"mistral-medium-latest",name:"Mistral Medium 3"}],perplexity:[{id:"sonar-pro",name:"Sonar Pro"},{id:"sonar",name:"Sonar"}],together:[{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B Turbo"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"Qwen/Qwen3-235B-A22B",name:"Qwen3 235B"},{id:"meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",name:"Llama 4 Maverick"}],fireworks:[{id:"accounts/fireworks/models/deepseek-v3p1",name:"DeepSeek V3.1"},{id:"accounts/fireworks/models/llama-v3p3-70b-instruct",name:"Llama 3.3 70B"},{id:"accounts/fireworks/models/qwen3-235b-a22b",name:"Qwen3 235B"}],cerebras:[{id:"gpt-oss-120b",name:"GPT OSS 120B"},{id:"zai-glm-4.7",name:"ZAI GLM 4.7"},{id:"llama-3.3-70b",name:"Llama 3.3 70B"},{id:"llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout"},{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen3 235B A22B"},{id:"qwen-3-32b",name:"Qwen3 32B"}],cohere:[{id:"command-r-plus-08-2024",name:"Command R+ (Aug 2024)"},{id:"command-r-08-2024",name:"Command R (Aug 2024)"},{id:"command-a-03-2025",name:"Command A (Mar 2025)"}],nvidia:[{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5"},{id:"z-ai/glm4.7",name:"GLM 4.7"},{id:"deepseek-ai/deepseek-v3.2",name:"DeepSeek V3.2"},{id:"nvidia/llama-3.3-70b-instruct",name:"Llama 3.3 70B"},{id:"meta/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick"},{id:"deepseek/deepseek-r1",name:"DeepSeek R1"}],nebius:[{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B Instruct"}],siliconflow:[{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek V3.2"},{id:"deepseek-ai/DeepSeek-V3.1",name:"DeepSeek V3.1"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"Qwen/Qwen3-235B-A22B-Instruct-2507",name:"Qwen3 235B"},{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3 Coder 480B"},{id:"Qwen/Qwen3-32B",name:"Qwen3 32B"},{id:"moonshotai/Kimi-K2.5",name:"Kimi K2.5"},{id:"zai-org/GLM-4.7",name:"GLM 4.7"},{id:"openai/gpt-oss-120b",name:"GPT OSS 120B"},{id:"baidu/ERNIE-4.5-300B-A47B",name:"ERNIE 4.5 300B"}],hyperbolic:[{id:"Qwen/QwQ-32B",name:"QwQ 32B"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3"},{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B"},{id:"meta-llama/Llama-3.2-3B-Instruct",name:"Llama 3.2 3B"},{id:"Qwen/Qwen2.5-72B-Instruct",name:"Qwen 2.5 72B"},{id:"Qwen/Qwen2.5-Coder-32B-Instruct",name:"Qwen 2.5 Coder 32B"},{id:"NousResearch/Hermes-3-Llama-3.1-70B",name:"Hermes 3 70B"}]},o={claude:"cc",codex:"cx","gemini-cli":"gc",qwen:"qw",iflow:"if",antigravity:"ag",github:"gh",kiro:"kr",cursor:"cu","kimi-coding":"kmc",kilocode:"kc",cline:"cl",openai:"openai",anthropic:"anthropic",gemini:"gemini",openrouter:"openrouter",glm:"glm","glm-cn":"glm-cn",kimi:"kimi",minimax:"minimax","minimax-cn":"minimax-cn",deepseek:"deepseek",groq:"groq",xai:"xai",mistral:"mistral",perplexity:"perplexity",together:"together",fireworks:"fireworks",cerebras:"cerebras",cohere:"cohere",nvidia:"nvidia",nebius:"nebius",siliconflow:"siliconflow",hyperbolic:"hyperbolic"};function m(e){return n[o[e]||e]||[]}},21110:(e,i,a)=>{a.d(i,{ThemeProvider:()=>d});var n=a(95155),o=a(12115),m=a(90085);function d({children:e}){let{initTheme:i}=(0,m.A)();return(0,o.useEffect)(()=>{i()},[i]),(0,n.jsx)(n.Fragment,{children:e})}},28777:(e,i,a)=>{a.d(i,{KC:()=>n.KC,Xg:()=>n.Xg});var n=a(13097);Object.entries(a(52679).Q2).filter(([,e])=>e.passthroughModels).map(([e])=>e),Object.entries(n.vq).flatMap(([e,i])=>i.map(i=>({provider:e,model:i.id,name:i.name})))},52679:(e,i,a)=>{a.d(i,{DI:()=>t,IS:()=>n,JH:()=>d,MA:()=>c,Q2:()=>s,fg:()=>m,gb:()=>l,mq:()=>r,wG:()=>u,wb:()=>g,zN:()=>o,zt:()=>p});let n={iflow:{id:"iflow",alias:"if",name:"iFlow AI",icon:"water_drop",color:"#6366F1"},qwen:{id:"qwen",alias:"qw",name:"Qwen Code",icon:"psychology",color:"#10B981"},"gemini-cli":{id:"gemini-cli",alias:"gc",name:"Gemini CLI",icon:"terminal",color:"#4285F4"},kiro:{id:"kiro",alias:"kr",name:"Kiro AI",icon:"psychology_alt",color:"#FF6B35"}},o={claude:{id:"claude",alias:"cc",name:"Claude Code",icon:"smart_toy",color:"#D97757"},antigravity:{id:"antigravity",alias:"ag",name:"Antigravity",icon:"rocket_launch",color:"#F59E0B"},codex:{id:"codex",alias:"cx",name:"OpenAI Codex",icon:"code",color:"#3B82F6"},github:{id:"github",alias:"gh",name:"GitHub Copilot",icon:"code",color:"#333333"},cursor:{id:"cursor",alias:"cu",name:"Cursor IDE",icon:"edit_note",color:"#00D4AA"}},m={openrouter:{id:"openrouter",alias:"openrouter",name:"OpenRouter",icon:"router",color:"#F97316",textIcon:"OR",passthroughModels:!0,website:"https://openrouter.ai"},glm:{id:"glm",alias:"glm",name:"GLM Coding",icon:"code",color:"#2563EB",textIcon:"GL",website:"https://open.bigmodel.cn"},kimi:{id:"kimi",alias:"kimi",name:"Kimi",icon:"psychology",color:"#1E3A8A",textIcon:"KM",website:"https://kimi.moonshot.cn"},minimax:{id:"minimax",alias:"minimax",name:"Minimax Coding",icon:"memory",color:"#7C3AED",textIcon:"MM",website:"https://www.minimaxi.com"},"minimax-cn":{id:"minimax-cn",alias:"minimax-cn",name:"Minimax (China)",icon:"memory",color:"#DC2626",textIcon:"MC",website:"https://www.minimaxi.com"},openai:{id:"openai",alias:"openai",name:"OpenAI",icon:"auto_awesome",color:"#10A37F",textIcon:"OA",website:"https://platform.openai.com"},anthropic:{id:"anthropic",alias:"anthropic",name:"Anthropic",icon:"smart_toy",color:"#D97757",textIcon:"AN",website:"https://console.anthropic.com"},gemini:{id:"gemini",alias:"gemini",name:"Gemini",icon:"diamond",color:"#4285F4",textIcon:"GE",website:"https://ai.google.dev"},deepseek:{id:"deepseek",alias:"ds",name:"DeepSeek",icon:"bolt",color:"#4D6BFE",textIcon:"DS",website:"https://deepseek.com"},groq:{id:"groq",alias:"groq",name:"Groq",icon:"speed",color:"#F55036",textIcon:"GQ",website:"https://groq.com"},xai:{id:"xai",alias:"xai",name:"xAI (Grok)",icon:"auto_awesome",color:"#1DA1F2",textIcon:"XA",website:"https://x.ai"},mistral:{id:"mistral",alias:"mistral",name:"Mistral",icon:"air",color:"#FF7000",textIcon:"MI",website:"https://mistral.ai"},perplexity:{id:"perplexity",alias:"pplx",name:"Perplexity",icon:"search",color:"#20808D",textIcon:"PP",website:"https://www.perplexity.ai"},together:{id:"together",alias:"together",name:"Together AI",icon:"group_work",color:"#0F6FFF",textIcon:"TG",website:"https://www.together.ai"},fireworks:{id:"fireworks",alias:"fireworks",name:"Fireworks AI",icon:"local_fire_department",color:"#7B2EF2",textIcon:"FW",website:"https://fireworks.ai"},cerebras:{id:"cerebras",alias:"cerebras",name:"Cerebras",icon:"memory",color:"#FF4F00",textIcon:"CB",website:"https://www.cerebras.ai"},cohere:{id:"cohere",alias:"cohere",name:"Cohere",icon:"hub",color:"#39594D",textIcon:"CO",website:"https://cohere.com"},nvidia:{id:"nvidia",alias:"nvidia",name:"NVIDIA NIM",icon:"developer_board",color:"#76B900",textIcon:"NV",website:"https://developer.nvidia.com/nim"},nebius:{id:"nebius",alias:"nebius",name:"Nebius AI",icon:"cloud",color:"#6C5CE7",textIcon:"NB",website:"https://nebius.com"},siliconflow:{id:"siliconflow",alias:"siliconflow",name:"SiliconFlow",icon:"cloud_queue",color:"#5B6EF5",textIcon:"SF",website:"https://cloud.siliconflow.com"},hyperbolic:{id:"hyperbolic",alias:"hyp",name:"Hyperbolic",icon:"bolt",color:"#00D4FF",textIcon:"HY",website:"https://hyperbolic.xyz"},deepgram:{id:"deepgram",alias:"dg",name:"Deepgram",icon:"mic",color:"#13EF93",textIcon:"DG",website:"https://deepgram.com"},assemblyai:{id:"assemblyai",alias:"aai",name:"AssemblyAI",icon:"record_voice_over",color:"#0062FF",textIcon:"AA",website:"https://assemblyai.com"},nanobanana:{id:"nanobanana",alias:"nb",name:"NanoBanana",icon:"image",color:"#FFD700",textIcon:"NB",website:"https://nanobananaapi.ai"}},d="openai-compatible-",t="anthropic-compatible-";function r(e){return"string"==typeof e&&e.startsWith(d)}function l(e){return"string"==typeof e&&e.startsWith(t)}let s={...n,...o,...m},c={oauth:{id:"oauth",name:"OAuth",icon:"lock"},apikey:{id:"apikey",name:"API Key",icon:"key"}};function p(e){for(let i of Object.values(s))if(i.alias===e||i.id===e)return i;return null}function u(e){let i=s[e];return i?.alias||e}Object.values(s).reduce((e,i)=>(e[i.alias]=i.id,e),{}),Object.values(s).reduce((e,i)=>(e[i.id]=i.alias,e),{});let g=["antigravity","kiro","github","codex"]},90085:(e,i,a)=>{a.d(i,{A:()=>t});var n=a(1934),o=a(31692),m=a(90620);function d(e){let i=document.documentElement,a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"dark"===("system"===e?a:e)?i.classList.add("dark"):i.classList.remove("dark")}let t=(0,n.v)((0,o.Zr)((e,i)=>({theme:m.B2.defaultTheme,setTheme:i=>{e({theme:i}),d(i)},toggleTheme:()=>{let a="dark"===i().theme?"light":"dark";e({theme:a}),d(a)},initTheme:()=>{d(i().theme)}}),{name:m.B2.storageKey}))},90620:(e,i,a)=>{a.d(i,{Q2:()=>n.Q2,fg:()=>n.fg,vQ:()=>o,MA:()=>n.MA,zN:()=>n.zN,B2:()=>m});var n=a(52679);a(28777);let o={name:"Endpoint Proxy",description:"AI Infrastructure Management",version:"0.2.96"},m={storageKey:"theme",defaultTheme:"system"}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{52397:(e,t,i)=>{Promise.resolve().then(i.bind(i,97162))},97162:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>h});var s=i(95155),a=i(12115),l=i(14051),r=i.n(l),n=i(73321),o=i(98500),d=i.n(o),c=i(5772),p=i(35497),m=i(52679),u=i(28777),x=i(11059);function h(){let e=(0,n.useParams)(),t=(0,n.useRouter)(),i=e.id,[l,r]=(0,a.useState)([]),[o,h]=(0,a.useState)(!0),[v,b]=(0,a.useState)(null),[w,k]=(0,a.useState)(!1),[S,$]=(0,a.useState)(!1),[T,O]=(0,a.useState)(!1),[E,R]=(0,a.useState)(!1),[I,q]=(0,a.useState)(null),[P,U]=(0,a.useState)({}),[K,D]=(0,a.useState)(!1),{copied:M,copy:L}=(0,x.C)(),_=v?{id:v.id,name:v.name||("anthropic-compatible"===v.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===v.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===v.type?"AC":"OC",apiType:v.apiType,baseUrl:v.baseUrl,type:v.type}:m.zN[i]||m.fg[i]||m.IS[i],F=!!m.zN[i]||!!m.IS[i],z=(0,u.KC)(i),J=(0,m.wG)(i),W=(0,m.mq)(i),V=(0,m.gb)(i),B=W||V,Z=B?i:J,G=B?v?.prefix||i:J,Q=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),H=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"})]),s=await e.json(),a=await t.json();if(e.ok){let e=(s.connections||[]).filter(e=>e.provider===i);r(e)}if(t.ok){let e=(a.nodes||[]).find(e=>e.id===i)||null;if(!e&&B)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===i)||null))break}b(e)}}catch(e){console.log("Error fetching connections:",e)}finally{h(!1)}},[i,B]),X=async e=>{try{let t=await fetch(`/api/provider-nodes/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(b(s.node),await H(),R(!1))}catch(e){console.log("Error updating provider node:",e)}};(0,a.useEffect)(()=>{H(),Q()},[H,Q]);let Y=async(e,t,i=J)=>{let s=`${i}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await Q();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},ee=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await Q()}catch(e){console.log("Error deleting alias:",e)}},et=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(l.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},ei=()=>{H(),k(!1)},es=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,...e})})).ok&&(await H(),$(!1))}catch(e){console.log("Error saving connection:",e)}},ea=async e=>{try{(await fetch(`/api/providers/${I.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await H(),O(!1))}catch(e){console.log("Error updating connection:",e)}},el=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&r(i=>i.map(i=>i.id===e?{...i,isActive:t}:i))}catch(e){console.log("Error updating connection status:",e)}},er=async(e,t)=>{if(e&&t)try{let i=t.priority,s=e.priority;i===s&&(i=l.indexOf(e)>l.indexOf(t)?t.priority-.5:t.priority+.5),await Promise.all([fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:i})}),fetch(`/api/providers/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:s})})]),await H()}catch(e){console.log("Error swapping priority:",e)}};return o?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(p.Qv,{}),(0,s.jsx)(p.Qv,{})]}):_?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${_.color}15`},children:K?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:_.color},children:_.textIcon||_.id.slice(0,2).toUpperCase()}):(0,s.jsx)(c.default,{src:W&&_.apiType?"responses"===_.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":V?"/providers/anthropic-m.png":`/providers/${_.id}.png`,alt:_.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>D(!0)})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:_.name}),(0,s.jsxs)("p",{className:"text-text-muted",children:[l.length," connection",1===l.length?"":"s"]})]})]})]}),B&&v&&(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:V?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:[V?"Messages API":"responses"===v.apiType?"Responses API":"Chat Completions"," \xb7 ",(v.baseUrl||"").replace(/\/$/,""),"/",V?"messages":"responses"===v.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>$(!0),disabled:l.length>0,children:"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>R(!0),children:"Edit"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${V?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${i}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),l.length>0&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),!B&&(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>F?k(!0):$(!0),children:"Add"})]}),0===l.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:F?"lock":"key"})}),(0,s.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!B&&(0,s.jsx)(p.$n,{icon:"add",onClick:()=>F?k(!0):$(!0),children:"Add Connection"})]}):(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:l.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,t)=>(0,s.jsx)(j,{connection:e,isOAuth:F,isFirst:0===t,isLast:t===l.length-1,onMoveUp:()=>er(e,l[t-1]),onMoveDown:()=>er(e,l[t+1]),onToggleActive:t=>el(e.id,t),onEdit:()=>{q(e),O(!0)},onDelete:()=>et(e.id)},e.id))})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:_.passthroughModels?"Model Aliases":"Available Models"}),B?(0,s.jsx)(g,{providerStorageAlias:Z,providerDisplayAlias:G,modelAliases:P,copied:M,onCopy:L,onSetAlias:Y,onDeleteAlias:ee,connections:l,isAnthropic:V}):_.passthroughModels?(0,s.jsx)(f,{providerAlias:J,modelAliases:P,copied:M,onCopy:L,onSetAlias:Y,onDeleteAlias:ee}):0===z.length?(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No models configured"}):(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:z.map(e=>{let t=`${Z}/${e.id}`,a=`${i}/${e.id}`,l=Object.entries(P).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(y,{model:e,fullModel:`${G}/${e.id}`,alias:l,copied:M,onCopy:L,onSetAlias:t=>Y(e.id,t,Z),onDeleteAlias:()=>ee(l)},e.id)})})]}),"kiro"===i?(0,s.jsx)(p.Mh,{isOpen:w,providerInfo:_,onSuccess:ei,onClose:()=>k(!1)}):"cursor"===i?(0,s.jsx)(p.G9,{isOpen:w,onSuccess:ei,onClose:()=>k(!1)}):(0,s.jsx)(p.LF,{isOpen:w,provider:i,providerInfo:_,onSuccess:ei,onClose:()=>k(!1)}),(0,s.jsx)(N,{isOpen:S,provider:i,providerName:_.name,isCompatible:B,isAnthropic:V,onSave:es,onClose:()=>$(!1)}),(0,s.jsx)(C,{isOpen:T,connection:I,onSave:ea,onClose:()=>O(!1)}),B&&(0,s.jsx)(A,{isOpen:E,node:v,onSave:X,onClose:()=>R(!1),isAnthropic:V})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,s.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function y({model:e,fullModel:t,alias:i,copied:a,onCopy:l}){return(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>l(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})})]})}function f({providerAlias:e,modelAliases:t,copied:i,onCopy:l,onSetAlias:r,onDeleteAlias:n}){let[o,d]=(0,a.useState)(""),[c,m]=(0,a.useState)(!1),u=Object.entries(t).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),x=async()=>{let e;if(!o.trim()||c)return;let i=o.trim(),s=(e=i.split("/"))[e.length-1];if(t[s])return void alert(`Alias "${s}" already exists. Please use a different model or edit existing alias.`);m(!0);try{await r(i,s),d("")}catch(e){console.log("Error adding model:",e)}finally{m(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{htmlFor:"new-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,s.jsx)("input",{id:"new-model-input",type:"text",value:o,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:x,disabled:!o.trim()||c,children:c?"Adding...":"Add"})]}),u.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:u.map(({modelId:e,fullModel:t,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:t,copied:i,onCopy:l,onDeleteAlias:()=>n(a)},t))})]})}function v({modelId:e,fullModel:t,copied:i,onCopy:a,onDeleteAlias:l}){return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e}`?"check":"content_copy"})})]})]}),(0,s.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function g({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:i,copied:l,onCopy:r,onSetAlias:n,onDeleteAlias:o,connections:d,isAnthropic:c}){let[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),g=Object.entries(i).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),b=e=>{let s,a=(s=e.split("/"))[s.length-1];if(!i[a])return a;let l=`${t}-${a}`;return i[l]?null:l},j=async()=>{if(!m.trim()||x)return;let t=m.trim(),i=b(t);if(!i)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await n(t,i,e),u("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},N=async()=>{if(y)return;let t=d.find(e=>!1!==e.isActive);if(t){f(!0);try{let i=await fetch(`/api/providers/${t.id}/models`),s=await i.json();if(!i.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let l=0;for(let t of a){let i=t.id||t.name||t.model;if(!i)continue;let s=b(i);s&&(await n(i,s,e),l+=1)}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{f(!1)}}},C=d.some(e=>!1!==e.isActive);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",c?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&j(),placeholder:c?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:j,disabled:!m.trim()||x,children:x?"Adding...":"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"download",onClick:N,disabled:!C||y,children:y?"Importing...":"Import from /models"})]}),!C&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),g.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:g.map(({modelId:e,fullModel:i,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:`${t}/${e}`,copied:l,onCopy:r,onDeleteAlias:()=>o(a)},i))})]})}function b({until:e}){let[t,i]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void i("");let s=Math.floor(t/1e3);if(s<60)i(`${s}s`);else if(s<3600)i(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);i(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function j({connection:e,isOAuth:t,isFirst:i,isLast:l,onMoveUp:r,onMoveDown:n,onToggleActive:o,onEdit:d,onDelete:c}){let m=t?e.name||e.email||e.displayName||"OAuth Account":e.name,[u,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=()=>{x(e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now())};t();let i=e.rateLimitedUntil?setInterval(t,1e3):null;return()=>{i&&clearInterval(i)}},[e.rateLimitedUntil]);let h="unavailable"!==e.testStatus||u?e.testStatus:"active";return(0,s.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:r,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:n,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:t?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:m}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,s.jsx)(p.Ex,{variant:!1===e.isActive?"default":"active"===h||"success"===h?"success":"error"===h||"expired"===h||"unavailable"===h?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":h||"Unknown"}),u&&!1!==e.isActive&&(0,s.jsx)(b,{until:e.rateLimitedUntil}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(p.lM,{size:"sm",checked:e.isActive??!0,onChange:o,title:e.isActive??!0?"Disable connection":"Enable connection"}),(0,s.jsxs)("div",{className:"flex gap-1 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,s.jsx)("button",{onClick:d,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,s.jsx)("button",{onClick:c,className:"p-2 hover:bg-red-500/10 rounded text-red-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})]})}function N({isOpen:e,provider:t,providerName:i,isCompatible:l,isAnthropic:r,onSave:n,onClose:o}){let[d,c]=(0,a.useState)({name:"",apiKey:"",priority:1}),[m,u]=(0,a.useState)(!1),[x,h]=(0,a.useState)(null),[y,f]=(0,a.useState)(!1),v=async()=>{u(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})}),i=await e.json();h(i.valid?"success":"failed")}catch{h("failed")}finally{u(!1)}},g=async()=>{if(t&&d.apiKey){f(!0);try{let e=!1;try{u(!0),h(null);let i=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})});e=!!(await i.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{u(!1)}await n({name:d.name,apiKey:d.apiKey,priority:d.priority,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Add ${i||t} API Key`,onClose:o,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:"Production Key"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:d.apiKey,onChange:e=>c({...d,apiKey:e.target.value}),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:v,disabled:!d.apiKey||m||y,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,s.jsx)(p.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),l&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:r?`Validation checks ${i||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${i||"OpenAI Compatible"} via /models on your base URL.`}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:d.priority,onChange:e=>c({...d,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:g,fullWidth:!0,disabled:!d.name||!d.apiKey||y,children:y?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function C({isOpen:e,connection:t,onSave:i,onClose:l}){let[r,n]=(0,a.useState)({name:"",priority:1,apiKey:""}),[o,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(null),[v,g]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(n({name:t.name||"",priority:t.priority||1,apiKey:""}),u(null),f(null))},[t]);let b=async()=>{if(t?.provider){d(!0),u(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),i=await e.json();u(i.valid?"success":"failed")}catch{u("failed")}finally{d(!1)}}},j=async()=>{if(t?.provider&&r.apiKey){h(!0),f(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:r.apiKey})}),i=await e.json();f(i.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}}},N=async()=>{g(!0);try{let e={name:r.name,priority:r.priority};if(!C&&r.apiKey){e.apiKey=r.apiKey;let i="success"===y;if(!i)try{h(!0),f(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:r.apiKey})});i=!!(await e.json()).valid,f(i?"success":"failed")}catch{f("failed")}finally{h(!1)}i&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}await i(e)}finally{g(!1)}};if(!t)return null;let C="oauth"===t.authType,A=(0,m.mq)(t.provider)||(0,m.gb)(t.provider);return(0,s.jsx)(p.aF,{isOpen:e,title:"Edit Connection",onClose:l,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:r.name,onChange:e=>n({...r,name:e.target.value}),placeholder:C?"Account name":"Production Key"}),C&&t.email&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,s.jsx)("p",{className:"font-medium",children:t.email})]}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:r.priority,onChange:e=>n({...r,priority:Number.parseInt(e.target.value)||1})}),!C&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:r.apiKey,onChange:e=>n({...r,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:j,disabled:!r.apiKey||x||v,variant:"secondary",children:x?"Checking...":"Check"})})]}),y&&(0,s.jsx)(p.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"})]}),!A&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(p.$n,{onClick:b,variant:"secondary",disabled:o,children:o?"Testing...":"Test Connection"}),c&&(0,s.jsx)(p.Ex,{variant:"success"===c?"success":"error",children:"success"===c?"Valid":"Failed"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:N,fullWidth:!0,disabled:v,children:v?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function A({isOpen:e,node:t,onSave:i,onClose:l,isAnthropic:r}){let[n,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){c(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await i(e)}finally{c(!1)}}},g=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:m,type:r?"anthropic-compatible":"openai-compatible"})}),t=await e.json();f(t.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,s.jsx)(p.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,s.jsx)(p.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,s.jsx)(p.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>u(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:g,disabled:!m||x||!n.baseUrl.trim(),variant:"secondary",children:x?"Checking...":"Check"})})]}),y&&(0,s.jsx)(p.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}y.propTypes={model:r().shape({id:r().string.isRequired}).isRequired,fullModel:r().string.isRequired,alias:r().string,copied:r().string,onCopy:r().func.isRequired},f.propTypes={providerAlias:r().string.isRequired,modelAliases:r().object.isRequired,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func.isRequired,onDeleteAlias:r().func.isRequired},v.propTypes={modelId:r().string.isRequired,fullModel:r().string.isRequired,copied:r().string,onCopy:r().func.isRequired,onDeleteAlias:r().func.isRequired},g.propTypes={providerStorageAlias:r().string.isRequired,providerDisplayAlias:r().string.isRequired,modelAliases:r().object.isRequired,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func.isRequired,onDeleteAlias:r().func.isRequired,connections:r().arrayOf(r().shape({id:r().string,isActive:r().bool})).isRequired,isAnthropic:r().bool},b.propTypes={until:r().string.isRequired},j.propTypes={connection:r().shape({id:r().string,name:r().string,email:r().string,displayName:r().string,rateLimitedUntil:r().string,testStatus:r().string,isActive:r().bool,lastError:r().string,priority:r().number,globalPriority:r().number}).isRequired,isOAuth:r().bool.isRequired,isFirst:r().bool.isRequired,isLast:r().bool.isRequired,onMoveUp:r().func.isRequired,onMoveDown:r().func.isRequired,onToggleActive:r().func.isRequired,onEdit:r().func.isRequired,onDelete:r().func.isRequired},N.propTypes={isOpen:r().bool.isRequired,provider:r().string,providerName:r().string,isCompatible:r().bool,isAnthropic:r().bool,onSave:r().func.isRequired,onClose:r().func.isRequired},C.propTypes={isOpen:r().bool.isRequired,connection:r().shape({id:r().string,name:r().string,email:r().string,priority:r().number,authType:r().string,provider:r().string}),onSave:r().func.isRequired,onClose:r().func.isRequired},A.propTypes={isOpen:r().bool.isRequired,node:r().shape({id:r().string,name:r().string,prefix:r().string,apiType:r().string,baseUrl:r().string}),onSave:r().func.isRequired,onClose:r().func.isRequired,isAnthropic:r().bool}}},e=>{e.O(0,[5370,4335,600,1672,8729,5497,8441,3794,7358],()=>e(e.s=52397)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7852],{23239:(e,s,t)=>{Promise.resolve().then(t.bind(t,59884))},59884:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>i});var a=t(95155),l=t(12115),r=t(73321);function n(){let e=(0,r.useSearchParams)(),[s,t]=(0,l.useState)("processing");return(0,l.useEffect)(()=>{let s=e.get("code"),a=e.get("state"),l=e.get("error"),r={code:s,state:a,error:l,errorDescription:e.get("error_description"),fullUrl:window.location.href};if(window.location.origin,window.opener)try{window.opener.postMessage({type:"oauth_callback",data:r},"*")}catch(e){console.log("postMessage failed:",e)}try{let e=new BroadcastChannel("oauth_callback");e.postMessage(r),e.close()}catch(e){console.log("BroadcastChannel failed:",e)}try{localStorage.setItem("oauth_callback",JSON.stringify({...r,timestamp:Date.now()}))}catch(e){console.log("localStorage failed:",e)}s||l?(t("success"),setTimeout(()=>{window.close(),setTimeout(()=>t("done"),500)},1500)):setTimeout(()=>t("manual"),0)},[e]),(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,a.jsxs)("div",{className:"text-center p-8 max-w-md",children:["processing"===s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:"Processing..."}),(0,a.jsx)("p",{className:"text-text-muted",children:"Please wait while we complete the authorization."})]}),("success"===s||"done"===s)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:"Authorization Successful!"}),(0,a.jsx)("p",{className:"text-text-muted",children:"success"===s?"This window will close automatically...":"You can close this tab now."})]}),"manual"===s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-yellow-100 dark:bg-yellow-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-yellow-600",children:"info"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:"Copy This URL"}),(0,a.jsx)("p",{className:"text-text-muted mb-4",children:"Please copy the URL from the address bar and paste it in the application."}),(0,a.jsx)("div",{className:"bg-surface border border-border rounded-lg p-3 text-left",children:(0,a.jsx)("code",{className:"text-xs break-all",children:window.location.href})})]})]})})}function i(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,a.jsxs)("div",{className:"text-center p-8",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("p",{className:"text-text-muted",children:"Loading..."})]})}),children:(0,a.jsx)(n,{})})}},73321:(e,s,t)=>{"use strict";var a=t(74645);t.o(a,"useParams")&&t.d(s,{useParams:function(){return a.useParams}}),t.o(a,"usePathname")&&t.d(s,{usePathname:function(){return a.usePathname}}),t.o(a,"useRouter")&&t.d(s,{useRouter:function(){return a.useRouter}}),t.o(a,"useSearchParams")&&t.d(s,{useSearchParams:function(){return a.useSearchParams}})}},e=>{e.O(0,[8441,3794,7358],()=>e(e.s=23239)),_N_E=e.O()}]);
package/app/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "9router-app",
3
- "version": "0.2.94",
3
+ "version": "0.2.96",
4
4
  "description": "9Router web dashboard",
5
5
  "private": true,
6
6
  "scripts": {
@@ -4,6 +4,7 @@ const path = require("path");
4
4
 
5
5
  const TARGET_HOST = "daily-cloudcode-pa.googleapis.com";
6
6
  const IS_WIN = process.platform === "win32";
7
+ const IS_MAC = process.platform === "darwin";
7
8
  const HOSTS_FILE = IS_WIN
8
9
  ? path.join(process.env.SystemRoot || "C:\\Windows", "System32", "drivers", "etc", "hosts")
9
10
  : "/etc/hosts";
@@ -81,8 +82,11 @@ async function addDNSEntry(sudoPassword) {
81
82
  // Flush DNS cache
82
83
  if (IS_WIN) {
83
84
  await execElevatedWindows("ipconfig /flushdns");
84
- } else {
85
+ } else if (IS_MAC) {
85
86
  await execWithPassword("dscacheutil -flushcache && killall -HUP mDNSResponder", sudoPassword);
87
+ } else {
88
+ // Linux: try systemd-resolved, fall back silently
89
+ await execWithPassword("resolvectl flush-caches 2>/dev/null || true", sudoPassword);
86
90
  }
87
91
  console.log(`✅ Added DNS entry: ${entry}`);
88
92
  } catch (error) {
@@ -112,13 +116,19 @@ async function removeDNSEntry(sudoPassword) {
112
116
  });
113
117
  });
114
118
  } else {
115
- await execWithPassword(`sed -i '' '/${TARGET_HOST}/d' ${HOSTS_FILE}`, sudoPassword);
119
+ // sed -i '' is macOS syntax; Linux uses sed -i without the empty string arg
120
+ const sedCmd = IS_MAC
121
+ ? `sed -i '' '/${TARGET_HOST}/d' ${HOSTS_FILE}`
122
+ : `sed -i '/${TARGET_HOST}/d' ${HOSTS_FILE}`;
123
+ await execWithPassword(sedCmd, sudoPassword);
116
124
  }
117
125
  // Flush DNS cache
118
126
  if (IS_WIN) {
119
127
  await execElevatedWindows("ipconfig /flushdns");
120
- } else {
128
+ } else if (IS_MAC) {
121
129
  await execWithPassword("dscacheutil -flushcache && killall -HUP mDNSResponder", sudoPassword);
130
+ } else {
131
+ await execWithPassword("resolvectl flush-caches 2>/dev/null || true", sudoPassword);
122
132
  }
123
133
  console.log(`✅ Removed DNS entry for ${TARGET_HOST}`);
124
134
  } catch (error) {
@@ -3,6 +3,7 @@ const path = require("path");
3
3
  const fs = require("fs");
4
4
  const os = require("os");
5
5
  const net = require("net");
6
+ const https = require("https");
6
7
  const crypto = require("crypto");
7
8
  const { addDNSEntry, removeDNSEntry, checkDNSEntry } = require("./dns/dnsConfig");
8
9
 
@@ -49,12 +50,14 @@ function getCachedPassword() { return globalThis.__mitmSudoPassword || null; }
49
50
  function setCachedPassword(pwd) { globalThis.__mitmSudoPassword = pwd; }
50
51
 
51
52
  // Check if a PID is alive
53
+ // EACCES = process exists but no permission (e.g. root process) → still alive
54
+ // ESRCH = process does not exist → dead
52
55
  function isProcessAlive(pid) {
53
56
  try {
54
57
  process.kill(pid, 0);
55
58
  return true;
56
- } catch {
57
- return false;
59
+ } catch (err) {
60
+ return err.code === "EACCES";
58
61
  }
59
62
  }
60
63
 
@@ -165,53 +168,36 @@ function checkPort443Free() {
165
168
  * Get PID and process name currently holding port 443
166
169
  * Returns { pid, name } or null if port is free / cannot determine
167
170
  */
168
- function getPort443Owner() {
171
+ function getPort443Owner(sudoPassword) {
169
172
  return new Promise((resolve) => {
170
- const cmd = IS_WIN
171
- ? `netstat -ano | findstr ":443 "`
172
- // Only match TCP processes actually LISTEN-ing on port 443 (not outbound UDP/QUIC)
173
- : `lsof -i TCP:${MITM_PORT} -n -P -sTCP:LISTEN`;
174
-
175
- exec(cmd, (err, stdout) => {
176
- if (err || !stdout.trim()) return resolve(null);
177
-
178
- let pid = null;
179
-
180
- if (IS_WIN) {
181
- // netstat line: " TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 1234"
173
+ if (IS_WIN) {
174
+ exec(`netstat -ano | findstr ":443 "`, (err, stdout) => {
175
+ if (err || !stdout.trim()) return resolve(null);
182
176
  for (const line of stdout.split("\n")) {
183
177
  const match = line.match(/LISTENING\s+(\d+)/i);
184
- if (match) { pid = parseInt(match[1], 10); break; }
178
+ if (match) {
179
+ const pid = parseInt(match[1], 10);
180
+ exec(`tasklist /FI "PID eq ${pid}" /FO CSV /NH`, (e2, out2) => {
181
+ const m = out2?.match(/"([^"]+)"/);
182
+ resolve({ pid, name: m ? m[1] : "unknown" });
183
+ });
184
+ return;
185
+ }
185
186
  }
186
- } else {
187
- // lsof line: "node 1234 user ..."
188
- for (const line of stdout.split("\n").slice(1)) {
187
+ resolve(null);
188
+ });
189
+ } else {
190
+ // Use ps to find node process running server.js (no sudo needed)
191
+ exec(`ps aux | grep "[s]erver.js"`, (err, stdout) => {
192
+ if (!stdout?.trim()) return resolve(null);
193
+ for (const line of stdout.split("\n")) {
189
194
  const parts = line.trim().split(/\s+/);
190
- if (parts.length >= 2) { pid = parseInt(parts[1], 10); break; }
195
+ const pid = parseInt(parts[1], 10);
196
+ if (!isNaN(pid)) return resolve({ pid, name: "node" });
191
197
  }
192
- }
193
-
194
- if (!pid || isNaN(pid)) return resolve(null);
195
-
196
- // Get process name by PID
197
- const nameCmd = IS_WIN
198
- ? `tasklist /FI "PID eq ${pid}" /FO CSV /NH`
199
- : `ps -p ${pid} -o comm=`;
200
-
201
- exec(nameCmd, (e2, out2) => {
202
- let name = "unknown";
203
- if (!e2 && out2.trim()) {
204
- if (IS_WIN) {
205
- // CSV: "node.exe","1234",...
206
- const m = out2.match(/"([^"]+)"/);
207
- if (m) name = m[1];
208
- } else {
209
- name = out2.trim();
210
- }
211
- }
212
- resolve({ pid, name });
198
+ resolve(null);
213
199
  });
214
- });
200
+ }
215
201
  });
216
202
  }
217
203
 
@@ -254,6 +240,37 @@ async function killLeftoverMitm(sudoPassword) {
254
240
  }
255
241
  }
256
242
 
243
+ /**
244
+ * Poll MITM health endpoint until server is up or timeout.
245
+ * Returns { ok, pid } on success, null on timeout.
246
+ */
247
+ function pollMitmHealth(timeoutMs) {
248
+ return new Promise((resolve) => {
249
+ const deadline = Date.now() + timeoutMs;
250
+ const check = () => {
251
+ const req = https.request(
252
+ { hostname: "127.0.0.1", port: 443, path: "/_mitm_health", method: "GET", rejectUnauthorized: false },
253
+ (res) => {
254
+ let body = "";
255
+ res.on("data", (d) => { body += d; });
256
+ res.on("end", () => {
257
+ try {
258
+ const json = JSON.parse(body);
259
+ resolve(json.ok === true ? { ok: true, pid: json.pid || null } : null);
260
+ } catch { resolve(null); }
261
+ });
262
+ }
263
+ );
264
+ req.on("error", () => {
265
+ if (Date.now() < deadline) setTimeout(check, 500);
266
+ else resolve(null);
267
+ });
268
+ req.end();
269
+ };
270
+ check();
271
+ });
272
+ }
273
+
257
274
  /**
258
275
  * Get MITM status
259
276
  */
@@ -319,19 +336,33 @@ async function startMitm(apiKey, sudoPassword) {
319
336
  await killLeftoverMitm(sudoPassword);
320
337
 
321
338
  // Check port 443 availability BEFORE modifying system
339
+ // "no-permission" = EACCES: port may be held by a root process, check via lsof/netstat
322
340
  const portStatus = await checkPort443Free();
323
- if (portStatus === "in-use") {
324
- const owner = await getPort443Owner();
325
- let ownerDesc = "another process";
326
- if (owner) {
341
+ if (portStatus === "in-use" || portStatus === "no-permission") {
342
+ const owner = await getPort443Owner(sudoPassword);
343
+ if (owner && owner.name === "node") {
344
+ // Orphan MITM node process — kill it and continue
345
+ console.log(`[MITM] Killing orphan node process on port 443 (PID ${owner.pid})...`);
346
+ try {
347
+ if (IS_WIN) {
348
+ await new Promise((resolve) => exec(`taskkill /F /PID ${owner.pid}`, resolve));
349
+ } else {
350
+ const { execWithPassword } = require("./dns/dnsConfig");
351
+ await execWithPassword(`kill -9 ${owner.pid}`, sudoPassword);
352
+ }
353
+ await new Promise(r => setTimeout(r, 800));
354
+ } catch {
355
+ // best effort — continue anyway
356
+ }
357
+ } else if (owner) {
327
358
  const shortName = owner.name.includes("/")
328
359
  ? owner.name.split("/").filter(Boolean).pop()
329
360
  : owner.name;
330
- ownerDesc = `"${shortName}" (PID ${owner.pid})`;
361
+ throw new Error(
362
+ `Port 443 is already in use by "${shortName}" (PID ${owner.pid}). Stop that process first, then retry.`
363
+ );
331
364
  }
332
- throw new Error(
333
- `Port 443 is already in use by ${ownerDesc}. Stop that process first, then retry.`
334
- );
365
+ // owner === null + no-permission → likely just needs sudo, proceed
335
366
  }
336
367
 
337
368
  // 1. Generate SSL certificate if not exists
@@ -358,12 +389,13 @@ async function startMitm(apiKey, sudoPassword) {
358
389
  console.log("Starting MITM server...");
359
390
 
360
391
  if (IS_WIN) {
361
- const nodePath = process.execPath;
362
- const envArgs = `$env:ROUTER_API_KEY='${apiKey}'; $env:NODE_ENV='production'; & '${nodePath}' '${SERVER_PATH}'`;
392
+ // Launch elevated node via PowerShell RunAs (triggers UAC prompt)
393
+ const nodePath = process.execPath.replace(/'/g, "''");
394
+ const serverPath = SERVER_PATH.replace(/'/g, "''");
363
395
  serverProcess = spawn("powershell", [
364
- "-Command",
365
- `Start-Process powershell -ArgumentList '-NoProfile','-Command','${envArgs.replace(/'/g, "''")}' -Verb RunAs -PassThru`
366
- ], { detached: false, stdio: ["ignore", "pipe", "pipe"] });
396
+ "-NoProfile", "-Command",
397
+ `$env:ROUTER_API_KEY='${apiKey}'; $env:NODE_ENV='production'; Start-Process '${nodePath}' -ArgumentList '''${serverPath}''' -Verb RunAs -WindowStyle Hidden`
398
+ ], { stdio: "ignore", env: process.env });
367
399
  } else {
368
400
  // sudo -S: read password from stdin, -E: preserve env vars
369
401
  // Pass ROUTER_API_KEY inline via env=... wrapper to avoid sudo stripping env
@@ -399,20 +431,22 @@ async function startMitm(apiKey, sudoPassword) {
399
431
  try { fs.unlinkSync(PID_FILE); } catch { /* ignore */ }
400
432
  });
401
433
 
402
- // Wait up to 8s sudo + Node startup takes longer than plain spawn
403
- const started = await new Promise((resolve) => {
404
- let resolved = false;
405
- const done = (val) => { if (!resolved) { resolved = true; resolve(val); } };
406
- const timeout = setTimeout(() => done(true), 8000);
407
- serverProcess.once("exit", () => { clearTimeout(timeout); done(false); });
408
- });
434
+ // Wait for server to be ready by polling health endpoint
435
+ const health = await pollMitmHealth(IS_WIN ? 12000 : 8000);
409
436
 
410
- if (!started) {
437
+ if (!health) {
438
+ if (IS_WIN) serverProcess = null;
411
439
  try { await removeDNSEntry(sudoPassword); } catch { /* best effort */ }
412
440
  const reason = startError || "Check sudo password or port 443 access.";
413
441
  throw new Error(`MITM server failed to start. ${reason}`);
414
442
  }
415
443
 
444
+ // On Windows, use real PID from health check (launcher exits immediately after UAC)
445
+ if (IS_WIN && health.pid) {
446
+ serverPid = health.pid;
447
+ fs.writeFileSync(PID_FILE, String(serverPid));
448
+ }
449
+
416
450
  await saveMitmSettings(true, sudoPassword);
417
451
  if (sudoPassword) setCachedPassword(sudoPassword);
418
452
 
@@ -173,6 +173,13 @@ async function intercept(req, res, bodyBuffer, mappedModel) {
173
173
  }
174
174
 
175
175
  const server = https.createServer(sslOptions, async (req, res) => {
176
+ // Health check endpoint for startup verification
177
+ if (req.url === "/_mitm_health") {
178
+ res.writeHead(200, { "Content-Type": "application/json" });
179
+ res.end(JSON.stringify({ ok: true, pid: process.pid }));
180
+ return;
181
+ }
182
+
176
183
  const bodyBuffer = await collectBodyRaw(req);
177
184
 
178
185
  // Save request log if enabled
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "9router",
3
- "version": "0.2.94",
3
+ "version": "0.2.96",
4
4
  "description": "9Router CLI - Start and manage 9Router server",
5
5
  "bin": {
6
6
  "9router": "./cli.js"
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{52397:(e,t,i)=>{Promise.resolve().then(i.bind(i,97162))},97162:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>h});var s=i(95155),a=i(12115),l=i(14051),r=i.n(l),n=i(73321),o=i(98500),d=i.n(o),c=i(5772),p=i(35497),m=i(52679),u=i(28777),x=i(11059);function h(){let e=(0,n.useParams)(),t=(0,n.useRouter)(),i=e.id,[l,r]=(0,a.useState)([]),[o,h]=(0,a.useState)(!0),[v,b]=(0,a.useState)(null),[A,k]=(0,a.useState)(!1);(0,a.useEffect)(()=>{try{let e=localStorage.getItem("oauth_pending_auth");if(e){let t=JSON.parse(e);t.provider===i&&Date.now()-t.timestamp<3e5&&k(!0)}}catch{}},[i]);let[S,$]=(0,a.useState)(!1),[T,O]=(0,a.useState)(!1),[E,R]=(0,a.useState)(!1),[I,q]=(0,a.useState)(null),[P,U]=(0,a.useState)({}),[K,D]=(0,a.useState)(!1),{copied:M,copy:_}=(0,x.C)(),L=v?{id:v.id,name:v.name||("anthropic-compatible"===v.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===v.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===v.type?"AC":"OC",apiType:v.apiType,baseUrl:v.baseUrl,type:v.type}:m.zN[i]||m.fg[i]||m.IS[i],F=!!m.zN[i]||!!m.IS[i],J=(0,u.KC)(i),z=(0,m.wG)(i),W=(0,m.mq)(i),V=(0,m.gb)(i),B=W||V,Z=B?i:z,G=B?v?.prefix||i:z,Q=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),H=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"})]),s=await e.json(),a=await t.json();if(e.ok){let e=(s.connections||[]).filter(e=>e.provider===i);r(e)}if(t.ok){let e=(a.nodes||[]).find(e=>e.id===i)||null;if(!e&&B)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===i)||null))break}b(e)}}catch(e){console.log("Error fetching connections:",e)}finally{h(!1)}},[i,B]),X=async e=>{try{let t=await fetch(`/api/provider-nodes/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(b(s.node),await H(),R(!1))}catch(e){console.log("Error updating provider node:",e)}};(0,a.useEffect)(()=>{H(),Q()},[H,Q]);let Y=async(e,t,i=z)=>{let s=`${i}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await Q();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},ee=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await Q()}catch(e){console.log("Error deleting alias:",e)}},et=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(l.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},ei=()=>{H(),k(!1)},es=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,...e})})).ok&&(await H(),$(!1))}catch(e){console.log("Error saving connection:",e)}},ea=async e=>{try{(await fetch(`/api/providers/${I.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await H(),O(!1))}catch(e){console.log("Error updating connection:",e)}},el=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&r(i=>i.map(i=>i.id===e?{...i,isActive:t}:i))}catch(e){console.log("Error updating connection status:",e)}},er=async(e,t)=>{if(e&&t)try{let i=t.priority,s=e.priority;i===s&&(i=l.indexOf(e)>l.indexOf(t)?t.priority-.5:t.priority+.5),await Promise.all([fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:i})}),fetch(`/api/providers/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:s})})]),await H()}catch(e){console.log("Error swapping priority:",e)}};return o?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(p.Qv,{}),(0,s.jsx)(p.Qv,{})]}):L?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${L.color}15`},children:K?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:L.color},children:L.textIcon||L.id.slice(0,2).toUpperCase()}):(0,s.jsx)(c.default,{src:W&&L.apiType?"responses"===L.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":V?"/providers/anthropic-m.png":`/providers/${L.id}.png`,alt:L.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>D(!0)})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:L.name}),(0,s.jsxs)("p",{className:"text-text-muted",children:[l.length," connection",1===l.length?"":"s"]})]})]})]}),B&&v&&(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:V?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:[V?"Messages API":"responses"===v.apiType?"Responses API":"Chat Completions"," \xb7 ",(v.baseUrl||"").replace(/\/$/,""),"/",V?"messages":"responses"===v.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>$(!0),disabled:l.length>0,children:"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>R(!0),children:"Edit"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${V?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${i}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),l.length>0&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),!B&&(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>F?k(!0):$(!0),children:"Add"})]}),0===l.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:F?"lock":"key"})}),(0,s.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!B&&(0,s.jsx)(p.$n,{icon:"add",onClick:()=>F?k(!0):$(!0),children:"Add Connection"})]}):(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:l.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,t)=>(0,s.jsx)(j,{connection:e,isOAuth:F,isFirst:0===t,isLast:t===l.length-1,onMoveUp:()=>er(e,l[t-1]),onMoveDown:()=>er(e,l[t+1]),onToggleActive:t=>el(e.id,t),onEdit:()=>{q(e),O(!0)},onDelete:()=>et(e.id)},e.id))})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:L.passthroughModels?"Model Aliases":"Available Models"}),B?(0,s.jsx)(g,{providerStorageAlias:Z,providerDisplayAlias:G,modelAliases:P,copied:M,onCopy:_,onSetAlias:Y,onDeleteAlias:ee,connections:l,isAnthropic:V}):L.passthroughModels?(0,s.jsx)(y,{providerAlias:z,modelAliases:P,copied:M,onCopy:_,onSetAlias:Y,onDeleteAlias:ee}):0===J.length?(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No models configured"}):(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:J.map(e=>{let t=`${Z}/${e.id}`,a=`${i}/${e.id}`,l=Object.entries(P).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(f,{model:e,fullModel:`${G}/${e.id}`,alias:l,copied:M,onCopy:_,onSetAlias:t=>Y(e.id,t,Z),onDeleteAlias:()=>ee(l)},e.id)})})]}),"kiro"===i?(0,s.jsx)(p.Mh,{isOpen:A,providerInfo:L,onSuccess:ei,onClose:()=>k(!1)}):"cursor"===i?(0,s.jsx)(p.G9,{isOpen:A,onSuccess:ei,onClose:()=>k(!1)}):(0,s.jsx)(p.LF,{isOpen:A,provider:i,providerInfo:L,onSuccess:ei,onClose:()=>k(!1)}),(0,s.jsx)(N,{isOpen:S,provider:i,providerName:L.name,isCompatible:B,isAnthropic:V,onSave:es,onClose:()=>$(!1)}),(0,s.jsx)(C,{isOpen:T,connection:I,onSave:ea,onClose:()=>O(!1)}),B&&(0,s.jsx)(w,{isOpen:E,node:v,onSave:X,onClose:()=>R(!1),isAnthropic:V})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,s.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function f({model:e,fullModel:t,alias:i,copied:a,onCopy:l}){return(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>l(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})})]})}function y({providerAlias:e,modelAliases:t,copied:i,onCopy:l,onSetAlias:r,onDeleteAlias:n}){let[o,d]=(0,a.useState)(""),[c,m]=(0,a.useState)(!1),u=Object.entries(t).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),x=async()=>{let e;if(!o.trim()||c)return;let i=o.trim(),s=(e=i.split("/"))[e.length-1];if(t[s])return void alert(`Alias "${s}" already exists. Please use a different model or edit existing alias.`);m(!0);try{await r(i,s),d("")}catch(e){console.log("Error adding model:",e)}finally{m(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{htmlFor:"new-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,s.jsx)("input",{id:"new-model-input",type:"text",value:o,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:x,disabled:!o.trim()||c,children:c?"Adding...":"Add"})]}),u.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:u.map(({modelId:e,fullModel:t,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:t,copied:i,onCopy:l,onDeleteAlias:()=>n(a)},t))})]})}function v({modelId:e,fullModel:t,copied:i,onCopy:a,onDeleteAlias:l}){return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e}`?"check":"content_copy"})})]})]}),(0,s.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function g({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:i,copied:l,onCopy:r,onSetAlias:n,onDeleteAlias:o,connections:d,isAnthropic:c}){let[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,y]=(0,a.useState)(!1),g=Object.entries(i).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),b=e=>{let s,a=(s=e.split("/"))[s.length-1];if(!i[a])return a;let l=`${t}-${a}`;return i[l]?null:l},j=async()=>{if(!m.trim()||x)return;let t=m.trim(),i=b(t);if(!i)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await n(t,i,e),u("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},N=async()=>{if(f)return;let t=d.find(e=>!1!==e.isActive);if(t){y(!0);try{let i=await fetch(`/api/providers/${t.id}/models`),s=await i.json();if(!i.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let l=0;for(let t of a){let i=t.id||t.name||t.model;if(!i)continue;let s=b(i);s&&(await n(i,s,e),l+=1)}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{y(!1)}}},C=d.some(e=>!1!==e.isActive);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",c?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&j(),placeholder:c?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:j,disabled:!m.trim()||x,children:x?"Adding...":"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"download",onClick:N,disabled:!C||f,children:f?"Importing...":"Import from /models"})]}),!C&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),g.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:g.map(({modelId:e,fullModel:i,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:`${t}/${e}`,copied:l,onCopy:r,onDeleteAlias:()=>o(a)},i))})]})}function b({until:e}){let[t,i]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void i("");let s=Math.floor(t/1e3);if(s<60)i(`${s}s`);else if(s<3600)i(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);i(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function j({connection:e,isOAuth:t,isFirst:i,isLast:l,onMoveUp:r,onMoveDown:n,onToggleActive:o,onEdit:d,onDelete:c}){let m=t?e.name||e.email||e.displayName||"OAuth Account":e.name,[u,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=()=>{x(e.rateLimitedUntil&&new Date(e.rateLimitedUntil).getTime()>Date.now())};t();let i=e.rateLimitedUntil?setInterval(t,1e3):null;return()=>{i&&clearInterval(i)}},[e.rateLimitedUntil]);let h="unavailable"!==e.testStatus||u?e.testStatus:"active";return(0,s.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:r,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:n,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:t?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:m}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,s.jsx)(p.Ex,{variant:!1===e.isActive?"default":"active"===h||"success"===h?"success":"error"===h||"expired"===h||"unavailable"===h?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":h||"Unknown"}),u&&!1!==e.isActive&&(0,s.jsx)(b,{until:e.rateLimitedUntil}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(p.lM,{size:"sm",checked:e.isActive??!0,onChange:o,title:e.isActive??!0?"Disable connection":"Enable connection"}),(0,s.jsxs)("div",{className:"flex gap-1 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,s.jsx)("button",{onClick:d,className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,s.jsx)("button",{onClick:c,className:"p-2 hover:bg-red-500/10 rounded text-red-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]})]})}function N({isOpen:e,provider:t,providerName:i,isCompatible:l,isAnthropic:r,onSave:n,onClose:o}){let[d,c]=(0,a.useState)({name:"",apiKey:"",priority:1}),[m,u]=(0,a.useState)(!1),[x,h]=(0,a.useState)(null),[f,y]=(0,a.useState)(!1),v=async()=>{u(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})}),i=await e.json();h(i.valid?"success":"failed")}catch{h("failed")}finally{u(!1)}},g=async()=>{if(t&&d.apiKey){y(!0);try{let e=!1;try{u(!0),h(null);let i=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:d.apiKey})});e=!!(await i.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{u(!1)}await n({name:d.name,apiKey:d.apiKey,priority:d.priority,testStatus:e?"active":"unknown"})}finally{y(!1)}}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Add ${i||t} API Key`,onClose:o,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:"Production Key"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:d.apiKey,onChange:e=>c({...d,apiKey:e.target.value}),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:v,disabled:!d.apiKey||m||f,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,s.jsx)(p.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),l&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:r?`Validation checks ${i||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${i||"OpenAI Compatible"} via /models on your base URL.`}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:d.priority,onChange:e=>c({...d,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:g,fullWidth:!0,disabled:!d.name||!d.apiKey||f,children:f?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function C({isOpen:e,connection:t,onSave:i,onClose:l}){let[r,n]=(0,a.useState)({name:"",priority:1,apiKey:""}),[o,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[f,y]=(0,a.useState)(null),[v,g]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(n({name:t.name||"",priority:t.priority||1,apiKey:""}),u(null),y(null))},[t]);let b=async()=>{if(t?.provider){d(!0),u(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),i=await e.json();u(i.valid?"success":"failed")}catch{u("failed")}finally{d(!1)}}},j=async()=>{if(t?.provider&&r.apiKey){h(!0),y(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:r.apiKey})}),i=await e.json();y(i.valid?"success":"failed")}catch{y("failed")}finally{h(!1)}}},N=async()=>{g(!0);try{let e={name:r.name,priority:r.priority};if(!C&&r.apiKey){e.apiKey=r.apiKey;let i="success"===f;if(!i)try{h(!0),y(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:r.apiKey})});i=!!(await e.json()).valid,y(i?"success":"failed")}catch{y("failed")}finally{h(!1)}i&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}await i(e)}finally{g(!1)}};if(!t)return null;let C="oauth"===t.authType,w=(0,m.mq)(t.provider)||(0,m.gb)(t.provider);return(0,s.jsx)(p.aF,{isOpen:e,title:"Edit Connection",onClose:l,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:r.name,onChange:e=>n({...r,name:e.target.value}),placeholder:C?"Account name":"Production Key"}),C&&t.email&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,s.jsx)("p",{className:"font-medium",children:t.email})]}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:r.priority,onChange:e=>n({...r,priority:Number.parseInt(e.target.value)||1})}),!C&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:r.apiKey,onChange:e=>n({...r,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:j,disabled:!r.apiKey||x||v,variant:"secondary",children:x?"Checking...":"Check"})})]}),f&&(0,s.jsx)(p.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"})]}),!w&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(p.$n,{onClick:b,variant:"secondary",disabled:o,children:o?"Testing...":"Test Connection"}),c&&(0,s.jsx)(p.Ex,{variant:"success"===c?"success":"error",children:"success"===c?"Valid":"Failed"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:N,fullWidth:!0,disabled:v,children:v?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function w({isOpen:e,node:t,onSave:i,onClose:l,isAnthropic:r}){let[n,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,y]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){c(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await i(e)}finally{c(!1)}}},g=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:m,type:r?"anthropic-compatible":"openai-compatible"})}),t=await e.json();y(t.valid?"success":"failed")}catch{y("failed")}finally{h(!1)}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,s.jsx)(p.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,s.jsx)(p.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,s.jsx)(p.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>u(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:g,disabled:!m||x||!n.baseUrl.trim(),variant:"secondary",children:x?"Checking...":"Check"})})]}),f&&(0,s.jsx)(p.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}f.propTypes={model:r().shape({id:r().string.isRequired}).isRequired,fullModel:r().string.isRequired,alias:r().string,copied:r().string,onCopy:r().func.isRequired},y.propTypes={providerAlias:r().string.isRequired,modelAliases:r().object.isRequired,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func.isRequired,onDeleteAlias:r().func.isRequired},v.propTypes={modelId:r().string.isRequired,fullModel:r().string.isRequired,copied:r().string,onCopy:r().func.isRequired,onDeleteAlias:r().func.isRequired},g.propTypes={providerStorageAlias:r().string.isRequired,providerDisplayAlias:r().string.isRequired,modelAliases:r().object.isRequired,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func.isRequired,onDeleteAlias:r().func.isRequired,connections:r().arrayOf(r().shape({id:r().string,isActive:r().bool})).isRequired,isAnthropic:r().bool},b.propTypes={until:r().string.isRequired},j.propTypes={connection:r().shape({id:r().string,name:r().string,email:r().string,displayName:r().string,rateLimitedUntil:r().string,testStatus:r().string,isActive:r().bool,lastError:r().string,priority:r().number,globalPriority:r().number}).isRequired,isOAuth:r().bool.isRequired,isFirst:r().bool.isRequired,isLast:r().bool.isRequired,onMoveUp:r().func.isRequired,onMoveDown:r().func.isRequired,onToggleActive:r().func.isRequired,onEdit:r().func.isRequired,onDelete:r().func.isRequired},N.propTypes={isOpen:r().bool.isRequired,provider:r().string,providerName:r().string,isCompatible:r().bool,isAnthropic:r().bool,onSave:r().func.isRequired,onClose:r().func.isRequired},C.propTypes={isOpen:r().bool.isRequired,connection:r().shape({id:r().string,name:r().string,email:r().string,priority:r().number,authType:r().string,provider:r().string}),onSave:r().func.isRequired,onClose:r().func.isRequired},w.propTypes={isOpen:r().bool.isRequired,node:r().shape({id:r().string,name:r().string,prefix:r().string,apiType:r().string,baseUrl:r().string}),onSave:r().func.isRequired,onClose:r().func.isRequired,isAnthropic:r().bool}}},e=>{e.O(0,[5370,4335,600,1672,8729,5497,8441,3794,7358],()=>e(e.s=52397)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7852],{23239:(e,t,s)=>{Promise.resolve().then(s.bind(s,59884))},59884:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var a=s(95155),r=s(12115),i=s(73321);let l="oauth_pending_auth";async function n(e,t){try{let s=localStorage.getItem(l);if(!s)return!1;let a=JSON.parse(s);if(Date.now()-a.timestamp>3e5)return localStorage.removeItem(l),!1;let r=await fetch(`/api/oauth/${a.provider}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:a.redirectUri,codeVerifier:a.codeVerifier,state:t})}),i=await r.json();return localStorage.removeItem(l),r.ok&&i.success}catch{return!1}}function c(){let e=(0,i.useSearchParams)(),[t,s]=(0,r.useState)("processing");return(0,r.useEffect)(()=>{let t=e.get("code"),a=e.get("state"),r=e.get("error"),i={code:t,state:a,error:r,errorDescription:e.get("error_description"),fullUrl:window.location.href};if(window.location.origin,window.opener)try{window.opener.postMessage({type:"oauth_callback",data:i},"*")}catch(e){console.log("postMessage failed:",e)}try{let e=new BroadcastChannel("oauth_callback");e.postMessage(i),e.close()}catch(e){console.log("BroadcastChannel failed:",e)}try{localStorage.setItem("oauth_callback",JSON.stringify({...i,timestamp:Date.now()}))}catch(e){console.log("localStorage failed:",e)}t||r?r?setTimeout(()=>{s("success"),setTimeout(()=>{window.close(),setTimeout(()=>s("done"),500)},1500)},0):(async()=>{if(localStorage.getItem(l)&&await n(t,a)){s("success"),setTimeout(()=>{window.close(),setTimeout(()=>s("done"),500)},1500);return}s("success"),setTimeout(()=>{window.close(),setTimeout(()=>s("done"),500)},1500)})():setTimeout(()=>s("manual"),0)},[e]),(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,a.jsxs)("div",{className:"text-center p-8 max-w-md",children:["processing"===t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:"Processing..."}),(0,a.jsx)("p",{className:"text-text-muted",children:"Please wait while we complete the authorization."})]}),("success"===t||"done"===t)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:"Authorization Successful!"}),(0,a.jsx)("p",{className:"text-text-muted",children:"success"===t?"This window will close automatically...":"You can close this tab now."})]}),"manual"===t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-yellow-100 dark:bg-yellow-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-yellow-600",children:"info"})}),(0,a.jsx)("h1",{className:"text-xl font-semibold mb-2",children:"Copy This URL"}),(0,a.jsx)("p",{className:"text-text-muted mb-4",children:"Please copy the URL from the address bar and paste it in the application."}),(0,a.jsx)("div",{className:"bg-surface border border-border rounded-lg p-3 text-left",children:(0,a.jsx)("code",{className:"text-xs break-all",children:window.location.href})})]})]})})}function o(){return(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg",children:(0,a.jsxs)("div",{className:"text-center p-8",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("p",{className:"text-text-muted",children:"Loading..."})]})}),children:(0,a.jsx)(c,{})})}},73321:(e,t,s)=>{"use strict";var a=s(74645);s.o(a,"useParams")&&s.d(t,{useParams:function(){return a.useParams}}),s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})}},e=>{e.O(0,[8441,3794,7358],()=>e(e.s=23239)),_N_E=e.O()}]);