9router 0.3.34 → 0.3.36

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 (309) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +40 -40
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  5. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/console-log/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/mitm/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/_global-error.html +2 -2
  20. package/app/.next/server/app/_global-error.rsc +1 -1
  21. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  22. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  23. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  24. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  25. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  26. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  27. package/app/.next/server/app/_not-found/page.js +2 -2
  28. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/_not-found.html +1 -1
  30. package/app/.next/server/app/_not-found.rsc +3 -3
  31. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  32. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  33. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  34. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  35. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  36. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  37. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  40. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.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/copilot-settings/route_client-reference-manifest.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_client-reference-manifest.js +1 -1
  46. package/app/.next/server/app/api/cli-tools/opencode-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/locale/route_client-reference-manifest.js +1 -1
  57. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  58. package/app/.next/server/app/api/models/route.js +1 -1
  59. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  60. package/app/.next/server/app/api/models/test/route_client-reference-manifest.js +1 -1
  61. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  63. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  64. package/app/.next/server/app/api/oauth/iflow/cookie/route_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  66. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  67. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  69. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/api/provider-nodes/route.js +1 -1
  72. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  73. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  75. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  78. package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
  79. package/app/.next/server/app/api/providers/[id]/test-models/route_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  81. package/app/.next/server/app/api/providers/route.js +1 -1
  82. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/providers/validate/route.js +1 -1
  85. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/api/settings/database/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/settings/proxy-test/route_client-reference-manifest.js +1 -1
  88. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  90. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  93. package/app/.next/server/app/api/translator/console-logs/route_client-reference-manifest.js +1 -1
  94. package/app/.next/server/app/api/translator/console-logs/stream/route.js +2 -2
  95. package/app/.next/server/app/api/translator/console-logs/stream/route_client-reference-manifest.js +1 -1
  96. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  97. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  98. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  99. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  100. package/app/.next/server/app/api/tunnel/disable/route_client-reference-manifest.js +1 -1
  101. package/app/.next/server/app/api/tunnel/enable/route_client-reference-manifest.js +1 -1
  102. package/app/.next/server/app/api/tunnel/status/route_client-reference-manifest.js +1 -1
  103. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  104. package/app/.next/server/app/api/usage/chart/route_client-reference-manifest.js +1 -1
  105. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  106. package/app/.next/server/app/api/usage/providers/route.js +1 -1
  107. package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -1
  108. package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -1
  109. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  110. package/app/.next/server/app/api/usage/stats/route_client-reference-manifest.js +1 -1
  111. package/app/.next/server/app/api/usage/stream/route_client-reference-manifest.js +1 -1
  112. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  113. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  114. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  116. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  117. package/app/.next/server/app/api/v1/models/route.js +1 -1
  118. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  119. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  120. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  121. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  122. package/app/.next/server/app/api/v1beta/models/route.js +1 -1
  123. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  124. package/app/.next/server/app/api/version/route.js +1 -1
  125. package/app/.next/server/app/api/version/route_client-reference-manifest.js +1 -1
  126. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  127. package/app/.next/server/app/callback.html +1 -1
  128. package/app/.next/server/app/callback.rsc +3 -3
  129. package/app/.next/server/app/callback.segments/_full.segment.rsc +3 -3
  130. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  131. package/app/.next/server/app/callback.segments/_index.segment.rsc +3 -3
  132. package/app/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
  133. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  134. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  135. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  136. package/app/.next/server/app/dashboard/cli-tools.rsc +5 -5
  137. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  138. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  139. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  140. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  141. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  142. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  143. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
  144. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  145. package/app/.next/server/app/dashboard/combos.html +1 -1
  146. package/app/.next/server/app/dashboard/combos.rsc +5 -5
  147. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  148. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  149. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  150. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  151. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  152. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  153. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
  154. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  155. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  156. package/app/.next/server/app/dashboard/endpoint.rsc +5 -5
  157. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  158. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  159. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  160. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  161. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  162. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  163. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
  164. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  165. package/app/.next/server/app/dashboard/mitm.html +1 -1
  166. package/app/.next/server/app/dashboard/mitm.rsc +5 -5
  167. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  168. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  169. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  170. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  171. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  172. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  173. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
  174. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  175. package/app/.next/server/app/dashboard/profile.html +1 -1
  176. package/app/.next/server/app/dashboard/profile.rsc +5 -5
  177. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  178. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  179. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  180. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  181. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  182. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  183. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
  184. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  185. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  186. package/app/.next/server/app/dashboard/providers/new.rsc +5 -5
  187. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  188. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  189. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  190. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  191. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  192. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  193. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  194. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
  195. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  196. package/app/.next/server/app/dashboard/providers.html +1 -1
  197. package/app/.next/server/app/dashboard/providers.rsc +5 -5
  198. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  199. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  200. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  201. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  202. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  203. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  204. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
  205. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  206. package/app/.next/server/app/dashboard/quota.html +2 -2
  207. package/app/.next/server/app/dashboard/quota.rsc +6 -6
  208. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  209. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  210. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  211. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  212. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
  213. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  214. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
  215. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  216. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  217. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  218. package/app/.next/server/app/dashboard/settings/pricing.rsc +3 -3
  219. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  220. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  221. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  222. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  223. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  224. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  225. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  226. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  227. package/app/.next/server/app/dashboard/translator.html +1 -1
  228. package/app/.next/server/app/dashboard/translator.rsc +5 -5
  229. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  230. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  231. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  232. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  233. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  234. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  235. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
  236. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  237. package/app/.next/server/app/dashboard/usage.html +1 -1
  238. package/app/.next/server/app/dashboard/usage.rsc +5 -5
  239. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  240. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  241. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  242. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  243. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  244. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  245. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
  246. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  247. package/app/.next/server/app/dashboard.html +1 -1
  248. package/app/.next/server/app/dashboard.rsc +5 -5
  249. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  250. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  251. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  252. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +5 -5
  253. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  254. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +3 -3
  255. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  256. package/app/.next/server/app/index.html +1 -1
  257. package/app/.next/server/app/index.rsc +3 -3
  258. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  259. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  260. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  261. package/app/.next/server/app/index.segments/_index.segment.rsc +3 -3
  262. package/app/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  263. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  264. package/app/.next/server/app/landing.html +1 -1
  265. package/app/.next/server/app/landing.rsc +3 -3
  266. package/app/.next/server/app/landing.segments/_full.segment.rsc +3 -3
  267. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  268. package/app/.next/server/app/landing.segments/_index.segment.rsc +3 -3
  269. package/app/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
  270. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  271. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  272. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  273. package/app/.next/server/app/login.html +1 -1
  274. package/app/.next/server/app/login.rsc +4 -4
  275. package/app/.next/server/app/login.segments/_full.segment.rsc +4 -4
  276. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  277. package/app/.next/server/app/login.segments/_index.segment.rsc +3 -3
  278. package/app/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  279. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  280. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  281. package/app/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  282. package/app/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  283. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  284. package/app/.next/server/app-paths-manifest.json +40 -40
  285. package/app/.next/server/chunks/1114.js +1 -1
  286. package/app/.next/server/chunks/1424.js +1 -1
  287. package/app/.next/server/chunks/2470.js +1 -1
  288. package/app/.next/server/chunks/3832.js +1 -1
  289. package/app/.next/server/chunks/6182.js +15 -17
  290. package/app/.next/server/chunks/8590.js +1 -1
  291. package/app/.next/server/chunks/8756.js +1 -1
  292. package/app/.next/server/pages/404.html +1 -1
  293. package/app/.next/server/pages/500.html +2 -2
  294. package/app/.next/server/server-reference-manifest.js +1 -1
  295. package/app/.next/server/server-reference-manifest.json +1 -1
  296. package/app/.next/static/chunks/4495-5f28825e29580b91.js +1 -0
  297. package/app/.next/static/chunks/{5497-a182d950887a90ed.js → 5497-a43d75d1afb1f91a.js} +1 -1
  298. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7c4f62f603a4588b.js +1 -0
  299. package/app/.next/static/chunks/app/{layout-e2ea1fe43c8d1853.js → layout-4a9c8a66079c83c4.js} +1 -1
  300. package/app/package.json +1 -1
  301. package/app/public/providers/alicode-intl.png +0 -0
  302. package/app/public/providers/alicode.png +0 -0
  303. package/app/src/mitm/dns/dnsConfig.js +99 -26
  304. package/app/src/mitm/manager.js +31 -84
  305. package/package.json +1 -1
  306. package/app/.next/static/chunks/4495-97a066cea645caef.js +0 -1
  307. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-d3eea801999e8eaf.js +0 -1
  308. /package/app/.next/static/{sxWcLJ3M3jKWxLlhk7_mc → igH2LgfvcCMEfi5vabbj9}/_buildManifest.js +0 -0
  309. /package/app/.next/static/{sxWcLJ3M3jKWxLlhk7_mc → igH2LgfvcCMEfi5vabbj9}/_ssgManifest.js +0 -0
