@sifxprime/krouter 0.5.165 → 0.5.166

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 (322) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +8 -8
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/prerender-manifest.json +3 -3
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/environment/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/environment/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +2 -2
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/presidio/page.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/presidio/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  55. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  57. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  58. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  59. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  60. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  61. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  62. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  64. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  65. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  66. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  67. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  68. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +7 -7
  69. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  70. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  71. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  72. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  73. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  74. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  75. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  76. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -2
  77. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +5 -5
  78. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  79. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  80. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +3 -2
  81. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  82. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  83. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  84. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +51 -1
  85. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  86. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  87. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  88. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  89. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  90. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  91. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  92. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +2 -2
  93. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  94. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  95. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  96. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  97. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  98. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  99. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -51
  100. package/app/.next-cli-build/server/app/api/settings/route.js +51 -1
  101. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  102. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  103. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  105. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  106. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  107. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  108. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +51 -1
  109. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +51 -1
  110. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  111. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  112. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +2 -2
  113. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  114. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  115. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  116. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  117. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  118. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  120. package/app/.next-cli-build/server/app/api/v1/search/route.js +51 -1
  121. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  122. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  123. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  124. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  125. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +51 -1
  126. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  127. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  128. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  129. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  130. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  131. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  132. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  133. package/app/.next-cli-build/server/app/callback.html +1 -1
  134. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  135. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  136. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  137. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
  138. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  139. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
  140. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +5 -5
  141. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
  142. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  143. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  144. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
  145. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +5 -5
  146. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  147. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  148. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  149. package/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
  150. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +5 -5
  151. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  152. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  153. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  154. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
  155. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +5 -5
  156. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  157. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  158. package/app/.next-cli-build/server/app/dashboard/environment.html +1 -1
  159. package/app/.next-cli-build/server/app/dashboard/environment.rsc +5 -5
  160. package/app/.next-cli-build/server/app/dashboard/environment.segments/!KGRhc2hib2FyZCk/dashboard/environment/__PAGE__.segment.rsc +5 -5
  161. package/app/.next-cli-build/server/app/dashboard/environment.segments/_full.segment.rsc +5 -5
  162. package/app/.next-cli-build/server/app/dashboard/environment.segments/_tree.segment.rsc +1 -1
  163. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  164. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
  165. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +5 -5
  166. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
  167. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  168. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  169. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
  170. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +5 -5
  171. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  172. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  173. package/app/.next-cli-build/server/app/dashboard/presidio.html +1 -1
  174. package/app/.next-cli-build/server/app/dashboard/presidio.rsc +4 -4
  175. package/app/.next-cli-build/server/app/dashboard/presidio.segments/!KGRhc2hib2FyZCk/dashboard/presidio/__PAGE__.segment.rsc +4 -4
  176. package/app/.next-cli-build/server/app/dashboard/presidio.segments/_full.segment.rsc +4 -4
  177. package/app/.next-cli-build/server/app/dashboard/presidio.segments/_tree.segment.rsc +1 -1
  178. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  179. package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
  180. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +5 -5
  181. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  182. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  183. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  184. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
  185. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +5 -5
  186. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  187. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  188. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  189. package/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
  190. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +5 -5
  191. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  192. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  193. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  194. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
  195. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +5 -5
  196. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  197. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  198. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  199. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
  200. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +5 -5
  201. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
  202. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  203. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  204. package/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
  205. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +6 -6
  206. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
  207. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  208. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  209. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  210. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  211. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  212. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  213. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  214. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
  215. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  216. package/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
  217. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +5 -5
  218. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
  219. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  220. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  221. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
  222. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +5 -5
  223. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
  224. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  225. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  226. package/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
  227. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +5 -5
  228. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  229. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  230. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  231. package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
  232. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +5 -5
  233. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  234. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  235. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  236. package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
  237. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +5 -5
  238. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
  239. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  240. package/app/.next-cli-build/server/app/index.html +1 -1
  241. package/app/.next-cli-build/server/app/index.rsc +3 -3
  242. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  243. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  244. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  245. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  246. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  247. package/app/.next-cli-build/server/app/landing.html +1 -1
  248. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  249. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  250. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  251. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
  252. package/app/.next-cli-build/server/app/login/page.js +1 -1
  253. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  254. package/app/.next-cli-build/server/app/login.html +1 -1
  255. package/app/.next-cli-build/server/app/login.rsc +4 -4
  256. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  257. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  258. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  259. package/app/.next-cli-build/server/app/page.js +1 -1
  260. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  261. package/app/.next-cli-build/server/app-paths-manifest.json +8 -8
  262. package/app/.next-cli-build/server/chunks/1318.js +51 -0
  263. package/app/.next-cli-build/server/chunks/1350.js +1 -0
  264. package/app/.next-cli-build/server/chunks/1450.js +1 -1
  265. package/app/.next-cli-build/server/chunks/1738.js +2 -2
  266. package/app/.next-cli-build/server/chunks/2557.js +1 -0
  267. package/app/.next-cli-build/server/chunks/2722.js +7 -7
  268. package/app/.next-cli-build/server/chunks/2750.js +2 -2
  269. package/app/.next-cli-build/server/chunks/3120.js +60 -12
  270. package/app/.next-cli-build/server/chunks/{9528.js → 369.js} +2 -3
  271. package/app/.next-cli-build/server/chunks/412.js +5 -5
  272. package/app/.next-cli-build/server/chunks/4161.js +1 -1
  273. package/app/.next-cli-build/server/chunks/4315.js +1 -1
  274. package/app/.next-cli-build/server/chunks/4404.js +1 -1
  275. package/app/.next-cli-build/server/chunks/4632.js +1 -1
  276. package/app/.next-cli-build/server/chunks/4884.js +3 -3
  277. package/app/.next-cli-build/server/chunks/5024.js +1 -1
  278. package/app/.next-cli-build/server/chunks/5330.js +28 -20
  279. package/app/.next-cli-build/server/chunks/5470.js +1 -1
  280. package/app/.next-cli-build/server/chunks/5681.js +1 -1
  281. package/app/.next-cli-build/server/chunks/5718.js +1 -1
  282. package/app/.next-cli-build/server/chunks/6108.js +1 -1
  283. package/app/.next-cli-build/server/chunks/6182.js +1 -1
  284. package/app/.next-cli-build/server/chunks/6200.js +1 -1
  285. package/app/.next-cli-build/server/chunks/6457.js +1 -1
  286. package/app/.next-cli-build/server/chunks/7153.js +1 -0
  287. package/app/.next-cli-build/server/chunks/7341.js +1 -1
  288. package/app/.next-cli-build/server/chunks/7828.js +1 -1
  289. package/app/.next-cli-build/server/chunks/8238.js +1 -1
  290. package/app/.next-cli-build/server/chunks/8590.js +1 -1
  291. package/app/.next-cli-build/server/chunks/8895.js +6 -6
  292. package/app/.next-cli-build/server/chunks/8962.js +1 -1
  293. package/app/.next-cli-build/server/chunks/{2365.js → 9055.js} +2 -1
  294. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  295. package/app/.next-cli-build/server/middleware.js +5 -5
  296. package/app/.next-cli-build/server/pages/404.html +1 -1
  297. package/app/.next-cli-build/server/pages/500.html +1 -1
  298. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  299. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  300. package/app/.next-cli-build/static/chunks/1321-c5b3011761e0228b.js +1 -0
  301. package/app/.next-cli-build/static/chunks/5497-1af4fbf829c885c4.js +7 -0
  302. package/app/.next-cli-build/static/chunks/{6069-cd255683a4a76ed3.js → 6069-7e7f824c6e2d4291.js} +6 -6
  303. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-e7fe548bb32bb43c.js +1 -0
  304. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-4bcade1442e6c0b5.js → page-66d4b33890b140ae.js} +7 -7
  305. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-c88a929e34f9b002.js → page-2f53d5dd5b247cf1.js} +4 -4
  306. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-a6d8744e27e7dd87.js +1 -0
  307. package/app/cli/package.json +1 -1
  308. package/app/package.json +1 -1
  309. package/app/src/mitm/server.js +1 -1
  310. package/package.json +1 -1
  311. package/src/cli/menus/combos.js +11 -2
  312. package/src/cli/utils/comboModelId.js +14 -0
  313. package/app/.next-cli-build/server/chunks/4746.js +0 -51
  314. package/app/.next-cli-build/server/chunks/6306.js +0 -1
  315. package/app/.next-cli-build/server/chunks/8319.js +0 -1
  316. package/app/.next-cli-build/server/chunks/9376.js +0 -51
  317. package/app/.next-cli-build/static/chunks/1321-ff45959ff6580781.js +0 -1
  318. package/app/.next-cli-build/static/chunks/5497-71ac1eaeaacd3abb.js +0 -7
  319. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-18d8f169d8c3de33.js +0 -1
  320. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-a1e95f4a56398b5f.js +0 -1
  321. /package/app/.next-cli-build/static/{8BL7P4wrNCaFJbJqldneC → i0cMBMqFdYWpbajovDyfY}/_buildManifest.js +0 -0
  322. /package/app/.next-cli-build/static/{8BL7P4wrNCaFJbJqldneC → i0cMBMqFdYWpbajovDyfY}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6069],{3534:(e,t,s)=>{s.d(t,{dM:()=>a,wn:()=>l});let l={antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["gemini-3.5-flash-low","gemini-3-flash-agent","gemini-3.5-flash-extra-low","gemini-3.1-pro-low","gemini-pro-agent","claude-sonnet-4-6","claude-opus-4-6-thinking","gpt-oss-120b-medium","gemini-3-flash"],defaultModels:[{id:"gemini-3.5-flash-low",name:"Gemini 3.5 Flash (Medium) / Default",alias:"gemini-3.5-flash-low",mandatory:!0},{id:"gemini-3-flash-agent",name:"Gemini 3.5 Flash (High)",alias:"gemini-3-flash-agent"},{id:"gemini-3.5-flash-extra-low",name:"Gemini 3.5 Flash (Low)",alias:"gemini-3.5-flash-extra-low"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro (Low)",alias:"gemini-3.1-pro-low"},{id:"gemini-pro-agent",name:"Gemini 3.1 Pro (High)",alias:"gemini-pro-agent"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Thinking)",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 (Thinking)",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT-OSS 120B (Medium)",alias:"gpt-oss-120b-medium"},{id:"gemini-3-flash",name:"Gemini 3 Flash (Command)",alias:"gemini-3-flash"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-5-mini","gpt-5.4-nano","claude-haiku-4.5","gpt-4o","gpt-4.1"],defaultModels:[{id:"gpt-5-mini",name:"GPT-5 mini",alias:"gpt-5-mini"},{id:"gpt-5.4-nano",name:"GPT-5.4 nano",alias:"gpt-5.4-nano"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"runtime.us-east-1.kiro.dev",defaultModels:[{id:"auto",name:"Auto (Kiro agent default)",alias:"auto"},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]},claude:{id:"claude",name:"Claude Desktop",image:"/providers/claude.png",color:"#D97757",description:"Anthropic Claude Desktop app (Electron). Intercepts api.anthropic.com so the desktop app routes through kRouter to whichever provider you've mapped (your Claude OAuth, Antigravity, etc.). The Claude Code CLI does NOT need this — use ANTHROPIC_BASE_URL instead.",configType:"mitm",mitmDomain:"api.anthropic.com",defaultModels:[{id:"claude-opus-4-7",name:"Claude Opus 4.7",alias:"claude-opus-4-7"},{id:"claude-opus-4-6",name:"Claude Opus 4.6",alias:"claude-opus-4-6"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4-5"},{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",alias:"claude-haiku-4-5"}]}},a={claude:{id:"claude",name:"Claude Code",image:"/providers/claude.png",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI / App",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},cowork:{id:"cowork",name:"Claude Cowork",image:"/providers/claude.png",color:"#D97757",description:"Claude Desktop Cowork (third-party inference)",configType:"custom"},hermes:{id:"hermes",name:"Hermes Agent",image:"/providers/hermes.png",color:"#8B5CF6",description:"Nous Research self-improving AI agent",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"custom"},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"custom"},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open ~/.continue/config.yaml (Windows: %USERPROFILE%\\.continue\\config.yaml). In Continue, the gear next to Local Config opens it."},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Empty file: paste the whole block. If the file has models: [] (Continue's default), replace that line with the models: section below. If models: already lists entries, add only the - name: entry under them."}],codeBlock:{language:"yaml",code:`name: kRouter
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6069],{3534:(e,t,s)=>{s.d(t,{dM:()=>a,wn:()=>l});let l={antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["gemini-4-argon-high","gemini-3.8-flash-high","gemini-3.8-flash-medium","gemini-3.8-flash-low","gemini-3.7-flash-high","gemini-3.7-flash-medium","gemini-3.7-flash-low","gemini-3.6-flash-high","gemini-3.6-flash-medium","gemini-3.6-flash-low","gemini-3.1-pro-high","gemini-3.1-pro-low","gemini-pro-agent","claude-sonnet-5-5","claude-sonnet-5-5-high","claude-sonnet-5-5-medium","claude-sonnet-5-5-low","claude-opus-5-5","claude-opus-5-5-high","claude-opus-5-5-medium","claude-opus-5-5-low","claude-sonnet-4-6","claude-opus-4-6-thinking","gpt-oss-120b-medium"],defaultModels:[{id:"gemini-3.8-flash-medium",name:"Gemini 3.8 Flash (Medium) / Default",alias:"gemini-3.8-flash-medium",mandatory:!0},{id:"gemini-3.8-flash-high",name:"Gemini 3.8 Flash (High)",alias:"gemini-3.8-flash-high"},{id:"gemini-3.8-flash-low",name:"Gemini 3.8 Flash (Low)",alias:"gemini-3.8-flash-low"},{id:"gemini-4-argon-high",name:"Gemini 4 Argon (High)",alias:"gemini-4-argon-high"},{id:"gemini-3.7-flash-high",name:"Gemini 3.7 Flash (High)",alias:"gemini-3.7-flash-high"},{id:"gemini-3.7-flash-medium",name:"Gemini 3.7 Flash (Medium)",alias:"gemini-3.7-flash-medium"},{id:"gemini-3.7-flash-low",name:"Gemini 3.7 Flash (Low)",alias:"gemini-3.7-flash-low"},{id:"gemini-3.6-flash-high",name:"Gemini 3.6 Flash (High)",alias:"gemini-3.6-flash-high"},{id:"gemini-3.6-flash-medium",name:"Gemini 3.6 Flash (Medium)",alias:"gemini-3.6-flash-medium"},{id:"gemini-3.6-flash-low",name:"Gemini 3.6 Flash (Low)",alias:"gemini-3.6-flash-low"},{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro (High)",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro (Low)",alias:"gemini-3.1-pro-low"},{id:"gemini-pro-agent",name:"Gemini 3.1 Pro (High) / Legacy",alias:"gemini-pro-agent"},{id:"claude-sonnet-5-5",name:"Claude Sonnet 5.5 (Thinking)",alias:"claude-sonnet-5-5"},{id:"claude-sonnet-5-5-high",name:"Claude Sonnet 5.5 (High)",alias:"claude-sonnet-5-5-high"},{id:"claude-sonnet-5-5-medium",name:"Claude Sonnet 5.5 (Medium)",alias:"claude-sonnet-5-5-medium"},{id:"claude-sonnet-5-5-low",name:"Claude Sonnet 5.5 (Low)",alias:"claude-sonnet-5-5-low"},{id:"claude-opus-5-5",name:"Claude Opus 5.5 (Thinking)",alias:"claude-opus-5-5"},{id:"claude-opus-5-5-high",name:"Claude Opus 5.5 (High)",alias:"claude-opus-5-5-high"},{id:"claude-opus-5-5-medium",name:"Claude Opus 5.5 (Medium)",alias:"claude-opus-5-5-medium"},{id:"claude-opus-5-5-low",name:"Claude Opus 5.5 (Low)",alias:"claude-opus-5-5-low"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Thinking)",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 (Thinking)",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT-OSS 120B (Medium)",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-5-mini","gpt-5.4-nano","claude-haiku-4.5","gpt-4o","gpt-4.1"],defaultModels:[{id:"gpt-5-mini",name:"GPT-5 mini",alias:"gpt-5-mini"},{id:"gpt-5.4-nano",name:"GPT-5.4 nano",alias:"gpt-5.4-nano"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"runtime.us-east-1.kiro.dev",defaultModels:[{id:"auto",name:"Auto (Kiro agent default)",alias:"auto"},{id:"claude-sonnet-5",name:"Claude Sonnet 5",alias:"claude-sonnet-5"},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]},claude:{id:"claude",name:"Claude Desktop",image:"/providers/claude.png",color:"#D97757",description:"Anthropic Claude Desktop app (Electron). Intercepts api.anthropic.com so the desktop app routes through kRouter to whichever provider you've mapped (your Claude OAuth, Antigravity, etc.). The Claude Code CLI does NOT need this — use ANTHROPIC_BASE_URL instead.",configType:"mitm",mitmDomain:"api.anthropic.com",defaultModels:[{id:"claude-opus-4-7",name:"Claude Opus 4.7",alias:"claude-opus-4-7"},{id:"claude-opus-4-6",name:"Claude Opus 4.6",alias:"claude-opus-4-6"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4-5"},{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",alias:"claude-haiku-4-5"}]}},a={claude:{id:"claude",name:"Claude Code",image:"/providers/claude.png",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI / App",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},cowork:{id:"cowork",name:"Claude Cowork",image:"/providers/claude.png",color:"#D97757",description:"Claude Desktop Cowork (third-party inference)",configType:"custom"},hermes:{id:"hermes",name:"Hermes Agent",image:"/providers/hermes.png",color:"#8B5CF6",description:"Nous Research self-improving AI agent",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"custom"},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"custom"},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open ~/.continue/config.yaml (Windows: %USERPROFILE%\\.continue\\config.yaml). In Continue, the gear next to Local Config opens it."},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Empty file: paste the whole block. If the file has models: [] (Continue's default), replace that line with the models: section below. If models: already lists entries, add only the - name: entry under them."}],codeBlock:{language:"yaml",code:`name: kRouter
2
2
  version: 0.0.1
3
3
  schema: v1
4
4
  models:
@@ -22,7 +22,7 @@ amp --model "{{model}}"
22
22
  "model": {
23
23
  "name": "{{model}}"
24
24
  }
25
- }`}},"deepseek-tui":{id:"deepseek-tui",name:"DeepSeek TUI",image:"/providers/deepseek-tui.png",color:"#4D6BFE",description:"DeepSeek Terminal Coding Agent (Rust TUI)",docsUrl:"https://github.com/DeepSeek-TUI/DeepSeek-TUI",configType:"custom",defaultCommand:"deepseek",modelAliases:["deepseek-v4-pro","deepseek-v4-flash","deepseek-chat","deepseek-reasoner"],defaultModels:[{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",alias:"deepseek-v4-pro"},{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",alias:"deepseek-v4-flash"},{id:"deepseek-chat",name:"DeepSeek V3 Chat",alias:"deepseek-chat"}],notes:[{type:"info",text:"DeepSeek TUI uses ~/.deepseek/config.toml for configuration. kRouter will update the provider to 'openai' mode with your base_url, api_key, and model."},{type:"warning",text:"Config path: Linux/macOS ~/.deepseek/config.toml • Windows %USERPROFILE%\\.deepseek\\config.toml"}]},jcode:{id:"jcode",name:"jcode",image:"/providers/jcode.png",color:"#FF6B35",description:"High-performance Rust-based coding agent harness",configType:"custom",docsUrl:"https://github.com/1jehuang/jcode",notes:[{type:"info",text:"jcode is a Rust-based coding agent with semantic memory, multi-agent swarms, and extreme performance (27.8 MB RAM, 14ms boot)."},{type:"info",text:"Configure kRouter as an OpenAI-compatible provider to route all jcode requests through kRouter's optimization layer."},{type:"warning",text:"Requires jcode installed. Install via: curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash"}],defaultModels:[{id:"claude-opus-4-7",name:"Claude Opus 4.7",alias:"opus",defaultValue:"cc/claude-opus-4-7"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"sonnet",defaultValue:"cc/claude-sonnet-4-6"},{id:"gpt-5.5",name:"GPT 5.5",alias:"gpt5",defaultValue:"cx/gpt-5.5"},{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro",alias:"gemini",defaultValue:"gemini/gemini-3.1-pro"}]},opendesign:{id:"opendesign",name:"OpenDesign",image:"/providers/opendesign.png",color:"#7C3AED",description:"OpenDesign — claude.ai/design open-sourced! Agent-native design skills pack",docsUrl:"https://github.com/manalkaff/opendesign",configType:"guide",notes:[{type:"info",text:"OpenDesign ships as a plugin/skills pack installed into Claude Code, Cursor, OpenAI Codex, Gemini CLI, or OpenCode. It inherits the host agent's model config, so once your host points at kRouter, /opendesign design sessions route through kRouter automatically — no extra env vars needed."},{type:"info",text:"Invoke with /opendesign <brief>. Covers decks, wireframes, interactive prototypes, design-system extraction, and brand systems, with a verifier subagent that checks output against the brief."}],guideSteps:[{step:1,title:"Install the plugin",desc:"Pick your host below and run the matching install command from the matrix."},{step:2,title:"No config needed",desc:"OpenDesign runs inside your host agent and uses its model config. If the host already routes through kRouter, /opendesign traffic does too."},{step:3,title:"Start designing",desc:"Invoke OpenDesign from your agent:",value:"/opendesign make a pitch deck for a seed-stage AI company, 10 slides",copyable:!0}],codeBlock:{language:"bash",code:`# Claude Code
25
+ }`}},"deepseek-tui":{id:"deepseek-tui",name:"DeepSeek TUI",image:"/providers/deepseek-tui.png",color:"#4D6BFE",description:"DeepSeek Terminal Coding Agent (Rust TUI)",docsUrl:"https://github.com/DeepSeek-TUI/DeepSeek-TUI",configType:"custom",defaultCommand:"deepseek",modelAliases:["deepseek-v4-pro","deepseek-v4-flash","deepseek-chat","deepseek-reasoner"],defaultModels:[{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",alias:"deepseek-v4-pro"},{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",alias:"deepseek-v4-flash"},{id:"deepseek-chat",name:"DeepSeek V3 Chat",alias:"deepseek-chat"}],notes:[{type:"info",text:"DeepSeek TUI uses ~/.deepseek/config.toml for configuration. kRouter will update the provider to 'openai' mode with your base_url, api_key, and model."},{type:"warning",text:"Config path: Linux/macOS ~/.deepseek/config.toml • Windows %USERPROFILE%\\.deepseek\\config.toml"}]},jcode:{id:"jcode",name:"jcode",image:"/providers/jcode.png",color:"#FF6B35",description:"High-performance Rust-based coding agent harness",configType:"custom",docsUrl:"https://github.com/1jehuang/jcode",notes:[{type:"info",text:"jcode is a Rust-based coding agent with semantic memory, multi-agent swarms, and extreme performance (27.8 MB RAM, 14ms boot)."},{type:"info",text:"Configure kRouter as an OpenAI-compatible provider to route all jcode requests through kRouter's optimization layer."},{type:"warning",text:"Requires jcode installed. Install via: curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash"}],defaultModels:[{id:"claude-opus-4-7",name:"Claude Opus 4.7",alias:"opus",defaultValue:"cc/claude-opus-4-7"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"sonnet",defaultValue:"cc/claude-sonnet-4-6"},{id:"gpt-6.1-sol",name:"GPT 6.1 Sol",alias:"gpt5",defaultValue:"cx/gpt-6.1-sol"},{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro",alias:"gemini",defaultValue:"gemini/gemini-3.1-pro"}]},opendesign:{id:"opendesign",name:"OpenDesign",image:"/providers/opendesign.png",color:"#7C3AED",description:"OpenDesign — claude.ai/design open-sourced! Agent-native design skills pack",docsUrl:"https://github.com/manalkaff/opendesign",configType:"guide",notes:[{type:"info",text:"OpenDesign ships as a plugin/skills pack installed into Claude Code, Cursor, OpenAI Codex, Gemini CLI, or OpenCode. It inherits the host agent's model config, so once your host points at kRouter, /opendesign design sessions route through kRouter automatically — no extra env vars needed."},{type:"info",text:"Invoke with /opendesign <brief>. Covers decks, wireframes, interactive prototypes, design-system extraction, and brand systems, with a verifier subagent that checks output against the brief."}],guideSteps:[{step:1,title:"Install the plugin",desc:"Pick your host below and run the matching install command from the matrix."},{step:2,title:"No config needed",desc:"OpenDesign runs inside your host agent and uses its model config. If the host already routes through kRouter, /opendesign traffic does too."},{step:3,title:"Start designing",desc:"Invoke OpenDesign from your agent:",value:"/opendesign make a pitch deck for a seed-stage AI company, 10 slides",copyable:!0}],codeBlock:{language:"bash",code:`# Claude Code
26
26
  /plugin marketplace add manalkaff/opendesign
27
27
  /plugin install opendesign@opendesign
28
28
 
@@ -36,8 +36,8 @@ amp --model "{{model}}"
36
36
  gemini extensions install https://github.com/manalkaff/opendesign
37
37
 
38
38
  # OpenCode
39
- # Fetch and follow .opencode/INSTALL.md from the repo`}}}},40295:e=>{e.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["runtime.us-east-1.kiro.dev","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"],claude:["api.anthropic.com"]}}},43666:(e,t,s)=>{s.d(t,{Tk:()=>b,aG:()=>P,Ah:()=>j,h1:()=>I,Q6:()=>M,lF:()=>$,a7:()=>S,ZM:()=>v,RF:()=>C,mW:()=>U,c9:()=>R,gY:()=>H,tA:()=>D,kn:()=>z,yZ:()=>w,qO:()=>E});var l=s(95155),a=s(12115),r=s(35497),i=s(5772),n=s(90620);let o="krouter.cliToolEndpointPresets",d="__custom__",c="__save__",m=e=>{window.localStorage.setItem(o,JSON.stringify(e))};function x({value:e,onChange:t,requiresExternalUrl:s=!1,tunnelEnabled:r=!1,tunnelPublicUrl:i="",tailscaleEnabled:p=!1,tailscaleUrl:u="",cloudEnabled:h=!1,cloudUrl:g="",withV1:f=!0}){let[y,b]=(0,a.useState)([]),[j,N]=(0,a.useState)(""),[v,w]=(0,a.useState)(""),k=(0,a.useRef)(!1);(0,a.useEffect)(()=>{b((()=>{try{let e=window.localStorage.getItem(o),t=JSON.parse(e||"[]");if(!Array.isArray(t))return[];return t.filter(e=>e?.name&&e?.baseUrl)}catch{return[]}})())},[]);let C=(0,a.useMemo)(()=>(({requiresExternalUrl:e,tunnelEnabled:t,tunnelPublicUrl:s,tailscaleEnabled:l,tailscaleUrl:a,cloudEnabled:r,cloudUrl:i,savedPresets:o,withV1:c})=>{let m=[],x=e=>{let t;return c?(t=(e||"").replace(/\/+$/,""))?/\/v1$/.test(t)?t:`${t}/v1`:"":(e||"").replace(/\/+$/,"")};if(!e){let e=x(`http://127.0.0.1:${n.h0.appPort}`);m.push({value:"local",label:e,url:e})}if(t&&s){let e=x(s);m.push({value:"tunnel",label:e,url:e})}if(l&&a){let e=x(a);m.push({value:"tailscale",label:e,url:e})}if(r&&i){let e=x(i);m.push({value:"cloud",label:e,url:e})}return o.forEach(e=>{m.push({value:`saved:${e.name}`,label:e.baseUrl,url:e.baseUrl,saved:!0})}),m.push({value:d,label:"Custom URL...",url:""}),m})({requiresExternalUrl:s,tunnelEnabled:r,tunnelPublicUrl:i,tailscaleEnabled:p,tailscaleUrl:u,cloudEnabled:h,cloudUrl:g,savedPresets:y,withV1:f}),[s,r,i,p,u,h,g,y,f]);(0,a.useEffect)(()=>{if(k.current||0===C.length)return;k.current=!0;let e=C.find(e=>e.value!==d);e?(N(e.value),t(e.url)):N(d)},[C,t]);let _=j.startsWith("saved:"),S=j===d,E=S&&(v||"").trim().length>0;return(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("select",{value:j,onChange:s=>{let l=s.target.value;if(l===c){let t=(e||"").trim();if(!t)return;let s=t;try{s=new URL(t).host}catch{}let l=window.prompt("Save endpoint as:",s);if(!l?.trim())return;let a=[...y.filter(e=>e.name!==l.trim()),{name:l.trim(),baseUrl:t}].sort((e,t)=>e.name.localeCompare(t.name));b(a),m(a);return}if(N(l),l===d){w(""),t("");return}let a=C.find(e=>e.value===l);a&&t(a.url)},className:"flex-1 min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[C.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value)),E&&(0,l.jsx)("option",{value:c,children:"+ Save current as..."})]}),_&&(0,l.jsx)("button",{type:"button",onClick:()=>{if(!j.startsWith("saved:"))return;let e=j.slice(6),s=y.filter(t=>t.name!==e);b(s),m(s),N(d),w(""),t("")},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),S&&(0,l.jsx)("input",{type:"text",value:v,onChange:e=>{let s=e.target.value;w(s),t(s)},placeholder:f?"https://example.com/v1":"https://example.com",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let p="__custom__";function u({value:e,onChange:t,apiKeys:s=[],cloudEnabled:r=!1,className:i=""}){let n=!s.some(t=>t.key===e)&&""!==e,[o,d]=(0,a.useState)(()=>e?s.some(t=>t.key===e)?e:p:s.length>0?s[0].key:p),[c,m]=(0,a.useState)(n?e:"");return 0===s.length&&o!==p&&o!==p?(0,l.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${i}`,children:r?"No API keys - Create one in Keys page":"sk_krouter (default)"}):(0,l.jsxs)("div",{className:`flex flex-col gap-1.5 ${i}`,children:[(0,l.jsxs)("select",{value:o,onChange:e=>{let s=e.target.value;d(s),s===p?(m(""),t("")):t(s)},className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[s.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id)),(0,l.jsx)("option",{value:p,children:"Custom..."})]}),o===p&&(0,l.jsx)("input",{type:"text",value:c,onChange:e=>{let s=e.target.value;m(s),t(s)},placeholder:"sk-...",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let h=e=>(e||"").replace(/\/+$/,"");function g(e,t={}){if(!e)return!1;let s=h(e),{tunnelPublicUrl:l,tailscaleUrl:a,cloudUrl:r}=t;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(s)||l&&s.startsWith(h(l))||a&&s.startsWith(h(a))||r&&s.startsWith(h(r)))}let f=s(41463).env.NEXT_PUBLIC_CLOUD_URL,y=[{label:"Default",value:""},{label:"200K",value:"198000"},{label:"300K",value:"298000"},{label:"500K",value:"498000"},{label:"1M",value:"998000"}];function b({tool:e,isExpanded:t,onToggle:s,activeProviders:n,modelMappings:o,onModelMappingChange:d,baseUrl:c,hasActiveProviders:m,apiKeys:p,cloudEnabled:h,initialStatus:j,tunnelEnabled:N,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:k}){let C,_,S,[E,A]=(0,a.useState)(j||null),[O,M]=(0,a.useState)(!1),[I,P]=(0,a.useState)(!1),[R,T]=(0,a.useState)(!1),[$,U]=(0,a.useState)(null),[K,D]=(0,a.useState)(!1),[L,z]=(0,a.useState)(!1),[F,q]=(0,a.useState)(null),[H,B]=(0,a.useState)(""),[G,J]=(0,a.useState)({}),[V,W]=(0,a.useState)(!1),[Y,Z]=(0,a.useState)(""),[Q,X]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(""),es=(0,a.useRef)(!1),el=(()=>{if(!E?.installed)return null;let e=E.settings?.env?.ANTHROPIC_BASE_URL;return e?g(e,{tunnelPublicUrl:v,tailscaleUrl:k,cloudUrl:h?f:null})?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{p?.length>0&&!H&&B(p[0].key)},[p,H]),(0,a.useEffect)(()=>{j&&A(j)},[j]),(0,a.useEffect)(()=>{t&&!E&&(ei(),er()),t&&er()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{X(!!e.ccFilterNaming)}).catch(()=>{})},[]);let ea=async e=>{let t=e.target.checked;X(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},er=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&J(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(E?.installed&&!es.current){es.current=!0;let t=E.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&d(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&p?.some(e=>e.key===s)&&B(s),et(t.CLAUDE_CODE_MAX_CONTEXT_TOKENS||"")}},[E,p,e.defaultModels,d]);let ei=async()=>{M(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();A(t)}catch(e){A({installed:!1,error:e.message})}finally{M(!1)}},en=()=>{let e=Y||c;return e.endsWith("/v1")?e:`${e}/v1`},eo=async()=>{P(!0),U(null);try{let t={ANTHROPIC_BASE_URL:en()},s=H?.trim()||(p?.length>0?p[0].key:null)||(h?null:"sk_krouter");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=o[e.alias];s&&e.envKey&&(t[e.envKey]=s)}),ee&&(t.CLAUDE_CODE_MAX_CONTEXT_TOKENS=ee);let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(U({type:"success",text:"Settings applied successfully!"}),A(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):U({type:"error",text:a.error||"Failed to apply settings"})}catch(e){U({type:"error",text:e.message})}finally{P(!1)}},ed=async()=>{T(!0),U(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(U({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>d(e.alias,e.defaultValue||"")),B(""),et("")):U({type:"error",text:s.error||"Failed to reset settings"})}catch(e){U({type:"error",text:e.message})}finally{T(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===el&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===el&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===el&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[O&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!O&&E&&!E.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if kRouter is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>W(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>D(!K),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:K?"expand_less":"help"}),K?"Hide":"How to Install"]})]})]}),K&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!O&&E?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(x,{value:Y||((C=Y||c).endsWith("/v1")?C:`${C}/v1`),onChange:Z,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:N,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:k})]}),E?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:E.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(u,{value:H,onChange:B,apiKeys:p,cloudEnabled:h})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:o[e.alias]||"",onChange:t=>d(e.alias,t.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),o[e.alias]&&(0,l.jsx)("button",{onClick:()=>d(e.alias,""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{q(e.alias),z(!0)},disabled:!m,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${m?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]},e.alias)),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:Q,onChange:ea,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Max context"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("select",{value:ee,onChange:e=>et(e.target.value),className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:y.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.label))}),(0,l.jsx)(r.m_,{text:"Overrides Claude Code's context window (CLAUDE_CODE_MAX_CONTEXT_TOKENS). Applied when you click Apply Settings.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),$&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===$.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===$.type?"check_circle":"error"}),(0,l.jsx)("span",{children:$.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:eo,disabled:!m,loading:I,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:ed,disabled:!E?.hasKRouter,loading:R,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>W(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:L,onClose:()=>z(!1),onSelect:e=>{F&&d(F,e.value)},selectedModel:F?o[F]:null,activeProviders:n,modelAliases:G,title:`Select model for ${F}`}),(0,l.jsx)(r.uR,{isOpen:V,onClose:()=>W(!1),title:"Claude CLI - Manual Configuration",configs:(_=H&&H.trim()?H:h?"<API_KEY_FROM_DASHBOARD>":"sk_krouter",S={ANTHROPIC_BASE_URL:en(),ANTHROPIC_AUTH_TOKEN:_},e.defaultModels.forEach(e=>{let t=o[e.alias];t&&e.envKey&&(S[e.envKey]=t)}),ee&&(S.CLAUDE_CODE_MAX_CONTEXT_TOKENS=ee),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:S},null,2)}])})]})}function j({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:m,tunnelEnabled:p,tunnelPublicUrl:h,tailscaleEnabled:f,tailscaleUrl:y}){let b,N,v,w,[k,C]=(0,a.useState)(m||null),[_,S]=(0,a.useState)(!1),[E,A]=(0,a.useState)(!1),[O,M]=(0,a.useState)(!1),[I,P]=(0,a.useState)(null),[R,T]=(0,a.useState)(!1),[$,U]=(0,a.useState)(""),[K,D]=(0,a.useState)(""),[L,z]=(0,a.useState)(""),[F,q]=(0,a.useState)(!1),[H,B]=(0,a.useState)(!1),[G,J]=(0,a.useState)({}),[V,W]=(0,a.useState)(!1),[Y,Z]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!$&&U(o[0].key)},[o,$]),(0,a.useEffect)(()=>{m&&C(m)},[m]),(0,a.useEffect)(()=>{t&&!k&&(et(),Q()),t&&Q()},[t]);let Q=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&J(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(k?.config){let e=k.config.match(/^model\s*=\s*"([^"]+)"/m);e&&D(e[1]);let t=k.config.match(/^default_subagent_model\s*=\s*"([^"]+)"/m);t&&z(t[1])}},[k]);let X=(()=>{if(!k?.installed)return null;if(!k.config)return"not_configured";let e=k.config.match(/base_url\s*=\s*"([^"]+)"/);return g(e?e[1]:"",{tunnelPublicUrl:h,tailscaleUrl:y})?"configured":"other"})(),ee=()=>{let e=Y||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},et=async()=>{S(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();C(t)}catch(e){C({installed:!1,error:e.message})}finally{S(!1)}},es=async()=>{A(!0),P(null);try{let e=$&&$.trim()||c?$:"sk_krouter",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ee(),apiKey:e,model:K,subagentModel:L||K})}),s=await t.json();t.ok?(P({type:"success",text:"Settings applied successfully!"}),et()):P({type:"error",text:s.error||"Failed to apply settings"})}catch(e){P({type:"error",text:e.message})}finally{A(!1)}},el=async()=>{M(!0),P(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(P({type:"success",text:"Settings reset successfully!"}),D(""),z(""),et()):P({type:"error",text:t.error||"Failed to reset settings"})}catch(e){P({type:"error",text:e.message})}finally{M(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[_&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!_&&k&&!k.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if kRouter is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>W(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>T(!R),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:R?"expand_less":"help"}),R?"Hide":"How to Install"]})]})]}),R&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex reads the key from ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"http_headers"})," in ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/config.toml"})," — a custom provider ignores ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"auth.json"}),', so your ChatGPT login stays untouched. Click "Apply" to auto-configure.']})})]})]})]}),!_&&k?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(x,{value:Y||Y||`${n}/v1`,onChange:Z,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:p,tunnelPublicUrl:h,tailscaleEnabled:f,tailscaleUrl:y})]}),k?.config&&((N=(b=k.config.match(/base_url\s*=\s*"([^"]+)"/))?b[1]:null)?(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:N})]}):null),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(u,{value:$,onChange:U,apiKeys:o,cloudEnabled:c})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:K,onChange:e=>D(e.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),K&&(0,l.jsx)("button",{onClick:()=>D(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>q(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:L,onChange:e=>z(e.target.value),placeholder:K||"provider/model-id (defaults to main model)",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),L&&(0,l.jsx)("button",{onClick:()=>z(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>B(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),I&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===I.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===I.type?"check_circle":"error"}),(0,l.jsx)("span",{children:I.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:es,disabled:!$&&c&&o.length>0||!K,loading:E,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:el,disabled:O,loading:O,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>W(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:F,onClose:()=>q(!1),onSelect:e=>{D(e.value),L||z(e.value),q(!1)},selectedModel:K,activeProviders:d,modelAliases:G,title:"Select Model for Codex"}),(0,l.jsx)(r.rq,{isOpen:H,onClose:()=>B(!1),onSelect:e=>{z(e.value),B(!1)},selectedModel:L,activeProviders:d,modelAliases:G,title:"Select Subagent Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:V,onClose:()=>W(!1),title:"Codex CLI - Manual Configuration",configs:(v=$&&$.trim()?$:c?"<API_KEY_FROM_DASHBOARD>":"sk_krouter",w=L||K,[{filename:"~/.codex/config.toml",content:`# kRouter Configuration for Codex CLI
40
- model = "${K}"
39
+ # Fetch and follow .opencode/INSTALL.md from the repo`}}}},40295:e=>{e.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["runtime.us-east-1.kiro.dev","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"],claude:["api.anthropic.com"]}}},43666:(e,t,s)=>{s.d(t,{Tk:()=>b,aG:()=>P,Ah:()=>j,h1:()=>I,Q6:()=>M,lF:()=>$,a7:()=>S,ZM:()=>v,RF:()=>C,mW:()=>U,c9:()=>R,gY:()=>H,tA:()=>D,kn:()=>z,yZ:()=>w,qO:()=>E});var l=s(95155),a=s(12115),r=s(35497),i=s(5772),n=s(90620);let o="krouter.cliToolEndpointPresets",d="__custom__",c="__save__",m=e=>{window.localStorage.setItem(o,JSON.stringify(e))};function x({value:e,onChange:t,requiresExternalUrl:s=!1,tunnelEnabled:r=!1,tunnelPublicUrl:i="",tailscaleEnabled:p=!1,tailscaleUrl:u="",cloudEnabled:h=!1,cloudUrl:g="",withV1:f=!0}){let[y,b]=(0,a.useState)([]),[j,N]=(0,a.useState)(""),[v,w]=(0,a.useState)(""),k=(0,a.useRef)(!1);(0,a.useEffect)(()=>{b((()=>{try{let e=window.localStorage.getItem(o),t=JSON.parse(e||"[]");if(!Array.isArray(t))return[];return t.filter(e=>e?.name&&e?.baseUrl)}catch{return[]}})())},[]);let C=(0,a.useMemo)(()=>(({requiresExternalUrl:e,tunnelEnabled:t,tunnelPublicUrl:s,tailscaleEnabled:l,tailscaleUrl:a,cloudEnabled:r,cloudUrl:i,savedPresets:o,withV1:c})=>{let m=[],x=e=>{let t;return c?(t=(e||"").replace(/\/+$/,""))?/\/v1$/.test(t)?t:`${t}/v1`:"":(e||"").replace(/\/+$/,"")};if(!e){let e=x(`http://127.0.0.1:${n.h0.appPort}`);m.push({value:"local",label:e,url:e})}if(t&&s){let e=x(s);m.push({value:"tunnel",label:e,url:e})}if(l&&a){let e=x(a);m.push({value:"tailscale",label:e,url:e})}if(r&&i){let e=x(i);m.push({value:"cloud",label:e,url:e})}return o.forEach(e=>{m.push({value:`saved:${e.name}`,label:e.baseUrl,url:e.baseUrl,saved:!0})}),m.push({value:d,label:"Custom URL...",url:""}),m})({requiresExternalUrl:s,tunnelEnabled:r,tunnelPublicUrl:i,tailscaleEnabled:p,tailscaleUrl:u,cloudEnabled:h,cloudUrl:g,savedPresets:y,withV1:f}),[s,r,i,p,u,h,g,y,f]);(0,a.useEffect)(()=>{if(k.current||0===C.length)return;k.current=!0;let e=C.find(e=>e.value!==d);e?(N(e.value),t(e.url)):N(d)},[C,t]);let _=j.startsWith("saved:"),S=j===d,E=S&&(v||"").trim().length>0;return(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("select",{value:j,onChange:s=>{let l=s.target.value;if(l===c){let t=(e||"").trim();if(!t)return;let s=t;try{s=new URL(t).host}catch{}let l=window.prompt("Save endpoint as:",s);if(!l?.trim())return;let a=[...y.filter(e=>e.name!==l.trim()),{name:l.trim(),baseUrl:t}].sort((e,t)=>e.name.localeCompare(t.name));b(a),m(a);return}if(N(l),l===d){w(""),t("");return}let a=C.find(e=>e.value===l);a&&t(a.url)},className:"flex-1 min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[C.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value)),E&&(0,l.jsx)("option",{value:c,children:"+ Save current as..."})]}),_&&(0,l.jsx)("button",{type:"button",onClick:()=>{if(!j.startsWith("saved:"))return;let e=j.slice(6),s=y.filter(t=>t.name!==e);b(s),m(s),N(d),w(""),t("")},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),S&&(0,l.jsx)("input",{type:"text",value:v,onChange:e=>{let s=e.target.value;w(s),t(s)},placeholder:f?"https://example.com/v1":"https://example.com",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let p="__custom__";function u({value:e,onChange:t,apiKeys:s=[],cloudEnabled:r=!1,className:i=""}){let n=!s.some(t=>t.key===e)&&""!==e,[o,d]=(0,a.useState)(()=>e?s.some(t=>t.key===e)?e:p:s.length>0?s[0].key:p),[c,m]=(0,a.useState)(n?e:"");return 0===s.length&&o!==p&&o!==p?(0,l.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${i}`,children:r?"No API keys - Create one in Keys page":"sk_krouter (default)"}):(0,l.jsxs)("div",{className:`flex flex-col gap-1.5 ${i}`,children:[(0,l.jsxs)("select",{value:o,onChange:e=>{let s=e.target.value;d(s),s===p?(m(""),t("")):t(s)},className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[s.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id)),(0,l.jsx)("option",{value:p,children:"Custom..."})]}),o===p&&(0,l.jsx)("input",{type:"text",value:c,onChange:e=>{let s=e.target.value;m(s),t(s)},placeholder:"sk-...",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let h=e=>(e||"").replace(/\/+$/,"");function g(e,t={}){if(!e)return!1;let s=h(e),{tunnelPublicUrl:l,tailscaleUrl:a,cloudUrl:r}=t;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(s)||l&&s.startsWith(h(l))||a&&s.startsWith(h(a))||r&&s.startsWith(h(r)))}let f=s(41463).env.NEXT_PUBLIC_CLOUD_URL,y=[{label:"Default",value:""},{label:"200K",value:"198000"},{label:"300K",value:"298000"},{label:"500K",value:"498000"},{label:"1M",value:"998000"}];function b({tool:e,isExpanded:t,onToggle:s,activeProviders:n,modelMappings:o,onModelMappingChange:d,baseUrl:c,hasActiveProviders:m,apiKeys:p,cloudEnabled:h,initialStatus:j,tunnelEnabled:N,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:k}){let C,_,S,[E,A]=(0,a.useState)(j||null),[O,M]=(0,a.useState)(!1),[I,P]=(0,a.useState)(!1),[R,T]=(0,a.useState)(!1),[$,U]=(0,a.useState)(null),[K,D]=(0,a.useState)(!1),[L,z]=(0,a.useState)(!1),[F,q]=(0,a.useState)(null),[H,B]=(0,a.useState)(""),[G,J]=(0,a.useState)({}),[V,W]=(0,a.useState)(!1),[Y,Z]=(0,a.useState)(""),[Q,X]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(""),es=(0,a.useRef)(!1),el=(()=>{if(!E?.installed)return null;let e=E.settings?.env?.ANTHROPIC_BASE_URL;return e?g(e,{tunnelPublicUrl:v,tailscaleUrl:k,cloudUrl:h?f:null})?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{p?.length>0&&!H&&B(p[0].key)},[p,H]),(0,a.useEffect)(()=>{j&&A(j)},[j]),(0,a.useEffect)(()=>{t&&!E&&(ei(),er()),t&&er()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{X(!!e.ccFilterNaming)}).catch(()=>{})},[]);let ea=async e=>{let t=e.target.checked;X(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},er=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&J(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(E?.installed&&!es.current){es.current=!0;let t=E.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&d(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&p?.some(e=>e.key===s)&&B(s),et(t.CLAUDE_CODE_MAX_CONTEXT_TOKENS||"")}},[E,p,e.defaultModels,d]);let ei=async()=>{M(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();A(t)}catch(e){A({installed:!1,error:e.message})}finally{M(!1)}},en=()=>{let e=Y||c;return e.endsWith("/v1")?e:`${e}/v1`},eo=async()=>{P(!0),U(null);try{let t={ANTHROPIC_BASE_URL:en()},s=H?.trim()||(p?.length>0?p[0].key:null)||(h?null:"sk_krouter");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=o[e.alias];s&&e.envKey&&(t[e.envKey]=s)}),ee&&(t.CLAUDE_CODE_MAX_CONTEXT_TOKENS=ee);let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(U({type:"success",text:"Settings applied successfully!"}),A(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):U({type:"error",text:a.error||"Failed to apply settings"})}catch(e){U({type:"error",text:e.message})}finally{P(!1)}},ed=async()=>{T(!0),U(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(U({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>d(e.alias,e.defaultValue||"")),B(""),et("")):U({type:"error",text:s.error||"Failed to reset settings"})}catch(e){U({type:"error",text:e.message})}finally{T(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===el&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===el&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===el&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[O&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!O&&E&&!E.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if kRouter is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>W(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>D(!K),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:K?"expand_less":"help"}),K?"Hide":"How to Install"]})]})]}),K&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!O&&E?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(x,{value:Y||((C=Y||c).endsWith("/v1")?C:`${C}/v1`),onChange:Z,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:N,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:k})]}),E?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:E.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(u,{value:H,onChange:B,apiKeys:p,cloudEnabled:h})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:o[e.alias]||"",onChange:t=>d(e.alias,t.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),o[e.alias]&&(0,l.jsx)("button",{onClick:()=>d(e.alias,""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{q(e.alias),z(!0)},disabled:!m,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${m?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]},e.alias)),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:Q,onChange:ea,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Max context"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("select",{value:ee,onChange:e=>et(e.target.value),className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:y.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.label))}),(0,l.jsx)(r.m_,{text:"Overrides Claude Code's context window (CLAUDE_CODE_MAX_CONTEXT_TOKENS). Applied when you click Apply Settings.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),$&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===$.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===$.type?"check_circle":"error"}),(0,l.jsx)("span",{children:$.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:eo,disabled:!m,loading:I,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:ed,disabled:!E?.hasKRouter,loading:R,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>W(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:L,onClose:()=>z(!1),onSelect:e=>{F&&d(F,e.value)},selectedModel:F?o[F]:null,activeProviders:n,modelAliases:G,title:`Select model for ${F}`}),(0,l.jsx)(r.uR,{isOpen:V,onClose:()=>W(!1),title:"Claude CLI - Manual Configuration",configs:(_=H&&H.trim()?H:h?"<API_KEY_FROM_DASHBOARD>":"sk_krouter",S={ANTHROPIC_BASE_URL:en(),ANTHROPIC_AUTH_TOKEN:_},e.defaultModels.forEach(e=>{let t=o[e.alias];t&&e.envKey&&(S[e.envKey]=t)}),ee&&(S.CLAUDE_CODE_MAX_CONTEXT_TOKENS=ee),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:S},null,2)}])})]})}function j({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:m,tunnelEnabled:p,tunnelPublicUrl:h,tailscaleEnabled:f,tailscaleUrl:y}){let b,N,[v,w]=(0,a.useState)(m||null),[k,C]=(0,a.useState)(!1),[_,S]=(0,a.useState)(!1),[E,A]=(0,a.useState)(!1),[O,M]=(0,a.useState)(null),[I,P]=(0,a.useState)(!1),[R,T]=(0,a.useState)(""),[$,U]=(0,a.useState)(""),[K,D]=(0,a.useState)(""),[L,z]=(0,a.useState)(!1),[F,q]=(0,a.useState)(!1),[H,B]=(0,a.useState)({}),[G,J]=(0,a.useState)(!1),[V,W]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!R&&T(o[0].key)},[o,R]),(0,a.useEffect)(()=>{m&&w(m)},[m]),(0,a.useEffect)(()=>{t&&!v&&(et(),Y()),t&&Y()},[t]);let Y=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&B(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(v?.config){let e=v.config.match(/^model\s*=\s*"([^"]+)"/m);e&&U(e[1]);let t=v.config.match(/^default_subagent_model\s*=\s*"([^"]+)"/m);t&&D(t[1])}},[v]);let Z=v?.activeProvider?.baseUrl||"",Q=v?.activeProvider?.apiKey||"";(0,a.useEffect)(()=>{Q&&o?.some(e=>e.key===Q)&&T(Q)},[Q,o]);let X=v?.installed?v.config?g(Z,{tunnelPublicUrl:h,tailscaleUrl:y})?"configured":"other":"not_configured":null,ee=()=>{let e=(V||`${n}/v1`).replace(/\/+$/,"");return e.endsWith("/v1")?e:`${e}/v1`},et=async()=>{C(!0);try{let e=await fetch("/api/cli-tools/codex-settings",{cache:"no-store"}),t=await e.json();w(t)}catch(e){w({installed:!1,error:e.message})}finally{C(!1)}},es=async()=>{S(!0),M(null);try{let e=R&&R.trim()||c?R:"sk_krouter",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ee(),apiKey:e,model:$,subagentModel:K||$})}),s=await t.json();t.ok?(M({type:"success",text:"Settings applied successfully!"}),et()):M({type:"error",text:s.error||"Failed to apply settings"})}catch(e){M({type:"error",text:e.message})}finally{S(!1)}},el=async()=>{A(!0),M(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(M({type:"success",text:"Settings reset successfully!"}),U(""),D(""),et()):M({type:"error",text:t.error||"Failed to reset settings"})}catch(e){M({type:"error",text:e.message})}finally{A(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[k&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!k&&v&&!v.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if kRouter is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>J(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>P(!I),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:I?"expand_less":"help"}),I?"Hide":"How to Install"]})]})]}),I&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex reads the key from ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"http_headers"})," in ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/config.toml"})," — a custom provider ignores ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"auth.json"}),', so your ChatGPT login stays untouched. Click "Apply" to auto-configure.']})})]})]})]}),!k&&v?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(x,{value:V||V||`${n}/v1`,onChange:W,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:p,tunnelPublicUrl:h,tailscaleEnabled:f,tailscaleUrl:y})]}),Z&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:Z})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(u,{value:R,onChange:T,apiKeys:o,cloudEnabled:c})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:$,onChange:e=>U(e.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),$&&(0,l.jsx)("button",{onClick:()=>U(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>z(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:K,onChange:e=>D(e.target.value),placeholder:$||"provider/model-id (defaults to main model)",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),K&&(0,l.jsx)("button",{onClick:()=>D(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>q(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),O&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===O.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===O.type?"check_circle":"error"}),(0,l.jsx)("span",{children:O.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:es,disabled:!R&&c&&o.length>0||!$,loading:_,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:el,disabled:E,loading:E,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>J(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:L,onClose:()=>z(!1),onSelect:e=>{U(e.value),K||D(e.value),z(!1)},selectedModel:$,activeProviders:d,modelAliases:H,title:"Select Model for Codex"}),(0,l.jsx)(r.rq,{isOpen:F,onClose:()=>q(!1),onSelect:e=>{D(e.value),q(!1)},selectedModel:K,activeProviders:d,modelAliases:H,title:"Select Subagent Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:G,onClose:()=>J(!1),title:"Codex CLI - Manual Configuration",configs:(b=R&&R.trim()?R:c?"<API_KEY_FROM_DASHBOARD>":"sk_krouter",N=K||$,[{filename:"~/.codex/config.toml",content:`# kRouter Configuration for Codex CLI
40
+ model = "${$}"
41
41
  model_provider = "krouter"
42
42
 
43
43
  [model_providers.krouter]
@@ -46,10 +46,10 @@ base_url = "${ee()}"
46
46
  wire_api = "responses"
47
47
 
48
48
  [model_providers.krouter.http_headers]
49
- Authorization = "Bearer ${v}"
49
+ Authorization = "Bearer ${b}"
50
50
 
51
51
  [agents]
52
- default_subagent_model = "${w}"
52
+ default_subagent_model = "${N}"
53
53
  `}])})]})}let N=s(41463).env.NEXT_PUBLIC_CLOUD_URL;function v({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:m,initialStatus:p,tunnelEnabled:h,tunnelPublicUrl:f,tailscaleEnabled:y,tailscaleUrl:b}){let j,w,k,C,[_,S]=(0,a.useState)(p||null),[E,A]=(0,a.useState)(!1),[O,M]=(0,a.useState)(!1),[I,P]=(0,a.useState)(!1),[R,T]=(0,a.useState)(null),[$,U]=(0,a.useState)(""),[K,D]=(0,a.useState)([]),[L,z]=(0,a.useState)(""),[F,q]=(0,a.useState)(!1),[H,B]=(0,a.useState)({}),[G,J]=(0,a.useState)(!1),[V,W]=(0,a.useState)(!1),[Y,Z]=(0,a.useState)(""),Q=(0,a.useRef)(!1),X=(()=>{if(!_?.installed)return null;let e=_.settings?.customModels?.find(isOurCustomEntry);return e?g(e.baseUrl,{tunnelPublicUrl:f,tailscaleUrl:b,cloudUrl:m?N:null})?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{d?.length>0&&!$&&U(d[0].key)},[d,$]),(0,a.useEffect)(()=>{p&&S(p)},[p]),(0,a.useEffect)(()=>{t&&!_&&(et(),ee()),t&&ee()},[t]);let ee=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&B(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(_?.installed&&!Q.current){Q.current=!0;let e=(_.settings?.customModels||[]).filter(isOurCustomEntry).sort((e,t)=>(e.index||0)-(t.index||0)).map(e=>e.model);if(e.length>0)D(e);else{let e=_.settings?.customModels?.find(e=>"custom:kRouter-0"===e.id);e?.model&&D([e.model])}}},[_]);let et=async()=>{A(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();S(t)}catch(e){S({installed:!1,error:e.message})}finally{A(!1)}},es=()=>{let e=Y||n;return e.endsWith("/v1")?e:`${e}/v1`},el=()=>{let e=L.trim();!e||K.includes(e)||(D(t=>[...t,e]),z(""))},ea=async()=>{M(!0),T(null);try{let e=$?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_krouter"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:es(),apiKey:e,models:K,activeModel:K[0]||""})}),s=await t.json();t.ok?(T({type:"success",text:"Settings applied successfully!"}),et()):T({type:"error",text:s.error||"Failed to apply settings"})}catch(e){T({type:"error",text:e.message})}finally{M(!1)}},er=async()=>{P(!0),T(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(T({type:"success",text:"Settings reset successfully!"}),D([]),et()):T({type:"error",text:t.error||"Failed to reset settings"})}catch(e){T({type:"error",text:e.message})}finally{P(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===X&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[E&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!E&&_&&!_.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if kRouter is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>J(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>W(!V),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:V?"expand_less":"help"}),V?"Hide":"How to Install"]})]})]}),V&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"curl -fsSL https://app.factory.ai/cli | sh"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!E&&_?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(x,{value:Y||((j=Y||n).endsWith("/v1")?j:`${j}/v1`),onChange:Z,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:h,tunnelPublicUrl:f,tailscaleEnabled:y,tailscaleUrl:b})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(u,{value:$,onChange:U,apiKeys:d,cloudEnabled:m})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsxs)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:["Models ",K.length>0&&(0,l.jsxs)("span",{className:"text-primary",children:["(",K.length,")"]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[K.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:K.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,l.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:e}),(0,l.jsx)("button",{onClick:()=>D(t=>t.filter(t=>t!==e)),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("input",{type:"text",value:L,onChange:e=>z(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),el())},placeholder:"provider/model-id",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,l.jsx)("button",{onClick:()=>q(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,l.jsx)("button",{onClick:el,disabled:!L.trim(),className:"px-2 py-1.5 rounded border bg-surface border-border hover:border-primary text-xs shrink-0 disabled:opacity-50",title:"Add model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),R&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===R.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===R.type?"check_circle":"error"}),(0,l.jsx)("span",{children:R.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ea,disabled:0===K.length,loading:O,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:er,disabled:!_?.hasKRouter,loading:I,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>J(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:F,onClose:()=>q(!1),onSelect:e=>{!e.value||K.includes(e.value)||(D(t=>[...t,e.value]),q(!1))},selectedModel:null,activeProviders:c,modelAliases:H,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:G,onClose:()=>J(!1),title:"Factory Droid - Manual Configuration",configs:(w=$&&$.trim()?$:m?"<API_KEY_FROM_DASHBOARD>":"sk_krouter",k={customModels:K.map((e,t)=>({model:e,id:`custom:kRouter-${t}`,index:t,baseUrl:es(),apiKey:w,displayName:e,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},C="u">typeof navigator&&navigator.platform,[{filename:C?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(k,null,2)}])})]})}function w({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:m,initialStatus:p,tunnelEnabled:h,tunnelPublicUrl:f,tailscaleEnabled:y,tailscaleUrl:b}){let j,N,[v,k]=(0,a.useState)(p||null),[C,_]=(0,a.useState)(!1),[S,E]=(0,a.useState)(!1),[A,O]=(0,a.useState)(!1),[M,I]=(0,a.useState)(null),[P,R]=(0,a.useState)(""),[T,$]=(0,a.useState)(""),[U,K]=(0,a.useState)({}),[D,L]=(0,a.useState)(null),[z,F]=(0,a.useState)(!1),[q,H]=(0,a.useState)({}),[B,G]=(0,a.useState)(!1),[J,V]=(0,a.useState)(""),W=(0,a.useRef)(!1),Y=()=>v?.settings?.models?.providers?.krouter??null,Z=(()=>{if(!v?.installed)return null;let e=Y();return e?g(e.baseUrl,{tunnelPublicUrl:f,tailscaleUrl:b})?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{d?.length>0&&!P&&R(d[0].key)},[d,P]),(0,a.useEffect)(()=>{p&&k(p)},[p]),(0,a.useEffect)(()=>{t&&!v&&(X(),Q()),t&&Q()},[t]);let Q=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&H(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(v?.installed&&!W.current){W.current=!0;let e=Y();if(e){let t=v.settings?.agents?.defaults?.model?.primary;t&&$(t.replace(/^krouter\//,"")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&R(e.apiKey)}let t=v.agents||[],s={};t.forEach(e=>{e.currentModel&&(s[e.id]=e.currentModel)}),K(s)}},[v,d]);let X=async()=>{_(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();k(t)}catch(e){k({installed:!1,error:e.message})}finally{_(!1)}},ee=()=>window.location.origin.replace("://localhost","://127.0.0.1"),et=()=>{let e=J||ee();return e.endsWith("/v1")?e:`${e}/v1`},es=async()=>{E(!0),I(null);try{let e=P?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_krouter"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:et(),apiKey:e,model:T,agentModels:U})}),s=await t.json();t.ok?(I({type:"success",text:"Settings applied successfully!"}),X()):I({type:"error",text:s.error||"Failed to apply settings"})}catch(e){I({type:"error",text:e.message})}finally{E(!1)}},el=async()=>{O(!0),I(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(I({type:"success",text:"Settings reset successfully!"}),$(""),R(""),X()):I({type:"error",text:t.error||"Failed to reset settings"})}catch(e){I({type:"error",text:e.message})}finally{O(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===Z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===Z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===Z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[C&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!C&&v&&!v.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if kRouter is deployed on a remote server."})]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>G(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!C&&v?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(x,{value:J||((j=J||ee()).endsWith("/v1")?j:`${j}/v1`),onChange:V,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:h,tunnelPublicUrl:f,tailscaleEnabled:y,tailscaleUrl:b})]}),Y()?.baseUrl&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:Y()?.baseUrl})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(u,{value:P,onChange:R,apiKeys:d,cloudEnabled:m})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:T,onChange:e=>$(e.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),T&&(0,l.jsx)("button",{onClick:()=>$(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{L(null),F(!0)},disabled:!o,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(v.agents||[]).filter(e=>e.agentDir).map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,l.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:e.name||e.id,children:["Agent ",e.name||e.id]}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:U[e.id]||"",onChange:t=>K(s=>({...s,[e.id]:t.target.value})),placeholder:`default (${T||"provider/model-id"})`,className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),U[e.id]&&(0,l.jsx)("button",{onClick:()=>K(t=>({...t,[e.id]:""})),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{L(e.id),F(!0)},disabled:!o,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},e.id))]}),M&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===M.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===M.type?"check_circle":"error"}),(0,l.jsx)("span",{children:M.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:es,disabled:!T,loading:S,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:el,disabled:!v?.hasKRouter,loading:A,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>G(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:z,onClose:()=>F(!1),onSelect:e=>{D?(K(t=>({...t,[D]:e.value})),L(null)):$(e.value),F(!1)},selectedModel:T,activeProviders:c,modelAliases:q,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:B,onClose:()=>G(!1),title:"Open Claw - Manual Configuration",configs:(N=P&&P.trim()?P:m?"<API_KEY_FROM_DASHBOARD>":"sk_krouter",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`krouter/${T||"provider/model-id"}`}}},models:{providers:{krouter:{baseUrl:et(),apiKey:N,api:"openai-completions",models:[{id:T||"provider/model-id",name:(T||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let k="/api/cli-tools/hermes-settings";function C({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:m,initialStatus:p,tunnelEnabled:h,tunnelPublicUrl:f,tailscaleEnabled:y,tailscaleUrl:b}){let j,[N,v]=(0,a.useState)(p||null),[w,_]=(0,a.useState)(!1),[S,E]=(0,a.useState)(!1),[A,O]=(0,a.useState)(!1),[M,I]=(0,a.useState)(null),[P,R]=(0,a.useState)(""),[T,$]=(0,a.useState)(""),[U,K]=(0,a.useState)(!1),[D,L]=(0,a.useState)({}),[z,F]=(0,a.useState)(!1),[q,H]=(0,a.useState)(""),B=(0,a.useRef)(!1),G=(()=>{if(!N?.installed)return null;let e=N.settings?.model;return e?.base_url?g(e.base_url,{tunnelPublicUrl:f,tailscaleUrl:b})?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{d?.length>0&&!P&&R(d[0].key)},[d,P]),(0,a.useEffect)(()=>{p&&v(p)},[p]),(0,a.useEffect)(()=>{t&&!N&&(V(),J()),t&&J()},[t]);let J=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(N?.installed&&!B.current){B.current=!0;let e=N.settings?.model;e?.default&&$(e.default)}},[N]);let V=async()=>{_(!0);try{let e=await fetch(k),t=await e.json();v(t)}catch(e){v({installed:!1,error:e.message})}finally{_(!1)}},W=()=>{let e=q||window.location.origin.replace("://localhost","://127.0.0.1");return e.endsWith("/v1")?e:`${e}/v1`},Y=async()=>{E(!0),I(null);try{let e=P?.trim()||(d?.length>0?d[0].key:null)||(m?null:"sk_krouter"),t=await fetch(k,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:W(),apiKey:e,model:T})}),s=await t.json();t.ok?(I({type:"success",text:"Settings applied successfully!"}),V()):I({type:"error",text:s.error||"Failed to apply settings"})}catch(e){I({type:"error",text:e.message})}finally{E(!1)}},Z=async()=>{O(!0),I(null);try{let e=await fetch(k,{method:"DELETE"}),t=await e.json();e.ok?(I({type:"success",text:"Settings reset successfully!"}),$(""),V()):I({type:"error",text:t.error||"Failed to reset settings"})}catch(e){I({type:"error",text:e.message})}finally{O(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/hermes.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[w&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Hermes Agent..."})]}),!w&&N&&!N.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Install: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash"})]})]}),(0,l.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 pl-0 sm:pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>F(!0),className:"w-full sm:w-auto !bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!w&&N?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(x,{value:q||W(),onChange:H,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:h,tunnelPublicUrl:f,tailscaleEnabled:y,tailscaleUrl:b})]}),N?.settings?.model?.base_url&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:N.settings.model.base_url})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(u,{value:P,onChange:R,apiKeys:d,cloudEnabled:m})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:T,onChange:e=>$(e.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),T&&(0,l.jsx)("button",{onClick:()=>$(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>K(!0),disabled:!o,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})]}),M&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===M.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===M.type?"check_circle":"error"}),(0,l.jsx)("span",{children:M.text})]}),(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Y,disabled:!T,loading:S,className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Z,disabled:!N?.hasKRouter,loading:A,className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>F(!0),className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:U,onClose:()=>K(!1),onSelect:e=>{$(e.value),K(!1)},selectedModel:T,activeProviders:c,modelAliases:D,title:"Select Model for Hermes Agent"}),(0,l.jsx)(r.uR,{isOpen:z,onClose:()=>F(!1),title:"Hermes Agent - Manual Configuration",configs:(j=P&&P.trim()?P:m?"<API_KEY_FROM_DASHBOARD>":"sk_krouter",[{filename:"~/.hermes/config.yaml",content:`model:
54
54
  default: "${T||"provider/model-id"}"
55
55
  provider: "custom"
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{20018:(e,t,s)=>{Promise.resolve().then(s.bind(s,80191))},80191:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var l=s(95155),a=s(12115),i=s(44923),r=s(87256),o=s(39768),n=s(5020),d=s(35497),c=s(11059);s(52679);let m=/^[a-zA-Z0-9_.\-]+$/,x=[{key:"vision",label:"Vision",icon:"visibility",desc:"Images",emptyHint:"Pick a vision model. Image requests are not rerouted until you add one."},{key:"audioInput",label:"Audio",icon:"graphic_eq",desc:"Audio input",emptyHint:"Pick an audio model. Audio requests are not rerouted until you add one."}],p={enabled:!0,roundRobin:!1,models:[]},u={vision:{...p},pdf:{...p},audioInput:{...p},videoInput:{...p}};function h(){let[e,t]=(0,a.useState)([]),[s,i]=(0,a.useState)(!0),[r,o]=(0,a.useState)(!1),[n,m]=(0,a.useState)(null),[h,b]=(0,a.useState)([]),[j,y]=(0,a.useState)({}),[N,w]=(0,a.useState)(u),[k,C]=(0,a.useState)(null),{copied:S,copy:$}=(0,c.C)();(0,a.useEffect)(()=>{A()},[]);let A=async()=>{try{let[s,l,a]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),i=await s.json(),r=await l.json(),o=a.ok?await a.json():{};s.ok&&t((i.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),l.ok&&b(r.connections||[]),y(o.comboStrategies||{});let n=o.capacityAdapter||{},d={...u};for(let t of x){var e;d[t.key]=(e=n[t.key],Array.isArray(e)?{enabled:!0,roundRobin:!1,models:e.map(e=>e?.model||e).filter(Boolean)}:e&&"object"==typeof e?{enabled:!1!==e.enabled,roundRobin:!!e.roundRobin,models:Array.isArray(e.models)?e.models.filter(Boolean):[]}:{...p})}w(d)}catch(e){console.log("Error fetching data:",e)}finally{i(!1)}},M=async e=>{w(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({capacityAdapter:e})})}catch(e){console.log("Error updating capacity adapter:",e)}},E=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await A(),o(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},P=async(e,t)=>{try{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await A(),m(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},O=async s=>{C({title:"Delete Combo",message:"Delete this combo?",onConfirm:async()=>{C(null);try{(await fetch(`/api/combos/${s}`,{method:"DELETE"})).ok&&t(e.filter(e=>e.id!==s))}catch(e){console.log("Error deleting combo:",e)}}})},_=async(e,t)=>{try{let s={...j},l={...s[e]||{},...t};l.fallbackStrategy&&"fallback"!==l.fallbackStrategy?s[e]=l:delete s[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})}),y(s)}catch(e){console.log("Error updating combo strategy:",e)}};return s?(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(d.Qv,{}),(0,l.jsx)(d.Qv,{})]}):(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:"Combos"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Create model combos with fallback support"})]}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>o(!0),className:"w-full sm:w-auto",children:"Create Combo"})]}),0===e.length?(0,l.jsx)(d.Zp,{children:(0,l.jsxs)("div",{className:"text-center py-12",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>o(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,l.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>(0,l.jsx)(f,{combo:e,activeProviders:h,copied:S,onCopy:$,onEdit:()=>m(e),onDelete:()=>O(e.id),strategy:j[e.name]||{},onSetStrategy:t=>_(e.name,t)},e.id))}),(0,l.jsx)(g,{capacityAdapter:N,onChange:M,activeProviders:h}),(0,l.jsx)(v,{isOpen:r,onClose:()=>o(!1),onSave:E,activeProviders:h},"create"),(0,l.jsx)(v,{isOpen:!!n,combo:n,onClose:()=>m(null),onSave:e=>P(n.id,e),activeProviders:h},n?.id||"new"),(0,l.jsx)(d.uo,{isOpen:!!k,onClose:()=>C(null),onConfirm:k?.onConfirm,title:k?.title||"Confirm",message:k?.message,variant:"danger"})]})}let b=[{value:"fallback",label:"Fallback — try in order"},{value:"round-robin",label:"Round Robin — rotate"},{value:"fusion",label:"Fusion — panel + judge"}];function f({combo:e,activeProviders:t=[],copied:s,onCopy:i,onEdit:r,onDelete:o,strategy:n={},onSetStrategy:c}){let[m,x]=(0,a.useState)(!1),p=n.fallbackStrategy||"fallback",u=n.judgeModel||"";return(0,l.jsxs)(d.Zp,{padding:"sm",className:"group",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,l.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,l.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1.5 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[220px]",children:e},t)),e.models.length>3&&(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]}),"fusion"===p&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Judge"}),(0,l.jsxs)("button",{onClick:()=>x(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",title:"Pick the model that fuses panel answers",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"gavel"}),(0,l.jsx)("span",{className:"truncate",children:u||`Auto — ${e.models[0]||"first model"}`})]}),u&&(0,l.jsx)("button",{onClick:()=>c({judgeModel:""}),className:"p-0.5 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-colors",title:"Reset judge to Auto",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]})]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,l.jsx)("div",{className:"w-full sm:w-[200px]",children:(0,l.jsx)(d.l6,{options:b,value:p,onChange:e=>c({fallbackStrategy:e.target.value}),selectClassName:"py-1.5 text-xs"})}),(0,l.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,l.jsxs)("button",{onClick:t=>{t.stopPropagation(),i(e.name,`combo-${e.id}`)},className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Copy combo name",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:s===`combo-${e.id}`?"check":"content_copy"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,l.jsxs)("button",{onClick:r,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Edit",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,l.jsxs)("button",{onClick:o,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 transition-colors hover:bg-red-500/10",title:"Delete",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]}),(0,l.jsx)(d.rq,{isOpen:m,onClose:()=>x(!1),onSelect:e=>{c({judgeModel:e?.value||""}),x(!1)},activeProviders:t,title:"Select Judge Model",addedModelValues:u?[u]:[],closeOnSelect:!0})]})}function g({capacityAdapter:e,onChange:t,activeProviders:s}){return(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:"Vision Adapter"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Your model can't read image/audio? Auto-switches to a model in the pool below."}),(0,l.jsxs)("ul",{className:"mt-1.5 text-[11px] text-text-muted flex flex-col gap-0.5",children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Vision"})," — images (png, jpg, webp, …)"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Audio"})," — audio input"]})]})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-4",children:x.map(a=>(0,l.jsx)(j,{cap:a,entry:e[a.key]||p,onChange:s=>t({...e,[a.key]:s}),activeProviders:s},a.key))})]})}function j({cap:e,entry:t,onChange:s,activeProviders:i}){let[r,o]=(0,a.useState)(!1),{enabled:n,roundRobin:c,models:m}=t,x=e=>s({...t,...e}),p=(e,t)=>{let s=e+t;if(s<0||s>=m.length)return;let l=[...m];[l[e],l[s]]=[l[s],l[e]],x({models:l})};return(0,l.jsxs)(d.Zp,{padding:"sm",className:`group ${!n?"opacity-50":""}`,children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2.5 sm:items-center",children:[(0,l.jsx)(d.lM,{checked:n,onChange:e=>x({enabled:e}),"aria-label":`Enable ${e.label} adapter`}),(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:e.icon})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("code",{className:"font-mono text-sm font-medium",children:e.label}),(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["— ",e.desc]})]}),(0,l.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===m.length&&n?(0,l.jsx)("span",{className:"text-xs text-amber-600 dark:text-amber-400",children:e.emptyHint}):0===m.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):m.slice(0,3).map((e,t)=>(0,l.jsxs)("code",{className:"group/chip inline-flex items-center gap-1 rounded bg-black/5 px-1.5 py-0.5 font-mono text-xs text-text-muted dark:bg-white/5",children:[(0,l.jsx)("span",{children:e}),(0,l.jsx)("button",{onClick:()=>p(t,-1),disabled:0===t,className:`leading-none opacity-0 group-hover/chip:opacity-100 ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary"}`,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,l.jsx)("button",{onClick:()=>p(t,1),disabled:t===m.length-1,className:`leading-none opacity-0 group-hover/chip:opacity-100 ${t===m.length-1?"text-text-muted/20":"text-text-muted hover:text-primary"}`,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})}),(0,l.jsx)("button",{onClick:()=>{x({models:m.filter((e,s)=>s!==t)})},className:"leading-none opacity-0 group-hover/chip:opacity-100 text-text-muted hover:text-red-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},`${e}-${t}`)),m.length>3&&(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",m.length-3," more"]})]})]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer select-none",children:[(0,l.jsx)(d.lM,{checked:c,onChange:e=>x({roundRobin:e}),disabled:!n,"aria-label":`Round-robin ${e.label} adapter`}),(0,l.jsx)("span",{children:"Round"})]}),(0,l.jsx)(d.$n,{icon:"add",variant:"ghost",size:"sm",onClick:()=>o(!0),disabled:!n,title:`Add ${e.label} model`,children:"Add Model"})]})]}),r&&(0,l.jsx)(d.rq,{isOpen:r,onClose:()=>o(!1),onSelect:e=>{m.includes(e.value)||x({models:[...m,e.value]})},activeProviders:i,title:`Add ${e.label} Model`,addedModelValues:m,capFilter:e.key,closeOnSelect:!1})]})}function y({id:e,index:t,model:s,isFirst:i,isLast:n,onEdit:d,onMoveUp:c,onMoveDown:m,onRemove:x}){let{attributes:p,listeners:u,setNodeRef:h,transform:b,isDragging:f}=(0,r.gl)({id:e}),g={transform:o.Ks.Transform.toString(b),opacity:f?.4:1,zIndex:f?999:void 0},[j,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(s),k=()=>{let e=N.trim();e&&e!==s?d(e):w(s),v(!1)};return(0,l.jsxs)("div",{ref:h,style:g,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${f?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,l.jsx)("button",{...p,...u,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-text-muted hover:text-primary active:cursor-grabbing shrink-0",title:"Drag to reorder",children:(0,l.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,l.jsx)("circle",{cx:"9",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"20",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"20",r:"2"})]})}),(0,l.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:t+1}),j?(0,l.jsx)("input",{autoFocus:!0,value:N,onChange:e=>w(e.target.value),onBlur:k,onKeyDown:e=>{"Enter"===e.key&&k(),"Escape"===e.key&&(w(s),v(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,l.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>v(!0),title:"Click to edit",children:s}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,l.jsx)("button",{onClick:c,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,l.jsx)("button",{onClick:m,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,l.jsx)("button",{onClick:x,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function v({isOpen:e,combo:t,onClose:s,onSave:o,activeProviders:c,kindFilter:x=null}){let[p,u]=(0,a.useState)(t?.name||""),[h,b]=(0,a.useState)(t?.models||[]),[f,g]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(""),[C,S]=(0,a.useState)({}),$=(0,i.FR)((0,i.MS)(i.AN,{activationConstraint:{distance:5}}),(0,i.MS)(i.uN,{coordinateGetter:r.JR})),A=h.map((e,t)=>({uid:`item-${t}`,model:e})),M=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();S(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,a.useEffect)(()=>{e&&M()},[e]);let E=e=>e.trim()?m.test(e)?(k(""),!0):(k("Only letters, numbers, -, _ and . allowed"),!1):(k("Name is required"),!1),P=async()=>{E(p)&&(N(!0),await o({name:p.trim(),models:h}),N(!1))},O=!!t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.aF,{isOpen:e,onClose:s,title:O?"Edit Combo":"Create Combo",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(d.pd,{label:"Combo Name",value:p,onChange:e=>{let t=e.target.value;u(t),t?E(t):k("")},placeholder:"my-combo",error:w}),(0,l.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===h.length?(0,l.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,l.jsx)(i.Mp,{sensors:$,collisionDetection:i.fp,onDragEnd:e=>{let{active:t,over:s}=e;if(s&&t.id!==s.id){let e=A.findIndex(e=>e.uid===t.id),l=A.findIndex(e=>e.uid===s.id);-1!==e&&-1!==l&&b(t=>(0,r.be)(t,e,l))}},modifiers:[n.FN,n.gj],children:(0,l.jsx)(r.gB,{items:A.map(e=>e.uid),strategy:r._G,children:(0,l.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:A.map(({uid:e,model:t},s)=>(0,l.jsx)(y,{id:e,index:s,model:t,isFirst:0===s,isLast:s===A.length-1,onEdit:e=>{let t=[...h];t[s]=e,b(t)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...h];[t[e-1],t[e]]=[t[e],t[e-1]],b(t)})(s),onMoveDown:()=>(e=>{if(e===h.length-1)return;let t=[...h];[t[e],t[e+1]]=[t[e+1],t[e]],b(t)})(s),onRemove:()=>{b(h.filter((e,t)=>t!==s))}},e))})})}),(0,l.jsxs)("button",{onClick:()=>g(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,l.jsx)(d.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,l.jsx)(d.$n,{onClick:P,fullWidth:!0,size:"sm",disabled:!p.trim()||!!w||j,children:j?"Saving...":O?"Save":"Create"})]})]})}),(0,l.jsx)(d.rq,{isOpen:f,onClose:()=>g(!1),onSelect:e=>{h.includes(e.value)||b([...h,e.value])},onDeselect:e=>{b(h.filter(t=>t!==e.value))},activeProviders:c,modelAliases:C,title:"Add Model to Combo",kindFilter:x,addedModelValues:h,closeOnSelect:!1})]})}},84680:(e,t,s)=>{"use strict";s.d(t,{PM:()=>l.PM,Sj:()=>l.Sj,Vy:()=>l.Vy,fF:()=>l.fF,sl:()=>l.sl,vL:()=>l.vL,y$:()=>l.y$,zM:()=>l.zM});var l=s(44923)}},e=>{e.O(0,[7504,5353,1321,5497,8441,3794,7358],()=>e(e.s=20018)),_N_E=e.O()}]);