@@ -15,6 +15,47 @@ const HOSTS_FILE = IS_WIN
15
15
  ? path.join(process.env.SystemRoot || "C:\\Windows", "System32", "drivers", "etc", "hosts")
16
16
  : "/etc/hosts";
17
17
 
18
+ /**
19
+ * Execute elevated PowerShell script on Windows via Start-Process -Verb RunAs.
20
+ * Only UAC consent dialog appears, no CMD/PS window popup.
21
+ */
22
+ function executeElevatedPowerShell(psScriptPath, timeoutMs = 30000) {
23
+ const flagFile = path.join(os.tmpdir(), `ps_done_${Date.now()}.flag`);
24
+ const psSQ = (s) => s.replace(/'/g, "''");
25
+
26
+ let psContent = fs.readFileSync(psScriptPath, "utf8");
27
+ psContent += `\nSet-Content -Path '${psSQ(flagFile)}' -Value 'done' -Encoding UTF8\n`;
28
+ fs.writeFileSync(psScriptPath, psContent, "utf8");
29
+
30
+ const outerCmd = `Start-Process powershell -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-WindowStyle','Hidden','-File','${psSQ(psScriptPath)}' -Verb RunAs -WindowStyle Hidden`;
31
+
32
+ return new Promise((resolve, reject) => {
33
+ let settled = false;
34
+ const settle = (fn, arg) => { if (!settled) { settled = true; fn(arg); } };
35
+
36
+ exec(
37
+ `powershell -NoProfile -NonInteractive -WindowStyle Hidden -Command "${outerCmd}"`,
38
+ { windowsHide: true },
39
+ () => {}
40
+ );
41
+
42
+ const deadline = Date.now() + timeoutMs;
43
+ const poll = () => {
44
+ if (settled) return;
45
+ if (fs.existsSync(flagFile)) {
46
+ try { fs.unlinkSync(flagFile); fs.unlinkSync(psScriptPath); } catch { /* ignore */ }
47
+ return settle(resolve);
48
+ }
49
+ if (Date.now() > deadline) {
50
+ try { fs.unlinkSync(psScriptPath); } catch { /* ignore */ }
51
+ return settle(reject, new Error("Timed out waiting for UAC confirmation"));
52
+ }
53
+ setTimeout(poll, 500);
54
+ };
55
+ setTimeout(poll, 300);
56
+ });
57
+ }
58
+
18
59
  /**
19
60
  * Execute command with sudo password via stdin (macOS/Linux only)
20
61
  */
@@ -99,18 +140,37 @@ async function addDNSEntry(tool, sudoPassword) {
99
140
  try {
100
141
  if (IS_WIN) {
101
142
  const hostsPath = HOSTS_FILE.replace(/'/g, "''");
102
- const addLines = entriesToAdd.map(h =>
103
- `$hc = Get-Content -Path '${hostsPath}' -Raw -ErrorAction SilentlyContinue; if ($hc -notmatch '${h}') { Add-Content -Path '${hostsPath}' -Value '127.0.0.1 ${h}' -Encoding UTF8 }`
104
- ).join("; ");
105
- const psScript = `${addLines}; ipconfig /flushdns | Out-Null`;
106
- await new Promise((resolve, reject) => {
107
- const escaped = psScript.replace(/"/g, '\\"');
108
- exec(
109
- `powershell -NonInteractive -WindowStyle Hidden -Command "Start-Process powershell -ArgumentList '-NonInteractive -WindowStyle Hidden -Command \\"${escaped}\\"' -Verb RunAs -Wait"`,
110
- { windowsHide: true },
111
- (error) => { if (error) reject(new Error(`Failed to add DNS: ${error.message}`)); else resolve(); }
112
- );
113
- });
143
+
144
+ // Build PowerShell script with proper error handling
145
+ const scriptLines = [];
146
+ scriptLines.push(`$ErrorActionPreference = 'Stop'`);
147
+ scriptLines.push(`$hostsPath = '${hostsPath}'`);
148
+ scriptLines.push(`try {`);
149
+ scriptLines.push(` $hostsContent = Get-Content -Path $hostsPath -Raw -ErrorAction SilentlyContinue`);
150
+ scriptLines.push(` if (-not $hostsContent) { $hostsContent = '' }`);
151
+
152
+ for (const host of entriesToAdd) {
153
+ // Escape special regex chars in hostname
154
+ const escapedHost = host.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
155
+ scriptLines.push(` if ($hostsContent -notmatch '${escapedHost}') {`);
156
+ scriptLines.push(` Add-Content -Path $hostsPath -Value '127.0.0.1 ${host}' -Encoding UTF8 -ErrorAction Stop`);
157
+ scriptLines.push(` Write-Host "Added DNS entry: ${host}"`);
158
+ scriptLines.push(` } else {`);
159
+ scriptLines.push(` Write-Host "DNS entry already exists: ${host}"`);
160
+ scriptLines.push(` }`);
161
+ }
162
+
163
+ scriptLines.push(` ipconfig /flushdns | Out-Null`);
164
+ scriptLines.push(`} catch {`);
165
+ scriptLines.push(` Write-Error "Failed to add DNS: $_"`);
166
+ scriptLines.push(` exit 1`);
167
+ scriptLines.push(`}`);
168
+
169
+ const psScript = scriptLines.join("\n");
170
+ const tmpPs1 = path.join(os.tmpdir(), `mitm_dns_add_${Date.now()}.ps1`);
171
+ fs.writeFileSync(tmpPs1, psScript, "utf8");
172
+
173
+ await executeElevatedPowerShell(tmpPs1, 30000);
114
174
  } else {
115
175
  await execWithPassword(`echo "${entries}" >> ${HOSTS_FILE}`, sudoPassword);
116
176
  await flushDNS(sudoPassword);
@@ -139,23 +199,35 @@ async function removeDNSEntry(tool, sudoPassword) {
139
199
  if (IS_WIN) {
140
200
  const content = fs.readFileSync(HOSTS_FILE, "utf8");
141
201
  const filtered = content.split(/\r?\n/).filter(l => !entriesToRemove.some(h => l.includes(h))).join("\r\n");
142
- const tmpFile = path.join(os.tmpdir(), "hosts_filtered.tmp");
202
+ const tmpFile = path.join(os.tmpdir(), `hosts_filtered_${Date.now()}.tmp`);
143
203
  fs.writeFileSync(tmpFile, filtered, "utf8");
204
+
144
205
  const tmpEsc = tmpFile.replace(/'/g, "''");
145
206
  const hostsEsc = HOSTS_FILE.replace(/'/g, "''");
146
- const psScript = `Copy-Item -Path '${tmpEsc}' -Destination '${hostsEsc}' -Force; ipconfig /flushdns | Out-Null; Remove-Item '${tmpEsc}' -ErrorAction SilentlyContinue`;
147
- await new Promise((resolve, reject) => {
148
- const escaped = psScript.replace(/"/g, '\\"');
149
- exec(
150
- `powershell -NonInteractive -WindowStyle Hidden -Command "Start-Process powershell -ArgumentList '-NonInteractive -WindowStyle Hidden -Command \\"${escaped}\\"' -Verb RunAs -Wait"`,
151
- { windowsHide: true },
152
- (error) => {
153
- try { fs.unlinkSync(tmpFile); } catch { /* ignore */ }
154
- if (error) reject(new Error(`Failed to remove DNS: ${error.message}`));
155
- else resolve();
156
- }
157
- );
158
- });
207
+
208
+ // Build PowerShell script with proper error handling
209
+ const scriptLines = [];
210
+ scriptLines.push(`$ErrorActionPreference = 'Stop'`);
211
+ scriptLines.push(`try {`);
212
+ scriptLines.push(` Copy-Item -Path '${tmpEsc}' -Destination '${hostsEsc}' -Force -ErrorAction Stop`);
213
+ scriptLines.push(` Write-Host "Hosts file updated successfully"`);
214
+ scriptLines.push(` ipconfig /flushdns | Out-Null`);
215
+ scriptLines.push(` Write-Host "DNS cache flushed"`);
216
+ scriptLines.push(` Remove-Item '${tmpEsc}' -ErrorAction SilentlyContinue`);
217
+ scriptLines.push(`} catch {`);
218
+ scriptLines.push(` Write-Error "Failed to remove DNS: $_"`);
219
+ scriptLines.push(` Remove-Item '${tmpEsc}' -ErrorAction SilentlyContinue`);
220
+ scriptLines.push(` exit 1`);
221
+ scriptLines.push(`}`);
222
+
223
+ const psScript = scriptLines.join("\n");
224
+ const tmpPs1 = path.join(os.tmpdir(), `mitm_dns_remove_${Date.now()}.ps1`);
225
+ fs.writeFileSync(tmpPs1, psScript, "utf8");
226
+
227
+ await executeElevatedPowerShell(tmpPs1, 30000);
228
+
229
+ // Cleanup temp file if still exists
230
+ try { fs.unlinkSync(tmpFile); } catch { /* ignore */ }
159
231
  } else {
160
232
  for (const host of entriesToRemove) {
161
233
  const sedCmd = IS_MAC
@@ -191,6 +263,7 @@ module.exports = {
191
263
  removeDNSEntry,
192
264
  removeAllDNSEntries,
193
265
  execWithPassword,
266
+ executeElevatedPowerShell,
194
267
  checkDNSEntry,
195
268
  checkAllDNSStatus,
196
269
  };
@@ -5,7 +5,7 @@ const os = require("os");
5
5
  const net = require("net");
6
6
  const https = require("https");
7
7
  const crypto = require("crypto");
8
- const { addDNSEntry, removeDNSEntry, removeAllDNSEntries, checkAllDNSStatus } = require("./dns/dnsConfig");
8
+ const { addDNSEntry, removeDNSEntry, removeAllDNSEntries, checkAllDNSStatus, executeElevatedPowerShell, TOOL_HOSTS } = require("./dns/dnsConfig");
9
9
 
10
10
  const IS_WIN = process.platform === "win32";
11
11
  const { generateCert } = require("./cert/generate");
@@ -345,49 +345,23 @@ async function startServer(apiKey, sudoPassword) {
345
345
 
346
346
  // Step 2: Spawn server (Root CA already installed in Step 1.5)
347
347
  if (IS_WIN) {
348
- const hostsFile = path.join(process.env.SystemRoot || "C:\\Windows", "System32", "drivers", "etc", "hosts");
349
- const flagFile = path.join(os.tmpdir(), `mitm_ready_${Date.now()}.flag`);
350
348
  const psSQ = (s) => s.replace(/'/g, "''");
351
349
  const nodePs = psSQ(process.execPath);
352
350
  const serverPs = psSQ(SERVER_PATH);
353
- const flagPs = psSQ(flagFile);
354
351
 
355
352
  const psScript = [
353
+ `$ErrorActionPreference = 'Stop'`,
356
354
  `$conn = Get-NetTCPConnection -LocalPort 443 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1`,
357
355
  `if ($conn -and $conn.OwningProcess -gt 4) { Stop-Process -Id $conn.OwningProcess -Force -ErrorAction SilentlyContinue }`,
358
356
  `Start-Sleep -Milliseconds 500`,
359
357
  `$nodeCmd = 'set ROUTER_API_KEY=${psSQ(apiKey)}&& set NODE_ENV=production&& "${nodePs}" "${serverPs}"'`,
360
358
  `Start-Process cmd -ArgumentList '/c',$nodeCmd -WindowStyle Hidden`,
361
359
  `Start-Sleep -Milliseconds 500`,
362
- `Set-Content -Path '${flagPs}' -Value 'ready' -Encoding UTF8`,
363
360
  ].join("\n");
364
361
 
365
362
  const tmpPs1 = path.join(os.tmpdir(), `mitm_start_${Date.now()}.ps1`);
366
363
  fs.writeFileSync(tmpPs1, psScript, "utf8");
367
- const vbs = [
368
- `Set oShell = CreateObject("Shell.Application")`,
369
- `Dim ps`,
370
- `ps = Chr(34) & "powershell.exe" & Chr(34)`,
371
- `Dim args`,
372
- `args = "-NoProfile -ExecutionPolicy Bypass -File " & Chr(34) & "${tmpPs1}" & Chr(34)`,
373
- `oShell.ShellExecute ps, args, "", "runas", 1`,
374
- ].join("\r\n");
375
- const tmpVbs = path.join(os.tmpdir(), `mitm_uac_${Date.now()}.vbs`);
376
- fs.writeFileSync(tmpVbs, vbs, "utf8");
377
- spawn("wscript.exe", [tmpVbs], { stdio: "ignore", windowsHide: true, detached: true }).unref();
378
-
379
- await new Promise((resolve, reject) => {
380
- const deadline = Date.now() + 90000;
381
- const poll = () => {
382
- if (fs.existsSync(flagFile)) {
383
- try { fs.unlinkSync(flagFile); fs.unlinkSync(tmpPs1); fs.unlinkSync(tmpVbs); } catch { /* ignore */ }
384
- return resolve();
385
- }
386
- if (Date.now() > deadline) return reject(new Error("Timed out waiting for UAC confirmation."));
387
- setTimeout(poll, 500);
388
- };
389
- poll();
390
- });
364
+ await executeElevatedPowerShell(tmpPs1, 90000);
391
365
 
392
366
  if (_updateSettings) await _updateSettings({ mitmCertInstalled: true }).catch(() => { });
393
367
  } else {
@@ -451,38 +425,27 @@ async function startServer(apiKey, sudoPassword) {
451
425
  * Stop MITM server — removes ALL tool DNS entries first, then kills server
452
426
  */
453
427
  async function stopServer(sudoPassword) {
454
- // Remove all DNS entries first (before killing server)
455
- console.log("[MITM] Removing all DNS entries before stopping server...");
456
- await removeAllDNSEntries(sudoPassword);
428
+ console.log("[MITM] Stopping server...");
457
429
 
430
+ // Kill server process
458
431
  const proc = serverProcess;
459
- if (proc && !proc.killed) {
460
- console.log("Stopping MITM server...");
461
- killProcess(proc.pid, false, sudoPassword);
462
- await new Promise(resolve => setTimeout(resolve, 1000));
463
- if (isProcessAlive(proc.pid)) killProcess(proc.pid, true, sudoPassword);
464
- serverProcess = null;
465
- serverPid = null;
466
- } else {
467
- try {
468
- if (fs.existsSync(PID_FILE)) {
469
- const savedPid = parseInt(fs.readFileSync(PID_FILE, "utf-8").trim(), 10);
470
- if (savedPid && isProcessAlive(savedPid)) {
471
- console.log(`Killing MITM server (PID: ${savedPid})...`);
472
- killProcess(savedPid, false, sudoPassword);
473
- await new Promise(resolve => setTimeout(resolve, 1000));
474
- if (isProcessAlive(savedPid)) killProcess(savedPid, true, sudoPassword);
475
- }
476
- }
477
- } catch { /* ignore */ }
478
- serverProcess = null;
479
- serverPid = null;
432
+ const pidToKill = proc && !proc.killed
433
+ ? proc.pid
434
+ : (() => { try { return parseInt(fs.readFileSync(PID_FILE, "utf-8").trim(), 10); } catch { return null; } })();
435
+
436
+ if (pidToKill && isProcessAlive(pidToKill)) {
437
+ console.log(`Killing MITM server (PID: ${pidToKill})...`);
438
+ killProcess(pidToKill, false, sudoPassword);
439
+ await new Promise(r => setTimeout(r, 1000));
440
+ if (isProcessAlive(pidToKill)) killProcess(pidToKill, true, sudoPassword);
480
441
  }
442
+ serverProcess = null;
443
+ serverPid = null;
481
444
 
482
445
  if (IS_WIN) {
446
+ // Single elevated script: clean DNS + flush — 1 UAC prompt only
483
447
  const hostsFile = path.join(process.env.SystemRoot || "C:\\Windows", "System32", "drivers", "etc", "hosts");
484
448
  const psSQ = (s) => s.replace(/'/g, "''");
485
- const { TOOL_HOSTS } = require("./dns/dnsConfig");
486
449
  const allHosts = Object.values(TOOL_HOSTS).flat();
487
450
 
488
451
  let hostsContent = "";
@@ -490,41 +453,25 @@ async function stopServer(sudoPassword) {
490
453
  const filtered = hostsContent.split(/\r?\n/)
491
454
  .filter(l => !allHosts.some(h => l.includes(h)))
492
455
  .join("\r\n");
493
- const tmpHosts = path.join(os.tmpdir(), "mitm_hosts_clean.tmp");
456
+ const tmpHosts = path.join(os.tmpdir(), `mitm_hosts_clean_${Date.now()}.tmp`);
494
457
  fs.writeFileSync(tmpHosts, filtered, "utf8");
495
458
 
496
- const flagFile = path.join(os.tmpdir(), "mitm_stop_done.flag");
497
459
  const psScript = [
498
- `Copy-Item -Path '${psSQ(tmpHosts)}' -Destination '${psSQ(hostsFile)}' -Force`,
499
- `& ipconfig /flushdns | Out-Null`,
500
- `Remove-Item '${psSQ(tmpHosts)}' -ErrorAction SilentlyContinue`,
501
- `Set-Content -Path '${psSQ(flagFile)}' -Value 'done' -Encoding UTF8`,
460
+ `$ErrorActionPreference = 'Stop'`,
461
+ `try {`,
462
+ ` Copy-Item -Path '${psSQ(tmpHosts)}' -Destination '${psSQ(hostsFile)}' -Force -ErrorAction Stop`,
463
+ ` ipconfig /flushdns | Out-Null`,
464
+ ` Remove-Item '${psSQ(tmpHosts)}' -ErrorAction SilentlyContinue`,
465
+ `} catch {`,
466
+ ` Remove-Item '${psSQ(tmpHosts)}' -ErrorAction SilentlyContinue`,
467
+ `}`,
502
468
  ].join("\n");
503
- const tmpPs1 = path.join(os.tmpdir(), "mitm_stop.ps1");
504
- fs.writeFileSync(tmpPs1, psScript, "utf8");
505
469
 
506
- const vbs = [
507
- `Set oShell = CreateObject("Shell.Application")`,
508
- `Dim args`,
509
- `args = "-NoProfile -ExecutionPolicy Bypass -File " & Chr(34) & "${tmpPs1}" & Chr(34)`,
510
- `oShell.ShellExecute "powershell.exe", args, "", "runas", 1`,
511
- ].join("\r\n");
512
- const tmpVbs = path.join(os.tmpdir(), "mitm_stop_uac.vbs");
513
- fs.writeFileSync(tmpVbs, vbs, "utf8");
514
- spawn("wscript.exe", [tmpVbs], { stdio: "ignore", windowsHide: true, detached: true }).unref();
515
-
516
- await new Promise((resolve) => {
517
- const deadline = Date.now() + 30000;
518
- const poll = () => {
519
- if (fs.existsSync(flagFile)) {
520
- try { fs.unlinkSync(flagFile); fs.unlinkSync(tmpPs1); fs.unlinkSync(tmpVbs); } catch { /* ignore */ }
521
- return resolve();
522
- }
523
- if (Date.now() > deadline) return resolve();
524
- setTimeout(poll, 500);
525
- };
526
- poll();
527
- });
470
+ const tmpPs1 = path.join(os.tmpdir(), `mitm_stop_${Date.now()}.ps1`);
471
+ fs.writeFileSync(tmpPs1, psScript, "utf8");
472
+ await executeElevatedPowerShell(tmpPs1, 30000);
473
+ } else {
474
+ await removeAllDNSEntries(sudoPassword);
528
475
  }
529
476
 
530
477
  try { fs.unlinkSync(PID_FILE); } catch { /* ignore */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "9router",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
4
4
  "description": "9Router CLI - Start and manage 9Router server",
5
5
  "bin": {
6
6
  "9router": "./cli.js"
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4495],{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"}],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"},{id:"claude-4.6-opus-max",name:"Claude 4.6 Opus Max"},{id:"claude-4.6-sonnet-medium-thinking",name:"Claude 4.6 Sonnet Medium Thinking"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gpt-5.2",name:"GPT 5.2"},{id:"gpt-5.3-codex",name:"GPT 5.3 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-5-mini",name:"GPT-5 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"}],alicode:[{id:"qwen3.5-plus",name:"Qwen3.5 Plus"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"glm-5",name:"GLM 5"},{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"qwen3-max-2026-01-23",name:"Qwen3 Max"},{id:"qwen3-coder-next",name:"Qwen3 Coder Next"},{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"glm-4.7",name:"GLM 4.7"}],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",alicode:"alicode",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]||[]}},52679:(e,i,a)=>{a.d(i,{DI:()=>t,IS:()=>n,JH:()=>d,MA:()=>r,Q2:()=>s,fg:()=>m,gb:()=>c,mq:()=>l,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"},kilocode:{id:"kilocode",alias:"kc",name:"Kilo Code",icon:"code",color:"#FF6B35",textIcon:"KC"},cline:{id:"cline",alias:"cl",name:"Cline",icon:"smart_toy",color:"#5B9BD5",textIcon:"CL"}},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"},"glm-cn":{id:"glm-cn",alias:"glm-cn",name:"GLM (China)",icon:"code",color:"#DC2626",textIcon:"GC",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"},alicode:{id:"alicode",alias:"alicode",name:"Alibaba",icon:"cloud",color:"#FF6A00",textIcon:"ALi"},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"},chutes:{id:"chutes",alias:"ch",name:"Chutes AI",icon:"water_drop",color:"#5B6EF5",textIcon:"CH",website:"https://chutes.ai"}},d="openai-compatible-",t="anthropic-compatible-";function l(e){return"string"==typeof e&&e.startsWith(d)}function c(e){return"string"==typeof e&&e.startsWith(t)}let s={...n,...o,...m},r={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"]}}]);
@@ -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),r=i(14051),l=i.n(r),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,[r,l]=(0,a.useState)([]),[o,h]=(0,a.useState)(!0),[v,g]=(0,a.useState)(null),[A,S]=(0,a.useState)(!1),[$,T]=(0,a.useState)(!1),[O,R]=(0,a.useState)(!1),[E,q]=(0,a.useState)(!1),[I,P]=(0,a.useState)(!1),[D,K]=(0,a.useState)(null),[U,M]=(0,a.useState)({}),[_,z]=(0,a.useState)(!1),[F,J]=(0,a.useState)({}),[L,W]=(0,a.useState)(""),[V,B]=(0,a.useState)(null),[Z,G]=(0,a.useState)(!1),{copied:Q,copy:H}=(0,x.C)(),X=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],Y=!!m.zN[i]||!!m.IS[i],ee=(0,u.KC)(i),et=(0,m.wG)(i),ei=(0,m.mq)(i),es=(0,m.gb)(i),ea=ei||es,er=ea?i:et,el=ea?v?.prefix||i:et,en=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),eo=(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);l(e)}if(t.ok){let e=(a.nodes||[]).find(e=>e.id===i)||null;if(!e&&ea)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}g(e)}}catch(e){console.log("Error fetching connections:",e)}finally{h(!1)}},[i,ea]),ed=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&&(g(s.node),await eo(),P(!1))}catch(e){console.log("Error updating provider node:",e)}};(0,a.useEffect)(()=>{eo(),en()},[eo,en]);let ec=async(e,t,i=et)=>{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 en();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},ep=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await en()}catch(e){console.log("Error deleting alias:",e)}},em=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&l(r.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},eu=()=>{eo(),S(!1)},ex=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,...e})})).ok&&(await eo(),R(!1))}catch(e){console.log("Error saving connection:",e)}},eh=async e=>{try{(await fetch(`/api/providers/${D.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eo(),q(!1))}catch(e){console.log("Error updating connection:",e)}},ef=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&l(i=>i.map(i=>i.id===e?{...i,isActive:t}:i))}catch(e){console.log("Error updating connection status:",e)}},ey=async(e,t)=>{if(e&&t)try{let i=t.priority,s=e.priority;i===s&&(i=r.indexOf(e)>r.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 eo()}catch(e){console.log("Error swapping priority:",e)}},ev=async e=>{if(!V){B(e);try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${er}/${e}`})}),i=await t.json();J(t=>({...t,[e]:i.ok?"ok":"error"})),W(i.ok?"":i.error||"Model not reachable")}catch{J(t=>({...t,[e]:"error"})),W("Network error")}finally{B(null)}}};return o?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(p.Qv,{}),(0,s.jsx)(p.Qv,{})]}):X?(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:`${X.color}15`},children:_?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:X.color},children:X.textIcon||X.id.slice(0,2).toUpperCase()}):(0,s.jsx)(c.default,{src:ei&&X.apiType?"responses"===X.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":es?"/providers/anthropic-m.png":`/providers/${X.id}.png`,alt:X.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>z(!0)})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:X.name}),(0,s.jsxs)("p",{className:"text-text-muted",children:[r.length," connection",1===r.length?"":"s"]})]})]})]}),ea&&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:es?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:[es?"Messages API":"responses"===v.apiType?"Responses API":"Chat Completions"," \xb7 ",(v.baseUrl||"").replace(/\/$/,""),"/",es?"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:()=>R(!0),disabled:r.length>0,children:"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>P(!0),children:"Edit"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${es?"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"})]})]}),r.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"}),!ea&&(0,s.jsxs)("div",{className:"flex gap-2",children:["iflow"===i&&(0,s.jsx)(p.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>T(!0),title:"Add connection using browser cookie",children:"Cookie"}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>Y?S(!0):R(!0),children:"Add"})]})]}),0===r.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:Y?"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"}),!ea&&(0,s.jsxs)("div",{className:"flex gap-2 justify-center",children:["iflow"===i&&(0,s.jsx)(p.$n,{icon:"cookie",variant:"secondary",onClick:()=>T(!0),children:"Cookie Auth"}),(0,s.jsx)(p.$n,{icon:"add",onClick:()=>Y?S(!0):R(!0),children:"iflow"===i?"OAuth":"Add Connection"})]})]}):(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:r.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,t)=>(0,s.jsx)(j,{connection:e,isOAuth:Y,isFirst:0===t,isLast:t===r.length-1,onMoveUp:()=>ey(e,r[t-1]),onMoveDown:()=>ey(e,r[t+1]),onToggleActive:t=>ef(e.id,t),onEdit:()=>{K(e),q(!0)},onDelete:()=>em(e.id)},e.id))})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,s.jsx)("h2",{className:"text-lg font-semibold",children:X.passthroughModels?"Model Aliases":"Available Models"})}),!!L&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:L}),(()=>{if(ea)return(0,s.jsx)(b,{providerStorageAlias:er,providerDisplayAlias:el,modelAliases:U,copied:Q,onCopy:H,onSetAlias:ec,onDeleteAlias:ep,connections:r,isAnthropic:es});if(X.passthroughModels)return(0,s.jsx)(y,{providerAlias:et,modelAliases:U,copied:Q,onCopy:H,onSetAlias:ec,onDeleteAlias:ep});let e=Object.entries(U).filter(([e,t])=>{let i=`${er}/`;if(!t.startsWith(i))return!1;let s=t.slice(i.length);return!ee.some(e=>e.id===s)&&e===s}).map(([e,t])=>({id:t.slice(`${er}/`.length),alias:e,fullModel:t}));return(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[ee.map(e=>{let t=`${er}/${e.id}`,a=`${i}/${e.id}`,l=Object.entries(U).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(f,{model:e,fullModel:`${el}/${e.id}`,alias:l,copied:Q,onCopy:H,onSetAlias:t=>ec(e.id,t,er),onDeleteAlias:()=>ep(l),testStatus:F[e.id],onTest:r.length>0?()=>ev(e.id):void 0,isTesting:V===e.id},e.id)}),e.map(e=>(0,s.jsx)(f,{model:{id:e.id},fullModel:`${el}/${e.id}`,alias:e.alias,copied:Q,onCopy:H,onSetAlias:()=>{},onDeleteAlias:()=>ep(e.alias),testStatus:F[e.id],onTest:r.length>0?()=>ev(e.id):void 0,isTesting:V===e.id,isCustom:!0},e.id)),(0,s.jsxs)("button",{onClick:()=>G(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]})]})})()]}),"kiro"===i?(0,s.jsx)(p.Mh,{isOpen:A,providerInfo:X,onSuccess:eu,onClose:()=>S(!1)}):"cursor"===i?(0,s.jsx)(p.G9,{isOpen:A,onSuccess:eu,onClose:()=>S(!1)}):(0,s.jsx)(p.LF,{isOpen:A,provider:i,providerInfo:X,onSuccess:eu,onClose:()=>S(!1)}),"iflow"===i&&(0,s.jsx)(p.vE,{isOpen:$,onSuccess:()=>{eo(),T(!1)},onClose:()=>T(!1)}),(0,s.jsx)(N,{isOpen:O,provider:i,providerName:X.name,isCompatible:ea,isAnthropic:es,onSave:ex,onClose:()=>R(!1)}),(0,s.jsx)(C,{isOpen:E,connection:D,onSave:eh,onClose:()=>q(!1)}),ea&&(0,s.jsx)(k,{isOpen:I,node:v,onSave:ed,onClose:()=>P(!1),isAnthropic:es}),!ea&&!X?.passthroughModels&&(0,s.jsx)(w,{isOpen:Z,providerAlias:er,providerDisplayAlias:el,onSave:async e=>{await ec(e,e,er),G(!1)},onClose:()=>G(!1)})]}):(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:r,testStatus:l,isCustom:n,onDeleteAlias:o,onTest:d,isTesting:c}){let p="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",style:p?{color:p}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"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}),d&&(0,s.jsx)("button",{onClick:d,disabled:c,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,title:"Test model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:c?{animation:"spin 1s linear infinite"}:void 0,children:c?"progress_activity":"science"})}),(0,s.jsx)("button",{onClick:()=>r(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"})}),n&&(0,s.jsx)("button",{onClick:o,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function y({providerAlias:e,modelAliases:t,copied:i,onCopy:r,onSetAlias:l,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 l(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:r,onDeleteAlias:()=>n(a)},t))})]})}function v({modelId:e,fullModel:t,copied:i,onCopy:a,onDeleteAlias:r}){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:r,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 b({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:i,copied:r,onCopy:l,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),b=Object.entries(i).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),g=e=>{let s,a=(s=e.split("/"))[s.length-1];if(!i[a])return a;let r=`${t}-${a}`;return i[r]?null:r},j=async()=>{if(!m.trim()||x)return;let t=m.trim(),i=g(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 r=0;for(let t of a){let i=t.id||t.name||t.model;if(!i)continue;let s=g(i);s&&(await n(i,s,e),r+=1)}0===r&&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."}),b.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:b.map(({modelId:e,fullModel:i,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:`${t}/${e}`,copied:r,onCopy:l,onDeleteAlias:()=>o(a)},i))})]})}function g({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:r,onMoveUp:l,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),h=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,a.useEffect)(()=>{let t=()=>{x(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let i=h?setInterval(t,1e3):null;return()=>{i&&clearInterval(i)}},[h]);let f="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:l,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:r,className:`p-0.5 rounded ${r?"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"===f||"success"===f?"success":"error"===f||"expired"===f||"unavailable"===f?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":f||"Unknown"}),u&&!1!==e.isActive&&(0,s.jsx)(g,{until:h}),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:r,isAnthropic:l,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)}},b=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"}),r&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:l?`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:b,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:r}){let[l,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,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(n({name:t.name||"",priority:t.priority||1,apiKey:""}),u(null),y(null))},[t]);let g=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&&l.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:l.apiKey})}),i=await e.json();y(i.valid?"success":"failed")}catch{y("failed")}finally{h(!1)}}},N=async()=>{b(!0);try{let e={name:l.name,priority:l.priority};if(!C&&l.apiKey){e.apiKey=l.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:l.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{b(!1)}};if(!t)return null;let C="oauth"===t.authType,k=(0,m.mq)(t.provider)||(0,m.gb)(t.provider);return(0,s.jsx)(p.aF,{isOpen:e,title:"Edit Connection",onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:l.name,onChange:e=>n({...l,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:l.priority,onChange:e=>n({...l,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:l.apiKey,onChange:e=>n({...l,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:j,disabled:!l.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"})]}),!k&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(p.$n,{onClick:g,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:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function k({isOpen:e,node:t,onSave:i,onClose:r,isAnthropic:l}){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||(l?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,l]);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};l||(e.apiType=n.apiType),await i(e)}finally{c(!1)}}},b=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:m,type:l?"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 ${l?"Anthropic":"OpenAI"} Compatible`,onClose:r,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:`${l?"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:l?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!l&&(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:l?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${l?"Anthropic":"OpenAI"}-compatible API.`}),(0,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:b,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:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function w({isOpen:e,providerAlias:t,providerDisplayAlias:i,onSave:r,onClose:l}){let[n,o]=(0,a.useState)(""),[d,c]=(0,a.useState)(null),[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&(o(""),c(null),u(""))},[e]);let f=async()=>{if(n.trim()){c("testing"),u("");try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${n.trim()}`})}),i=await e.json();c(i.ok?"ok":"error"),u(i.error||"")}catch(e){c("error"),u(e.message)}}},y=async()=>{if(n.trim()&&!x){h(!0);try{await r(n.trim())}finally{h(!1)}}};return(0,s.jsx)(p.aF,{isOpen:e,onClose:l,title:"Add Custom Model",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:n,onChange:e=>{o(e.target.value),c(null),u("")},onKeyDown:e=>{"Enter"===e.key&&f()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,s.jsx)(p.$n,{variant:"secondary",icon:"science",loading:"testing"===d,onClick:f,disabled:!n.trim()||"testing"===d,children:"testing"===d?"Testing...":"Test"})]}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,s.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:n.trim()||"model-id"})]})]}),"ok"===d&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===d&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,s.jsx)("span",{children:m||"Model not reachable"})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,s.jsx)(p.$n,{onClick:y,fullWidth:!0,size:"sm",disabled:!n.trim()||x,children:x?"Adding...":"Add Model"})]})]})})}f.propTypes={model:l().shape({id:l().string.isRequired}).isRequired,fullModel:l().string.isRequired,alias:l().string,copied:l().string,onCopy:l().func.isRequired,testStatus:l().oneOf(["ok","error"]),isCustom:l().bool,onDeleteAlias:l().func,onTest:l().func,isTesting:l().bool},y.propTypes={providerAlias:l().string.isRequired,modelAliases:l().object.isRequired,copied:l().string,onCopy:l().func.isRequired,onSetAlias:l().func.isRequired,onDeleteAlias:l().func.isRequired},v.propTypes={modelId:l().string.isRequired,fullModel:l().string.isRequired,copied:l().string,onCopy:l().func.isRequired,onDeleteAlias:l().func.isRequired},b.propTypes={providerStorageAlias:l().string.isRequired,providerDisplayAlias:l().string.isRequired,modelAliases:l().object.isRequired,copied:l().string,onCopy:l().func.isRequired,onSetAlias:l().func.isRequired,onDeleteAlias:l().func.isRequired,connections:l().arrayOf(l().shape({id:l().string,isActive:l().bool})).isRequired,isAnthropic:l().bool},g.propTypes={until:l().string.isRequired},j.propTypes={connection:l().shape({id:l().string,name:l().string,email:l().string,displayName:l().string,modelLockUntil:l().string,testStatus:l().string,isActive:l().bool,lastError:l().string,priority:l().number,globalPriority:l().number}).isRequired,isOAuth:l().bool.isRequired,isFirst:l().bool.isRequired,isLast:l().bool.isRequired,onMoveUp:l().func.isRequired,onMoveDown:l().func.isRequired,onToggleActive:l().func.isRequired,onEdit:l().func.isRequired,onDelete:l().func.isRequired},N.propTypes={isOpen:l().bool.isRequired,provider:l().string,providerName:l().string,isCompatible:l().bool,isAnthropic:l().bool,onSave:l().func.isRequired,onClose:l().func.isRequired},C.propTypes={isOpen:l().bool.isRequired,connection:l().shape({id:l().string,name:l().string,email:l().string,priority:l().number,authType:l().string,provider:l().string}),onSave:l().func.isRequired,onClose:l().func.isRequired},k.propTypes={isOpen:l().bool.isRequired,node:l().shape({id:l().string,name:l().string,prefix:l().string,apiType:l().string,baseUrl:l().string}),onSave:l().func.isRequired,onClose:l().func.isRequired,isAnthropic:l().bool},w.propTypes={isOpen:l().bool.isRequired,providerAlias:l().string.isRequired,providerDisplayAlias:l().string.isRequired,onSave:l().func.isRequired,onClose:l().func.isRequired}}},e=>{e.O(0,[5370,4335,5772,2032,4495,5497,8441,3794,7358],()=>e(e.s=52397)),_N_E=e.O()}]);